コード例 #1
0
ファイル: TypeController.php プロジェクト: AxelPanda/ibos
 public function init()
 {
     parent::init();
     $this->catid = intval(EnvUtil::getRequest("catid"));
     $this->category = FlowCategory::model()->fetchAllByUserPurv($this->uid);
     $this->flowid = intval(EnvUtil::getRequest("flowid"));
 }
コード例 #2
0
ファイル: QueryController.php プロジェクト: AxelPanda/ibos
 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);
 }
コード例 #3
0
ファイル: IWWfCategoryView.php プロジェクト: AxelPanda/ibos
 private function handleList($runProcess)
 {
     $category = $flows = $list = array();
     foreach ($runProcess as $run) {
         $flowId = $run["flowid"];
         if (isset($flows[$flowId])) {
             $flow = $flows[$flowId];
         } else {
             $flows[$flowId] = $flow = FlowType::model()->fetchByPk($flowId);
         }
         $catId = $flow["catid"];
         if (!isset($list[$catId])) {
             $category[$catId] = array();
             $cat = FlowCategory::model()->fetchByPk($catId);
             if ($cat) {
                 $category[$catId] = $cat;
             }
         }
         if (isset($list[$catId][$flowId])) {
             if ($this->type == "todo") {
                 if ($run["flag"] == FlowConst::PRCS_UN_RECEIVE) {
                     $list[$catId][$flowId]["unreceive"]++;
                 }
             }
             $list[$catId][$flowId]["count"]++;
         } else {
             if ($this->type == "todo") {
                 if ($run["flag"] == FlowConst::PRCS_UN_RECEIVE) {
                     $flow["unreceive"] = 1;
                 } else {
                     $flow["unreceive"] = 0;
                 }
             }
             $flow["count"] = 1;
             $list[$catId][$flowId] = $flow;
         }
     }
     ksort($list, SORT_NUMERIC);
     return array("catSort" => $category, "list" => $list);
 }
コード例 #4
0
ファイル: WfNewUtil.php プロジェクト: AxelPanda/ibos
 public static function replaceAutoName(ICFlowType $type, $uid, $isChildFlow = false)
 {
     $user = User::model()->fetchByUid(intval($uid));
     list($year, $month, $day, $hour, $minute, $seconds) = explode("-", date("Y-m-d-H-i-s", TIMESTAMP));
     $catName = FlowCategory::model()->fetchNameByPk($type->catid);
     $autoNum = $type->autonum;
     $autoLen = $type->autolen;
     $autoNum++;
     $len = strlen($autoNum);
     for ($i = 0; $i < $autoLen - $len; $i++) {
         $autoNum = "0" . $autoNum;
     }
     if (empty($type->autoname) && $isChildFlow) {
         $type->autoname = sprintf("{F} [{RUN}](%s)", Ibos::lang("Subflow", "workflow.default"));
     }
     $maxRun = FlowRun::model()->getMaxRunId();
     $mapping = array("{Y}" => $year, "{M}" => $month, "{D}" => $day, "{H}" => $hour, "{I}" => $minute, "{S}" => $seconds, "{F}" => $type->name, "{FC}" => $catName, "{U}" => $user["realname"], "{MD}" => $user["deptname"], "{AD}" => Department::model()->fetchDeptNameByDeptId($user["alldeptid"]), "{P}" => $user["posname"], "{N}" => $autoNum, "{RUN}" => $maxRun + 1);
     $search = array_keys($mapping);
     $replace = array_values($mapping);
     $runName = str_replace($search, $replace, $type->autoname);
     return $runName;
 }
