public function index() { $this->view->setTitle("Поиск"); $object = new Model_Object(); $ai = new Model_Ai(); $forms = $ai->getForms(); if (isset($this->findSess["string"])) { $this->view->setMainContent("<p style='font-weight: bold; margin-bottom: 20px'>Поиск: " . $this->findSess["string"] . "</p>"); if (isset($_GET["page"])) { if (is_numeric($_GET["page"])) { if (!$this->find->setPage($_GET["page"])) { $this->__call("find", "objects"); } } } $this->find->links = "/" . $this->args[0] . "/"; $text = substr($this->findSess["string"], 0, 64); $text = explode(" ", $text); $findArr = $this->find->findObjects($text); if (!isset($this->args[1]) or $this->args[1] == "page") { foreach ($findArr as $part) { $numTroubles = $object->getNumTroubles($part["id"]); $obj = $object->getShortObject($part["id"]); $advInfo = $ai->getAdvancedInfo($part["id"]); $numAdvInfo = $ai->getNumAdvancedInfo($part["id"]); $this->view->find_objectMain(array("ui" => $this->registry["ui"], "obj" => $obj, "advInfo" => $advInfo, "forms" => $forms, "numAdvInfo" => $numAdvInfo, "numTroubles" => $numTroubles)); } //Отобразим пейджер if (count($this->find->pager) != 0) { $this->view->pager(array("pages" => $this->find->pager)); } } } }
public function index() { if ($this->registry["ui"]["admin"]) { $this->view->setTitle("Просмотр удалённых объектов"); $this->view->setLeftContent($this->view->render("left_objects", array())); if (isset($this->args[1])) { if (isset($_GET["page"])) { if (is_numeric($_GET["page"])) { if (!$this->object->setPage($_GET["page"])) { $this->__call("objects", "list"); } } } $ai = new Model_Ai(); $forms = $ai->getForms(); $this->object->links = "objects/" . $this->args[0] . "/" . $this->args[1] . "/"; $data = $this->object->getTrashObjects($this->args[1]); $template = new Model_Template(); $arr_objs = array(); $i = 0; foreach ($data as $part) { $arr_objs[$i] = $this->object->getShortObject($part["id"]); $arr_objs[$i]["ai"] = $ai->getAdvancedInfo($part["id"]); $i++; } $fields = $template->getTypeTemplate($this->args[1]); $this->view->objects_subgroupstrash(array("objs" => $arr_objs, "forms" => $forms, "gid" => $this->args[1], "fields" => $fields)); //Отобразим пейджер if (count($this->object->pager) != 0) { $this->view->pager(array("pages" => $this->object->pager)); } } } $this->view->showPage(); }
public function index() { $this->view->setTitle("Просмотр объектов"); $this->view->setLeftContent($this->view->render("left_objects", array())); if (isset($this->args[1])) { if (isset($_GET["page"])) { if (is_numeric($_GET["page"])) { if (!$this->object->setPage($_GET["page"])) { $this->__call("objects", "list"); } } } $ai = new Model_Ai(); $forms = $ai->getForms(); $this->object->links = "objects/" . $this->args[0] . "/" . $this->args[1] . "/"; $sort =& $_SESSION["sort"]; if (isset($_GET["clear"])) { unset($sort["sort"]); } if (isset($_POST) and count($_POST) > 0) { $sort_flag = true; $sort = $_POST; $data = $this->object->getObjectsSearch($this->args[1], $_POST); } else { if ($sort["sort"] != "") { $sort_flag = true; $data = $this->object->getObjectsSearch($this->args[1], $sort); } else { $sort_flag = false; $data = $this->object->getObjects($this->args[1]); } } $template = new Model_Template(); $arr_objs = array(); $i = 0; foreach ($data as $part) { $arr_objs[$i] = $this->object->getShortObject($part["id"]); $arr_objs[$i]["ai"] = $ai->getAdvancedInfo($part["id"]); $i++; } if (isset($this->registry["module_mail"])) { $mail = true; } else { $mail = false; } $fields = $template->getTypeTemplate($this->args[1]); $this->view->objects_subgroups(array("objs" => $arr_objs, "mail" => $mail, "forms" => $forms, "gid" => $this->args[1], "fields" => $fields, "sort_flag" => $sort_flag)); //Отобразим пейджер if (count($this->object->pager) != 0) { $this->view->pager(array("pages" => $this->object->pager)); } } $this->view->showPage(); }
public function index() { $this->view->setTitle("Объект"); $this->view->setLeftContent($this->view->render("left_objects", array())); $object = new Model_Object(); $ai = new Model_Ai(); $forms = $ai->getForms(); if ($obj = $object->getShortObject($this->args[1])) { if (isset($this->registry["module_mail"])) { $mail = true; } else { $mail = false; } $numTroubles = $object->getNumTroubles($this->args[1]); $advInfo = $ai->getAdvancedInfo($this->args[1]); $numAdvInfo = $ai->getNumAdvancedInfo($this->args[1]); $this->view->objectMain(array("ui" => $this->registry["ui"], "mail" => $mail, "obj" => $obj, "advInfo" => $advInfo, "forms" => $forms, "numAdvInfo" => $numAdvInfo, "numTroubles" => $numTroubles)); } else { $this->view->setMainContent("<p>Объект не найден</p>"); } $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(); }
public function index() { $this->view->setTitle("Просмотр задачи"); $this->view->setLeftContent($this->view->render("left_tt", array())); //$top[0] = $this->view->render("top_tt", array()); //$this->view->top_top(array("blocks" => $top)); $author = array(); $ruser = array(); if (isset($this->args[1])) { if ($data = $this->registry["tt"]->getTask($this->args[1])) { if (count($data) > 0) { $numComments = $this->registry["tt"]->getNumComments($this->args[1]); $newComments = $this->registry["tt"]->getNewCommentsFromTid($this->args[1]); $lastCommentDate = $this->registry["tt"]->addTaskView($this->args[1]); if ($data[0]["remote_id"] == 0) { $author = $this->registry["user"]->getUserInfo($data[0]["who"]); } else { $author = $this->registry["tt_user"]->getRemoteUserInfo($data[0]["who"]); } foreach ($data as $part) { if (isset($part["uid"])) { if ($part["uid"] != 0) { $user = $this->registry["user"]->getUserInfo($part["uid"]); $ruser[] = "<a style='cursor: pointer' onclick='getUserInfo(" . $part["uid"] . ")'>" . $user["name"] . " " . $user["soname"] . "</a>"; } } if (isset($part["rgid"])) { if ($part["rgid"] != 0) { $ruser[] = "<span style='color: #5D7FA6'><b>" . $this->registry["user"]->getSubgroupName($part["rgid"]) . "</b></span>"; } } if ($part["all"] == 1) { $ruser[] = "<span style='color: #D9A444'><b>Все</b></span>"; } } $group = null; if ($data[0]["gid"] != "0") { $group = $this->registry["tt"]->getGroupName($data[0]["gid"]); } $object = new Model_Object(); $ai = new Model_Ai(); $forms = $ai->getForms(); $cuser = $this->registry["user"]->getUserInfo($data[0]["cuid"]); $notObj = false; if ($obj = $object->getShortObject($data[0]["oid"])) { $notObj = true; $numTroubles = $object->getNumTroubles($data[0]["oid"]); $advInfo = $ai->getAdvancedInfo($data[0]["oid"]); $numAdvInfo = $ai->getNumAdvancedInfo($data[0]["oid"]); $rObject = $this->registry["module_objects"]->renderObject($this->registry["ui"], $obj, $advInfo, $numAdvInfo, $forms, $numTroubles, $group); $this->view->setMainContent($rObject); } $this->view->tt_task(array("data" => $data, "author" => $author, "ruser" => $ruser, "cuser" => $cuser, "numComments" => $numComments, "newComments" => $newComments, "notObj" => $notObj, "obj" => $obj)); $comments = $this->registry["tt"]->getComments($this->args[1]); $history = $this->registry["logs"]->getHistory("task", $this->args[1]); for ($i = 0; $i < count($comments); $i++) { $result[$i] = $comments[$i]; $result[$i]["type"] = "comment"; } for ($j = 0; $j < count($history); $j++) { $result[$j + $i] = $history[$j]; $result[$j + $i]["ui"] = $this->registry["user"]->getUserInfo($history[$j]["uid"]); $result[$j + $i]["type"] = "history"; } for ($i = 0; $i < count($result); $i++) { if (isset($result[$i]["id"])) { $min = $result[$i]; for ($j = $i; $j < count($result); $j++) { if (isset($result[$j]["id"])) { if ($result[$j]["timestamp"] < $result[$i]["timestamp"]) { $min = $result[$j]; $result[$j] = $result[$i]; $result[$i] = $min; } } } } } if (count($comments) > 0) { $this->view->setMainContent("<div style='padding: 10px 0 20px 40px; font-size: 14px; color: #999'>Комментарии:</div>"); } //Первый лог (о создании задачи) не нужен! unset($result[0]); foreach ($result as $part) { if ($part["date"] >= $lastCommentDate) { $new = true; } else { $new = false; } $this->view->tt_comment(array("comment" => $part, "data" => $data, "new" => $new)); } if (!$data[0]["close"]) { $status = $this->registry["tt"]->getCommentsStatus(); $this->view->tt_formcomment(array("tid" => $this->args[1], "status" => $status)); } } else { $this->view->setMainContent("<p>Задача не найдена</p>"); } } else { $this->view->setMainContent("<p>Задача не найдена</p>"); } } $this->view->showPage(); }
public function index() { $this->view->setTitle("Просмотр задачи"); $author = array(); $ruser = array(); if (isset($this->args[0])) { if ($data = $this->registry["tt"]->getTask($this->args[0])) { if (count($data) > 0) { $numComments = $this->registry["tt"]->getNumComments($this->args[0]); $newComments = $this->registry["tt"]->getNewCommentsFromTid($this->args[0]); $lastCommentDate = $this->registry["tt"]->addTaskView($this->args[0]); if ($data[0]["remote_id"] == 0) { if (isset($this->registry["module_users"])) { $author = $this->registry["user"]->getUserInfo($data[0]["who"]); } else { $ui = new Model_Ui(); $user = $ui->getInfo($val["uid"]); } } else { $author = $this->registry["tt_user"]->getRemoteUserInfo($data[0]["who"]); } foreach ($data as $part) { if (isset($part["uid"])) { if ($part["uid"] != 0) { if (isset($this->registry["module_users"])) { $user = $this->registry["user"]->getUserInfo($part["uid"]); } else { $ui = new Model_Ui(); $user = $ui->getInfo($val["uid"]); } $ruser[] = "<a style='cursor: pointer' onclick='getUserInfo(" . $part["uid"] . ")'>" . $user["name"] . " " . $user["soname"] . "</a>"; } } if (isset($part["rgid"])) { if ($part["rgid"] != 0) { $ruser[] = "<span style='color: #5D7FA6'><b>" . $this->registry["user"]->getSubgroupName($part["rgid"]) . "</b></span>"; } } if ($part["all"] == 1) { $ruser[] = "<span style='color: #D9A444'><b>Все</b></span>"; } } $group = null; if ($data[0]["gid"] != "0") { $group = $this->registry["tt"]->getGroupName($data[0]["gid"]); } $object = new Model_Object(); $ai = new Model_Ai(); $forms = $ai->getForms(); $cuser = $this->registry["user"]->getUserInfo($data[0]["cuid"]); $notObj = false; if ($obj = $object->getShortObject($data[0]["oid"])) { $notObj = true; $numTroubles = $object->getNumTroubles($data[0]["oid"]); $advInfo = $ai->getAdvancedInfo($data[0]["oid"]); $numAdvInfo = $ai->getNumAdvancedInfo($data[0]["oid"]); $rObject = $this->registry["module_objects"]->renderObject($this->registry["ui"], $obj, $advInfo, $numAdvInfo, $forms, $numTroubles, $group); $this->view->setMainContent($rObject); } $this->view->tt_task(array("data" => $data, "author" => $author, "ruser" => $ruser, "cuser" => $cuser, "numComments" => $numComments, "newComments" => $newComments, "notObj" => $notObj, "obj" => $obj)); $comments = $this->registry["tt"]->getComments($this->args[0]); if (count($comments) > 0) { $this->view->setMainContent("<div style='padding: 10px 0 20px 40px; font-size: 14px; color: #999'>Комментарии:</div>"); } foreach ($comments as $part) { if ($part["date"] >= $lastCommentDate) { $new = true; } else { $new = false; } $this->view->tt_comment(array("comment" => $part, "data" => $data, "new" => $new)); } if (!$data[0]["close"]) { $status = $this->registry["tt"]->getCommentsStatus(); $this->view->tt_formcomment(array("tid" => $this->args[0], "status" => $status)); } } else { $this->view->setMainContent("<p>Задача не найдена</p>"); } } else { $this->view->setMainContent("<p>Задача не найдена</p>"); } } $this->view->showPage(); }