Example #1
0
 public function actionEdit()
 {
     if (!EnvUtil::submitCheck("updatesubmit")) {
         $assignmentId = intval(EnvUtil::getRequest("id"));
         $checkRes = $this->checkAvailableById($assignmentId);
         if (!$checkRes["isSuccess"]) {
             $this->ajaxReturn($checkRes);
         }
         $assignment = Assignment::model()->fetchByPk($assignmentId);
         $uid = Ibos::app()->user->uid;
         if ($uid != $assignment["designeeuid"]) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("You donot have permission to edit")));
         }
         if (!empty($assignment["attachmentid"])) {
             $assignment["attachs"] = AttachUtil::getAttach($assignment["attachmentid"]);
         }
         $assignment["starttime"] = empty($assignment["starttime"]) ? "" : date("Y-m-d H:i", $assignment["starttime"]);
         $assignment["endtime"] = empty($assignment["endtime"]) ? "" : date("Y-m-d H:i", $assignment["endtime"]);
         $assignment["chargeuid"] = StringUtil::wrapId($assignment["chargeuid"]);
         $assignment["participantuid"] = StringUtil::wrapId($assignment["participantuid"]);
         $assignment["lang"] = Ibos::getLangSource("assignment.default");
         $assignment["assetUrl"] = Ibos::app()->assetManager->getAssetsUrl("assignment");
         $editAlias = "application.modules.assignment.views.default.edit";
         $editView = $this->renderPartial($editAlias, $assignment, true);
         echo $editView;
     } else {
         $assignmentId = intval(EnvUtil::getRequest("id"));
         $assignment = Assignment::model()->fetchByPk($assignmentId);
         $this->beforeSave($_POST);
         $uid = Ibos::app()->user->uid;
         $data = $this->handlePostData();
         $data["updatetime"] = TIMESTAMP;
         $updateSuccess = Assignment::model()->updateByPk($assignmentId, $data);
         if ($updateSuccess) {
             AttachUtil::updateAttach($data["attachmentid"]);
             if ($data["chargeuid"] != $assignment["chargeuid"]) {
                 $chargeuid = StringUtil::getId($_POST["chargeuid"]);
                 $participantuid = StringUtil::getId($_POST["participantuid"]);
                 $uidArr = array_merge($participantuid, $chargeuid);
                 $this->sendNotify($assignmentId, $data["subject"], $uidArr, "assignment_new_message");
             }
             $this->addStepComment($assignmentId, Ibos::lang("Eidt the assignment"));
             AssignmentLog::model()->addLog($assignmentId, "edit", Ibos::lang("Eidt the assignment"));
             $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Update succeed", "message")));
         } else {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Update failed", "message")));
         }
     }
 }
