protected static function getsubcategories($parent, array $postitems, $exclude = false) { $result = ''; $categories = tcategories::i(); $html = tadminhtml::getinstance('editor'); $tml = str_replace('$checkbox', $html->getinput('checkbox', 'category-$id', 'value="$id" $checked', '$title'), $html->category); $args = new targs(); foreach ($categories->items as $id => $item) { if ($parent != $item['parent']) { continue; } if ($exclude && in_array($id, $exclude)) { continue; } $args->add($item); $args->checked = in_array($item['id'], $postitems); $args->subcount = ''; $args->subitems = self::getsubcategories($id, $postitems); $result .= $html->parsearg($tml, $args); } if ($result == '') { return ''; } return sprintf($html->categories(), $result); }