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


PHP Adapter\Model类代码示例

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


在下文中一共展示了Model类的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: 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

示例3: 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

示例4: 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

示例5: getPage

 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;
     }
 }
开发者ID:Robert-Xie,项目名称:phalcon-webmis,代码行数:34,代码来源:Inc.php

示例6: indexAction

 /**
  * 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);
 }
开发者ID:devsnippet,项目名称:city_site,代码行数:36,代码来源:RolesController.php

示例7: indexAction

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

示例8: articleAction

 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);
 }
开发者ID:ametsuramet,项目名称:eazy-dashboard,代码行数:7,代码来源:PostController.php

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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