Skip to content

Commit

Permalink
New config parms THEMES_CHOOSABLE and MAX_BBOX. Moved to defines like…
Browse files Browse the repository at this point in the history
… other parms
  • Loading branch information
elpaso committed Mar 17, 2014
1 parent f63604a commit 0e55d6b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions php/config.php.tpl
Expand Up @@ -4,7 +4,8 @@

Configuration for the search scripts

@copyright: 2014 by Alessandro Pasotti - ItOpen (http://www.itopen.it) <apasotti@gmail.com>
@copyright: 2014 by Alessandro Pasotti -
ItOpen (http://www.itopen.it) <apasotti@gmail.com>
@license: GNU AGPL, see COPYING for details.
*/

Expand All @@ -21,7 +22,7 @@

/**************************************
* search configuration
*/
*/
// Configuration for searchable layers
$searchlayers_config = array(
// Key is layer name
Expand All @@ -36,10 +37,10 @@ define('DEFAULT_SEARCH_LAYERS', 'Country');
// Limit search results
define('SEARCH_LIMIT', 100);
// make themes choosable in search combo
$themes_choosable = false);
define('THEMES_CHOOSABLE', false);
// zoom to this bbox if a layer is chosen in the search combo [minx, miny, maxx, maxy]
// set to null if extent should not be changed
$max_bbox = null;
define('MAX_BBOX', null);


/**************************************
Expand Down
12 changes: 6 additions & 6 deletions php/search.php
Expand Up @@ -4,8 +4,8 @@
Generic search: just like search.wsgi
@copyright: 2013 by Alessandro Pasotti ItOpen (http://www.itopen.it)
<apasotti@gmail.com>
@copyright: 2013-2014 by Alessandro Pasotti -
ItOpen (http://www.itopen.it) <apasotti@gmail.com>
@license: GNU AGPL, see COPYING for details.
*/

Expand All @@ -20,8 +20,9 @@
// Get project
$project = get_project($map);

if ($themes_choosable) {
if (defined('THEMES_CHOOSABLE') && THEMES_CHOOSABLE) {
$selectable = "1";
$max_bbox = defined('MAX_BBOX') ? MAX_BBOX : null;
} else {
$selectable = "0";
$max_bbox = null;
Expand Down Expand Up @@ -63,7 +64,7 @@ function build_postgis_search_query($dbtable, $search_column, $geom_column, $lay
}
#for each querystring
for($j = 0; $j < count($querystrings); $j++){

$sql .= "$search_column ILIKE '%" . $querystrings[$j] . "%'";

if ($j < count($querystrings) - 1){
Expand Down Expand Up @@ -91,7 +92,7 @@ function build_spatialite_search_query($dbtable, $search_column, $geom_column, $
}
#for each querystring
for($j = 0; $j < count($querystrings); $j++){

$sql .= "$search_column LIKE '%" . $querystrings[$j] . "%'";

if ($j < count($querystrings) - 1){
Expand Down Expand Up @@ -137,7 +138,6 @@ function build_spatialite_search_query($dbtable, $search_column, $geom_column, $
$sql .= ' LIMIT ' . SEARCH_LIMIT;
}
$sql .= ';';
//die($sql);
// Get connection from the last layer
$dbh = get_connection($layer, $project, $map);
$stmt = $dbh->prepare($sql);
Expand Down
3 changes: 2 additions & 1 deletion php/search_geom.php
Expand Up @@ -4,7 +4,8 @@
Get search geometry
@copyright: 2013 by Alessandro Pasotti - ItOpen (http://www.itopen.it) <apasotti@gmail.com>
@copyright: 2013-2014 by Alessandro Pasotti -
ItOpen (http://www.itopen.it) <apasotti@gmail.com>
@license: GNU AGPL, see COPYING for details.
*/

Expand Down

0 comments on commit 0e55d6b

Please sign in to comment.