From: avl Date: Wed, 27 Jan 2010 13:41:57 +0000 (+0200) Subject: (no commit message) X-Git-Tag: 0.5~364 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=c3ad40aaf52ab256a8a8b482fa917bd337691600;p=ipf.git (no commit message) --- 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.'.'); }