示例#1
0
 public static function getExportData($list, $param)
 {
     $lang = Ibos::getLangSources(array("workflow.default"));
     $data = $titles = $sum = array();
     $group = "";
     $flow = new ICFlowType($param["flowid"]);
     $structure = $flow->form->parser->structure;
     foreach ($list as $index => $row) {
         if (!empty($param["condition"])) {
             $formData = WfHandleUtil::getFormData($row["flowid"], $row["runid"]);
             $notPass = WfHandleUtil::checkCondition($formData, $param["condition"], "");
             if ($notPass !== "") {
                 continue;
             }
         }
         $queryHidden = Ibos::app()->db->createCommand()->select("hiddenitem")->from("{{flow_process}} fp")->leftJoin("{{flow_run_process}} frp", "fp.processid = frp.flowprocess")->where(sprintf("fp.flowid = %d AND frp.runid = %d AND frp.uid = %d", $param["flowid"], $row["runid"], $param["uid"]))->queryAll();
         $hidden = ConvertUtil::getSubByKey($queryHidden, "hiddenitem");
         $itemData = FlowDataN::model()->fetch($param["flowid"], $row["runid"]);
         $processor = new ICPrintViewProcessor(array("itemData" => $itemData));
         foreach (explode(",", $param["viewextfields"]) as $key => $field) {
             if (strpos($field, ".") !== false) {
                 list(, $itemID) = explode(".", $field);
                 $item = isset($structure[$itemID]) ? $structure[$itemID] : array();
                 if (empty($item)) {
                     continue;
                 }
                 if ($item["data-type"] == "sign" || $item["data-type"] == "label") {
                     continue;
                 }
                 if (in_array($item["data-title"], $hidden)) {
                     $value = "";
                 } else {
                     $itemValue = $itemData[$itemID];
                     switch ($item["data-type"]) {
                         case "checkbox":
                             if ($itemValue == "on") {
                                 $value = $lang["Yes"];
                             } else {
                                 $value = $lang["No"];
                             }
                             break;
                         case "user":
                         case "auto":
                             $method = $item["data-type"] . "Processor";
                             if (method_exists($processor, $method)) {
                                 $value = $processor->{$method}($item, true);
                             }
                             break;
                         case "listview":
                             $sumflag = 0;
                             $lv_subject = $item["data-lv-title"];
                             $lv_sum = $item["data-lv-sum"];
                             $lv_sum_array = explode("`", $lv_sum);
                             if (strstr($lv_sum, "1")) {
                                 $sumflag = 1;
                             }
                             $lv_value = $itemValue;
                             $item_value = "<table class='commonTable2' ><tr>\n";
                             $my_array = explode("`", $lv_subject);
                             $array_count_title = sizeof($my_array);
                             if ($my_array[$array_count_title - 1] == "") {
                                 $array_count_title--;
                             }
                             for ($i = 0; $i < $array_count_title; $i++) {
                                 $item_value .= "<td>" . $my_array[$i] . "</td>\n";
                             }
                             $item_value .= "</tr>\n";
                             $my_array = explode("\r\n", $lv_value);
                             $array_count = sizeof($my_array);
                             if ($my_array[$array_count - 1] == "") {
                                 $array_count--;
                             }
                             $sum_data = array();
                             for ($i = 0; $i < $array_count; $i++) {
                                 $item_value .= "<tr>\n";
                                 $tr_data = $my_array[$i];
                                 $my_array1 = explode("`", $tr_data);
                                 for ($j = 0; $j < $array_count_title; $j++) {
                                     if ($lv_sum_array[$j] == 1) {
                                         $sum_data[$j] += $my_array1[$j];
                                     }
                                     $td_data = $my_array1[$j];
                                     if ($td_data == "") {
                                         $td_data = "&nbsp;";
                                     }
                                     $item_value .= "<td>" . $td_data . "</td>\n";
                                 }
                                 $item_value .= "</tr>\n";
                             }
                             if ($sumflag == 1 && 0 < $array_count) {
                                 $item_value .= "<tr style='font-weight:bold;'>\n";
                                 for ($j = 0; $j < $array_count_title; $j++) {
                                     if ($sum_data[$j] == "") {
                                         $sumvalue = "&nbsp;";
                                     } else {
                                         $sumvalue = "合计:" . $sum_data[$j];
                                     }
                                     $item_value .= "<td align=right>" . $sumvalue . "</td>\n";
                                 }
                                 $item_value .= "</tr>\n";
                             }
                             $item_value .= "</table>\n";
                             break;
                         default:
                             $value = isset($itemData[$itemID]) ? $itemData[$itemID] : "";
                             break;
                     }
                 }
                 $title = $item["data-title"];
             } else {
                 switch ($field) {
                     case "runid":
                         $value = $row["runid"];
                         $title = $lang["Flow no"];
                         break;
                     case "runname":
                         $value = $row["runName"];
                         $title = $lang["Flow subject/num"];
                         break;
                     case "runstatus":
                         if ($param["flowconditions"]["flowstatus"] == "all") {
                             if ($row["endtime"] == 0) {
                                 $status = "<span class=\"red\">{$lang["Perform"]}</span>";
                             } else {
                                 $status = $lang["Has ended"];
                             }
                         } elseif ($param["flowconditions"]["flowstatus"] == "0") {
                             $status = "<span class=\"red\">{$lang["Perform"]}</span>";
                         } else {
                             $status = $lang["Has ended"];
                         }
                         $value = $status;
                         $title = $lang["Flow status"];
                         break;
                     case "rundate":
                         $value = date("Y-m-d", $row["begintime"]);
                         $title = $lang["Flow begin date"];
                         break;
                     case "runtime":
                         $value = ConvertUtil::formatDate($row["begintime"]);
                         $title = $lang["Flow begin time"];
                         break;
                     default:
                         break;
                 }
             }
             if (StringUtil::findIn($param["sumfields"], $field)) {
                 $sum[] = $key;
             }
             $data[$index][$key] = $value;
             if ($index == 0) {
                 if (strcmp($param["groupbyfields"]["field"], $field) == 0) {
                     $group = $key;
                 }
                 $titles[$key] = $title;
             }
         }
     }
     return array("title" => $titles, "data" => $data, "sum" => $sum, "group" => $group, "sum_data" => isset($sum_data) ? $sum_data : array());
 }
