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


PHP Data::channelLevel方法代码示例

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


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

示例1: show

 public function show()
 {
     $cid = Q('cid', 0, 'intval');
     $aid = Q('aid', 0, 'intval');
     $Model = K('Comment');
     $where = "comment_state=1 AND cid={$cid} AND aid={$aid}";
     $count = $Model->join()->where($where)->where("pid=0 ")->count();
     $page = new Page($count, 15);
     $data = array();
     if ($count) {
         //获得1级回复的id
         $result = $Model->where($where)->where("pid=0 ")->limit($page->limit())->order("comment_id desc")->getField('comment_id', true);
         $comment_id = implode(',', $result);
         $data = $Model->where("comment_state=1 AND (comment_id IN ({$comment_id}) OR reply_comment_id IN ({$comment_id}))")->order("comment_id ASC")->all();
         //设置头像(没有头像的用户使用默认头像)
         foreach ($data as $n => $d) {
             if (empty($d['icon'])) {
                 $data[$n]['icon'] = __ROOT__ . "/data/image/user/50-gray.png";
             } else {
                 $data[$n]['icon'] = __ROOT__ . '/' . $d['icon'];
             }
         }
     }
     //获得多层
     $data = Data::channelLevel($data, 0, '', 'comment_id');
     $this->assign('page', $page->show());
     $this->assign('data', $data);
     $con = $this->fetch('index.php');
     if (Q('page')) {
         echo $con;
     } else {
         echo "document.write('<div id=\"hdcomment\">" . preg_replace('@\\r|\\n@mi', '', addslashes($con)) . "</div>')";
     }
     exit;
 }
开发者ID:jyht,项目名称:v5,代码行数:35,代码来源:CommentControl.class.php

示例2: set

 public function set()
 {
     if (IS_POST) {
         $favoriteModel = M('menu_favorite');
         //删除旧的收藏
         $map['uid'] = $_SESSION['user']['uid'];
         $favoriteModel->where($map)->del();
         if (!empty($_POST['nid'])) {
             foreach ($_POST['nid'] as $nid) {
                 $data = array('uid' => $_SESSION['user']['uid'], 'nid' => $nid);
                 $favoriteModel->add($data);
             }
         }
         $this->success('设置成功,请刷新后台');
     } else {
         $nodeModel = M('node');
         $pre = C('DB_PREFIX');
         if (IS_SUPER_ADMIN || IS_WEBMASTER) {
             $sql = "SELECT n.nid,n.pid,m.uid,n.title FROM {$pre}node AS n  LEFT JOIN\n\t\t\t\t\t\t\t (SELECT * FROM {$pre}menu_favorite WHERE uid={$_SESSION['user']['uid']}) AS m\n\t\t\t\t\t\t\t ON n.nid = m.nid WHERE n.is_show=1";
         } else {
             $sql = "SELECT n.nid,n.pid,m.uid,n.title FROM {$pre}node AS n  LEFT JOIN  {$pre}access AS a ON n.nid=a.nid LEFT JOIN\n\t\t\t\t\t\t\t (SELECT * FROM {$pre}menu_favorite WHERE uid={$_SESSION['user']['uid']}) AS m ON n.nid = m.nid\n\t\t\t\t\t\t\t WHERE n.type=2 OR (n.show=1 AND m.nid is not null)";
         }
         $nodeData = $nodeModel->query($sql);
         $nodeData = Data::channelLevel($nodeData, 0, "", "nid");
         $this->assign('data', $nodeData);
         $this->display();
     }
 }
开发者ID:suhanyujie,项目名称:spider,代码行数:28,代码来源:FavoriteMenuController.class.php

