Example #1
0
 protected function showDetail()
 {
     $repid = intval(EnvUtil::getRequest("repid"));
     $isShowTitle = EnvUtil::getRequest("isShowTitle");
     $fromController = EnvUtil::getRequest("fromController");
     $report = Report::model()->fetchByPk($repid);
     $uid = Ibos::app()->user->uid;
     Report::model()->addReaderuid($report, $uid);
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = array();
     if (!empty($report["attachmentid"])) {
         $attachs = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
     }
     $readers = array();
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if ($report["stamp"] != 0) {
         $stamp = Stamp::model()->fetchStampById($report["stamp"]);
         $stampUrl = FileUtil::fileName(Stamp::STAMP_PATH) . $stamp;
     }
     $report["addtime"] = ConvertUtil::formatDate($report["addtime"], "u");
     $params = array("lang" => Ibos::getLangSource("report.default"), "repid" => $repid, "report" => $report, "uid" => $uid, "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "fromController" => $fromController, "isShowTitle" => $isShowTitle, "allowComment" => $this->getIsAllowComment($fromController));
     $detailAlias = "application.modules.report.views.detail";
     $detailView = $this->renderPartial($detailAlias, $params, true);
     $this->ajaxReturn(array("data" => $detailView, "isSuccess" => true));
 }
Example #2
0
 public function actionShow()
 {
     $newsid = EnvUtil::getRequest("id");
     $article = new MICArticle();
     $data = $article->getNews($newsid);
     if (!empty($data)) {
         if (!empty($data["attachmentid"])) {
             $data["attach"] = AttachUtil::getAttach($data["attachmentid"]);
             $attachmentArr = explode(",", $data["attachmentid"]);
         }
     }
     $this->ajaxReturn($data, "JSONP");
 }
Example #3
0
 public function actionShow()
 {
     $id = isset($_GET["id"]) ? $_GET["id"] : 0;
     $email = Email::model()->fetchById($id, 0);
     if (!empty($email)) {
         if (!empty($email["attachmentid"])) {
             $email["attach"] = AttachUtil::getAttach($email["attachmentid"], true, false, false, false, true);
             $attachmentArr = explode(",", $email["attachmentid"]);
         }
     }
     Email::model()->setRead($id, Yii::app()->user->uid);
     $this->ajaxReturn($email, "JSONP");
 }
Example #4
0
 public function actionShow()
 {
     $diaryid = intval(EnvUtil::getRequest("diaryid"));
     $uid = Ibos::app()->user->uid;
     if (empty($diaryid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("share/index"));
     }
     $diary = Diary::model()->fetchByPk($diaryid);
     if (empty($diary)) {
         $this->error(Ibos::lang("No data found"), $this->createUrl("share/index"));
     }
     if (!ICDiary::checkScope($uid, $diary)) {
         $this->error(Ibos::lang("You do not have permission to view the log"), $this->createUrl("share/index"));
     }
     Diary::model()->addReaderuidByPK($diary, $uid);
     $data = Diary::model()->fetchDiaryRecord($diary);
     $params = array("diary" => ICDiary::processDefaultShowData($diary), "prevAndNextPK" => Diary::model()->fetchPrevAndNextPKByPK($diary["diaryid"]), "data" => $data);
     if (!empty($diary["attachmentid"])) {
         $params["attach"] = AttachUtil::getAttach($diary["attachmentid"], true, true, false, false, true);
         $params["count"] = 0;
     }
     $params["allowComment"] = $this->issetSharecomment() || UserUtil::checkIsSub($uid, $diary["uid"]) ? 1 : 0;
     if (!empty($diary["readeruid"])) {
         $readerArr = explode(",", $diary["readeruid"]);
         $params["readers"] = User::model()->fetchAllByPk($readerArr);
     } else {
         $params["readers"] = "";
     }
     if (!empty($diary["stamp"])) {
         $params["stampUrl"] = Stamp::model()->fetchStampById($diary["stamp"]);
     }
     $params["sharecomment"] = $this->issetSharecomment();
     $this->setPageTitle(Ibos::lang("Show share diary"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work diary"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Show share diary"))));
     $this->render("show", $params);
 }
