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; }
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; }
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; }