Пример #1
0
 public static function buildWaypointsForGeocache(GeoCache $geoCache)
 {
     $db = OcDb::instance();
     $stmt = $db->multiVariableQuery("SELECT `wp_id`, `type`, `longitude`, `latitude`,  `desc`, `status`, `stage` FROM `waypoints` WHERE `cache_id`=:1 ORDER BY `stage`,`wp_id`", $geoCache->getCacheId());
     foreach ($db->dbResultFetchAll($stmt) as $wpRecord) {
         $waypoint = new Waypoint();
         $waypoint->setCoordinates(new Coordinates(array('dbRow' => $wpRecord)))->setDescription($wpRecord['desc'])->setId((int) $wpRecord['wp_id'])->setStage((int) $wpRecord['stage'])->setStatus((int) $wpRecord['status'])->setType((int) $wpRecord['type'])->setGeocache($geoCache);
         $geoCache->getWaypoints()->append($waypoint);
     }
 }
Пример #2
0
 // end visit-counter
 // hide coordinates when user is not logged in
 if ($usr == true || !$hide_coords) {
     $coords = mb_ereg_replace(" ", " ", htmlspecialchars(help_latToDegreeStr($geocache->getCoordinates()->getLatitude()), ENT_COMPAT, 'UTF-8')) . ' ' . mb_ereg_replace(" ", " ", htmlspecialchars(help_lonToDegreeStr($geocache->getCoordinates()->getLongitude()), ENT_COMPAT, 'UTF-8'));
     $coords2 = mb_ereg_replace(" ", " ", htmlspecialchars(help_latToDegreeStr($geocache->getCoordinates()->getLatitude(), 0), ENT_COMPAT, 'UTF-8')) . ' ' . mb_ereg_replace(" ", " ", htmlspecialchars(help_lonToDegreeStr($geocache->getCoordinates()->getLongitude(), 0), ENT_COMPAT, 'UTF-8'));
     $coords3 = mb_ereg_replace(" ", " ", htmlspecialchars(help_latToDegreeStr($geocache->getCoordinates()->getLatitude(), 2), ENT_COMPAT, 'UTF-8')) . ' ' . mb_ereg_replace(" ", " ", htmlspecialchars(help_lonToDegreeStr($geocache->getCoordinates()->getLongitude(), 2), ENT_COMPAT, 'UTF-8'));
     $coords_other = "<a href=\"#\" onclick=\"javascript:window.open('http://www.opencaching.pl/coordinates.php?lat=" . $geocache->getCoordinates()->getLatitude() . "&amp;lon=" . $geocache->getCoordinates()->getLongitude() . "&amp;popup=y&amp;wp=" . htmlspecialchars($geocache->getWaypointId(), ENT_COMPAT, 'UTF-8') . "','Koordinatenumrechnung','width=240,height=334,resizable=yes,scrollbars=1')\">" . tr('coords_other') . "</a>";
 } else {
     $coords = tr('hidden_coords');
     $coords_other = "";
 }
 if ($geocache->getCacheType() == GeoCache::TYPE_EVENT) {
     $cache_stats = '';
 } else {
     if ($geocache->getFounds() + $geocache->getNotFounds() + $geocache->getNotesCount() != 0) {
         $cache_stats = "<a class =\"links2\" href=\"javascript:void(0)\" onmouseover=\"Tip('" . tr('show_statictics_cache') . "', BALLOON, true, ABOVE, false, OFFSETX, -17, PADDING, 8, WIDTH, -240)\" onmouseout=\"UnTip()\" onclick=\"javascript:window.open('cache_stats.php?cacheid=" . $geocache->getCacheId() . "&amp;popup=y','Cache_Statistics','width=500,height=750,resizable=yes,scrollbars=1')\"><img src=\"tpl/stdstyle/images/blue/stat1.png\" alt=\"Statystyka skrzynki\" title=\"Statystyka skrzynki\" /></a>";
     } else {
         $cache_stats = "<a class =\"links2\" href=\"javascript:void(0)\" onmouseover=\"Tip('" . tr('not_stat_cache') . "', BALLOON, true, ABOVE, false, OFFSETX, -17, PADDING, 8, WIDTH, -240)\" onmouseout=\"UnTip()\"><img src=\"tpl/stdstyle/images/blue/stat1.png\" alt=\"\" title=\"\" /></a>";
     }
 }
 if (!isset($map_msg)) {
     $map_msg = '';
 }
 if (!isset($map_msg)) {
     $map_msg = '';
 }
 if (!isset($coords2)) {
     $coords2 = '';
 }
 if (!isset($coords3)) {
     $coords3 = '';
Пример #3
0
 /**
  * @return  Collection
  */
 public function getGeocaches()
 {
     if (!$this->geocaches->isReady()) {
         $db = OcDb::instance();
         $query = 'SELECT powerTrail_caches.isFinal, caches . * , user.username FROM  `caches` , user, powerTrail_caches WHERE cache_id IN ( SELECT  `cacheId` FROM  `powerTrail_caches` WHERE  `PowerTrailId` =:1) AND user.user_id = caches.user_id AND powerTrail_caches.cacheId = caches.cache_id ORDER BY caches.name';
         $s = $db->multiVariableQuery($query, $this->id);
         $geoCachesDbResult = $db->dbResultFetchAll($s);
         $geocachesIdArray = array();
         foreach ($geoCachesDbResult as $geoCacheDbRow) {
             $geocache = new GeoCache();
             $geocache->loadFromRow($geoCacheDbRow)->setIsPowerTrailPart(true);
             $geocache->setPowerTrail($this);
             if ($geoCacheDbRow['isFinal'] == 1) {
                 $geocache->setIsPowerTrailFinalGeocache(true);
             }
             $this->geocaches[] = $geocache;
             $geocachesIdArray[] = $geocache->getCacheId();
         }
         $this->geocaches->setIsReady(true);
         $this->geocaches->setGeocachesIdArray($geocachesIdArray);
         $this->caculateGeocachesCountByStatus();
     }
     return $this->geocaches;
 }