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


PHP Tree::setTree方法代码示例

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


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

示例1: bm

 function get_header_gcategories($amount, $position, $brand_is_recommend = 1)
 {
     $gcategory_mod =& bm('gcategory', array('_store_id' => 0));
     $gcategories = array();
     if (!$amount) {
         $gcategories = $gcategory_mod->get_list(-1, true);
     } else {
         $gcategory = $gcategory_mod->get_list(0, true);
         $gcategories = $gcategory;
         foreach ($gcategory as $val) {
             $result = $gcategory_mod->get_list($val['cate_id'], true);
             $result = array_slice($result, 0, $amount);
             $gcategories = array_merge($gcategories, $result);
         }
     }
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
     $gcategory_list = $tree->getArrayList(0);
     $i = 0;
     $brand_mod =& m('brand');
     foreach ($gcategory_list as $k => $v) {
         $gcategory_list[$k]['top'] = isset($position[$i]) ? $position[$i] : '0px';
         $i++;
         $gcategory_list[$k]['brands'] = $brand_mod->find(array('conditions' => "tag = '" . $v['value'] . "' AND recommended=" . $brand_is_recommend, 'order' => 'sort_order asc,brand_id desc'));
     }
     return array('gcategories' => $gcategory_list);
 }
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:28,代码来源:main.widget.php

示例2: bm

 function _get_data()
 {
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $gcategory_mod =& bm('gcategory', array('_store_id' => 0));
         $gcategories = array();
         $brand_mod =& m('brand');
         if (empty($this->options['amount'])) {
             $gcategories = $gcategory_mod->get_list(-1, true);
         } else {
             $gcategory = $gcategory_mod->get_list(0, true);
             $gcategories = $gcategory;
             foreach ($gcategory as $val) {
                 $result = $gcategory_mod->get_list($val['cate_id'], true);
                 $result = array_slice($result, 0, $this->options['amount']);
                 $gcategories = array_merge($gcategories, $result);
             }
         }
         import('tree.lib');
         $tree = new Tree();
         $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
         $data = array('gcategories' => $tree->getArrayList(0), 'model_name' => $this->options['model_name'], 'brands' => $brand_mod->find(array('conditions' => "recommended = 1 AND if_show = 1", 'order' => 'sort_order', 'limit' => $this->_num)));
         $cache_server->set($key, $data, $this->_ttl);
     }
     return $data;
 }
开发者ID:dongfeihu,项目名称:estore,代码行数:28,代码来源:main.widget.php

示例3: intval

 function _get_data()
 {
     $this->options['amount'] = intval($this->options['amount']);
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $gcategory_mod =& bm('gcategory', array('_store_id' => 0));
         $gcategories = array();
         if (empty($this->options['amount'])) {
             $gcategories = $gcategory_mod->get_list(-1, true);
         } else {
             $gcategory = $gcategory_mod->get_list(0, true);
             $gcategories = $gcategory;
             foreach ($gcategory as $val) {
                 $result = $gcategory_mod->get_list($val['cate_id'], true);
                 $result = array_slice($result, 0, $this->options['amount']);
                 $gcategories = array_merge($gcategories, $result);
             }
         }
         import('tree.lib');
         $tree = new Tree();
         //LLL 商品分类挂件根据语言选择分类字段
         $lang2 = get_lang2();
         //like fr,sc etc...
         $gcategories = chg_array2_string($gcategories, 'cate_name', $lang2);
         $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
         $data = $tree->getArrayList(0);
         $cache_server->set($key, $data, $this->_ttl);
     }
     return $data;
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:32,代码来源:main.widget.php

示例4: getAreaTreeList

 public static function getAreaTreeList($city_id = 11)
 {
     //返回完整列表
     $list = self::getAllList($city_id);
     $tree = new Tree();
     $tree->setTree($list, 'TypeId', 'ParentId', 'TypeName', true);
     return $tree->getArrayList();
 }
开发者ID:emilymwang8,项目名称:cms,代码行数:8,代码来源:Advert.php

