Example #1
0
 public function indexAction()
 {
     $ArticleMapper = new Application_Model_ArticleMapper();
     if ($_SESSION['user']['DeptID'] == 0) {
         $AllPub = $ArticleMapper->countArticleByStamp(0, 2147483647, 1);
         $AllUnPub = $ArticleMapper->countArticleByStamp(0, 2147483647, 0);
         $res_UnRead = $ArticleMapper->findArticleByStampForList('all', -1, -1, -1, $_SESSION['user']['LastLoginTime'], -1);
         $res_Self = $ArticleMapper->findArticleForList('all', -1, -1, $_SESSION['user']['UserID']);
         $res_SelfReject = $ArticleMapper->findArticleForList('reject', -1, -1, $_SESSION['user']['UserID']);
         $this->view->All = $AllPub['count'] + $AllUnPub['count'];
         $this->view->UnRead = count($res_UnRead);
         $this->view->Self = count($res_Self);
         $this->view->res_Self = $res_Self;
         $this->view->SelfReject = count($res_SelfReject);
     } else {
         $NowOfWeek = date("w") ? date("w") : 7;
         $ThisWeekBeginStamp = strtotime(date('Y-m-d', time() - 86400 * ($NowOfWeek - 1)) . ' 00:00:00');
         $res_SelfThisWeek = $ArticleMapper->findArticleByStampForList('all', -1, -1, $_SESSION['user']['UserID'], $ThisWeekBeginStamp, -1);
         $res_Self = $ArticleMapper->findArticleForList('all', -1, -1, $_SESSION['user']['UserID']);
         $res_SelfReject = $ArticleMapper->findArticleForList('reject', -1, -1, $_SESSION['user']['UserID']);
         $res_Dept = $ArticleMapper->findArticleForList('all', $_SESSION['user']['DeptID'], -1, -1);
         $res_DeptWait = $ArticleMapper->findArticleForList('wait', $_SESSION['user']['DeptID'], -1, -1);
         $res_DeptReject = $ArticleMapper->findArticleForList('reject', $_SESSION['user']['DeptID'], -1, -1);
         $this->view->SelfThisWeek = count($res_SelfThisWeek);
         $this->view->Self = count($res_Self);
         $this->view->SelfReject = count($res_SelfReject);
         $this->view->Dept = count($res_Dept);
         $this->view->DeptWait = count($res_DeptWait);
         $this->view->DeptReject = count($res_DeptReject);
         $this->view->res_Self = $res_Self;
     }
     $DeptMapper = new Application_Model_DepartmentMapper();
     $arr = $DeptMapper->findAllDept();
     $this->view->arrDept = $arr;
     $ColumnMapper = new Application_Model_ColumnMapper();
     $arr = $ColumnMapper->findAllColumn();
     $this->view->arrColumn = $arr;
 }
Example #2
0
 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;
     }
 }