• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Tree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: gettree

 function gettree()
 {
     $model = new Tree();
     $tree = $model->getTree();
     View::$layout = 'empty';
     View::render('fields/parenttree', array('tree' => $tree));
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:7,代码来源:FieldsController.php


示例2: _get_data

 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;
 }
开发者ID:dongfeihu,项目名称:estore,代码行数:28,代码来源:main.widget.php


示例3: doSearch

 function doSearch()
 {
     $keyword = $_REQUEST['keyword'];
     $filter_keyword = '%' . $keyword . '%';
     $page_num = $_REQUEST['page_num'] ? $_REQUEST['page_num'] : 1;
     //get ids
     $q = "select id from trees where title like ? or description like ? ";
     $st = $this->dbconn->Prepare($q);
     $r1 = $this->dbconn->getAll($st, array($filter_keyword, $filter_keyword));
     $q = "select tree_id from tree_parameters where value like ? or node like ? ";
     $st = $this->dbconn->Prepare($q);
     $r2 = $this->dbconn->getAll($st, array($filter_keyword, $filter_keyword));
     $q = "select t.id from trees t LEFT JOIN users u ON u.id= t.user_id where u.name like ? or u.description like ? or u.email like ?  ";
     $st = $this->dbconn->Prepare($q);
     $r3 = $this->dbconn->getAll($st, array($filter_keyword, $filter_keyword, $filter_keyword));
     $r = array_merge($r1, $r2, $r3);
     $r_ids = array();
     foreach ($r as $row) {
         $r_ids[] = $row[0];
     }
     rsort($r_ids);
     $pages_count = round(count($r_ids) / 10 + 0.4);
     $tree_model = new Tree($this->dbconn);
     $trees = $tree_model->fetchAll(array('filter' => " WHERE id in (" . implode(",", $r_ids) . ") LIMIT " . ($page_num - 1) * 10 . ",10", 'values' => array()), 'all');
     $this->smarty->Assign('keyword', $keyword);
     $this->smarty->Assign('trees', $trees);
     $this->smarty->Assign('page_num', $page_num);
     $this->smarty->Assign('pages_count', $pages_count);
     $this->display('Search/result.tpl');
 }
开发者ID:arimano,项目名称:plyloedit,代码行数:30,代码来源:SearchController.php


示例4: _get_data

 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;
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:32,代码来源:main.widget.php


示例5: index

 function index()
 {
     $result = $this->terms_obj->order(array("listorder" => "asc"))->select();
     /*  $tree = new PathTree();
         $tree->icon = array('   │ ', '   ├─ ', '   └─ ');
         $tree->nbsp = '---';
        	$tree->init($result);
        	$tree=$tree->get_tree();
        	$this->assign("terms",$tree); */
     $tree = new \Tree();
     $tree->icon = array('   │ ', '   ├─ ', '   └─ ');
     $tree->nbsp = '   ';
     foreach ($result as $r) {
         $r['str_manage'] = '<a href="' . U("AdminTerm/add", array("parent" => $r['term_id'])) . '">添加子类</a> | <a href="' . U("AdminTerm/edit", array("id" => $r['term_id'])) . '">修改</a> | <a class="J_ajax_del" href="' . U("AdminTerm/delete", array("id" => $r['term_id'])) . '">删除</a> ';
         $url = U('portal/list/index', array('id' => $r['term_id']));
         $r['url'] = $url;
         $r['taxonomys'] = $this->taxonomys[$r['taxonomy']];
         $r['id'] = $r['term_id'];
         $r['parentid'] = $r['parent'];
         $array[] = $r;
     }
     $tree->init($array);
     $str = "<tr>\r\n\t\t\t\t\t<td><input name='listorders[\$id]' type='text' size='3' value='\$listorder' class='input input-order'></td>\r\n\t\t\t\t\t<td>\$id</td>\r\n\t\t\t\t\t<td>\$spacer <a href='\$url' target='_blank'>\$name</a></td>\r\n\t    \t\t\t<td>\$taxonomys</td>\r\n\t\t\t\t\t<td align='center'><a href='\$url' target='_blank'>访问</a></td>\r\n\t\t\t\t\t<td>\$str_manage</td>\r\n\t\t\t\t</tr>";
     $taxonomys = $tree->get_tree(0, $str);
     $this->assign("taxonomys", $taxonomys);
     $this->display();
     //$this->display();
 }
