当前位置: 首页>>代码示例>>PHP>>正文


PHP Pagination::factory方法代码示例

本文整理汇总了PHP中Pagination::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::factory方法的具体用法?PHP Pagination::factory怎么用?PHP Pagination::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pagination的用法示例。


在下文中一共展示了Pagination::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_index

 public function action_index()
 {
     //if they want to see a single post
     $seotitle = $this->request->param('seotitle', NULL);
     if ($seotitle !== NULL) {
         return $this->action_view($seotitle);
     }
     //template header
     $this->template->title = __('Blog');
     $this->template->meta_description = core::config('general.site_name') . ' ' . __('blog section.');
     $posts = new Model_Post();
     $posts->where('status', '=', Model_Post::STATUS_ACTIVE)->where('id_forum', 'IS', NULL);
     if (($search = Core::get('search')) !== NULL and strlen(Core::get('search')) >= 3) {
         $posts->where_open()->where('title', 'like', '%' . $search . '%')->or_where('description', 'like', '%' . $search . '%')->where_close();
     }
     $res_count = clone $posts;
     $res_count = $res_count->count_all();
     // check if there are some post
     if ($res_count > 0) {
         // pagination module
         $pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__("Page ") . $pagination->current_page));
         //we sort all ads with few parameters
         $posts = $posts->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     } else {
         $posts = NULL;
         $pagination = NULL;
     }
     $this->template->bind('content', $content);
     $this->template->content = View::factory('pages/blog/listing', array('posts' => $posts, 'pagination' => $pagination, 'user' => Auth::instance()->get_user()));
 }
开发者ID:nick-catanchin-ie,项目名称:common,代码行数:31,代码来源:blog.php

示例2: action_list

 /**
  * 列表页
  */
 public function action_list()
 {
     $this->_add_css('styles/album/my_library.css');
     $this->_add_script('scripts/dtree.js');
     $tag = new Tags();
     $cate = new Bookcategory();
     $position = trim($this->getQuery('position'));
     switch ($position) {
         case 'is_hot':
             $pageTitle = '热门文章';
             break;
         case 'is_recommend':
             $pageTitle = '美文推荐';
             break;
         default:
             $pageTitle = '最新文章';
             break;
     }
     $this->template->position = $pageTitle;
     $select = DB::select('a.*', 'cate.cate_name', 'u.username')->from(array('articles', 'a'))->join(array('article_categories', 'cate'))->on('cate.cate_id', '=', 'a.cate_id')->join(array('users', 'u'))->on('u.uid', '=', 'a.uid')->where('a.recycle', '=', 0)->where('a.is_show', '=', 1)->order_by('a.article_id', 'DESC');
     if (!empty($position) && $position != 'is_new') {
         $select->where('a.' . $position, '=', 1);
     }
     $this->template->cate_id = $cate_id = trim($this->getQuery('cate_id'));
     if ($cate_id > 0) {
         $select->where('a.cate_id', '=', $cate_id);
     }
     $this->template->pagination = $pagination = Pagination::factory(array('total_items' => count($select->execute()->as_array()), 'items_per_page' => 30));
     $this->template->results = $select->limit($pagination->items_per_page)->offset($pagination->offset)->execute();
     $this->template->tags = $tags = $tag->getHotTags('article');
     if ($this->auth) {
         $this->template->categories = $categories = $cate->getCates($this->auth['uid']);
     }
 }
开发者ID:BGCX261,项目名称:zhongyycode-svn-to-git,代码行数:37,代码来源:index.php

示例3: action_list

 public function action_list()
 {
     $this->_add_css('styles/album/my_library.css');
     $this->_add_script('scripts/dtree.js');
     $username = urldecode($this->getQuery('username'));
     $user = ORM::factory('user');
     $art = ORM::factory('article');
     $this->template->userInfo = $userInfo = $user->where('username', '=', $username)->find();
     if (empty($userInfo->username)) {
         $this->show_message('非法访问', 0, array(), true);
     }
     $this->template->pageTitle = $this->auth['username'] . '的图书列表';
     $this->template->categories = $categories = $this->cate->getCates($userInfo->uid);
     $select = DB::select('a.*', 'cate.cate_name')->from(array('articles', 'a'))->join(array('article_categories', 'cate'))->on('cate.cate_id', '=', 'a.cate_id')->where('a.uid', '=', $userInfo->uid)->where('a.recycle', '=', 0)->order_by('a.article_id', 'DESC');
     $this->template->keyword = $keyword = trim($this->getQuery('keyword'));
     if (!empty($keyword)) {
         $select->where('a.title', 'like', "%{$keyword}%")->or_where('a.uid', '=', $keyword);
     }
     $this->template->cate_id = $cate_id = trim($this->getQuery('cate_id'));
     if ($cate_id > 0) {
         $select->where('a.cate_id', '=', $cate_id);
     }
     $this->template->pagination = $pagination = Pagination::factory(array('total_items' => count($select->execute()->as_array()), 'items_per_page' => 30));
     $this->template->results = $select->limit($pagination->items_per_page)->offset($pagination->offset)->execute();
     $this->template->tags = $tags = $this->tag->get(0, 'article', $userInfo->uid);
     $this->template->cateInfo = $this->cate->cateInfo($cate_id);
 }
