/** * @param View $view */ protected function _renderJsonp(View $view) { $content = $this->getResponse()->setContentType('application/json')->setJsonContent($view->getParamsToView())->getContent(); $content = $this->request->get('callback') . '(' . $content . ')'; $this->response->setContent($content)->send(); $view->setRenderLevel(View::LEVEL_NO_RENDER); }
public function indexAction() { $request = new Request(); $this->view->setVar("title", "Інспектори"); $search = trim($request->get("search")); $pageCount = $request->get("page-count") ? $request->get("page-count") : $this->session->get("page-count"); if ($pageCount) { $this->session->set("page-count", $pageCount); } $orderColumn = trim($request->get("order-column")) . " " . trim($request->get("order-type")); $offset = $request->get("page") * $pageCount - $pageCount; $inspectorsQuery = \Users::query()->rightJoin("UserGroups")->where("UserGroups.group_id = 3"); $pageCount = $pageCount ? $pageCount : self::$ITEMS_ON_PAGE; $inspectorsQuery->limit($pageCount, $offset >= 0 ? $offset : null); if ($orderColumn and !empty($orderColumn)) { $inspectorsQuery->orderBy(trim($orderColumn) ? $orderColumn : "last_name ASC"); } if ($search and !empty($search)) { $searchBind = "'%" . $search . "%'"; $inspectorsQuery->andWhere("name LIKE {$searchBind} OR last_name LIKE {$searchBind} OR second_name LIKE {$searchBind} OR email LIKE {$searchBind} OR pmobile LIKE {$searchBind}"); } $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $inspectorsQuery->execute(), "limit" => $pageCount ? $pageCount : self::$ITEMS_ON_PAGE, "page" => $request->get("page"))); $page = $paginator->getPaginate(); $this->view->page = $page; $this->view->countItems = count($page->items); $this->view->search = $search; $this->view->orderColumn = $request->get("order-column"); $this->view->orderType = $request->get("order-type"); $this->view->pageCount = $pageCount; }
/** * 初始化所有请求参数 */ protected static function initParam() { if (self::$request === null) { self::$request = new Request(); } self::$all_param = self::$request->get(); if (isset(self::$all_param['__QP_url'])) { unset(self::$all_param['__QP_url']); } self::$post_param = self::$request->getPost(); self::$non_post_param = array_diff(self::$all_param, self::$post_param); }
public function reset() { if (!$this->multiLocale) { return; } $this->request or $this->request = static::$di->getShared('request'); if ($locale = $this->request->get('_locale')) { $this->_setLocale($locale); return; } if (($cookie = Cookies::get('locale')) && ($locale = $cookie->useEncryption(false)->getValue())) { $this->_setLocale($locale); $cookie->setHttpOnly(false)->delete(); return; } if ($locale = Session::get('current_locale')) { $this->loadLocale($this->currentLocale = $locale); return; } // @codeCoverageIgnoreStart if ($this->detectClientLocale) { $this->_setLocale($this->request->getBestLanguage()); return; } // @codeCoverageIgnoreEnd $this->loadLocale($this->currentLocale = $this->defaultLocale); }
function execute() { try { $this->properties = array_merge($this->request->get()); $this->checkParams($this->properties, $this->getParamRules()); $this->returnData = $this->doExecute(); } catch (\Exception $e) { $this->returnType = self::RETURN_TYPE_JSON; $this->returnData = $this->error($e->getCode(), $e->getMessage()); } }
public function indexAction() { $request = new Request(); $this->view->setVar("title", "Дилери"); $search = trim($request->get("search")); $pageCount = $request->get("page-count") ? $request->get("page-count") : $this->session->get("page-count"); if ($pageCount) { $this->session->set("page-count", $pageCount); } $orderColumn = trim($request->get("order-column")) . " " . trim($request->get("order-type")); $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => \Dealers::find(array("order" => trim($orderColumn) ? $orderColumn : "title ASC", "conditions" => "title LIKE ?1 OR address LIKE ?1 ", "bind" => array(1 => "%" . $search . "%"))), "limit" => $pageCount ? $pageCount : 30, "page" => $request->get("page"))); $page = $paginator->getPaginate(); $this->view->page = $page; $this->view->countItems = count($page->items); $this->view->search = $search; $this->view->orderColumn = $request->get("order-column"); $this->view->orderType = $request->get("order-type"); $this->view->pageCount = $pageCount; }
public function indexAction() { $this->view->title = $this->trans->_("students"); $request = new Request(); $students = \Students::find(); $search = trim($request->get("search")); $pageCount = $request->get("page-count") ? $request->get("page-count") : $this->session->get("page-count"); if ($pageCount) { $this->session->set("page-count", $pageCount); } $orderColumn = trim($request->get("order-column")) . " " . trim($request->get("order-type")); $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => \Students::find(array("order" => trim($orderColumn) ? $orderColumn : "id ASC", "conditions" => "id LIKE ?1 ", "bind" => array(1 => "%" . $search . "%"))), "limit" => $pageCount ? $pageCount : 30, "page" => $request->get("page"))); $page = $paginator->getPaginate(); $this->view->page = $page; //$this->view->users=$students->; $this->view->countItems = count($page->items); $this->view->search = $search; $this->view->orderColumn = $request->get("order-column"); $this->view->orderType = $request->get("order-type"); $this->view->pageCount = $pageCount; }
/** * @param \Phalcon\Http\Request $request * @return array All request params (GET, POST, PUT, RawJsonBody) */ public static function getMergeParams(Request $request) { $jsonRawBody = (array) $request->getJsonRawBody(true); $params = array_merge((array) $request->get(), (array) $request->getPost(), (array) $request->getPut(), $jsonRawBody); return self::convertDate($params, $request->getDI()); }
public function get($name = null, $filters = null, $defaultValue = null, $notAllowEmpty = false, $noRecursive = false) { return parent::get($name, $filters, $defaultValue, $notAllowEmpty, $noRecursive); }
/** * Логирует запрос * @param \Phalcon\Http\Request $request */ public function log(Request $request) { $token = trim($request->get('token')); $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $host = parse_url($referer); $host = $host['host']; if ($token != '') { $this->googleTracker->setClientID($token); } $page = new \Racecore\GATracking\Tracking\Page(); $page->setDocumentPath($referer != '' ? $referer : '/'); $page->setDocumentTitle($referer != '' ? $referer : 'Direct'); $this->googleTracker->addTracking($page); $event = new \Racecore\GATracking\Tracking\Event(); $event->setEventCategory('Token_' . $request->get('token')); $event->setEventLabel($host); $event->setEventAction('Hit'); $this->googleTracker->addTracking($event); try { $this->googleTracker->send(); } catch (Exception $e) { //echo 'Error: ' . $e->getMessage() . '<br />' . "\r\n"; //echo 'Type: ' . get_class($e); } }
public function getSignatureMethod() { return $this->request->get('oauth_signature_method'); }