From c3ad40aaf52ab256a8a8b482fa917bd337691600 Mon Sep 17 00:00:00 2001 From: avl Date: Wed, 27 Jan 2010 15:41:57 +0200 Subject: [PATCH] (no commit message) --- ipf/form/field/treemodelchoice.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ipf/form/field/treemodelchoice.php b/ipf/form/field/treemodelchoice.php index ccec81c..c8f3e60 100644 --- a/ipf/form/field/treemodelchoice.php +++ b/ipf/form/field/treemodelchoice.php @@ -23,6 +23,11 @@ class IPF_Form_Field_TreeModelChoice extends IPF_Form_Field_Choice{ } return $levels; } + + protected function _addObject($o, &$choices,$level, $parent_id, $valname){ + $name = str_repeat("-", $level).$o['name']; + $choices[$name.' ('.$valname.$o->id.')'] = $valname.$o->id; + } protected function _collectTreeRecursive(&$choices,$level=0,$parent_id=null,$valname=''){ foreach($this->_models[$level]['objects'] as $o){ @@ -31,8 +36,7 @@ class IPF_Form_Field_TreeModelChoice extends IPF_Form_Field_Choice{ if ($parent_id!=$o->$foreign) continue; } - $name = str_repeat("-", $level).$o['name']; - $choices[$name.' ('.$valname.$o->id.')'] = $valname.$o->id; + $this->_addObject($o, &$choices,$level, $parent_id, $valname); if ($level<(count($this->_models)-1)){ $this->_collectTreeRecursive(&$choices,$level+1,$o->id,$valname.$o->id.'.'); } -- 2.49.0