本文整理匯總了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);
}