Example #5
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 #6
0
 public function getCommentList($map = null, $order = "cid ASC", $limit = 10, $offset = 0, $isReply = false)
 {
     $list = $this->getDbConnection()->createCommand()->select("*")->from($this->tableName())->where($map)->order($order)->limit($limit)->offset($offset)->queryAll();
     $uid = Ibos::app()->user->uid;
     $isAdministrator = Ibos::app()->user->isadministrator;
     foreach ($list as $k => &$v) {
         if (!empty($v["tocid"]) && $isReply) {
             $replyInfo = $this->getCommentInfo($v["tocid"], false);
             $v["replyInfo"] = "//@<a class='anchor' data-toggle='usercard' data-param='uid={$replyInfo["user_info"]["uid"]}' href='{$replyInfo["user_info"]["space_url"]}' target='_blank'>" . $replyInfo["user_info"]["realname"] . "</a>:" . $replyInfo["content"];
         } else {
             $v["replyInfo"] = "";
         }
         $v["isCommentDel"] = $isAdministrator || $uid === $v["uid"];
         $v["user_info"] = User::model()->fetchByUid($v["uid"]);
         $v["content"] = StringUtil::parseHtml($v["content"] . $v["replyInfo"]);
         $v["sourceInfo"] = Source::getCommentSource($v);
         if (!empty($v["attachmentid"])) {
             $v["attach"] = AttachUtil::getAttach($v["attachmentid"]);
         }
     }
     return $list;
 }