开发者ID:kmlzh1983,项目名称:diamond,代码行数:28,代码来源:AdminTermController.class.php


示例6: index

 public function index()
 {
     $map['status'] = array('lt', 2);
     $list = $this->_list(MODULE_NAME, $map);
     foreach ($list as $key => $v) {
         $adata = M($v["mx"])->field("title")->getByid($v["mid"]);
         if ($v["status"] == 1) {
             $list[$key]["title"] = $adata["title"];
         } else {
             $list[$key]["title"] = "<font color=red>" . $adata["title"] . "--未处理</font>";
         }
         $list[$key]["url"] = "/index.php?m=" . $v["mx"] . "&a=show&id=" . $v["mid"];
     }
     /*获得分类*/
     if ($this->categorys) {
         $arrx = explode(",", "1,4,33");
         foreach ((array) $arrx as $key => $v) {
             $array[$v] = $this->categorys[$v];
             $arr = explode(",", $this->categorys[$v]["arrchildid"]);
         }
         //print_r($array);
         import('@.ORG.Tree');
         $str = "<option value='\$id' \$disabled \$selected>\$spacer \$catname</option>";
         $tree = new Tree($array);
         $select_categorys = $tree->get_tree(0, $str);
         $this->assign('select_categorys', $select_categorys);
         $this->assign('categorys', $this->categorys);
     }
     $this->assign('list', $list);
     $this->display();
 }
开发者ID:anywn3773,项目名称:gzsrex,代码行数:31,代码来源:OrderAction.class2.php


示例7: isManager

 /**
  * Is the specified/current user a manager of a tree?
  *
  * @param Tree      $tree
  * @param User|null $user
  *
  * @return bool
  */
 public static function isManager(Tree $tree, User $user = null)
 {
     if ($user === null) {
         $user = self::user();
     }
     return self::isAdmin($user) || $user && $tree->getUserPreference($user, 'canedit') === 'admin';
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:15,代码来源:Auth.php


示例8: edit

 function edit()
 {
     if (IS_POST) {
         $post = I('post.');
         $data['parent'] = $post['parent'];
         $data['title'] = $post['title'];
         $data['listorder'] = $post['listorder'];
         $map['user_id'] = $this->uid;
         $map['id'] = $post['id'];
         if ($this->categories->where($map)->save($data) !== false) {
             $this->success('类别修改成功!');
         } else {
             $this->error('类别修改失败!');
         }
     } else {
         $id = I('id');
         $map_categories['id'] = $id;
         $map_categories['user_id'] = $this->uid;
         $data = $this->categories->where($map_categories)->field(true)->find();
         if ($data == null) {
             $this->error('没有这个类别!');
         }
         $map['user_id'] = $this->uid;
         $list = $this->categories->where($map)->order('listorder')->select();
         import('@.Rover.Tree');
         $tree = new Tree();
         $tree->init($list);
         $str = "<option \$css value=\$id \$selected>\$spacer\$title</option>";
         $selected = $tree->get_tree(0, $str, $data['parent']);
         $this->assign('selected', $selected);
         $this->assign('data', $data);
         $this->display('mod');
     }
 }
开发者ID:tanaer,项目名称:pdm,代码行数:34,代码来源:CategoriesAction.class.php


示例9: get_header_gcategories

 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);
 }
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:28,代码来源:main.widget.php


