Ejemplo n.º 1
0
 function defaultAction()
 {
     $db = new sql();
     $db->connect();
     $chid = $this->chid;
     include "lib/pagination.class.php";
     include "lib/orderby.class.php";
     $adminConfig = admin::adminConfig();
     $orderBy = new orderBy("?chid=" . $this->chid . "&", array("library" => "№", "time" => "Дата", "name" => "Заголовок", "short_text" => "Подзаголовок", "author" => "Автор"), array("library" => "desc"), $this->field, $this->order);
     $pagination = new pagination($orderBy->urlForPage(), $this->page, $adminConfig["recPerPage"], '', "library", "id");
     $res = $db->query("select library.id as library, name, short_text, time, authors.lastname as author FROM (library LEFT JOIN library_authors ON library.id = library_authors.library) LEFT JOIN authors ON library_authors.author = authors.id GROUP BY library.id" . $orderBy->orderByQuery() . " " . $pagination->limit());
     $page = $this->page ? "&page=" . $this->page : "";
     while ($data = $db->fetch_array($res)) {
         $res1 = $db->query("select id, firstname, secondname, lastname from library_authors left join authors on library_authors.author = authors.id where library_authors.library=" . $data["library"] . " order by lastname, firstname, secondname");
         $typeAuthorsID = admin::getTypeID("authors");
         while ($data1 = $db->fetch_array($res1)) {
             $data["fio"] .= "<li><a href=\"?chid={$typeAuthorsID}&action=edit&id={$data1['id']}\">" . $data1["lastname"] . ($data1["firstname"] ? " " . $data1["firstname"] : "") . ($data1["secondname"] ? " " . $data1["secondname"] : "") . "</a></li>";
         }
         $data["date"] = $data["time"] ? @date("d.m.Y", $data["time"]) : "";
         $data["fio"] = $data["fio"] ? "<ul>" . $data["fio"] . "</ul>" : "";
         eval('$libraryTR.="' . admin::template("libraryTR") . '";');
     }
     $pageBar = $pagination->bar();
     $th = $orderBy->bar();
     eval('$content="' . admin::template("libraryMain") . '";');
     $this->elements["content"] = $content;
 }
Ejemplo n.º 2
0
 function wrongAdd()
 {
     session_start();
     if ($_SESSION["fields"]) {
         foreach ($_SESSION["wrongFields"] as $key => $value) {
             $message .= "<p class=\"error\">" . $value . "</p>";
         }
         $data = $_SESSION["fields"];
         $select = admin::getDateSelectOptions($data["time"]);
         $chid = $this->chid;
         $action = "appendAdd";
         $db = new sql();
         $db->connect();
         $res = $db->query("select * from types order by id");
         while ($data1 = $db->fetch_array($res)) {
             $i++;
             $types .= "<option" . ($data["type"] == $data1["id"] ? " selected" : "") . " value=\"{$data1['id']}\">{$data1['title']}</option>";
         }
         $ts[$data["type"]] = " selected";
         $true = $data["type"] == 4 ? " && true" : " && false";
         $data = $_SESSION["fields"];
         $header = "Добавление";
         $lid = $this->lid;
         $library["chid"] = admin::getTypeID("library");
         eval("\$content=\"" . admin::template("itemAdd", "FORMPOST", array("fields[title]" => "EXISTS", "fields[url]" => "EXISTS")) . "\";");
         $this->elements["content"] = $content;
     }
 }