Example #7
0
 public function actionEdit()
 {
     $op = EnvUtil::getRequest("op");
     $resumeid = EnvUtil::getRequest("resumeid");
     if (empty($op)) {
         $op = "default";
     }
     if (!in_array($op, array("default", "update", "mark", "status")) || empty($resumeid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("resume/index"));
     }
     if ($op == "default") {
         $detail = ResumeDetail::model()->fetch("resumeid=:resumeid", array(":resumeid" => $resumeid));
         $detail["birthday"] = date("Y-m-d", $detail["birthday"]);
         $detail["status"] = Resume::model()->fetchStatusByResumeid($detail["resumeid"]);
         $avatarid = $detail["avatarid"];
         if (empty($avatarid)) {
             $detail["avatarUrl"] = "";
         } else {
             $avatar = AttachUtil::getAttachData($avatarid);
             $detail["avatarUrl"] = FileUtil::fileName(FileUtil::getAttachUrl() . "/" . $avatar[$avatarid]["attachment"]);
         }
         if (!empty($detail["attachmentid"])) {
             $detail["attach"] = AttachUtil::getAttach($detail["attachmentid"]);
         }
         $data = array("sidebar" => $this->getSidebar(), "resumeDetail" => $detail, "dashboardConfig" => $this->getDashboardConfig(), "uploadConfig" => AttachUtil::getUploadConfig());
         $data["dashboardConfigToJson"] = CJSON::encode($data["dashboardConfig"]);
         $regulars = Regular::model()->fetchAll();
         $data["regulars"] = CJSON::encode($regulars);
         $this->setPageTitle(Ibos::lang("Edit resume"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Recruitment management"), "url" => $this->createUrl("resume/index")), array("name" => Ibos::lang("Talent management"), "url" => $this->createUrl("resume/index")), array("name" => Ibos::lang("Edit resume"))));
         $this->render("edit", $data);
     } else {
         $this->{$op}();
     }
 }
Example #8
0
 public static function exportExcel($id)
 {
     $data = Email::model()->fetchById($id);
     if ($data) {
         $users = UserUtil::loadUser();
         header("Cache-control: private");
         header("Content-type: application/vnd.ms-excel");
         header("Content-Disposition: attachment; filename=" . ConvertUtil::iIconv($data["subject"], CHARSET, "GBK") . "(" . date("Y-m-d") . ").xls");
         //$html = "            <html xmlns:o=\"urn:schemas-microsoft-com:office:office\"\r\n\t\txmlns:x=\"urn:schemas-microsoft-com:office:excel\"\r\n\t\txmlns=\"http://www.w3.org/TR/REC-html40\">\r\n\t\t<head>\r\n\t\t<title></title>\r\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n\t\t</head>\r\n\t\t<body topmargin=\"5\">\r\n\t\t <table border=\"1\" cellspacing=\"1\" width=\"95%\" class=\"small\" cellpadding=\"3\">\r\n\t\t\t<tr style=\"BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;\">\r\n\t\t\t  <td align=\"center\">收件人:</td>\r\n\t\t\t  <td align=\"center\">发件人:</td>\r\n\t\t\t  <td align=\"center\">抄送:</td>\r\n\t\t\t  <td align=\"center\">重要性:</td>\r\n\t\t\t  <td align=\"center\">标题:</td>\r\n\t\t\t  <td align=\"center\">发送时间:</td>\r\n\t\t\t  <td align=\"center\">内容:</td>\r\n\t\t\t  <td align=\"center\">附件名称:</td>\r\n\t\t\t</tr>      ";
         $html = '<html xmlns:o="urn:schemas-microsoft-com:office:office"
     xmlns:x="urn:schemas-microsoft-com:office:excel"
     xmlns="http://www.w3.org/TR/REC-html40">
     <head>
     <title></title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     </head>
     <body topmargin="5">
      <table border="1" cellspacing="1" width="95%" class="small" cellpadding="3">
         <tr style="BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;">
           <td align="center">收件人:</td>
           <td align="center">发件人:</td>
           <td align="center">抄送:</td>
           <td align="center">重要性:</td>
           <td align="center">标题:</td>
           <td align="center">发送时间:</td>
           <td align="center">内容:</td>
           <td align="center">附件名称:</td>
         </tr>';
         $data["toname"] = self::joinStringByArray($data["toids"], $users, "realname", ";");
         $data["content"] = str_replace("  ", "&nbsp;&nbsp;", $data["content"]);
         $data["content"] = str_replace("\n", "<br>", $data["content"]);
         $data["fromname"] = isset($users[$data["fromid"]]) ? $users[$data["fromid"]]["realname"] : "";
         $data["copytoname"] = self::joinStringByArray($data["copytoids"], $users, "realname", ";");
         $important_desc = "";
         if ($data["important"] == "0") {
             $important_desc = "";
         } elseif ($data["important"] == "1") {
             $important_desc = "<font color=\"#ff6600\">一般邮件</font>";
         } elseif ($data["important"] == "2") {
             $important_desc = "<font color=\"#FF0000\">重要邮件</font>";
         }
         $attachmentname = "";
         if ($data["attachmentid"] !== "") {
             $tempdata = AttachUtil::getAttach($data["attachmentid"]);
             foreach ($tempdata as $value) {
                 $attachmentname .= $value["filename"] . "; ";
             }
         }
         $data["sendtime"] = ConvertUtil::formatDate($data["sendtime"]);
         //$html .= "\r\n                <tr>\r\n                    <td nowrap align=\"center\">" . $data["toname"] . "</td>\r\n                    <td nowrap align=\"center\">" . $data["fromname"] . "</td>\r\n                    <td>" . $data["copytoname"] . "</td>\r\n                    <td nowrap align=\"center\">" . $important_desc . "</td>\r\n                    <td nowrap>" . $data["subject"] . "</td>\r\n                    <td nowrap align=\"center\" x:str=\"" . $data["sendtime"] . "\">" . $data["sendtime"] . "</td>\r\n                    <td>" . $data["content"] . "</td>\r\n                    <td>" . $attachmentname . "</td>\r\n                </tr>\r\n            </table>";
         $html .= '<tr>
                     <td nowrap align="center">' . $data["toname"] . '</td>
                     <td nowrap align="center">' . $data["fromname"] . '</td>
                     <td>' . $data["copytoname"] . '</td>
                     <td nowrap align="center">' . $important_desc . '</td>
                     <td nowrap>' . $data["subject"] . '</td>
                     <td nowrap align="center" x:str="' . $data["sendtime"] . '">' . $data["sendtime"] . '</td>
                     <td>' . $data["content"] . '</td>
                     <td>' . $attachmentname . '</td>
                 </tr></table>';
         echo $html;
     }
 }
Example #9
0
 private function parseTemplate($_data)
 {
     $user = User::model()->fetchByUid($_data["uid"]);
     $_data["data"] = unserialize($_data["feeddata"]);
     $var = $_data["data"];
     if (!empty($var["attach_id"])) {
         $var["attachInfo"] = AttachUtil::getAttach($var["attach_id"]);
         $attachUrl = FileUtil::getAttachUrl();
         foreach ($var["attachInfo"] as $ak => $av) {
             $_attach = array("attach_id" => $av["aid"], "attach_name" => $av["filename"], "attach_url" => FileUtil::fileName($attachUrl . "/" . $av["attachment"]), "extension" => StringUtil::getFileExt($av["filename"]), "size" => $av["filesize"]);
             if ($_data["type"] == "postimage") {
                 $_attach["attach_small"] = WbCommonUtil::getThumbImageUrl($av, WbConst::ALBUM_DISPLAY_WIDTH, WbConst::ALBUM_DISPLAY_HEIGHT);
                 $_attach["attach_middle"] = WbCommonUtil::getThumbImageUrl($av, WbConst::WEIBO_DISPLAY_WIDTH, WbConst::WEIBO_DISPLAY_HEIGHT);
             }
             $var["attachInfo"][$ak] = $_attach;
         }
     }
     $var["uid"] = $_data["uid"];
     $var["actor"] = "<a href='{$user["space_url"]}' data-toggle='usercard' data-param=\"uid={$user["uid"]}\">{$user["realname"]}</a>";
     $var["actor_uid"] = $user["uid"];
     $var["actor_uname"] = $user["realname"];
     $var["feedid"] = $_data["feedid"];
     if (!empty($_data["rowid"])) {
         empty($_data["table"]) && ($_data["table"] = "feed");
         $var["sourceInfo"] = Source::getSourceInfo($_data["table"], $_data["rowid"], false, $_data["module"]);
     } else {
         $var["sourceInfo"] = null;
     }
     $feedTemplateAlias = "application.modules.message.config.feed.{$_data["type"]}Feed";
     $file = Ibos::getPathOfAlias($feedTemplateAlias);
     if (!file_exists($file . ".php")) {
         $feedTemplateAlias = "application.modules.message.config.feed.postFeed";
     }
     $feedXmlContent = Ibos::app()->getController()->renderPartial($feedTemplateAlias, $var, true);
     $s = simplexml_load_string($feedXmlContent);
     if (!$s) {
         return false;
     }
     $result = $s->xpath("//feed[@type='" . StringUtil::filterCleanHtml($_data["type"]) . "']");
     $actions = (array) $result[0]->feedAttr;
     $return["content"] = $var["content"];
     if (isset($var["attach_id"])) {
         $return["attach_id"] = $var["attach_id"];
     }
     $return["userInfo"] = $user;
     $return["title"] = trim((string) $result[0]->title);
     $return["body"] = trim((string) $result[0]->body);
     $return["info"] = trim((string) $result[0]["info"]);
     $return["body"] = StringUtil::parseHtml($return["body"]);
     $return["api_source"] = $var["sourceInfo"];
     $return["actions"] = $actions["@attributes"];
     if (!$this->notDel($_data["module"], $_data["type"], $_data["rowid"])) {
         $return["body"] = Ibos::lang("Info already delete", "message.default");
     }
     return $return;
 }
Example #10
0
 public function actionShow()
 {
     $repid = EnvUtil::getRequest("repid");
     $uid = Ibos::app()->user->uid;
     if (empty($repid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("default/index"));
     }
     $report = Report::model()->fetchByPk($repid);
     if (empty($report)) {
         $this->error(Ibos::lang("File does not exists", "error"), $this->createUrl("default/index"));
     }
     if ($report["uid"] != $uid) {
         $this->error(Ibos::lang("Request tainting", "error"), $this->createUrl("default/index"));
     }
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = $readers = array();
     if (!empty($report["attachmentid"])) {
         $attachments = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
         $attachs = array_values($attachments);
     }
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if (!empty($report["stamp"])) {
         $stampUrl = Stamp::model()->fetchStampById($report["stamp"]);
     }
     $params = array("report" => $report, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "realname" => User::model()->fetchRealnameByUid($report["uid"]), "departmentName" => Department::model()->fetchDeptNameByUid($report["uid"]), "isInstallCalendar" => ModuleUtil::getIsEnabled("calendar"));
     if (!empty($params["nextPlanList"])) {
         $reportType = ReportType::model()->fetchByPk($report["typeid"]);
         $firstPlan = $params["nextPlanList"][0];
         $params["nextSubject"] = ICReport::handleShowSubject($reportType, $firstPlan["begindate"], $firstPlan["enddate"], 1);
     }
     $this->setPageTitle(Ibos::lang("Show report"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work report"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Show report"))));
     $this->render("show", $params);
 }
