public function searchAction() { $numberPage = 1; if ($this->request->isPost()) { $query = Phalcon_Model_Query::fromInput("ProductTypes", $_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"; $producttypes = ProductTypes::find($parameters); if (count($producttypes) == 0) { Flash::notice("The search did not find any product types", "alert alert-info"); return $this->_forward("producttypes/index"); } $paginator = Phalcon_Paginator::factory("Model", array("data" => $producttypes, "limit" => 10, "page" => $numberPage)); $page = $paginator->getPaginate(); $this->view->setVar("page", $page); $this->view->setVar("producttypes", $producttypes); }
public function indexAction() { if (!$this->request->isPost()) { Phalcon_Flash::notice('This is a sample application of the Phalcon PHP Framework. Please don\'t provide us any personal information. Thanks', 'alert alert-info'); } }