public function paging($data) { $currentPage = (int) $_GET['page']; $paginator = new PaginatorModel(array("data" => $data, "limit" => 10, "page" => $currentPage)); $page = $paginator->getPaginate(); return $page; }
/** * Searches for operadora */ public function searchAction($yacimientoId = null) { parent::importarJsTable(); $numberPage = 1; if ($yacimientoId != null) { $operadora = Operadora::find(array('operadora_yacimientoId=:yacimiento_id:', 'bind' => array('yacimiento_id' => $yacimientoId))); } else { if ($this->request->isPost()) { $query = Criteria::fromInput($this->di, "Operadora", $_POST); $this->persistent->parameters = $query->getParams(); } else { $numberPage = $this->request->getQuery("page", "int"); } $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $parameters["order"] = "operadora_id"; $operadora = Operadora::find($parameters); } if (count($operadora) == 0) { $this->flash->notice("No se han encontrado resultados"); return $this->dispatcher->forward(array("controller" => "operadora", "action" => "index")); } $paginator = new Paginator(array("data" => $operadora, "limit" => 25, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); }
/** * Index action */ public function indexAction() { $numberPage = $this->request->getQuery("page", "int", 1); $comments = Comments::query()->order("submitted DESC")->execute(); $paginator = new Paginator(array("data" => $comments, "limit" => 10, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); }
public function indexAction() { $this->tag->setTitle('Quản lý bài viết'); $news = News::find(array('order' => 'id DESC')); $currentPage = $this->request->getQuery("page", "int") > 0 ? $this->request->getQuery("page", "int") : 1; // Create a Model paginator, show 10 rows by page starting from $currentPage $paginator = new PaginatorModel(array("data" => $news, "limit" => 10, "page" => $currentPage)); // Get the paginated results $page = $paginator->getPaginate(); $this->view->setVar('page', $page); // Change active $params = $this->request->getPost(); $id = isset($params['id']) ? $params['id'] : ''; $active = isset($params['active']) ? $params['active'] : ''; if ($active == 1) { $active = 2; } else { if ($active == 2) { $active = 1; } } if ($id != null) { $news = News::findFirst($id); $news->active = $active; $news->save(); } }
/** * Searches for usuario */ public function searchAction() { $numberPage = 1; if ($this->request->isPost()) { $query = Criteria::fromInput($this->di, "Usuario", $_POST); $this->persistent->parameters = $query->getParams(); } else { $numberPage = $this->request->getQuery("page", "int"); } $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $parameters["order"] = "idusuario"; $usuario = Usuario::find($parameters); if (count($usuario) == 0) { $this->flash->notice("The search did not find any usuario"); return $this->dispatcher->forward(array("controller" => "usuario", "action" => "index")); } $barcode = new Barcode(); echo "<style>"; echo $barcode->getCssStyle(); echo "</style>"; //echo $barcode->code39("AB20150wewesdsd"); $this->view->setVar("barcode", $barcode); $paginator = new Paginator(array("data" => $usuario, "limit" => 10, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); }
public function indexAction($categoryID = 0) { $this->setTitle("Список элементов"); $this->setCategoryTitleSmall($categoryID); $this->view->addUrl = $this->di->get('url')->get(array( 'for' => 'new_element', 'categoryID' => $categoryID )); $elements = Elements::find([ "categoryID = :categoryID:", "bind" => ["categoryID" => $categoryID], "bindTypes" => ["categoryID" => Column::BIND_PARAM_INT], "order" => "created desc" ]); // ПАГИНАЦИЯ ??? $paginator = new Paginator(array( "data" => $elements, "limit" => 10, "page" => $this->request->getQuery("page", "int") ?: 1 )); $this->view->page = $paginator->getPaginate(); $this->view->elements = $elements; }
/** * ページングを実行する * 指定がなければ最初(=1)のページ @param $page * @param $count * @param $list * @return $this */ public function paging($list, $count, $page = 1) { $pagenator = new Paginator(['data' => $list, 'limit' => $count, 'page' => $page]); $this->pagenate = $pagenator; $this->page = $pagenator->getPaginate(); return $this; }
public function indexAction($page = 1) { $parameters["order"] = "gid desc"; $users = Groups::find($parameters); $paginator = new Model(array('data' => $users, 'limit' => 20, 'page' => $page)); $this->view->page = $paginator->getPaginate(); }
/** * Searches for equipopozo */ public function searchAction($yacimientoId = null) { parent::importarJsTable(); $numberPage = 1; if ($yacimientoId != null) { $equipopozo = Equipopozo::find(array('equipoPozo_yacimientoId=:yacimiento_id:', 'bind' => array('yacimiento_id' => $yacimientoId))); } else { if ($this->request->isPost()) { //$query = parent::fromInput($this->di, 'Equipopozo', $this->request->getPost()); $query = Criteria::fromInput($this->di, "Equipopozo", $_POST); $this->persistent->parameters = $query->getParams(); } else { $numberPage = $this->request->getQuery("page", "int"); } $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $parameters["order"] = "equipoPozo_id"; $equipopozo = Equipopozo::find($parameters); } if (count($equipopozo) == 0) { $this->flash->notice("No se encontraron resultados en la busqueda"); return $this->dispatcher->forward(array("controller" => "equipopozo", "action" => "index")); } $paginator = new Paginator(array("data" => $equipopozo, "limit" => 25, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); }
public function listAction() { $params = $this->request->getQuery(); if ($params['_url'] != null) { $string = ltrim($params['_url'], '/danh-muc'); } $array = explode('-', $string); $id = $array[0]; // Get name category $category = Category::findFirstById($id); $this->tag->setTitle($category->name); // Get list category of id if ($id != '' && $id > 0) { // The data set to paginate $news = News::find(array('active = 1 AND category =' . $id, 'order' => 'id DESC')); $currentPage = (int) $_GET["page"]; // Create a Model paginator, show 10 rows by page starting from $currentPage $paginator = new PaginatorModel(array("data" => $news, "limit" => 13, "page" => $currentPage)); // Get the paginated results $page = $paginator->getPaginate(); $this->view->setVar('page', $page); $this->view->setVar('category', $category); } else { $this->response->redirect('error'); } }
public function indexAction() { $nowurl = $this->request->getURI(); $type_list = $this->_getBusTypeList(); $this->view->type_list = $type_list; $this->view->url = $nowurl; $project_type = ''; $project_grow_up = ''; $is_type_belongs = false; $numberPage = 1; if ($this->request->isGet()) { $query = Criteria::fromInput($this->di, "DtbProduct", $_GET); } else { $numberPage = $this->request->getQuery("page", "int"); } $this->persistent->parameters = $query->getParams(); $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $parameters["order"] = "product_id"; $dtb_product = DtbProduct::find($parameters); if (count($dtb_product) == 0) { $this->flash->notice("The search did not find any dtb_product"); } $paginator = new Paginator(array("data" => $dtb_product, "limit" => $this->config->application->page_size, "page" => $numberPage)); $page = $paginator->getPaginate(); $page_split = $this->_split_page($page->current, $page->total_pages); $this->view->page_split = $page_split; //$this->view->disable(); $this->view->page = $page; }
/** * Searches for vehiculo */ public function searchAction() { $numberPage = 1; if ($this->request->isPost()) { $query = Criteria::fromInput($this->di, "Vehiculo", $_POST); $this->persistent->parameters = $query->getParams(); } else { $numberPage = $this->request->getQuery("page", "int"); } $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $parameters["order"] = "idvehiculo"; $vehiculo = Vehiculo::find($parameters); if (count($vehiculo) == 0) { $this->flash->notice("The search did not find any vehiculo"); return $this->dispatcher->forward(array("controller" => "vehiculo", "action" => "index")); } foreach ($vehiculo as $v) { //print_r($v->TiposVehiculo); } $paginator = new Paginator(array("data" => $vehiculo, "limit" => 10, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); }
/** * Index action */ public function indexAction() { $numberPage = 1; $list = Users::find(); $paginator = new Paginator(array("data" => $list, "limit" => 10, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); }
/** * Buscando las planillas. * SI el usuario tiene rol de administrador podra ver todas las planillas. * Sino se veran las Habilitadas unicamente */ public function searchAction() { parent::importarJsTable(); $numberPage = 1; if ($this->request->isPost()) { $query = Criteria::fromInput($this->di, "Planilla", $_POST); $this->persistent->parameters = $query->getParams(); } else { $numberPage = $this->request->getQuery("page", "int"); } $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $parameters["order"] = "planilla_id DESC"; $planilla = Planilla::find($parameters); if (count($planilla) == 0) { $this->flash->notice("No se encontraron resultados"); return $this->dispatcher->forward(array("controller" => "planilla", "action" => "index")); } $paginator = new Paginator(array("data" => $planilla, "limit" => 10000, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); $miSesion = $this->session->get('auth'); if ($miSesion['rol_nombre'] == 'ADMIN') { $this->view->admin = 1; } else { $this->view->admin = 0; } }
/** * Searches for waypoints */ public function searchAction() { $numberPage = 1; if ($this->request->isPost()) { $query = Criteria::fromInput($this->di, "Waypoints", $_POST); $this->persistent->parameters = $query->getParams(); } else { $numberPage = $this->request->getQuery("page", "int"); if ($numberPage <= 0) { $numberPage = 1; } } $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $parameters["order"] = "id"; $waypoints = Waypoints::find($parameters); if (count($waypoints) == 0) { $this->flash->notice("The search did not find any waypoints"); return $this->dispatcher->forward(array("controller" => "waypoints", "action" => "index")); } $paginator = new Paginator(array("data" => $waypoints, "limit" => 10, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); }
private function listAction() { $numberPage = 1; if (!$this->request->isPost()) { $numberPage = $this->request->getQuery('page', 'int'); } $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } // $count = Motorbikes::count($parameters); $itemsPerPage = $this->getDI()->get('config')->setting->itemsPerPage; // $parameters['offset'] = $itemsPerPage * $numberPage; // $parameters['limit'] = $itemsPerPage; $motorbike = Motorbikes::find($parameters); if (count($motorbike) == 0) { $this->flash->notice('The search did not find any motorbike'); return $this->forward('motorbikes/index'); } // var_dump($motorbike); $paginator = new Paginator(array('data' => $motorbike, 'limit' => $itemsPerPage, 'page' => $numberPage)); // Pick "motorbike/search" as view to render $this->view->pick("motorbikes/search"); $this->view->page = $paginator->getPaginate(); $this->view->sortForm = new MotorbikesSortForm(); }
public function getPage($config = array()) { if (isset($config['data'])) { $cname = isset($config['cname']) ? $config['where'] : $this->dispatcher->getControllerName(); $limit = isset($config['limit']) ? $config['limit'] : 15; $getUrl = isset($config['getUrl']) ? $config['getUrl'] : ''; // Page $page = $this->request->getQuery('page', 'int'); $paginator = new PaginatorModel(array('data' => $config['data'], 'limit' => $limit, 'page' => $page)); $Page = $paginator->getPaginate(); // Page Html $Lang = $this->inc->getLang('inc'); $html = ''; if (empty($page) || $page == 1) { $html .= '<span>' . $Lang->_('inc_page_first') . '</span>'; $html .= '<span>' . $Lang->_('inc_page_before') . '</span>'; } else { $html .= '<a href="' . $this->inc->BaseUrl($cname) . '?page=1' . $getUrl . '">' . $Lang->_('inc_page_first') . '</a>'; $html .= '<a href="' . $this->inc->BaseUrl($cname) . '?page=' . $Page->before . $getUrl . '">' . $Lang->_('inc_page_before') . '</a>'; } if ($page == $Page->last) { $html .= '<span>' . $Lang->_('inc_page_next') . '</span>'; $html .= '<span>' . $Lang->_('inc_page_last') . '</span>'; } else { $html .= '<a href="' . $this->inc->BaseUrl($cname) . '?page=' . $Page->next . $getUrl . '">' . $Lang->_('inc_page_next') . '</a>'; $html .= '<a href="' . $this->inc->BaseUrl($cname) . '?page=' . $Page->last . $getUrl . '">' . $Lang->_('inc_page_last') . '</a>'; } $html .= ' Page : ' . $Page->current . '/' . $Page->total_pages; $Page->PageHtml = $html; return $Page; } else { return FALSE; } }
/** * Default action, shows the search form */ public function indexAction() { $numberPage = 1; if ($this->request->isPost()) { $query = \Phalcon\Mvc\Model\Criteria::fromInput($this->di, "\\Models\\Roles", $_POST); $query->order("id ASC, name ASC"); $this->persistent->searchParams = $query->getParams(); if (!\Helpers\Arr::is_array_empty($this->persistent->searchParams)) { $models = \Models\Roles::find($this->persistent->searchParams); } } else { $numberPage = $this->request->getQuery("page", "int"); if (!$numberPage or $numberPage <= 0) { $numberPage = 1; } if ($numberPage > 1 and !\Helpers\Arr::is_array_empty($this->persistent->searchParams)) { $models = \Models\Roles::find($this->persistent->searchParams); } else { //$models = \Models\Roles::query()->order("id ASC, name ASC")->execute(); $models = \Models\Roles::find(); $this->persistent->searchParams = null; } } if (count($models) == 0) { $this->flashSession->notice("Не найдено"); $this->persistent->searchParams = null; } $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $models, "limit" => 10, "page" => $numberPage)); $page = $paginator->getPaginate(); $this->view->setVar("page", $page); //$this->view->setVar('searchparams', $this->persistent->searchParams); //$this->view->setVar('numpage', $numberPage); }
/** * user list */ public function indexAction() { $page = $this->request->getQuery('page', 'int', 1); $users = Users::find(); $paginator = new Model(array('data' => $users, 'limit' => 20, 'page' => $page)); $this->view->page = $paginator->getPaginate(); }
public function articleAction() { $posts = Post::find(['type = "post" AND id_web = "' . $this->auth->id_web . '" order by id desc']); $paginator = new PaginatorModel(array("data" => $posts, "limit" => $this->params->limit, "page" => $this->params->page)); $page = $paginator->getPaginate(); $this->view->setVar("page", $page); }
public function indexAction() { $indexProducts = Products::find(array("limit" => 5, "order" => "id asc")); $products = Products::find(array("order" => "id asc")); $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $products, "limit" => 8, "page" => $dynamicPageBegin)); $this->view->page = $paginator->getPaginate(); $this->view->indexProducts = $indexProducts; }
public function getList() { if (self::count() == 0) { return false; } $paginator = new PaginatorModel(array("data" => self::findBymerchantId(1), "limit" => 10, "page" => @(int) $_GET["page"])); return $paginator->getPaginate(); }
public function indexAction() { $currentPage = $this->request->getQuery('page', 'int', 1); $posts = Post::find(['status > 0', 'order' => 'id DESC']); $paginator = new Paginator(['data' => $posts, 'limit' => Post::DEFAULT_POSTS_ON_PAGE, 'page' => $currentPage]); $this->view->setVar('title', 'Posts | '); $this->view->setVar('page', $paginator->getPaginate()); }
/** * 用户管理主页 */ public function webAction() { $numberPage = $this->request->getQuery("page", "int") ? $this->request->getQuery("page", "int") : 1; //$parameters["id"] = '3'; $data = SunUser::find(); $paginator = new Paginator(array("data" => $data, "limit" => 10, "page" => $numberPage)); $this->view->page = $paginator->getPaginate(); }
/** * user list */ public function indexAction($page = 1) { $parameters["order"] = "id desc"; // $parameters['conditions'] = 'username = :username:'******'bind'] = array('username'=>'seiven'); $users = Users::find($parameters); $paginator = new Model(array('data' => $users, 'limit' => 20, 'page' => $page)); $this->view->page = $paginator->getPaginate(); }
/** * Paginates given Resource. By default paginates ::find of caller Model. * * @param null $resource : Resource to be paginated * @return Response */ public function paginate($resource = null) { if (empty($resource)) { $full_path = explode('\\', get_called_class()); $className = 'App\\Models\\' . str_replace('sController', '', end($full_path)); $resource = $className::find(); } $paginator = new PaginatorModel(array('data' => $resource, 'limit' => 10, 'page' => (int) $this->request->getQuery('page', 'int', '1'))); return new Response(json_encode($paginator->getPaginate())); }
/** * Index action - display all tariffs * * @package las * @version 1.0 */ public function indexAction() { $this->tag->setTitle(__('Tariffs')); // Available sort to choose $this->filter->add('in_array', function ($value) { return in_array($value, ['amount', 'amount DESC', 'downloadCeil', 'downloadCeil DESC', 'name', 'name DESC', 'priority', 'priority DESC', 'uploadCeil', 'uploadCeil DESC']) ? $value : null; }); // Get tariffs and prepare pagination $paginator = new Paginator(["data" => Tariffs::find(['order' => $this->request->getQuery('order', 'in_array', 'id', true)]), "limit" => $this->request->getQuery('limit', 'int', 20, true), "page" => $this->request->getQuery('page', 'int', 1, true)]); $this->view->setVars(['pagination' => $paginator->getPaginate(), 'bitRate' => \Las\Models\Settings::options('bitRate', $this->las['general']['bitRate'])]); }
/** * Index action - display all networks * * @package las * @version 1.0 */ public function indexAction() { $this->tag->setTitle(__('Networks')); // Available sort to choose $this->filter->add('in_array', function ($value) { return in_array($value, ['interface', 'interface DESC', 'name', 'name DESC', 'subnetwork', 'subnetwork DESC', 'status', 'status DESC', 'type', 'type DESC']) ? $value : null; }); // Get networks and prepare pagination $paginator = new Paginator(["data" => Networks::find(['order' => $this->request->getQuery('order', 'in_array', 'id', true)]), "limit" => $this->request->getQuery('limit', 'int', 20, true), "page" => $this->request->getQuery('page', 'int', 1, true)]); $this->view->setVars(['pagination' => $paginator->getPaginate(), 'bitRate' => Settings::options('bitRate', $this->las['general']['bitRate'])]); }
/** * Index action - display all firewalls * * @package las * @version 1.0 */ public function indexAction() { $this->tag->setTitle(__('Firewalls')); // Available sort to choose $this->filter->add('in_array', function ($value) { return in_array($value, ['name', 'name DESC', 'status', 'status DESC']) ? $value : null; }); // Get networks and prepare pagination $paginator = new Paginator(["data" => Firewalls::find(['order' => $this->request->getQuery('order', 'in_array', 'id', true)]), "limit" => $this->request->getQuery('limit', 'int', 20, true), "page" => $this->request->getQuery('page', 'int', 1, true)]); $this->view->setVars(['pagination' => $paginator->getPaginate()]); }
public function indexAction($maker_id = null, $product_id = null) { if ($this->request->isPost()) { $redirect = "revaluation/index"; $input_maker = $this->request->getPost('maker_id'); if (!empty($input_maker)) { if (preg_match('/^\\d+$/', $input_maker)) { $maker_id = $input_maker; } else { $maker_id = PMaker::findFirst("name='{$input_maker}'")->id; } // $maker_id = $this->request->getPost('maker_id', 'int'); $redirect = "revaluation/index/{$maker_id}"; // return $this->response->redirect("revaluation/index/$maker_id"); } if (!empty($this->request->getPost('product_id', 'int'))) { $product_id = $this->request->getPost('product_id', 'int'); if ($find_product = PProductMain::findFirst($product_id)) { $maker_id = $find_product->maker_id; $redirect = "revaluation/index/{$maker_id}/{$product_id}"; } else { $redirect = "revaluation/index"; } // return $this->response->redirect("revaluation/index/$maker_id/$product_id"); } return $this->response->redirect($redirect); } if ($maker_id != null) { // Find maker $and_prod_id = $product_id != null ? " AND id={$product_id}" : null; $maker = PMaker::findFirst($maker_id); if (!$maker) { $this->flash->error("Мастер с id {$maker_id} не найден!"); return $this->response->redirect("revaluation/index"); } $maker_products = PProductMain::find("parent=0 AND maker_id={$maker_id}" . $and_prod_id); $maker_count = PProductMain::count("parent=0 AND maker_id={$maker_id}" . $and_prod_id); $this->view->maker = $maker->name; $this->view->maker_count = $maker_count; $this->view->maker_curr = $maker->currencystr; // Currency rate // $this->view->crosscurr = PCrosscurrency::findFirst("title='{$maker->currencystr}'")->currencyrate; // Paginator $perpage = $this->request->getQuery('perpage', 'int') ? $this->request->getQuery('perpage', 'int') : 50; $page = $this->request->getQuery('page', 'int') ? $this->request->getQuery('page', 'int') : 1; $paginator = new Paginator(["data" => $maker_products, "limit" => $perpage, "page" => $page]); $this->view->page = $paginator->getPaginate(); } // All makers // $this->view->makers_list = array_column(PMaker::find(["name IS NOT NULL AND isseller=1 AND approved=1 AND (banned=0 OR banned IS NULL)", 'order' => 'name ASC'])->toArray(), 'name', 'id'); $this->view->maker_id = $maker_id; $this->view->requests = PRevaluation::find(['active=1', 'order' => 'created DESC']); }