Example #11
0
 public function actionShow()
 {
     $repid = intval(EnvUtil::getRequest("repid"));
     $uid = Ibos::app()->user->uid;
     if (empty($repid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("review/index"));
     }
     $report = Report::model()->fetchByPk($repid);
     if (empty($report)) {
         $this->error(Ibos::lang("No data found", "error"), $this->createUrl("review/index"));
     }
     if ($report["uid"] == $uid) {
         $this->redirect($this->createUrl("default/show", array("repid" => $repid)));
     }
     $permission = ICReport::checkPermission($report, $uid);
     if (!$permission) {
         $this->error(Ibos::lang("You do not have permission to view the report"), $this->createUrl("review/index"));
     }
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = $readers = array();
     if (!empty($report["attachmentid"])) {
         $attachments = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
         $attachs = array_values($attachments);
     }
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if (!empty($report["stamp"])) {
         $stampUrl = Stamp::model()->fetchStampById($report["stamp"]);
     }
     $params = array("report" => $report, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "realname" => User::model()->fetchRealnameByUid($report["uid"]), "departmentName" => Department::model()->fetchDeptNameByUid($report["uid"]));
     if (!empty($params["nextPlanList"])) {
         $reportType = ReportType::model()->fetchByPk($report["typeid"]);
         $firstPlan = $params["nextPlanList"][0];
         $params["nextSubject"] = ICReport::handleShowSubject($reportType, $firstPlan["begindate"], $firstPlan["enddate"], 1);
     }
     $dashboardConfig = $this->getReportConfig();
     if ($dashboardConfig["stampenable"] && $dashboardConfig["autoreview"]) {
         $this->changeIsreview($repid);
     }
     $this->setPageTitle(Ibos::lang("Show subordinate report"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work report"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Show subordinate report"))));
     $this->render("show", $params);
 }
