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


PHP Data::isChild方法代碼示例

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


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

示例1: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->_db->edit_node()) {
             $this->_ajax(1, '修改節點成功');
         }
     } else {
         $nid = Q('nid');
         $this->field = $this->_node[$nid];
         foreach ($this->_node as $id => $node) {
             $this->_node[$id]['disabled'] = Data::isChild($this->_node, $id, $nid, 'nid') ? ' disabled="disabled" ' : '';
         }
         $this->node = $this->_node;
         $this->display();
     }
 }
開發者ID:jyht,項目名稱:v5,代碼行數:16,代碼來源:NodeControl.class.php

示例2: getLevelCategory

 /**
  * 獲取樹狀欄目
  * 指定cid時過濾掉cid及其子欄目
  *
  * @param int $cid
  *
  * @return mixed
  */
 public function getLevelCategory($cid = 0)
 {
     $category = Db::table('web_category')->where('siteid', SITEID)->get();
     if ($category) {
         $category = Data::tree($category, 'title', 'cid', 'pid');
         if ($cid) {
             //編輯時在欄目選擇中不顯示自身與子級欄目
             foreach ($category as $k => $v) {
                 if ($v['cid'] == $cid || Data::isChild($category, $v['cid'], $cid)) {
                     unset($category[$k]);
                 }
             }
         }
         return $category;
     }
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:24,代碼來源:WebCategory.php

示例3: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->editNode()) {
             $this->success('修改節點成功');
         }
     } else {
         $nid = Q('nid');
         $this->field = $this->node[$nid];
         foreach ($this->node as $id => $node) {
             $this->node[$id]['disabled'] = Data::isChild($this->node, $id, $nid, 'nid') ? ' disabled="disabled" ' : '';
         }
         $this->assign('node', $this->node);
         $this->display();
     }
 }
開發者ID:lililishuang,項目名稱:hdcms,代碼行數:16,代碼來源:NodeController.class.php

示例4: getEdit

 public function getEdit($id, $pid)
 {
     $data = $this->getAll();
     foreach ($data as $key => $value) {
         $data[$key]["_disabled"] = $data[$key]['_selected'] = '';
         if ($id == $value['id']) {
             $data[$key]['_disabled'] = 'disabled=""';
         }
         if (Data::isChild($data, $value['id'], $id, 'id')) {
             $data[$key]['_disabled'] = 'disabled=""';
         }
         if ($value['id'] == $pid) {
             $data[$key]['_selected'] = "selected=''";
         }
     }
     return $data;
 }
開發者ID:arnold1119,項目名稱:cms,代碼行數:17,代碼來源:Category.php

示例5: getEditData

 public function getEditData($id, $pid)
 {
     $data = $this->getAll();
     foreach ($data as $k => $d) {
         $data[$k]['_selected'] = $data[$k]['_disabled'] = '';
         if ($d['id'] == $id) {
             $data[$k]['_disabled'] = ' disabled=""';
         }
         if (Data::isChild($data, $d['id'], $id, 'id')) {
             $data[$k]['_disabled'] = ' disabled=""';
         }
         if ($pid == $d['id']) {
             $data[$k]['_selected'] = " selected=''";
         }
     }
     return $data;
 }
開發者ID:arnold1119,項目名稱:cms,代碼行數:17,代碼來源:Category.php

示例6: edit

 public function edit()
 {
     //打印用戶自定義常量
     //print_const();
     if (IS_POST) {
         if ($this->_db->edit_category()) {
             $this->ajax(array('state' => 1, 'message' => '欄目修改成功'));
         } else {
             $this->ajax(array('state' => 0, 'message' => $this->_db->error));
         }
     } else {
         //分配編輯欄目舊的數據
         $field = $this->_db->find(Q("cid"));
         //分配所有欄目
         $category = $this->_db->all();
         $category = Data::tree($category, 'cname');
         foreach ($category as $n => $v) {
             //將父級欄目添加selected(選中狀態)
             $v['selected'] = '';
             if ($field['pid'] == $v['cid']) {
                 $v['selected'] = ' selected="selected" ';
             }
             //將子欄目與自身添加disabled(禁止選擇)
             $v['disabled'] = '';
             if ($field['cid'] == $v['cid'] || Data::isChild($category, $v['cid'], $field['cid'])) {
                 $v['disabled'] = ' disabled="disabled" class="disabled" ';
             }
             $category[$n] = $v;
         }
         //分配當前欄目數據
         $this->field = $field;
         //分配欄目數據
         $this->category = $category;
         $this->display();
     }
 }
