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


PHP Model::getPaginate方法代码示例

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


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

示例1: paging

 public function paging($data)
 {
     $currentPage = (int) $_GET['page'];
     $paginator = new PaginatorModel(array("data" => $data, "limit" => 10, "page" => $currentPage));
     $page = $paginator->getPaginate();
     return $page;
 }
开发者ID:xw716825,项目名称:xw,代码行数:7,代码来源:ModelBase.php

示例2: searchAction

 /**
  * 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();
 }
开发者ID:munozdaniel,项目名称:sya,代码行数:30,代码来源:OperadoraController.php

示例3: indexAction

 /**
  * 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();
 }
开发者ID:gn0st1k4m,项目名称:phalconBlog,代码行数:10,代码来源:CommentsController.php

示例4: indexAction

 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();
     }
 }
开发者ID:JosTrucD,项目名称:phalcon-news,代码行数:27,代码来源:NewsController.php

示例5: searchAction

 /**
  * 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();
 }
开发者ID:Jonhathan-Rodas,项目名称:ranchogrande,代码行数:31,代码来源:UsuarioController.php

示例6: indexAction

	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;		
	}
开发者ID:Kefir92,项目名称:home-bookkeeping,代码行数:27,代码来源:ElementsController.php

示例7: paging

 /**
  * ページングを実行する
  * 指定がなければ最初(=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;
 }
开发者ID:muramoya,项目名称:kotori,代码行数:14,代码来源:ResourcesList.php

示例8: indexAction

 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();
 }
开发者ID:zhangkg,项目名称:phalcon_manage,代码行数:7,代码来源:RolesController.php

示例9: searchAction

 /**
  * 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();
 }
开发者ID:munozdaniel,项目名称:sya,代码行数:31,代码来源:EquipopozoController.php

示例10: listAction

 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');
     }
 }
开发者ID:JosTrucD,项目名称:phalcon-news,代码行数:26,代码来源:IndexController.php

示例11: indexAction

 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;
 }
开发者ID:alexz202,项目名称:goldenlight,代码行数:32,代码来源:RaiseProductController.php

示例12: searchAction

 /**
  * 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();
 }
开发者ID:Jonhathan-Rodas,项目名称:ranchogrande,代码行数:28,代码来源:VehiculoController.php

示例13: indexAction

 /**
  * 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();
 }
开发者ID:vietdh85,项目名称:product-vh,代码行数:10,代码来源:UsersController.php

示例14: searchAction

 /**
  * 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;
     }
 }
开发者ID:munozdaniel,项目名称:sya,代码行数:34,代码来源:PlanillaController.php

示例15: searchAction

 /**
  * 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();
 }
开发者ID:esironal,项目名称:sandbox-1,代码行数:28,代码来源:WaypointsController.php


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