Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 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);
 }
Ejemplo n.º 8
0
 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);
 }
Ejemplo n.º 9
0
 function &_tree($acategories)
 {
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($acategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree;
 }
Ejemplo n.º 10
0
 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);
 }
Ejemplo n.º 11
0
 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();
 }
Ejemplo n.º 12
0
 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();
 }
Ejemplo n.º 13
0
 function &_tree($regions)
 {
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($regions, 'region_id', 'parent_id', 'region_name');
     return $tree;
 }
Ejemplo n.º 14
0
 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();
 }
Ejemplo n.º 15
0
 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);
 }
Ejemplo n.º 16
0
 function _get_scategory_options()
 {
     $mod =& m('scategory');
     $scategories = $mod->get_list();
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($scategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getOptions();
 }
Ejemplo n.º 17
0
 function _get_store_gcategory()
 {
     $gcategory_mod =& bm('gcategory', array('_store_id' => $this->_store_id));
     $gcategories = $gcategory_mod->get_list(-1, true);
     //LLL store gcategories里面的cate_name部分仅保留对应语言的字符 frontend.base, store中的商品分类
     $gcategories = chg_array2_string($gcategories, 'cate_name', get_lang2());
     import('tree.lib');
     $tree = new Tree();
     $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
     return $tree->getArrayList(0);
 }