public function getFormFields($params) { $id = $params["id"]; $ai = new Model_Ai(); $fields = $ai->getForm($id); echo $this->view->render("kb_formfields", array("fields" => $fields)); }
public function index() { $this->view->setTitle("Форма для выбранного объектаы"); $this->view->setLeftContent($this->view->render("left_objects", array())); $ai = new Model_Ai(); $obj = new Model_Object(); if (isset($this->args[1]) and $this->args[1] == "edit") { if (isset($_POST["submit"])) { unset($_POST["submit"]); $ai->editObjectFormInfo($_GET["oaid"], $_POST); $this->view->refresh(array("timer" => "1", "url" => "objects/")); } else { if (isset($_GET["oaid"])) { $afinfo = $ai->getAdvanced($_GET["oaid"]); $val = $ai->getaiinfo(); $form = json_decode($val["val"], true); $fields = $ai->getForm($val["tid"]); for ($i = 0; $i < count($fields); $i++) { foreach ($form as $key => $val) { if ($fields[$i]["field"] == $key) { $fields[$i]["val"] = $val; } } } $this->view->objects_setformedit(array("oaid" => $_GET["oaid"], "afinfo" => $afinfo, "info" => $val, "form" => $form, "fields" => $fields)); } } } else { if (isset($_POST["submit"])) { unset($_POST["submit"]); $form = $ai->getFormName($_GET["fid"]); $title = "[" . $form . "] "; $sObj = $obj->getShortObject($_GET["oid"]); foreach ($sObj as $part) { $title .= $part["val"] . " "; } $oaid = $ai->addObjectFormInfo($_GET["oid"], $_GET["fid"], $title, $_POST); $ai->addTags($oaid, $form); $this->view->refresh(array("timer" => "1", "url" => "objects/")); } else { if (isset($_GET["oid"]) and isset($_GET["fid"])) { $this->view->objects_setform(array("oid" => $_GET["oid"], "fid" => $_GET["fid"])); } } } $this->view->showPage(); }
public function index() { $this->view->setTitle("Формы"); $this->view->setLeftContent($this->view->render("left_objects", array())); $ai = new Model_Ai(); $template = new Model_Template(); $datatypes = $template->getDataTypes(); if (isset($this->args[1])) { if ($this->args[1] == "add") { if (isset($_POST["submit"])) { $ai->addForm($_POST); $this->view->refresh(array("timer" => "1", "url" => "objects/forms/")); } else { $this->view->objects_formadd(array("datatypes" => $datatypes)); } } else { if ($this->args[1] == "edit") { if (isset($_POST["submit"])) { $ai->editForm($_GET["id"], $_POST); $this->view->refresh(array("timer" => "1", "url" => "objects/forms/")); } else { if (isset($_GET["id"])) { $post = $ai->getForm($_GET["id"]); $this->view->objects_formedit(array("post" => $post, "datatypes" => $datatypes)); } } } elseif ($this->args[1] == "editview") { $param = $ai->getTemplateView($_GET["id"]); $this->view->objects_formeditview(array("tid" => $_GET["id"], "post" => $param, "datatypes" => $datatypes)); } } } else { $forms = $ai->getForms(); $this->view->objects_formslist(array("forms" => $forms)); } $this->view->showPage(); }