Example #2
0
 private function update()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $repid = $_POST["repid"];
         $typeid = $_POST["typeid"];
         $uid = Ibos::app()->user->uid;
         $editRepData = array("uid" => $uid, "begindate" => strtotime($_POST["begindate"]), "enddate" => strtotime($_POST["enddate"]), "typeid" => $typeid, "subject" => StringUtil::filterCleanHtml($_POST["subject"]), "content" => $_POST["content"], "attachmentid" => $_POST["attachmentid"], "toid" => implode(",", StringUtil::getId($_POST["toid"])));
         Report::model()->modify($repid, $editRepData);
         if (isset($_POST["orgPlan"])) {
             foreach ($_POST["orgPlan"] as $recordid => $orgPlan) {
                 $updateData = array("process" => intval($orgPlan["process"]), "exedetail" => StringUtil::filterCleanHtml($orgPlan["exedetail"]));
                 if ($updateData["process"] == self::COMPLETE_FALG) {
                     $updateData["flag"] = 1;
                 }
                 ReportRecord::model()->modify($recordid, $updateData);
             }
         }
         ReportRecord::model()->deleteAll("repid=:repid AND planflag!=:planflag", array(":repid" => $repid, ":planflag" => 0));
         $isInstallCalendar = ModuleUtil::getIsEnabled("calendar");
         if ($isInstallCalendar) {
             Calendars::model()->deleteALL("`calendarid` IN(select `cid` from {{calendar_rep_record}} where `repid`={$repid})");
             CalendarRepRecord::model()->deleteAll("repid = {$repid}");
         }
         if (isset($_POST["outSidePlan"])) {
             $outSidePlan = array_filter($_POST["outSidePlan"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
             if (!empty($outSidePlan)) {
                 ReportRecord::model()->addPlans($outSidePlan, $repid, $editRepData["begindate"], $editRepData["enddate"], $uid, 1);
             }
         }
         if (isset($_POST["nextPlan"])) {
             $nextPlan = array_filter($_POST["nextPlan"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
             if (!empty($nextPlan)) {
                 ReportRecord::model()->addPlans($nextPlan, $repid, strtotime($_POST["planBegindate"]), strtotime($_POST["planEnddate"]), $uid, 2);
             }
         }
         $attachmentid = trim($_POST["attachmentid"], ",");
         AttachUtil::updateAttach($attachmentid);
         $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("default/index"));
     }
 }
Example #3
0
 public function addComment()
 {
     $return = array("isSuccess" => false, "data" => Ibos::lang("Post comment fail", "message"));
     $data = $_POST;
     foreach ($data as $key => $val) {
         $data[$key] = StringUtil::filterCleanHtml($data[$key]);
     }
     $data["uid"] = Ibos::app()->user->uid;
     $data["content"] = StringUtil::filterDangerTag($data["content"]);
     $table = ucfirst($data["table"]);
     $pk = $table::model()->getTableSchema()->primaryKey;
     $sourceInfo = $table::model()->fetch(array("condition" => "`{$pk}` = {$data["rowid"]}"));
     if (!$sourceInfo) {
         $return["isSuccess"] = false;
         $return["data"] = Ibos::lang("Comment has been delete", "message.default");
         $this->getOwner()->ajaxReturn($return);
     }
     $data["cid"] = Comment::model()->addComment($data);
     if (!empty($data["attachmentid"])) {
         AttachUtil::updateAttach($data["attachmentid"]);
     }
     $data["ctime"] = TIMESTAMP;
     if ($data["cid"]) {
         $this->afterAdd($data, $sourceInfo);
         $return["isSuccess"] = true;
         $return["data"] = $this->parseComment($data);
     }
     $this->getOwner()->ajaxReturn($return);
 }
Example #4
0
 public function actionForm()
 {
     $key = EnvUtil::getRequest("key");
     if ($key) {
         $this->key = $key;
         $param = WfCommonUtil::param($key, "DECODE");
         $this->_extraAttributes = $param;
         $this->runid = $param["runid"];
         $this->flowid = $param["flowid"];
         $this->processid = $param["processid"];
         $this->flowprocess = $param["flowprocess"];
     } else {
         $this->ajaxReturn("<script>alert('工作流数据错误,可能已转交或被回退')</script>", "EVAL");
     }
     $flow = new ICFlowType(intval($this->flowid));
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $data = array();
         $readOnly = $_POST["readonly"];
         $hidden = $_POST["hidden"];
         $saveflag = $_POST["saveflag"];
         $fbAttachmentID = $_POST["fbattachmentid"];
         $attachmentID = $_POST["attachmentid"];
         $content = isset($_POST["content"]) ? StringUtil::filterCleanHtml($_POST["content"]) : "";
         $topflag = $_POST["topflag"];
         $this->checkRunAccess($this->runid, $this->processid, $this->createUrl("list/index"));
         if (FlowRunProcess::model()->getIsOp($this->uid, $this->runid, $this->processid)) {
             $enablefiledArr = explode(",", $_POST["enablefiled"]);
             $formData = array();
             $structure = $flow->form->parser->structure;
             foreach ($structure as $index => $item) {
                 if (!in_array("data_" . $item["itemid"], $enablefiledArr)) {
                     continue;
                 }
                 $value = isset($_POST[$index]) ? $_POST[$index] : "";
                 $formData[$index] = $value;
             }
             $formData && $this->handleImgComponent($formData);
             $formData && FlowDataN::model()->update($this->flowid, $this->runid, $formData);
         }
         if (!empty($content) || !empty($fbAttachmentID)) {
             $fbData = array("runid" => $this->runid, "processid" => $this->processid, "flowprocess" => $this->flowprocess, "uid" => $this->uid, "content" => $content, "attachmentid" => $fbAttachmentID, "edittime" => TIMESTAMP);
             FlowRunfeedback::model()->add($fbData);
             AttachUtil::updateAttach($fbAttachmentID, $this->runid);
         }
         FlowRun::model()->modify($this->runid, array("attachmentid" => $attachmentID));
         AttachUtil::updateAttach($attachmentID, $this->runid);
         $plugin = FlowProcess::model()->fetchSavePlugin($this->flowid, $this->flowprocess);
         if (!empty($plugin)) {
             $pluginFile = "./system/modules/workflow/plugins/save/" . $plugin;
             if (file_exists($pluginFile)) {
                 include_once $pluginFile;
             }
         }
         switch ($saveflag) {
             case "save":
                 MainUtil::setCookie("save_flag", 1, 300);
                 $this->ajaxReturn("<script>alert('保存成功')</script>", "EVAL");
                 break;
             case "turn":
                 MainUtil::setCookie("turn_flag", 1, 300);
                 break;
             case "end":
             case "finish":
                 if ($saveflag == "end") {
                     $param = array("opflag" => 1);
                 } else {
                     $param = array("topflag" => $topflag);
                 }
                 $this->redirect($this->createUrl("handle/complete", array_merge($param, array("key" => $this->key))));
                 break;
             default:
                 break;
         }
     } else {
         $this->checkRunDel();
         $this->checkIllegal();
         $len = strlen($flow->autonum);
         for ($i = 0; $i < $flow->autolen - $len; $i++) {
             $flow->autonum = "0" . $flow->autonum;
         }
         $runProcess = new ICFlowRunProcess($this->runid, $this->processid, $this->flowprocess, $this->uid);
         $checkitem = "";
         if ($flow->isFixed()) {
             $process = new ICFlowProcess($this->flowid, $this->flowprocess);
             if ($runProcess->opflag != 0) {
                 $checkitem = $process->checkitem;
             }
             if (0 < $process->allowback) {
                 $isAllowBack = true;
             }
         } else {
             $process = array();
         }
         $run = new ICFlowRun($this->runid);
         $hasOtherOPUser = FlowRunProcess::model()->getHasOtherOPUser($this->runid, $this->processid, $this->flowprocess, $this->uid);
         if ($runProcess->flag == self::UN_RECEIVE) {
             $this->setSelfToHandle($runProcess->id);
         }
         if ($runProcess->topflag == 1 && $runProcess->opflag == 1) {
             FlowRunProcess::model()->updateTop($this->uid, $this->runid, $this->processid, $this->flowprocess);
         }
         if ($runProcess->topflag == 2) {
             if (!$hasOtherOPUser) {
                 $runProcess->opflag = 1;
             }
         }
         if ($this->processid == 1) {
             FlowRun::model()->modify($this->runid, array("beginuser" => $this->uid, "begintime" => TIMESTAMP));
             if (!empty($run->parentrun)) {
                 $this->setParentToHandle($run->parentrun, $this->runid);
             }
         }
         $preProcess = $this->processid - 1;
         if ($preProcess) {
             if ($flow->isFree() || $flow->isFixed() && $process->gathernode != self::FORCE) {
                 $this->setProcessDone($preProcess);
             }
         }
         if ($flow->isFixed() && $process->timeout != 0) {
             if ($runProcess->flag == self::UN_RECEIVE && $this->processid !== 1) {
                 $processBegin = FlowRunProcess::model()->fetchDeliverTime($this->runid, $preProcess);
             } else {
                 $processBegin = $runProcess->processtime ? $runProcess->processtime : TIMESTAMP;
             }
             $timeUsed = TIMESTAMP - $processBegin;
         }
         $viewer = new ICFlowFormViewer(array("flow" => $flow, "form" => $flow->getForm(), "run" => $run, "process" => $process, "rp" => $runProcess));
         $data = array_merge(array("flow" => $flow->toArray(), "run" => $run->toArray(), "process" => !empty($process) ? $process->toArray() : $process, "checkItem" => $checkitem, "prcscache" => WfCommonUtil::loadProcessCache($this->flowid), "rp" => $runProcess->toArray(), "rpcache" => WfPreviewUtil::getViewFlowData($this->runid, $this->flowid, $this->uid, $remindUid), "fbSigned" => $this->isFeedBackSigned(), "allowBack" => isset($isAllowBack) ? $isAllowBack : false, "timeUsed" => isset($timeUsed) ? $timeUsed : 0, "uploadConfig" => AttachUtil::getUploadConfig()), $viewer->render(true, false, true));
         $formdata = array("run" => $data["run"], "flow" => $data["flow"], "enableArr" => "", "valueArr" => "", "emptyArr" => "");
         $data["enablefiled"] = array();
         if (is_array($data["model"]["itemData"])) {
             if (isset($data["prcscache"][$data["rp"]["flowprocess"]]["processitem"])) {
                 $enableFiled = explode(",", $data["prcscache"][$data["rp"]["flowprocess"]]["processitem"]);
             } else {
                 $enableFiled = array();
             }
             foreach ($data["model"]["itemData"] as $k => $v) {
                 if (substr($k, 0, 5) != "data_") {
                     continue;
                 }
                 $data["model"]["structure"][$k]["value"] = $v;
                 if (in_array($data["model"]["structure"][$k]["data-title"], $enableFiled)) {
                     $data["enablefiled"][] = $k;
                     $data["model"]["structure"][$k]["value"] = $data["model"]["eleout"][$k];
                     $formdata["enableArr"][] = $data["model"]["structure"][$k];
                     continue;
                 }
                 if ($v != "") {
                     $formdata["valueArr"][] = $data["model"]["structure"][$k];
                     continue;
                 }
                 $formdata["emptyArr"][] = $data["model"]["structure"][$k];
             }
         }
         $data["model"] = $this->renderPartial("application.modules.mobile.views.work.form", $formdata, true);
         $data["model"] .= "<input type=\"hidden\" name=\"key\" value=\"" . $this->key . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"hidden\" value=\"" . $data["hidden"] . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"readonly\" value=\"" . $data["readonly"] . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"attachmentid\" id=\"attachmentid\" value=\"" . $data["run"]["attachmentid"] . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"fbattachmentid\" id=\"fbattachmentid\" value=\"\">";
         $data["model"] .= "<input type=\"hidden\" name=\"topflag\" value=\"" . $data["rp"]["opflag"] . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"saveflag\">";
         $data["model"] .= "<input type=\"hidden\" name=\"formhash\" value=\"" . FORMHASH . "\">";
         $data["model"] .= "<input type=\"hidden\" name=\"enablefiled\" value=\"" . implode(",", $data["enablefiled"]) . "\">";
         if ($this->isEnabledAttachment($flow, $run, $process, $runProcess)) {
             $data["allowAttach"] = true;
             if (!empty($run->attachmentid)) {
                 $attachPurv = $this->getAttachPriv($flow, $process, $runProcess);
                 $down = $attachPurv["down"];
                 $edit = $attachPurv["edit"];
                 $del = $attachPurv["del"];
                 $data["attachData"] = AttachUtil::getAttach($run->attachmentid, $down, $down, $edit, $del);
             }
         } else {
             $data["allowAttach"] = false;
         }
         if ($flow->isFixed() && $process->feedback != 1) {
             $data["allowFeedback"] = true;
             $data["feedback"] = WfHandleUtil::loadFeedback($flow->getID(), $run->getID(), $flow->type, $this->uid);
         } else {
             $data["allowFeedback"] = false;
         }
         if ($flow->isFree() && $runProcess->opflag == "1") {
             $hasDefault = FlowRunProcess::model()->getHasDefaultStep($this->runid, $this->processid);
             if (!$hasDefault) {
                 $data["defaultEnd"] = true;
             }
         }
         if ($flow->isFree() && $runProcess->topflag == "2") {
             if (!$hasOtherOPUser) {
                 $data["otherEnd"] = true;
             }
         }
         $this->ajaxReturn($data, "JSONP");
     }
 }
