Changeset 91 for branches/1.1dev/lib/Hierarchy.inc.php
- Timestamp:
- Apr 9, 2006 3:39:08 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1dev/lib/Hierarchy.inc.php
r90 r91 354 354 $child_id =& $this->child_id; 355 355 } else { 356 logMsg(_("getParents failed. Arguments not specified properly."), LOG_ERR, __FILE__, __LINE__);356 logMsg(_("getParents failed. Arguments not specified properly."), resource_tbl, __FILE__, __LINE__); 357 357 return false; 358 358 } … … 402 402 $child_id =& $this->child_id; 403 403 } else { 404 logMsg(_("getNode failed. Arguments not specified properly."), LOG_ERR, __FILE__, __LINE__);404 logMsg(_("getNode failed. Arguments not specified properly."), resource_tbl, __FILE__, __LINE__); 405 405 return false; 406 406 } … … 408 408 409 409 $qid = dbQuery(" 410 SELECT child_type, child_id, title, subnode_quantity410 SELECT * 411 411 FROM node_tbl 412 412 WHERE child_type = '" . mysql_real_escape_string($child_type) . "' … … 443 443 $child_id =& $this->child_id; 444 444 } else { 445 logMsg(_("getChildren failed. Arguments not specified properly."), LOG_ERR, __FILE__, __LINE__);445 logMsg(_("getChildren failed. Arguments not specified properly."), resource_tbl, __FILE__, __LINE__); 446 446 return false; 447 447 } … … 492 492 $child_id =& $this->child_id; 493 493 } else { 494 logMsg(_("getNumberChildren failed. Arguments not specified properly."), LOG_ERR, __FILE__, __LINE__);494 logMsg(_("getNumberChildren failed. Arguments not specified properly."), resource_tbl, __FILE__, __LINE__); 495 495 return false; 496 496 } … … 530 530 $child_id =& $this->child_id; 531 531 } else { 532 logMsg(_("isLeaf failed. Arguments not specified properly."), LOG_ERR, __FILE__, __LINE__);532 logMsg(_("isLeaf failed. Arguments not specified properly."), resource_tbl, __FILE__, __LINE__); 533 533 return false; 534 534 } … … 641 641 $child_id =& $this->child_id; 642 642 } else { 643 logMsg(_("nodeExists failed. Arguments not specified properly."), LOG_ERR, __FILE__, __LINE__);643 logMsg(_("nodeExists failed. Arguments not specified properly."), resource_tbl, __FILE__, __LINE__); 644 644 return false; 645 645 } … … 748 748 } 749 749 750 function convertListToTree($curr, $child_type=null, $child_id=null, $_ return_flag=true)750 function convertListToTree($curr, $child_type=null, $child_id=null, $_indent=0) 751 751 { 752 752 if (!is_array($curr) || empty($curr)) { … … 757 757 static $children_map; 758 758 static $node_map; 759 759 760 760 // The original $curr contains the full list. Save a copy of this. 761 761 if (!isset($orig)) { … … 765 765 $children_map = array(); 766 766 foreach ($orig as $i => $n) { 767 $n_parent = $this->toStringID($n['parent_type'], $n['parent_id']);767 $n_parent = ('' != $n['parent_type'] && '' != $n['parent_id']) ? $this->toStringID($n['parent_type'], $n['parent_id']) : 'null__00'; 768 768 $n_child = $this->toStringID($n['child_type'], $n['child_id']); 769 769 $children_map[$n_parent][] = $n_child; … … 786 786 } 787 787 } 788 788 789 if (!isset($curr['indent'])) { 790 $curr['indent'] = $_indent; 791 } 792 789 793 // Get children of current node. 790 794 $curr_str_id = $this->toStringID($curr['child_type'], $curr['child_id']); … … 794 798 if (!empty($curr_children)) { 795 799 foreach ($curr_children as $child) { 796 $curr['children'][] = $this->convertListToTree($orig[$node_map[$child]], null, null, false);797 } 798 } 799 800 if ($_ return_flag) {800 $curr['children'][] = $this->convertListToTree($orig[$node_map[$child]], null, null, $_indent + 1); 801 } 802 } 803 804 if ($_indent === 0) { 801 805 // We must reset the static variables so that they do 802 806 // not fill up during subsequent function calls.
Note: See TracChangeset
for help on using the changeset viewer.