本文整理汇总了PHP中Pagination::page_number方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::page_number方法的具体用法?PHP Pagination::page_number怎么用?PHP Pagination::page_number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::page_number方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Used to display the index page but also uses a jquery and the pagination to do preload of next pages
* of the news articles. Which are then displaye don scroll
* @param integer $page the page number (Matt are you sure this is needed, the pagination is smart enough not to need this).
*/
public function index($page = 1)
{
$total = orm::factory('news')->where('group', 'site')->where('status', 'approved')->count_all();
$paging = new Pagination(array('total_items' => $total, 'items_per_page' => 3));
$articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all($paging->items_per_page, $paging->sql_offset);
$view = new View(url::location());
$view->articles = $articles;
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
// If the request is an ajax request, then the page is attempting to autoupdate
// the items with in the news, so just send through the news items.
if (request::is_ajax()) {
// if the ajax is attempting to get a page which doesnt exist, send 404
if ($page > $paging->total_pages) {
Event::run('system.404');
} else {
$this->ajax['view'] = $view;
}
} else {
// otherwise its a http request, send throught he entire page with template.
$this->template->title = 'About Us › News & Updates Archive';
$this->breadcrumbs->add()->url(false)->title('Archive');
$view->breadcrumbs = $this->breadcrumbs->cut();
$this->template->content = $view;
}
}
示例2: index
/**
* this index is a little differnt from normal, it will filter the results by the group params and show the
* page with only thoes values, further more
* @param $group
*/
public function index($group = NULL)
{
if ($this->access->allowed('news', 'read')) {
$this->breadcrumbs->add()->url('news/index/' . $group)->title('News');
// add the group filter to the crumb
$news = ORM::factory('news')->where('status !=', 'deleted');
if ($group != NULL) {
$news->where('group', $group);
}
$paging = new Pagination(array('total_items' => $news->count_all()));
$view = new view(url::location());
// re add the clauses we need
$news->where('status !=', 'deleted');
if ($group != NULL) {
$news->where('group', $group);
}
$view->news = $news->find_all($paging->items_per_page, $paging->sql_offset);
$view->group = $group;
// used tos end to the add page so we know what group to return to.
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$this->template->title = 'News';
$this->template->content = $view;
} else {
Kohana::log('debug', 'User failed constructor security check');
url::failed();
}
}
示例3: index
/**
* Index page, used to display all inspirations.
* This method may look a little "odd" there is a reason for this,
* the kohana orm shares the same instances across multiple objects.
* This means that we can not build all of the queries at the same time,
* they can not be set until all previous queries are completed (stupid).
*
* I have tried to reduce code repertition by using arrays, but its still ugly.
*
*/
public function index($page = 1, $application = 'all', $industry = 'all')
{
//gigo :: this is a work around for the jquery, curerently the these vars are entered into the system via a slickify jquery module that
// seem to like to run thml entities upon the values of the items regardless of that is sent into it.
$application = html_entity_decode($application);
$industry = html_entity_decode($industry);
$this->template->title = 'Inspirations';
$view = new view(url::routes_area() . 'index');
$where = array();
// Filter the results by the application and industry if needed
$view->selected_application = false;
if ($application != 'all') {
// find the application ID
$application = orm::factory('application')->like('name', url::decode($application))->find();
// gigo check
if ($application->loaded) {
$where['application_id'] = $application->id;
// set the aopplication ID as part of the where, used when getting inspirations and its pagination
$view->selected_application = $application;
// set the vaule used to set the selected filter on the page.
}
}
$view->selected_industry = false;
if ($industry != 'all') {
// find the application ID
$industry = orm::factory('industry')->where('name', url::decode($industry))->find();
// gigo check
if ($industry->loaded) {
$where['industry_id'] = $industry->id;
// set the industry ID as part of the where, used when getting inspirations and its pagination
$view->selected_industry = $industry;
// set the vaule used to set the selected filter on the page.
}
}
// add pagination, we are sending thorugh 16 items as this is easyly divisable.
$total = orm::factory('inspiration');
foreach ($where as $field => $value) {
$total->where($field, $value);
}
$paging = new Pagination(array('total_items' => $total->count_all(), 'items_per_page' => self::NUMBER_OF_ITEMS_PER_PAGE));
$inspirations = orm::factory('inspiration');
foreach ($where as $field => $value) {
$inspirations->where($field, $value);
}
$this->breadcrumbs->add()->url('inspiration')->title('Inspiration');
$this->breadcrumbs->add()->url(false)->title('Showcase');
$view->breadcrumbs = $this->breadcrumbs->cut();
$view->inspirations = $inspirations->find_all($paging->items_per_page, $paging->sql_offset);
$view->applications = orm::factory('application')->find_all();
$view->industries = orm::factory('industry')->find_all();
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$this->template->content = $view;
}
示例4: index
/**
* index page for the industrial items.
*/
public function index()
{
if ($this->access->allowed('industrials', 'read')) {
// set the type if an invalid one is entered then place in a default.
$this->template->title = 'Industrial Products';
$paging = new Pagination(array('total_items' => ORM::factory('industrial')->where('status !=', 'deleted')->count_all()));
$view = new view(url::routes_area() . 'index');
$view->industrials = ORM::factory('industrial')->where('status !=', 'deleted')->orderby('status', 'DESC')->find_all($paging->items_per_page, $paging->sql_offset);
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$this->template->content = $view;
}
}
示例5: index
public function index($type = NULL)
{
//Event::add('system.post_controller', 'foo');
if ($this->access->allowed('papers', 'read')) {
$filtered = in_array($type, array('standard', 'digital', 'sticky'));
$total = ORM::factory('paper')->where('status != ', 'deleted');
if ($filtered) {
$total->where('type', $type);
}
$total = $total->count_all();
$paging = new Pagination(array('total_items' => $total));
$view = new view(url::routes_area() . 'index');
$list = new view(url::routes_area() . 'index_list');
$list_papers = ORM::factory('paper')->orderby('name', 'asc')->where('status != ', 'deleted');
if ($filtered) {
$list_papers->where('type', $type);
}
$list->papers = $list_papers->find_all($paging->items_per_page, $paging->sql_offset);
if (request::is_ajax()) {
// ajax request return all the data the index will require to repopulate
$this->ajax['list'] = $list->__toString();
$this->ajax['page_number'] = $paging->page_number()->__toString();
$this->ajax['pagination'] = $paging->render();
} else {
if ($filtered) {
// replace the last bread crumb
$this->breadcrumbs->add()->url(url::location())->title(ucwords($type));
}
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$view->list = $list;
$this->template->content = $view;
$this->template->title = $filtered ? ucwords($type) . ' Papers' : 'Papers';
}
} else {
Kohana::log('debug', 'User failed constructor security check');
url::failed();
}
}
示例6: index
public function index()
{
if ($this->access->allowed('magazines', 'read')) {
$view = new view(url::location());
$this->template->title = 'Stock Magazines';
$paging = new Pagination(array('total_items' => ORM::factory('magazine')->where(array('status !=' => 'deleted'))->count_all()));
$view->magazines = orm::factory('magazine')->where(array('status !=' => 'deleted'))->find_all($paging->items_per_page, $paging->sql_offset);
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$this->template->content = $view;
} else {
url::failed();
}
}
示例7: index
public function index()
{
if ($this->access->allowed('campaigns', 'read')) {
$paging = new Pagination(array('total_items' => ORM::factory('campaign')->where('status !=', 'deleted')->count_all()));
$view = new view(url::location());
$this->template->title = 'Campaigns';
$view->campaigns = ORM::factory('campaign')->where('status !=', 'deleted')->orderby('created', 'asc')->find_all($paging->items_per_page, $paging->sql_offset);
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$this->template->content = $view;
} else {
url::failed();
}
}
示例8: index
/**
* Method for displaying a users lightboxes, the only people who should have access to this page are
* user of the system.
*
* @todo add notification for fails
*/
public function index()
{
// get the current user.
$user = Security::instance()->get_user();
// sanity check
if ($user && $user->loaded) {
if ($this->access->allowed('lightboxes', 'index')) {
$paging = new Pagination(array('total_items' => ORM::factory('lightbox')->where('creator_id', $user->id)->count_all()));
$view = new view(url::routes_area() . 'index');
$view->breadcrumbs = $this->breadcrumbs->get();
$this->breadcrumbs->delete();
$list = new view(url::routes_area() . 'index_list');
$list->lightboxes = ORM::factory('lightbox')->orderby('updated', 'desc')->where('creator_id', $user->id)->find_all($paging->items_per_page, $paging->sql_offset);
if (request::is_ajax()) {
// ajax request return all the data the index will require to repopulate
$this->ajax['list'] = $list->__toString();
$this->ajax['page_number'] = $paging->page_number()->__toString();
$this->ajax['pagination'] = $paging->render();
} else {
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$view->list = $list;
$this->template->content = $view;
$this->template->title = 'Papers';
}
} else {
// they are logged in, but dont have access to the page.
// you cant go to an index of a lightbox with out being logged into an account.
Kohana::log('debug', 'User failed constructor security check');
url::failed();
}
} else {
// instead of the generic message, instead give them a nice messgae, or redirect to login page.
Kohana::log('debug', 'User failed constructor security check');
url::failed(url::current());
}
}
示例9: index
public function index()
{
if ($this->access->allowed('billboards', 'read')) {
$this->template->title = 'Billboards';
$paging = new Pagination(array('total_items' => ORM::factory('billboard')->where('status !=', 'deleted')->count_all()));
$view = new view(url::routes_area() . 'index');
$billboards = ORM::factory('billboard')->where('status !=', 'deleted')->find_all($paging->items_per_page, $paging->sql_offset);
$view->billboards = $billboards;
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$this->template->content = $view;
} else {
url::failed();
}
}
示例10: index
/**
* this index is a little differnt from normal, it will filter the results by the group params and show the
* page with only thoes values, further more
* @param $group
*/
public function index()
{
if ($this->access->allowed('glossaries', 'read')) {
$glossaries = ORM::factory('glossary')->where('status !=', 'deleted');
$paging = new Pagination(array('total_items' => $glossaries->count_all()));
$view = new view(url::location());
$glossaries->where('status !=', 'deleted');
$view->glossaries = $glossaries->find_all($paging->items_per_page, $paging->sql_offset);
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$this->template->title = 'Glossary';
$this->template->content = $view;
} else {
Kohana::log('debug', 'User failed constructor security check');
url::failed();
}
}
示例11: index
/**
* This method will return all of the inspiraiton items that a user has created.
*/
public function index()
{
// add security and user logged in checks.
if ($this->current && $this->access->allowed('inspirations', 'view')) {
$view = new view(url::routes_area() . 'index');
// add pagination, we are sending thorugh 12 items as this is easyly divisable.
$paging = new Pagination(array('total_items' => ORM::factory('inspiration')->where('user_id', $this->current->id)->count_all(), 'items_per_page' => self::NUMBER_OF_ITEMS_PER_PAGE));
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$view->inspirations = orm::factory('inspiration')->where('user_id', $this->current->id)->where('status !=', 'deleted')->find_all($paging->items_per_page, $paging->sql_offset);
// add the breadcrumbs to the page level and then delete them so they dont show up on the template level.
$view->breadcrumbs = $this->breadcrumbs->cut();
$this->template->content = $view;
} else {
// they are not logged in.
url::failed(url::current());
}
}
示例12: index
public function index()
{
if ($this->access->allowed('inspirations', 'read')) {
$this->template->title = 'Inspirations';
$paging = new Pagination(array('total_items' => ORM::factory('inspiration')->where('status !=', 'deleted')->count_all()));
$view = new view(url::routes_area() . 'index');
$inspirations = ORM::factory('inspiration')->where('status !=', 'deleted')->orderby('status', 'DESC')->find_all($paging->items_per_page, $paging->sql_offset);
$users = array();
// assign the user information
foreach ($inspirations as $inspiration) {
$user = new User_Model(NULL, 'default');
$users[$inspiration->id] = $user->find($inspiration->user_id);
}
$view->inspirations = $inspirations;
$view->users = $users;
$view->pagination = $paging->render();
$view->page_number = $paging->page_number();
$this->template->content = $view;
} else {
url::failed();
}
}