Exemplo n.º 1
0
 public static function handleApproval($datas)
 {
     $allApprovals = Approval::model()->fetchAllSortByPk("id");
     $allCategorys = OfficialdocCategory::model()->fetchAllSortByPk("catid");
     $docApprovals = OfficialdocApproval::model()->fetchAllGroupByDocId();
     $backDocIds = OfficialdocBack::model()->fetchAllBackDocId();
     foreach ($datas as &$doc) {
         $doc["back"] = in_array($doc["docid"], $backDocIds) ? 1 : 0;
         $doc["approval"] = $doc["approvalStep"] = array();
         $catid = $doc["catid"];
         if (!empty($allCategorys[$catid]["aid"])) {
             $aid = $allCategorys[$catid]["aid"];
             if (!empty($allApprovals[$aid])) {
                 $doc["approval"] = $allApprovals[$aid];
             }
         }
         if (!empty($doc["approval"])) {
             $doc["approvalName"] = !empty($doc["approval"]) ? $doc["approval"]["name"] : "";
             $doc["docApproval"] = isset($docApprovals[$doc["docid"]]) ? $docApprovals[$doc["docid"]] : array();
             $doc["stepNum"] = count($doc["docApproval"]);
             $step = array();
             foreach ($doc["docApproval"] as $docApproval) {
                 $step[$docApproval["step"]] = User::model()->fetchRealnameByUid($docApproval["uid"]);
             }
             for ($i = 1; $i <= $doc["approval"]["level"]; $i++) {
                 if ($i <= $doc["stepNum"]) {
                     $doc["approval"][$i]["approvaler"] = isset($step[$i]) ? $step[$i] : "未知";
                 } else {
                     $levelName = Approval::model()->getLevelNameByStep($i);
                     $approvalUids = $doc["approval"][$levelName];
                     $doc["approval"][$i]["approvaler"] = User::model()->fetchRealnamesByUids($approvalUids, "、");
                 }
             }
         }
     }
     return $datas;
 }
Exemplo n.º 2
0
 private function verifyComplete($docid, $uid)
 {
     Officialdoc::model()->updateAllStatusByDocids($docid, 1, $uid);
     OfficialdocApproval::model()->deleteAll("docid={$docid}");
     $doc = Officialdoc::model()->fetchByPk($docid);
     if (!empty($doc)) {
         $wbconf = WbCommonUtil::getSetting(true);
         if (isset($wbconf["wbmovement"]["article"]) && $wbconf["wbmovement"]["article"] == 1) {
             $publishScope = array("deptid" => $doc["deptid"], "positionid" => $doc["positionid"], "uid" => $doc["uid"]);
             $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $doc["subject"], "{url}" => Ibos::app()->urlManager->createUrl("officialdoc/officialdoc/show", array("docid" => $doc["docid"])))), "body" => $doc["content"], "actdesc" => Ibos::lang("Post officialdoc"), "userid" => $publishScope["uid"], "deptid" => $publishScope["deptid"], "positionid" => $publishScope["positionid"]);
             WbfeedUtil::pushFeed($doc["author"], "officialdoc", "officialdoc", $doc["docid"], $data);
         }
         UserUtil::updateCreditByAction("addofficialdoc", $doc["author"]);
     }
 }