開發者ID:jyht,項目名稱:v5,代碼行數:36,代碼來源:CategoryControl.class.php

示例7: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->editCategory()) {
             $this->success('修改欄目成功');
         } else {
             $this->error($this->db->error);
         }
     } else {
         if (!$this->cid || !isset($this->category[$this->cid])) {
             $this->error('欄目不存在');
         }
         $cache = $this->category;
         $category = $cache[$this->cid];
         foreach ($cache as $n => $cat) {
             //父欄目select狀態
             $selected = $category['pid'] == $cat['cid'] ? 'selected=""' : '';
             //子欄目disabled
             $disabled = Data::isChild($this->category, $cat['cid'], $this->cid) || $this->cid == $cat['cid'] ? 'disabled=""' : '';
             $cache[$n]['selected'] = $selected;
             $cache[$n]['disabled'] = $disabled;
         }
         /**
          * 獲得欄目權限
          */
         $categoryAccess = $this->db->getCategoryAccess($this->cid);
         /**
          * 如果當前欄目有文章時不允許更改模型
          */
         $map['cid'] = $this->cid;
         $contentTable = $this->model[$this->category[$this->cid]['mid']]['table_name'];
         if (M($contentTable)->where($map)->count()) {
             $disabledChangeModel = true;
         } else {
             $disabledChangeModel = false;
         }
         $this->assign('disabledChangeModel', $disabledChangeModel);
         $this->assign('access', $categoryAccess);
         $this->assign('field', $category);
         $this->assign('model', $this->model);
         $this->assign('category', $cache);
         $this->display();
     }
 }
開發者ID:suhanyujie,項目名稱:spider,代碼行數:44,代碼來源:CategoryController.class.php

示例8: edit

 public function edit()
 {
     $CategoryModel = K("Category");
     $cid = Q('cid', 0, 'intval');
     if (IS_POST) {
         $post = $_POST;
         if (empty($post)) {
             $this->error('參數錯誤');
         }
         if ($CategoryModel->editCategory($post)) {
             $this->success('修改欄目成功');
         } else {
             $this->error($CategoryModel->error);
         }
     } else {
         $categoryCache = cache('category');
         $categoryData = $categoryCache[$cid];
         foreach ($categoryCache as $n => $cat) {
             $selected = $disabled = "";
             //父欄目select狀態
             $selected = $categoryData['pid'] == $cat['cid'] ? 'selected=""' : '';
             //子欄目disabled
             $disabled = Data::isChild($categoryCache, $cat['cid'], $cid) ? 'disabled=""' : '';
             //當前欄目不可選
             if ($cid == $cat['cid']) {
                 $disabled = 'disabled="disabled"';
             }
             $categoryCache[$n]['selected'] = $selected;
             $categoryCache[$n]['disabled'] = $disabled;
         }
         $categoryAccess = $CategoryModel->getCategoryAccess($cid);
         //分配角色權限
         $this->assign('access', $categoryAccess);
         $this->assign('field', $categoryData);
         $this->assign('category', $categoryCache);
         $this->display();
     }
 }
開發者ID:jyht,項目名稱:v5,代碼行數:38,代碼來源:CategoryControl.class.php

示例9: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->editCategory()) {
             $this->success('修改欄目成功');
         } else {
             $this->error($this->db->error);
         }
     } else {
         if (!$this->cid || !isset($this->category[$this->cid])) {
             $this->error('cid不存在');
         }
         $cache = $this->category;
         $category = $cache[$this->cid];
         foreach ($cache as $n => $cat) {
             $selected = $disabled = "";
             //父欄目select狀態
             $selected = $category['pid'] == $cat['cid'] ? 'selected=""' : '';
             //子欄目disabled
             $disabled = Data::isChild($this->category, $cat['cid'], $this->cid) || $this->cid == $cat['cid'] ? 'disabled=""' : '';
             $cache[$n]['selected'] = $selected;
             $cache[$n]['disabled'] = $disabled;
         }
         $categoryAccess = $this->db->getCategoryAccess($this->cid);
         //分配角色權限
         $this->assign('access', $categoryAccess);
         $this->assign('field', $category);
         $this->assign('model', $this->model);
         $this->assign('category', $cache);
         $this->display();
     }
 }
開發者ID:lililishuang,項目名稱:hdcms,代碼行數:32,代碼來源:CategoryController.class.php


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