public function index() { import('Class.Category', APP_PATH); $cate = M('cate')->order('sort ASC')->select(); $this->cate = Category::unlimitedForLevel($cate, '  --'); $this->display(); }
public function article() { import('Class.Category', APP_PATH); $cate = M('cate')->order('sort')->select(); $this->cate = Category::unlimitedForLevel($cate); $this->display(); }
public function index() { $cate = M('cate')->order('sort ASC')->select(); //$this->assign('cate', $cate)->display(); import('Class.Category', APP_PATH); // $cate = Category::unlimitedForLayer($cate); $this->cate = Category::unlimitedForLevel($cate, ' --'); $this->display(); }
public function blog() { //博文所属分类 import('Class.Category', APP_PATH); $cate = M('cate')->order('sort')->select(); $this->cate = Category::unlimitedForLevel($cate); //博文属性 $this->attr = M('attr')->select(); $this->display(); }
public function addArt() { //文章分类 import('Class.Category', APP_PATH); $column = M('column')->order('sort ASC')->select(); $this->column = Category::unlimitedForLevel($column); //文章属性 $this->attr = M('attr')->select(); $this->display(); }
public function index() { $cate = M('cate')->order('sort')->select(); import('Class/Category', APP_PATH); $this->cate = Category::unlimitedForLevel($cate); // $cate = Category::unlimitedForLayer($cate); // $cate = Category::getParents($cate,18); // $cate = Category::getChildsId($cate,3); // p($cate);die; $this->display(); }
public function index() { // require(APP_PATH.'Common/Category.class.php'); import('Category', APP_PATH . 'Common'); $cate = M('cate')->order('sort ASC')->select(); // $cate=Category::unlimitedForLayer($cate); $this->cate = $cate = Category::unlimitedForLevel($cate); // p($cate); // die; // $this->cate=$cate; $this->display(); // $this->assign('cate',$cate)->display(); }
public function blog() { // echo __ROOT__; //分类列表 import('Category', APP_PATH . '/Common'); $cate = M('cate')->order('sort ASC')->select(); $this->cate = $cate = Category::unlimitedForLevel($cate); // p($cate); //属性列表 $this->attr = $attr = M('attr')->select(); // p($attr); $this->display(); }
/** * 修改博客 * @param * @return */ public function modify() { $this->status = 1; //status,0=>新增博客,1=>修改博客. $id = $_GET['id']; $field = array('id', 'click', 'title', 'summary', 'content', 'cid'); $where = array('id' => $id); $this->blog = D('BlogRelation')->field($field)->relation(true)->where($where)->find(); $cate = M('cate')->select(); import('Class.Category', APP_NAME); $this->attr = M('attr')->select(); $this->cate = Category::unlimitedForLevel($cate); $this->display('blog'); }
public function index() { import('Class.Category', APP_PATH); $uid = session('uid'); if ($uid == 3) { $where = array('del' => 0); } else { $where = array('del' => 0, 'uid' => $uid); } $column = M('columns')->where($where)->order('sort ASC')->select(); //传递1个父ID返回所以子级分类 //$column=Category::getChilds($column,2); //传递1个父ID返回所以子级分类ID //$column=Category::getChildsID($column,2); //传递1个子ID返回所以父级分类 //$column=Category::getParents($column,2); //下拉菜单递归 //$column=Category::unlimitedForLayer($column,'pk'); //列表递归 $this->column = Category::unlimitedForLevel($column); $this->display(); }
public function addDetails() { import('Class.Category', './'); //引入无限极分类 $sortList = M('discuss_sort')->select(); //先把图文分类读出来 $sortList = deep_htmlspecialchars_decode($sortList); //查询输出了数据库数据之后记得反转义 $sortList = Category::unlimitedForLevel($sortList, ' '); //组合子分类与父分类 $this->assign('sortList', $sortList); //把分类分配过去 $this->display(); }
public function cate() { import('Class.Category', APP_PATH); $cate = M('video_cate')->order('sort ASC')->select(); $this->cate = Category::unlimitedForLevel($cate, ' --- '); $this->display(); }
public function add() { $m = M('Category'); $clist = $m->order('sort asc')->select(); import('ORG.Util.Category'); $clist = Category::unlimitedForLevel($clist); $this->assign('clist', $clist); $this->display(); }
public function editDetails() { if ($_POST) { $id = I('id', 0, 'intval'); $db = M('ad'); parent::checkField('ad_name', deep_htmlspecialchars($_POST['ad_name']), 'require', '广告名称不能为空'); //parent::checkField('content', deep_htmlspecialchars($_POST['content']), 'require', '内容不能为空'); $data = array(); $data['id'] = $id; $data['ad_name'] = I('ad_name'); $data['sort_id'] = I('parent_id'); $data['status'] = I('status'); $data['ad_pic'] = I('ad_pic'); $data['ad_url'] = I('ad_url'); $data['ad_explain'] = I('ad_explain'); $data['start_time'] = strtotime(I('start_time')); $data['end_time'] = strtotime(I('end_time')); if ($db->data($data)->save()) { $this->success('修改成功', U(GROUP_NAME . '/Ad/detailslist')); } else { $this->error('修改失败'); } } else { $id = I('id', 0, 'intval'); $this->assign('id', $id); $data = M('ad')->where(array('id' => $id))->find(); $this->assign('data', $data); import('Class.Category', './'); //引入无限极分类 $sortList = M('ad_sort')->select(); //先把广告分类读出来 $sortList = Category::unlimitedForLevel($sortList, ' '); //组合子分类与父分类 $this->assign('sortList', $sortList); //把分类分配过去 $this->display(); } }
public function changeArticle() { import('Class.Category', APP_PATH); $cate = M('cate')->order('sort')->select(); $this->cate = Category::unlimitedForLevel($cate); //读取文章属性 $this->attr = M('attr')->select(); $id = (int) $_GET['id']; $this->Article = M('article')->where(array('id' => $id))->find(); $this->display(); }
/** * 根据表单生成查询条件 * 进行列表过滤 * @param Model $model 数据对象 * @param HashMap $map 过滤条件 * @param string $sortBy 排序 * @param boolean $asc 是否正序 */ protected function _list($model, $map = array(), $sortBy = '', $asc = false) { //排序字段 默认为主键名 if (!empty($_REQUEST['_order'])) { $order = $_REQUEST['_order']; } else { $order = !empty($sortBy) ? $sortBy : $model->getPk(); } //排序方式默认按照倒序排列 //接受 sort参数 0 表示倒序 非0都 表示正序 if (!empty($_REQUEST['_sort'])) { $sort = $_REQUEST['_sort'] == 'asc' ? 'asc' : 'desc'; } else { $sort = $asc ? 'asc' : 'desc'; } //取得满足条件的记录数 $count = $model->where($map)->count(); //每页显示的记录数 if (!empty($_REQUEST['numPerPage'])) { $listRows = $_REQUEST['numPerPage']; } else { $listRows = '10'; } //设置当前页码 if (!empty($_REQUEST['pageNum'])) { $nowPage = $_REQUEST['pageNum']; } else { $nowPage = 1; } $_GET['p'] = $nowPage; //创建分页对象 import("ORG.Util.Page"); $p = new Page($count, $listRows); //分页查询数据 $list = $model->where($map)->order('sort asc')->select(); //回调函数,用于数据加工,如将用户id,替换成用户名称 if (method_exists($this, '_tigger_list')) { $this->_tigger_list($list); } //分页跳转的时候保证查询条件 foreach ($map as $key => $val) { if (!is_array($val)) { $p->parameter .= "{$key}=" . urlencode($val) . "&"; } } //分页显示 $page = $p->show(); //列表排序显示 $sortImg = $sort; //排序图标 $sortAlt = $sort == 'desc' ? '升序排列' : '倒序排列'; //排序提示 $sort = $sort == 'desc' ? 1 : 0; //排序方式 import('ORG.Util.Category'); $list = Category::unlimitedForLevel($list); //模板赋值显示 $this->assign('list', $list); $this->assign('sort', $sort); $this->assign('order', $order); $this->assign('sortImg', $sortImg); $this->assign('sortType', $sortAlt); $this->assign("page", $page); $this->assign("search", $search); //搜索类型 $this->assign("values", $_POST['values']); //搜索输入框内容 $this->assign("totalCount", $count); //总条数 $this->assign("numPerPage", $p->listRows); //每页显多少条 $this->assign("currentPage", $nowPage); //当前页码 }