35 public function __construct(&$objectArr, $myId, $parentId, $rootId =
null)
37 $this->_objects =& $objectArr;
39 $this->_parentId = $parentId;
41 $this->_rootId = $rootId;
53 foreach (array_keys($this->_objects) as $i) {
54 $key1 = $this->_objects[$i]->getVar($this->_myId);
55 $this->_tree[$key1][
'obj'] =& $this->_objects[$i];
56 $key2 = $this->_objects[$i]->getVar($this->_parentId);
57 $this->_tree[$key1][
'parent'] = $key2;
58 $this->_tree[$key2][
'child'][] = $key1;
59 if (isset($this->_rootId)) {
60 $this->_tree[$key1][
'root'] = $this->_objects[$i]->getVar($this->_rootId);
135 if (isset($this->_tree[$key][
'parent'], $this->_tree[$this->_tree[$key][
'parent']][
'obj'])) {
136 $ret[$uplevel] =& $this->_tree[$this->_tree[$key][
'parent']][
'obj'];
137 $parents =& $this->
getAllParent($this->_tree[$key][
'parent'], $ret, $uplevel+1);
138 foreach (array_keys($parents) as $newkey) {
139 $ret[$newkey] =& $parents[$newkey];
159 public function _makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr =
'')
162 $value = $this->_tree[$key][
'obj']->getVar($this->_myId);
163 $ret .=
'<option value="'.$value.
'"';
164 if ($value == $selected) {
165 $ret .=
' selected="selected"';
167 $ret .=
'>'.$prefix_curr.$this->_tree[$key][
'obj']->getVar($fieldName).
'</option>';
168 $prefix_curr .= $prefix_orig;
170 if (isset($this->_tree[$key][
'child']) && !empty($this->_tree[$key][
'child'])) {
171 foreach ($this->_tree[$key][
'child'] as $childkey) {
172 $this->
_makeSelBoxOptions($fieldName, $selected, $childkey, $ret, $prefix_orig, $prefix_curr);