Beispiel #1
0
 function index()
 {
     if ($this->registry["ui"]["admin"]) {
         $this->view->setLeftContent($this->view->render("left_route", array()));
         $routes = new Model_RealRoute();
         if ($this->args[0] == "edit") {
             if (isset($this->post["actionsubmit"])) {
                 $routes->addRouteAction($this->post["step_id"], $this->post["ifdata"], $this->post["ifcon"], $this->post["ifval"], $this->post["goto"]);
             }
             if (isset($this->post["submit"])) {
                 if (isset($this->post["tid"])) {
                     if (isset($this->post["delegate"])) {
                         $uid = $this->post["delegate"];
                     } else {
                         $uid = 0;
                     }
                     $routes->setRouteTask($this->post["tid"], $this->post, $uid);
                 }
             }
             if (isset($this->get["id"])) {
                 $route = $routes->getRoute($this->get["id"]);
                 $this->view->setTitle("Бизнес-процесс: " . $route[0]["name"]);
                 $steps = $routes->getSteps();
                 for ($i = 0; $i < count($steps); $i++) {
                     $steps[$i]["action"] = $routes->getRouteAction($steps[$i]["step_id"]);
                 }
                 $this->view->edit(array("route" => $route, "rid" => $this->get["id"], "steps" => $steps));
             }
         }
         $this->view->showPage();
     }
 }
Beispiel #2
0
 public function runAction($rid, $step_id, $results)
 {
     $goto = null;
     $routes = new Model_RealRoute();
     $action = $routes->getRouteAction($step_id);
     if (count($action) == 0) {
         $goto = $this->countStep($rid, $step_id);
     } else {
         foreach ($action as $part) {
             $templates = new Model_Template();
             $sql = "SELECT datatype FROM route_tasks_results WHERE id = :ifdata LIMIT 1";
             $res = $this->registry['db']->prepare($sql);
             $param = array(":ifdata" => $part["ifdata"]);
             $res->execute($param);
             $row = $res->fetchAll(PDO::FETCH_ASSOC);
             $vals = $templates->getDataVals($row[0]["datatype"]);
             foreach ($results as $key => $val) {
                 foreach ($vals as $temps) {
                     if ($temps["id"] == $val) {
                         $id = $temps["val"];
                     }
                 }
                 if ($key == $part["ifdata"]) {
                     if ($part["ifcon"] == "=") {
                         if ($id == $part["ifval"]) {
                             $goto = $part["goto"];
                         }
                     } else {
                         if ($part["ifcon"] == "<") {
                             if ($id < $part["ifval"]) {
                                 $goto = $part["goto"];
                             }
                         } else {
                             if ($part["ifcon"] == ">") {
                                 if ($id > $part["ifval"]) {
                                     $goto = $part["goto"];
                                 }
                             } else {
                                 if ($part["ifcon"] == "!=") {
                                     if ($id != $part["ifval"]) {
                                         $goto = $part["goto"];
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if ($goto == null) {
             $goto = $this->countStep($rid, $step_id);
         }
     }
     return $goto;
 }
Beispiel #3
0
 function delRealRoute($params)
 {
     $rid = $params["rid"];
     $routes = new Model_RealRoute();
     $routes->delRoute($rid);
 }