示例#2
0
 protected function makeUserSelect($runId, $index, $process, $name, $flowId, $processId)
 {
     $lang = Ibos::getLangSource("workflow.default");
     $tablestr = "";
     if ($index) {
         $display = "none;";
     } else {
         $display = "";
     }
     if ($process["childflow"] != 0) {
         $flow = FlowType::model()->fetchByPk($process["childflow"]);
         if ($flow) {
             $type = $flow["type"];
         }
         if ($type == 2) {
             $process["prcs_id_next"] = "";
         }
         $subfp = FlowProcess::model()->fetchProcess($process["childflow"], 1);
         if ($subfp) {
             $prcsuser = WfHandleUtil::getPrcsUser($process["childflow"], $processId);
         } else {
             $prcsuser = "";
         }
         $prcsuser = sprintf("[%s]", !empty($prcsuser) ? StringUtil::iImplode($prcsuser) : "");
         if (empty($subfp["uid"]) && empty($subfp["deptid"]) && empty($subfp["positionid"])) {
             $nopriv = $lang["Not set step permissions"];
         }
         $tablestr = "            <div style='display:{$display};' id='user_select_{$index}'>\r\n                <div class=\"control-group first-group\">\r\n                    <label class=\"control-label\">{$lang["Host"]}</label>\r\n                    <div class=\"controls\">\r\n                        <strong>{$name} {$nopriv}</strong>\r\n                        <input type=\"hidden\" name=\"topflag{$index}\" value=\"0\">\r\n                        <input id=\"prcs_user_op{$index}\" name=\"prcs_user_op{$index}\" type=\"text\" />\r\n                    </div>\r\n                </div>\r\n                <div class=\"control-group\">\r\n                    <label class=\"control-label\">{$lang["Agent"]}</label>\r\n                    <div class=\"controls\">\r\n                        <input id=\"prcs_user{$index}\" name=\"prcs_user{$index}\" type=\"text\" />\r\n                    </div>\r\n                </div>\r\n            </div>\r\n            <script>\r\n\t\t\t\t\$(function(){\r\n\t\t\t\t\tvar prcsData{$index} = {$prcsuser};\r\n\t\t\t\t\t\$('#prcs_user_op{$index}').userSelect({\r\n\t\t\t\t\t\tbox:\$('<div id=\"prcs_user_op_box{$index}\"></div>').appendTo(document.body),\r\n\t\t\t\t\t\tdata:Ibos.data.includes(prcsData{$index}),\r\n\t\t\t\t\t\ttype:'user',\r\n\t\t\t\t\t\tmaximumSelectionSize:'1'\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\$('#prcs_user{$index}').userSelect({\r\n\t\t\t\t\t\tbox:\$('<div id=\"prcs_user_box{$index}\"></div>').appendTo(document.body),\r\n\t\t\t\t\t\tdata:Ibos.data.includes(prcsData{$index}),\r\n\t\t\t\t\t\ttype:'user'\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t</script>";
     } else {
         if (empty($process["uid"]) && empty($process["deptid"]) && empty($process["positionid"])) {
             $nopriv = $lang["Not set step permissions"];
         }
         $prcsOpUser = $prcsUserAuto = "";
         $deptArr = DepartmentUtil::loadDepartment();
         if ($process["autotype"] == 1) {
             $uid = FlowRun::model()->fetchBeginUserByRunID($runId);
             $prcsuser = User::model()->fetchByUid($uid);
             if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $prcsuser["uid"]) || StringUtil::findIn($process["deptid"], $prcsuser["alldeptid"]) || StringUtil::findIn($process["positionid"], $prcsuser["allposid"])) {
                 $prcsOpUser = $prcsuser["uid"];
                 $prcsUserAuto = $prcsuser["uid"] . ",";
             }
         } elseif (in_array($process["autotype"], array(2, 4, 5, 6))) {
             if ($process["autobaseuser"] != 0) {
                 $baseUid = FlowRunProcess::model()->fetchBaseUid($runId, $process["autobaseuser"]);
                 $baseuser = User::model()->fetchByUid($baseUid);
                 $autodept = $baseuser["deptid"];
             } else {
                 $autodept = Ibos::app()->user->deptid;
             }
             if (0 < intval($autodept)) {
                 if ($process["autotype"] == 2) {
                     $tmpdept = $autodept;
                 } else {
                     if ($process["autotype"] == 4 || $process["autotype"] == 6) {
                         $tmpdept = $deptArr[$autodept]["pid"] == 0 ? $autodept : $deptArr[$autodept]["pid"];
                     } elseif ($process["autotype"] == 5) {
                         $deptStr = Department::model()->queryDept($autodept, true);
                         $temp = explode(",", $deptStr);
                         $count = count($temp);
                         $dept = isset($temp[$count - 2]) ? $temp[$count - 2] : $autodept;
                         if ($deptArr[$dept]["pid"] != 0) {
                             $tmpdept = $deptArr[$dept]["deptid"];
                         } else {
                             $tmpdept = $autodept;
                         }
                     }
                 }
                 $manager = $deptArr[$tmpdept]["manager"];
                 if ($process["autotype"] == 4 || $process["autotype"] == 6) {
                     $leader = $deptArr[$autodept]["leader"];
                     $subleader = $deptArr[$autodept]["subleader"];
                     if ($leader != "0" && $process["autotype"] == 4) {
                         $manager = $leader;
                     }
                     if ($subleader != "0" && $process["autotype"] == 6) {
                         $manager = $subleader;
                     }
                 }
                 if (!empty($manager)) {
                     $muser = User::model()->fetchByUid($manager);
                     if (!empty($muser)) {
                         if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $muser["uid"]) || StringUtil::findIn($process["deptid"], $muser["alldeptid"]) || StringUtil::findIn($process["positionid"], $muser["allposid"])) {
                             $prcsUserAuto = $muser["uid"] . ",";
                         }
                         if ($prcsUserAuto != "") {
                             $prcsOpUser = strtok($prcsUserAuto, ",");
                         }
                     }
                 } else {
                     $userPerMax = "";
                     foreach (User::model()->fetchAllOtherManager($tmpdept) as $user) {
                         $user = User::model()->fetchByUid($user["uid"]);
                         $uid = $user["uid"];
                         $position = $user["allposid"];
                         if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $uid) || StringUtil::findIn($process["deptid"], $user["alldeptid"]) || StringUtil::findIn($process["positionid"], $position)) {
                             if ($userPerMax == "") {
                                 $prcsOpUser = $uid;
                                 $prcsUserAuto .= $uid . ",";
                                 $userPerMax = $position;
                             } elseif ($position == $userPerMax) {
                                 $prcsUserAuto .= $uid . ",";
                             }
                         }
                     }
                 }
             }
         } elseif ($process["autotype"] == 3) {
             $autouserop = User::model()->fetchByUid($process["autouserop"]);
             if (!empty($autouserop)) {
                 if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $autouserop["uid"]) || StringUtil::findIn($process["deptid"], $autouserop["alldeptid"]) || StringUtil::findIn($process["positionid"], $autouserop["allposid"])) {
                     $prcsOpUser = $autouserop["uid"];
                 }
             }
             if (!empty($process["autouser"])) {
                 foreach (User::model()->fetchAllByUids(explode(",", trim($process["autouser"], ","))) as $user) {
                     if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $user["uid"]) || StringUtil::findIn($process["deptid"], $user["alldeptid"]) || StringUtil::findIn($process["positionid"], $user["allposid"])) {
                         $prcsUserAuto .= $user["uid"] . ",";
                     }
                 }
             }
         } elseif ($process["autotype"] == 7) {
             if (is_numeric($process["autouser"])) {
                 $itemData = FlowDataN::model()->fetchItem($process["autouser"], $process["flowid"], $runId);
                 $tmp = strtok($itemData, ",");
                 $userarr = array();
                 while ($tmp) {
                     $userarr[$tmp] = array();
                     $tmp = strtok(",");
                 }
                 $tempArray = explode(",", trim($itemData, ","));
                 foreach ($tempArray as $key => $value) {
                     if (is_numeric($value)) {
                         $value = User::model()->fetchRealnameByUid($value, "");
                         $tempArray[$key] = $value;
                     }
                 }
                 foreach (User::model()->fetchAllByRealnames($tempArray) as $k => $v) {
                     $dept = Department::model()->queryDept($v["alldeptid"]);
                     if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $v["uid"]) || StringUtil::findIn($process["deptid"], $dept) || StringUtil::findIn($process["positionid"], $v["allposid"])) {
                         $prcsUserAuto .= $v["uid"] . ",";
                     }
                 }
                 if ($prcsUserAuto != "") {
                     $prcsOpUser = strtok($prcsUserAuto, ",");
                 }
             }
         } else {
             if ($process["autotype"] == 8 && is_numeric($process["autouser"])) {
                 $uid = FlowRunProcess::model()->fetchBaseUid($runId, $process["autouser"]);
                 if ($uid) {
                     $temp = User::model()->fetchByUid($uid);
                     if ($temp) {
                         if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $temp["uid"]) || StringUtil::findIn($process["deptid"], $temp["alldeptid"]) || StringUtil::findIn($process["positionid"], $temp["allposid"])) {
                             $prcsOpUser = $prcsUserAuto = $temp["uid"];
                             $prcsUserAuto .= ",";
                         }
                     }
                 }
             } elseif ($process["autotype"] == 9) {
                 $main = Ibos::app()->user->deptid;
                 foreach (User::model()->fetchAllFitDeptUser($main) as $k => $v) {
                     if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $v["uid"]) || StringUtil::findIn($process["deptid"], $v["alldeptid"]) || StringUtil::findIn($process["positionid"], $v["allposid"])) {
                         $prcsUserAuto .= $v["uid"] . ",";
                     }
                 }
                 if (!empty($prcsUserAuto)) {
                     $prcsOpUser = strtok($prcsUserAuto, ",");
                 }
             } elseif ($process["autotype"] == 10) {
                 $main = Ibos::app()->user->deptid;
                 $deptStr = Department::model()->queryDept($main, true);
                 $temp = explode(",", $deptStr);
                 $count = count($temp);
                 $dept = isset($temp[$count - 2]) ? $temp[$count - 2] : $main;
                 if ($deptArr[$dept]["pid"] != 0) {
                     $tmpdept = $deptArr[$dept]["deptid"];
                 } else {
                     $tmpdept = $main;
                 }
                 foreach (User::model()->fetchAllFitDeptUser($tmpdept) as $k => $v) {
                     if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $v["uid"]) || StringUtil::findIn($process["deptid"], $v["alldeptid"]) || StringUtil::findIn($process["positionid"], $v["allposid"])) {
                         $prcsUserAuto .= $v["uid"] . ",";
                     }
                 }
                 if (!empty($prcsUserAuto)) {
                     $prcsOpUser = strtok($prcsUserAuto, ",");
                 }
             } else {
                 if ($process["uid"] != "" && $process["deptid"] == "" && $process["positionid"] == "") {
                     $prcsUserArr = explode(",", $process["uid"]);
                     $prcsUserCount = count($prcsUserArr) - 1;
                     if ($prcsUserCount == 1) {
                         $prcsUserAuto = $process["uid"];
                         $prcsOpUser = $prcsUserAuto;
                     }
                 }
             }
         }
         $prcsuser = WfHandleUtil::getPrcsUser($flowId, $process["processid"]);
         $prcsuser = sprintf("[%s]", !empty($prcsuser) ? StringUtil::iImplode($prcsuser) : "");
         if ($process["userlock"] != 1) {
             $attr = 'islock="1"';
         } else {
             $attr = '';
         }
         if (!empty($prcsOpUser)) {
             $prcsOpUser = StringUtil::wrapId($prcsOpUser);
         }
         if (!empty($prcsUserAuto)) {
             $prcsUserAuto = StringUtil::wrapId(StringUtil::filterStr($prcsUserAuto));
         }
         $tablestr = "        <div class=\"control-group\" style=\"display:{$display};\" id='user_select_{$index}'>\r\n            <div class=\"control-group first-group\">\r\n                <label class=\"control-label\">{$lang["Host"]}</label>\r\n                <div class=\"controls\">\r\n\t\t\t\t\t<input type=\"hidden\" name=\"topflag{$index}\" value=\"{$process["topdefault"]}\">\r\n\t\t\t\t\t<input id=\"prcs_user_op{$index}\" {$attr} name=\"prcs_user_op{$index}\"  value=\"{$prcsOpUser}\" type=\"text\" />\r\n\t\t\t\t</div>\r\n            </div>\r\n            <div class=\"control-group\">\r\n                <label class=\"control-label\">{$lang["Agent"]}</label>\r\n                <div class=\"controls\">\r\n\t\t\t\t\t<input id=\"prcs_user{$index}\" {$attr} name=\"prcs_user{$index}\" value=\"{$prcsUserAuto}\" type=\"text\" />\r\n\t\t\t\t</div>\r\n            </div>\r\n        </div>\r\n        <script>\r\n            \$(function(){\r\n\t\t\t\tvar prcsData{$index} = {$prcsuser};\r\n                var puo = \$('#prcs_user_op{$index}');\r\n                var pu = \$('#prcs_user{$index}');\r\n\t\t\t\tvar topdef = '{$process["topdefault"]}';\r\n                puo.userSelect({\r\n                    box:\$('<div id=\"prcs_user_op_box{$index}\"></div>').appendTo(document.body),\r\n                    data:Ibos.data.includes(prcsData{$index}),\r\n\t\t\t\t\ttype:'user',\r\n                    maximumSelectionSize:'1'\r\n                });\r\n                if(puo.attr('islock')==1 || topdef != 0){\r\n                    puo.userSelect('setReadOnly');\r\n                }     \r\n                pu.userSelect({\r\n\t\t\t\t\tbox:\$('<div id=\"prcs_user_box{$index}\"></div>').appendTo(document.body),\r\n                    data:Ibos.data.includes(prcsData{$index}),\r\n\t\t\t\t\ttype:'user'\r\n                });\r\n                if(pu.attr('islock')==1){\r\n                    pu.userSelect('setReadOnly');\r\n                }\r\n            });\r\n        </script>";
     }
     return $tablestr;
 }
