/**
  * [慢生活页面]
  */
 public function newlist()
 {
     // 接收类型ID
     $typeid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
     // 头部样式
     $this->header();
     // 内容样式
     // include_once(VIEW_DIR.'/temp/newlist.html');
     $this->view->display('temp/newlist2_1.html');
     // 获取页码
     $page = isset($_GET['page']) ? $_GET['page'] : 1;
     //从用户点击操作携带过来的参数中获取
     // 获取每页显示记录
     $pagecount = $GLOBALS['config']['admin_goods_pagecount'];
     // // 获取文章记录
     // $article = new ArticeModel();
     $article = new ArticeModel();
     // 获取总记录数
     $counts = $article->getCounts();
     //求出总页数
     $pages = ceil($counts / $pagecount);
     // $articles = $article->getAllArticle($pagecount,$page,$typeid);
     $articles = $article->getTypeName($pagecount, $page, $typeid);
     foreach ($articles as $key => $value) {
         $this->view->assgin('title', $value['a_title']);
         $this->view->assgin('content', $this->sysSubStr(htmlspecialchars_decode($value['a_content']), 250));
         $this->view->assgin('time', date('Y-m-d', $value['a_time']));
         $this->view->assgin('name', $value['a_username']);
         $this->view->assgin('type', $value['s_name']);
         $this->view->assgin('scan', $value['a_scan']);
         $this->view->assgin('Reply_Num', $value['replysum']);
         $this->view->assgin('aid', $value['a_id']);
         $this->view->assgin('tid', $value['s_id']);
         $this->view->assgin('thumbimg', $value['a_thumb_img']);
         $this->view->display('temp/newlist2_2.html');
     }
     //添加分页按钮
     $pagestr = Page::setAHtmlPage('index.php', 'newlist', 'newlist', $counts, $pagecount, $page);
     $this->view->assgin('pagestr', $pagestr);
     $this->view->display('temp/newlist2_3.html');
     // 获取所有文章分类 慢生活分类ID为1
     $type = new SortArticleModel();
     $types = $type->getTypeById(1);
     // 获取栏目推荐
     $hots = $article->getTypeHot($typeid);
     // 获取点击排行
     $articles = $article->getTypeScan();
     // 获取最新评论
     $talk = new ReplayModel();
     $talks = $talk->getReplay();
     // 备案
     $filings = new InitModel();
     $filing = $filings->getOne();
     // 右边样式
     include_once VIEW_DIR . '/temp/newlist2.html';
 }
 /**
  * [模版分享页面]
  */
 public function share()
 {
     // 接收类型ID
     $typeid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
     // 头部样式
     $this->header();
     if ($typeid <= 0) {
         // 实例化文章
         $article = new ArticeModel();
         // 获取所有文章分类 模版分类ID为
         $type = new SortArticleModel();
         $types = $type->getTypeById(2);
         // 遍历个人博客模版
         foreach ($types as $k => $v) {
             // 个人博客板块
             if ($temp = $article->getTypeNameImg($v['s_id'])) {
                 $conten[] = $temp;
             }
             // 保存类型名称
             $typename[] = $v['s_name'];
         }
         // 内容样式 share
         include_once VIEW_DIR . '/temp/share.html';
     } else {
         // 获取所有文章分类 模版分类ID为
         $type = new SortArticleModel();
         $types = $type->getTypeById(2);
         $article = new ArticeModel();
         // 获取页码
         $page = isset($_GET['page']) ? $_GET['page'] : 1;
         // 获取每页显示记录数
         $pagecount = $GLOBALS['config']['admin_goods_pagecount'];
         // 获取所有记录资源
         $conten = $article->getTypeNameAll($pagecount, $page, $typeid);
         // 获取总记录数
         $counts = count($types);
         // 计算总页数
         $pages = ceil($counts / $pagecount);
         //添加分页按钮
         $pagestr = Page::setAHtmlPage('index.php', 'share', 'share', $counts, $pagecount, $page, $typeid);
         include_once VIEW_DIR . '/temp/share1.html';
     }
     // 获取栏目推荐
     $hots = $article->getTypeHot($typeid);
     // 获取点击排行
     $articles = $article->getTypeScan();
     // 获取最新评论
     $talk = new ReplayModel();
     $talks = $talk->getReplay();
     // 备案
     $filings = new InitModel();
     $filing = $filings->getOne();
     // 右边样式
     include_once VIEW_DIR . '/temp/share2.html';
 }
 /**
  * [编辑文章]
  * By:0x584A
  * Date:2015年9月21日 12:54:46
  */
 public function editartice()
 {
     // 接收ID
     $aid = intval($_REQUEST['editid']);
     // 实例化
     $article = new ArticeModel();
     $types = new SortArticleModel();
     $type = $types->getAllType();
     $list = $article->getById($aid);
     include_once VIEW_DIR . '/edit_artice.html';
 }
 /**
  * 删除文章
  * By:0x584A
  * Date:2015年9月21日 12:56:39
  */
 public function delartice()
 {
     // 接收删除ID
     $aid = intval($_REQUEST['delid']);
     //判断删除的文章是否存在
     $article = new ArticeModel();
     $title = $article->getById($aid);
     if ($title) {
         $article->deleteByID($aid);
         $logs = new LogsModel();
         $logs->insertOne($_SESSION['adminuser']['u_name'] . "删除文章【" . $title['a_title'] . "】成功");
         $this->success('index.php?c=index&a=listartice', '删除成功..');
     } else {
         $logs = new LogsModel();
         $logs->insertOne($_SESSION['adminuser']['u_name'] . "删除文章【" . $title['a_title'] . "】<font style='color:red'>失败</font>");
         $this->error("index.php?c=index&a=listartice", '删除失败,请联系管理员..');
     }
 }
 /**
  * 显示文章详细页面
  */
 public function show()
 {
     // 接收文章id
     $aid = isset($_REQUEST['aid']) ? intval($_REQUEST['aid']) : '';
     // 接收类型id
     $tid = isset($_REQUEST['tid']) ? intval($_REQUEST['tid']) : '';
     // var_dump($_REQUEST);
     // exit;
     if (empty($aid) || $aid == null || empty($tid) || $tid == null) {
         header('location:index.php');
     }
     // 取出文章
     $article = new ArticeModel();
     $articles = $article->getByIdandType($aid, $tid);
     if (count($articles) == 0) {
         $this->error('index.php', '没有该片文章...');
     }
     // 文章浏览数加1
     $article->updateScan($aid);
     //上一篇文章
     $Previous = $article->getPreviousArtice($articles['a_id']);
     //下一篇文章
     $next = $article->getNextArtice($articles['a_id']);
     // 头部样式
     $this->header();
     // 遍历评论
     $replay = new ReplayModel();
     $rows = $replay->getReplayByTypeId($aid);
     // 内容样式
     include_once VIEW_DIR . '/temp/show.html';
     // 右边样式
     // 获取所有文章分类 慢生活分类ID为1
     $type = new SortArticleModel();
     $types = $type->getTypeById(1);
     // 获取栏目推荐
     $hots = $article->getTypeHot();
     // 获取最新评论
     $talk = new ReplayModel();
     $talks = $talk->getReplay();
     // 获取点击排行
     $articles = $article->getTypeScan();
     // 备案
     $filings = new InitModel();
     $filing = $filings->getOne();
     include_once VIEW_DIR . '/temp/show2.html';
 }