开发者ID:BGCX261,项目名称:zhongyycode-svn-to-git,代码行数:27,代码来源:user.php

示例4: action_index

	public function action_index()
	{
		$logs = ORM::factory('log')->apply_filters($_GET);
		$counter = clone $logs;
		$pagination = Pagination::factory(array(
			'current_page'   => array('source' => 'query_string', 'key' => 'page'),
			'total_items'    => $counter->count_all(),
			'items_per_page' => Kohana::config('dblog.pagination.items_per_page'),
			'view'           => Kohana::config('dblog.pagination.view'),
			'auto_hide'      => TRUE,
		));
		$logs = $logs
			->order_by('created', 'DESC')
			->limit($pagination->items_per_page)
			->offset($pagination->offset)
			->find_all()
			->as_array();
		$filters = $this->get_filters();
		$view = View::factory('dblog/index')
			->bind('logs', $logs)
			->bind('filter_values', $filters)
			->set('filters', Arr::get($_GET, 'log-filter', array()))
			->bind('pagination', $pagination);
		$this->response->body($view);
	}
开发者ID:nexeck,项目名称:kohana-dblog,代码行数:25,代码来源:dblog.php

示例5: action_list

 /**
  * 角色列表
  */
 public function action_list()
 {
     $total = Model::factory('Role')->countRoles()->getArray();
     $pagination = Pagination::factory($total);
     $roles = Model::factory('Role')->getRolesByLimit($pagination->offset(), $pagination->number())->getObject();
     $this->_default->content = View::factory('role/list')->set('roles', $roles)->set('pagination', $pagination);
 }
开发者ID:panchao1,项目名称:cronsystem,代码行数:10,代码来源:Role.php

示例6: action_index

 public function action_index()
 {
     $base = new Model_Base();
     $pageNum = 0;
     $param = $this->request->param('id');
     $filters = $base->safeArrAssoc($_GET);
     $params = explode('/', $param);
     $gid = $params[0];
     foreach ($params as $paramName) {
         if (preg_match("/page(\\d)/", $paramName)) {
             $pageNum = str_replace('page', '', $paramName);
         }
     }
     $marker = array_pop($params);
     $catalog = new Model_Material('groups');
     //смотрим шаблон для виджета
     $widget = new Model_Widget();
     $template = $widget->getTempalte('catalog2', $gid);
     if ($template) {
         $this->template = View::factory('widgets/' . $template);
     }
     // $categoryName = $catalog->getCategoryNameByCatalog();
     //получить содержимое папки
     // $count = $catalog->getCountMaterials($param);
     $count = $catalog->getCountMaterials($gid);
     $pagination = Pagination::factory(array('total_items' => $count));
     $pagination->current_page = $pageNum;
     $data = $catalog->getFullMaterials($gid);
     $this->template->data = $data;
     $this->template->pagination = $pagination;
 }
开发者ID:chernogolov,项目名称:blank,代码行数:31,代码来源:Catalog2.php

示例7: action_index

 public function action_index()
 {
     $supplychain_alias = ORM::factory('supplychain_alias');
     $page = max($this->request->param('page'), 1);
     $items = 20;
     $offset = $items * ($page - 1);
     $count = $supplychain_alias->count_all();
     $pagination = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'page'), 'total_items' => $supplychain_alias->count_all(), 'items_per_page' => $items));
     $this->template->supplychain_alias = $supplychain_alias->limit($pagination->items_per_page)->offset($pagination->offset)->find_all()->as_array(null, array('id', 'site', 'alias', 'supplychain_id'));
     $this->template->page_links = $pagination->render();
     $this->template->offset = $pagination->offset;
     $supplychain_alias_count = $supplychain_alias->count_all();
     $post = Validate::factory($_POST);
     $post->rule('site', 'not_empty')->rule('alias', 'not_empty')->filter('site', 'strip_tags')->filter('alias', 'strip_tags')->rule('supplychain_id', 'not_empty')->filter(true, 'trim');
     if (strtolower(Request::$method) === 'post' && $post->check()) {
         $check = false;
         $post = (object) $post->as_array();
         $site_added = $post->site;
         $alias_added = $post->alias;
         $id = $post->supplychain_id;
         // check if the alias already exists, if not add new alias
         $supplychain_alias = ORM::factory('supplychain_alias');
         $supplychain_alias->supplychain_id = $id;
         $supplychain_alias->site = $site_added;
         $supplychain_alias->alias = $alias_added;
         try {
             $supplychain_alias->save();
         } catch (Exception $e) {
             Message::instance()->set('Could not create alias. Violates the unique (site, alias)');
         }
         $this->request->redirect('admin/aliases');
     }
     Breadcrumbs::instance()->add('Management', 'admin/')->add('Aliases', 'admin/aliases');
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:34,代码来源:aliases.php

