getTpl($this->templ, 'body'); $tpli = $R->getTpl($this->templ, 'item'); $tplis = $R->getTpl($this->templ, 'item_sel'); $tplsep = $R->getTpl($this->templ, 'sep'); if (!$this->root) { if (isset($this->autoLevel) && $this->autoLevel) { $this->autoLevel = intval($this->autoLevel); // Приводим к числу $path = $cat->getPath(); if (count($path) == 1) return ''; $path = array_reverse($path); if ($this->autoLevel > count($path)) { $this->autoLevel = count($path) - 1; } $this->root = $path[$this->autoLevel]; } else { $this->root = $cat->cat; } } $this->obj = new cobject(__REAL_CAT_OBJ_); $sql_where = ''; if ($this->noexit) { $sql_where = ' AND id not in (18) '; global $auth; if ($auth->is_login) { $tpl = $R->set('current_user_name', $auth->user_obj->assign('{name}'), $tpl); } } $tpl = $R->set('root', 'root'.crc32($this->root), $tpl); $db2 = $core_db->q($this->obj->getSelect(' AND `cat_id` = "'.db_escape_string($this->root).'"')); if ($db2->nr()) { $this->obj->lRow($db2); $tpl = $this->obj->assign($tpl); } $db2 = $core_db->q($this->obj->getSelect(' AND `parent_cat` = "' . $this->root . '" AND `_sys_unvisible` = "0" '.$sql_where.' ORDER BY `_sys_order`')); $first = true; while ($db2->r()) { $this->obj->lRow($db2); if (!in_array($db2->f('cat_id'), $cat->path)) { $tt = $this->obj->assign($tpli); } else { $tt = $this->obj->assign($tplis); } if ($first) { $first = false; } else { $tpl = $R->parse('menu_item', $tplsep, $tpl); } $tpl = $R->parse('menu_item', $tt, $tpl); } return $R->clear($tpl); } } ?>