コード例 #1
0
ファイル: s.php プロジェクト: rigidus/ea
 function childTree($array, $parent)
 {
     $childs = '';
     if (isset($array[$parent])) {
         $display = cookie::rcoll(self::$tree_key, $parent);
         $tpl_rr = self::$tree_item[self::$tree_key];
         preg_match_all(self::$regex_sections, $tpl_rr, $out_sections);
         foreach ($array[$parent] as $d => $v) {
             $tpl_r = $tpl_rr;
             /* sections */
             if ($out_sections) {
                 foreach ($out_sections[1] as $g => $t) {
                     if (!isset($v[$t])) {
                         $tpl_r = str_replace($out_sections[0][$g], '', $tpl_r);
                     }
                 }
             }
             $tpl_r = preg_replace('/{{(.*?)}}/i', '', $tpl_r);
             /* end sections */
             $v['tree_child'] = self::childTree($array, $d);
             $childs .= self::parseVars($tpl_r, $v);
         }
         $tree_tmpl = self::$tree_tmpl[self::$tree_key];
         if ($parent != 0) {
             $tree_tmpl = str_replace('{index}', $parent, $tree_tmpl);
             $tree_tmpl = str_replace('{display}', $display, $tree_tmpl);
         }
         $childs = str_replace(self::$tree_item_r[self::$tree_key], $childs, $tree_tmpl);
     }
     return $childs;
 }