public function getIndex() { if ($this->access['is_view'] == 0) { return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page ')); } // Filter sort and order for query $sort = !is_null(Input::get('sort')) ? Input::get('sort') : 'id'; $order = !is_null(Input::get('order')) ? Input::get('order') : 'asc'; // End Filter sort and order for query // Filter Search for query $filter = !is_null(Input::get('search')) ? $this->buildSearch() : ''; // End Filter Search for query $filter .= " AND id !='1' AND tb_groups.level >= " . Session::get('gid') . ""; $page = Input::get('page', 1); $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter); // Get Query $results = $this->model->getRows($params); $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1; $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']); $this->data['rowData'] = $results['rows']; $this->data['pagination'] = $pagination; $this->data['pager'] = $this->injectPaginate(); $this->data['i'] = $page * $params['limit'] - $params['limit']; $this->data['tableGrid'] = $this->info['config']['grid']; $this->data['tableForm'] = $this->info['config']['forms']; $this->data['colspan'] = SiteHelpers::viewColSpan($this->info['config']['grid']); $this->data['access'] = $this->access; $this->layout->nest('content', 'users.index', $this->data)->with('menus', SiteHelpers::menus()); }
public function post_index() { $buscado = Input::get('buscar'); $query = DB::query(' SELECT x.concepto, d.precio_unitario, fxp.folio_fxp, fxp.fecha_expedicion, p.nombre, m.clave, m.nombre as material FROM ( SELECT concepto,MAX(fxp.fecha_expedicion) AS max_date FROM detalle_fxp d INNER JOIN facturasxpagar fxp ON fxp.id = d.fxp_id GROUP BY concepto ) AS x INNER JOIN facturasxpagar fxp ON fxp.fecha_expedicion = x.max_date INNER JOIN detalle_fxp d ON d.fxp_id = fxp.id AND d.concepto = x.concepto INNER JOIN proveedores p ON p.id = fxp.proveedor_id LEFT JOIN materiales m ON d.material_id = m.id WHERE x.concepto LIKE ? OR m.clave LIKE ? OR m.nombre LIKE ? OR p.nombre LIKE ? ;', array($buscado . "%", $buscado . "%", $buscado . "%", $buscado . "%")); // var_dump($query); // echo '<pre>'; // print_r($query); // echo '</pre>'; $costos = Paginator::make($query, count($query), PER_PAGE_LARGE); $this->data['costos'] = $costos; return View::make('admin.' . $this->views . '.index', $this->data); }
public function postData() { if ($this->access['is_view'] == 0) { echo SiteHelpers::alert('error', Lang::get('core.note_restric')); die; } $sort = !is_null(Input::get('sort')) ? Input::get('sort') : $this->info['setting']['orderby']; $order = !is_null(Input::get('order')) ? Input::get('order') : $this->info['setting']['ordertype']; $filter = !is_null(Input::get('search')) ? $this->buildSearch() : ''; $page = Input::get('page', 1); $master = $this->buildMasterDetail(); $filter .= $master['masterFilter']; $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : $this->info['setting']['perpage'], 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0); $results = $this->model->getRows($params); $this->data['param'] = $params; $this->data['rowData'] = $results['rows']; $this->data['tableGrid'] = $this->info['config']['grid']; $this->data['tableForm'] = $this->info['config']['forms']; $this->data['access'] = $this->access; $this->data['subgrid'] = isset($this->info['config']['subgrid']) ? $this->info['config']['subgrid'] : array(); $this->data['masterdetail'] = $this->masterDetailParam(); // Build pagination setting $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1; $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']); // Build Pagination $this->data['pagination'] = $pagination; // Build pager number and append current param GET $this->data['pager'] = $this->injectPaginate(); // Row grid Number $this->data['i'] = $page * $params['limit'] - $params['limit']; return View::make('aorderdetails.table', $this->data); }
public static function getHomePageList($category_id) { $total = static::where('forumtopics.forumcategory_id', '=', $category_id)->count(); $per_page = Config::get('forums::forums.topics_per_page'); $page = Paginator::page($total, $per_page); $topics = DB::query('SELECT forumtopics.id as id, forumtopics.title as title, forumtopics.slug as slug, forumtopics.nb_messages as nb_messages, forumtopics.nb_views as nb_views, forumtopics.sticky as sticky, forumtopics.created_at as created_at, topicusers.username as topic_username, fm.id as last_message_id, fm.created_at as last_message_date, users.username as last_message_username FROM forumtopics JOIN (SELECT forummessages.id, forummessages.user_id, forummessages.forumtopic_id, forummessages.created_at FROM forummessages ORDER BY forummessages.created_at DESC) as fm ON fm.forumtopic_id = forumtopics.id JOIN users ON fm.user_id = users.id JOIN users as topicusers ON forumtopics.user_id = topicusers.id WHERE forumtopics.forumcategory_id = ? GROUP BY fm.forumtopic_id ORDER BY forumtopics.sticky DESC, fm.created_at DESC LIMIT ' . ($page - 1) * $per_page . ', ' . $per_page, array($category_id)); return Paginator::make($topics, $total, $per_page); }
public function getIndex() { if ($this->access['is_view'] == 0) { return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page ')); } // Filter sort and order for query $sort = !is_null(Input::get('sort')) ? Input::get('sort') : ''; $order = !is_null(Input::get('order')) ? Input::get('order') : 'asc'; // End Filter sort and order for query // Filter Search for query $filter = !is_null(Input::get('search')) ? $this->buildSearch() : ''; // End Filter Search for query $page = Input::get('page', 1); $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0); // Get Query $results = $this->model->getRows($params); // Build pagination setting $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1; $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']); $this->data['rowData'] = $results['rows']; // Build Pagination $this->data['pagination'] = $pagination; // Build pager number and append current param GET $this->data['pager'] = $this->injectPaginate(); // Row grid Number $this->data['i'] = $page * $params['limit'] - $params['limit']; // Grid Configuration $this->data['tableGrid'] = $this->info['config']['grid']; $this->data['tableForm'] = $this->info['config']['forms']; $this->data['colspan'] = SiteHelpers::viewColSpan($this->info['config']['grid']); // Group users permission $this->data['access'] = $this->access; // Render into template $this->layout->nest('content', 'rinvoices.index', $this->data)->with('menus', SiteHelpers::menus()); }
public function links() { if (count($this->results) <= 0) { $this->getResult(); } return \Paginator::make($this->results, count($this->results), static::$app['config']->get('statistics::paginate_num'))->links(); }
public function select() { $pagination = $this->_config['pagination']; $search = $this->_config['search']; $whereList = ''; if (ake('whereList', $this->_config)) { $whereList = $this->_config['whereList']; } $order = !strlen($this->_request->getCrudOrder()) ? $this->_config['defaultOrder'] : $this->_request->getCrudOrder(); $orderDirection = !strlen($this->_request->getCrudOrderDirection()) ? $this->_config['defaultOrderDirection'] : $this->_request->getCrudOrderDirection(); $export = !strlen($this->_request->getCrudTypeExport()) ? null : $this->_request->getCrudTypeExport(); $offset = !strlen($this->_request->getCrudNumPage()) ? 0 : $this->_request->getCrudNumPage() * $this->_config['itemsByPage']; $limit = $this->_config['itemsByPage']; $where = !strlen($this->_request->getCrudWhere()) ? '' : Project::makeQuery($this->_request->getCrudWhere(), $this->_type); $data = Project::query($this->_type, $where, 0, 0, $order, $orderDirection); $count = count($data); if (true === $pagination) { $pageNumber = $offset / $limit < 1 ? 1 : $offset / $limit; $paginator = Paginator::make($data, $count, $limit); $this->_items = $paginator->getItemsByPage($pageNumber); $this->_pagination = Crud::pagination($paginator); } else { $this->_items = $data; } if (0 < $count && null !== $export) { $method = 'export' . ucfirst(Inflector::lower($export)); return Crud::$method($data, $this->_em); } if (true === $search) { $this->makeSearch(); } return $this; }
public function itemsIndex() { $total = 125; $items = range(1, $total); $paginated = Paginator::make($items, $total, $this->per_page); $data = $this->buildPaginationResponse($paginated); return $this->respondOk($data); }
public function getPaginator() { if (!$this->paginator) { $items = $this->getCollection()->toArray(); $this->paginator = \Paginator::make($items, $this->getTotalRowsCount(), $this->page_size); } return $this->paginator; }
/** * Article'ları listele * GET /admin/article */ public function index() { $page = Input::get('page', 1); // Config öğesine talip ol $perPage = 3; $pagiData = $this->article->byPage($page, $perPage, true); $articles = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage); $this->layout->content = View::make('admin.article_list')->with('articles', $articles); }
/** * Paginated articles * GET / */ public function home() { $page = Input::get('page', 1); // Candidate for config item $perPage = 3; $pagiData = $this->article->byPage($page, $perPage); $articles = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage); $this->layout->content = View::make('home')->with('articles', $articles); }
/** * Show listing of snippets of a user * GET /profiles/{slug}/snippets */ public function getSnippets($slug) { $page = Input::get('page', 1); // Candidate for config item $perPage = 10; $pagiData = $this->snippet->byAuthor($slug, $page, $perPage); $user = $pagiData->user; $snippets = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage); return View::make('users.snippets', compact('snippets', 'user')); }
/** * Show listing of snippets * GET /snippets */ public function getIndex() { $page = Input::get('page', 1); // Candidate for config item $perPage = 30; $pagiData = $this->snippet->byPage($page, $perPage); $snippets = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage); $tags = $this->tag->all(); $topSnippetContributors = $this->user->getTopSnippetContributors(); return View::make('snippets.index', compact('snippets', 'tags', 'topSnippetContributors')); }
/** * (non-PHPdoc) * @see \Mawelous\Yamop\Mapper::_createPaginator() */ protected function _createPaginator($results, $totalCount, $perPage, $page, $options) { if ($options) { \Paginator::setPageName($options); $paginator = \Paginator::make($results, $totalCount, $perPage); \Paginator::setPageName('page'); } else { $paginator = \Paginator::make($results, $totalCount, $perPage); } return $paginator; }
public function getIndex() { if ($this->access['is_view'] == 0) { return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric'))); } // Filter sort and order for query $sort = !is_null(Input::get('sort')) ? Input::get('sort') : 'slideshow_id'; $order = !is_null(Input::get('order')) ? Input::get('order') : 'asc'; // End Filter sort and order for query // Filter Search for query $filter = !is_null(Input::get('search')) ? $this->buildSearch() : ''; $filter .= " AND lang = '{$this->lang}'"; // End Filter Search for query // Take param master detail if any $master = $this->buildMasterDetail(); // append to current $filter $filter .= $master['masterFilter']; $page = Input::get('page', 1); $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0); // Get Query $results = $this->model->getRows($params); // Build pagination setting $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1; $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']); $test = $this->model->columnTable(); $arr_search = SiteHelpers::arraySearch(Input::get('search')); foreach ($arr_search as $key => $val) { if ($key != "sort" && $key != "order" && $key != "rows") { $test[$key]['value'] = $val; } } $this->data['test'] = $test; $this->data['rowData'] = $results['rows']; // Build Pagination $this->data['pagination'] = $pagination; // Build pager number and append current param GET $this->data['pager'] = $this->injectPaginate(); // Row grid Number $this->data['i'] = $page * $params['limit'] - $params['limit']; // Grid Configuration $this->data['tableGrid'] = $this->info['config']['grid']; $this->data['tableForm'] = $this->info['config']['forms']; $this->data['colspan'] = SiteHelpers::viewColSpan($this->info['config']['grid']); // Group users permission $this->data['access'] = $this->access; // Detail from master if any $this->data['masterdetail'] = $this->masterDetailParam(); $this->data['details'] = $master['masterView']; // Master detail link if any $this->data['subgrid'] = isset($this->info['config']['subgrid']) ? $this->info['config']['subgrid'] : array(); // Render into template $this->layout->nest('content', 'Slideshow.index', $this->data)->with('menus', SiteHelpers::menus()); }
public function getPaginator() { if (!$this->paginator) { $items = $this->getCollection()->toArray(); if (version_compare(Application::VERSION, '5.0.0', '<')) { $this->paginator = \Paginator::make($items, $this->getTotalRowsCount(), $this->page_size); } else { $this->paginator = new \Illuminate\Pagination\LengthAwarePaginator($items, $this->getTotalRowsCount(), $this->page_size, $this->getCurrentPage(), ['path' => \Illuminate\Pagination\Paginator::resolveCurrentPath()]); } } return $this->paginator; }
/** * Account overview */ public function get_read_multiple() { // Set API options $options = array('offset' => (Input::get('page', 1) - 1) * $this->per_page, 'limit' => $this->per_page, 'sort_by' => Input::get('sort_by', 'name'), 'order' => Input::get('order', 'ASC')); // Add search to API options if (Input::has('q')) { $options['search'] = array('string' => Input::get('q'), 'columns' => array('name', 'email')); } // Get the Accounts $accounts = API::get(array('accounts'), $options); // Paginate the Accounts $accounts = Paginator::make($accounts->get('results'), $accounts->get('total'), $this->per_page); $this->layout->content = Module::page('account.read_multiple', $accounts); }
public function get_read_multiple($id = null) { // Set API options $options = array('offset' => (Input::get('page', 1) - 1) * $this->per_page, 'limit' => $this->per_page, 'sort_by' => Input::get('sort_by', 'name'), 'order' => Input::get('order', 'ASC'), 'filter' => array('module_id' => $id)); // Add search to API options if (Input::has('q')) { $options['search'] = array('string' => Input::get('q'), 'columns' => array('name')); } // Get the Accounts $mediagroups = API::get(array('media', $id, 'groups'), $options); // Paginate the mediagroups $mediagroups = Paginator::make($mediagroups->get('results'), $mediagroups->get('total'), $this->per_page); $this->layout->content = Module::page('media.group.read_multiple', $mediagroups, $id); }
/** * Show listing of snippets filtered by a tag * GET /tags/{slug} */ public function getShow($slug) { $page = Input::get('page', 1); // Candidate for config item $perPage = 30; $pagiData = $this->snippet->byTag($slug, $page, $perPage); if (!$pagiData->tag) { return App::abort(404); } $tag = $pagiData->tag; $snippets = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage); $tags = $this->tag->all(); $topSnippetContributors = $this->user->getTopSnippetContributors(); return View::make('tags.snippets', compact('snippets', 'tag', 'tags', 'topSnippetContributors')); }
/** * Display a listing of the resource. * * @return Response */ public function articles() { $current = Input::get('page', 1) - 1; $articles = array_chunk($this->post->all('article'), Config::get('skorry.paginate')); if (!count($articles)) { $data = (new \Parsedown())->parse(\File::get(base_path() . '/readme.md')); return View::make('hello', compact('data')); } if (!array_key_exists($current, $articles)) { App::abort(404); } $articles = $articles[$current]; $paginator = Paginator::make($articles, count($this->post->all('article')), Config::get('skorry.paginate')); return View::make('posts.articles', compact('articles', 'paginator')); }
public function getJobs() { $displayTitle = "Jobs"; //.$sectorId; $sectors = DB::select("EXEC spSectors_Select"); dd($sectors); $job_types = JobAlerts::getJobTypes(); $locations = DB::select("EXEC spLocations_Select"); $numOfJobs = 5; $pageNumber = Input::get('page') ?: 1; $jobs = []; $paginator = Paginator::make($jobs, count(DB::select("EXEC spJobSearch_Select @JobTitle = '', @SectorIDs = '{$sectors_get}', @LocationIDs = '{$location_get}', @EmploymentTypeIDs = '{$type_get}'")), $numOfJobs); $jobs = DB::select("EXEC spJobSearchPaged_Select @JobTitle = ?, @SectorIDs = '{$sectors}', @LocationIDs = '{$location_get}', @EmploymentTypeIDs = '{$type_get}', @RowsPerPage = {$numOfJobs}, @PageNumber = {$pageNumber}", explode('+', $keywords)); $recommended = self::getRecommendedJobs(); return View::make('jobs')->with('jobs', $jobs)->with('reccommended', $reccommended)->with('sectors', $sectors)->with('job_types', $job_types)->with('locations', $locations)->with('displayTitle', $displayTitle)->with('paginator', $paginator); }
public function showBlock($block) { try { //get the block data $blockInfo = $this->bitcoinClient->block($block); //get the block transactions $page = Input::get('page', 1); $transactions = $this->bitcoinClient->blockTransactions($block, $page, $limit = 20, $sortDir = 'desc'); //create an instance of the Paginator for easy pagination of the results $transactions = Paginator::make($transactions['data'], $transactions['total'], $transactions['per_page']); $data = array('block' => $blockInfo, 'transactions' => $transactions); return View::make('explorer.block', $data); } catch (Exception $e) { $data = array("title" => "Bitcoin Block", "subtitle" => "Could Not Get Block Data", "message" => $e->getMessage()); return View::make('error.general', $data); } }
public static function get($table, $columns, $Search_columns, $sJoin = null, $where = null, $limit = 10) { $sLimit = ""; $page = Input::get('page', 1); $sLimit = "LIMIT " . intval($limit * ($page - 1)) . ", " . intval($limit); foreach ($columns as $q) { if (strpos($q, ' as ') == true) { $clean_columns[] = trim(substr($q, strrpos($q, ' as ') + 4)); } else { $clean_columns[] = $q; } } $sSearch = str_replace("'", " ", $_GET['sSearch']); $sSearch = ltrim($sSearch); $sWhere = ""; $sAnd = ""; if ($where) { $sWhere = "WHERE" . ' ' . $where; $sAnd = "AND" . ' ' . $where; } if ($sSearch != "") { $aWords = preg_split('/\\s+/', $sSearch); $sWhere = "WHERE ("; for ($j = 0; $j < count($aWords); $j++) { if ($aWords[$j] != "") { $sWhere .= "("; for ($i = 0; $i < count($Search_columns); $i++) { $sWhere .= $Search_columns[$i] . " LIKE '%" . $aWords[$j] . "%' OR "; } $sWhere = substr_replace($sWhere, "", -3); $sWhere .= ") AND "; } } $sWhere = substr_replace($sWhere, "", -4); $sWhere .= ')' . $sAnd; } $table = DB::select("SELECT SQL_CALC_FOUND_ROWS " . str_replace(" , ", " ", implode(", ", $columns)) . ",\n {$table}.id as id FROM {$table} {$sJoin} {$sWhere} {$sLimit}"); $Found_Rows = DB::select('SELECT FOUND_ROWS() as num_rows'); $Found_Rows = (int) $Found_Rows['0']->num_rows; if (!$Found_Rows) { return false; } return Paginator::make($table, $Found_Rows, $limit); }
public function get_all() { $count = Cache::remember('items_count', function () { return Item::count(); }, 30); $page = Input::get('page', 1); $num_pages = 10; $per_page = 20; $extra_pages = 4; $start_total = $num_pages * $per_page > $count ? $count : $num_pages * $per_page; $total = $page * $per_page < $start_total - $per_page * $extra_pages ? $start_total : (($page + $extra_pages) * $per_page > $count ? $count : ($page + $extra_pages) * $per_page); $items_cache = 'items_' . $page . '_' . $per_page; $items = Cache::remember($items_cache, function () use($page, $per_page) { return Item::take($per_page)->skip(($page - 1) * $per_page)->get(); }, 30); $items = Paginator::make($items, $total, $per_page); $this->layout->page_title = "Admin - All items"; $this->layout->page_content = View::make('admin.items.all')->with('items', $items)->with('page', $page); }
public function results() { $results = $paginator = false; if (\Input::has('term')) { $solr = new LaravelSolariumQuery(\Config::get('laravel-solarium::default_core')); $searchInput = \Input::get('term'); $searchArray = explode(' ', $searchInput); $searchTermsArray = array(); foreach ($searchArray as $term) { $searchTermArray[] = 'search_content:"' . trim($term) . '"'; } $searchTerm = implode(' OR ', $searchTermArray); $searchTerm .= ' AND status:"APPROVED"'; $resultsPerPage = \Config::get('laravel-solarium::results.items_per_page'); $results = $solr->search($searchTerm)->fields(array('id', 'title', 'content', 'url'))->page(\Input::get('page', 1), $resultsPerPage)->highlight(array('content'))->get(); $highlighting = $results->getHighlighting(); $paginator = \Paginator::make($results->getDocuments(), $results->getNumFound(), $resultsPerPage); } $viewFile = \Config::get('laravel-solarium::results.view'); return \View::make($viewFile)->with(compact('results', 'paginator', 'highlighting')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { //get all investor credits // load the view and pass the all transactions if (strtolower(Session::get('account_type')) == 'admin') { $transactions = DB::select(DB::raw('select mws.* from mradiwallettransactions mws inner join (select max(id) as tid, user_id from mradiwallettransactions group by user_id order by tid desc) drv on mws.id = drv.tid')); $pageNumber = Input::get('page', 1); $perpage = 15; $slice = array_slice($transactions, $perpage * ($pageNumber - 1), $perpage); $transactions = Paginator::make($slice, count($transactions), $perpage); $myBalance = Helpers::investorBalance(Session::get('account_id'), true); } else { $transactions = Mradiwallettransaction::where('user_id', Session::get('account_id'))->orderBy('id', 'desc')->paginate(15); $myBalance = Helpers::investorBalance(Session::get('account_id')); } $totalInvestorBid = Helpers::getTotalInvestorBid(Session::get('account_id')); return View::make('admin.pages.investor_transactions')->with(compact('totalInvestorBid', 'myBalance'))->withObjects($transactions); }
public static function createPagination($dataObject, $input) { //total rows $totalItems = count($dataObject->tableData); //array of rows $items = $dataObject->tableData; //display $perpage = 10; //if we go outside the range of links if ($input < 1 || $input > ceil($totalItems / $perpage)) { $input = 1; Paginator::setCurrentPage(1); } //offset for each page $offset = $input * $perpage - $perpage; //cut up the array for display $articles = array_slice($items, $offset, $perpage); //create the paginated data $paginator = Paginator::make($articles, $totalItems, $perpage); return $paginator; }
public static function display($class, $conf) { $conf = !is_array($conf) ? array() : $conf; $config = $class::makeInfo($class); extract(array_merge(array('limit' => 10, 'sort' => $config['key'], 'order' => 'asc', 'params' => ''), $conf)); $data = array(); $page = Input::get('page', 1); $sort = !is_null(Input::get('sort')) ? Input::get('sort') : $sort; $order = !is_null(Input::get('order')) ? Input::get('order') : $order; $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : $limit, 'sort' => $sort, 'order' => $order); $results = $class::getRows($params); $data['key'] = $config['key']; $data['rowData'] = $results['rows']; $data['tableGrid'] = $config['config']['grid']; $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1; $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']); $data['pagination'] = $pagination; // Build pager number and append current param GET // Row grid Number $data['i'] = $page * $params['limit'] - $params['limit']; return View::make('public.index', $data); }
public function getIndex($type = '', $id = '') { // Filter sort and order for query $sort = !is_null(Input::get('sort')) ? Input::get('sort') : 'created'; $order = !is_null(Input::get('order')) ? Input::get('order') : 'desc'; // End Filter sort and order for query // Filter Search for query $filter = !is_null(Input::get('search')) ? $this->buildSearch() : ''; // End Filter Search for query // Take param master detail if any $master = $this->buildMasterDetail(); // append to current $filter $filter .= $master['masterFilter']; if ($type != '' && $type == 'category') { $filter .= " AND tb_blogcategories.alias ='" . $id . "' "; } $page = Input::get('page', 1); $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => 0); // Get Query $results = Blog::getRows($params); // Build pagination setting $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1; $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']); $this->data['rowData'] = $results['rows']; // Build Pagination $this->data['pagination'] = $pagination; // Build pager number and append current param GET $this->data['pager'] = $this->injectPaginate(); // Row grid Number $this->data['i'] = $page * $params['limit'] - $params['limit']; // Grid Configuration $this->data['blogcategories'] = Blog::summaryCategory(); $this->data['clouds'] = Blog::clouds(); $this->data['recent'] = Blog::recentPosts(); $this->layout = View::make("layouts." . CNF_THEME . ".index"); // Render into template $this->layout->nest('content', 'blog.index', $this->data)->with('page', $this->data); }
public function getIndex() { $category_selected = ""; $tocity = ""; if (isset($_GET['size'])) { $category_selected = $_GET['size']; Session::put('category_selected', $category_selected); } if (Session::has('category_selected')) { $category_selected = Session::get('category_selected'); } $perPage = 8; if (isset($_GET['tocity'])) { $tocity = $_GET['tocity']; Session::put('city', $tocity); } if (Session::has('city')) { $tocity = Session::get('city'); } if (isset($_GET['page'])) { $currentPage = $_GET['page'] - 1; } else { $currentPage = 0; } if ($tocity != "") { $cakes = Cakes::where('type', '=', $category_selected)->where('city', '=', $tocity)->get()->toArray(); } else { $cakes = Cakes::where('type', '=', $category_selected)->get()->toArray(); } $tmp = array(); foreach ($cakes as $arg) { $tmp[$arg['title']][] = $arg; } $cakes = $tmp; $pagedData = array_slice($cakes, $currentPage * $perPage, $perPage); $links = Paginator::make($cakes, count($cakes), $perPage); return View::make('cake.index')->with('category_selected', $category_selected)->with('city_list', City::all())->with('cakes', $pagedData)->with('links', $links)->with('tocity', $tocity)->with('city_to_go', ""); }