querySpecial = $this->getHttpValue($request, 'my_new_parameter_name'); // NEW } public function buildRequest() { if (!$this->querySpecial) { // NEW if (!is_null($this->shape) || (!is_null($this->queryState) && count($this->queryState->querySelections) > 0)) { $queryRequest = new QueryRequest(); $queryRequest->queryAllLayers = $this->queryState->queryAllLayers; $queryRequest->defaultMaskMode = self::DEFAULT_MASKMODE; if (!is_null($this->getConfig()->defaultMaskmode)) { $queryRequest->defaultMaskMode = $this->getConfig()->defaultMaskmode; } $queryRequest->defaultHilight = self::DEFAULT_HILIGHT; if (!is_null($this->getConfig()->defaultHilight)) { $queryRequest->defaultHilight = $this->getConfig()->defaultHilight; } $queryRequest->defaultTableFlags = new TableFlags(); $queryRequest->defaultTableFlags->returnAttributes = self::DEFAULT_ATTRIBUTES; if (!is_null($this->getConfig()->defaultAttributes)) { $queryRequest->defaultTableFlags->returnAttributes = $this->getConfig()->defaultAttributes; } $queryRequest->defaultTableFlags->returnTable = self::DEFAULT_TABLE; if (!is_null($this->getConfig()->defaultTable)) { $queryRequest->defaultTableFlags->returnTable = $this->getConfig()->defaultTable; } $queryRequest->querySelections = $this->queryState->querySelections; $queryRequest->shape = $this->shape; return $queryRequest; } return null; } } public function initializeResult($queryResult) { if (empty($queryResult) && !$this->querySpecial) // NEW return; if (!$this->querySpecial) { // NEW $queryResult = $this->processResult($queryResult); $tablesPlugin = $this->cartoclient->getPluginManager()->tables; $tablesPlugin->addTableGroups($queryResult->tableGroup); } } protected function drawQuery() { $smarty = new Smarty_Plugin($this->getCartoclient(), $this); if ($this->getConfig()->displayExtendedSelection) { $queryLayers = array(); $queryLayersLabel = array(); $this->getLayers($queryLayers, $queryLayersLabel); $selections = array(); for ($i = 0; $i < count($queryLayers); $i++) { $selection = new stdClass(); $selection->layerId = $queryLayers[$i]; $selection->layerLabel = $queryLayersLabel[$i]; foreach ($this->queryState->querySelections as $querySelection) { if ($querySelection->layerId == $queryLayers[$i]) { $selection->useInQuery = $querySelection->useInQuery; $selection->policy = $querySelection->policy; $selection->maskMode = $querySelection->maskMode; $selection->hilight = $querySelection->hilight; $selection->returnAttributes = $querySelection->tableFlags->returnAttributes; $selection->returnTable = $querySelection->tableFlags->returnTable; break; } } $selections[] = $selection; } $smarty->assign('query_selections', $selections); $smarty->assign('query_alllayers', $this->queryState->queryAllLayers); $smarty->assign('query_hilightattr_active', $this->getConfig()->returnAttributesActive); } $smarty->assign('query_display_selection', $this->getConfig()->displayExtendedSelection); // NEW if ($this->querySpecial) { $smarty->assign('specialQueryWhatever', true); // this is to activate a template part } // OR /* if ($this->querySpecial) { $smarty->assign('specialQueryWhatever', true); // this is to activate a template part $smarty->assign('specialQueryResult', $this->getSpecialQueryResult()); } */ return $smarty->fetch('query.tpl'); } /* private function getSpecialQueryResult() { require_once(path/to/your/special/query/phpfile.php'); $specialQuery = new specialQuery(); // defined in your external php file // call a function, passing the spacial query parameter $result = $specialQuery->callSomeFunctionInSpecialQuery($this->querySpecial) return $result; } */ } ?>