public function Guestbook($param) { // dump($param);die; if ($param['post_title'] == "留言板") { //前台创建的“留言板”页面 //第一次使用,创建留言本表 $where['status'] = 1; $where['reply'] = array('exp', 'is not null'); $order = 'date DESC'; $config = $this->getConfig(); // dump($config);die; $page = $config['records']; $count = count(M('guestbook')->where($where)->select()); if ($count != 0) { $Page = new GreenPage($count, $page); // 实例化分页类 传入总记录数 $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; } $message = M('guestbook')->where($where)->order($order)->limit($limit)->select(); // dump(M('guestbook')->getLastSql());die; $this->assign('count', $count); $this->assign('pages', ceil($count / $page)); $this->assign('pager', $pager_bar); $this->assign('guestbook', $message); $this->assign('post_id', I('info')); $this->display('guestbook'); } elseif ($param = 'menu') { echo "\n <li><a href='" . addons_url('Guestbook://Guestbook/manage') . "'><h4>留言板</h4></a></li>\n "; } }
/** * 查询指定标签的详细信息 * @param $info detail 查询的 id 或者slug */ public function detail($info) { $TagsLogic = new TagsLogic(); $PostsLogic = new PostsLogic(); $tag = $TagsLogic->detail($info); $this->if404($tag, "非常抱歉,没有这个标签,可能它已经躲起来了"); $posts_id = $TagsLogic->getPostsId($tag['tag_id']); $count = sizeof($posts_id); $count == 0 ? $res404 = 0 : ($res404 = 1); if (!empty($posts_id)) { $Page = new GreenPage($count, get_opinion('PAGER')); $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $posts_list = $PostsLogic->getList($limit, 'single', 'post_id desc', true, array(), $posts_id); } $this->assign('title', $tag['tag_name']); // 赋值数据集 $this->assign('res404', $res404); $this->assign('postslist', $posts_list); // 赋值数据集 $this->assign('pager', $pager_bar); // 赋值分页输出 $this->assign('breadcrumbs', get_breadcrumbs('tags', $tag['tag_id'])); $this->display('Archive/single-list'); }
public function index() { $page = I('get.page', get_opinion('PAGER')); $count = D('Weixinre')->count(); $Page = new GreenPage($count, $page); // 实例化分页类 传入总记录数 $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $weixinre = D('Weixinre')->limit($limit)->select(); $this->assign('pager', $pager_bar); $this->assign('weixinre', $weixinre); $this->display(); }
public function manage() { $order = 'date DESC'; $page = I('get.page', get_opinion('PAGER')); $count = count(M('guestbook')->where($where)->select()); if ($count != 0) { $Page = new GreenPage($count, $page); // 实例化分页类 传入总记录数 $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; } $message = M('guestbook')->where($where)->order($order)->limit($limit)->select(); $this->assign('message', $message); $this->assign('action', '留言板管理'); $this->assign('module', '留言板'); $this->assign('module_url', U('Admin/Custom/plugin')); $this->display(T('Addons://Guestbook@Guestbook/manage')); }
public function index() { $page = I('get.page', get_opinion('PAGER')); $Bmb = D('Bmb'); //$stu = $Stu->select(); $stu_count = $Bmb->count(); if ($stu_count != 0) { $Page = new GreenPage($stu_count, $page); // 实例化分页类 传入总记录数 $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $stu_list = $Bmb->join(GreenCMS_DB_PREFIX . 'stu ON ' . GreenCMS_DB_PREFIX . 'stu.ksh = ' . GreenCMS_DB_PREFIX . 'bmb.ksh')->limit($limit)->select(); } $this->assign('stu_count', $stu_count); $this->assign('stu_list', $stu_list); $this->assign('pager', $pager_bar); $this->assign('action', '2011报名管理'); $this->display(''); }
public function log() { $page = I('get.page', 20); $where = I('get.'); $LogLogic = new LogLogic(); $count = $LogLogic->countAll($where); // 查询满足要求的总记录数 if ($count != 0) { $Page = new GreenPage($count, $page); // 实例化分页类 传入总记录数 $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $log_list = $LogLogic->getList($limit, $where); } $this->assign('pager_bar', $pager_bar); $this->assign('log_list', $log_list); $this->display(); }
/** * 标签 */ public function tag() { $page = I('get.page', get_opinion('PAGER')); $TagsLogic = new TagsLogic(); $count = $TagsLogic->countAll(); // 查询满足要求的总记录数 if ($count != 0) { $Page = new GreenPage($count, $page); // 实例化分页类 传入总记录数 $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $tags = $TagsLogic->selectWithPostsCount($limit); } $this->assign('tags', $tags); $this->assign('pager', $pager_bar); $this->display(); }
public function loginlog() { $page = I('get.page', 20); $Login_log = D('login_log'); $count = $Login_log->count(); // 查询满足要求的总记录数 if ($count != 0) { $Page = new GreenPage($count, $page); // 实例化分页类 传入总记录数 $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $log = $Login_log->limit($limit)->select(); } $this->assign('pager_bar', $pager_bar); $this->assign('log', $log); $this->display(); }
/** * 兼容旧式CMS深目录结构的二级cat结构 * @param $info */ public function channel($info) { //TODO 兼容旧式CMS深目录结构的二级cat结构 $Cat = new CatsLogic(); $cat = $Cat->detail($info); $children = $Cat->getChildren($cat['cat_id']); $Cat = new CatsLogic(); $Posts = new PostsLogic(); $cat = $Cat->detail($info); $this->if404($cat, "非常抱歉,没有这个分类,可能它已经躲起来了"); //优雅的404 $posts_id = $Cat->getPostsId($cat['cat_id']); $count = sizeof($posts_id); $count == 0 ? $res404 = 0 : ($res404 = 1); if (!empty($posts_id)) { $Page = new GreenPage($count, get_opinion('PAGER')); $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $posts_list = $Posts->getList($limit, 'single', 'post_id desc', true, array(), $posts_id); } $this->assign('children', $children); $this->assign('title', $cat['cat_name']); // 赋值数据集 $this->assign('res404', $res404); $this->assign('postslist', $posts_list); // 赋值数据集 $this->assign('pager', $pager_bar); // 赋值分页输出 $this->assign('breadcrumbs', get_breadcrumbs('cats', $cat['cat_id'])); $this->display('Archive/channel-list'); }
/** * 兼容旧式CMS深目录结构的二级cat结构 * @param $info */ public function channel($info) { //TODO 兼容旧式CMS深目录结构的二级cat结构 $CatsLogic = new CatsLogic(); $cat = $CatsLogic->detail($info); $children = $CatsLogic->getChildren($cat['cat_id']); if (empty($children['cat_children'])) { $children = $CatsLogic->getChildren($children['cat_father']); } $CatsLogic = new CatsLogic(); $Posts = new PostsLogic(); $cat = $CatsLogic->detail($info); $this->if404($cat, "非常抱歉,没有这个分类,可能它已经躲起来了"); //优雅的404 $posts_id = $CatsLogic->getPostsIdWithChildren($cat['cat_id']); $count = sizeof($posts_id); $count == 0 ? $res404 = 0 : ($res404 = 1); if (!empty($posts_id)) { $Page = new GreenPage($count, get_opinion('PAGER')); $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $posts_list = $Posts->getList($limit, 'single', 'post_date desc', true, array(), $posts_id); } $this->assign('children', $children); $this->assign('title', $cat['cat_name']); // 赋值数据集 $this->assign('res404', $res404); $this->assign('postslist', $posts_list); // 赋值数据集 $this->assign('pager', $pager_bar); // 赋值分页输出 $this->assign('breadcrumbs', get_breadcrumbs('cats', $cat['cat_id'])); if (File::file_exists(T('Home@Archive/channel-list'))) { $this->display('Archive/channel-list'); } else { //TODO 这里怎么处理却决于你自己了。 // $this->error404('缺少对应的模版而不能显示'); $this->display('Archive/single-list'); } }
/** * 未知类型归档 支持年月日参数传递 和用户id * @param $method 未知类型 * @param array $args 参数 */ public function _empty($method, $args) { $title_prefix = (I('get.year', '') ? I('get.year', '') . '年' : '') . (I('get.month', '') ? I('get.month', '') . '月' : '') . (I('get.day', '') ? I('get.day', '') . '日' : ''); //TODO 通用类型 $post_type = $method; $map['post_date'] = array('like', I('get.year', '%') . '-' . I('get.month', '%') . '-' . I('get.day', '%') . '%'); if (I('get.uid') != '') { $map['user_id'] = I('get.uid'); } $PostsLogic = new PostsLogic(); $count = $PostsLogic->countAll($post_type, $map); // 查询满足要求的总记录数 $count == 0 ? $res404 = 0 : ($res404 = 1); if ($count != 0) { $Page = new GreenPage($count, C('PAGER')); $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $posts_list = $PostsLogic->getList($limit, $post_type, 'post_id desc', true, $map); } $this->assign('title', $title_prefix . '所有' . $post_type); $this->assign('res404', $res404); // 赋值数据集 $this->assign('postslist', $posts_list); // 赋值数据集 $this->assign('pager', $pager_bar); // 赋值分页输出 if (File::file_exists(T('Home@Archive/' . $post_type . '-list'))) { $this->display($post_type); } else { //TODO 这里怎么处理却决于你自己了。 $this->error404('缺少对应的模版而不能显示'); // $this->display('single-list'); } }
/** * 钩子列表 */ public function hooks() { $this->meta_title = '钩子列表'; $map = $fields = array(); Cookie('__forward__', $_SERVER['REQUEST_URI']); $count = D("Hooks")->count(); if ($count != 0) { $page = I('get.page', get_opinion('PAGER')); $Page = new GreenPage($count, $page); // 实例化分页类 传入总记录数 $pager_bar = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; $list = D("Hooks")->limit($limit)->field($fields)->select(); } $this->assign('page', $pager_bar); $this->assign('list', $list); $this->display(); }