示例3: edit

 public function edit()
 {
     if (IS_POST) {
         $rid = Q("post.rid");
         $this->_db->where(array("rid" => $rid))->del();
         if (!empty($_POST['nid'])) {
             foreach ($_POST['nid'] as $v) {
                 $this->_db->add(array("rid" => $rid, "nid" => $v));
             }
         }
         $this->_ajax(1, '修改成功');
     } else {
         $rid = Q("rid");
         $sql = "SELECT n.nid,n.title,n.pid,n.type,a.rid as access_rid FROM hd_node AS n LEFT JOIN (SELECT * FROM (SELECT * FROM hd_access WHERE rid={$rid}) AS aa)AS a\n                ON n.nid = a.nid ORDER BY list_order ASC";
         $result = $this->_db->query($sql);
         foreach ($result as $n => $r) {
             $checked = $r['access_rid'] || $r['type'] == 2 ? " checked=''" : '';
             $disabled = $r['type'] == 2 ? 'disabled=""' : '';
             $result[$n]['checkbox'] = "<label><input type='checkbox' name='nid[]' value='{$r['nid']}' {$checked} {$disabled}/> {$r['title']}</label>";
         }
         $this->access = Data::channelLevel($result, 0, '-', 'nid');
         $this->rid = $rid;
         $this->display();
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:25,代码来源:AccessControl.class.php

示例4: set

 /**
  * 权限设置 
  */
 public function set()
 {
     if (IS_POST) {
         //先删除原来
         M('access')->where("rid={$_POST['rid']}")->del();
         if (!empty($_POST['access'])) {
             $data = array();
             foreach ($_POST['access'] as $c => $a) {
                 $data['rid'] = $_POST['rid'];
                 $data['nid'] = $a;
                 M('access')->add($data);
             }
         }
         $this->success('权限设置成功');
     } else {
         /****第一种方案***
         			//找到有权限设置的节点
         			$node=M('node')->all();
         			$node=Data::channelLevel($node,0,'&nbsp','nid');
         			//找到该角色的已有的权限
         			$map['rid']=array('EQ',$_SESSION['rid']);
         			$controller=M('access')->where($map)->getField('controller',true);
         			$action=M('access')->where($map)->getField('action',true);
         			$this->assign('controller',$controller);
         			$this->assign('action',$action);
         			$this->assign('node',$node);
         			$this->display();*/
         // ***方案二***
         $data = M()->join("__access__ a join __node__ n on a.nid=n.nid")->all();
         $node = Data::channelLevel($data, 0, '&nbsp', 'nid');
         $this->assign('node', $node);
         $this->assign('rid', $_SESSION['rid']);
         $this->display();
     }
 }
开发者ID:www2511550,项目名称:ECSHOP,代码行数:38,代码来源:AccessController.class.php

示例5: edit

 public function edit()
 {
     if (IS_POST) {
         $this->db->where(array("rid" => $this->rid))->del();
         if (!empty($_POST['nid'])) {
             foreach ($_POST['nid'] as $v) {
                 $this->db->add(array("rid" => $this->rid, "nid" => $v));
             }
         }
         $this->success('修改成功');
     } else {
         $sql = "SELECT n.nid,n.title,n.pid,n.type,a.rid as access_rid FROM hd_node AS n LEFT JOIN\n            \t\t\t(SELECT * FROM (SELECT * FROM hd_access WHERE rid={$this->rid}) AS t)AS a\n                \t\tON n.nid = a.nid ORDER BY list_order ASC";
         $result = $this->db->query($sql);
         foreach ($result as $n => $r) {
             //当前角色已经有权限或不需要验证的节点
             $checked = $r['access_rid'] || $r['type'] == 2 ? " checked=''" : '';
             //不需要验证的节点,关闭选择(因为所有管理员都有权限)
             $disabled = $r['type'] == 2 ? 'disabled=""' : '';
             //前台表单
             $result[$n]['checkbox'] = "<label><input type='checkbox' name='nid[]' value='{$r['nid']}' {$checked} {$disabled}/> {$r['title']}</label>";
         }
         $this->assign('access', Data::channelLevel($result, 0, '-', 'nid'));
         $this->assign('rid', $this->rid);
         $this->display();
     }
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:26,代码来源:AccessController.class.php

示例6: __init

 /**
  * 构造函数
  * @return [type] [description]
  */
 public function __init()
 {
     $this->db = K('Goods');
     $this->category = S('category');
     $this->user = K('User');
     /**
      * 获得所有栏目
      */
     $category = Data::channelLevel($this->category, 0, '-');
     $this->assign('category', $category);
 }
开发者ID:www2511550,项目名称:ECSHOP,代码行数:15,代码来源:IndexController.class.php

示例7: __init

 public function __init()
 {
     /**
      * 获得所有栏目
      */
     $category = Data::channelLevel(S('category'), 0, '-');
     $this->assign('category', $category);
     /**
      * 登陆后操作
      */
     if (!isset($_SESSION['username'])) {
         $this->error('请登陆后再操作');
     }
 }
开发者ID:www2511550,项目名称:ECSHOP,代码行数:14,代码来源:MemberController.class.php

示例8: index

 /**
  * 后台首页
  */
 public function index()
 {
     /**
      * 站长或超级管理员返回所有菜单
      */
     if (IS_SUPER_ADMIN || IS_WEBMASTER) {
         $node = M('node')->where("is_show=1")->order('list_order ASC')->all();
     } else {
         /**
          * 管理员权限节点
          */
         $node = M()->join(" __access__ a RIGHT __node__ n JOIN ON n.nid=a.nid")->where("n.is_show=1 AND (n.type=2 OR a.rid={$_SESSION['user']['rid']})")->order('list_order ASC')->all();
     }
     $node = Data::channelLevel($this->addNodeUrl($node), 0, '&nbsp;', 'nid');
     //分配菜单节点
     $this->assign('node', $node);
     //-----------------------------------------------------------------------------------
     /**
      * 快捷菜单节点
      */
     $quickMenu = M()->join("__menu_favorite__ m JOIN __node__ n ON m.nid=n.nid")->where("uid={$_SESSION['user']['uid']}")->all();
     $this->assign('quickMenu', $this->addNodeUrl($quickMenu));
     $this->display();
 }
开发者ID:suhanyujie,项目名称:spider,代码行数:27,代码来源:IndexController.class.php

示例9: get_comment

 /**
  * 获得评论列表
  */
 public function get_comment()
 {
     $where = "comment_state=1 AND cid=" . $this->_cid . " AND aid=" . $this->_aid;
     $count = $this->join()->where($where)->where("pid=0 ")->count();
     $page = new Page($count, 15);
     $data = array();
     if ($count) {
         //获得1级回复的id
         $result = $this->where($where)->where("pid=0 ")->limit($page->limit())->order("comment_id desc")->getField('comment_id', true);
         $comment_id = implode(',', $result);
         $data = $this->where("comment_state=1 AND (comment_id IN ({$comment_id}) OR reply_comment_id IN ({$comment_id}))")->order("comment_id ASC")->all();
         //设置头像(没有头像的用户使用默认头像)
         foreach ($data as $n => $d) {
             if (empty($d['icon'])) {
                 $data[$n]['icon'] = __ROOT__ . "/data/image/user/50-gray.png";
             } else {
                 $data[$n]['icon'] = __ROOT__ . '/' . $d['icon'];
             }
         }
     }
     //获得多层
     $data = Data::channelLevel($data, 0, '', 'comment_id');
     return array('page' => $page->show(), 'data' => $data);
 }
开发者ID:jyht,项目名称:v5,代码行数:27,代码来源:CommentModel.class.php

示例10: menus

 /**
  * 获取当前用户在站点后台可以使用的系统菜单
  * @return mixed
  */
 public function menus()
 {
     /**
      * 系统管理
      * 1 移除系统菜单
      * 2 将没有三级或二级菜单的菜单移除
      */
     //移除用户没有使用权限的系统菜单
     $permission = Db::table('user_permission')->where('siteid', SITEID)->where('uid', v('user.info.uid'))->where('type', 'system')->pluck('permission');
     $menus = Db::table('menu')->get();
     if ($permission) {
         $permission = explode('|', $permission);
         $tmp = $menus;
         foreach ($tmp as $k => $m) {
             if ($m['permission'] != '' && !in_array($m['permission'], $permission)) {
                 unset($menus[$k]);
             }
         }
     }
     $menus = Data::channelLevel($menus, 0, '', 'id', 'pid');
     //移除没有三级菜单的一级与二级菜单
     $tmp = $menus;
     foreach ($tmp as $k => $t) {
         //二级菜单为空时删除些菜单
         foreach ($t['_data'] as $n => $d) {
             if (empty($d['_data'])) {
                 unset($menus[$k]['_data'][$n]);
             }
         }
         //一级菜单没有子菜单时移除
         if (empty($menus[$k]['_data'])) {
             unset($menus[$k]);
         }
     }
     return $menus;
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:40,代码来源:Menu.php

示例11: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->editAccess()) {
             $this->success('修改成功');
         } else {
             $this->error('修改失败');
         }
     } else {
         $sql = "SELECT n.nid,n.title,n.pid,n.type,a.rid as access_rid FROM " . C('DB_PREFIX') . "node AS n LEFT JOIN\n            \t\t\t(SELECT * FROM " . C('DB_PREFIX') . "access WHERE rid={$this->rid}) AS a\n                \t\tON n.nid = a.nid ORDER BY list_order ASC";
         $result = $this->db->query($sql);
         foreach ($result as $n => $r) {
             //当前角色已经有权限或不需要验证的节点
             $checked = $r['access_rid'] || $r['type'] == 2 ? " checked=''" : '';
             //不需要验证的节点,关闭选择(因为所有管理员都有权限)
             $disabled = $r['type'] == 2 ? 'disabled=""' : '';
             //表单
             $result[$n]['checkbox'] = "<label>\n                        <input type='checkbox' name='nid[]' value='{$r['nid']}' {$checked} {$disabled}/> {$r['title']}\n                        </label>";
         }
         $this->assign('access', Data::channelLevel($result, 0, '-', 'nid'));
         $this->assign('rid', $this->rid);
         $this->display();
     }
 }
开发者ID:suhanyujie,项目名称:spider,代码行数:24,代码来源:AccessController.class.php

示例12: setFavorite

 public function setFavorite()
 {
     if (IS_POST) {
         $post = $_POST;
         //删除旧的收藏
         $favoriteModel = M('menu_favorite');
         $favoriteModel->del(array('uid' => $_SESSION['uid']));
         if (!empty($_POST['nid'])) {
             foreach ($post['nid'] as $nid) {
                 $favoriteModel->add(array('uid' => $_SESSION['uid'], 'nid' => $nid));
             }
         }
         $pre = C("DB_PREFIX");
         //更新缓存
         $sql = "SELECT * FROM {$pre}menu_favorite AS m JOIN {$pre}node AS n ON m.nid=n.nid WHERE uid=" . $_SESSION['uid'];
         $favoriteMenu = M()->query($sql);
         cache($_SESSION['uid'], $favoriteMenu, MENU_CACHE_PATH);
         $this->success('设置成功');
     } else {
         if (!is_writable(MENU_CACHE_PATH)) {
             $this->error(MENU_CACHE_PATH . '缓存目录不可写');
         }
         $nodeModel = V('node');
         $pre = C('DB_PREFIX');
         if (session("WEB_MASTER") || session("rid") == 1) {
             $sql = "SELECT n.nid,n.pid,m.uid,n.title FROM {$pre}node AS n  LEFT JOIN \n\t\t\t\t\t\t\t (SELECT * FROM {$pre}menu_favorite WHERE uid={$_SESSION['uid']}) AS m ON n.nid = m.nid WHERE n.state=1";
         } else {
             $sql = "SELECT n.nid,n.pid,m.uid,n.title FROM {$pre}node AS n  LEFT JOIN  {$pre}access AS a ON n.nid=a.nid LEFT JOIN\n\t\t\t\t\t\t\t (SELECT * FROM {$pre}menu_favorite WHERE uid={$_SESSION['uid']}) AS m ON n.nid = m.nid \n\t\t\t\t\t\t\t WHERE n.type=2 OR (n.state=1 AND m.nid is not null)";
         }
         $nodeData = $nodeModel->query($sql);
         $nodeData = Data::channelLevel($nodeData, 0, "", "nid");
         $this->assign('data', $nodeData);
         $this->display();
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:35,代码来源:IndexControl.class.php

示例13: getchannletree

 public function getchannletree()
 {
     $data = $this->get();
     // return Data::channelList($data, 0, $html = "&nbsp;", 'id');
     return Data::channelLevel($data, 0, $html = "&nbsp;", 'id');
 }
开发者ID:arnold1119,项目名称:cms,代码行数:6,代码来源:Node.php

示例14: setFavorite

 public function setFavorite()
 {
     if (IS_POST) {
         $post = $_POST;
         //删除旧的收藏
         $favoriteModel = M('menu_favorite');
         $favoriteModel->del(array('uid' => $_SESSION['user']['uid']));
         if (!empty($_POST['nid'])) {
             foreach ($post['nid'] as $nid) {
                 $favoriteModel->add(array('uid' => $_SESSION['user']['uid'], 'nid' => $nid));
             }
         }
         $pre = C("DB_PREFIX");
         //更新缓存
         $sql = "SELECT * FROM {$pre}menu_favorite AS m JOIN {$pre}node AS n ON m.nid=n.nid WHERE uid=" . $_SESSION['user']['uid'];
         $favoriteMenu = M()->query($sql);
         S('user_menu' . $_SESSION['user']['uid'], $favoriteMenu);
         $this->success('设置成功');
     } else {
         $nodeModel = M('node');
         $pre = C('DB_PREFIX');
         if ($_SESSION['user']['web_master'] || $_SESSION['user']['rid'] == 1) {
             $sql = "SELECT n.nid,n.pid,m.uid,n.title FROM {$pre}node AS n  LEFT JOIN\n\t\t\t\t\t\t\t (SELECT * FROM {$pre}menu_favorite WHERE uid={$_SESSION['user']['uid']}) AS m ON n.nid = m.nid WHERE n.show=1";
         } else {
             $sql = "SELECT n.nid,n.pid,m.uid,n.title FROM {$pre}node AS n  LEFT JOIN  {$pre}access AS a ON n.nid=a.nid LEFT JOIN\n\t\t\t\t\t\t\t (SELECT * FROM {$pre}menu_favorite WHERE uid={$_SESSION['user']['uid']}) AS m ON n.nid = m.nid\n\t\t\t\t\t\t\t WHERE n.type=2 OR (n.show=1 AND m.nid is not null)";
         }
         $nodeData = $nodeModel->query($sql);
         $nodeData = Data::channelLevel($nodeData, 0, "", "nid");
         $this->assign('data', $nodeData);
         $this->display();
     }
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:32,代码来源:IndexController.class.php


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