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


PHP tree::toFormatTree方法代码示例

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


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

示例1: load

 public function load($param)
 {
     $key = $this->build_key(__CLASS__, $param);
     $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
     $cate_list = $GLOBALS['fcache']->get($key);
     if ($cate_list === false) {
         $pid = intval($param['pid']);
         $extwhere = $param['extwhere'];
         require_once APP_ROOT_PATH . "system/utils/child.php";
         require_once APP_ROOT_PATH . "system/utils/tree.php";
         $ids_util = new child("deal_cate");
         $ids = $ids_util->getChildIds($pid);
         $ids[] = $pid;
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_effect = 1 and is_delete = 0 and id in (" . implode(",", $ids) . ") {$extwhere} order by sort desc");
         foreach ($cate_list as $k => $v) {
             if ($v['uname'] != '') {
                 $curl = url("youhui", "ycate", array("id" => $v['uname']));
             } else {
                 $curl = url("youhui", "ycate", array("id" => $v['id']));
             }
             $cate_list[$k]['url'] = $curl;
             $sub_ids = $ids_util->getChildIds($v['id']);
             $sub_ids[] = $v['id'];
             $cate_list[$k]['count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and is_shop = 2 and cate_id in (" . implode(",", $sub_ids) . ")");
         }
         $tree_util = new tree();
         $cate_list = $tree_util->toFormatTree($cate_list, 'name');
         $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
         $GLOBALS['fcache']->set($key, $cate_list);
     }
     return $cate_list;
 }
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:32,代码来源:cache_youhui_cate_tree.auto_cache.php

示例2: load

 public function load($param)
 {
     $key = $this->build_key(__CLASS__, $param);
     $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
     $cate_list = $GLOBALS['fcache']->get($key);
     if ($cate_list === false) {
         $pid = intval($param['pid']);
         $is_all = intval($param['is_all']);
         require_once APP_ROOT_PATH . "system/utils/child.php";
         require_once APP_ROOT_PATH . "system/utils/tree.php";
         $ids_util = new child("shop_cate");
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where is_effect = 1 and is_delete = 0 order by sort desc,id desc");
         foreach ($cate_list as $k => $v) {
             $sort = array('0' => 'sort', '1' => 'id');
             $ids = $ids_util->getChildIds($v['pid'], "id", "pid", $sort);
             $ids[] = $v['pid'];
             if ($v['pid'] > 0 && !in_array($pid, $ids) && $is_all == 0) {
                 unset($cate_list[$k]);
             } else {
                 if ($v['uname'] != '') {
                     $curl = url("shop", "cate", array("id" => $v['uname']));
                 } else {
                     $curl = url("shop", "cate", array("id" => $v['id']));
                 }
                 $cate_list[$k]['url'] = $curl;
                 $sub_ids = $ids_util->getChildIds($v['pid'], "id", "pid", $sort);
                 $sub_ids[] = $v['id'];
                 $cate_list[$k]['count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and buy_type <> 1 and shop_cate_id in (" . implode(",", $sub_ids) . ")");
             }
         }
         $tree_util = new tree();
         $cate_list = $tree_util->toFormatTree($cate_list, 'name');
         $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
         $GLOBALS['fcache']->set($key, $cate_list);
     }
     return $cate_list;
 }
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:37,代码来源:cache_shop_cate_tree.auto_cache.php

示例3: investor_one

 public function investor_one()
 {
     require APP_ROOT_PATH . 'system/utils/tree.php';
     //股权众筹 发起项目项目基本信息
     if (!$GLOBALS['user_info']) {
         app_redirect(url_wap("user#login"));
     }
     if (app_conf("INVEST_STATUS") == 1) {
         showErr("股权众筹已经关闭");
     }
     $id = intval($_REQUEST['id']);
     if ($id > 0) {
         $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0  ");
         if (empty($deal_item)) {
             showErr("该项目不存在");
         }
         if ($deal_item['user_id'] != intval($GLOBALS['user_info']['id'])) {
             showErr("您没有该项目的权限!");
         }
     }
     $show_html = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "help where id=7");
     $GLOBALS['tmpl']->assign('show_html', $show_html);
     $cate_list_str = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
     $tree = new tree();
     $cate_list = $tree->toFormatTree($cate_list_str);
     $GLOBALS['tmpl']->assign("cate_list", $cate_list);
     if ($deal_item) {
         $GLOBALS['tmpl']->assign("page_title", $deal_item['name']);
         $region_pid = 0;
         $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc");
         //二级地址
         foreach ($region_lv2 as $k => $v) {
             if ($v['name'] == $deal_item['province']) {
                 $region_lv2[$k]['selected'] = 1;
                 $region_pid = $region_lv2[$k]['id'];
                 break;
             }
         }
         $GLOBALS['tmpl']->assign("region_lv2", $region_lv2);
         if ($region_pid > 0) {
             $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where pid = " . $region_pid . " order by py asc");
             //三级地址
             foreach ($region_lv3 as $k => $v) {
                 if ($v['name'] == $deal_item['city']) {
                     $region_lv3[$k]['selected'] = 1;
                     break;
                 }
             }
             $GLOBALS['tmpl']->assign("region_lv3", $region_lv3);
         }
         $deal_item['business_create_time'] = to_date($deal_item['business_create_time'], 'Y-m-d');
         $deal_item['limit_price'] = $deal_item['limit_price'] / 10000;
         $deal_item['invote_mini_money'] = $deal_item['invote_mini_money'] / 10000;
         //资质证明
         $audit_data_list = unserialize($deal_item['audit_data']);
         $GLOBALS['tmpl']->assign("audit_data_list", $audit_data_list);
         $GLOBALS['tmpl']->assign("deal_item", $deal_item);
         $GLOBALS['tmpl']->display("investor_one.html");
     } else {
         if (!$GLOBALS['user_info']) {
             app_redirect(url_wap("user#login"));
         }
         $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc");
         //二级地址
         $GLOBALS['tmpl']->assign("region_lv2", $region_lv2);
         $deal_image = es_session::get("deal_image");
         $GLOBALS['tmpl']->assign("deal_image", $deal_image);
         $GLOBALS['tmpl']->display("investor_one.html");
     }
 }
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:70,代码来源:project.action.php


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