/** * Add database navigation links * * @param array $categories * @return array */ public function getEditLink() { $controller = $this->request->getControllerName(); $switch = 'databases'; if ($controller == 'databases') { $switch = 'databases-edit'; } $params = $this->request->getParams(); $params['controller'] = $switch; return $this->request->url_for($params); }
/** * Get 'search' params out of the URL, organized into groupings for the * query object to parse * * @return array */ protected function extractSearchGroupings() { $arrFinal = array(); foreach ($this->request->getParams() as $key => $value) { $key = urldecode($key); // if we see 'query' as the start of a param, check if there are corresponding // entries for field and boolean; these will have a number after them // if coming from an advanced search form if (preg_match("/^query/", $key)) { if ($value == "") { continue; } $id = str_replace("query", "", $key); $arrTerm = array(); $arrTerm["id"] = $id; $arrTerm["query"] = $value; $arrTerm["relation"] = $this->request->getParam("relation{$id}"); $arrTerm["field"] = $this->request->getParam("field{$id}"); // boolean only counts if this is not the first query term if (count($arrFinal) > 0) { $arrTerm["boolean"] = $this->request->getParam("boolean{$id}"); } else { $arrTerm["boolean"] = ""; } array_push($arrFinal, $arrTerm); } } return $arrFinal; }
/** * The current search-related parameters * * @return array */ public function currentParams() { $params = $this->request->getParams(); $params['controller'] = $this->request->getParam('controller'); $params["action"] = $this->request->getParam("action"); $params["sort"] = $this->request->getParam("sort"); return $params; }