Beispiel #1
0
 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();
 }
Beispiel #2
0
 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));
             }
         }
     }
 }
Beispiel #3
0
 public function index()
 {
     $this->view->setTitle("Информация");
     $this->view->setLeftContent($this->view->render("left_objects", array()));
     $object = new Model_Object();
     $ai = new Model_Ai();
     if (isset($_GET["oid"]) and is_numeric($_GET["oid"])) {
         if (isset($this->args[1])) {
             if ($this->args[1] == "add") {
                 $this->view->objects_addinfo(array("oid" => $_GET["oid"]));
             }
         }
     }
     if (isset($_GET["oaid"]) and is_numeric($_GET["oaid"])) {
         if (isset($this->args[1])) {
             if ($this->args[1] == "edit") {
                 $arr = $ai->getTags($_GET["oaid"]);
                 $advInfo["tags"] = implode(", ", $arr);
                 $advInfo["adv"] = $ai->getAdvanced($_GET["oaid"]);
                 $this->view->objects_editinfo(array("aoid" => $_GET["oaid"], "ai" => $advInfo));
             }
         }
     }
     $this->view->showPage();
 }
Beispiel #4
0
 public function index()
 {
     $this->view->setLeftContent($this->view->render("left_kb", array()));
     $advinfo = new Model_Ai();
     $tpl = new Model_Template();
     if (isset($this->get["history"])) {
         $this->view->setTitle("История");
         $tasks = $this->registry["logs"]->getHistory("info", $this->get["history"]);
         foreach ($tasks as $task) {
             if ($task["param"][0]["key"]) {
                 $this->view->history(array("obj" => $task));
             }
         }
     } elseif (isset($_GET["tag"])) {
         $this->view->setTitle("Тег: " . htmlspecialchars($_GET["tag"]));
         $ai = $advinfo->getAIFromTag($_GET["tag"]);
         $this->view->setMainContent("<b>Тег:</b> " . htmlspecialchars($_GET["tag"]));
         foreach ($ai as $part) {
             $aiinfo = $advinfo->getaiinfo();
             /*
             if ($ainfo = json_decode($part["val"], true)) {
             	$part["val"] = null;
             	foreach($ainfo as $key=>$val) {
             		$part["val"] .= "<b>" . $key . "</b>: " . $val . "<br />";
             	}
             }
             */
             $this->view->ai(array("ai" => $part, "info" => $aiinfo));
         }
     } elseif (isset($this->args[1]) and $this->args[1] == "add") {
         $this->view->setTitle("Добавить информацию");
         $this->view->kb_add();
     } else {
         $this->view->setTitle("Теги");
         $templates = $tpl->getTemplates();
         $id = count($templates);
         $templates[$id]["id"] = 0;
         $templates[$id]["name"] = "Заметки";
         $list = $advinfo->getAi();
         for ($i = 0; $i < count($list); $i++) {
             if ($list[$i]["oid"] == "0") {
                 $list[$i]["name"] = "Заметки";
             }
         }
         $sortlist = array();
         foreach ($templates as $template) {
             foreach ($list as $kb) {
                 if ($kb["name"] == $template["name"]) {
                     $sortlist[$template["name"]][] = $kb["tag"];
                 }
             }
         }
         $this->print_array($sortlist);
         $this->view->kb_tree(array("list" => $this->tree));
     }
     $this->view->showPage();
 }
Beispiel #5
0
 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();
 }
Beispiel #6
0
 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();
 }
Beispiel #7
0
 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();
 }
Beispiel #8
0
 public function index()
 {
     $this->view->setTitle("Поиск");
     $this->view->setLeftContent($this->view->render("left_find", array("num" => $this->numFind)));
     $find = new Model_Find();
     $object = new Model_Object();
     $ai = new Model_Ai();
     if (isset($this->findSess["string"])) {
         $this->view->setMainContent("<p style='font-weight: bold; margin-bottom: 20px'>Поиск: " . $this->findSess["string"] . "</p>");
         if (isset($this->args[1])) {
             if ($this->args[1] == "page" and isset($this->args[2])) {
                 if (!$find->setPage($this->args[2])) {
                     $this->__call("objects", "index");
                 }
             }
         }
         $find->links = "/" . $this->args[0] . "/";
         $text = substr($this->findSess["string"], 0, 64);
         $text = explode(" ", $text);
         $findArr = $find->findAdvs($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"]);
                 $objects = $this->registry["module_objects"]->renderObject($this->registry["ui"], $obj, $advInfo, $forms, $numAdvInfo, $numTroubles);
                 $this->view->setMainContent($objects);
             }
             //Отобразим пейджер
             if (count($find->pager) != 0) {
                 $this->view->pager(array("pages" => $find->pager));
             }
         }
     }
 }
Beispiel #9
0
 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();
 }
Beispiel #10
0
 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();
 }
Beispiel #11
0
 public function getFormFields($params)
 {
     $id = $params["id"];
     $ai = new Model_Ai();
     $fields = $ai->getForm($id);
     echo $this->view->render("kb_formfields", array("fields" => $fields));
 }
Beispiel #12
0
 public function delForm($params)
 {
     $id = $params["id"];
     $ai = new Model_Ai();
     $ai->delForm($id);
 }
Beispiel #13
0
 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();
 }
Beispiel #14
0
 public function editAdvanced($params)
 {
     $oid = $params["oid"];
     $title = $params["title"];
     $text = $params["text"];
     $tags = htmlspecialchars($params["tags"]);
     echo $oid . " " . $title . " " . $text . " " . $tags;
     $advinfo = new Model_Ai();
     $advinfo->editAdvanced($oid, $title, $text);
     $advinfo->changeTags($oid, $tags);
 }