public function action_index() { // add if (Input::post("teacher_id", null) != null and Security::check_token()) { // save $reservation = Model_Lessontime::forge(); $reservation->teacher_id = Input::post("teacher_id", 0); $reservation->student_id = 0; $reservation->status = 0; $reservation->freetime_at = strtotime(Input::post("year", 0) . "-" . Input::post("month", 0) . "-" . Input::post("day", 0) . " " . Input::post("hour", 0) . ":" . Input::post("min", 0) . ":00"); $reservation->save(); } $where = [["deleted_at", 0]]; if (Input::get("search_teacher", 0) != 0) { array_push($where, ["teacher_id" => Input::get("search_teacher", 0)]); } if (Input::get("year", 0) != 0 && Input::get("month", 0) != 0 && Input::get("day", 0) != 0) { $y = Input::get("year", 0); $m = Input::get("month", 0); $d = Input::get("day", 0); array_push($where, ["freetime_at", ">=", strtotime("{$y}-{$m}-{$d} 00:00:00")]); array_push($where, ["freetime_at", "<=", strtotime("{$y}-{$m}-{$d} 23:59:59")]); } $data["reservations"] = Model_Lessontime::find("all", ["where" => $where, "order_by" => [["id", "desc"]]]); $config = array('pagination_url' => "?search_teacher=" . Input::get("search_teacher", 0), 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 20, 'total_items' => count($data["reservations"])); $data["pager"] = Pagination::forge('mypagination', $config); $data["reservations"] = array_slice($data["reservations"], $data["pager"]->offset, $data["pager"]->per_page); $data["teachers"] = Model_User::find("all", ["where" => [["group_id", 10], ["deleted_at", 0]], "order_by" => [["id", "desc"]]]); $view = View::forge("admin/reservations/index", $data); $this->template->content = $view; }
public function action_index() { $page = Input::get('page') ? Input::get('page') : 1; $query = Input::get('query') ? Input::get('query') : ""; if (strlen($query)) { $data['news'] = DB::select('*')->from('news')->where('news_title', 'LIKE', '%' . $query . '%')->limit(30)->offset(($page - 1) * 30)->order_by('id', 'desc')->execute()->as_array(); } else { $data['news'] = DB::select('*')->from('news')->limit(30)->offset(($page - 1) * 30)->order_by('id', 'desc')->execute()->as_array(); } $total_rec = DB::count_last_query(); $data['total_page'] = ceil($total_rec / 30); $data['page'] = $page; $config = array('pagination_url' => "", 'total_items' => $total_rec, 'per_page' => 30, 'uri_segment' => 2, 'current_page' => $page); $pagination = Pagination::forge('pagenav', $config); $data['pagination'] = $pagination->render(); $cats = Model_Category::get_categories(); $this->theme->set_template('index'); $this->theme->get_template()->set_global('current_menu', "News", false); $this->theme->get_template()->set_global('current_menu_desc', "จัดการข่าวทั้งหมดในระบบ", false); $this->theme->get_template()->set('breadcrumb', array(array('title' => "Home", 'icon' => "fa-home", 'link' => Uri::create('home'), 'active' => false), array('title' => "News", 'icon' => "eicon-newspaper", 'link' => "", 'active' => true))); $this->theme->get_template()->set_global('query', $query, false); $this->theme->get_template()->set_global('cats', $cats, false); $this->theme->set_partial('sidebar', 'common/sidebar'); $this->theme->set_partial('content', 'news/index')->set($data); }
private function pagination($model, $options) { $config = array('pagination_url' => Uri::base() . $options['controller'] . '/' . $options['page'], 'total_items' => count($model), 'per_page' => isset($options['per_page']) ? $options['per_page'] : '', 'uri_segment' => 'page', 'wrapper' => '<div class="clearfix"><div class="pagination no-margin">{pagination}</div></div>', 'first' => '<li class="first">{link}</li>', 'fist-marker' => 'First', 'first-link' => '<a href="{uri}">{page}</a>', 'previous' => '<li class="previous">{link}</li>', 'previous-marker' => 'Previous', 'previous-link' => '<a href="{uri}">{page}</a>', 'previous-inactive' => '<li class="previous-inactive">{link}</li>', 'previous-inactive-link' => '<a href="{uri}" rel="prev">{page}</a>', 'regular' => '<li>{link}</li>', 'regular-link' => '<a href="{uri}">{page}</a>', 'active' => '<li class="active">{link}</li>', 'active-link' => '<a href="{uri}">{page}</a>', 'next' => '<li class="next">{link}</li>', 'next-marker' => 'Next', 'next-link' => '<a href="{uri}" rel="next">{page}</a>', 'next-inactive' => '<li class="next-inactive">{link}</li>', 'next-inactive-link' => '<a href="{uri}" rel="next">{page}</a>', 'last' => '<li class="last">{link}</li>', 'last-marker' => 'Last', 'last-link' => '<a href="{uri}">{page}</a>'); $pagination = Pagination::forge('table', $config); $data = $options['model']::query()->rows_offset($pagination->per_page)->rows_limit($pagination->offset)->get(); return $pagination->render(); }
/** * Инлексная страница */ public function action_index() { // Если была отправлена форма фильтрации или сортировка if (\Input::method() == 'POST') { $category_id = (int) \Input::post('category_id'); if ($category_id > 0) { \Session::set('filter_articles_category_id', $category_id); } else { \Session::set('filter_articles_category_id', null); } $title = trim(\Input::post('title')); \Session::set('filter_articles_title', $title); // Сортировка \Session::set('admin_articles_order_by', \Input::post('order_by', 'id')); \Session::set('admin_articles_order_method', \Input::post('order_method', 'desc')); } // Запрос на извлечение кол-ва статей $count = \Model_Article::get_articles_count(\Session::get('filter_articles_title'), \Session::get('filter_articles_category_id')); // Пагинация $config = array('pagination_url' => \URI::create('admin/articles/index'), 'total_items' => $count, 'per_page' => 15, 'uri_segment' => 4); $pagination = \Pagination::forge('articles_pagination', $config); $data['pagination'] = $pagination->render(); // Передаём в представление данные пагинации (для нумерации статей) $data['current_page'] = is_null($pagination->current_page) ? 1 : $pagination->current_page; $data['per_page'] = $pagination->per_page; // Получение статей $data['articles'] = \Model_Article::get_articles(\Session::get('filter_articles_title'), \Session::get('filter_articles_category_id'), $pagination->per_page, $pagination->offset, \Session::get('admin_articles_order_by', 'id'), \Session::get('admin_articles_order_method', 'desc')); // Категории статей $data['categories'] = \Model_Category::get_categories_for_select(); $this->template->title = "Статьи"; $this->template->content = \View::forge('articles/index', $data, false); }
public function action_imagelist() { $query = Model_Board::query()->select("id"); $bbsCount = $query->count(); //ページネーション $pConfig = array('pagination_url' => 'admin/imagelist/', 'uri_segment' => 3, 'num_links' => 2, 'per_page' => 3, 'total_items' => $bbsCount, 'show_first' => true, 'show_last' => true, 'name' => 'bootstrap3'); $pagiNation = Pagination::forge('adminPagination', $pConfig); $query2 = Model_Board::query(); $query2->rows_offset($pagiNation->offset); $query2->rows_limit($pagiNation->per_page); $query2->order_by('id', 'desc'); $data['bbss'] = $query2->get(); $query3 = Model_Attach::query(); $query3->select('id', 'bbsId', 'mime'); foreach ($data['bbss'] as $bbs) { $query3->or_where_open(); $query3->where('bbsId', '=', $bbs->id); $query3->or_where_close(); } $query3->order_by('id', 'desc'); $data['attaches'] = $query3->get(); $this->template->boardDescription = '画像一覧'; $content = View::forge('admin/imglist', $data); $content->set_safe('pagination', $pagiNation); $this->template->content = $content; }
/** * 予約履歴一覧 * * @access public * @param * @return void * @author kobayashi * @author ida */ public function action_list() { Asset::css('jquery-ui.min.css', array(), 'add_css'); Asset::js('jquery-ui.min.js', array(), 'add_js'); $conditions = $this->getCondition(); $condition_list = \Model_Entry::createAdminSearchCondition($conditions); $total_count = \Model_Entry::getCountByAdminSearch($condition_list); // ページネーション設定 $pagination = \Pagination::forge('entry_pagination', $this->getPaginationConfig($total_count)); $entry_list = \Model_Entry::findAdminBySearch($condition_list, $pagination->current_page, $this->result_per_page); $view_model = \ViewModel::forge('admin/entry/list'); if (\Input::param('fleamarket_id')) { $fleamarket = \Model_Fleamarket::find(\Input::param('fleamarket_id')); $view_model->set('fleamarket', $fleamarket, false); } if (\Input::param('user_id')) { $user = \Model_User::find(Input::param('user_id')); $view_model->set('user', $user, false); } $view_model->set('entry_list', $entry_list, false); $view_model->set('pagination', $pagination, false); $view_model->set('conditions', $conditions, false); $view_model->set('total_count', $total_count); $this->template->content = $view_model; }
public function action_index() { $page = Input::get('page') ? Input::get('page') : 1; $query = Input::get('query') ? Input::get('query') : ""; if (strlen($query)) { $data['users'] = DB::select('*')->from('users')->where('group', '=', '100')->and_where('username', 'LIKE', '%' . $query . '%')->limit(30)->offset(($page - 1) * 30)->execute()->as_array(); } else { $data['users'] = DB::select('*')->from('users')->where('group', '=', '100')->limit(30)->offset(($page - 1) * 30)->execute()->as_array(); } $total_rec = DB::count_last_query(); $data['page'] = $page; $data['total_page'] = ceil($total_rec / 30); $config = array('pagination_url' => "", 'total_items' => $total_rec, 'per_page' => 30, 'uri_segment' => 2, 'current_page' => $page); $pagination = Pagination::forge('pagenav', $config); $data['pagination'] = $pagination->render(); $groups = array(-1 => 'Banned', 0 => 'Guests', 1 => 'Users', 100 => 'Administrators'); $this->theme->set_template('index'); $this->theme->get_template()->set_global('current_menu', "Users", false); $this->theme->get_template()->set_global('current_menu_desc', "จัดการผู้ใช้งาน CMS ทั้งหมดในระบบ", false); $this->theme->get_template()->set('breadcrumb', array(array('title' => "Home", 'icon' => "fa-home", 'link' => Uri::create('home'), 'active' => false), array('title' => "Users", 'icon' => "fa-users", 'link' => "", 'active' => true))); $this->theme->get_template()->set_global('query', $query, false); $this->theme->get_template()->set_global('groups', $groups, false); $this->theme->set_partial('sidebar', 'common/sidebar'); $this->theme->set_partial('content', 'user/index')->set($data); }
public function action_index() { if (!\DBUtil::table_exists('blog') && !\DBUtil::table_exists('blog_comment')) { \Response::redirect('blog/installrequired'); } // list posts ----------------------------------------------------------------------------------------------------- $option['limit'] = \Model_Config::getval('content_items_perpage'); $option['offset'] = trim(\Input::get('page')) != null ? ((int) \Input::get('page') - 1) * $option['limit'] : 0; $list_items = \Blog\Model_Blog::listItems($option); // pagination config $config['pagination_url'] = \Uri::main() . \Uri::getCurrentQuerystrings(true, true, false); $config['total_items'] = $list_items['total']; $config['per_page'] = $option['limit']; $config['uri_segment'] = 'page'; $config['num_links'] = 3; $config['show_first'] = true; $config['show_last'] = true; $config['first-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>"; $config['first-inactive-link'] = '<a href="#">{page}</a>'; $config['first-marker'] = '«'; $config['last-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>"; $config['last-inactive-link'] = '<a href="#">{page}</a>'; $config['last-marker'] = '»'; $config['previous-marker'] = '‹'; $config['next-marker'] = '›'; $pagination = \Pagination::forge('viewlogins_pagination', $config); $output['list_items'] = $list_items; $output['pagination'] = $pagination; unset($config, $list_accounts, $option, $pagination); // <head> output ---------------------------------------------------------------------------------------------- $output['page_title'] = $this->generateTitle(\Lang::get('blog')); // <head> output ---------------------------------------------------------------------------------------------- return $this->generatePage('blog_v', $output, false); }
public function action_reserved() { $data["reservations"] = Model_Lessontime::find("all", ["where" => [["deleted_at", 0], ["teacher_id", $this->user->id], ["status", "<>", 0], ["status", "<>", 3], ["freetime_at", ">=", time()]], "order_by" => [["id", "desc"]]]); $config = array('pagination_url' => "", 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 20, 'total_items' => count($data["reservations"])); $data["pager"] = Pagination::forge('mypagination', $config); $view = View::forge("teachers/lesson/reserved", $data); $this->template->content = $view; }
public function action_index() { $pagination = \Pagination::forge('default', ['name' => 'bootstrap3', 'total_items' => \Model_Vendor::count(), 'per_page' => 1000, 'uri_segment' => 'p', 'num_links' => 20]); $conditions = array('rows_limit' => $pagination->per_page, 'rows_offset' => $pagination->offset); $data['vendors'] = \Model_Vendor::find('all', $conditions); $this->template->title = "Vendors"; $this->template->content = View::forge('admin/vendor/index', $data); }
public function action_index() { $args = array('seller' => Seller::active()); $pagination = Pagination::forge('customer_pagination', array('total_items' => Service_Customer_Order::count($args))); $orders = Service_Customer_Order::find(array_merge($args, array('offset' => $pagination->offset, 'limit' => $pagination->per_page, 'order_by' => array('updated_at' => 'desc')))); $this->view->orders = $orders; $this->view->pagination = $pagination; }
/** * Displays a list of customers. * * @return void */ public function action_index() { $args = array('seller' => Seller::active(), 'status' => 'all'); $pagination = Pagination::forge('customer_pagination', array('total_items' => Service_Customer::count($args))); $customers = Service_Customer::find(array_merge($args, array('offset' => $pagination->offset, 'limit' => $pagination->per_page))); $this->view->customers = $customers; $this->view->pagination = $pagination; }
/** * Действие для вывода списка категорий */ public function action_index() { // Пагинация $config = array('pagination_url' => \URI::create('admin/media/photos/categories/index'), 'total_items' => \Model_Media_Photos_Category::count(), 'per_page' => 10, 'uri_segment' => 6); $pagination = \Pagination::forge('categories_pagination', $config); $data['pagination'] = $pagination->render(); $data['сategories'] = \Model_Media_Photos_Category::find('all', array('related' => 'photos', 'order_by' => array('created_at' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page)); $this->template->content = \View::forge('media/photos/categories/index', $data, FALSE); }
/** * Список сезонов */ public function action_index() { // Пагинация $config = array('pagination_url' => \URI::create('admin/competitions/seasons/index'), 'total_items' => \Model_Season::count(), 'per_page' => 10, 'uri_segment' => 5); $pagination = \Pagination::forge('seasons_pagination', $config); $data['pagination'] = $pagination->render(); $data['seasons'] = \Model_Season::find('all', array('order_by' => array('id' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page)); $this->template->content = \View::forge('competitions/seasons/index', $data); }
/** * The basic welcome message * * @access public * @return Response */ public function action_index() { $lPage = Input::get('current_page', 1); $lArticles = Model_Articles::getAll($lPage, $this->lang); $lPagination = Pagination::forge('data_table', array('pagination_url' => '/main/index', 'total_items' => DB::count_last_query(), 'num_links' => 3, 'per_page' => \Config::get('db.items_per_page'), 'current_page' => $lPage, 'uri_segment' => 'current_page'))->render(); $this->template->content = View::forge('index', ['articles' => $lArticles, 'pagination' => $lPagination], false); return $this->template; //return Response::forge(View::forge('welcome/index')); }
public function action_index() { $data["news"] = Model_News::find("all", ["where" => [["deleted_at", 0], ["for_teachers", 1]], "order_by" => [["id", "desc"]]]); $config = array('pagination_url' => "", 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 10, 'total_items' => count($data["news"])); $data["pager"] = Pagination::forge('mypagination', $config); $data["news"] = array_slice($data["news"], $data["pager"]->offset, $data["pager"]->per_page); $data["user"] = $this->user; $view = View::forge("teachers/news/index", $data); $this->template->content = $view; }
public function action_index() { $where = [["deleted_at", 0]]; $data["contacts"] = Model_Contact::find("all", ["where" => $where, "order_by" => [["id", "desc"]]]); $config = array('pagination_url' => "", 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 20, 'total_items' => count($data["contacts"])); $data["pager"] = Pagination::forge('mypagination', $config); $data["contacts"] = array_slice($data["contacts"], $data["pager"]->offset, $data["pager"]->per_page); $view = View::forge("admin/contacts", $data); $this->template->content = $view; }
public function action_index() { $this->dataGlobal['pageTitle'] = __('backend.post.manage'); // Pagination $config = array('pagination_url' => \Uri::current(), 'total_items' => Model_Post::count(), 'per_page' => \Config::get('application.pagination.per_page'), 'uri_segment' => 'page'); $this->data['pagination'] = $pagination = \Pagination::forge('post_pagination', $config); // Get posts $this->data['posts'] = \Model_Post::query()->offset($pagination->offset)->limit($pagination->per_page)->order_by('created_at', 'DESC')->get(); $this->theme->set_partial('content', 'backend/post/index')->set($this->data, null, false); }
public function action_index() { $this->dataGlobal['pageTitle'] = __('backend.category.manage'); // Pagination $config = array('pagination_url' => \Uri::current(), 'total_items' => \Model_User::count(), 'per_page' => floor(\Model_User::count() / 2), 'uri_segment' => 'page'); $this->data['pagination'] = $pagination = \Pagination::forge('authors_pagination', $config); // Get categories $this->data['authors'] = \Model_User::query()->offset($pagination->offset)->limit($pagination->per_page)->order_by('created_at', 'DESC')->get(); return \Response::forge(\View::forge('backend/author/index')->set($this->data, null, false)); }
public function action_index() { $data = array(); // $a = Uri::create('/assets/img/collection'); // print_r($a); exit; $count = Model_Collection::count(); $config = array('pagination_url' => Uri::create('collection/index'), 'uri_segment' => 3, 'num_links' => 4, 'per_page' => 5, 'total_items' => $count); $pagination = Pagination::forge('mypagination', $config); $data['collections'] = Model_Collection::query()->order_by('created', 'desc')->limit($pagination->per_page)->offset($pagination->offset)->get(); $this->template->content = View::forge('collection/index', $data); }
/** * Действие для отображения списка видеозаписей */ public function action_index() { // Пагинация $config = array('pagination_url' => \URI::create('media/videos'), 'total_items' => \Model_Media_Video::count(), 'per_page' => 4, 'uri_segment' => 3); $pagination = \Pagination::forge('videos_pagination', $config); $data['pagination'] = $pagination->render(); // Получаем список видеозаписей $data['videos'] = \Model_Media_Video::find('all', array('order_by' => array('created_at' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page)); $this->template->page_title = 'Медиа :: Видео'; $this->template->content = \View::forge('media/videos/index', $data, FALSE); }
public function action_index() { $data["news"] = Model_News::find("all", ["where" => [["deleted_at", 0], ["for_students", 1]], "order_by" => [["id", "desc"]]]); $data['pasts'] = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", 0)], ["deleted_at", 0]]]); $data["donetrial"] = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", -1)], ["deleted_at", 0]]]); $config = array('pagination_url' => "", 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 10, 'total_items' => count($data["news"])); $data["pager"] = Pagination::forge('mypagination', $config); $data["news"] = array_slice($data["news"], $data["pager"]->offset, $data["pager"]->per_page); $data["user"] = $this->user; $view = View::forge("students/news/index", $data); $this->template->content = $view; }
/** * Действие для отображения списка новостей */ public function action_index() { // Запрос на извлечение количества статей $count = \Model_Article::get_articles_count(NULL, $this->category_id); // Пагинация $config = array('pagination_url' => \URI::create("news/{$this->uri}/page"), 'total_items' => $count, 'per_page' => 6, 'uri_segment' => 4); $pagination = \Pagination::forge('news_pagination', $config); $data['pagination'] = $pagination->render(); // Получение статей $data['articles'] = \Model_Article::get_articles('', $this->category_id, $pagination->per_page, $pagination->offset); $this->template->content = \View::forge('articles/index', $data, FALSE); }
public function action_trial() { $where = [["group_id", 1], ["deleted_at", 0], ["charge_html", 0]]; $trial_where = [["status", 2], ["deleted_at", 0], ["language", -1], ["number", 1]]; $data["users"] = Model_User::find("all", ["where" => $where, "order_by" => [["id", "desc"]]]); $data["lessons"] = Model_Lessontime::find("all", ["where" => $trial_where, "order_by" => [["id", "desc"]]]); $config = array('pagination_url' => "?search_text=" . Input::get("search_text", ""), 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 10, 'total_items' => count($data["lessons"])); $data["pager"] = Pagination::forge('mypagination', $config); $data["lessons"] = array_slice($data["lessons"], $data["pager"]->offset, $data["pager"]->per_page); $view = View::forge("admin/students/trial", $data); $this->template->content = $view; }
/** * 送信先ユーザ一覧画面 * * @access public * @param * @return void * @author ida */ public function action_userlist($mail_magazine_id = null) { $total_count = \Model_Mail_Magazine_User::getCountByMailMagazineId($mail_magazine_id); // ページネーション設定 $pagination = \Pagination::forge('mail_magazine_user_pagination', $this->getUserListPaginationConfig($total_count)); $mail_magazine_user_list = \Model_Mail_Magazine_User::findListByMailMagazineId($mail_magazine_id, $pagination->current_page, $this->result_per_page); $view_model = \ViewModel::forge('admin/mailmagazine/userlist'); $view_model->set('mail_magazine_id', $mail_magazine_id); $view_model->set('mail_magazine_user_list', $mail_magazine_user_list, false); $view_model->set('pagination', $pagination, false); $this->template->content = $view_model; }
/** * フリマ一覧 * * @access public * @param * @return void * @author kobayashi * @author ida */ public function action_list() { $conditions = $this->getCondition(); $condition_list = \Model_Fleamarket::createAdminSearchCondition($conditions); $total_count = \Model_Fleamarket::getCountByAdminSearch($condition_list); // ページネーション設定 $pagination = \Pagination::forge('fleamarket_pagination', $this->getPaginationConfig($total_count)); $fleamarkets = \Model_Fleamarket::findAdminBySearch($condition_list, $pagination->current_page, $this->result_per_page); $view_model = \ViewModel::forge('admin/fleamarket/list'); $view_model->set('fleamarkets', $fleamarkets, false); $view_model->set('pagination', $pagination, false); $view_model->set('conditions', $conditions, false); $this->template->content = $view_model; }
/** * Отображение списка фотографий категории * * @param int $id */ public function action_view($id = null) { is_null($id) and \Response::redirect('media/photos/categories'); // Пагинация $config = array('pagination_url' => \URI::create('media/photos/categories/view/' . $id), 'total_items' => \Model_Media_Photo::count(array('where' => array(array('category_id', '=', $id)))), 'per_page' => 6, 'uri_segment' => 6); $pagination = \Pagination::forge('photos_pagination', $config); $data['pagination'] = $pagination->render(); // Извлекаем данные категории $data['photos'] = \Model_Media_Photo::find('all', array('related' => 'category', 'where' => array(array('category_id', '=', $id)), 'order_by' => array('created_at' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page)); $this->template->css = array('lightbox.css'); $this->template->js = array('lightbox.min.js'); $this->template->page_title = 'Медиа :: Фото :: ' . current($data['photos'])->category->title; $this->template->content = \View::forge('media/photos/categories/view', $data, FALSE); }
public function action_index() { $where = [["group_id", 10], ["deleted_at", 0]]; $search_text = Input::get("search_text", ""); if ($search_text != "") { array_push($where, ["email", "like", "%{$search_text}%"]); } $data["users"] = Model_User::find("all", ["where" => $where, "order_by" => [["id", "desc"]]]); $config = array('pagination_url' => "?search_text=" . Input::get("search_text", ""), 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 20, 'total_items' => count($data["users"])); $data["pager"] = Pagination::forge('mypagination', $config); $data["users"] = array_slice($data["users"], $data["pager"]->offset, $data["pager"]->per_page); $view = View::forge("admin/teachers/index", $data); $this->template->content = $view; }
/** * Get all categorys from author * @param string $author username */ public function action_show_by_author($author = false) { $author = $this->data['author'] = \Model_User::query()->where('username', $author)->get_one(); if (!$author) { \Messages::error(__('frontend.author.not-found')); \Response::redirect_back(\Router::get('homepage')); } else { // Pagination $config = array('pagination_url' => \Uri::current(), 'total_items' => count($author->posts), 'per_page' => \Config::get('application.pagination.per_page'), 'uri_segment' => 'page'); $this->data['pagination'] = $pagination = \Pagination::forge('category_pagination', $config); // Get categorys $this->data['categories'] = Model_Category::query()->where('user_id', $author->id)->order_by('created_at', 'DESC')->offset($pagination->offset)->limit($pagination->per_page)->get(); return \Response::forge(\View::forge('frontend/category/author')->set($this->data, null, false)); } }
/** * Действие для отображения списка фотографий категории */ public function action_index($category_id = NULL) { is_null($category_id) and \Response::redirect('admin/media/photos/categories'); if (!($data['category'] = \Model_Media_Photos_Category::find($category_id))) { \Session::set_flash('error', 'Категория не найдена.'); \Response::redirect('admin/media/photos/categories'); } // Пагинация $config = array('pagination_url' => \URI::create('admin/media/photos/list/index/' . $category_id), 'total_items' => \Model_Media_Photo::count(array('where' => array(array('category_id' => $category_id)))), 'per_page' => 10, 'uri_segment' => 7); $pagination = \Pagination::forge('categories_pagination', $config); $data['pagination'] = $pagination->render(); $data['photos'] = \Model_Media_Photo::find('all', array('where' => array(array('category_id', '=', $category_id)), 'order_by' => array('created_at' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page)); $this->template->title = 'Фотогалерея "' . $data['category']->title . '"'; $this->template->content = \View::forge('media/photos/list/index', $data, FALSE); }