public function actionShow() { $uid = Ibos::app()->user->uid; $docid = EnvUtil::getRequest("id"); $version = EnvUtil::getRequest("version"); if (empty($docid)) { $this->ajaxReturn("", "JSONP"); } $officialDocEntity = new ICOfficialdoc($docid); $officialDoc = $officialDocEntity->getAttributes(); if ($version) { $versionData = OfficialdocVersion::model()->fetchByAttributes(array("docid" => $docid, "version" => $version)); $officialDoc = array_merge($officialDoc, $versionData); } if (!empty($officialDoc)) { if (!OfficialdocUtil::checkReadScope($uid, $officialDoc)) { $this->error(Ibos::lang("You do not have permission to read the officialdoc"), $this->createUrl("default/index")); } $data = ICOfficialdoc::getShowData($officialDoc); OfficialdocReader::model()->addReader($docid, $uid); Officialdoc::model()->updateClickCount($docid, $data["clickcount"]); $page = EnvUtil::getRequest("page"); $criteria = new CDbCriteria(); $pages = new CPagination(OfficialdocUtil::getCharacterLength($data["content"])); $pages->pageSize = 2000; $pages->applyLimit($criteria); $tmpContent = OfficialdocUtil::subHtml($data["content"], $pages->getCurrentPage() * $pages->getPageSize(), ($pages->getCurrentPage() + 1) * $pages->getPageSize()); $data["content"] = $tmpContent; if (!empty($page) && $page != 1) { $data["content"] = "<div><div style=\"border-bottom:4px solid #e26f50;margin-top:60px;\"></div><div style=\"border-top:1px solid #e26f50;margin-top:4px;\"><div><p style=\"text-align:center;\"></p><div id=\"original-content\" style=\"min-height:400px;font:16px/2 fangsong,simsun;color:#666;\"><table cellspacing=\"0\" cellpadding=\"0\" width=\"95%\" align=\"center\"><tbody><tr><td class=\"p1\"><span><p>" . $tmpContent . "</p>"; $data["content"] = OfficialdocUtil::subHtml($data["content"], 0, $pages->pageSize * 2); } $params = array("data" => $data, "pages" => $pages, "dashboardConfig" => Yii::app()->setting->get("setting/docconfig")); if ($data["rcid"]) { $params["rcType"] = RcType::model()->fetchByPk($data["rcid"]); } } else { $params = ""; } $this->ajaxReturn($params, "JSONP"); }
public function actionShow() { if (EnvUtil::getRequest("op") == "sign") { $this->sign(); exit; } $uid = Ibos::app()->user->uid; $docid = intval(EnvUtil::getRequest("docid")); $version = EnvUtil::getRequest("version"); if (empty($docid)) { $this->error(Ibos::lang("Parameters error", "error")); } $officialDoc = Officialdoc::model()->fetchByPk($docid); if ($version) { $versionData = OfficialdocVersion::model()->fetchByAttributes(array("docid" => $docid, "version" => $version)); $officialDoc = array_merge($officialDoc, $versionData); } if (!empty($officialDoc)) { if (!OfficialdocUtil::checkReadScope($uid, $officialDoc)) { $this->error(Ibos::lang("You do not have permission to read the officialdoc"), $this->createUrl("officialdoc/index")); } $data = ICOfficialdoc::getShowData($officialDoc); $signInfo = OfficialdocReader::model()->fetchSignInfo($docid, $uid); OfficialdocReader::model()->addReader($docid, $uid); Officialdoc::model()->updateClickCount($docid, $data["clickcount"]); $needSignUids = Officialdoc::model()->fetchAllUidsByDocId($docid); $needSign = in_array($uid, $needSignUids); $params = array("data" => $data, "signInfo" => $signInfo, "dashboardConfig" => Ibos::app()->setting->get("setting/docconfig"), "needSign" => $needSign); if ($data["rcid"]) { $params["rcType"] = RcType::model()->fetchByPk($data["rcid"]); } if ($officialDoc["status"] == 2) { $temp[0] = $params["data"]; $temp = ICOfficialdoc::handleApproval($temp); $params["data"] = $temp[0]; $params["isApprovaler"] = $this->checkIsApprovaler($officialDoc, $uid); } if (!empty($data["attachmentid"])) { $params["attach"] = AttachUtil::getAttach($data["attachmentid"]); } $this->setPageTitle(Ibos::lang("Show officialdoc")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Information center")), array("name" => Ibos::lang("Officialdoc"), "url" => $this->createUrl("officialdoc/index")), array("name" => Ibos::lang("Show officialdoc")))); $this->render("show", $params); } else { $this->error(Ibos::lang("No permission or officialdoc not exists"), $this->createUrl("officialdoc/index")); } }