Files
oc-server3/htdocs/lib2/logic/npas.inc.php
T
following f5565a918c ported search.php & tools to lib2, and ...
- fixed logentry sorting for logs with identical date
- fixed ä etc. display in short descriptions on search results page
- try to select a matching language for the short descriptions
- added some translations
- hide download and map links if no search results (updates #235)
- nicer display of selectlocid page
- use site-dependent urls in GPX, LOC, TXT and KML
- unified XML encoding, now all done via two functions in lib2/util.inc.php (updates #121)
- some preventive XML encoding adjustments in GPX
- removed XML encoding in LOC CDATA section
- improved charset conversion for OVL and OV2 output
- some optimizations
- discarded lots of obsolete code
- disabled debug mode force_compile in OcSmarty class (performance)
2013-07-13 12:38:57 +02:00

52 lines
1.5 KiB
PHP

<?php
/****************************************************************************
For license information see doc/license.txt
Unicode Reminder メモ
Nature Protection Area functions
****************************************************************************/
function get_npas($cache_id)
{
$rsNPA = sql(
"SELECT `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName`
FROM `cache_npa_areas`
INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id`
INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id`
WHERE `cache_npa_areas`.`cache_id`='&1'
GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`
ORDER BY `npa_types`.`ordinal` ASC",
$cache_id);
$npas = array();
while ($rNPA = sql_fetch_array($rsNPA))
$npas[] = $rNPA;
sql_free_result($rsNPA);
return $npas;
}
function get_desc_npas($cache_id)
{
global $opt;
$npas = get_npas($cache_id);
if ($npas)
{
$desc = "<p>" . str_replace('%1',$opt['cms']['npa'], _('This geocache is probably placed within the following nature protection areas (<a href="%1">Info</a>):')) . "</p>\n" .
"<ul>\n";
foreach ($npas as $npa)
$desc .= "<li>" . $npa['npaTypeName'] . ": <a href='http://www.google.de/search?q=".urlencode($npa['npaTypeName'].' '.$npa['npaName'])."' target='_blank'>" . $npa['npaName'] . "</a></li>\n";
$desc .= "</ul>\n";
}
else
$desc = "";
return $desc;
}
?>