本文整理汇总了PHP中Pagination::forge方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::forge方法的具体用法?PHP Pagination::forge怎么用?PHP Pagination::forge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::forge方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
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;
}
示例2: action_index
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);
}
示例3: pagination
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();
}
示例4: action_index
/**
* Инлексная страница
*/
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);
}
示例5: action_imagelist
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;
}
示例6: action_list
/**
* 予約履歴一覧
*
* @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;
}
示例7: action_index
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);
}
示例8: action_index
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);
}
示例9: action_reserved
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;
}
示例10: action_index
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);
}
示例11: action_index
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;
}
示例12: action_index
/**
* 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;
}
示例13: action_index
/**
* Действие для вывода списка категорий
*/
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);
}
示例14: action_index
/**
* Список сезонов
*/
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);
}
示例15: action_index
/**
* 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'));
}