Example #12
0
 private function showdiary()
 {
     $diaryid = intval($_GET["diaryid"]);
     $isShowDiarytime = EnvUtil::getRequest("isShowDiarytime");
     $fromController = EnvUtil::getRequest("fromController");
     $uid = Ibos::app()->user->uid;
     if (empty($diaryid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("default/index"));
     }
     $diary = Diary::model()->fetchByPk($diaryid);
     if (empty($diary)) {
         $this->error(Ibos::lang("No data found", "error"), $this->createUrl("default/index"));
     }
     if (!ICDiary::checkScope($uid, $diary)) {
         $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("You do not have permission to view the log")));
     }
     Diary::model()->addReaderuidByPK($diary, $uid);
     $data = Diary::model()->fetchDiaryRecord($diary);
     $data["tomorrowPlanList"] = $this->handelRemindTime($data["tomorrowPlanList"]);
     $attachs = array();
     if (!empty($diary["attachmentid"])) {
         $attachs = AttachUtil::getAttach($diary["attachmentid"], true, true, false, false, true);
     }
     $readers = array();
     if (!empty($diary["readeruid"])) {
         $readerArr = explode(",", $diary["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if ($diary["stamp"] != 0) {
         $stamp = Stamp::model()->fetchStampById($diary["stamp"]);
         $stampUrl = FileUtil::fileName(Stamp::STAMP_PATH) . $stamp;
     }
     $diary["diarytime"] = DiaryUtil::getDateAndWeekDay(date("Y-m-d", $diary["diarytime"]));
     $diary["nextdiarytime"] = DiaryUtil::getDateAndWeekDay(date("Y-m-d", $diary["nextdiarytime"]));
     $diary["addtime"] = ConvertUtil::formatDate($diary["addtime"], "u");
     $params = array("lang" => Ibos::getLangSource("diary.default"), "diaryid" => $diaryid, "diary" => $diary, "uid" => $uid, "data" => $data, "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "fromController" => $fromController, "isShowDiarytime" => $isShowDiarytime, "allowComment" => $this->getIsAllowComment($fromController, $uid, $diary));
     $detailAlias = "application.modules.diary.views.detail";
     $detailView = $this->renderPartial($detailAlias, $params, true);
     $this->ajaxReturn(array("data" => $detailView, "isSuccess" => true));
 }
Example #13
0
 public function actionPrint()
 {
     $expWord = EnvUtil::getRequest("word");
     $expHtml = EnvUtil::getRequest("html");
     $key = EnvUtil::getRequest("key");
     if ($key) {
         $param = WfCommonUtil::param($key, "DECODE");
         $flowid = isset($param["flowid"]) ? intval($param["flowid"]) : 0;
         $runid = isset($param["runid"]) ? intval($param["runid"]) : 0;
         $flowprocess = isset($param["flowprocess"]) ? intval($param["flowprocess"]) : 0;
     }
     $view = EnvUtil::getRequest("view");
     if ($view) {
         MainUtil::setCookie("flowview", $view, TIMESTAMP + 60 * 60 * 24 * 3000);
     } else {
         $view = MainUtil::getCookie("flowview");
         if (!$view) {
             $view = "1234";
         }
     }
     $data = array("formview" => false, "attachview" => false, "signview" => false, "chartview" => false, "flowid" => $flowid, "runid" => $runid, "key" => $key);
     $this->checkRunAccess($runid);
     $flow = new ICFlowType(intval($flowid));
     $process = new ICFlowProcess($flow->getID(), $flowprocess);
     $run = new ICFlowRun($runid);
     if (strstr($view, "1")) {
         $data["formview"] = true;
         $viewer = new ICFlowFormViewer(array("flow" => $flow, "form" => $flow->form, "run" => $run, "process" => $process));
         $data = array_merge($data, array("runname" => $run->name, "script" => $flow->form->script, "css" => $flow->form->css), $viewer->render(false, true));
     }
     if (strstr($view, "2")) {
         $data["attachview"] = true;
         if ($run->attachmentid !== "") {
             if ($flow->isFixed()) {
                 if (FlowRunProcess::model()->getHasDownper($runid, $flowid, $this->uid)) {
                     $down = 0;
                 } else {
                     $down = 1;
                 }
             } else {
                 $down = 1;
             }
             $data["prcscache"] = WfCommonUtil::loadProcessCache($flowid);
             $data["attachData"] = AttachUtil::getAttach($run->attachmentid, $down);
         }
     }
     if (strstr($view, "3")) {
         $data["signview"] = true;
         $data["feedback"] = WfHandleUtil::loadFeedback($flowid, $runid, $flow->type, $this->uid, true);
     }
     if (strstr($view, "4")) {
         $data["chartview"] = true;
     }
     if ($expHtml || $expWord) {
         $data["chartview"] = false;
     }
     $this->layout = "";
     $this->setPageTitle(Ibos::lang("Print preview"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("Print preview"), "url" => $this->createUrl("preview/print", array("key" => $key)))));
     $this->render("print", $data);
 }
Example #14
0
 public function actionShow()
 {
     $id = is_null($_GET["id"]) ? 0 : intval($_GET["id"]);
     if ($id) {
         $data = array();
         $email = Email::model()->fetchById($id, $this->archiveId);
         if (!$email) {
             $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("list/index"));
         }
         $isReceiver = $email["toid"] == $this->uid || $email["fromid"] == $this->uid || StringUtil::findIn($email["copytoids"], $this->uid) || StringUtil::findIn($email["toids"], $this->uid);
         if (!$isReceiver) {
             $this->error(Ibos::lang("View access invalid"), $this->createUrl("list/index"));
         }
         if (EnvUtil::getRequest("op") == "showframe") {
             echo $email["content"];
             exit;
         }
         if (($email["toid"] == $this->uid || StringUtil::findIn($email["toids"], $this->uid)) && $email["isread"] == 0) {
             Email::model()->setRead($id, $this->uid);
         }
         $email["dateTime"] = ConvertUtil::formatDate($email["sendtime"]);
         if ($this->uid == $email["fromid"]) {
             $email["fromName"] = Ibos::lang("Me");
         } elseif (!empty($email["fromid"])) {
             $email["fromName"] = User::model()->fetchRealnameByUid($email["fromid"]);
         } else {
             $email["fromName"] = $email["fromwebmail"];
         }
         $allIds = StringUtil::filterStr($email["toids"] . "," . $email["copytoids"]);
         $copyToId = explode(",", $email["copytoids"]);
         $toId = explode(",", $email["toids"]);
         $allUsers = $copyToUsers = $toUsers = array();
         foreach (explode(",", $allIds) as $key => $uid) {
             if (!empty($uid)) {
                 $tempUid = strpos($uid, "@");
                 if (!$tempUid) {
                     if ($this->uid == $uid) {
                         $name = Ibos::lang("Self");
                     } else {
                         $name = User::model()->fetchRealnameByUid($uid);
                     }
                 } else {
                     $name = $uid;
                 }
                 if (in_array($uid, $copyToId)) {
                     $copyToUsers[$key] = $allUsers[$key] = $name;
                 } elseif (in_array($uid, $toId)) {
                     $allUsers[$key] = $toUsers[$uid] = $name;
                 } else {
                     $allUsers[$key] = $name;
                 }
             }
         }
         if (!empty($email["towebmail"])) {
             $towebmails = explode(";", $email["towebmail"]);
             while (!empty($towebmails)) {
                 $toUsers[] = $allUsers[] = array_pop($towebmails);
             }
             $toUsers = array_unique($toUsers);
             $allUsers = array_unique($allUsers);
         }
         $data["allUsers"] = $allUsers;
         $data["toUsers"] = $toUsers;
         $data["copyToUsers"] = $copyToUsers;
         $data["isSecretUser"] = StringUtil::findIn($this->uid, $email["secrettoids"]);
         !empty($email["attachmentid"]) && ($data["attach"] = AttachUtil::getAttach($email["attachmentid"]));
         $data["next"] = Email::model()->fetchNext($id, $this->uid, $email["fid"], $this->archiveId);
         $data["prev"] = Email::model()->fetchPrev($id, $this->uid, $email["fid"], $this->archiveId);
         $data["email"] = $email;
         $data["weekDay"] = DateTimeUtil::getWeekDay($email["sendtime"]);
         $this->setPageTitle(Ibos::lang("Show email"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Email center"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("Show email"))));
         $this->render("show", $data);
     } else {
         $this->error(Ibos::lang("Parameters error"), $this->createUrl("list/index"));
     }
 }
Example #15
0
 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"));
     }
 }
