Ejemplo n.º 1
0
 /**
 * 留言列表
 * @date: 2015-12-30 上午02:11:24
 * @author: zhouqg
 * @param: variable
 * @return:
 */
 public function index()
 {
     // 搜索功能
     $keyword = I('post.keyword');
     if (!empty($keyword)) {
         $where['message_title'] = array('like', "%{$keyword}%");
         $this->assign('keyword', $keyword);
     }
     //栏目选择
     $selColumn = I('post.selColumn');
     if (!empty($selColumn) && $selColumn != '0') {
         $where['column_id'] = $selColumn;
         $this->assign('selColumn', $selColumn);
     }
     //获得栏目列表
     $m = D('Column')->where(array('model_id' => $this->modelId))->order('column_sort ASC')->select();
     $m = Category::unlimitedForLevel($m, '  ├─');
     $this->assign('Column', $m);
     $m = D('Message');
     $where['message_del'] = '0';
     $order = 'message_sort,message_addtime desc';
     $result = D('Message')->where($where)->relation(true)->select();
     //**分页实现代码
     $count = count($result);
     // 查询满足要求的总记录数
     $Page = new \Think\Page($count, 15);
     // 实例化分页类 传入总记录数和每页显示的记录数(20)
     $show = $Page->show();
     // 分页显示输出
     $this->assign('page', $show);
     // 赋值分页输出
     $this->assign('count', $count);
     // 赋值分页输出
     //**分页实现代码
     $result = D('Message')->where($where)->relation(true)->limit($Page->firstRow . ',' . $Page->listRows)->order($order)->select();
     foreach ($result as $k => $v) {
         $result[$k]['message_title'] = Common::substr_ext($v['message_title'], 0, 16, 'utf-8', "");
     }
     //     dump($result);
     //     exit;
     $this->assign('vlist', $result);
     //赋值
     $this->display();
 }
Ejemplo n.º 2
0
 /**
  * 栏目添加
  * @date: 2015-12-23 上午09:21:48
  * @author: zhouqg
  * @param: variable
  * @return:
  */
 public function add()
 {
     //显示所属栏目
     $id = I('get.id');
     if (!$id) {
         $id = '0';
     }
     $m = D('Column')->order('column_sort ASC')->select();
     $m = Category::unlimitedForLevel($m, '  ├─');
     //新闻栏目为1
     $this->assign('cate', $m);
     $this->assign('pid', $id);
     //显示栏目所属模型
     $m = M('Model')->select();
     $this->assign('Modellist', $m);
     $m = D('Column');
     //读取父类模型id
     $modelId = $m->find($id);
     $this->assign('modelId', $modelId['model_id']);
     $this->display();
 }
 /**
  * 栏目首页显示
  */
 public function index()
 {
     import('Class.Category', APP_PATH);
     //该文件放在APP所在目录下的Class目录,当前项目路径
     $m = D('Column')->order('column_sort ASC', 'column_addtime ASC')->relation(true)->select();
     $m = Category::unlimitedForLevel($m, '   ├─');
     //关联查询模型的名字
     foreach ($m as $k3 => $v3) {
         $url = $v3['url'];
         $mm = D('Model');
         $data['model_table'] = $url;
         $arr = $mm->where($data)->select();
         if ($v3['column_link'] == 1) {
             $m[$k3]['model_name'] = '<span style="color:#FF0000">外部链接</span>';
         }
         if ($v3['column_link'] == 2) {
             $m[$k3]['model_name'] = '内部链接';
         }
         if ($v3['column_link'] == 0) {
             $m[$k3]['model_name'] = $arr['0']['model_name'];
         }
     }
     //栏目链接重构
     foreach ($m as $k3 => $v3) {
         if ($v3['column_link'] == 1) {
             $m[$k3]['url'] = '';
         }
         if ($v3['column_link'] == 2) {
             $m[$k3]['url'] = '';
         }
         if ($v3['column_link'] == 0) {
             $m[$k3]['url'] = __APP__ . '/' . MODULE_NAME . '/' . $v3['url'] . '/' . index . '/' . 'id' . '/' . $v3['id'];
         }
     }
     //     	dump($m);
     //     	exit;
     $this->assign('vlist', $m);
     $this->display();
 }
Ejemplo n.º 4
0
 /**
 * 修改单页
 * @date: 2015-12-29 上午02:24:35
 * @author: zhouqg
 * @param: variable
 * @return:
 */
 public function edit()
 {
     $id = I('get.id');
     $m = D('Page');
     //读取数据库模型model文件,关联模型。
     $arr = $m->relation(true)->find($id);
     $arr['page_summary_decode'] = html_entity_decode($arr['page_summary']);
     $arr['page_content_decode'] = html_entity_decode($arr['page_content']);
     $this->assign('cate', $arr);
     $m = D('Column')->where(array('model_id' => $this->modelId))->order('column_sort ASC')->select();
     $m = Category::unlimitedForLevel($m, '&nbsp;&nbsp;├─');
     $this->assign('column', $m);
     $this->display();
 }
