本文整理汇总了PHP中tree::get_tree_array方法的典型用法代码示例。如果您正苦于以下问题:PHP tree::get_tree_array方法的具体用法?PHP tree::get_tree_array怎么用?PHP tree::get_tree_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tree
的用法示例。
在下文中一共展示了tree::get_tree_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* 显示编辑商品表单
*/
public function edit()
{
// 初始化返回结构体
$return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
try {
// 初始化返回数据
$return_data = array();
// 收集请求数据
$request_data = $this->input->get();
if (empty($request_data['id'])) {
throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400);
}
$product = BLL_Product::get($request_data['id']);
if (empty($product['id'])) {
throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400);
}
// 分类列表默认关联第一个
$categorys_tree = CategoryService::get_instance()->get_tree("<option value=\\\"\$id\\\" \$selected>\$spacer\$title</option>", $product['category_id']);
$categories = CategoryService::get_instance()->query_assoc(array());
$categories = tree::get_tree_array($categories);
$classifies = ClassifyService::get_instance()->index(array('orderby' => array('id' => 'ASC')));
$classify_content['features'] = $this->load_features($product['classify_id'], $product['fetuoptrs']);
$classify_content['brands'] = $this->load_brands($product['classify_id'], $product['brand_id']);
// 处理商品类型特定的模板区块
$ptype_layout = NULL;
switch ($product['type']) {
case ProductService::PRODUCT_TYPE_ASSEMBLY:
throw new MyRuntimeException('Coming soon ...', 400);
//暂时不支持组合商品
$ptype_layout = new View($this->package_name . '/' . $this->class_name . '/assembly/layout');
break;
case ProductService::PRODUCT_TYPE_CONFIGURABLE:
$ptype_layout = new View($this->package_name . '/' . $this->class_name . '/configurable/layout');
break;
case ProductService::PRODUCT_TYPE_GOODS:
default:
$ptype_layout = new View($this->package_name . '/' . $this->class_name . '/simple/layout');
break;
}
$ptype_layout->product = $product;
$return_struct['content'] = array('product' => $product);
//* 请求类型 */
if ($this->is_ajax_request()) {
// ajax 请求
// json 输出
$this->template->content = $return_struct;
} else {
// html 输出
//* 模板输出 */
$this->template->return_struct = $return_struct;
$content = new View($this->package_name . '/' . $this->class_name . '/' . __FUNCTION__);
//* 变量绑定 */
$this->template->title = Kohana::config('site.name');
$this->template->content = $content;
//* 请求结构数据绑定 */
$this->template->content->request_data = $request_data;
//* 返回结构体绑定 */
$this->template->content->return_struct = $return_struct;
$this->template->content->categorys_tree = $categorys_tree;
$this->template->content->categories = $categories;
$this->template->content->classifies = $classifies;
$this->template->content->classify_content = $classify_content;
$this->template->content->ptype_layout = $ptype_layout;
$this->template->content->listurl = isset($request_data['listurl']) ? $request_data['listurl'] : '';
}
// end of request type determine
} catch (MyRuntimeException $ex) {
$this->_ex($ex, $return_struct, $request_data);
}
}