Beispiel #1
0
 public function index()
 {
     $this->view->setTitle("Поиск");
     $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"]);
                 $this->view->find_objectMain(array("ui" => $this->registry["ui"], "obj" => $obj, "advInfo" => $advInfo, "numAdvInfo" => $numAdvInfo, "numTroubles" => $numTroubles));
             }
             //Отобразим пейджер
             if (count($find->pager) != 0) {
                 $this->view->pager(array("pages" => $find->pager));
             }
         }
     }
 }
Beispiel #2
0
 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) {
             $obj = $object->getShortObject($part["id"]);
             foreach ($obj as $val) {
                 $row[$val["field"]] = $val["val"];
             }
             $id = $obj[0]["id"];
             echo $this->view->render("tt_setObj", array("data" => $row, "id" => $id));
         }
     }
 }
Beispiel #3
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();
     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));
             }
         }
     }
 }
Beispiel #4
0
 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>';
         }
     }
 }