Ejemplo n.º 5
0
 /**
 * 修改新闻
 * @date: 2015-12-23 上午02:24:35
 * @author: zhouqg
 * @param: variable
 * @return:
 */
 public function edit()
 {
     $id = I('get.id');
     $m = D('News');
     //读取数据库模型model文件,关联模型。
     $arr = $m->relation(true)->find($id);
     $arr['news_content_decode'] = html_entity_decode($arr['news_content']);
     $this->assign('cate', $arr);
     $m = D('Column')->where(array('model_id' => $this->modelId))->order('column_sort ASC')->select();
     $m = Category::unlimitedForLevel($m, '&nbsp;&nbsp;├─');
     $this->assign('column', $m);
     //读取原有属性的id  然后跟属性数据库的值对比  有则置值为1  没有则是0
     $m = D('News');
     //读取数据库模型model文件,关联模型。
     $arr = $m->relation(true)->find($id);
     $arr = $arr['child'];
     foreach ($arr as $k => $v) {
         $arr[$k] = $v['id'];
     }
     //文章属性
     $attr = M('Attr')->where(array('model_id' => $this->modelId))->select();
     foreach ($attr as $k => $v) {
         if (in_array($v['id'], $arr)) {
             $attr[$k]['access'] = '1';
         } else {
             $attr[$k]['access'] = '0';
         }
     }
     $this->assign('attr', $attr);
     $this->display();
 }
Ejemplo n.º 6
0
 /**
  * 显示文章修改
  */
 public function edit()
 {
     $id = I('get.id');
     $m = D('News');
     //读取数据库模型model文件,关联模型。
     $arr = $m->relation(true)->find($id);
     //dump($arr);
     //exit;
     //文章属性
     $attr = M('Attr')->select();
     $this->assign('flagtypelist', $attr);
     //显示所属栏目
     $m = M('Column')->order('column_sort ASC')->select();
     $m = Category::unlimitedForLevel($m, '&nbsp;&nbsp;├─');
     $this->assign('Columnlist', $m);
     $this->assign('cate', $arr);
     $this->display();
 }
Ejemplo n.º 7
0
 /**
  * 显示回收站批量移动
  */
 public function movetrach()
 {
     //dump($_POST);
     //exit;
     $id = I('post.id');
     //dump($id);
     //exit;
     if ($id == null) {
         $this->error('请选择删除项!');
     }
     $id_one = $id[0];
     //dump($id_one);
     //exit;
     $m = D('News');
     //读取数据库模型model文件,关联模型。
     $arr = $m->relation(true)->find($id_one);
     //dump($arr);
     //exit;
     //组合数组赋值给前台显示
     $id = implode(',', $id);
     $this->assign('data', $id);
     //显示所属栏目
     $m = M('Column')->order('column_sort ASC')->select();
     $m = Category::unlimitedForLevel($m, '&nbsp;&nbsp;├─');
     $this->assign('Columnlist', $m);
     $this->assign('cate', $arr);
     $this->display();
 }
 /**
  * 显示文章修改
  */
 public function edit()
 {
     $id = I('get.id');
     $m = D('News');
     //读取数据库模型model文件,关联模型。
     $arr = $m->relation(true)->find($id);
     $arr['news_showpic'] = __ROOT__ . $arr['news_pic'];
     //     	dump($arr);
     //     	exit;
     $this->assign('cate', $arr);
     //读取原有属性的id  然后跟属性数据库的值对比  有则置值为1  没有则是0
     $m = D('News');
     //读取数据库模型model文件,关联模型。
     $arr = $m->relation(true)->find($id);
     $arr = $arr['child'];
     //     	dump($arr);
     //     	exit;
     foreach ($arr as $k2 => $v2) {
         $arr[$k2] = $v2['id'];
     }
     //     	dump($arr);
     //     	exit;
     //文章属性
     $attr = M('Attr')->select();
     foreach ($attr as $k2 => $v2) {
         if (in_array($v2['id'], $arr)) {
             $attr[$k2]['access'] = '1';
         } else {
             $attr[$k2]['access'] = '0';
         }
     }
     $this->assign('flagtypelist', $attr);
     //     	dump($attr);
     //     	dump($arr);
     //     	exit;
     //显示所属栏目
     $m = M('Column')->order('column_sort ASC')->select();
     $m = Category::unlimitedForLevel($m, '&nbsp;&nbsp;├─');
     $this->assign('Columnlist', $m);
     $this->display();
 }