Example #5
0
 private function update()
 {
     $resumeDetail = ICResumeDetail::processAddRequestData();
     $resumeid = EnvUtil::getRequest("resumeid");
     $detailid = EnvUtil::getRequest("detailid");
     $resume = Resume::model()->fetchByPk($resumeid);
     $statustime = $resume["status"] == $resumeDetail["status"] ? $resume["statustime"] : strtotime(date("Y-m-d"));
     $data = array("input" => Ibos::app()->user->uid, "positionid" => $resumeDetail["positionid"], "uptime" => TIMESTAMP, "status" => $resumeDetail["status"], "statustime" => $statustime);
     $flag = Resume::model()->modify($resumeid, $data);
     if ($flag) {
         unset($resumeDetail["status"]);
         $resumeDetail["birthday"] = strtotime($resumeDetail["birthday"]);
         $orgDetail = ResumeDetail::model()->fetchByPk($detailid);
         if ($resumeDetail["avatarid"] != $orgDetail["avatarid"]) {
             AttachUtil::updateAttach($resumeDetail["avatarid"]);
         }
         if ($resumeDetail["attachmentid"] != $orgDetail["attachmentid"]) {
             AttachUtil::updateAttach($resumeDetail["attachmentid"]);
         }
         ResumeDetail::model()->modify($detailid, $resumeDetail);
         $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("resume/show", array("resumeid" => $resumeid)));
     } else {
         $this->error(Ibos::lang("Update failed", "message"), $this->createUrl("resume/show", array("resumeid" => $resumeid)));
     }
 }
