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() { $tid = false; if (isset($_POST["tid"])) { if (is_numeric($_POST["tid"])) { $tid = $_POST["tid"]; } } if (!$tid) { $tid = $this->args[1]; } $data = $this->registry["tt"]->getTask($tid); // Если задача создана нами if ($this->registry["ui"]["id"] == $data[0]["who"] or $this->registry["ui"]["admin"]) { $this->view->setTitle("Правка задачи"); $this->view->setLeftContent($this->view->render("left_tt", array())); $this->view->setLeftContent($this->view->render("left_attach", array())); if (isset($_POST["submit"])) { $_POST["task"] = $_POST["textfield"]; unset($_POST["textfield"]); if ($tid = $this->registry["tt"]->editTask($_POST, $data)) { $this->registry["tt"]->spamUsers("Изменения в задаче", $_POST["tid"]); $this->view->refresh(array("timer" => "1", "url" => "tt/")); } else { $this->view->setMainContent("<p style='margin: 30px 0 0 50px; color: red'>Заполните текст задачи!</span>"); $this->view->refresh(array("timer" => "1", "url" => "tt/edit/" . $_POST["tid"] . "/")); } } else { $data = $this->registry["tt"]->getTask($this->args[1]); $object = new Model_Object(); $obj = $object->getShortObject($data[0]["oid"]); $issRusers = array(); $k = 0; foreach ($data as $part) { if ($part["uid"] != null) { if ($part["uid"] != "0") { $row = $this->registry["user"]->getUserInfo($part["uid"]); $k++; $issRusers[$k]["desc"] = '<p><span style="font-size: 11px; margin-right: 10px;" id="udesc[' . $row["uid"] . ']">' . $row["name"] . ' ' . $row["soname"] . '</span>'; $issRusers[$k]["desc"] .= '<input id="uhid[' . $row["uid"] . ']" type="hidden" name="ruser[]" value="' . $row["uid"] . '" /></p>'; } } if ($part["rgid"] != null) { if ($part["rgid"] != "0") { $gname = $this->registry["user"]->getGroupName($part["rgid"]); $k++; $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">' . $gname . '<input type="hidden" name="gruser[]" value="' . $part["rgid"] . '" /></p>'; } } if ($part["all"] == "1") { $k++; $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">Все<input type="hidden" name="rall" value="1" /></p>'; } } $this->view->tt_edit(array("data" => $data, "obj" => $obj, "issRusers" => $issRusers)); } } $this->view->showPage(); }
public function index() { $this->view->setTitle("Правка черновика"); $this->view->setLeftContent($this->view->render("left_tt", array())); $this->view->setLeftContent($this->view->render("left_attach", array())); if (isset($_POST["createtask"])) { if (isset($_GET["oid"]) and $_GET["oid"] != "") { $oid = $_GET["oid"]; } elseif (isset($_POST["selObjHid"])) { $oid = $_POST["selObjHid"]; } else { $oid = 0; } $_POST["task"] = $_POST["textfield"]; unset($_POST["textfield"]); if ($tid = $this->registry["tt"]->addTask($oid, $_POST)) { $this->registry["tt"]->SpamUsers("Новая задача", $tid); $this->view->refresh(array("timer" => "1", "url" => "tt/show/" . $tid . "/")); } else { $this->view->setMainContent("<p style='margin: 30px 0 0 50px; color: red'>Заполните текст задачи!</span>"); $this->view->refresh(array("timer" => "1", "url" => "tt/add/?oid=" . $oid . "&date=" . $_GET["date"])); } } elseif (isset($_POST["submit"])) { $_POST["task"] = $_POST["textfield"]; if ($tid = $this->registry["tt"]->editDraft($_POST)) { $this->view->refresh(array("timer" => "1", "url" => "tt/draft/")); } } else { $data = $this->registry["tt"]->getDraft($this->args[1]); $object = new Model_Object(); $obj = $object->getShortObject($data[0]["oid"]); $issRusers = array(); $k = 0; foreach ($data as $part) { if ($part["uid"] != null) { if ($part["uid"] != "0") { $row = $this->registry["user"]->getUserInfo($part["uid"]); $k++; $issRusers[$k]["desc"] = '<p><span style="font-size: 11px; margin-right: 10px;" id="udesc[' . $row["uid"] . ']">' . $row["name"] . ' ' . $row["soname"] . '</span>'; $issRusers[$k]["desc"] .= '<input id="uhid[' . $row["uid"] . ']" type="hidden" name="ruser[]" value="' . $row["uid"] . '" /></p>'; } } if ($part["rgid"] != null) { if ($part["rgid"] != "0") { $gname = $this->registry["user"]->getGroupName($part["rgid"]); $k++; $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">' . $gname . '<input type="hidden" name="gruser[]" value="' . $part["rgid"] . '" /></p>'; } } if ($part["all"] == "1") { $k++; $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">Все<input type="hidden" name="rall" value="1" /></p>'; } } $this->view->tt_draftedit(array("data" => $data, "obj" => $obj, "issRusers" => $issRusers)); } $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)); if (isset($_GET["page"])) { if (is_numeric($_GET["page"])) { if (!$this->registry["tt"]->setPage($_GET["page"])) { $this->__call("tt", "index"); } } } $this->registry["tt"]->links = "/"; $tasks = $this->registry["tt"]->getDrafts(); if (count($tasks) == 0) { $this->view->setMainContent("<p>Черновиков нет</p>"); } foreach ($tasks as $part) { if ($data = $this->registry["tt"]->getDraft($part["id"])) { $author = $this->registry["user"]->getUserInfo($data[0]["who"]); $ruser = array(); foreach ($data as $val) { if (isset($val["uid"])) { if ($val["uid"] != 0) { $user = $this->registry["user"]->getUserInfo($val["uid"]); $ruser[] = "<a style='cursor: pointer' onclick='getUserInfo(" . $val["uid"] . ")'>" . $user["name"] . " " . $user["soname"] . "</a>"; } } if (isset($val["rgid"])) { if ($val["rgid"] != 0) { $ruser[] = "<span style='color: #5D7FA6'><b>" . $this->registry["user"]->getSubgroupName($val["rgid"]) . "</b></span>"; } } if ($val["all"] == 1) { $ruser[] = "<span style='color: #D9A444'><b>Все</b></span>"; } } $object = new Model_Object(); $notObj = true; if (!($obj = $object->getShortObject($data[0]["oid"]))) { $notObj = false; } $this->view->tt_task(array("type" => "draft", "data" => $data, "author" => $author, "ruser" => $ruser, "notObj" => $notObj, "obj" => $obj)); unset($ruser); } else { $this->view->setMainContent("<p>Черновиков нет</p>"); } } //Отобразим пейджер if (count($this->registry["tt"]->pager) != 0) { $this->view->pager(array("pages" => $this->registry["tt"]->pager)); } $this->view->showPage(); }
public function showTasks($tasks) { $task = array(); $object = new Model_Object(); if (count($tasks) == 0) { $this->view->setMainContent("<p style='margin: 10px'>Задачи не найдены</p>"); } foreach ($tasks as $part) { if ($data = $this->registry["tt"]->getTask($part["id"])) { $numComments = $this->registry["tt"]->getNumComments($part["id"]); $newComments = $this->registry["tt"]->getNewCommentsFromTid($part["id"]); if ($data[0]["remote_id"] == 0) { $author = $this->registry["user"]->getUserInfo($data[0]["who"]); } else { $author = $this->registry["tt_user"]->getRemoteUserInfo($data[0]["who"]); } $ruser = array(); foreach ($data as $val) { if (isset($val["uid"])) { if ($val["uid"] != 0) { $user = $this->registry["user"]->getUserInfo($val["uid"]); $ruser[] = "<a style='cursor: pointer' onclick='getUserInfo(" . $val["uid"] . ")'>" . $user["name"] . " " . $user["soname"] . "</a>"; } } if (isset($val["rgid"])) { if ($val["rgid"] != 0) { $ruser[] = "<span style='color: #5D7FA6'><b>" . $this->registry["user"]->getSubgroupName($val["rgid"]) . "</b></span>"; } } if ($val["all"] == 1) { $ruser[] = "<span style='color: #D9A444'><b>Все</b></span>"; } } $cuser = $this->registry["user"]->getUserInfo($data[0]["cuid"]); $notObj = true; if (!($obj = $object->getShortObject($data[0]["oid"]))) { $notObj = false; } //$task[] = $this->view->render("tt_tasktable", array("data" => $data, "author" => $author, "ruser" => $ruser, "cuser" => $cuser, "notObj" => $notObj, "obj" => $obj, "numComments" => $numComments, "newComments" => $newComments)); $task[] = $this->view->render("tt_task", array("data" => $data, "author" => $author, "ruser" => $ruser, "cuser" => $cuser, "notObj" => $notObj, "obj" => $obj, "numComments" => $numComments, "newComments" => $newComments)); unset($ruser); } else { $this->view->setMainContent("<p style='margin: 10px 0'>Задача не найдена</p>"); } } $this->view->tt_taskpage(array("tasks" => $task)); //Отобразим пейджер if (count($this->registry["tt"]->pager) != 0) { $this->view->pager(array("pages" => $this->registry["tt"]->pager)); } $this->view->showPage(); }
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("Добавить объект"); $object = new Model_Object(); if (isset($_POST["submit"])) { $object->addObject($_POST); $this->view->refresh(array("timer" => "1", "url" => "objects/list/")); } else { if (isset($_GET["p"])) { $contact =& $_SESSION["contact"]; if (isset($contact["email"]) and $contact["email"] != null) { $email = $contact["email"]; } else { $email = null; } $this->view->objects_add(array("pname" => $_GET["p"], "email" => $email)); } } $this->view->showPage(); }
public function index() { $this->view->setTitle("Правка объекта"); $this->view->setLeftContent($this->view->render("left_objects", array())); $object = new Model_Object(); if (isset($_POST["submit"])) { $object->editObject($_POST); $this->view->refresh(array("timer" => "1", "url" => "objects/sub/" . $this->args[1] . "/")); } else { if (isset($this->args[1])) { $data = $object->getObject($this->args[1]); $contact =& $_SESSION["contact"]; if (isset($contact["email"]) and $contact["email"] != null) { $email = $contact["email"]; } else { $email = null; } $first[] = '<ul id="firstSort" class="tviewshow">'; $second[] = '<ul id="secondSort" class="tviewshow">'; $third[] = '<ul id="thirdSort" class="tviewshow">'; foreach ($data as $part) { if ($part["view"]["x"] == 1) { $first[] = $this->view->render("objects_objectfieldedit", array("part" => $part)); } elseif ($part["view"]["x"] == 2) { $second[] = $this->view->render("objects_objectfieldedit", array("part" => $part)); } elseif ($part["view"]["x"] == 3) { $third[] = $this->view->render("objects_objectfieldedit", array("part" => $part)); } else { $first[] = $this->view->render("objects_objectfieldedit", array("part" => $part)); } } $first[] = "</ul>"; $second[] = "</ul>"; $third[] = "</ul>"; $template = array_merge($first, $second, $third); $template = '<div style="overflow: hidden" id="tview">' . implode(" ", $template) . '</div>'; $this->view->objects_edit(array("vals" => $data, "template" => $template, "email" => $email)); } } $this->view->showPage(); }
public function index() { $this->view->setTitle("Объект"); $object = new Model_Object(); $ai = $this->registry["module_kb"]; $forms = $ai->getForms(); if ($obj = $object->getShortObject($this->args[0])) { if (isset($this->registry["module_mail"])) { $mail = true; } else { $mail = false; } $numTroubles = $object->getNumTroubles($this->args[0]); $advInfo = $ai->getAdvancedInfo($this->args[0]); $numAdvInfo = $ai->getNumAdvancedInfo($this->args[0]); $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("Правка объекта"); $object = new Model_Object(); if (isset($_POST["submit"])) { $object->editObject($_POST); $this->view->refresh(array("timer" => "1", "url" => "objects/edit/" . $_POST["tid"] . "/")); } else { if (isset($this->args[1])) { $data = $object->getObject($this->args[1]); $contact =& $_SESSION["contact"]; if (isset($contact["email"]) and $contact["email"] != null) { $email = $contact["email"]; } else { $email = null; } $this->view->objects_edit(array("vals" => $data, "email" => $email)); } } $this->view->showPage(); }
function index() { $this->view->setTitle("Просмотр броней"); $reserv = new Model_Reserv(); $object = new Model_Object(); $reserv->setUid($this->registry["ui"]["id"]); $list = $reserv->getList(); $i = 0; $res_list = array(); foreach ($list as $part) { $i++; $res_list[$i] = $part; $res_list[$i]["object"] = $object->getShortObject($part["oid"]); $res_list[$i]["fstart"] = date("H:i, d F Y", strtotime($part["start"])); if ($part["end"] == "0000-00-00 00:00:00") { $res_list[$i]["fend"] = "-:- -- -- --"; } else { $res_list[$i]["fend"] = date("H:i, d F Y", strtotime($part["end"])); } } $this->view->reservs(array("list" => $res_list)); $this->view->showPage(); }
public function index() { $this->view->setTitle("Форма для выбранного объектаы"); $ai = $this->registry["module_kb"]; $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"]); $afinfo = json_decode($afinfo["val"], true); $this->view->objects_setformedit(array("oaid" => $_GET["oaid"], "afinfo" => $afinfo)); } } } 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"], $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_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)); } } } }
public function move_objs($params) { $objs = json_decode($params["json"], true); $sub = $params["sub"]; $templates = new Model_Template($this->registry); $objects = new Model_Object($this->registry); if (count($objs) > 0) { foreach ($objs as $key => $val) { $oid = mb_substr($key, 4, mb_strlen($key) - 5); $objects->moveObj($oid, $sub); } } }
function formfulltask($param) { if (isset($param[0])) { $data = $param[0]; $issRusers = array(); $k = 0; foreach ($data as $part) { if (isset($part["ruser"])) { foreach ($part["ruser"] as $uid) { if ($uid != "0") { $row = $this->registry["user"]->getUserInfo($uid); $k++; $issRusers[$k]["desc"] = '<p><span style="font-size: 11px; margin-right: 10px;" id="udesc[' . $uid . ']">' . $row["name"] . ' ' . $row["soname"] . '</span>'; $issRusers[$k]["desc"] .= '<input id="uhid[' . $uid . ']" type="hidden" name="ruser[]" value="' . $uid . '" /></p>'; } } } if (isset($part["gruser"])) { foreach ($part["gruser"] as $gid) { if ($gid != "0") { $gname = $this->registry["user"]->getSubgroupName($gid); $k++; $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">' . $gname . '<input type="hidden" name="gruser[]" value="' . $gid . '" /></p>'; } } } if ($part["rall"] == "1") { $k++; $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">Все<input type="hidden" name="rall" value="1" /></p>'; } } $obj = array(); if ($data[0]["selObjHid"] != "") { $object = new Model_Object(); $obj = $object->getShortObject($data[0]["selObjHid"]); } return $this->view->render("tt_form_fulltask", array("data" => $data, "issRusers" => $issRusers, "obj" => $obj)); } }
private function getOidFromUniqId($tid, $uniqId) { $objects = new Model_Object(); return $objects->getOidFromUniqId($tid, $uniqId); }
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)); $groups = new Model_TTGroups(); if (isset($_GET["clear"])) { unset($_SESSION["groups"]); } $groupsSess =& $_SESSION["groups"]; if (isset($_POST["submit"])) { $_POST["sday"] = htmlspecialchars($_POST["sday"]); $_POST["smonth"] = htmlspecialchars($_POST["smonth"]); $_POST["syear"] = htmlspecialchars($_POST["syear"]); $_POST["fday"] = htmlspecialchars($_POST["fday"]); $_POST["fmonth"] = htmlspecialchars($_POST["fmonth"]); $_POST["fyear"] = htmlspecialchars($_POST["fyear"]); $groupsSess = $_POST; } else { if (!isset($groupsSess)) { $groupsSess = array(); } } if (!isset($groupsSess["sday"])) { $groupsSess["sday"] = "01"; } if (!isset($groupsSess["smonth"])) { $groupsSess["smonth"] = "01"; } if (!isset($groupsSess["syear"])) { $groupsSess["syear"] = "2010"; } if (!isset($groupsSess["fday"])) { $groupsSess["fday"] = date("d"); } if (!isset($groupsSess["fmonth"])) { $groupsSess["fmonth"] = date("m"); } if (!isset($groupsSess["fyear"])) { $groupsSess["fyear"] = date("Y"); } $this->view->groups_date(array("date" => $groupsSess)); if ($this->args[0] == "groups" or !isset($this->args[0])) { if (isset($this->args[1])) { $groups->links = "tt/groups/" . $this->args[1] . "/"; } if (isset($_GET["page"])) { if (is_numeric($_GET["page"])) { if (!$groups->setPage($_GET["page"])) { $this->__call("groups", "groups"); } } } if (isset($this->args[1])) { $data = $groups->getGroupsStatFromGroups($groupsSess, $this->args[1]); if (!isset($this->args[2]) or $this->args[2] == "page") { foreach ($data as $part) { if ($data = $this->registry["tt"]->getTask($part["id"])) { if ($data[0]["remote_id"] == 0) { $author = $this->registry["user"]->getUserInfo($data[0]["who"]); } else { $author = $this->registry["tt_user"]->getRemoteUserInfo($data[0]["who"]); } //$author = $this->registry["user"]->getUserInfo($data[0]["who"]); $ruser = array(); foreach ($data as $val) { if (isset($val["uid"])) { if ($val["uid"] != 0) { $user = $this->registry["user"]->getUserInfo($val["uid"]); $ruser[] = "<a style='cursor: pointer' onclick='getUserInfo(" . $val["uid"] . ")'>" . $user["name"] . " " . $user["soname"] . "</a>"; } } if (isset($val["rgid"])) { if ($val["rgid"] != 0) { $ruser[] = "<span style='color: #5D7FA6'><b>" . $this->registry["user"]->getSubgroupName($val["rgid"]) . "</b></span>"; } } if ($val["all"] == 1) { $ruser[] = "<span style='color: #D9A444'><b>Все</b></span>"; } } $object = new Model_Object(); $cuser = $this->registry["user"]->getUserInfo($data[0]["cuid"]); $notObj = true; if (!($obj = $object->getShortObject($data[0]["oid"]))) { $notObj = false; } $this->view->tt_taskshort(array("data" => $data, "author" => $author, "ruser" => $ruser, "cuser" => $cuser, "notObj" => $notObj, "obj" => $obj)); unset($ruser); } } //Отобразим пейджер if (count($groups->pager) != 0) { $this->view->pager(array("pages" => $groups->pager)); } } } else { $data = $groups->getGroupsStat($groupsSess); $this->view->groups_groups(array("data" => $data)); } } $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("Поиск"); $this->view->setLeftContent($this->view->render("left_find", array("num" => $this->numFind))); $find = new Model_Find(); $object = new Model_Object(); 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 (!$find->setPage($_GET["page"])) { $this->__call("find", "tasks"); } } } $find->links = "find/" . $this->args[0] . "/"; $text = substr($this->findSess["string"], 0, 64); $text = explode(" ", $text); $findArr = $find->findTroubles($text); if (!isset($this->args[1]) or $this->args[1] == "page") { foreach ($findArr as $part) { if ($data = $this->registry["tt"]->getTask($part["id"])) { $numComments = $this->registry["tt"]->getNumComments($part["id"]); $newComments = $this->registry["tt"]->getNewCommentsFromTid($part["id"]); if ($data[0]["remote_id"] == 0) { $author = $this->registry["user"]->getUserInfo($data[0]["who"]); } else { $author = $this->registry["tt_user"]->getRemoteUserInfo($data[0]["who"]); } $ruser = array(); foreach ($data as $val) { if (isset($val["uid"])) { if ($val["uid"] != 0) { $user = $this->registry["user"]->getUserInfo($val["uid"]); $ruser[] = "<a style='cursor: pointer' onclick='getUserInfo(" . $val["uid"] . ")'>" . $user["name"] . " " . $user["soname"] . "</a>"; } } if (isset($val["rgid"])) { if ($val["rgid"] != 0) { $ruser[] = "<span style='color: #5D7FA6'><b>" . $this->registry["user"]->getSubgroupName($val["rgid"]) . "</b></span>"; } } if ($val["all"] == 1) { $ruser[] = "<span style='color: #D9A444'><b>Все</b></span>"; } } $cuser = $this->registry["user"]->getUserInfo($data[0]["cuid"]); $notObj = true; if (!($obj = $object->getShortObject($data[0]["oid"]))) { $notObj = false; } $content = $this->registry["module_tt"]->renderTask($data, $author, $ruser, $cuser, $notObj, $obj, $numComments, $newComments); $this->view->setMainContent($content); } } //Отобразим пейджер if (count($find->pager) != 0) { $this->view->pager(array("pages" => $find->pager)); } } } }
public function repairObjs($params) { $json = json_decode(stripslashes($params["json"]), true); $object = new Model_Object(); $data = array(); foreach ($json as $key => $val) { $object->repairObject($key); } }
public function getReserv($params) { $id = $params["id"]; $reserv = new Model_Reserv(); $obj = new Model_Object(); $data = $reserv->getReserv($id); $data["object"] = "<a style='cursor: pointer;' onclick='getInfo(" . $data["oid"] . ")'>"; $temp = $obj->getShortObject($data["oid"]); foreach ($temp as $part) { $data["object"] .= $part["val"] . " "; } $data["object"] .= "</a>"; $data["reservstart"] = date("d.m.Y", strtotime($data["start"])); $data["reservstarttime"] = date("H:i", strtotime($data["start"])); if ($data["end"] != "0000-00-00 00:00:00") { $data["enddate"] = 1; $data["reservend"] = date("d.m.Y", strtotime($data["end"])); $data["reservendtime"] = date("H:i", strtotime($data["end"])); } else { $data["enddate"] = 0; } echo json_encode($data); }
public function findObj($params) { $tfind = $params["find"]; $find = new Model_Find(); $object = new Model_Object(); $findSess =& $_SESSION["find"]; if (isset($tfind)) { $findSess["string"] = $tfind; } else { if (!isset($findSess["string"])) { $findSess["string"] = ""; } } if (isset($findSess["string"])) { $text = substr($findSess["string"], 0, 64); $text = explode(" ", $text); $tfind = $find->findObjects($text); if (count($tfind) == 0) { echo "<p style='color: #777; margin-left: 20px'>Ничего не найдено</p>"; } foreach ($tfind as $part) { echo '<div style="margin-bottom: 20px">'; $obj = $object->getShortObject($part["id"]); foreach ($obj as $val) { echo "<p><b>" . $val["field"] . ":</b> " . $val["val"] . "</p>"; $row[$val["field"]] = $val["val"]; } $row["id"] = $val["id"]; $data = json_encode($row); echo "<p><img src='" . $this->registry['uri'] . "img/enter.png' alt='' style='vertical-align: middle; margin-right: 5px'><a style='cursor: pointer' onclick='selObj(" . $data . ")'>выбрать</a></p>"; echo '</div>'; } } }
public function index() { $this->view->setTitle("Задачи"); $object = new Model_Object(); $cal =& $_SESSION["cal"]; if (isset($_GET["page"])) { if (is_numeric($_GET["page"])) { if (!$this->registry["tt"]->setPage($_GET["page"])) { $this->__call("tt", "index"); } } } if (isset($this->args[0])) { if ($this->args[0] == "task") { if (isset($this->args[1])) { $this->registry["tt"]->links = "tt/" . $this->args[0] . "/" . $this->args[1] . "/"; } else { $this->registry["tt"]->links = "tt/" . $this->args[0] . "/"; } if (isset($this->args[1])) { if ($this->args[1] == "iter") { $tasks = $this->registry["tt"]->getIterTasks(); $this->view->tt_caltype(array("caltype" => $cal["type"], "date" => $this->model->editDate(date("Y-m-d")))); } elseif ($this->args[1] == "time") { $tasks = $this->registry["tt"]->getTimeTasks(); $this->view->tt_caltype(array("caltype" => $cal["type"], "date" => $this->model->editDate(date("Y-m-d")))); } elseif ($this->args[1] == "noiter") { $tasks = $this->registry["tt"]->getNoiterTasks(); $this->view->tt_caltype(array("caltype" => $cal["type"], "date" => $this->model->editDate(date("Y-m-d")))); } elseif ($this->args[1] == "me") { $sortmytt =& $_SESSION["sortmytt"]; if (!isset($sortmytt["sort"]) or !isset($sortmytt["id"])) { $sortmytt["sort"] = "date"; $sortmytt["id"] = "false"; } $sort_groups = $this->registry["tt"]->getSortGroupsMe(); $this->view->setLeftContent($this->view->render("left_sortmytt", array("sort" => $sortmytt, "sg" => $sort_groups))); $tasks = $this->registry["tt"]->getMeTasks(); } } else { $this->__call("tt", "index"); } } elseif ($this->args[0] == "date") { $this->registry["tt"]->links = "tt/" . $this->args[0] . "/" . $this->args[1] . "/"; $this->view->tt_caltype(array("caltype" => $cal["type"], "date" => $this->model->editDate(date("Y-m-d", strtotime($this->args[1]))))); $tasks = $this->registry["tt"]->getTasksDate($this->registry["ui"]["id"], $this->args[1]); } elseif ($this->args[0] == "oid") { $this->registry["tt"]->links = "tt/" . $this->args[0] . "/" . $this->args[1] . "/"; $tasks = $this->registry["tt"]->getOidTasks($this->args[1]); } } else { $sortmytt =& $_SESSION["sortmytt"]; if (!isset($sortmytt["sort"]) or !isset($sortmytt["id"])) { $sortmytt["sort"] = "date"; $sortmytt["id"] = "false"; } $sort_groups = $this->registry["tt"]->getSortGroups(); $this->view->setLeftContent($this->view->render("left_sortmytt", array("sort" => $sortmytt, "sg" => $sort_groups))); $this->registry["tt"]->links = "tt/"; $tasks = $this->registry["tt"]->getTasks(); } if (count($tasks) == 0) { $this->view->setMainContent("<p style='margin: 10px'>Задачи не найдены</p>"); } foreach ($tasks as $part) { if ($data = $this->registry["tt"]->getTask($part["id"])) { $numComments = $this->registry["tt"]->getNumComments($part["id"]); $newComments = $this->registry["tt"]->getNewCommentsFromTid($part["id"]); 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"]); } $ruser = array(); foreach ($data as $val) { if (isset($val["uid"])) { if ($val["uid"] != 0) { if (isset($this->registry["module_users"])) { $user = $this->registry["user"]->getUserInfo($val["uid"]); } else { $ui = new Model_Ui(); $user = $ui->getInfo($val["uid"]); } $ruser[] = "<a style='cursor: pointer' onclick='getUserInfo(" . $val["uid"] . ")'>" . $user["name"] . " " . $user["soname"] . "</a>"; } } if (isset($val["rgid"])) { if ($val["rgid"] != 0) { $ruser[] = "<span style='color: #5D7FA6'><b>" . $this->registry["user"]->getSubgroupName($val["rgid"]) . "</b></span>"; } } if ($val["all"] == 1) { $ruser[] = "<span style='color: #D9A444'><b>Все</b></span>"; } } $cuser = $this->registry["user"]->getUserInfo($data[0]["cuid"]); $notObj = true; if (!($obj = $object->getShortObject($data[0]["oid"]))) { $notObj = false; } $this->view->tt_task(array("data" => $data, "author" => $author, "ruser" => $ruser, "cuser" => $cuser, "notObj" => $notObj, "obj" => $obj, "numComments" => $numComments, "newComments" => $newComments)); unset($ruser); } else { $this->view->setMainContent("<p style='margin: 10px0'>Задача не найдена</p>"); } } //Отобразим пейджер if (count($this->registry["tt"]->pager) != 0) { $this->view->pager(array("pages" => $this->registry["tt"]->pager)); } $this->view->showPage(); }
function index() { if (isset($this->registry["get"]["sub"])) { $this->view->setTitle("Создать задачу (подзадача к №" . $this->registry["get"]["sub"] . ")"); } else { $this->view->setTitle("Создать задачу"); } $this->view->setLeftContent($this->view->render("left_tt", array())); $this->view->setLeftContent($this->view->render("left_attach", array())); //Сохранение в черновики if (isset($_POST["draft"])) { $_POST["task"] = $_POST["textfield"]; if (isset($_GET["oid"]) and $_GET["oid"] != "") { $oid = $_GET["oid"]; } elseif (isset($_POST["selObjHid"])) { $oid = $_POST["selObjHid"]; } else { $oid = 0; } $this->registry["tt"]->addDraft($oid, $_POST); $this->view->refresh(array("timer" => "1", "url" => "tt/draft/")); // submit создания задачи } elseif (isset($_POST["submit"])) { if (isset($_GET["oid"]) and $_GET["oid"] != "") { $oid = $_GET["oid"]; } elseif (isset($_POST["selObjHid"])) { $oid = $_POST["selObjHid"]; } else { $oid = 0; } $_POST["task"] = $_POST["textfield"]; unset($_POST["textfield"]); if ($tid = $this->registry["tt"]->addTask($oid, $_POST)) { $this->registry["tt"]->spamUsers("Новая задача", $tid); $this->view->refresh(array("timer" => "1", "url" => "tt/show/" . $tid . "/")); } else { $this->view->setMainContent("<p style='margin: 30px 0 0 50px; color: red'>Заполните текст задачи!</span>"); $this->view->refresh(array("timer" => "1", "url" => "tt/add/?oid=" . $oid . "&date=" . $_GET["date"])); } // submit создания задачи с владки "пользователи" } elseif (isset($_GET["addUsersTask"])) { $rusers = $this->registry["user"]->getUsers(); $issRusers = array(); $k = 0; foreach ($_GET as $key => $part) { if ($key == "ruser") { foreach ($part as $val) { $row = $this->registry["user"]->getUserInfo($val); $k++; $issRusers[$k]["desc"] = '<p><span style="font-size: 11px; margin-right: 10px;" id="udesc[' . $row["uid"] . ']">' . $row["name"] . ' ' . $row["soname"] . '</span>'; $issRusers[$k]["desc"] .= '<input id="uhid[' . $row["uid"] . ']" type="hidden" name="ruser[]" value="' . $row["uid"] . '" /></p>'; } } if ($key == "gruser") { foreach ($part as $val) { $gname = $this->registry["user"]->getSubgroupName($val); $k++; $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">' . $gname . '<input type="hidden" name="gruser[]" value="' . $val . '" /></p>'; } } if ($key == "rall") { $k++; $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">Все<input type="hidden" name="rall" value="1" /></p>'; } } $this->view->tt_add(array("oid" => "", "obj" => "", "now_date" => date("Y-m-d"), "now_time" => date("H:i:s"), "issRusers" => $issRusers)); } else { $rusers = $this->registry["user"]->getUsers(); $object = new Model_Object(); if (isset($_GET["oid"])) { $oid = $_GET["oid"]; $obj = $object->getShortObject($_GET["oid"]); } else { $oid = ""; $obj = ""; } if (isset($_GET["date"])) { $data[0]["startdate"] = date("Y", strtotime($_GET["date"])) . "-" . date("m", strtotime($_GET["date"])) . "-" . date("d", strtotime($_GET["date"])); $data[0]["starttime"] = "00:00:00"; } else { $data[0]["startdate"] = date("Y-m-d"); $data[0]["starttime"] = date("H:i:s"); } $data[0]["deadline"] = 1; $group = null; if (isset($_GET["group"])) { $group = $_GET["group"]; } $this->view->tt_add(array("oid" => $oid, "rusers" => $rusers, "obj" => $obj, "data" => $data, "group" => $group)); } $this->view->showPage(); }
public function getSortGroupsMe() { $result = array(); $object = new Model_Object(); $sql = "SELECT g.id AS gid, g.name AS `gname`, t.oid, t.imp, td.type\r\n FROM troubles AS t\r\n LEFT JOIN troubles_responsible AS tr ON (tr.tid = t.id)\r\n LEFT JOIN troubles_deadline AS td ON (td.tid = t.id)\r\n LEFT JOIN group_tt AS g ON (g.id = t.gid)\r\n WHERE ( ( (t.secure = 0) AND (t.who = :uid OR tr.uid = :uid OR tr.all = 1 OR tr.gid = :gid) ) OR ( (t.secure = 1) AND (t.who = :uid OR tr.uid = :uid OR tr.all = 1 OR tr.gid = :gid) ) )\r\n AND t.close = 0\r\n AND td.opening <= NOW()\r\n\t\tORDER BY t.imp"; $res = $this->registry['db']->prepare($sql); $param = array(":uid" => $this->registry["ui"]["id"], ":gid" => $this->registry["ui"]["group"]); $res->execute($param); $data = $res->fetchAll(PDO::FETCH_ASSOC); foreach ($data as $part) { $result["gname"][$part["gid"]] = $part["gname"]; $result["oid"][$part["oid"]] = $part["oid"]; $result["imp"][$part["imp"]] = $part["imp"]; $result["type"][$part["type"]] = $part["type"]; } if (count($result) != 0) { $result["gname"] = array_unique($result["gname"]); $temp = array_unique($result["oid"]); foreach ($temp as $key => $part) { $result["obj"][$key] = $object->getShortObject($part); } $result["imp"] = array_unique($result["imp"]); $result["type"] = array_unique($result["type"]); } return $result; }
function writeMail($params) { $json = json_decode($params["json"]); $object = new Model_Object(); $data = array(); foreach ($json as $key => $val) { $email = null; $oid = mb_substr($key, 4, mb_strlen($key) - 5); $email = $object->getEmailFromOid($oid); if ($email != null) { $data[] = $email; } } $mail =& $_SESSION["mail"]; $mail["json"] = json_encode($data); }
function getOidFromUniqId($param) { $object = new Model_Object(); return $object->getOidFromUniqId($param[0], $param[1]); }
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(); }