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())); }
/** * 列表页 */ 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']); } }
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); }
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); }
/** * 角色列表 */ 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); }
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; }
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'); }
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); }
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)); }
/** * 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)); } }
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())); }
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'); }
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); }
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(''); } }
/** * 账号列表 */ 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); }
/** * List of pages (blogs/posts/etc.) with a specific tag * * @throws HTTP_Exception_404 * * @uses Log::add * @uses Text::ucfirst * @uses ACL::check * @uses Meta::links * @uses URL::canonical * @uses Route::url */ public function action_view() { $id = (int) $this->request->param('id', 0); $tag = ORM::factory('tag', $id); if (!$tag->loaded()) { throw HTTP_Exception::factory(404, 'Tag :tag not found!', array(':tag' => $id)); } $this->title = __(':title', array(':title' => Text::ucfirst($tag->name))); $view = View::factory('tag/view')->set('teaser', TRUE)->bind('pagination', $pagination)->bind('posts', $posts); $posts = $tag->posts; if (!ACL::check('administer tags') and !ACL::check('administer content')) { $posts->where('status', '=', 'publish'); } $total = $posts->reset(FALSE)->count_all(); if ($total == 0) { Log::info('No posts found.'); $this->response->body(View::factory('page/none')); return; } $pagination = Pagination::factory(array('current_page' => array('source' => 'cms', 'key' => 'page'), 'total_items' => $total, 'items_per_page' => 15, 'uri' => $tag->url)); $posts = $posts->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all(); $this->response->body($view); // Set the canonical and shortlink for search engines if ($this->auto_render === TRUE) { Meta::links(URL::canonical($tag->url, $pagination), array('rel' => 'canonical')); Meta::links(Route::url('tag', array('action' => 'view', 'id' => $tag->id)), array('rel' => 'shortlink')); } }
public function action_index() { $types = ORM::factory('email_type'); $pager = Pagination::factory(array('total_items' => $types->reset(FALSE)->count_all(), 'items_per_page' => 20)); $this->set_title(__('Email types'), FALSE); $this->template->content = View::factory('email/types/index', array('types' => $types->find_all(), 'pager' => $pager)); }
public function action_list() { $volume = 50; $page_no = 0; if (isset($_GET['page'])) { $page_no = Html::chars($_GET['page']); $page_no = $page_no - 1; $page_no = $page_no * $volume + 1; } $view = View::factory("technicianl"); $view->list = null; $view->paging = null; $view->message = $this->message; try { //----- NO OPERATION IS DONE HERE. DEFAULT OPERATION------- $view->list = $this->model->SelectByPaging($page_no, $volume); $total = $this->model->Count(); //----- EVERYTHING IS DONE HERE. AYE SIKU SIBE------ //----- LETS GO PAGING. THANKS.------- $paging = Pagination::factory(array('base_url' => "technician/list/", 'uri_segment' => 'page', 'total_items' => $total, 'items_per_page' => $volume, 'style' => 'digg')); $view->paging = $paging; } catch (Exception $e) { //----- ERROR DONE SHELE. SO DISPLAY ERROR------- echo $e->getMessage(); } //-----DONT FORGET OUR PRESENTATION LAYER------- $this->template->content = $view; //-----WE ARE DONE. SISE. ALAWADA------- }
public static function create_grid($collection, $per_page) { $grid = '<table class="table-grid">'; $grid .= '<thead>'; $grid .= '<tr>'; foreach (grid::$columns as $column) { $grid .= '<th>' . grid::$labels[$column] . '</th>'; } $grid .= '<th colspan="2">Acciones</th>'; $grid .= '</tr>'; $grid .= '</thead>'; $grid .= '<tbody>'; foreach ($collection->find_all() as $item) { $grid .= '<tr>'; foreach (grid::$columns as $column) { $grid .= '<td class="' . grid::$styles[$column] . '">' . $item->{$column} . '</td>'; } $grid .= '<td>Edit</td>'; $grid .= '<td>Delete</td>'; $grid .= '</tr>'; } $grid .= '</tbody>'; $grid .= '<tfoot>'; $grid .= '<tr><td colspan="' . (count(grid::$columns) + 2) . '" class="table-row-right">'; $grid .= Pagination::factory(array('style' => 'classic', 'items_per_page' => $per_page, 'query_string' => 'page', 'total_items' => $collection->count_last_query())); $grid .= '</td></tr>'; $grid .= '</tfoot>'; $grid .= '</table>'; return $grid; }
public function action_index() { $this->template->t_header = 'Владельци'; $count = ORM::factory('Owner')->count_all(); $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => $this->items_per_page))->route_params(array('controller' => Request::current()->controller(), 'action' => Request::current()->action())); $owners = ORM::factory('Owner')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all(); $this->template->content = View::factory('/owners/main')->bind('owners', $owners)->bind('pagination', $pagination); }
public function action_all() { if (Auth::instance()->logged_in("admin")) { $pagination = Pagination::factory(array('total_items' => Model::factory('User')->count_all())); $this->template->data["users"] = Model::factory('User')->order_by('id', 'desc')->offset($pagination->offset)->limit($pagination->items_per_page)->find_all(); $this->template->data["pagination"] = $pagination; } }
public function action_index() { $demo[] = Pagination::factory(array('total_items' => 211))->render(); $demo[] = Pagination::factory(array('current_page' => array('source' => 'route', 'key' => 'page'), 'total_items' => 193, 'items_per_page' => 20))->render(); $demo[] = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'other_pagenr'), 'total_items' => 61))->render(); $demo[] = Pagination::factory(array('total_items' => 8, 'auto_hide' => FALSE))->render(); $this->request->response = '<h1>Pagination demos — <a href="' . URL::site($this->request->controller) . '">reset</a></h1>' . implode('', $demo); }
private function userlist() { $keyword = strtoupper(Core::$_dataFilter->valueCheck(Core::get("keyword"), "Limit", "关键字最多20个字符", false, 20)); $_where = ""; if ($keyword) { $_where .= " user_name like '%{$keyword}%'"; } $_order = Core::$_dataFilter->valueCheck(Core::get("order"), "Limit", "关键字最多20个字符", false, 20); $_asc = isset($_GET['asc']) ? $_GET['asc'] : 1; if ($_order) { if ($_asc) { $_asc = 0; $_order = "{$_order} desc"; } else { $_asc = 1; $_order = "{$_order} asc"; } } else { $_order = 'id desc '; } //实例化分页数据获取 $pager = Pagination::factory(); //设置每显示记录条数 $pageSize = 10; //设置显示的数字页码数 $showSize = 10; $page = Users::getPage($_where, null, $_order, $pageSize); $pager->dataTotal = $page['total']; //获取当前页 $currPage = $page['curr']; //创建分页实例 $pager->pagerInit(ROOT . 'class/plus/pagination/pagerstatictemplate.htm', $pageSize, $showSize, $currPage, 'page'); //获取页数据 $result = $page['list']; if (!empty($result)) { //设置表头 $url = $pager->getPageUrl("order=edate&asc={$_asc}", 'order'); $pager->setHeader(array('序号', '用户名', '注册时间')); //设置显示的字段 $showFields = array('id', 'order', 'user_name', 'add_time'); //设置处理字段函数 $multFunction = array('id' => array('PaginalTable', 'createCheckBox'), 'order' => array('Core', 'order')); //复合字段处理 $multFields = array('order' => array('id')); //设置表格标签 $pager->setTableTag(true); //设置表格样式 $pager->setTableClass('newblog'); //设置选择框 $pager->setCheckBox(); $pager->setRowNumber(($currPage - 1) * $showSize); //$pager->setDetailButton(); //$pager->setCustomButton(array('设置版本','设置码率')); $this->_showpage = $pager->showGet('', '<em>|</em>'); return $pager->createTable($result, $showFields, $multFunction, $multFields); } }
public function action_index() { $count = ORM::factory('article')->count_all(); $pagination = Pagination::factory(array('total_items' => $count))->route_params(array('controller' => Request::current()->controller(), 'action' => Request::current()->action())); $articles = ORM::factory('article')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all(); $article = View::factory('v_articles', array('articles' => $articles, 'pagination' => $pagination)); $this->template->page_title = 'Статии'; $this->template->block_center = array('article' => $article); }
public function action_index() { $count = ORM::factory('product')->count_all(); $pagination = Pagination::factory(array('total_items' => $count, $this->request)); $product = array_reverse(ORM::factory('product')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all()->as_array()); $catToPro = ORM::factory('categori')->find_all(); $productView = View::factory('admin/products/v_products_index', array('product' => $product, 'catToPro' => $catToPro, 'pagination' => $pagination)); $this->template->block_center = array($productView); }
public function action_index() { if (!empty($_GET['search'])) { $pagjinaacija = Pagination::factory(array('total_items' => Model::factory('article')->get_count_where($_GET['search']), 'items_per_page' => 2, 'auto_hide' => TRUE)); $this->template->content = View::factory('index/query')->set('query', Model::factory('article')->get_articles_from_query($_GET['search'], $pagjinaacija->offset, $pagjinaacija->items_per_page))->set('pagjinaacija', $pagjinaacija->render()); } else { $this->template->content = View::factory('index/error')->set('message', 'Nav rakstu ar šādu atslēgvārdu.'); } }
public function action_index() { // получаем общее количество $count = ORM::factory('emailsender')->count_all(); // передаем значение количества товаров в модуль pagination и формируем ссылки $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50)); $email = ORM::factory('emailsender')->limit($pagination->items_per_page)->offset($pagination->offset); $this->view = View::factory('backend/email/all')->set('email', $email)->set('pagination', $pagination); $this->template->content = $this->view; }
public function action_index() { $count = ORM::factory('avatar')->where('moderation_status_id', '!=', '2')->count_all(); $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 12)); $results = ORM::factory('avatar')->where('moderation_status_id', '!=', '2')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all(); $pages = $pagination->render(); $this->template->content = View::factory('admin/avatars/index'); $this->template->content->set(array('avatars' => $results, 'pages' => $pages)); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); }
public function action_index() { $pagination = Pagination::factory(array('total_items' => Model::factory('entry')->get_count(), 'items_per_page' => 2, 'view' => 'pagination/digg')); $this->template->page_title = 'Home, exacly! :)'; $entry = new Model_Entry(); $view = View::factory('home/main'); $view->entries = $entry->get_entries($pagination->items_per_page, $pagination->offset); $view->pagination = $pagination; $this->template->content = $view->render(); }
public function action_index() { $logs = ORM::factory('log')->filter(); Assets::css('logs', 'cms/media/css/controller/logs.css'); $per_page = (int) Arr::get($this->request->query(), 'per_page', 20); $pager = Pagination::factory(array('total_items' => $logs->reset(FALSE)->count_all(), 'items_per_page' => $per_page)); $sidebar = new Sidebar(array(new Sidebar_Fields_DateRange(array('label' => __('Date range'), 'name' => 'created_on', 'range' => array(array('name' => '', 'value' => Arr::path($this->request->query(), 'created_on.0')), array('name' => '', 'value' => Arr::path($this->request->query(), 'created_on.1'))))), new Sidebar_Fields_Select(array('name' => 'level[]', 'label' => __('Log level'), 'options' => Log::levels(), 'selected' => (array) $this->request->query('level'))), new Sidebar_Fields_Input(array('name' => 'per_page', 'label' => __('Items per page'), 'value' => $per_page, 'size' => 3)))); $this->set_title(__('Logs'), FALSE); $this->template->content = View::factory('logs/index', array('logs' => $logs->with('user')->limit($pager->items_per_page)->offset($pager->offset)->find_all(), 'pager' => $pager, 'sidebar' => $sidebar)); }