Example #6
0
 public function actionIndex()
 {
     $flow = new ICFlowType(intval($this->flowid));
     if (EnvUtil::submitCheck("formhash")) {
         $data = array();
         $readOnly = $_POST["readonly"];
         $hidden = $_POST["hidden"];
         $saveflag = $_POST["saveflag"];
         $fbAttachmentId = $_POST["fbattachmentid"];
         $attachmentId = $_POST["attachmentid"];
         $content = isset($_POST["content"]) ? StringUtil::filterCleanHtml($_POST["content"]) : "";
         $topflag = $_POST["topflag"];
         $this->checkRunAccess($this->runid, $this->processid, $this->createUrl("list/index"));
         if (FlowRunProcess::model()->getIsOp($this->uid, $this->runid, $this->processid)) {
             $formData = array();
             $structure = $flow->form->parser->structure;
             foreach ($structure as $index => $item) {
                 if (StringUtil::findIn($hidden, $item["itemid"]) || StringUtil::findIn($readOnly, $item["itemid"])) {
                     continue;
                 }
                 $value = isset($_POST[$index]) ? $_POST[$index] : "";
                 $formData[$index] = $value;
             }
             $formData && $this->handleImgComponent($formData);
             $formData && FlowDataN::model()->update($this->flowid, $this->runid, $formData);
         }
         if (!empty($content) || !empty($fbAttachmentId)) {
             $fbData = array("runid" => $this->runid, "processid" => $this->processid, "flowprocess" => $this->flowprocess, "uid" => $this->uid, "content" => $content, "attachmentid" => $fbAttachmentId, "edittime" => TIMESTAMP);
             FlowRunfeedback::model()->add($fbData);
             AttachUtil::updateAttach($fbAttachmentId, $this->runid);
         }
         FlowRun::model()->modify($this->runid, array("attachmentid" => $attachmentId));
         AttachUtil::updateAttach($attachmentId, $this->runid);
         $plugin = FlowProcess::model()->fetchSavePlugin($this->flowid, $this->flowprocess);
         if (!empty($plugin)) {
             $pluginFile = "./system/modules/workflow/plugins/save/" . $plugin;
             if (file_exists($pluginFile)) {
                 include_once $pluginFile;
             }
         }
         switch ($saveflag) {
             case "save":
                 MainUtil::setCookie("save_flag", 1);
                 $this->redirect($this->createUrl("form/index", array("key" => $this->key)));
                 break;
             case "turn":
                 MainUtil::setCookie("turn_flag", 1);
                 $this->redirect($this->createUrl("form/index", array("key" => $this->key)));
                 break;
             case "end":
             case "finish":
                 if ($saveflag == "end") {
                     $param = array("opflag" => 1);
                 } else {
                     $param = array("topflag" => $topflag);
                 }
                 $this->redirect($this->createUrl("handle/complete", array_merge($param, array("key" => $this->key))));
                 break;
             default:
                 break;
         }
     } else {
         $this->checkRunDel();
         $this->checkIllegal();
         $len = strlen($flow->autonum);
         for ($i = 0; $i < $flow->autolen - $len; $i++) {
             $flow->autonum = "0" . $flow->autonum;
         }
         $runProcess = new ICFlowRunProcess($this->runid, $this->processid, $this->flowprocess, $this->uid);
         $checkitem = "";
         if ($flow->isFixed()) {
             $process = new ICFlowProcess($this->flowid, $this->flowprocess);
             if ($runProcess->opflag != 0) {
                 $checkitem = $process->checkitem;
             }
             if (0 < $process->allowback) {
                 $isAllowBack = $this->isAllowBack($runProcess->parent);
             }
         } else {
             $process = array();
         }
         $run = new ICFlowRun($this->runid);
         $hasOtherOPUser = FlowRunProcess::model()->getHasOtherOPUser($this->runid, $this->processid, $this->flowprocess, $this->uid);
         if ($runProcess->flag == FlowConst::PRCS_UN_RECEIVE) {
             $this->setSelfToHandle($runProcess->id);
         }
         if ($runProcess->topflag == 1 && $runProcess->opflag == 1) {
             FlowRunProcess::model()->updateTop($this->uid, $this->runid, $this->processid, $this->flowprocess);
         }
         if ($runProcess->topflag == 2) {
             if (!$hasOtherOPUser) {
                 $runProcess->opflag = 1;
             }
         }
         if ($this->processid == 1) {
             FlowRun::model()->modify($this->runid, array("beginuser" => $this->uid, "begintime" => TIMESTAMP));
             if (!empty($run->parentrun)) {
                 $this->setParentToHandle($run->parentrun, $this->runid);
             }
         }
         $preProcess = $this->processid - 1;
         if ($preProcess) {
             if ($flow->isFree() || $flow->isFixed() && $process->gathernode != 1) {
                 $this->setProcessDone($preProcess);
             }
         }
         if ($flow->isFixed() && $process->timeout != 0) {
             if ($runProcess->flag == FlowConst::PRCS_UN_RECEIVE && $this->processid != 1) {
                 $processBegin = FlowRunProcess::model()->fetchDeliverTime($this->runid, $preProcess);
             } else {
                 $processBegin = $runProcess->processtime ? $runProcess->processtime : TIMESTAMP;
             }
             $timeUsed = TIMESTAMP - $processBegin;
         }
         $viewer = new ICFlowFormViewer(array("flow" => $flow, "form" => $flow->getForm(), "run" => $run, "process" => $process, "rp" => $runProcess));
         $data = array_merge(array("flow" => $flow->toArray(), "run" => $run->toArray(), "processid" => $this->processid, "process" => !empty($process) ? $process->toArray() : $process, "checkItem" => $checkitem, "prcscache" => WfCommonUtil::loadProcessCache($this->flowid), "rp" => $runProcess->toArray(), "fbSigned" => $this->isFeedBackSigned(), "allowBack" => isset($isAllowBack) ? $isAllowBack : false, "timeUsed" => isset($timeUsed) ? $timeUsed : 0, "uploadConfig" => AttachUtil::getUploadConfig()), $viewer->render());
         if ($this->isEnabledAttachment($flow, $run, $process, $runProcess)) {
             $data["allowAttach"] = true;
             if (!empty($run->attachmentid)) {
                 $attachPurv = $this->getAttachPriv($flow, $process, $runProcess);
                 $down = $attachPurv["down"];
                 $edit = $attachPurv["edit"];
                 $del = $attachPurv["del"];
                 $data["attachData"] = AttachUtil::getAttach($run->attachmentid, $down, $down, $edit, $del);
             }
         } else {
             $data["allowAttach"] = false;
         }
         if ($flow->isFixed() && $process->feedback != 1 || $flow->isFree()) {
             $data["allowFeedback"] = true;
         } else {
             $data["allowFeedback"] = false;
         }
         if ($data["allowBack"]) {
             $data["backlist"] = $this->getBackList($runProcess->flowprocess);
         }
         $data["feedback"] = WfHandleUtil::loadFeedback($flow->getID(), $run->getID(), $flow->type, $this->uid);
         if ($flow->isFree() && $runProcess->opflag == "1") {
             $hasDefault = FlowRunProcess::model()->getHasDefaultStep($this->runid, $this->processid);
             if (!$hasDefault) {
                 $data["defaultEnd"] = true;
             }
         }
         if ($flow->isFree() && $runProcess->topflag == "2") {
             if (!$hasOtherOPUser) {
                 $data["otherEnd"] = true;
             }
         }
         $this->setPageTitle(Ibos::lang("Handle work"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang("My work"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("Handle work"))));
         $this->render("index", $data);
     }
 }
