public function getSidebar($catid = 0) { $sidebarAlias = "application.modules.article.views.sidebar"; $approvals = Approval::model()->fetchAllApproval(); $params = array("approvals" => $approvals, "categoryData" => $this->getCategoryOption(), "catid" => $catid); return $this->renderPartial($sidebarAlias, $params, true); }
protected function getSidebar($catid = 0) { $sidebarAlias = "application.modules.officialdoc.views.sidebar"; $approvals = Approval::model()->fetchAllApproval(); $params = array("approvals" => $approvals, "categoryData" => $this->getCategoryOption(), "catid" => $catid); $noSignCount = Officialdoc::model()->countNoSignByUid(Ibos::app()->user->uid); $params["noSignCount"] = $noSignCount; return $this->renderPartial($sidebarAlias, $params, true); }
public function actionDel() { if (Ibos::app()->request->isAjaxRequest) { $id = EnvUtil::getRequest("id"); $delRet = Approval::model()->deleteApproval($id); if ($delRet) { $ret["isSuccess"] = true; $ret["msg"] = Ibos::lang("Del succeed", "message"); } else { $ret["isSuccess"] = false; $ret["msg"] = Ibos::lang("Del failed", "message"); } $this->ajaxReturn($ret); } }
public function checkIsApproval($catid, $uid) { $aid = $this->fetchAidByCatid($catid); $approvalUids = Approval::model()->fetchApprovalUidsByIds($aid); $res = in_array($uid, $approvalUids); return $res; }
private function verify() { if (Ibos::app()->request->isAjaxRequest) { $uid = Ibos::app()->user->uid; $artIds = trim(EnvUtil::getRequest("articleids"), ","); $ids = explode(",", $artIds); if (empty($ids)) { $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Parameters error", "error"))); } $sender = User::model()->fetchRealnameByUid($uid); foreach ($ids as $artId) { $artApproval = ArticleApproval::model()->fetchLastStep($artId); if (empty($artApproval)) { $this->verifyComplete($artId, $uid); } else { $art = Article::model()->fetchByPk($artId); $category = ArticleCategory::model()->fetchByPk($art["catid"]); $approval = Approval::model()->fetch("id={$category["aid"]}"); $curApproval = Approval::model()->fetchNextApprovalUids($approval["id"], $artApproval["step"]); $nextApproval = Approval::model()->fetchNextApprovalUids($approval["id"], $artApproval["step"] + 1); if (!in_array($uid, $curApproval["uids"])) { $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("You do not have permission to verify the article"))); } if (!empty($nextApproval)) { if ($nextApproval["step"] == "publish") { $this->verifyComplete($artId, $uid); } else { ArticleApproval::model()->recordStep($artId, $uid); $config = array("{sender}" => $sender, "{subject}" => $art["subject"], "{category}" => $category["name"], "{content}" => $this->renderPartial("remindcontent", array("article" => $art, "author" => $sender), true), "{url}" => $this->createUrl("default/index", array("type" => "notallow"))); foreach ($nextApproval["uids"] as $k => $approvalUid) { if (!ArticleUtil::checkReadScope($approvalUid, $art)) { unset($nextApproval["uids"][$k]); } } Notify::model()->sendNotify($nextApproval["uids"], "article_verify_message", $config, $uid); Article::model()->updateAllStatusAndApproverByPks($artId, $uid, 2); } } } } $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Verify succeed", "message"))); } }
public static function handleApproval($datas) { $allApprovals = Approval::model()->fetchAllSortByPk("id"); $allCategorys = ArticleCategory::model()->fetchAllSortByPk("catid"); $artApprovals = ArticleApproval::model()->fetchAllGroupByArtId(); $backArtIds = ArticleBack::model()->fetchAllBackArtId(); foreach ($datas as &$art) { $art["back"] = in_array($art["articleid"], $backArtIds) ? 1 : 0; $art["approval"] = $art["approvalStep"] = array(); $catid = $art["catid"]; if (!empty($allCategorys[$catid]["aid"])) { $aid = $allCategorys[$catid]["aid"]; if (!empty($allApprovals[$aid])) { $art["approval"] = $allApprovals[$aid]; } } if (!empty($art["approval"])) { $art["approvalName"] = !empty($art["approval"]) ? $art["approval"]["name"] : ""; $art["artApproval"] = isset($artApprovals[$art["articleid"]]) ? $artApprovals[$art["articleid"]] : array(); $art["stepNum"] = count($art["artApproval"]); $step = array(); foreach ($art["artApproval"] as $artApproval) { $step[$artApproval["step"]] = User::model()->fetchRealnameByUid($artApproval["uid"]); } for ($i = 1; $i <= $art["approval"]["level"]; $i++) { if ($i <= $art["stepNum"]) { $art["approval"][$i]["approvaler"] = isset($step[$i]) ? $step[$i] : "未知"; } else { $levelName = Approval::model()->getLevelNameByStep($i); $approvalUids = $art["approval"][$levelName]; $art["approval"][$i]["approvaler"] = User::model()->fetchRealnamesByUids($approvalUids, "、"); } } } } return $datas; }
protected function getCurApproval() { $catid = EnvUtil::getRequest("catid"); $category = OfficialdocCategory::model()->fetchByPk($catid); $approval = Approval::model()->fetchByPk($category["aid"]); $this->ajaxReturn(array("approval" => $approval)); }