当前位置: 首页>>代码示例>>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;未经允许,请勿转载。