示例10: index

    public function index()
    {
        $sort = $this->_get("sort", 'trim', 'ordid');
        $order = $this->_get("order", 'trim', 'ASC');
        $tree = new Tree();
        $tree->icon = array('│ ', '├─ ', '└─ ');
        $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
        $result = $this->_mod->where(array('lang' => $this->lang))->order($sort, $order)->select();
        $array = array();
        foreach ($result as $r) {
            $r['str_type'] = L('type_' . $r['type']);
            $r['str_manage'] = '<a href="' . U('home/content/index', array('cid' => $r['id'])) . '" target="_blank">' . L('lable_browse') . '</a> |
					' . ($r['type'] == 0 ? '<a href="' . U('content/index', array('cat_id' => $r['id'])) . '">' . L('tabs_content') . '</a> | ' : '') . '
					<a href="' . U('category/add', array('pid' => $r['id'])) . '">' . L('lable_addsoncate') . '</a> |
					<a href="' . U('category/edit', array('id' => $r['id'])) . '">' . L('lable_edit') . '</a> |
					<a href="javascript:;" class="J_confirmurl" data-acttype="ajax" data-uri="' . U('category/delete', array('id' => $r['id'])) . '" data-msg="' . sprintf(L('confirm_delete_one'), $r['name']) . '分类下的文章也会删除">' . L('lable_del') . '</a>';
            $r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
            $array[] = $r;
        }
        $str = "<tr id='node-\$id' \$parentid_node>\n                <td class='text-c'>\$id</td>\n\t\t\t\t\t\t\t\t<td class='text-c'><span data-tdtype='edit' data-field='ordid' data-id='\$id' class='tdedit'>\$ordid</span></td>\n                <td>\$spacer<span data-tdtype='edit' data-field='name' data-id='\$id' class='tdedit'>\$name</span></td>\n\t\t\t\t\t\t\t\t<td align='center' class='type_\$type'>\$str_type</td>\n                <td class='text-c'>\$str_manage</td>\n                </tr>";
        $tree->init($array);
        $list = $tree->get_tree(0, $str);
        $this->assign('curr_name', 'index');
        $this->assign('list', $list);
        $this->assign('list_table', true);
        $this->display();
    }
开发者ID:kjzwj,项目名称:jcms,代码行数:27,代码来源:categoryAction.class.php


