/** treePage строит страницу из дерева типов или вовзвращяет false если страница на найденна * * */ private function treePage($link) { $nodes = K_TreeQuery::crt($link)->go(array('aliases' => true)); $metaParams['pageArgs'] = $this->pageArgs; $metaParams['link'] = $this->paramLink; // var_dump($link); Ссылка поиска страницы к дереву типов $this->meta = $metaParams; // echo $link; // echo '<br/>'; $this->staticPage = $nodes[0]; // проверка на страницу к кторой идёт запрос // var_dump($nodes); $this->view->leftMenu = $this->genLeftMenu(); // takeoff - генерируем меню if (!$nodes[0] || $nodes[0]['tree_type'] != 'page') { //понимаем что запрос к странице по типу //echo $this->paramLink; //echo $this->paramLink; $TQnode = K_TreeQuery::crt($this->paramLink); $nodeMeta = $TQnode->getUseNode(); // запрашиваем блоки для этой ноды, в /page_types/, в зависимости от типа вывода, списка или одного итема // если тип ноды папка, то ищим не по типу а по названию. if ($nodeMeta['tree_type'] == "folder" || $nodeMeta['tree_type'] == "list") { $typeP = $nodeMeta['tree_name']; $this->howShow = 'list'; } else { $typeP = $nodeMeta['tree_type']; } $TQnode = K_TreeQuery::crt('/page_types/' . $typeP . '/' . $howShow . '/'); if ($TQnode->getUseNode()) { $nodeItem = $TQnode->go(array('aliases' => true)); } else { $this->howShow = $this->howShow == 'list' ? 'item' : 'list'; $TQnode = K_TreeQuery::crt('/page_types/' . $typeP . '/' . $this->howShow . '/'); $nodeItem = $TQnode->go(array('aliases' => true)); } // echo '/page_types/'.$typeP.'/'.$howShow.'/' ; //запрашиваем ноду по линку запроса if ($this->howShow == 'list' || $nodeMeta['tree_type'] == "folder" || $nodeMeta['tree_type'] == "list") { if ($nodeItem[0]['tree_type'] == 'filter') { $filterArr = $nodeItem[0]; } $offset = $this->pageArgs['num'] * $this->pageArgs['count'] - $this->pageArgs['count']; if ($filterArr) { $filterTypes = array_map('trim', explode(',', $filterArr['types'])); $ordered = json_decode(stripcslashes($filterArr['group']), true); $treeObj = K_TreeQuery::crt($this->paramLink)->types($filterArr['types'])->order($ordered)->limit($this->pageArgs['count'], $offset); if ($filterArr['condition']) { $treeObj->condit(array($filterArr['types'] => ' ' . $filterArr['condition'])); } list($paramNode, $metaParams['count']) = $treeObj->go(array('test' => true, 'count' => true, 'orderby' => array('DESC', 'DESC'))); } else { list($paramNode, $metaParams['count']) = K_TreeQuery::crt($this->paramLink)->limit($this->pageArgs['count'], $offset)->go(array('aliases' => true, 'childs' => true, 'test' => true, 'count' => true)); } $this->howShow = 'list'; } else { $nodesR = K_TreeQuery::gNodes($this->paramLink, 1); $paramNode = $nodesR[0]; } //var_dump($this->paramLink); // K_debug::get()->addMessage('link '.'/page_types/'.$paramNode['tree_type'].'/'); // K_debug::get()->dump($nodeItem); // запрашиваем информацию для этой ноды // $paramNode= cTree::gNodes($this->paramLink,1); // K_debug::get()->dump($paramNode); $this->view->prevNextActive = false; // var_dump($paramNode); // var_dump($nodeItem[0]); if ($nodeItem[0] && $paramNode) { // страница итема K_JsParams::add('nowShow', $this->howShow); $this->view->title = $nodeMeta['title']; $this->view->mkeys = $nodeMeta['mkeys']; $this->view->mdesc = $nodeMeta['mdesc']; $this->view->activeMenu = $nodeMeta['activemenu']; $this->view->node = $this->nodeItem =& $paramNode; $metaParams['link'] = $this->paramLink; $this->meta = $metaParams; //строим блоки и станицу итема $blocks = $this->getBlocks($nodeItem); $this->view->breadcrumbs = K_breadcrumbs::get(); // echo $typeP.' - '.$howShow; $blocks['middle'][] = K_Request::call(array('module' => 'typebloks', 'controller' => $typeP, 'action' => $this->howShow, 'params' => array('node' => $paramNode, 'meta' => $metaParams))); $this->view->content = $blocks; } else { return false; } } else { // кастомная страница // $this->view->title = $nodes[0]['title']; // $this->view->mkeys = $nodes[0]['mkeys']; // $this->view->mdesc = $nodes[0]['mdesc']; K_Seo::set($nodes[0]); //$this->view->currentMenuItem = $this->paramLink; //строим блоки и кастомную страницу $this->view->content = $this->getBlocks($nodes); $this->view->breadcrumbs = K_breadcrumbs::get(); // K_debug::get()->addMessage('node '.$nodes[0]['tree_type']); // K_debug::get()->dump($nodes); } $this->view->title = K_Seo::$title; $this->view->mkeys = K_Seo::$keywords; $this->view->mdesc = K_Seo::$description; $this->view->canonical = K_Seo::$canonical; // $this->view->menuItems = K_TreeQuery::crt($this->view->node['menu'])->type('link')->go(array('childs'=>true)); $this->view->jsGlobalOptions = K_JsParams::output(); return trim($link, '/'); }
public function go($more = array()) { $more = array_merge(array('cascade' => false, "childs" => false, "test" => false, 'count' => false, 'aliases' => false), $more); return K_TreeQuery::gNodes(array("id" => !empty($this->nid) ? $this->nid : 0, "limit" => !empty($this->limit) ? $this->limit : false, "offset" => !empty($this->offset) ? $this->offset : 0, "types" => !empty($this->types) ? $this->types : false, "condit" => !empty($this->condit) ? $this->condit : '', 'filter' => !empty($this->filter) ? $this->filter : false, "idIndex" => !empty($this->idIndex) ? $this->idIndex : false, "joins" => !empty($this->joins) ? $this->joins : false, "group" => !empty($this->group) ? $this->group : false, "order" => !empty($this->order) ? $this->order : false, "more" => $more), false, $this->parentNodeData); }