Exemplo n.º 1
0
 /**
  * function_description
  *
  * @return return_description
  */
 public static function navigation()
 {
     $user = JFactory::getUser();
     $juser = new JUser($user->id);
     $uri = JFactory::getApplication()->input->get('layout');
     $navi = '';
     $navi .= '<div class="gps-navi">';
     $navi .= '<div class="navi-part"><a href="' . JRoute::_("index.php?option=com_htraininglogs") . '">' . JText::_('COM_HTRAININGLOGS_OVERVIEW') . '</a></div>';
     $navi .= '<div class="navi-part"><a href="' . JRoute::_("index.php?option=com_htraininglogs&view=cats&layout=default") . '">' . JText::_('COM_HTRAININGLOGS_CATS') . '</a></div>';
     $navi .= '<div class="navi-part"><a href="' . JRoute::_("index.php?option=com_htraininglogs&view=files&layout=list") . '">' . JText::_('COM_HTRAININGLOGS_TRACKS') . '</a></div>';
     $cfg = HTraininglogsHelper::getConfig();
     if ($user->get('id')) {
         // Erscheint nur, wenn User kein Gast
         if (HTraininglogsHelper::userHasFrontendRights()) {
             $navi .= '<div class="navi-part"><a href="' . JRoute::_("index.php?option=com_htraininglogs&view=files&layout=form") . '">' . JText::_('COM_HTRAININGLOGS_ADD_FILE') . '</a></div>';
         }
         // Erscheint bei jedem Registrierten
         $navi .= '<div class="navi-part"><a href="' . JRoute::_("index.php?option=com_htraininglogs&view=files&layout=user") . '">' . JText::_('COM_HTRAININGLOGS_MY_FILES') . '</a></div>';
         if ($uri != null and $uri == 'file') {
             $gpsfile = new JtgModelFiles();
             $track = JFactory::getApplication()->input->get('id');
             $track = $gpsfile->getFile($track);
             if ($track !== null and $user->get('id') == $track->uid) {
                 // User can delete or, update its own tracks
                 $navi .= '<div class="navi-part"><a href="' . JRoute::_("index.php?option=com_htraininglogs&view=files&layout=form&id=" . JFactory::getApplication()->input->get('id')) . '">' . JText::_('COM_HTRAININGLOGS_UPDATE_GPS_FILE') . '</a></div>';
                 $navi .= '<div class="navi-part"><a href="' . JRoute::_("index.php?option=com_htraininglogs&controller=files&task=delete&id=" . JFactory::getApplication()->input->get('id')) . '">' . JText::_('COM_HTRAININGLOGS_DELETE_FILE') . '</a></div>';
             }
         }
     }
     $navi .= '<div class="no-float"></div>';
     $navi .= '</div>';
     return $navi;
 }
