當前位置: 首頁>>代碼示例>>PHP>>正文


PHP tree::init方法代碼示例

本文整理匯總了PHP中tree::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP tree::init方法的具體用法?PHP tree::init怎麽用?PHP tree::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tree的用法示例。


在下文中一共展示了tree::init方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getActionTree

 public function getActionTree()
 {
     $sql = "SELECT id,parent_id,action_name from {$this->_table}";
     $cates = $res = $this->getList($sql);
     $this->load->helper('html_tree');
     $tree = new tree($cates);
     $tree->icon = array('  │ ', '  ├─ ', '  └─ ');
     //樹形圖標
     $tree->nbsp = '   ';
     //三個空格
     $options = '';
     $tree->init($cates);
     return $tree->get_tree(0, "<option value='\$id'>\$spacer\$action_name</option>\n");
 }
開發者ID:shitfSign,項目名稱:conf_system,代碼行數:14,代碼來源:admin_actions_mod.php

示例2: add

 public function add($id = '')
 {
     require APPPATH . 'libraries/tree.class.php';
     if ($id) {
         $query = $this->db->where(array('catid' => $id))->get('category')->row_array();
     }
     $this->data['item'] = $query;
     $categorys = $this->categorys;
     $tree = new tree();
     $tree->icon = array('&nbsp;&nbsp;│ ', '&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;└─ ');
     $tree->nbsp = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
     $string = '<select name="parentid">';
     $string .= "<option value='0'>≡ 作為一級欄目 ≡</option>";
     $str = "<option value='\$catid' \$selected>\$spacer \$catname</option>;";
     $str2 = "<optgroup label='\$spacer \$catname'></optgroup>";
     $tree->init($categorys);
     $string .= $tree->get_tree_category(0, $str, $str2, $query['parentid']);
     $string .= '</select>';
     $this->data['categorys'] = $string;
     $this->repair(false);
     $this->load->view('category/add', $this->data);
 }
開發者ID:tatfan,項目名稱:fb_backend,代碼行數:22,代碼來源:category.php

示例3: select_category

 /**
  * 欄目選擇
  * @param string $file 欄目緩存文件名
  * @param intval/array $catid 別選中的ID,多選是可以是數組
  * @param string $str 屬性
  * @param string $default_option 默認選項
  * @param intval $modelid 按所屬模型篩選
  * @param intval $type 欄目類型
  * @param intval $onlysub 隻可選擇子欄目
  * @param intval $siteid 如果設置了siteid 那麽則按照siteid取
  */
 public static function select_category($file = '', $catid = 0, $str = '', $default_option = '', $modelid = 0, $type = -1, $onlysub = 0, $siteid = 0, $is_push = 0)
 {
     require_once "Tree.class.php";
     $tree = new tree();
     if (!$siteid) {
         $siteid = get_siteid();
     }
     if ($modelid) {
         $result = D('Category')->where('siteid = %d and modelid = %d', $siteid, $modelid)->select();
     } else {
         $result = D('Category')->where('siteid = %d', $siteid)->select();
     }
     $string = '<select ' . $str . '>';
     if ($default_option) {
         $string .= "<option value='0'>{$default_option}</option>";
     }
     if (is_array($result)) {
         foreach ($result as $r) {
             if ($siteid != $r['siteid'] || $type >= 0 && $r['type'] != $type) {
                 continue;
             }
             $r['selected'] = '';
             if (is_array($catid)) {
                 $r['selected'] = in_array($r['id'], $catid) ? 'selected' : '';
             } elseif (is_numeric($catid)) {
                 $r['selected'] = $catid == $r['id'] ? 'selected' : '';
             }
             $r['html_disabled'] = "0";
             if (!empty($onlysub) && $r['child'] != 0) {
                 $r['html_disabled'] = "1";
             }
             $categorys[$r['id']] = $r;
             if ($modelid && $r['modelid'] != $modelid) {
                 unset($categorys[$r['catid']]);
             }
         }
     }
     $str = "<option value='\$id' \$selected>\$spacer \$catname</option>;";
     $str2 = "<optgroup label='\$spacer \$catname'></optgroup>";
     $tree->init($categorys);
     $string .= $tree->get_tree_category(0, $str, $str2);
     $string .= '</select>';
     return $string;
 }
開發者ID:lxp521125,項目名稱:TP-Admin,代碼行數:55,代碼來源:Form.class.php

示例4: role_perm

 public function role_perm($type = 'module', $id = '')
 {
     $this->data['type'] = $type;
     if ($id) {
         $role = $this->db->where(array('roleid' => $id))->get('admin_role')->row_array();
         $this->data['role'] = $role;
         $role_perm = $this->data['roles'] = $this->M_user->get_admin_role_perm($id);
         if ($type == 'module') {
             //print_r($role_perm);
             $this->data['role_perm'] = $role_perm['module'];
         }
         if ($type == 'category') {
             require APPPATH . 'libraries/tree.class.php';
             $this->load->model('M_content');
             $categorys = $this->M_content->get_category();
             $tree = new tree();
             $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ', '&nbsp;&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;&nbsp;└─ ');
             $tree->nbsp = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
             $str = "<tr>\n            \t\t\t\t<td><label><input type='checkbox' \$checked class='ace' name='perm[]' value='\$id' /><span class='lbl'></span></label></td>\n            \t\t\t\t<td>\$id</td>\n            \t\t\t\t<td class='left'>\$spacer\$catname</td>\n            \t\t\t</tr>";
             $str2 = "<tr>\n            \t\t\t\t<td><label><input type='checkbox' class='ace' name='perm[]' value='\$id' /><span class='lbl'></span></label></td>\n            \t\t\t\t<td>\$id</td>\n            \t\t\t\t<td class='left'>\$spacer\$catname</td>\n            \t\t\t</tr>";
             $tree->init($categorys);
             $string = $tree->get_tree_multi(0, $str, implode(',', $role_perm['category']));
             $this->data['categorys'] = $string;
         }
         $this->load->view('user/role_perm', $this->data);
     } else {
         show_error('參數異常');
     }
 }
開發者ID:tatfan,項目名稱:fb_backend,代碼行數:29,代碼來源:user.php

示例5: getTree

 public static function getTree($data, $format = "<option value='\$catid' \$selected>\$spacer\$name</option>", $id = 0, $nbsp = "&nbsp;&nbsp;&nbsp;&nbsp;", $icon = array("&nbsp;&nbsp;", "&nbsp;&nbsp;", "&nbsp;&nbsp;"))
 {
     Ibos::import("ext.Tree", true);
     $tree = new tree();
     $tree->init($data);
     $tree->icon = $icon;
     $tree->nbsp = $nbsp;
     $trees = $tree->get_tree(0, $format, $id);
     return $trees;
 }
開發者ID:AxelPanda,項目名稱:ibos,代碼行數:10,代碼來源:StringUtil.php


注:本文中的tree::init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。