Example #16
0
 protected function parseComment($data)
 {
     $uid = Ibos::app()->user->uid;
     $isAdministrator = Ibos::app()->user->isadministrator;
     $data["userInfo"] = User::model()->fetchByUid($uid);
     $data["content"] = StringUtil::pregHtml($data["content"]);
     $data["content"] = StringUtil::parseHtml($data["content"]);
     $data["lang"] = Ibos::getLangSources(array("message.default"));
     $data["isCommentDel"] = $isAdministrator || $uid === $data["uid"];
     if (!empty($data["attachmentid"])) {
         $data["attach"] = AttachUtil::getAttach($data["attachmentid"]);
     }
     return $this->render($this->getParseView("comment", "parse"), $data, true);
 }
Example #17
0
 public function actionShow()
 {
     $diaryid = EnvUtil::getRequest("id");
     $diaryDate = EnvUtil::getRequest("diarydate");
     if (empty($diaryid) && empty($diaryDate)) {
         $this->ajaxReturn(array(), "JSONP");
     }
     $diary = array();
     $uid = Ibos::app()->user->uid;
     if (!empty($diaryid)) {
         $diary = Diary::model()->fetchByPk($diaryid);
     } else {
         $diary = Diary::model()->fetch("diarytime=:diarytime AND uid=:uid", array(":diarytime" => strtotime($diaryDate), ":uid" => $uid));
     }
     if (empty($diary)) {
         $this->ajaxReturn(array(), "JSONP");
     }
     Diary::model()->addReaderuidByPK($diary, $uid);
     $data = Diary::model()->fetchDiaryRecord($diary);
     $params = array("diary" => ICDiary::processDefaultShowData($diary), "prevAndNextPK" => Diary::model()->fetchPrevAndNextPKByPK($diary["diaryid"]), "data" => $data);
     if (!empty($diary["attachmentid"])) {
         $params["attach"] = AttachUtil::getAttach($diary["attachmentid"], true, true, false, false, true);
         $params["count"] = 0;
     }
     if (!empty($diary["readeruid"])) {
         $readerArr = explode(",", $diary["readeruid"]);
         $params["readers"] = User::model()->fetchAllByPk($readerArr);
     } else {
         $params["readers"] = "";
     }
     if (!empty($diary["stamp"])) {
         $params["stampUrl"] = Stamp::model()->fetchStampById($diary["stamp"]);
     }
     $this->ajaxReturn($params, "JSONP");
 }
Example #18
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 #19
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 #20
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}();
     }
 }