コード例 #1
0
ファイル: DefaultController.php プロジェクト: AxelPanda/ibos
 public function actionIndex()
 {
     $op = EnvUtil::getRequest("op");
     $option = empty($op) ? "default" : $op;
     $routes = array("default", "show", "search", "getReader", "getReaderByDeptId", "getVoteCount", "preview");
     if (!in_array($option, $routes)) {
         $this->error(Ibos::lang("Can not find the path"), $this->createUrl("default/index"));
     }
     $uid = Ibos::app()->user->uid;
     if ($option == "default") {
         $catid = intval(EnvUtil::getRequest("catid"));
         $childCatIds = "";
         if (!empty($catid)) {
             $this->catid = $catid;
             $childCatIds = ArticleCategory::model()->fetchCatidByPid($this->catid, true);
         }
         if (EnvUtil::getRequest("param") == "search") {
             $this->search();
         }
         Article::model()->cancelTop();
         Article::model()->updateIsOverHighLight();
         $type = EnvUtil::getRequest("type");
         $articleidArr = ArticleReader::model()->fetchArticleidsByUid($uid);
         $this->condition = ArticleUtil::joinListCondition($type, $articleidArr, $childCatIds, $this->condition, $this->catid);
         $datas = Article::model()->fetchAllAndPage($this->condition);
         $articleList = ICArticle::getListData($datas["datas"], $uid);
         $params = array("pages" => $datas["pages"], "datas" => $articleList, "categoryOption" => $this->getCategoryOption());
         if ($type == "notallow") {
             $view = "approval";
             $params["datas"] = ICArticle::handleApproval($params["datas"]);
         } else {
             $view = "list";
         }
         $this->setPageTitle(Ibos::lang("Article"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Information center")), array("name" => Ibos::lang("Article"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Article list"))));
         $this->render($view, $params);
     } else {
         $this->{$option}();
     }
 }
コード例 #2
0
ファイル: MICArticle.php プロジェクト: AxelPanda/ibos
 public function getList($type = 1, $catid = 0, $search = "")
 {
     $gUid = Ibos::app()->user->uid;
     $childCatIds = "";
     if (!empty($catid)) {
         $this->catid = $catid;
         $childCatIds = ArticleCategory::model()->fetchCatidByPid($this->catid, true);
     }
     if (!empty($search)) {
         $this->condition = "subject like '%{$search}%'";
     }
     $articleidArr = ArticleReader::model()->fetchArticleidsByUid(Ibos::app()->user->uid);
     $this->condition = ArticleUtil::joinListCondition($type, $articleidArr, $childCatIds, $this->condition);
     $datas = Article::model()->fetchAllAndPage($this->condition);
     $listData = $datas["datas"];
     foreach ($listData as $key => $value) {
         $value["content"] = StringUtil::cutStr(strip_tags($value["content"]), 30);
         $listData[$key] = array_filter($value);
         $listData[$key]["readstatus"] = ArticleReader::model()->checkIsRead($value["articleid"], $gUid);
     }
     $return["datas"] = $listData;
     $return["pages"] = array("pageCount" => $datas["pages"]->getPageCount(), "page" => $datas["pages"]->getCurrentPage(), "pageSize" => $datas["pages"]->getPageSize());
     return $return;
 }