示例8: action_index

 public function action_index()
 {
     $jobs = ORM::factory('job');
     $total = $jobs->count_all();
     $pagination = Pagination::factory(array('total_items' => $total, 'items_per_page' => 15));
     $this->template->content = View::factory('jobs')->set('jobs', $jobs->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all())->set('total_jobs', $total)->set('pagination', $pagination);
 }
开发者ID:paulcinelli,项目名称:kohanajobs,代码行数:7,代码来源:jobs.php

示例9: action_index

 public function action_index()
 {
     $jobs = ORM::factory('job');
     $pager = Pagination::factory(array('total_items' => $jobs->reset(FALSE)->count_all(), 'items_per_page' => 20));
     $this->set_title(__('Jobs'), FALSE);
     $this->template->content = View::factory('jobs/index', array('jobs' => $jobs->limit($pager->items_per_page)->offset($pager->offset)->find_all(), 'pager' => $pager));
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:7,代码来源:jobs.php

示例10: action_moderate

 /**
  * Action MODERATION
  */
 public function action_moderate()
 {
     //template header
     $this->template->title = __('Moderation');
     $this->template->meta_description = __('Moderation');
     $this->template->scripts['footer'][] = '/js/oc-panel/moderation.js';
     //find all tables
     $ads = new Model_Ad();
     $res_count = $ads->where('status', '=', Model_Ad::STATUS_NOPUBLISHED)->count_all();
     if ($res_count > 0) {
         $pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count, 'items_per_page' => core::config('general.advertisements_per_page')))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
         $ads = $ads->where('ad.status', '=', Model_Ad::STATUS_NOPUBLISHED)->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
         //find all tables
         $hits = new Model_Visit();
         $hits->find_all();
         $list_cat = Model_Category::get_all();
         $list_loc = Model_Location::get_all();
         $arr_hits = array();
         // array of hit integers
         // fill array with hit integers
         foreach ($ads as $key_ads) {
             // match hits with ad
             $h = $hits->where('id_ad', '=', $key_ads->id_ad);
             $count = count($h->find_all());
             // count individual hits
             array_push($arr_hits, $count);
         }
         $this->template->content = View::factory('oc-panel/pages/moderate', array('ads' => $ads, 'pagination' => $pagination, 'category' => $list_cat, 'location' => $list_loc, 'hits' => $arr_hits));
         // create view, and insert list with data
     } else {
         Alert::set(Alert::INFO, __('You do not have any advertisements waiting to be published'));
         $this->template->content = View::factory('oc-panel/pages/moderate', array('ads' => NULL));
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:37,代码来源:ad.php

示例11: action_index

 public function action_index()
 {
     //if they want to see a single post
     $seotitle = $this->request->param('seotitle', NULL);
     if ($seotitle !== NULL) {
         return $this->action_view($seotitle);
     }
     //template header
     $this->template->title = __('Blog');
     $this->template->meta_description = __('Blog');
     $posts = new Model_Post();
     $posts->where('status', '=', 1);
     $res_count = $posts->count_all();
     // check if there are some post
     if ($res_count > 0) {
         // pagination module
         $pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count, 'items_per_page' => core::config('general.advertisements_per_page')))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__("Page ") . $pagination->current_page));
         //we sort all ads with few parameters
         $posts = $posts->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     } else {
         $posts = NULL;
         $pagination = NULL;
     }
     $this->template->bind('content', $content);
     $this->template->content = View::factory('pages/blog/listing', array('posts' => $posts, 'pagination' => $pagination, 'user' => Auth::instance()->get_user()));
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:27,代码来源:blog.php