示例5: m

 function _list_scategory()
 {
     $scategory_mod =& m('scategory');
     $scategories = $scategory_mod->get_list(-1, true);
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($scategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getArrayList(0);
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:9,代码来源:category.app.php

示例6: m

 function _list_scategory()
 {
     $scategory_mod =& m('scategory');
     $scategories = $scategory_mod->get_list(-1, true);
     import('tree.lib');
     $tree = new Tree();
     $lang2 = get_lang2();
     //LLL 获取语言2个字母的代称,如fr, sc, en
     $scategories = chg_array2_string($scategories, 'cate_name', $lang2);
     //保留数组第二维字段字符串中指定语言的部分
     $tree->setTree($scategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getArrayList(0);
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:13,代码来源:category.app.php

示例7: m

 function _get_acategory_options($layer = 0)
 {
     $acategory_mod =& m('acategory');
     $acategories = $acategory_mod->get_list();
     foreach ($acategories as $key => $val) {
         if ($val['code'] == ACC_SYSTEM) {
             unset($acategories[$key]);
         }
     }
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($acategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getOptions($layer);
 }
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:14,代码来源:main.widget.php

示例8: index

 function index()
 {
     $where = array();
     if ($this->user_info->key != 'root') {
         $where = array('status >=' => 0);
     }
     $title = htmlspecialchars(trim($this->input->get_post("title")));
     $type = htmlspecialchars(trim($this->input->get_post("type")));
     $options = array('type' => $type ? $type : 'admin', 'where' => $where, 'order' => " order_id desc,cid desc");
     $lc_list = $this->model->getAll2Array($options);
     //查询所有信息
     $tree = new Tree();
     $tree->init($lc_list);
     if ($title) {
         $newTree = $tree->findTreeByName($title);
         if ($newTree) {
             $tree->setTree(array($newTree['cid'] => $newTree));
         }
     }
     $data = array('lc_tree' => $tree, 'type' => $type, 'title' => $title, 'fileter_options' => array('title' => $title), 'page' => '');
     $this->_template('admin/setting/columlist', $data);
 }
开发者ID:cordova2009,项目名称:SMA,代码行数:22,代码来源:colum.php

示例9: import

 function &_tree($acategories)
 {
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($acategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree;
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:7,代码来源:navigation.app.php

示例10: bm

 function _get_store_gcategory()
 {
     $gcategory_mod =& bm('gcategory', array('_store_id' => $this->_store_id));
     $gcategories = $gcategory_mod->get_list(-1, true);
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getArrayList(0);
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:9,代码来源:frontend.base.php

示例11: m

 function _get_scategory_options()
 {
     $mod =& m('scategory');
     $scategories = $mod->get_list();
     //LLL apply_app分类多语言
     $scategories = chg_array2_string($scategories, 'cate_name', get_lang2(), true);
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($scategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getOptions();
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:11,代码来源:apply.app.php

示例12: bm

 function _get_sgcategory_options()
 {
     $mod =& bm('gcategory', array('_store_id' => $this->_store_id));
     $gcategories = $mod->get_list();
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getOptions();
 }
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:9,代码来源:my_goods.app.php

示例13: import

 function &_tree($regions)
 {
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($regions, 'region_id', 'parent_id', 'region_name');
     return $tree;
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:7,代码来源:region.app.php

示例14: bm

 function _get_sgcategory_options()
 {
     $mod =& bm('gcategory', array('_store_id' => $this->_store_id));
     $gcategories = $mod->get_list();
     //LLL 本店所有商品分类多语言
     $gcategories = chg_array2_string($gcategories, 'cate_name', '', true);
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getOptions();
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:11,代码来源:my_goods.app.php

示例15: bm

 function _get_gcategory_options($layer = 0)
 {
     $gcategory_mod =& bm('gcategory', array('_store_id' => 0));
     $gcategories = $gcategory_mod->get_list();
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getOptions($layer);
 }
开发者ID:GavinLai,项目名称:ecmall,代码行数:9,代码来源:widget.base.php


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