示例#3
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);
     }
 }
示例#4
0
 public static function addRunData($flowId, $runData, $structure)
 {
     self::updateTable($flowId, $structure);
     FlowDataN::model()->add($flowId, $runData);
 }
示例#5
0
 public function handleForm(&$model, &$hiddenArr, &$readOnlyArr, $debug = false)
 {
     $structure = $this->form->structure;
     $inAppMode = isset($this->flow);
     if ($inAppMode) {
         WfCommonUtil::updateTable($this->flow->flowid, $structure);
         $itemData = FlowDataN::model()->fetch($this->flow->flowid, $this->run->runid);
     }
     if (empty($structure)) {
         return $model;
     } else {
         $params = array("inDebug" => $debug, "inApp" => $inAppMode, "itemData" => isset($itemData) ? $itemData : array());
         $processor = new ICViewProcessor(array_merge($params, $this->toArray()));
         foreach ($structure as $ename => $item) {
             $etitle = isset($item["data-title"]) ? $item["data-title"] : "";
             $etype = $item["data-type"];
             $itemID = $item["itemid"];
             if (!$debug) {
                 if ($this->flow->isFixed() && StringUtil::findIn($this->process->hiddenitem, $etitle)) {
                     $model = str_ireplace("{" . $ename . "}", "", $model);
                     $hiddenArr[] = $itemID;
                     continue;
                 }
                 $readOnly = $this->isReadOnly($etitle);
             } else {
                 $readOnly = false;
             }
             if ($readOnly) {
                 if ($this->flow->isFixed() && StringUtil::findIn($this->process->processitemauto, $etitle) || $etype != "calc") {
                     $readOnlyArr[] = $itemID;
                 }
             }
             $method = $etype . "Processor";
             if (method_exists($processor, $method)) {
                 $eleout = $processor->{$method}($item, $readOnly);
             }
             $model = str_ireplace("{" . $ename . "}", $eleout, $model);
         }
     }
 }