示例12: action_index

 public function action_index()
 {
     $this->_add_css('styles/album/my_library.css');
     $this->_add_script('scripts/dtree.js');
     $this->template->pageTitle = '图书搜索';
     $select = $select = DB::select('a.*', 'cate.cate_name')->from(array('articles', 'a'))->join(array('article_categories', 'cate'))->on('cate.cate_id', '=', 'a.cate_id')->where('a.recycle', '=', 0)->order_by('a.article_id', 'DESC');
     $this->template->keyword = $keyword = urldecode($this->getQuery('keyword'));
     if (!empty($keyword)) {
         $select->where('a.title', 'like', "%{$keyword}%")->or_where('a.content', 'like', "%{$keyword}%");
     }
     $this->template->searchTag = $tag = urldecode($this->getQuery('tags'));
     if (!empty($tag)) {
         $tag_id = DB::select('tag_id')->from('tags_name')->where('tag_name', '=', $tag)->execute()->get('tag_id');
         if ($tag_id > 0) {
             $result = DB::select('tags.item_id')->from('tags')->where('tags.tag_id', '=', $tag_id)->execute()->as_array();
             $item_id = array();
             foreach ($result as $item) {
                 $item_id[] = $item['item_id'];
             }
             $select->where('a.article_id', 'in', $item_id);
             $this->template->pageTitle = '标签搜索';
         }
     }
     $this->template->pagination = $pagination = Pagination::factory(array('total_items' => count($select->execute()->as_array()), 'items_per_page' => 30));
     $this->template->results = $select->limit($pagination->items_per_page)->offset($pagination->offset)->execute();
     $this->template->tags = $tags = $this->tag->getHotTags('article');
 }
开发者ID:BGCX261,项目名称:zhongyycode-svn-to-git,代码行数:27,代码来源:search.php

示例13: action_list

 public function action_list()
 {
     $data = array();
     $filter = Session::instance()->get('userlistFilter', array());
     $user = ORM::factory('user');
     if ($this->isPressed('btnFilter')) {
         $filter['FIO'] = trim(Arr::get($_POST, 'FIO'));
         $filter['role'] = trim(Arr::get($_POST, 'role'));
         $filter['isActive'] = trim(Arr::get($_POST, 'isActive'));
         $filter['note'] = trim(Arr::get($_POST, 'note'));
         foreach ($filter as $key => $value) {
             if ($value == '') {
                 unset($filter[$key]);
             }
         }
         Session::instance()->set('userlistFilter', $filter);
     }
     if ($this->isPressed('btnDelete')) {
         $idList = Arr::get($_POST, 'cb', array());
         foreach ($idList as $id => $value) {
             $user = ORM::factory('user', $id);
             $user->delete();
         }
     }
     $user = ORM::factory('user');
     $data['notes'] = $user->getDistinctNotes();
     $data['filter'] = $filter;
     // получаем общее количество пользователей
     $count = ORM::factory('user')->getUserList($filter)->count();
     // передаем значение количества пользователей в модуль pagination и формируем ссылки
     $pagination = Pagination::factory(array('total_items' => $count))->route_params(array('controller' => Request::current()->controller(), 'action' => Request::current()->action()));
     $data['users'] = $user->getUserList($filter, $pagination);
     $data['pagination'] = $pagination;
     $this->tpl->content = View::factory('admin/userlist', $data);
 }
开发者ID:reznikds,项目名称:Reznik,代码行数:35,代码来源:users.php

示例14: action_index

 public function action_index($identifier = false)
 {
     // TODO: cache this crap
     if (!$identifier) {
         Message::instance()->set('No user specified.');
         return $this->request->redirect('');
     }
     if (is_numeric($identifier)) {
         // pass
         $user = ORM::factory('user', $identifier);
     } else {
         $user = ORM::factory('user')->where('username', '=', $identifier)->find();
     }
     if ($user->loaded()) {
         $user = (object) $user->as_array();
         unset($user->password);
         $user->avatar = Gravatar::avatar($user->email, 128);
         unset($user->email);
         $this->template->user = $user;
         $pg = isset($_GET['p']) && (int) $_GET['p'] ? $_GET['p'] : 1;
         $pg = max($pg, 1);
         $l = 10;
         $q = array('user' => $user->id, 'l' => $l, 'o' => ($pg - 1) * $l, 'p' => $pg, 'recent' => 'yes');
         $r = Sourcemap_Search::find($q);
         $this->template->search_result = $r;
         $p = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'p'), 'total_items' => $r->hits_tot, 'items_per_page' => $r->limit, 'view' => 'pagination/basic'));
         $this->template->pager = $p;
         $this->template->supplychains = $r->results;
     } else {
         Message::instance()->set('That user doesn\'t exist.');
         return $this->request->redirect('');
     }
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:33,代码来源:user.php

示例15: action_list

 /**
  * 账号列表
  */
 public function action_list()
 {
     $total = Model::factory('Account')->countAccounts()->getArray();
     $pagination = Pagination::factory($total);
     $accounts = Model::factory('Account')->getAccountsByLimit($pagination->offset(), $pagination->number())->getObject();
     $this->_default->content = View::factory('account/list')->set('accounts', $accounts)->set('pagination', $pagination);
 }
开发者ID:panchao1,项目名称:cronsystem,代码行数:10,代码来源:Account.php


注:本文中的Pagination::factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。