示例#1
0
 public function actionAdvanced()
 {
     $flowList = $sort = array();
     $enabledFlowIds = WfNewUtil::getEnabledFlowIdByUid($this->uid);
     foreach (FlowType::model()->fetchAll() as $flow) {
         $catId = $flow["catid"];
         $flowId = $flow["flowid"];
         if (!isset($flowList[$catId])) {
             $sort[$catId] = array();
             $cat = FlowCategory::model()->fetchByPk($catId);
             if ($cat) {
                 $sort[$catId] = $cat;
             }
         }
         if ($flow["usestatus"] == 3) {
             continue;
         }
         $enabled = in_array($flowId, $enabledFlowIds);
         if (!$enabled && $flow["usestatus"] == 2) {
             continue;
         }
         $per = FlowPermission::model()->fetchPermission($this->uid, $flowId);
         if ($flow["type"] == 1 && Ibos::app()->user->isadministrator != "1" && !$per) {
             if (!WfNewUtil::checkProcessPermission($flowId, 0, $this->uid)) {
                 continue;
             }
         }
         $handle = $done = 0;
         foreach (FlowRun::model()->fetchAllEndByFlowID($flowId) as $run) {
             if ($run["endtime"] == 0) {
                 $handle++;
             } else {
                 $done++;
             }
         }
         $flow["handle"] = $handle;
         $flow["done"] = $done;
         $flow["enabled"] = $enabled;
         $flowList[$catId][$flowId] = $flow;
     }
     ksort($flowList, SORT_NUMERIC);
     $this->setPageTitle(Ibos::lang("Select process"));
     $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("Select process"))));
     $data = array("flows" => $flowList, "sort" => $sort);
     $this->render("advanced", $data);
 }
示例#2
0
 protected function handleStartFlowList(&$data)
 {
     $flowList = $commonlyFlowList = $sort = array();
     $enabledFlowIds = WfNewUtil::getEnabledFlowIdByUid($this->uid);
     $commonlyFlowIds = FlowRun::model()->fetchCommonlyUsedFlowId($this->uid);
     foreach (FlowType::model()->fetchAll(array("order" => "sort,flowid")) as $flow) {
         $catId = $flow["catid"];
         $flowId = $flow["flowid"];
         if (!isset($flowList[$catId])) {
             $sort[$catId] = array();
             $cat = FlowCategory::model()->fetchByPk($catId);
             if ($cat) {
                 $sort[$catId] = $cat;
             }
         }
         if ($flow["usestatus"] == 3) {
             continue;
         }
         $enabled = in_array($flowId, $enabledFlowIds);
         if (!$enabled && $flow["usestatus"] == 2) {
             continue;
         }
         $flow["enabled"] = $enabled;
         if (in_array($flowId, $commonlyFlowIds)) {
             $commonlyFlowList[] = $flow;
         }
         $flowList[$catId][$flowId] = $flow;
     }
     ksort($flowList, SORT_NUMERIC);
     $data["flows"] = $flowList;
     $data["sort"] = $sort;
     $data["commonlyFlows"] = $commonlyFlowList;
 }