--- ./old/Memory.php 2003-07-03 19:45:39.000000000 +0200
+++ ./new/Memory.php 2003-12-02 10:55:47.000000000 +0100
@@ -268,8 +268,8 @@
if ($this->debug) {
$endTime = split(" ",microtime());
$endTime = $endTime[1]+$endTime[0];
- print " reading and preparing tree data took: ".
- ($endTime - $startTime)."
";
+ echo ' reading and preparing tree data took: '.
+ ($endTime - $startTime).'
';
}
return $this->_setup($res);
@@ -306,8 +306,21 @@
$this->children = array();
// build an array where all the parents have their children as a member
// this i do to speed up the buildStructure
+ $columnNameMappings = $this->getOption('columnNameMaps');
foreach ($setupData as $values) {
if (is_array($values)) {
+ //Added this foreach because of NOTICE: Undefined index: [l|r]
+ //Sometimes Undefined index: parent.
+ //FIXME!! This is just a quick hack, but it shouldn't be necessary
+ //if index were dealt with properly!!
+ foreach ($values as $oldKey=>$constVal) {
+ //if(array_key_exists($oldKey, $columnNameMappings)) {
+ if (in_array($oldKey, array('left', 'right'))) {
+ $values[$columnNameMappings[$oldKey]] = $constVal;
+ unset($values[$oldKey]);
+ }
+ }
+
$this->data[$values['id']] = $values;
$this->children[$values['parentId']][] = $values['id'];
}
@@ -382,7 +395,7 @@
if ($this->debug) {
$endTime = split(" ",microtime());
$endTime = $endTime[1]+$endTime[0];
- print(" building took: ".($endTime - $startTime)."
");
+ echo ' building took: '.($endTime - $startTime).'
';
}
// build the property 'structure'
@@ -408,7 +421,7 @@
if ($this->debug) {
$endTime = split(" ",microtime());
$endTime = $endTime[1]+$endTime[0];
- print(" buildStructure took: ".($endTime - $startTime)."
");
+ echo ' buildStructure took: '.($endTime - $startTime).'
';
}
return true;
}
@@ -1062,11 +1075,11 @@
* @param string the path to search for
* @param integer the id where to search for the path
* @param string the name of the key that contains the node name
- * @param string the path seperator
+ * @param string the path separator
* @return integer the id of the searched element
*
*/
- function &getElementByPath($path,$startId=0,$nodeName='name',$seperator='/')
+ function &getElementByPath($path, $startId=0, $nodeName='name', $separator='/')
{
$id = $this->getIdByPath($path,$startId);
if ($id) {
@@ -1110,6 +1123,7 @@
function &getChild($id)
{
return $this->_getElement($id, 'child');
+
}
// }}}
@@ -1206,11 +1220,11 @@
* @param string $path the path to search for
* @param integer $startId the id where to search for the path
* @param string $nodeName the name of the key that contains the node name
- * @param string $seperator the path seperator
+ * @param string $separator the path separator
* @return integer the id of the searched element
*
*/
- function getIdByPath($path, $startId=0, $nodeName = 'name', $seperator = '/')
+ function getIdByPath($path, $startId=0, $nodeName='name', $separator='/')
// should this method be called getElementIdByPath ????
{
// if no start ID is given get the root
@@ -1223,10 +1237,10 @@
}
}
- if (strpos($path,$seperator)===0) { // if a seperator is at the beginning strip it off
- $path = substr($path,strlen($seperator));
+ if (strpos($path, $separator) === 0) { // if a separator is at the beginning strip it off
+ $path = substr($path, strlen($separator));
}
- $nodes = explode($seperator,$path);
+ $nodes = explode($separator, $path);
$curId = $startId;
foreach ($nodes as $key=>$aNodeName) {
$nodeFound = false;
@@ -1247,7 +1261,6 @@
return false;
}
}
-
return $curId;
// FIXXME to be implemented
}
@@ -1453,33 +1466,35 @@
// if $node is an array, we assume it is a collection of elements
if (!is_array($node)) {
$nodes = $this->getNode($node);
+ } else {
+ $nodes = $node;
}
// if $node==0 then the entire tree is retreived
if (sizeof($node)) {
- print '
| name | ';
+ echo '| name | ';
$keys = array();
foreach ($this->getRoot() as $key=>$x) {
if (!is_array($x)) {
- print "$key | ";
+ echo ''.$key.' | ';
$keys[] = $key;
}
}
- print '
';
+ echo '';
foreach ($nodes as $aNode) {
- print '| ';
+ echo ' |
| ';
$prefix = '';
for($i=0;$i<$aNode['level'];$i++) $prefix .= '- ';
- print "$prefix {$aNode['name']} | ";
+ echo "$prefix {$aNode['name']}";
foreach ($keys as $aKey) {
if (!is_array($key)) {
$val = isset($aNode[$aKey]) ? $aNode[$aKey] : ' ';
- print "$val | ";
+ echo ''.$val.' | ';
}
}
- print '
';
+ echo '';
}
- print '
';
+ echo '
|---|
';
}
}
@@ -1526,7 +1541,7 @@
$this->getNode
foreach($this->data[$srcId] as $key=>$value)
- print("$key=>$value
");
+ echo "$key=>$value
";
*/
}