Location: PHPKode > projects > AppForMap > appformap/includes/postgisquery_dialog.php
<?
global $pg_query_layer_array;
global $postGisQueryName;
global $pg_select_layer;
global $postGisQuerable;
global $languageText;
global $SFSQLselect;
global $themeQuery;
global $jsTableCheck;
global $wfsTree;

$QuerytypeText = $languageText[queryType];
$queryfunctionText = $languageText[SFSQLfunction];
$querytableText = $languageText[queryLayers];
$submitText = "<b>$languageText[submitQuery]</b>";
$lineText=$languageText[line];
$pointText=$languageText[point];
$polygonText=$languageText[polygon];
$rectangleText=$languageText[rectangle];
$featureText=$languageText[theme];

echo "<table cellpadding=3 width=100% cellspacing=3><tr><td class='layout-table'>$querytableText<br>";
$query = "select * from geometry_columns";
@ $result = pg_exec($this -> connect(), $query);
@ $num_results = pg_numrows($result);
if (!$result) echo "No PostGIS layers available";
$u = 0;
for ($i = 0; $i < $num_results; $i ++)
{
	$temp = "pg_query_layer_$i";
	global $$temp;
	@ $row = pg_fetch_array($result);
	if ($postGisQuerable[strtoupper($row[f_table_name])]!="false") {
	echo "<input id='$row[f_table_name]' type='checkbox' name='pg_query_layer_$i' value='$row[f_table_name]'";
	$temp = "pg_query_layer_$i";
	if ($$temp == $row[f_table_name])
	{
		echo " checked";
	}
	echo ">";
	if ($themeQuery==true){
	echo "<input type='radio' name='pg_select_layer' value='$row[f_table_name]'";

	if ($pg_select_layer == $row[f_table_name])
	{
		echo " checked";
	}
	echo ">";
	}
	if ($geoTypeText) $geoType="(".$this->getGeometryColumns($row[f_table_name],"type").")";
	if ($postGisQueryName[strtoupper($row[f_table_name])] != "")
		echo $postGisQueryName[strtoupper($row[f_table_name])]." ".$geoType."<br>";
	else
		echo $row[f_table_name]." ".$geoType."<br>";
	}
}
echo "</td></tr>";

echo "<tr><td  class='layout-table'>$QuerytypeText &nbsp<br>";
echo "<input type='radio' name='pg_query_type' value='point' onClick='removeDiv();' ";

if ($this -> pg_query_type == 'point')
	echo " checked";
echo ">$pointText";

echo "<input type='radio' name='pg_query_type' value='line' ";
if ($this -> pg_query_type == 'line')
	echo " checked";
echo ">$lineText";


echo "<input type='radio' name='pg_query_type' value='rectangle' onClick='removeDiv();' ";
if ($this -> pg_query_type == 'rectangle' || $this -> pg_query_type=='')
	echo " checked";
echo ">$rectangleText";

echo "<input type='radio' name='pg_query_type' value='polygon' ";
if ($this -> pg_query_type == 'polygon')
	echo " checked";
echo ">$polygonText";


echo "<input ";
if ($themeQuery==false) echo "style='display:none";
echo "' type='radio' name='pg_query_type' value='feature' onClick='removeDiv();'";
if ($this -> pg_query_type == 'feature')
	echo "  checked";
echo ">";
if ($themeQuery==true) echo $featureText;

echo "</td></tr>";

if ($SFSQLselect==true){
   echo "<tr><td class='layout-table'>$queryfunctionText &nbsp<br><select style='font-family: arial, helvetica, sans-serif;font-size: 10;' name='pg_query_function'>";
echo "<option value='intersects' ";
if ($this -> pg_query_function == 'intersects')
	echo " SELECTED";
echo ">intersects";
echo "</option>";
echo "<option value='overlaps' ";
if ($this -> pg_query_function == 'overlaps')
	echo " SELECTED";
echo ">Overlaps";
echo "</option>";
echo "<option value='within' ";
if ($this -> pg_query_function == 'within')
	echo " SELECTED";
echo ">within";
echo "</option>";
echo "<option value='touches' ";
if ($this -> pg_query_function == 'touches')
	echo " SELECTED";
echo ">touches";
echo "</option>";
echo "</select>";
echo "</td></tr>";
} else $this -> pg_query_function = 'intersects';
echo "<tr><td class='layout-table'>";
echo "<a id='showPostGISsearch' style='display:none;color: #000000;font-size: 12;' href='javascript:submitPostgisQuery();'>$submitText</a>";
echo "";
//echo "&nbsp;&nbsp;Always draw&nbsp<input type='checkbox' name='alwaysDraw' checked></td></tr>";
//echo "</br><a style='color: #000000;' href='javascript:spliceArray();'>Delete</a>";
//echo "</br>Delete node<input type='text' name='node' value=''>";
echo "</table>";

echo "<input type='hidden' name='pg_query_layer_count' value='$i'>";
echo $jsTableCheck;
echo $wfsTree;
?>
Return current item: AppForMap