コード例 #5
0
 public function actionCategory()
 {
     if (EnvUtil::submitCheck("formhash")) {
         if (isset($_POST["name"])) {
             foreach ($_POST["name"] as $id => $val) {
                 if (!empty($val)) {
                     $data = array("name" => StringUtil::filterCleanHtml($val), "sort" => intval($_POST["sort"][$id]), "deptid" => !empty($_POST["deptid"][$id]) ? implode(",", StringUtil::getId($_POST["deptid"][$id])) : "");
                     FlowCategory::model()->modify(intval($id), $data);
                 }
             }
         }
         if (isset($_POST["newname"])) {
             foreach ($_POST["newname"] as $id => $val) {
                 if (!empty($val)) {
                     $data = array("name" => StringUtil::filterCleanHtml($val), "sort" => intval($_POST["newsort"][$id]), "deptid" => !empty($_POST["newdeptid"][$id]) ? implode(",", StringUtil::getId($_POST["newdeptid"][$id])) : "");
                     FlowCategory::model()->add($data);
                 }
             }
         }
         if (!empty($_POST["delid"])) {
             $id = StringUtil::filterStr($_POST["delid"]);
             if (!FlowCategory::model()->del($id)) {
                 $this->error(Ibos::lang("Category delete require"));
             }
         }
         $this->success(Ibos::lang("Operation succeed", "message"));
     } else {
         $categorys = FlowCategory::model()->fetchAll(array("order" => "sort ASC"));
         foreach ($categorys as $key => &$cat) {
             if ($cat["deptid"] !== "") {
                 $cat["deptid"] = StringUtil::wrapId($cat["deptid"], "d");
             }
             $cat["flownums"] = FlowType::model()->countByAttributes(array("catid" => $cat["catid"]));
             $cat["formnums"] = FlowFormType::model()->countByAttributes(array("catid" => $cat["catid"]));
         }
         $this->render("category", array("list" => $categorys));
     }
 }
コード例 #6
0
ファイル: FormtypeController.php プロジェクト: AxelPanda/ibos
 public function actionIndex()
 {
     $this->catid = intval(EnvUtil::getRequest("catid"));
     $this->category = FlowCategory::model()->fetchAllByUserPurv($this->uid);
     $catId = $this->getCatId();
     $keyword = EnvUtil::getRequest("keyword");
     if (!empty($keyword)) {
         $keyword = StringUtil::filterCleanHtml($keyword);
     } else {
         $keyword = "";
     }
     if (EnvUtil::getRequest("inajax") == "1") {
         $limit = intval(EnvUtil::getRequest("limit"));
         $offset = intval(EnvUtil::getRequest("offset"));
         $condition = $catId ? "ff.catid = " . intval($catId) : "1";
         if (!empty($keyword)) {
             $condition .= " AND ff.formname LIKE '%{$keyword}%'";
         }
         $list = FlowFormType::model()->fetchAllByList($condition, $offset, $limit);
         $list = $this->handleFormData($list);
         $count = count($list);
         $this->ajaxReturn(array("count" => $count, "list" => $list));
     } else {
         if (isset($_GET["pagesize"])) {
             $this->setListPageSize($_GET["pagesize"]);
         }
         $condition = $catId ? "catid = " . intval($catId) : "1";
         if (!empty($keyword)) {
             $condition .= " AND t.formname LIKE '%{$keyword}%'";
         }
         $count = FlowFormType::model()->countByCondition($condition);
         $pages = PageUtil::create($count, $this->getListPageSize());
         $data = array("limit" => $pages->getLimit(), "offset" => $pages->getOffset(), "pageSize" => $this->getListPageSize(), "keyword" => $keyword, "pages" => $pages, "count" => $count, "category" => $this->category, "catId" => $this->catid);
         $this->setPageTitle(Ibos::lang("Form library manager"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang("Form library manager"), "url" => $this->createUrl("formtype/index")), array("name" => Ibos::lang("List"))));
         $this->render("index", $data);
     }
 }
コード例 #7
0
ファイル: NewController.php プロジェクト: AxelPanda/ibos
 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;
 }
コード例 #8
0
ファイル: WfCommonUtil.php プロジェクト: AxelPanda/ibos
 public static function checkDeptPurv($uid, $deptId = 0, $catId = 0)
 {
     $user = User::model()->fetchByUid($uid);
     if ($user["isadministrator"] == 1) {
         return true;
     }
     if ($deptId == "") {
         if (0 < $catId) {
             $cat = FlowCategory::model()->fetchByPk($catId);
             if ($cat) {
                 return self::checkDeptPurv($uid, $cat["deptid"], 0);
             }
         }
         return true;
     }
     $purv = false;
     if (!empty($user["alldeptid"])) {
         foreach (explode(",", $user["alldeptid"]) as $userDept) {
             foreach (explode(",", $deptId) as $dept) {
                 if ($userDept == $dept || DepartmentUtil::isDeptParent($userDept, $dept)) {
                     $purv = true;
                     break;
                 }
             }
         }
     }
     return $purv;
 }