Example #7
0
 private function update()
 {
     $uid = Ibos::app()->user->uid;
     $articleId = $_POST["articleid"];
     $this->beforeSaveData($_POST);
     $this->addOrUpdateArticle("update", $_POST, $uid);
     if ($_POST["type"] == parent::ARTICLE_TYPE_PICTURE) {
         $pidids = $_POST["picids"];
         if (!empty($pidids)) {
             ArticlePicture::model()->deleteAll("articleid=:articleid", array(":articleid" => $articleId));
             AttachUtil::updateAttach($pidids);
             $attach = AttachUtil::getAttach($pidids, true, true, false, false, true);
             $this->addPicture($attach, $articleId);
         }
     }
     $attachmentid = trim($_POST["attachmentid"], ",");
     if (!empty($attachmentid)) {
         AttachUtil::updateAttach($attachmentid);
         Article::model()->modify($articleId, array("attachmentid" => $attachmentid));
     }
     $dashboardConfig = $this->getDashboardConfig();
     if (isset($_POST["votestatus"]) && $this->getVoteInstalled() && $dashboardConfig["articlevoteenable"]) {
         $voteItemType = $_POST["voteItemType"];
         $type = $voteItemType == 1 ? "vote" : "imageVote";
         if (!empty($voteItemType) && trim($_POST[$type]["subject"]) != "") {
             $this->updateVote($voteItemType, $type, $articleId, $uid);
             $rcord = Article::model()->fetch(array("select" => array("votestatus"), "condition" => "articleid=:articleid", "params" => array(":articleid" => $articleId)));
             if ($rcord["votestatus"] == 0) {
                 Article::model()->modify($articleId, array("votestatus" => 1));
             }
         } else {
             Article::model()->modify($articleId, array("votestatus" => 0));
         }
     }
     $user = User::model()->fetchByUid($uid);
     $article = Article::model()->fetchByPk($articleId);
     $categoryName = ArticleCategory::model()->fetchCateNameByCatid($article["catid"]);
     if (!empty($_POST["msgRemind"]) && $article["status"] == 1) {
         $publishScope = array("deptid" => $article["deptid"], "positionid" => $article["positionid"], "uid" => $article["uid"]);
         $uidArr = ArticleUtil::getScopeUidArr($publishScope);
         $config = array("{sender}" => $user["realname"], "{category}" => $categoryName, "{subject}" => $article["subject"], "{content}" => $this->renderPartial("remindcontent", array("article" => $article, "author" => $user["realname"]), true), "{url}" => Ibos::app()->urlManager->createUrl("article/default/index", array("op" => "show", "articleid" => $article["articleid"])));
         if (0 < count($uidArr)) {
             Notify::model()->sendNotify($uidArr, "article_message", $config, $uid);
         }
     }
     if ($article["status"] == 2) {
         $this->sendPending($article, $uid);
     }
     ArticleBack::model()->deleteAll("articleid = {$articleId}");
     $this->success(Ibos::lang("Update succeed"), $this->createUrl("default/index"));
 }
