private function handleCancel($assignmentId)
 {
     Assignment::model()->modify($assignmentId, array("status" => 4));
     AssignmentApply::model()->deleteAll("assignmentid = {$assignmentId}");
     $this->addStepComment($assignmentId, Ibos::lang("Cancel the assignment"));
     AssignmentLog::model()->addLog($assignmentId, "cancel", Ibos::lang("Cancel the assignment"));
     return true;
 }
Beispiel #2
0
 public function actionShow()
 {
     $op = EnvUtil::getRequest("op");
     if (empty($op)) {
         $assignmentId = intval(EnvUtil::getRequest("assignmentId"));
         $checkRes = $this->checkAvailableById($assignmentId);
         if (!$checkRes["isSuccess"]) {
             $this->error($checkRes["msg"], $this->createUrl("unfinished/index"));
         }
         $assignment = Assignment::model()->fetchByPk($assignmentId);
         if (!$this->checkShowPermissions($assignment) && !$this->checkIsSup($assignment)) {
             $this->error(Ibos::lang("You donot have permission to view"), $this->createUrl("unfinished/index"));
         }
         if (!empty($assignment["attachmentid"])) {
             $assignment["attach"] = AttachUtil::getAttach($assignment["attachmentid"]);
         }
         if (!empty($assignment["stamp"])) {
             $assignment["stampUrl"] = Stamp::model()->fetchStampById($assignment["stamp"]);
         }
         $apply = AssignmentApply::model()->fetchByAttributes(array("assignmentid" => $assignmentId));
         $applyData = $this->handleApplyData($assignmentId, $apply);
         $isDesigneeuid = $this->checkIsDesigneeuid($assignment["designeeuid"]);
         $isChargeuid = $this->checkIsChargeuid($assignment["chargeuid"]);
         if ($isChargeuid && $assignment["status"] == 0) {
             Assignment::model()->modify($assignmentId, array("status" => 1));
             $assignment["status"] = 1;
         }
         AssignmentLog::model()->addLog($assignmentId, "view", Ibos::lang("View the assignment"));
         $participantuidArr = explode(",", $assignment["participantuid"]);
         $participantuid = array_filter($participantuidArr, create_function("\$v", "return !empty(\$v);"));
         $reminds = AssignmentRemind::model()->fetchAllByUid(Ibos::app()->user->uid);
         $assignment["remindtime"] = in_array($assignmentId, array_keys($reminds)) ? $reminds[$assignmentId] : 0;
         $params = array("isDesigneeuid" => $isDesigneeuid, "isChargeuid" => $isChargeuid, "designee" => User::model()->fetchByUid($assignment["designeeuid"]), "charge" => User::model()->fetchByUid($assignment["chargeuid"]), "participantCount" => count($participantuid), "participant" => User::model()->fetchRealnamesByUids($participantuid, "、"), "assignment" => AssignmentUtil::handleShowData($assignment), "applyData" => CJSON::encode($applyData));
         $this->setPageTitle(Ibos::lang("See the assignment details"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Assignment"), "url" => $this->createUrl("unfinished/index")), array("name" => Ibos::lang("Assignment details"))));
         $this->render("show", $params);
     } else {
         $this->{$op}();
     }
 }