當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model\Criteria類代碼示例

本文整理匯總了PHP中Phalcon\Mvc\Model\Criteria的典型用法代碼示例。如果您正苦於以下問題:PHP Criteria類的具體用法?PHP Criteria怎麽用?PHP Criteria使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Criteria類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: response

 /**
  * @param Criteria $query
  * @return HttpResponse
  */
 public function response(Criteria $query)
 {
     if ($this->getPayload()->getOrder()) {
         $query->orderBy($this->getPayload()->getOrderQuery());
     }
     $response = new CollectionResponsePayload($query, $this->createMeta($query));
     return new HttpResponse($response);
 }
開發者ID:alevikzs,項目名稱:phrest,代碼行數:12,代碼來源:Collection.php

示例2: buildWhere

 /**
  * @param string $preparedUrl
  * @return null|string
  */
 private static function buildWhere($preparedUrl)
 {
     $criteria = new Criteria();
     $andList = explode('|', $preparedUrl);
     $andList = array_filter($andList);
     foreach ($andList as $condition) {
         $criteria->andWhere(self::buildOR($condition));
     }
     return $criteria->getWhere();
 }
開發者ID:sergeytkachenko,項目名稱:phalcon-rest-jpa,代碼行數:14,代碼來源:Operators.php

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

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

示例5: searchAction

 public function searchAction()
 {
     $numberPage = 1;
     if ($this->request->isPost()) {
         $query = Criteria::fromInput($this->di, "Categories", $_POST);
         $this->session->conditions = $query->getConditions();
     } else {
         $numberPage = $this->request->getQuery("page", "int");
         if ($numberPage <= 0) {
             $numberPage = 1;
         }
     }
     $parameters = array();
     if ($this->session->conditions) {
         $parameters["conditions"] = $this->session->conditions;
     }
     $parameters["order"] = "id";
     $categories = Categories::find($parameters);
     if (count($categories) == 0) {
         $this->flash->notice("The search did not find any categories");
         return $this->dispatcher->forward(array("controller" => "categories", "action" => "index"));
     }
     $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $categories, "limit" => 10, "page" => $numberPage));
     $page = $paginator->getPaginate();
     $this->view->setVar("page", $page);
 }
開發者ID:alawnchen,項目名稱:blog-tutorial,代碼行數:26,代碼來源:CategoriesController.php

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

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

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

示例9: indexAction

 /**
  * list
  */
 public function indexAction()
 {
     error_reporting(E_ALL & ~E_NOTICE);
     //$this->persistent->parameters = null;
     $numberPage = 1;
     if ($this->request->isPost()) {
         $query = Criteria::fromInput($this->di, "Topic", $_POST);
         $this->persistent->parameters = $query->getParams();
     } else {
         $numberPage = $this->request->getQuery("page", "int");
     }
     if ($numberPage == null) {
         $this->persistent->parameters = null;
     }
     $parameters = $this->persistent->parameters;
     if (!is_array($parameters)) {
         $parameters = array();
     }
     if ($this->request->getPost("topic")) {
         $parameters["conditions"] .= " and topictype = 2 and status = 0";
         //status:
     } else {
         $parameters["conditions"] = "topictype = 2 and status = 0";
         //status:
     }
     //$parameters["order"] = "id";
     $builder = $this->modelsManager->createBuilder()->columns('*')->from('Topic')->where($parameters['conditions'], $parameters['bind'])->orderBy('id');
     $paginator = new PaginatorQueryBuilder(array("builder" => $builder, "limit" => 20, "page" => $numberPage));
     $this->view->page = $paginator->getPaginate();
 }
開發者ID:w3yyb,項目名稱:phalphp,代碼行數:33,代碼來源:TopicController.php

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

示例11: indexAction

 public function indexAction()
 {
     $numberPage = 1;
     if ($this->request->isPost()) {
         $query = \Phalcon\Mvc\Model\Criteria::fromInput($this->di, "Models\\News", $_POST);
         $query->order("id ASC, title ASC");
         $this->persistent->searchParams = $query->getParams();
         if (!\Helpers\Arr::is_array_empty($this->persistent->searchParams)) {
             $news = \Models\News::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)) {
             $news = \Models\News::find($this->persistent->searchParams);
         } else {
             $news = \Models\News::find();
             $this->persistent->searchParams = null;
         }
     }
     if (count($news) == 0) {
         $this->flashSession->notice("Не найдено ни одной новости");
         $this->persistent->searchParams = null;
     }
     $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $news, "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,代碼行數:32,代碼來源:NewsController.php

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

示例13: searchAction

 public function searchAction()
 {
     $numberPage = 1;
     if ($this->request->isPost()) {
         $query = Criteria::fromInput($this->di, "Companies", $_POST);
         $this->persistent->searchParams = $query->getParams();
     } else {
         $numberPage = $this->request->getQuery("page", "int");
         if ($numberPage <= 0) {
             $numberPage = 1;
         }
     }
     $parameters = array();
     if ($this->persistent->searchParams) {
         $parameters = $this->persistent->searchParams;
     }
     $companies = Department::find($parameters);
     if (count($companies) == 0) {
         $this->flash->notice("沒有找到對應的部門");
         return $this->forward("companies/index");
     }
     $paginator = new Phalcon\Paginator\Adapter\Model(array("data" => $companies, "limit" => 10, "page" => $numberPage));
     $page = $paginator->getPaginate();
     $this->view->setVar("page", $page);
     $this->view->setVar("companies", $companies);
 }
開發者ID:lookingatsky,項目名稱:zhonghewanbang,代碼行數:26,代碼來源:CompaniesController.php

示例14: searchAction

 public function searchAction()
 {
     $numberPage = 1;
     if ($this->request->isPost()) {
         $query = Criteria::fromInput($this->di, "Products", $_POST);
         $this->persistent->searchParams = $query->getParams();
     } else {
         $numberPage = $this->request->getQuery("page", "int");
         if ($numberPage <= 0) {
             $numberPage = 1;
         }
     }
     $parameters = array();
     if ($this->persistent->searchParams) {
         $parameters = $this->persistent->searchParams;
     }
     $products = Products::find($parameters);
     if (count($products) == 0) {
         $this->flash->notice("The search did not find any products");
         return $this->forward("products/index");
     }
     $paginator = new Phalcon\Paginator\Adapter\Model(array("data" => $products, "limit" => 5, "page" => $numberPage));
     $page = $paginator->getPaginate();
     $this->view->setVar("page", $page);
 }
開發者ID:Rho1and0,項目名稱:invo,代碼行數:25,代碼來源:ProductsController.php

示例15: searchAction

 /**
  * Searches for motorbikes
  */
 public function searchAction()
 {
     if ($this->request->isPost()) {
         $query = Criteria::fromInput($this->di, "MotorBike\\Models\\Motorbikes", $this->request->getPost());
         $this->persistent->parameters = $query->getParams();
     }
     return $this->listAction();
 }
開發者ID:sr-hosseini,項目名稱:motorbike,代碼行數:11,代碼來源:MotorbikesController.php


注:本文中的Phalcon\Mvc\Model\Criteria類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。