当前位置: 首页>>代码示例>>PHP>>正文


PHP Tree::display_tree方法代码示例

本文整理汇总了PHP中Tree::display_tree方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::display_tree方法的具体用法?PHP Tree::display_tree怎么用?PHP Tree::display_tree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tree的用法示例。


在下文中一共展示了Tree::display_tree方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _index

 public function _index($navigation)
 {
     # There will always be a root_holder so no items is actually =1
     if ('1' == $navigation->navigation_items->count()) {
         return $this->wrap_tool('(no items)', 'navigation', $navigation);
     }
     $view = new View('public_navigation/lists/stock');
     $view->navigation = $navigation;
     # public node_generation function is contained in the tree class...
     $view->tree = Tree::display_tree('navigation', $navigation->navigation_items);
     return $this->wrap_tool($view, 'navigation', $navigation);
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:12,代码来源:navigation.php

示例2: manage

 function manage()
 {
     valid::id_key($this->pid);
     $navigation_items = ORM::factory('navigation_item')->where(array('fk_site' => $this->site_id, 'navigation_id' => $this->pid))->find_all();
     if (0 == $navigation_items->count()) {
         die('Error: this navigation has no root node.');
     }
     $pages = ORM::factory('page')->where('fk_site', $this->site_id)->find_all();
     $view = new View('edit_navigation/manage');
     $view->tree = Tree::display_tree('navigation', $navigation_items, NULL, NULL, 'render_edit_navigation', TRUE);
     $view->tool_id = $this->pid;
     $view->pages = $pages;
     die($view);
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:14,代码来源:edit_navigation.php

示例3: parse_tokens

 public function parse_tokens($body)
 {
     # NEWSLETTER TOKEN.
     str_replace('{{newsletter}}', '', $body, $count);
     if (0 < $count) {
         $pages_config = yaml::parse($this->site_name, 'pages_config');
         if (empty($pages_config['newsletter'])) {
             return $body;
         }
         $parent_id = explode('-', $pages_config['newsletter']);
         $parent_id = $parent_id['1'];
         # get the newsletter HTML.
         $newsletter = new Newsletter_Controller();
         $body = str_replace('{{newsletter}}', $newsletter->_index($parent_id), $body);
     }
     # ------------------------------------------------------
     # SHOWROOM TOKEN. format: {showroom_cats:parent_id:parameters}
     $pattern = '/{showroom_cats:(\\d+)\\:(\\w+)\\}/';
     if (0 < preg_match($pattern, $body, $match)) {
         # get the page name.
         $page_name = yaml::does_value_exist($this->site_name, 'pages_config', "showroom-{$match[1]}");
         if (!$page_name) {
             return $body;
         }
         # get the showroom category html.
         $showroom = ORM::factory('showroom', $match[1]);
         if (!$showroom->loaded) {
             return $body;
         }
         # how should the list be displayed?
         if (!empty($match[2]) and 'flat' == $match[2]) {
             # showing only root categories.
             $root_cats = ORM::factory('showroom_cat')->where(array('fk_site' => $this->site_id, 'showroom_id' => $showroom->id, 'local_parent' => $showroom->root_id))->orderby(array('lft' => 'asc'))->find_all();
             $categories = Tree::display_flat_tree('showroom', $root_cats, $page_name);
         } else {
             $categories = Tree::display_tree('showroom', $showroom->showroom_cats, $page_name);
         }
         $body = preg_replace($pattern, $categories, $body, 1);
     }
     /* -------------------------------------------- */
     # google map! format: {google_map:parent_id:parameters}
     $pattern = '/{google_map:(\\d+)\\:(\\w+)\\}/';
     if (0 < preg_match($pattern, $body, $match)) {
     }
     return $body;
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:46,代码来源:edit_tool.php

示例4: items_category

 private function items_category($page_name, $showroom, $category_id)
 {
     # get the parent to determine the view.
     if (!is_object($showroom)) {
         $showroom = ORM::factory('showroom', $showroom);
     }
     # get the category
     $category = ORM::factory('showroom_cat')->where(array('fk_site' => $this->site_id, 'showroom_id' => $showroom->id))->find($category_id);
     if (!$category->loaded) {
         return '<div class="not_found">Invalid category</div>';
     }
     # get any sub categories ...
     $sub_cats = ORM::factory('showroom_cat')->where(array('fk_site' => $this->site_id, 'showroom_id' => $showroom->id, 'lft >=' => "{$category->lft}", 'lft <=' => "{$category->rgt}"))->find_all();
     # create array from the cat and sub_cats
     $cat_ids = array();
     foreach ($sub_cats as $cat) {
         $cat_ids[] = $cat->id;
     }
     # get all the items.
     $items = ORM::factory('showroom_cat_item')->where(array('fk_site' => $this->site_id))->in('showroom_cat_id', $cat_ids)->find_all();
     if (0 == $items->count()) {
         return '<div class="not_found">No items. Check back soon!</div>';
     }
     $view = new View("public_showroom/display/{$showroom->view}");
     # do view stuff
     if ('gallery' == $showroom->view) {
         # request javascript file
         $view->request_js_files('lightbox/lightbox.js');
         # parse the params.
         $params = explode('|', $showroom->params);
         $view->columns = (isset($params[1]) and is_numeric($params[1])) ? $params[1] : 2;
         $view->thumb_size = (isset($params[2]) and is_numeric($params[2])) ? $params[2] : 75;
     }
     # get the path to this category
     $path = ORM::factory('showroom_cat')->where(array('fk_site' => $this->site_id, 'showroom_id' => $showroom->id, 'lft <' => $category->lft, 'rgt >' => $category->rgt, 'local_parent !=' => 0))->orderby(array('lft' => 'asc'))->find_all();
     $view->path = $path;
     $view->category = $category;
     $view->sub_categories = Tree::display_tree('showroom', $sub_cats, $page_name);
     $view->page_name = $page_name;
     $view->img_path = $this->assets->assets_url();
     $view->items = $items;
     return $view;
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:43,代码来源:showroom.php


注:本文中的Tree::display_tree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。