示例11: _fillChilds

 /**
  * Fill childs data array for tree panel
  * @param Tree $tree
  * @param mixed $root
  * @return array
  */
 protected function _fillChilds(Tree $tree, $root = 0)
 {
     $result = array();
     $childs = $tree->getChilds($root);
     if (empty($childs)) {
         return array();
     }
     foreach ($childs as $k => $v) {
         $row = $v['data'];
         $obj = new stdClass();
         $obj->id = $row['id'];
         $obj->text = $row['name'];
         $obj->expanded = false;
         $obj->isDir = $row['isDir'];
         $obj->path = $row['path'];
         $obj->name = $row['name'];
         $obj->hid = $row['hid'];
         if ($row['isDir']) {
             $obj->leaf = false;
         } else {
             $obj->leaf = true;
         }
         $cld = array();
         if ($tree->hasChilds($row['id'])) {
             $cld = $this->_fillChilds($tree, $row['id']);
         }
         $obj->children = $cld;
         $result[] = $obj;
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:37,代码来源:File.php


示例12: index

    public function index()
    {
        $tree = new Tree();
        $tree->icon = array('│ ', '├─ ', '└─ ');
        $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
        $result = $this->_mod->select();
        $array = array();
        foreach ($result as $arr) {
            $arr['status'] = '<i data-editid="' . $arr['id'] . '" data-editype="single" data-editfield="status" data-toggle="AJAXedit" data-editurl="' . U('admin/ajax_edit') . '" class="' . ($arr['status'] == 0 ? 'icon-remove' : 'icon-ok') . '" data-value="' . $arr['status'] . '"></i>';
            $arr['mangers'] = '<a class="editing" data-id="' . $arr['id'] . '" href="#editing" data-orgurl="' . U('admin/edit') . '" data-url="' . U('admin/edit', array('id' => $arr['id'])) . '" data-toggle="modal">' . L('edit') . '</a>
							  <a data-toggle="AJAXdelete" data-url="' . U('admin/delete', array('id' => $arr['id'])) . '" >' . L('del') . '</a>
							';
            $arr['p_node'] = $arr['pid'] ? ' class="child-node-' . $arr['pid'] . '"' : '';
            $array[] = $arr;
        }
        $auth = array();
        $auth = session('admin');
        if ($auth['role_id'] > 1) {
            $str = "<tr id='node-\$id' \$p_node >\r\n                <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\r\n                <td align='center'>\$id</td>\r\n                <td>\$spacer<span data-toggle='AJAXedit' data-value='\$name' data-editype='word' data-editurl='" . U('admin/ajax_edit') . "' data-editfield='name' data-editid='\$id'>\$username</span></td>\r\n                <td>\$status</td>\r\n             \t<td>\$mangers</td>\r\n                </tr>";
        } else {
        }
        $str = "<tr id='node-\$id' \$p_node >\r\n                <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\r\n                <td align='center'>\$id</td>\r\n                <td>\$spacer<span data-toggle='AJAXedit' data-value='\$name' data-editype='word' data-editurl='" . U('admin/ajax_edit') . "' data-editfield='name' data-editid='\$id'>\$username</span></td>\r\n                <td>\$status</td>\r\n             \t<td>\$mangers</td>\r\n                </tr>";
        $tree->init($array);
        $list = $tree->get_tree(0, $str);
        $this->assign('list', $list);
        $add_menu = array('title' => L('admin_add'), 'url' => U('admin/add'), 'id' => 'admin_add', 'width' => '500', 'height' => '350', 'btn' => 'save', 'getajax' => U('admin/ajax_getroles'));
        $this->assign('add_menu', $add_menu);
        $this->display();
    }
开发者ID:omusico,项目名称:MRFOS,代码行数:29,代码来源:adminAction.class.php


示例13: get_tpl_slotz

 function get_tpl_slotz($tpl_name)
 {
     $tpl_tree = new Tree($_DB['DB_NAME'], 'template_container');
     if ($tpl_id = $tpl_tree->FindbyBasic(1, $tpl_name)) {
         return $tpl_slotz = $tpl_tree->GetChildsParam($tpl_id[0], array('SlotAlias'), true);
     }
 }
开发者ID:umaxfun,项目名称:x4m,代码行数:7,代码来源:gallery.common.class.php


示例14: info

 public function info($type = 'admin')
 {
     parent::info();
     $cid = intval($this->input->get_post('cid'));
     $options = array();
     if ($cid > 0) {
         $options['where'] = array('cid' => $cid);
     }
     $item = $this->model->getOne($options, true);
     $this->parameters->fromArray(json_to_array($item['params']));
     $item['params'] = $this->parameters;
     $parents = array('顶级栏目');
     $where = array();
     if ($this->user_info->key != 'root') {
         $where = array('status >=' => 0);
     }
     $item['type'] = $item['type'] ? $item['type'] : $type;
     $options = array('type' => $item['type'], 'where' => $where, 'order' => " order_id desc,cid desc");
     $tree = new Tree();
     $tree->init($this->model->getAll2Array($options));
     foreach ($tree->getValueOptions() as $k => $tmp) {
         $parents[$k] = $tmp['title'];
     }
     $data = array('parents' => $parents, 'item' => $item);
     $this->_template('admin/setting/columinfo', $data);
 }
开发者ID:cordova2009,项目名称:SMA,代码行数:26,代码来源:colum.php


示例15: info

 public function info()
 {
     $infoid = I('get.infoid');
     $this->assign('infoid', $infoid);
     //获取车型列表
     $info_db = D('Info');
     $infoList = $info_db->getInfoList();
     $this->assign('infoList', $infoList);
     //题图
     $topPicList = getPicMetaArr($infoid, 91);
     //print_r($topPicList);exit;
     $this->assign('topPicList', $topPicList);
     $classself_db = D('ClassSelf');
     $data_class = array();
     $data_class = $classself_db->getClassSelfList($infoid);
     foreach ($data_class as $key => &$row) {
         if ($row['classid'] == 91) {
             unset($data_class[$key]);
         }
         if ($row['parentid'] == 91) {
             unset($data_class[$key]);
         }
         $row['cid'] = $row['id'];
         $row['id'] = $row['classid'];
     }
     $tree = new \Tree();
     $tree->init($data_class);
     $menuList = $tree->get_tree_array(0);
     $this->assign('menuList', $menuList);
     $this->display(":info");
 }
开发者ID:shizitao,项目名称:iucars,代码行数:31,代码来源:InfoController.class.php


示例16: index

 public function index()
 {
     $sort = $this->_get("sort", 'trim', 'ordid');
     $order = $this->_get("order", 'trim', 'ASC');
     $tree = new Tree();
     $tree->icon = array('│ ', '├─ ', '└─ ');
     $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
     $result = $this->_mod->order($sort . ' ' . $order)->where(array('tokenTall' => $this->getTokenTall()))->select();
     $array = array();
     foreach ($result as $r) {
         $r['str_img'] = $r['img'] ? '<span class="img_border"><img src="' . attach($r['img'], 'item_cate') . '" style="width:26px; height:26px;" class="J_preview" data-bimg="' . attach($r['img'], 'item_cate') . '" /></span>' : '';
         $r['str_status'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="status" data-value="' . $r['status'] . '" src="__STATIC__/images/admin/toggle_' . ($r['status'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
         $r['str_index'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="is_index" data-value="' . $r['is_index'] . '" src="__STATIC__/images/admin/toggle_' . ($r['is_index'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
         $r['str_type'] = $r['type'] ? '<span class="gray">' . L('item_cate_type_tag') . '</span>' : L('item_cate_type_cat');
         $r['str_manage'] = '<a href="javascript:;" class="J_showdialog" data-uri="' . U('item_cate/add', array('pid' => $r['id'])) . '" data-title="' . L('add_item_cate') . '" data-id="add" data-width="520" data-height="360">' . L('add_item_subcate') . '</a> |
                             <a href="javascript:;" class="J_showdialog" data-uri="' . U('item_cate/edit', array('id' => $r['id'])) . '" data-title="' . L('edit') . ' - ' . $r['name'] . '" data-id="edit" data-width="520" data-height="360">' . L('edit') . '</a> |
                             <a href="javascript:;" class="J_confirmurl" data-acttype="ajax" data-uri="' . U('item_cate/delete', array('id' => $r['id'])) . '" data-msg="' . sprintf(L('confirm_delete_one'), $r['name']) . '">' . L('delete') . '</a>';
         $r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
         $r['is_allcate'] = $r['name'] == '全部商品' ? 'allcate' : 'cate&cid=' . $r['id'];
         $array[] = $r;
     }
     $str = "<tr id='node-\$id' \$parentid_node>\n                <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\n                <td align='center'>\$id</td>\n                <td>\$spacer<span data-tdtype='view' data-field='name' data-id='\$id' class='tdview'  style='color:\$fcolor'>\$name</span></td>\n                <td align='left'>" . $_SERVER['HTTP_HOST'] . "/weTall/index.php?m=book&a=\$is_allcate&tokenTall=" . $this->getTokenTall() . "</td>\n        \t\t<td align='center'>\$str_img</td>\n                <td align='center'>\$str_type</td>\n                <td align='center'><span data-tdtype='view' data-field='ordid' data-id='\$id' class='tdview'>\$ordid</span></td>\n                <td align='center'>\$str_index</td>\n                <td align='center'>\$str_status</td>\n                <td align='center'>\$str_manage</td>\n                </tr>";
     $tree->init($array);
     $list = $tree->get_tree(0, $str);
     $this->assign('list', $list);
     //bigmenu (标题,地址,弹窗ID,宽,高)
     $big_menu = array('title' => L('add_item_cate'), 'iframe' => U('item_cate/add'), 'id' => 'add', 'width' => '520', 'height' => '360');
     $this->assign('big_menu', $big_menu);
     $this->assign('list_table', true);
     $this->display();
 }
开发者ID:dlpc,项目名称:wxshoppingmall,代码行数:31,代码来源:item_cateAction.class.php


示例17: cate_url

 public function cate_url()
 {
     $sort = $this->_get("sort", 'trim', 'ordid');
     $order = $this->_get("order", 'trim', 'ASC');
     $tree = new Tree();
     $tree->icon = array('│ ', '├─ ', '└─ ');
     $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
     $result = $this->_mod->order($sort . ' ' . $order)->where("token ='" . session('token') . "'")->select();
     $array = array();
     foreach ($result as $r) {
         $r['str_img'] = $r['img'] ? '<span class="img_border"><img src="' . attach($r['img'], '' . session('token') . '/item_cate') . '" style="width:26px; height:26px;" class="J_preview" data-bimg="' . attach($r['img'], '' . session('token') . '/item_cate') . '" /></span>' : '';
         $r['str_status'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="status" data-value="' . $r['status'] . '" src="__STATIC__/images/admin/toggle_' . ($r['status'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
         $r['str_index'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="is_index" data-value="' . $r['is_index'] . '" src="__STATIC__/images/admin/toggle_' . ($r['is_index'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
         $r['str_type'] = $r['type'] ? '<span class="gray">' . L('item_cate_type_tag') . '</span>' : L('item_cate_type_cat');
         // <a href="'.U('item_cate/tag_list',array('cate_id'=>$r['id'])).'">'.L('tag').'</a> |
         $r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
         $array[] = $r;
     }
     $url = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?token=' . session('token') . '&m=book&a=cate&cateid=';
     $str = "<tr id='node-\$id' \$parentid_node>\n                <td align='center' style='display:none;'><input type='checkbox' value='\$id' class='J_checkitem'></td>\n                <td align='left' style='display:none;'>\$id</td>\n                <td>\$spacer<span style='color:\$fcolor'>\$name</span></td>\n                <td align='left'>" . $url . "\$id</td>\n\n                </tr>";
     $tree->init($array);
     $list = $tree->get_tree(0, $str);
     $this->assign('list', $list);
     //bigmenu (标题,地址,弹窗ID,宽,高)
     $this->assign('list_table', true);
     $this->display();
 }
开发者ID:yaks,项目名称:weixinshop,代码行数:27,代码来源:item_cateAction.class.php


示例18: index

 /**
  * 模型管理首页
  */
 public function index()
 {
     $_SESSION['admin_menu_index'] = "Model/index";
     $result = $this->model_model->select();
     import("Tree");
     $tree = new \Tree();
     $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ', '&nbsp;&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;&nbsp;└─ ');
     $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
     $newmenus = array();
     foreach ($result as $m) {
         $newmenus[$m['id']] = $m;
     }
     foreach ($result as $n => $r) {
         $result[$n]['str_manage'] = '<a href="' . U("model/lists", array("model" => $r['name'])) . '">数据</a> |<a href="' . U("model/edit", array("id" => $r['id'], "menuid" => $_GET['menuid'])) . '">修改</a> | <a class="J_ajax_del" href="' . U("Model/del", array("id" => $r['id'])) . '">删除</a> |<a href="' . U('Attribute/index?model_id=' . $r['id']) . '" >字段管理</a>';
         $result[$n]['status'] = $r['status'] ? "显示" : "隐藏";
         if (APP_DEBUG) {
             $result[$n]['app'] = $r['app'] . "/" . $r['model'] . "/" . $r['action'];
         }
     }
     $tree->init($result);
     $str = "<tr id='node-\$id' \$parentid_node>\n                    <td>\$id</td>\n                    <td>\$title</td>\n                    <td>\$name</td>\n                    <td>\$create_time</td>\n                    <td>\$str_manage</td>\n                </tr>";
     $categorys = $tree->get_tree(0, $str);
     $this->assign("categorys", $categorys);
     $this->display();
 }
开发者ID:slpi1,项目名称:thinkcmfAddModel,代码行数:28,代码来源:ModelController.class.php


示例19: index

 public function index()
 {
     $sort = $this->_get("sort", 'trim', 'ordid');
     $order = $this->_get("order", 'trim', 'ASC');
     $tree = new Tree();
     $tree->icon = array('│ ', '├─ ', '└─ ');
     $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
     $result = $this->_mod->order($sort . ' ' . $order)->select();
     $array = array();
     foreach ($result as $r) {
         $r['str_status'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="status" data-value="' . $r['status'] . '" src="__STATIC__/images/admin/toggle_' . ($r['status'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
         $r['str_manage'] = '<a href="javascript:;" class="J_showdialog" data-uri="' . U('items_cate/add', array('pid' => $r['id'])) . '" data-title="' . L('add_item_cate') . '" data-id="add" data-width="520" data-height="20">' . L('add_item_subcate') . '</a> |
                             <a href="javascript:;" class="J_showdialog" data-uri="' . U('items_cate/edit', array('id' => $r['id'])) . '" data-title="' . L('edit') . ' - ' . $r['name'] . '" data-id="edit" data-width="500" data-height="20">' . L('edit') . '</a> |
                             <a href="javascript:;" class="J_confirmurl" data-acttype="ajax" data-uri="' . U('items_cate/delete', array('id' => $r['id'])) . '" data-msg="' . sprintf(L('confirm_delete_one'), $r['name']) . '">' . L('delete') . '</a>';
         $r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
         $array[] = $r;
     }
     $str = "<tr id='node-\$id' \$parentid_node>\n                <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\n                <td align='center'>\$id</td>\n                <td>\$spacer<span data-tdtype='edit' data-field='name' data-id='\$id' class='tdedit'  style='color:\$fcolor'>\$name</span></td>\n                <td align='center'><span data-tdtype='edit' data-field='ordid' data-id='\$id' class='tdedit'>\$ordid</span></td>\n                <td align='center'>\$str_status</td>\n                <td align='center'>\$str_manage</td>\n                </tr>";
     $tree->init($array);
     $list = $tree->get_tree(0, $str);
     $this->assign('list', $list);
     //bigmenu (标题,地址,弹窗ID,宽,高)
     $big_menu = array('title' => L('add_item_cate'), 'iframe' => U('items_cate/add'), 'id' => 'add', 'width' => '520', 'height' => '80');
     $this->assign('big_menu', $big_menu);
     $this->assign('list_table', true);
     $this->display();
 }
开发者ID:leamiko,项目名称:58bitao,代码行数:27,代码来源:items_cateAction.class.php


示例20: getTree

 public function getTree($wechatId)
 {
     $sql = "select m.name,m.id,m.type,m.parentId,a.action,a.responseId,a.id as actionId from " . MenuModel::model()->tableName() . " m left join " . MenuactionModel::model()->tableName() . " a on m.id=a.menuId  where m.wechatId=" . $wechatId . " order by m.id desc";
     $command = Yii::app()->db->createCommand($sql);
     $data = $command->queryAll();
     $tree = new Tree($data);
     return $tree->get_tree_list();
 }
开发者ID:00606,项目名称:wechat,代码行数:8,代码来源:MenuactionModel.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TreeDropdownField类代码示例发布时间:2022-05-23
下一篇:
PHP TravelHelper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap