本文整理汇总了PHP中Tree::getArrayList方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::getArrayList方法的具体用法?PHP Tree::getArrayList怎么用?PHP Tree::getArrayList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::getArrayList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例7: 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);
}
示例8: bm
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);
}