protected function handleRunData(ICFlowType $type, &$runData) { $structure = $type->form->structure; foreach ($structure as $k => $v) { if ($v["data-type"] == "checkbox" && stristr($v["content"], "checkbox")) { if (stristr($v["content"], "checked") || stristr($v["content"], " checked=\"checked\"")) { $itemData = "on"; } else { $itemData = ""; } } elseif (!in_array($v["data-type"], array("select", "listview"))) { if (isset($v["data-value"])) { $itemData = str_replace("\"", "", $v["data-value"]); if ($itemData == "{macro}") { $itemData = ""; } } else { $itemData = ""; } } else { $itemData = ""; } $runData[strtolower($k)] = $itemData; } WfCommonUtil::addRunData($type->getID(), $runData, $structure); }
protected function setGuideProcess(ICFlowType $flow, $curStep) { $guideProcess = $flow->guideprocess; $processPart = explode(",", $guideProcess); if (!in_array($curStep, $processPart)) { $processPart[] = $curStep; sort($processPart); $newProcess = implode(",", $processPart); FlowType::model()->updateByPk($flow->getID(), array("guideprocess" => $newProcess)); } }
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); }
public function actionSearch() { $flowId = intval(EnvUtil::getRequest("flowid")); $seqId = intval(EnvUtil::getRequest("id")); if (!$flowId && !$seqId) { $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("query/advanced")); } $data = array(); if ($seqId) { $edit = true; $tpl = FlowQueryTpl::model()->fetchByPk($seqId); if ($tpl) { $flow = new ICFlowType(intval($tpl["flowid"])); $tpl["flow"] = unserialize($tpl["flowconditions"]); if (!empty($tpl["flow"]["beginuser"])) { $tpl["flow"]["beginuser"] = StringUtil::wrapId($tpl["flow"]["beginuser"]); } $tpl["group"] = unserialize($tpl["groupbyfields"]); $tpl["viewfields"] = !empty($tpl["viewextfields"]) ? explode(",", $tpl["viewextfields"]) : array(); if (!empty($tpl["condformula"])) { $conArr = explode("\\n", $tpl["condformula"]); } else { $conArr = array(); } } else { $this->error(Ibos::lang("Record does not exists", "error"), $this->createUrl("query/advanced")); } } else { $flow = new ICFlowType($flowId); $edit = false; $tpl = $conArr = array(); } $formStructure = $flow->form->parser->getStructure(); $defTitleArr = array(array("key" => "runid", "title" => Ibos::lang("Flow no")), array("key" => "runname", "title" => Ibos::lang("Flow subject/num")), array("key" => "runstatus", "title" => Ibos::lang("Flow status")), array("key" => "rundate", "title" => Ibos::lang("Flow begin date")), array("key" => "runtime", "title" => Ibos::lang("Flow begin time"))); $titleArr = array(); $table = "flow_data_" . $flow->getID(); foreach ($formStructure as $structure) { if ($structure["data-type"] == "sign" || $structure["data-type"] == "label") { continue; } $titleIdentifier = sprintf("%s.%s", $table, "data_" . $structure["itemid"]); $structure["data-title"] = stripslashes(str_replace(array("<", ">"), array("<", ">"), $structure["data-title"])); $titleArr[] = array("key" => $titleIdentifier, "title" => $structure["data-title"]); } $data["deftitle"] = $defTitleArr; $data["title"] = $titleArr; $this->setPageTitle(Ibos::lang("specify query conditions")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang("Work query"), "url" => $this->createUrl("query/index")), array("name" => Ibos::lang("Advanced query"), "url" => $this->createUrl("query/advanced")), array("name" => Ibos::lang("specify query conditions")))); $tpls = FlowQueryTpl::model()->fetchAllBySearch($flow->getID(), $this->uid); $data["flow"] = $flow->toArray(); $data["tpls"] = $tpls; $data["edit"] = $edit; $data["tpl"] = $tpl; $data["conArr"] = $conArr; $data["id"] = $seqId; $this->render("search", $data); }