private function show_user_overview() { if (($user_count = $this->model->count_users()) === false) { $this->output->add_tag("result", "Database error."); return; } handle_table_sort("adminuser_order", array("id", "username", "fullname", "email", "status"), array("username", "id")); $paging = new pagination($this->output, "admin_users", $this->settings->admin_page_size, $user_count); $users = $this->model->get_users($_SESSION["adminuser_order"], $paging->offset, $paging->size); $roles = $this->model->get_roles(); if ($users === false || $roles === false) { $this->output->add_tag("result", "Database error."); return; } $status = array("Disabled", "Change password", "Active"); $this->output->open_tag("overview"); $this->output->open_tag("users"); foreach ($users as $user) { $user["status"] = $status[$user["status"]]; $this->output->open_tag("user", array("id" => $user["id"], "admin" => show_boolean($user["is_admin"]))); $this->output->add_tag("username", $user["username"]); $this->output->add_tag("fullname", $user["fullname"]); $this->output->add_tag("email", $user["email"]); $this->output->add_tag("status", $user["status"]); $this->output->close_tag(); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->close_tag(); }
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 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; }
private function show_forum($forum_id) { if (($count = $this->model->count_topics($forum_id)) === false) { $this->output->add_tag("result", "Database error while counting topics."); return; } $paging = new pagination($this->output, "forum_" . $forum_id, $this->settings->forum_page_size, $count); if (($forum = $this->model->get_forum($forum_id, $paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Forum not found.", $this->url); return; } $this->output->title = $forum["title"] . " - Forum"; $this->output->open_tag("forum", array("id" => $forum["id"])); $this->output->add_tag("title", $forum["title"]); $this->output->open_tag("topics"); foreach ($forum["topics"] as $topic) { if ($this->user->logged_in) { $topic["unread"] = show_boolean($this->model->last_topic_view($topic["id"]) < $topic["timestamp"]); } $topic["starter"] = isset($topic["visitor"]) ? $topic["visitor"] : $topic["user"]; $topic["timestamp"] = date("j F Y, H:i", $topic["timestamp"]); $this->output->record($topic, "topic"); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->close_tag(); }
public function execute() { if ($_SERVER["REQUEST_METHOD"] == "POST") { /* Delete message */ if ($this->model->delete_message($_POST["id"])) { $this->user->log_action("guestbook entry %d deleted", $_POST["id"]); } } handle_table_sort("adminguestbook_order", array("author", "message", "timestamp", "ip_address"), array("timestamp", "author")); $paging = new pagination($this->output, "admin_guestbook", $this->settings->admin_page_size, $message_count); if (($guestbook = $this->model->get_messages($_SESSION["adminguestbook_order"], $paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("guestbook"); foreach ($guestbook as $item) { $item["message"] = truncate_text($item["message"], 45); if ($this->output->mobile) { $item["timestamp"] = date("Y-m-d", $item["timestamp"]); } else { $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]); } $this->output->record($item, "item"); } $paging->show_browse_links(); $this->output->close_tag(); }
private function show_album($album_id) { if (($album = $this->model->get_album_info($album_id)) == false) { $this->output->add_tag("result", "Database error retrieving album title."); return; } if (($count = $this->model->count_photos_in_album($album_id)) === false) { $this->output->add_tag("result", "Database error counting albums"); return; } $paging = new pagination($this->output, "photo_album_" . $album_id, $this->settings->photo_album_size, $count); if (($photos = $this->model->get_photo_info($album_id, $paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error retrieving photos."); return; } else { if (count($photos) == 0) { $this->output->add_tag("result", "Photo album is empty."); return; } } $this->title = $album["name"]; $this->output->open_tag("photos", array("info" => $album["description"])); foreach ($photos as $photo) { $this->output->record($photo, "photo"); } $paging->show_browse_links(); $this->output->close_tag(); $this->output->add_javascript("banshee/jquery.prettyphoto.js"); $this->output->add_javascript("photo.js"); $this->output->add_css("banshee/prettyphoto.css"); }
private function show_message_overview() { if (($message_count = $this->model->count_messages()) === false) { $this->output->add_tag("result", "Database error."); return false; } $paging = new pagination($this->output, "admin_forum", $this->settings->admin_page_size, $message_count); if (($messages = $this->model->get_messages($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("overview"); $this->output->open_tag("messages"); foreach ($messages as $message) { $message["content"] = truncate_text($message["content"], 400); $message["timestamp"] = date("j F Y, H:i", $message["timestamp"]); if ($message["author"] == "") { $message["author"] = $message["username"]; } $this->output->record($message, "message"); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->close_tag(); }
public function actionIndex($type = '') { $file = zotop::model('zotop.file'); if (!empty($type)) { $where = array('type', '=', $type); } $files = $file->db()->where($where)->orderby('createtime', 'desc')->getPage(); $pagination = new pagination(); $pagination->page = $files['page']; $pagination->pagesize = $files['pagesize']; $pagination->total = $files['total']; $p = $pagination->render(); $totalsize = $file->totalsize(); $totalcount = $file->count(); $page = new page(); $page->set('title', zotop::t('文件管理')); $page->set('navbar', $this->navbar()); $page->set('page', $files['page']); $page->set('pagesize', $files['pagesize']); $page->set('total', $files['total']); $page->set('files', $files['data']); $page->set('totalsize', $totalsize); $page->set('totalcount', $totalcount); $page->set('pagination', $p); $page->display(); }
public function execute() { if (isset($_SERVER["hide_ss"]) == false) { $_SERVER["hide_ss"] = true; } if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["submit_button"] == "hidess") { $_SERVER["hide_ss"] = is_true($_POST["hide_ss"]); } $this->output->add_css("banshee/filter.css"); $filter = new filter($this->db, $this->output, $this->user); $filter->to_output($this->model->table, false); if (($count = $this->model->count_events($filter->webserver, $_SERVER["hide_ss"])) === false) { $this->output->add_tag("result", "Database error."); return; } $paging = new pagination($this->output, "events", $this->settings->event_page_size, $count); if ($_SERVER["REQUEST_METHOD"] == "POST") { $paging->reset(); } if (($events = $this->model->get_events($paging->offset, $paging->size, $filter->webserver, $_SERVER["hide_ss"])) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("events", array("hide_ss" => show_boolean($_SERVER["hide_ss"]))); foreach ($events as $event) { $event["timestamp"] = date("j F Y, H:i:s", $event["timestamp"]); $event["event"] = $this->output->secure_string($event["event"], "_"); $this->output->record($event, "event"); } $paging->show_browse_links(); $this->output->close_tag(); }
public function actionIndex($categoryid = 0, $status = null) { $where = array(); if (!empty($categoryid)) { $where[] = 'AND'; $where[] = array('categoryid', '=', $categoryid); } if (isset($status)) { $where[] = 'AND'; $where[] = array('status', '=', $status); } $where = array_slice($where, 1); $blog = zotop::model('blog.blog'); $blogs = $blog->db()->where($where)->orderby('order', 'desc')->orderby('updatetime', 'desc')->getPage(); $blogstatus = $blog->status(); $category = zotop::model('blog.category'); $categorys = $category->getAll(); $categorys = arr::hashmap($categorys, 'id'); $pagination = new pagination(); $pagination->page = $blogs['page']; $pagination->pagesize = $blogs['pagesize']; $pagination->total = $blogs['total']; $p = $pagination->render(); $page = new page(); $page->set('title', '日志管理'); $page->set('navbar', $this->navbar($categoryid)); $page->set('blogs', $blogs); $page->set('status', $status); $page->set('blogstatus', $blogstatus); $page->set('pagination', $p); $page->set('categoryid', $categoryid); $page->set('categorys', $categorys); $page->display(); }
public function actionLibrary($globalid, $field, $image = '') { if (empty($image)) { //zotop::redirect('zotop/image/upload',array('globalid'=>$globalid, 'field'=>$field, 'image'=>url::encode($image))); } $file = zotop::model('zotop.image'); $images = $file->db()->where('type', '=', 'image')->where('globalid', '=', $globalid)->orderby('createtime', 'desc')->getPage(); $pagination = new pagination(); $pagination->page = $images['page']; $pagination->pagesize = $images['pagesize']; $pagination->total = $images['total']; $p = $pagination->render(); $page = new dialog(); $page->set('title', '图片库'); $page->set('globalid', $globalid); $page->set('field', $field); $page->set('navbar', $this->navbar($globalid, $field, $image)); $page->set('image', $image); $page->set('page', $images['page']); $page->set('pagesize', $images['pagesize']); $page->set('total', $images['total']); $page->set('images', $images['data']); $page->set('pagination', $p); $page->display(); }
public function execute() { $this->output->description = "News"; $this->output->keywords = "news"; $this->output->title = "News"; $this->output->add_alternate("News", "application/rss+xml", "/news.xml"); if ($this->page->type == "xml") { /* RSS feed */ $rss = new RSS($this->output); if ($rss->fetch_from_cache("news_rss") == false) { $rss->title = $this->settings->head_title . " news"; $rss->description = $this->settings->head_description; if (($news = $this->model->get_news(0, $this->settings->news_rss_page_size)) != false) { foreach ($news as $item) { $link = "/news/" . $item["id"]; $rss->add_item($item["title"], $item["content"], $link, $item["timestamp"]); } } $rss->to_output(); } } else { if (valid_input($this->page->pathinfo[1], VALIDATE_NUMBERS, VALIDATE_NONEMPTY)) { /* News item */ if (($item = $this->model->get_news_item($this->page->pathinfo[1])) == false) { $this->output->add_tag("result", "Unknown news item"); } else { $this->output->title = $item["title"] . " - News"; $item["timestamp"] = date("j F Y, H:i", strtotime($item["timestamp"])); $this->output->record($item, "news"); } } else { /* News overview */ if (($count = $this->model->count_news()) === false) { $this->output->add_tag("result", "Database error"); return; } $paging = new pagination($this->output, "news", $this->settings->news_page_size, $count); if (($news = $this->model->get_news($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error"); return; } foreach ($news as $item) { $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]); $this->output->record($item, "news"); } $paging->show_browse_links(7, 3); } } }
public static function output($total, $page = 0, $pagesize = 0, $url = '') { if (is_array($total)) { $page = $total['page']; $pagesize = $total['pagesize']; $url = $total['url']; $total = $total['total']; } $pagination = new pagination(); $pagination->total = $total; $pagination->page = $page; $pagination->pagesize = $pagesize; $pagination->url = $url; $p = $pagination->render(); return $p; }
function _make_user_table($n, &$data) { $dbh = getdbh(); //pagination $stmt = $dbh->query('SELECT count(*) "total" FROM "users"'); $rs = $stmt->fetch(PDO::FETCH_ASSOC); $total = $rs['total']; $limit = $GLOBALS['pagination']['per_page']; $data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>'; $data['body'][] = pagination::makePagination($n, $total, myUrl('users/manage'), $GLOBALS['pagination']); //table $stmt = $dbh->query("SELECT * FROM \"users\" LIMIT {$n},{$limit}"); $tablearr[] = explode(',', 'uid,username,password,fullname,created_dt,Action'); while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) { $uid = $rs['uid']; $row = null; foreach ($rs as $k => $v) { $row[$k] = htmlspecialchars($v); } $row[] = '<a href="' . myUrl("users/edit/{$uid}") . '">Edit</a> | <a href="javascript:jsconfirm(\'Really Delete User?\',\'' . myUrl("users/ops_delete/{$uid}") . '\')">Delete</a>'; $tablearr[] = $row; } $data['body'][] = table::makeTable($tablearr); $data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>'; }
function _make_html_table($n, &$data) { $dbh = getdbh(); //pagination $stmt = $dbh->query('SELECT count(OID) total FROM t_user'); $total = $stmt->fetchColumn(); $limit = $GLOBALS['pagination']['per_page']; $data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>'; $data['body'][] = pagination::makePagination($n, $total, myUrl('mgmt_user/manage'), $GLOBALS['pagination']); //table $stmt = $dbh->query("SELECT OID,CID,permissions,username,fullname FROM t_user LIMIT {$n},{$limit}"); $tablearr[] = explode(',', 'username,roll,fullname'); while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) { $OID = $rs['OID']; $CID = $rs['CID']; $row = null; $row['username'] = htmlspecialchars($rs['username']); $row['roll'] = htmlspecialchars(User::getPermissionsAsRollText($rs['permissions'])); $row['fullname'] = htmlspecialchars($rs['fullname']); $row[] = '<a href="' . myUrl("mgmt_user/edit/{$OID}/{$CID}") . '">Edit</a> | <a href="javascript:jsconfirm(\'Really Delete User?\',\'' . myUrl("mgmt_user/ops_delete/{$OID}/{$CID}") . '\')">Delete</a>'; $tablearr[] = $row; } $data['body'][] = table::makeTable($tablearr); $data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>'; }
function _make_html_table($table, $item, $urlPrefix, $n, &$data) { $dbh = getdbh(); //pagination $stmt = $dbh->query("SELECT count(OID) total FROM {$table}"); $total = $stmt->fetchColumn(); $limit = $GLOBALS['pagination']['per_page']; $data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>'; $data['body'][] = pagination::makePagination($n, $total, myUrl("{$urlPrefix}/manage"), $GLOBALS['pagination']); //table $fields = "URL,stationId,lastContact,debug"; $stmt = $dbh->query("SELECT OID,CID,{$fields} FROM {$table} LIMIT {$n},{$limit}"); if ($stmt === false) { var_dump($dbh->errorInfo()); return; } $tablearr[] = explode(',', $fields); while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) { $OID = $rs['OID']; $CID = $rs['CID']; $row = null; foreach ($tablearr[0] as $f) { $row[] = htmlspecialchars($rs[$f]); } $row[] = '<a href="' . myUrl("{$urlPrefix}/ops_reset/{$OID}/{$CID}") . '">Reset</a> | ' . '<a href="' . myUrl("{$urlPrefix}/ops_shutdown/{$OID}/{$CID}") . '">Shutdown</a> | ' . '<a href="' . myUrl("{$urlPrefix}/edit/{$OID}/{$CID}") . '">Edit</a> | ' . '<a href="javascript:jsconfirm(\'Really Delete ' . $item . '?\',\'' . myUrl("{$urlPrefix}/ops_delete/{$OID}/{$CID}") . '\')">Delete</a>'; $tablearr[] = $row; } $data['body'][] = table::makeTable($tablearr); $data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>'; }
public function execute() { $this->output->title = "Pagination demo"; $list = array(); for ($i = 0; $i < 200; $i++) { array_push($list, "List item " . ($i + 1)); } $paging = new pagination($this->output, "demo", 15, count($list)); $items = array_slice($list, $paging->offset, $paging->size); $this->output->open_tag("items"); foreach ($items as $item) { $this->output->add_tag("item", $item); } $this->output->close_tag(); $paging->show_browse_links(); }
function paginate($model, $options = array()) { $m = new Model(); $limit = preg_match("/LIMIT (\\d+) OFFSET (\\d+)/", $model->last_query, $matches); $limit = $matches[1]; $offset = $matches[2]; $page = $offset / $limit + 1; $query = preg_replace("/^SELECT (.*) FROM/", "SELECT COUNT(*) AS count FROM", $model->last_query); $query = preg_replace("/LIMIT (.*)\$/", "", $query); $m->find_by_sql($query); $pagination = new pagination(); $pagination->page = $page; $pagination->target = $options['target']; $pagination->items($m->fields['count']); $pagination->limit($limit); return $pagination->show(); }
function defaultAction() { $db = new sql(); $db->connect(); $chid = $this->chid; include "lib/pagination.class.php"; $adminConfig = admin::adminConfig(); $pagination = new pagination("?chid=" . $this->chid . "&", $this->page, $adminConfig["recPerPage"], '', "news", "id"); $res = $db->query("select id, time, title from news order by id desc " . $pagination->limit()); $page = $this->page ? "&page=" . $this->page : ""; while ($data = $db->fetch_array($res)) { $data["date"] = $data["time"] ? @date("d.m.Y", $data["time"]) : ""; eval('$newsTR.="' . admin::template("newsTR") . '";'); } $pageBar = $pagination->bar(); eval('$content="' . admin::template("newsMain") . '";'); $this->elements["content"] = $content; }
private function show_dictionary_overview() { if (($word_count = $this->model->count_words()) === false) { $this->output->add_tag("result", "Database error."); return; } $paging = new pagination($this->output, "admin_dictionary", $this->settings->admin_page_size, $word_count); if (($words = $this->model->get_words($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("overview"); $this->output->open_tag("words"); foreach ($words as $word) { $this->output->record($word, "word"); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->close_tag(); }
private function show_overview() { if (($XXX_count = $this->model->count_XXXs()) === false) { $this->output->add_tag("result", "Database error."); return; } $paging = new pagination($this->output, "XXXs", $this->settings->admin_page_size, $XXX_count); if (($XXXs = $this->model->get_XXXs($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("overview"); $this->output->open_tag("XXXs"); foreach ($XXXs as $XXX) { $this->output->record($XXX, "XXX"); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->close_tag(); }
private function show_overview() { if (($webserver_count = $this->model->count_webservers()) === false) { $this->output->add_tag("result", "Database error."); return; } $paging = new pagination($this->output, "webservers", $this->settings->admin_page_size, $webserver_count); if (($webservers = $this->model->get_webservers($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("overview"); $this->output->open_tag("webservers"); foreach ($webservers as $webserver) { $webserver["tls"] = show_boolean($webserver["tls"]); $webserver["active"] = show_boolean($webserver["active"]); $this->output->record($webserver, "webserver"); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->close_tag(); }
public function execute() { if (valid_input($this->page->pathinfo[2], VALIDATE_NUMBERS, VALIDATE_NONEMPTY) == false) { $offset = 0; } else { $offset = $this->page->pathinfo[2]; } if (isset($_SESSION["admin_actionlog_size"]) == false) { $_SESSION["admin_actionlog_size"] = $this->model->get_log_size(); } $paging = new pagination($this->output, "admin_actionlog", $this->settings->admin_page_size, $_SESSION["admin_actionlog_size"]); if (($log = $this->model->get_action_log($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Error reading action log."); return; } $users = array($this->user->id => $this->user->username); $this->output->open_tag("log"); $this->output->open_tag("list"); foreach ($log as $entry) { $user_id = $entry["user_id"]; list($user_id, $switch_id) = explode(":", $user_id); if (isset($users[$user_id]) == false) { if (($user = $this->model->get_user($user_id)) !== false) { $users[$user_id] = $user["username"]; } } if (isset($users[$switch_id]) == false) { if (($switch = $this->model->get_user($switch_id)) !== false) { $users[$switch_id] = $switch["username"]; } } $entry["username"] = isset($users[$user_id]) ? $users[$user_id] : "-"; $entry["switch"] = isset($users[$switch_id]) ? $users[$switch_id] : "-"; $this->output->record($entry, "entry"); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->close_tag(); }
public function actionIndex($type = 'all', $folderid = 0) { $file = zotop::model('system.file'); $folder = zotop::model('system.folder'); if (!empty($type) && $type != 'all') { $where = array('file.type', '=', $type); } $files = $file->db()->select('file.*', 'user.name as user_name', 'user.username as user_username')->join('user', 'user.id', 'file.userid')->where($where)->orderby('file.createtime', 'desc')->getPage(); //zotop::dump($file->db()->Sql()); $types = $file->types(); $pagination = new pagination(); $pagination->page = $files['page']; $pagination->pagesize = $files['pagesize']; $pagination->total = $files['total']; $p = $pagination->render(); $totalsize = $file->totalsize($where); $totalcount = $file->count(); $folders = $folder->getAll(); $tree = new tree($folders, 0); $position = $tree->getPosition($folderid); foreach ($position as $p) { $pos[zotop::url('system/file/index/' . $type . '/' . $p['id'])] = $p['title']; } $page = new page(); $page->set('title', zotop::t('文件管理')); $page->set('position', array(zotop::url('system/file') => zotop::t('文件管理'), zotop::url('system/file/' . $type . '/0') => zotop::t('全部文件')) + (array) $pos + array('列表')); $page->set('navbar', $this->navbar()); $page->set('page', $files['page']); $page->set('pagesize', $files['pagesize']); $page->set('total', $files['total']); $page->set('files', $files['data']); $page->set('totalsize', $totalsize); $page->set('totalcount', $totalcount); $page->set('pagination', $p); $page->set('types', $types); $page->set('type', $type); $page->set('folderid', $folderid); $page->display(); }
public function execute() { $this->output->description = "Guestbook"; $this->output->keywords = "guestbook"; $this->output->title = "Guestbook"; $skip_sign_link = false; if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($this->model->message_oke($_POST) == false) { $this->show_guestbook_form($_POST); } else { if ($this->model->save_message($_POST) == false) { $this->output->add_message("Database errors while saving message."); $this->show_guestbook_form($_POST); } else { $skip_sign_link = true; } } } if (($message_count = $this->model->count_messages()) === false) { $this->output->add_tag("result", "Database error."); return; } $paging = new pagination($this->output, "guestbook", $this->settings->guestbook_page_size, $message_count); if (($guestbook = $this->model->get_messages($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); } else { $this->output->open_tag("guestbook", array("skip_sign_link" => show_boolean($skip_sign_link))); foreach ($guestbook as $item) { $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]); $message = new message($item["message"]); $item["message"] = $message->unescaped_output(); unset($item["ip_address"]); $this->output->record($item, "item"); } $paging->show_browse_links(7, 3); $this->output->close_tag(); } }
public function actionBrowser($folderid = 0) { $file = zotop::model('system.file'); if ($folderid == 0) { $images = $file->db()->where('type', '=', 'image')->orderby('createtime', 'desc')->getPage(); } else { $images = $file->db()->where('type', '=', 'image')->where('folderid', '=', $folderid)->orderby('createtime', 'desc')->getPage(); } $pagination = new pagination(); $pagination->page = $images['page']; $pagination->pagesize = $images['pagesize']; $pagination->total = $images['total']; $p = $pagination->render(); $page = new page(); $page->set('title', '图片库'); $page->set('image', $image); $page->set('page', $images['page']); $page->set('pagesize', $images['pagesize']); $page->set('total', $images['total']); $page->set('images', $images['data']); $page->set('pagination', $p); $page->display(); }
private function show_weblog_overview() { if (($weblog_count = $this->model->count_weblogs()) === false) { $this->output->add_tag("result", "Database error."); return; } $paging = new pagination($this->output, "admin_forum", $this->settings->admin_page_size, $weblog_count); if (($weblogs = $this->model->get_weblogs($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("overview"); $this->output->open_tag("weblogs"); foreach ($weblogs as $weblog) { $weblog["visible"] = show_boolean($weblog["visible"]); $weblog["timestamp"] = date("j F Y, H:i", $weblog["timestamp"]); $this->output->record($weblog, "weblog"); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->add_tag("comments", show_boolean($this->user->access_allowed("cms/weblog/comment"))); $this->output->close_tag(); }
public function actionIndex($categoryid = 0, $status = null) { $blog = zotop::model('blog.blog'); $blogs = $blog->getPage($categoryid, $status); $blogstatus = $blog->status(); $category = zotop::model('blog.category'); $categorys = $category->getAll(); $pagination = new pagination(); $pagination->page = $blogs['page']; $pagination->pagesize = $blogs['pagesize']; $pagination->total = $blogs['total']; $p = $pagination->render(); $page = new page(); $page->set('title', '日志管理'); $page->set('navbar', $this->navbar($categoryid)); $page->set('blogs', $blogs); $page->set('status', $status); $page->set('blogstatus', $blogstatus); $page->set('pagination', $p); $page->set('categoryid', $categoryid); $page->set('categorys', $categorys); $page->display(); }
public function __construct() { $this->registry = registry::getInstance(); $this->session = $this->registry["session"]; $this->cookie = $this->registry["cookie"]; $this->view = $this->registry["views"]; $this->themes = $this->registry["themes"]; $this->path = $this->registry["path"]; $this->l10n = l10n::getInstance(); $this->html = html::getInstance(); $this->ajax = new ajax(); $this->pagination = pagination::getInstance(); if ($_SERVER["REQUEST_METHOD"] == "POST") { $this->data = $_POST; } else { $this->data = NULL; } $this->isAjax = $this->isAjax(); }
function pagination() { $string = $_SERVER['REQUEST_URI']; $pattern = '/(&page=[0-9]+)/i'; $replacement = ''; $target = preg_replace('/([&?]+page=[0-9]+)/i', '', $_SERVER['REQUEST_URI']); $this->load->library('pagination'); $page = new pagination(); $page->target($target); $page->limit($this->paged->page_size); @$page->currentPage($this->paged->current_page); $page->Items($this->paged->total_rows); return $page->show(); }