Exemplo n.º 2
0
 /**
  * function_description
  *
  * @return array
  */
 private function parseXMLlinesOL()
 {
     // 	global $jtg_microtime;
     $cfg = HTraininglogsHelper::getConfig();
     $iconpath = JUri::base() . "/media/com_htraininglogs/assets/template/" . $cfg->template . "/images/";
     $link = JUri::current();
     $string_se = "";
     $center = "";
     // TODO if (AnimatedCursorLayer)
     if (true) {
         /* AnimatedCursorLayer
          * This MUST be added after olmap.zoomToExtent
          */
         $document = JFactory::getDocument();
         $document->addScript(JUri::base(true) . '/media/com_htraininglogs/assets/js/animatedCursor.js');
         $center .= "\n// <!-- parseOLMapAnimatedCursorLayer BEGIN -->\n";
         $center .= "longitudeData = {$this->longitudeData};\n";
         $center .= "latitudeData = {$this->latitudeData};\n";
         $center .= "var points = [];\n";
         $center .= "var style ={strokeOpacity: 0.7, strokeColor: \"#ff00ff\", strokeWidth: 5, graphicZIndex: 5}\n";
         $center .= "for (var i = 0; i < longitudeData.length; i++) {\n";
         $center .= "\tvar point = new OpenLayers.Geometry.Point(longitudeData[i], latitudeData[i]). transform(new OpenLayers.Projection(\"EPSG:4326\"), olmap.getProjectionObject());\n";
         $center .= "\tpoints.push(point);\n";
         $center .= "}\n";
         $center .= "var line = new OpenLayers.Geometry.LineString(points);\n";
         $center .= "var linefeature  = new OpenLayers.Feature.Vector(line, null, style);\n";
         $track_name = htmlentities($this->trackname, ENT_QUOTES, 'UTF-8');
         $center .= "animatedCursorLayer = new OpenLayers.Layer.Vector(\"{$track_name}\");\n";
         $center .= "animatedCursorLayer.addFeatures([linefeature]);\n";
         $center .= "animatedCursorLayer.gpxfeature = animatedCursorLayer.features[0];\n";
         $center .= "olmap.addLayer(animatedCursorLayer);\n";
         $center .= "\n// <!-- parseOLMapAnimatedCursorIcon BEGIN -->\n";
         $center .= "animatedCursorIcon = new OpenLayers.Layer.Markers(\"Animated Cursor\", {\n";
         $center .= "displayInLayerSwitcher: false });\n";
         $center .= "olmap.addLayer(animatedCursorIcon);\n";
         $center .= "animatedCursorIcon.setVisibility(false);\n";
         $center .= "var size = new OpenLayers.Size(32,32);\n";
         $center .= "var offset = new OpenLayers.Pixel(-16,-32);\n";
         $center .= "var cursorIcon = new OpenLayers.Icon(\"" . JUri::base() . "/media/com_htraininglogs/assets/images/orange-dot.png\",size,offset);\n";
         $center .= "var lonLatStart = new OpenLayers.LonLat(" . $this->track[1]->start . ") . ";
         $center .= "transform(new OpenLayers.Projection(\"EPSG:4326\"), olmap.getProjectionObject());\n";
         $center .= "animatedCursorIcon.addMarker(new OpenLayers.Marker(lonLatStart,cursorIcon));\n";
         $center .= "// <!-- parseOLMapAnimatedCursorIcon END -->\n";
     } else {
         $center .= "<!-- AnimatedCursorLayer not activated -->\n";
     }
     $center .= "// <!-- parseOLMapAnimatedCursorLayer END -->\n";
     $string = "// <!-- parseXMLlines BEGIN -->\n";
     if ($this->trackCount == 0) {
         return;
     }
     $tracksColors = $this->calculateAllColors($this->trackCount);
     for ($i = 1; $i <= $this->trackCount; $i++) {
         $m = microtime(true);
         $coords = $this->track[$i]->coords;
         $subid = $link . "&amp;subid=" . $i;
         $color = "#" . $tracksColors[$i - 1];
         $string_se .= "var lonLatStart" . $i . " = new OpenLayers.LonLat(" . $this->track[$i]->start . ") . ";
         $string_se .= "transform(new OpenLayers.Projection(\"EPSG:4326\"), olmap.getProjectionObject());\n";
         $string_se .= "var lonLatStop" . $i . " = new OpenLayers.LonLat(" . $this->track[$i]->stop . ") . ";
         $string_se .= "transform(new OpenLayers.Projection(\"EPSG:4326\"), olmap.getProjectionObject());\n";
         $string_se .= "var sizeStart" . $i . " = new OpenLayers.Size(24,24);\n";
         $string_se .= "var sizeStop" . $i . " = new OpenLayers.Size(24,24);\n";
         $string_se .= "var offsetStart" . $i . " = new OpenLayers.Pixel(-3,-22);\n";
         $string_se .= "var offsetStop" . $i . " = new OpenLayers.Pixel(-19,-22);\n";
         $string_se .= "var iconStart" . $i . " = ";
         $string_se .= "new OpenLayers.Icon(\"" . $iconpath . "trackStart.png\",";
         $string_se .= "sizeStart" . $i . ",offsetStart" . $i . ");\n";
         $string_se .= "var iconStop" . $i . " = new OpenLayers.Icon(\"" . $iconpath . "trackDest.png\",";
         $string_se .= "sizeStop" . $i . ",offsetStop" . $i . ");\n";
         $string_se .= "layer_startstop.addMarker(new OpenLayers.Marker(lonLatStop" . $i . ",iconStop" . $i . "));\n";
         $string_se .= "popupClassStart = AutoSizeFramedCloud;\n";
         $string_se .= "popupContentHTMLStart = '";
         $string_se .= "<font style=\"font-weight: bold;\" color=\"" . $color . "\">";
         $string_se .= $this->track[$i]->trackname ? htmlentities($this->track[$i]->trackname, ENT_QUOTES, 'UTF-8') : JText::_('COM_HTRAININGLOGS_TRACK') . $i;
         $string_se .= "</font>";
         $string_se .= "';\n";
         $string_se .= "addlayer_startstop(lonLatStart" . $i . ", popupClassStart, popupContentHTMLStart, true, false, iconStart" . $i . ", olmap);\n";
     }
     $string .= "layer_startstop = new OpenLayers.Layer.Markers(";
     $string .= "\"" . $i . ": " . $track_name . "\"";
     $string .= ", { displayInLayerSwitcher: false }";
     $string .= ");";
     $string .= "olmap.addLayer(layer_startstop);";
     $string .= "layer_startstop.setVisibility(true);";
     $string .= $string_se;
     $string .= "// <!-- parseXMLlines END -->\n";
     $center .= "// <!-- parseOLMapCenterSingleTrack BEGIN -->\n";
     $center .= "var min = lonLatToMercator(new OpenLayers.LonLat";
     $center .= "(" . $this->bbox_lon_min . "," . $this->bbox_lat_min . "));\n";
     $center .= "var max = lonLatToMercator(new OpenLayers.LonLat";
     $center .= "(" . $this->bbox_lon_max . "," . $this->bbox_lat_max . "));\n";
     $center .= "olmap.zoomToExtent(new OpenLayers.Bounds(min.lon, min.lat, max.lon, max.lat));\n";
     $center .= "// <!-- parseOLMapCenterSingleTrack END -->\n";
     return array("coords" => $string, "center" => $center);
 }