Example #8
0
 private function update()
 {
     $diaryId = $_POST["diaryid"];
     $diary = Diary::model()->fetchByPk($diaryId);
     $uid = Ibos::app()->user->uid;
     if (!ICDiary::checkReadScope($uid, $diary)) {
         $this->error(Ibos::lang("You do not have permission to edit the log"), $this->createUrl("default/index"));
     }
     if (isset($_POST["originalPlan"])) {
         foreach ($_POST["originalPlan"] as $key => $value) {
             if (isset($value)) {
                 DiaryRecord::model()->modify($key, array("schedule" => $value));
             }
         }
     }
     DiaryRecord::model()->deleteAll("diaryid=:diaryid AND planflag=:planflag", array(":diaryid" => $diaryId, ":planflag" => 0));
     if (!empty($_POST["planOutside"])) {
         $planOutside = array_filter($_POST["planOutside"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
         DiaryRecord::model()->addRecord($planOutside, $diaryId, $_POST["diarytime"], $uid, "outside");
     }
     $attributes = array("content" => $_POST["diaryContent"]);
     if (array_key_exists("shareuid", $_POST)) {
         $shareUidArr = StringUtil::getId($_POST["shareuid"]);
         $attributes["shareuid"] = implode(",", $shareUidArr);
     }
     Diary::model()->modify($diaryId, $attributes);
     $attachmentid = trim($_POST["attachmentid"], ",");
     AttachUtil::updateAttach($attachmentid);
     Diary::model()->modify($diaryId, array("attachmentid" => $attachmentid));
     $isInstallCalendar = ModuleUtil::getIsEnabled("calendar");
     if ($isInstallCalendar) {
         Calendars::model()->deleteALL("`calendarid` IN(select `cid` from {{calendar_record}} where `did`={$diaryId})");
         CalendarRecord::model()->deleteAll("did = {$diaryId}");
     }
     DiaryRecord::model()->deleteAll("plantime=:plantime AND uid=:uid AND planflag=:planflag", array(":plantime" => strtotime($_POST["plantime"]), ":uid" => $uid, ":planflag" => 1));
     if (!isset($_POST["plan"])) {
         $this->error(Ibos::lang("Please fill out at least one work plan"), $this->createUrl("default/edit", array("diaryid" => $diaryId)));
     }
     $plan = array_filter($_POST["plan"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
     DiaryRecord::model()->addRecord($plan, $diaryId, strtotime($_POST["plantime"]), $uid, "new");
     $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("default/index"));
 }
Example #9
0
 private function save($bodyId, $bodyData)
 {
     if (!empty($bodyData["attachmentid"]) && $bodyId) {
         AttachUtil::updateAttach($bodyData["attachmentid"], $bodyId);
     }
     if ($bodyData["issend"]) {
         Email::model()->send($bodyId, $bodyData);
         if (!empty($bodyData["towebmail"])) {
             $toUsers = StringUtil::filterStr($bodyData["towebmail"], ";");
             if (!empty($toUsers)) {
                 $webBox = EmailWeb::model()->fetchByPk($bodyData["fromwebid"]);
                 WebMailUtil::sendWebMail($toUsers, $bodyData, $webBox);
             }
         }
         UserUtil::updateCreditByAction("postmail", $this->uid);
         $message = Ibos::lang("Send succeed");
     } else {
         $message = Ibos::lang("Save succeed", "message");
     }
     if (Yii::app()->request->getIsAjaxRequest()) {
         $this->ajaxReturn(array("isSuccess" => true, "messsage" => $message));
     } else {
         $this->success($message, $this->createUrl("list/index"));
     }
 }
Example #10
0
 private function update()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $docid = $_POST["docid"];
         $uid = Ibos::app()->user->uid;
         $data = $_POST;
         $publicScope = OfficialdocUtil::handleSelectBoxData(StringUtil::getId($data["publishScope"], true));
         $data["uid"] = $publicScope["uid"];
         $data["positionid"] = $publicScope["positionid"];
         $data["deptid"] = $publicScope["deptid"];
         $ccScope = OfficialdocUtil::handleSelectBoxData(StringUtil::getId($data["ccScope"], true), false);
         $data["ccuid"] = $ccScope["uid"];
         $data["ccpositionid"] = $ccScope["positionid"];
         $data["ccdeptid"] = $ccScope["deptid"];
         $data["approver"] = $uid;
         $data["docno"] = $_POST["docNo"];
         $data["commentstatus"] = isset($data["commentstatus"]) ? $data["commentstatus"] : 0;
         $data["uptime"] = TIMESTAMP;
         $data["version"] = $data["version"] + 1;
         $version = Officialdoc::model()->fetchByPk($_POST["docid"]);
         $version["editor"] = $uid;
         $version["reason"] = $data["reason"];
         $version["uptime"] = TIMESTAMP;
         OfficialdocVersion::model()->add($version);
         if ($data["status"] == 2) {
             $catid = intval($data["catid"]);
             $category = OfficialdocCategory::model()->fetchByPk($catid);
             $data["status"] = empty($category["aid"]) ? 1 : 2;
             $data["approver"] = !empty($category["aid"]) ? 0 : $uid;
         }
         $attachmentid = trim($_POST["attachmentid"], ",");
         if (!empty($attachmentid)) {
             AttachUtil::updateAttach($attachmentid);
             Officialdoc::model()->modify($docid, array("attachmentid" => $attachmentid));
         }
         $attributes = Officialdoc::model()->create($data);
         Officialdoc::model()->updateByPk($data["docid"], $attributes);
         $doc = Officialdoc::model()->fetchByPk($data["docid"]);
         $this->sendPending($doc, $uid);
         OfficialdocBack::model()->deleteAll("docid = {$docid}");
         $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("officialdoc/index"));
     }
 }