Beispiel #1
0
 // check XY home if OK redirect to myn
 if ($usr == true) {
     $ulat = $applicationContainer->getLoggedUser()->getHomeCoordinates()->getLatitude();
     $ulon = $applicationContainer->getLoggedUser()->getHomeCoordinates()->getLongitude();
     if ($ulon != NULL && $ulat != NULL || $ulon != 0 && $ulat != 0) {
         $distancecache = sprintf("%.2f", calcDistance($ulat, $ulon, $geocache->getCoordinates()->getLatitude(), $geocache->getCoordinates()->getLongitude()));
         tpl_set_var('distance_cache', '<img src="tpl/stdstyle/images/free_icons/car.png" class="icon16" alt="distance" title="" align="middle" />&nbsp;' . tr('distance_to_cache') . ': <b>' . $distancecache . ' km</b><br />');
     } else {
         tpl_set_var('distance_cache', '');
     }
 } else {
     tpl_set_var('distance_cache', '');
 }
 // check if there is geokret in this cache
 $thatquery = "SELECT gk_item.id, name, distancetravelled as distance FROM gk_item INNER JOIN gk_item_waypoint ON (gk_item.id = gk_item_waypoint.id) WHERE gk_item_waypoint.wp = :v1 AND stateid<>1 AND stateid<>4 AND stateid <>5 AND typeid<>2 AND missing=0";
 $params['v1']['value'] = (string) $geocache->getGeocacheWaypointId();
 $params['v1']['data_type'] = 'string';
 $s = $dbc->paramQuery($thatquery, $params);
 unset($params);
 //clear to avoid overlaping on next paramQuery (if any))
 $geokrety_all_count = $dbc->rowCount($s);
 if ($geokrety_all_count == 0) {
     // no geokrets in this cache
     tpl_set_var('geokrety_begin', '<!--');
     tpl_set_var('geokrety_end', '-->');
     tpl_set_var('geokrety_content', '');
 } else {
     // geokret is present in this cache
     $geokrety_content = '';
     $geokrety_all = $dbc->dbResultFetchAll($s);
     for ($i = 0; $i < $geokrety_all_count; $i++) {