public function articleAction() { $ID = $this->_request->getParam("id"); if (!empty($ID)) { $ArticleMapper = new Application_Model_ArticleMapper(); $arrArticle = $ArticleMapper->findArticleById($ID); session_start(); //开启session并在下面进行判断,以便在前台不显示未审核的文章 if ($arrArticle[0]['Published'] >= 1 || isset($_SESSION['user']['Type'])) { //点击量+1 if (!isset($_SESSION['user']['Type'])) { $ArticleMapper->clickArticle($ID); } $DeptMapper = new Application_Model_DepartmentMapper(); $arr = $DeptMapper->findDept($arrArticle[0]['DeptID']); $this->view->arrDept = $arr; $ColumnMapper = new Application_Model_ColumnMapper(); $arr = $ColumnMapper->findColumn($arrArticle[0]['ColumnID']); $this->view->arrPageColumn = $arr; $arr = $ColumnMapper->findallColumn(); $this->view->arrColumn = $arr; $this->view->arrArticle = $arrArticle; $DeptID = $arrArticle[0]['DeptID'] ? $arrArticle[0]['DeptID'] : -1; $arrListrdxw = $ArticleMapper->findArticleForList('publish', $DeptID, 1, -1); $arrListbbfc = $ArticleMapper->findArticleForList('publish', $DeptID, 2, -1); $arrListhdkj = $ArticleMapper->findArticleForList('publish', $DeptID, 3, -1); $arrListczzl = $ArticleMapper->findArticleForList('publish', $DeptID, 4, -1); $arrListcysh = $ArticleMapper->findArticleForList('publish', $DeptID, 5, -1); $arrListcgxy = $ArticleMapper->findArticleForList('publish', $DeptID, 6, -1); $this->view->arrListrdxw = $arrListrdxw; $this->view->arrListbbfc = $arrListbbfc; $this->view->arrListhdkj = $arrListhdkj; $this->view->arrListczzl = $arrListczzl; $this->view->arrListcysh = $arrListcysh; $this->view->arrListcgxy = $arrListcgxy; } else { $this->_redirect('/pengbei', array('code' => 301)); exit; } } else { $this->_redirect('/pengbei'); exit; } }
/** * 文章退稿 */ public function rejectarticleAction() { $ID = $this->getRequest()->getParam('id'); $type = $this->_request->getParam("type"); $this->_helper->layout->disableLayout(); if ($type == 'post') { if (!empty($ID)) { if ($this->getRequest()->getParam('problem_format') == "on") { $Reason = "缩进存在问题,"; } else { $Reason = ""; } if ($this->getRequest()->getParam('problem_image') == "on") { $Reason .= "图片存在问题,"; } else { $Reason .= ""; } if ($this->getRequest()->getParam('problem_content') == "on") { $Reason .= "内容存在问题,"; } else { $Reason .= ""; } $Reason .= $this->getRequest()->getParam('reason'); $ArticleMapper = new Application_Model_ArticleMapper(); $res = $ArticleMapper->rejectArticle($ID, $Reason); if (!isset($res)) { $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"退稿失败 %>_<%\");history.back();</script>"; echo $string; exit; } else { $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"退稿成功!\");location.href = \"/admin/listarticle\";</script>"; echo $string; exit; } } else { $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"退稿失败 %>_<%\");history.back();</script>"; echo $string; exit; } } else { $this->view->ID = $ID; $ArticleMapper = new Application_Model_ArticleMapper(); $arrArticle = $ArticleMapper->findArticleById($ID); if (!empty($arrArticle)) { $DeptMapper = new Application_Model_DepartmentMapper(); $arr = $DeptMapper->findDept($arrArticle[0]['DeptID']); $this->view->DeptName = $arr[0]['DeptName']; $ColumnMapper = new Application_Model_UserMapper(); $arr = $ColumnMapper->findUserByID($arrArticle[0]['WriterID']); $this->view->RealName = $arr[0]['RealName']; $this->view->Title = $arrArticle[0]['Title']; $this->view->Date = date('Y-m-d', $arrArticle[0]['WriteTime']); } else { echo "非法访问"; exit; } } }