Пример #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();
     for ($i = 1; $i < 4; $i++) {
         $voteTR = "";
         $orderBy = new orderBy("?chid=" . $this->chid . "&", array("id" => "№", "time" => "Дата", "name" => "Заголовок", "company" => "Компания", "gsum" => "Средний бал", "gcount" => "Проголосовало"), array("gsum" => "desc"), $this->field[$i], $this->order[$i], array("field[{$i}]", "order[{$i}]"));
         $pagination = new pagination($orderBy->urlForPage(), $this->page, $adminConfig["recPerPage"], '', "projects", "id");
         $res = $db->query("select projects.id, name, company, category_name, date, sum(IF(grade is null,0, grade))/count(IF(grade is null,0, grade)) as gsum, count(grade) as gcount FROM (projects LEFT JOIN categories ON projects.category = categories.category_id) left join votes on projects.id=votes.id where category={$i} group by projects.id, name, company, category_name, date " . $orderBy->orderByQuery() . " " . $pagination->limit());
         $page = $this->page ? "&page=" . $this->page : "";
         while ($data = $db->fetch_array($res)) {
             $data["date"] = date("d.m.Y", $data["date"]);
             eval('$voteTR.="' . admin::template("voteTR") . '";');
         }
         $pageBar = $pagination->bar();
         $th = $orderBy->bar();
         eval('$content.="' . admin::template("voteMain") . '";');
         $content .= "<br>";
     }
     $this->elements["content"] = $content;
 }
Пример #2
0
 function librarySelectI()
 {
     if (!$this->page) {
         $this->page = 1;
     }
     $db = new sql();
     $db->connect();
     include "lib/orderby.class.php";
     $orderBy = new orderBy("?chid=" . $this->chid . "&", array("library" => "№", "time" => "Дата", "name" => "Заголовок", "short_text" => "Подзаголовок", "author" => "Автор"), array("library" => "desc"), $this->field, $this->order);
     $adminConfig = admin::adminConfig();
     //echo "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()." limit ".(($this->page-1)*$adminConfig["recPerPage"]).", ".$adminConfig["recPerPage"];
     $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() . " limit " . ($this->page - 1) * $adminConfig["recPerPage"] . ", " . $adminConfig["recPerPage"]);
     while ($data = $db->fetch_array($res)) {
         $i++;
         $data["date"] = date("d.m.Y", $data["time"]);
         $data["name"] = admin::null2nbsp($data["name"]);
         $data["short_text"] = admin::null2nbsp($data["short_text"]);
         $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");
         while ($data1 = $db->fetch_array($res1)) {
             $data["fio"] .= "<li>" . $data1["lastname"] . ($data1["firstname"] ? " " . $data1["firstname"] : "") . ($data1["secondname"] ? " " . $data1["secondname"] : "") . "</li>";
         }
         $data["fio"] = admin::null2nbsp($data["fio"]);
         $checked = $data["library"] == $this->id || !$this->id && $i == 1 ? " checked" : "";
         eval("\$librarySelectITR.=\"" . admin::template("librarySelectITR") . "\";");
     }
     eval("\$content=\"" . admin::template("librarySelectI") . "\";");
     $this->elements["content"] = $content;
 }
Пример #3
0
 function show_AllUsers()
 {
     $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 . "&action=show_AllUsers&", array("id" => "№", "name" => "Имя", "email" => "E-mail"), array("name" => ""), $this->field, $this->order);
     $pagination = new pagination($orderBy->urlForPage(), $this->page, $adminConfig["recPerPage"], '', "subs_users", "id");
     $res = $db->query("select * from subs_users" . $orderBy->orderByQuery() . " " . $pagination->limit());
     if ($this->field) {
         $page = "&field={$this->field}";
     }
     if ($this->order) {
         $page .= "&order={$this->order}";
     }
     if ($this->page) {
         $page .= "&page={$this->page}";
     }
     while ($data = $db->fetch_array($res)) {
         $i++;
         eval('$subscribeAllUsersTR.="' . admin::template("subscribeAllUsersTR") . '";');
     }
     $th = $orderBy->bar();
     $pageBar = $pagination->bar();
     eval('$content="' . admin::template("subscribeAllUsersMain") . '";');
     $this->elements["content"] = $content;
 }