/** * SEARCH VIA ATTRIBUTES */ function q_execAttributeQuery() { // Definition of search parameters with external methods if (isset($_REQUEST['externalSearchDefinition'])) { $this->qLayerName = $_REQUEST['layerName']; $this->qSearchLayerType = $_REQUEST['layerType']; $fldName = $_REQUEST['fldName']; $this->qStr = $_REQUEST['qStr']; pm_logDebug(3, $_REQUEST, "Parameters for REQUEST array \nfile: query.php->q_execAttributeQuery \n"); // Default using search.xml definitions } else { $searchitem = $_REQUEST['searchitem']; foreach ($_REQUEST as $key => $val) { if ($key != "findlist" && $key != "searchitem") { $searchArray[$key] = urldecode($val); //utf8_encode($val); } } $search = new XML_search($this->map, $_SESSION['PM_SEARCH_CONFIGFILE']); $searchParams = $search->getSearchParameters($this->map, $searchitem, $searchArray); $this->qLayerName = $searchParams['layerName']; $this->qSearchLayerType = $searchParams['layerType']; $fldName = $searchParams['firstFld']; $this->qStr = $searchParams['qStr']; pm_logDebug(2, $searchArray, "Parameters for searchArray \nfile: query.php->q_execAttributeQuery \n"); pm_logDebug(2, $searchParams, "Parameters for searchParams \nfile: query.php->q_execAttributeQuery"); } // Return layer type $this->qLayer = $this->map->getLayerByName($this->qLayerName); //$this->qSearchLayerType = $this->qLayer->connectiontype; // Get group and glayer objects $GroupGlayer = PMCommon::returnGroupGlayer($this->qLayerName); $this->grp = $GroupGlayer[0]; $this->glayer = $GroupGlayer[1]; $this->XYLayerProperties = $this->glayer->getXYLayerProperties(); $this->layerEncoding = $this->glayer->getLayerEncoding(); if ($this->qSearchLayerType == "shape" || $this->qSearchLayerType == "ms" || $this->qSearchLayerType == "oracle") { if ($layFilter = $this->qLayer->getFilterString()) { $mapLayerFilterItem = $this->qLayer->filteritem; if ($layFilter[0] == '/') { $operator = '=~'; } else { $operator = '='; } $this->qStr = "(\"[{$mapLayerFilterItem}]\" {$operator} {$layFilter} AND ({$this->qStr}) )"; pm_logDebug(3, $this->qStr, "query string including FILTER -- query.php->q_execAttributeQuery"); } if ($this->qSearchLayerType == "oracle") { @$this->qLayer->queryByAttributes(null, $this->qStr, MS_MULTIPLE); } else { @$this->qLayer->queryByAttributes($fldName, $this->qStr, MS_MULTIPLE); } } }
<?php require_once "../pmsession.php"; require_once "../globals.php"; require_once "../common.php"; require_once "../query/search.php"; $action = $_REQUEST['action']; $search = new XML_search($map, $_SESSION['PM_SEARCH_CONFIGFILE']); if ($action == 'optionlist') { $search->validateSearchXML(); $searchJson = $search->createSearchOptions(); $divelem = '1'; } else { $searchitem = $_REQUEST['searchitem']; $searchJson = $search->createSearchItem($searchitem); $divelem = '2'; } //error_log($searchJson); header("Content-Type: text/plain; charset={$defCharset}"); $searchJson = str_replace("\\'", "'", $searchJson); // return JS object literals "{}" for XMLHTTP request echo "{\"searchJson\":{$searchJson}, \"action\":\"{$action}\", \"divelem\":\"{$divelem}\"}";