/**
  * Display the view
  */
 public function display($tpl = null)
 {
     require_once JPATH_SITE . '/administrator/components/com_einsatzkomponente/helpers/einsatzkomponente.php';
     // Helper-class laden
     $app = JFactory::getApplication();
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->params = $app->getParams('com_einsatzkomponente');
     $this->gmap_config = EinsatzkomponenteHelper::load_gmap_config();
     // GMap-Config aus helper laden
     //print_r ($this->params);break;
     require_once JPATH_SITE . '/administrator/components/com_einsatzkomponente/helpers/einsatzkomponente.php';
     // Helper-class laden
     $aktuelles_Datum = getdate();
     //Komponentenversion aus Datenbank lesen
     $this->version = EinsatzkomponenteHelper::getVersion();
     //Limitstart und Limit für Pagination
     //        if ($this->params->get('display_home_pagination')) :
     //		$limitstart = $this->pagination->limitstart;
     //		$limitstart = $app->getUserStateFromRequest( "com_einsatzkomponente.limitstart", 'limitstart', $limitstart );
     //		$limit = $this->pagination->limit;
     //		else:
     //		$limitstart = '0';
     //		$limit = '10000';
     //		endif;
     //Einsatzdaten aus der Datenbank holen
     $count = EinsatzkomponenteHelper::count_einsatz_daten_bestimmtes_jahr('');
     //		$this->pagination->total = count($count);
     //		$this->pagination->pagesTotal = ceil(count($count)/$limit);
     //		$this->pagination->pagesStop = ceil(count($count)/$limit);
     $this->reports = EinsatzkomponenteHelper::einsatz_daten_bestimmtes_jahr('', '99999', '0');
     $this->years = EinsatzkomponenteHelper::getYear();
     // Alle Jahre der Einsatzdaten ermitteln
     $this->einsatzarten = EinsatzkomponenteHelper::getEinsatzarten();
     // Alle Einsatzarten der Einsatzdaten ermitteln
     $this->organisationen = EinsatzkomponenteHelper::getOrganisationen();
     // Alle Einsatzarten der Einsatzdaten ermitteln
     $layout_detail = $this->params->get('layout_detail', '');
     // Detailbericht Layout
     $this->layout_detail_link = '';
     if ($layout_detail) {
         $this->layout_detail_link = '&layout=' . $layout_detail;
     }
     // Detailbericht Layout 'default' ?
     $document = JFactory::getDocument();
     // Import CSS
     $document->addStyleSheet('components/com_einsatzkomponente/assets/css/einsatzkomponente.css');
     $document->addStyleSheet('components/com_einsatzkomponente/assets/css/responsive.css');
     if ($this->params->get('display_einsatzkarte_bootstrap', '0')) {
         $document->addScript('components/com_einsatzkomponente/assets/bootstrap/js/bootstrap.min.js');
         $document->addStyleSheet('components/com_einsatzkomponente/assets/bootstrap/css/bootstrap.min.css');
         $document->addStyleSheet('components/com_einsatzkomponente/assets/bootstrap/css/bootstrap-responsive.min.css');
     }
     $document->addStyleDeclaration($this->params->get('gmap_css', ''));
     //$document->addStyleSheet('components/com_einsatzkomponente/assets/jquery/JQRangeSlider/iThing.css');
     //$document->addScript('components/com_einsatzkomponente/assets/jquery/JQRangeSlider/jQDateRangeSlider-withRuler-min.js');
     if ($this->params->get('display_home_rss', '1')) {
         // RSS-Feed in den Dokumenten-Header einfügen
         $href = 'index.php?option=com_einsatzkomponente&view=einsatzberichte&format=feed&type=rss';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink($href, 'alternate', 'rel', $attribs);
     }
     $this->monate = array(1 => "Januar", 2 => "Februar", 3 => "März", 4 => "April", 5 => "Mai", 6 => "Juni", 7 => "Juli", 8 => "August", 9 => "September", 10 => "Oktober", 11 => "November", 12 => "Dezember");
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     require_once JPATH_SITE . '/administrator/components/com_einsatzkomponente/helpers/einsatzkomponente.php';
     // Helper-class laden
     $app = JFactory::getApplication();
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->params = $app->getParams('com_einsatzkomponente');
     $this->gmap_config = EinsatzkomponenteHelper::load_gmap_config();
     // GMap-Config aus helper laden
     //print_r ($this->params);break;
     require_once JPATH_SITE . '/administrator/components/com_einsatzkomponente/helpers/einsatzkomponente.php';
     // Helper-class laden
     $aktuelles_Datum = getdate();
     $selectedYear = $aktuelles_Datum["year"];
     //if (!$app->input->get(year)) :
     //if ($this->params->get('anzeigejahr')) : $selectedYear = $this->params->get('anzeigejahr'); endif;
     //endif;
     //if ($app->input->get(year)) : $selectedYear = $app->input->get(year); endif;
     //if ($app->input->get(year)) :
     //----Modulposition laden ----
     $this->modulepos_1 = '<div class="mod_eiko1">' . EinsatzkomponenteHelper::module('eiko1') . '</div>';
     $this->modulepos_2 = '<div class="mod_eiko2">' . EinsatzkomponenteHelper::module('eiko2') . '</div>';
     $selectedYear = $app->getUserStateFromRequest("com_einsatzkomponente.selectedYear", 'year', $selectedYear);
     $selectedEinsatzart = '';
     $selectedEinsatzart = $app->getUserStateFromRequest("com_einsatzkomponente.selectedEinsatzart", 'selectedEinsatzart', '');
     $selectedOrga = '';
     $selectedOrga = $app->getUserStateFromRequest("com_einsatzkomponente.selectedOrga", 'selectedOrga', '0');
     //print_r ($selectedEinsatzart);
     //endif;
     if ($this->params->get('anzeigejahr')) {
         $selectedYear = $this->params->get('anzeigejahr');
     }
     $this->selectedYear = $selectedYear;
     $this->selectedEinsatzart = $selectedEinsatzart;
     $app->setUserState("com_einsatzkomponente.selectedYear", $selectedYear);
     $app->setUserState("com_einsatzkomponente.selectedEinsatzart", $selectedEinsatzart);
     if ($this->params->get('abfragewehr', '1')) {
         if ($this->params->get('anzeigewehr')) {
             $selectedOrga = $this->params->get('anzeigewehr');
         }
         $this->selectedOrga = $selectedOrga;
         $this->selectedOrga = $app->setUserState("com_einsatzkomponente.selectedOrga", $selectedOrga);
     } else {
         $selectedOrga = $app->getUserStateFromRequest("com_einsatzkomponente.selectedOrga", 'selectedOrga', '0');
         $this->selectedOrga = $selectedOrga;
     }
     //Komponentenversion aus Datenbank lesen
     $this->version = EinsatzkomponenteHelper::getVersion();
     //Limitstart und Limit für Pagination
     if ($this->params->get('display_home_pagination')) {
         $limitstart = $this->pagination->limitstart;
         $limitstart = $app->getUserStateFromRequest("com_einsatzkomponente.limitstart", 'limitstart', $limitstart);
         $limit = $this->pagination->limit;
     } else {
         $limitstart = '0';
         $limit = '10000';
     }
     //Einsatzdaten aus der Datenbank holen
     $count = EinsatzkomponenteHelper::count_einsatz_daten_bestimmtes_jahr($selectedYear);
     $this->pagination->total = count($count);
     $this->pagination->pagesTotal = ceil(count($count) / $limit);
     $this->pagination->pagesStop = ceil(count($count) / $limit);
     $this->reports = EinsatzkomponenteHelper::einsatz_daten_bestimmtes_jahr($selectedYear, $limit, $limitstart);
     if ($selectedYear == '9999') {
         $count = EinsatzkomponenteHelper::count_einsatz_daten_bestimmtes_jahr('');
         $this->pagination->total = count($count);
         $this->pagination->pagesTotal = ceil(count($count) / $limit);
         $this->pagination->pagesStop = ceil(count($count) / $limit);
         $this->reports = EinsatzkomponenteHelper::einsatz_daten_bestimmtes_jahr('', $limit, $limitstart);
     }
     if (!$this->reports) {
         $count = EinsatzkomponenteHelper::count_einsatz_daten_bestimmtes_jahr($aktuelles_Datum["year"] - 1);
         $this->pagination->total = count($count);
         $this->pagination->pagesTotal = ceil(count($count) / $limit);
         $this->pagination->pagesStop = ceil(count($count) / $limit);
         $this->reports = EinsatzkomponenteHelper::einsatz_daten_bestimmtes_jahr($aktuelles_Datum["year"] - 1, $limit, $limitstart);
         // Falls Jahr ohne Einsatz per Menülink aufgerufen wird, dann kein anderes Jahr anzeigen
         if ($this->params->get('anzeigejahr') == $selectedYear) {
             $this->reports = '';
         }
     }
     //print_r ($this->reports);break;
     $this->years = EinsatzkomponenteHelper::getYear();
     // Alle Jahre der Einsatzdaten ermitteln
     $this->einsatzarten = EinsatzkomponenteHelper::getEinsatzarten();
     // Alle Einsatzarten der Einsatzdaten ermitteln
     $this->organisationen = EinsatzkomponenteHelper::getOrganisationen();
     // Alle Einsatzarten der Einsatzdaten ermitteln
     //print_r ($this->einsatzarten);
     $layout_detail = $this->params->get('layout_detail', '');
     // Detailbericht Layout
     $this->layout_detail_link = '';
     if ($layout_detail) {
         $this->layout_detail_link = '&layout=' . $layout_detail;
     }
     // Detailbericht Layout 'default' ?
     $document = JFactory::getDocument();
     // Import CSS
     $document->addStyleSheet('components/com_einsatzkomponente/assets/css/einsatzkomponente.css');
     $document->addStyleSheet('components/com_einsatzkomponente/assets/css/responsive.css');
     if ($this->params->get('display_home_bootstrap', '0')) {
         // Import Bootstrap
         $document->addScript('components/com_einsatzkomponente/assets/bootstrap/js/bootstrap.min.js');
         $document->addStyleSheet('components/com_einsatzkomponente/assets/bootstrap/css/bootstrap.min.css');
         $document->addStyleSheet('components/com_einsatzkomponente/assets/bootstrap/css/bootstrap-responsive.min.css');
     }
     $document->addStyleDeclaration($this->params->get('main_css', ''));
     // Import Jquery
     JHtml::_('jquery.framework', false);
     // prüfen ob jquery geladen wurde
     echo "<script type=\"text/javascript\">\n\t\tif(typeof jQuery == \"function\")\n\t\telse\n\t\t  alert(\"jQuery nicht geladen\");\n\t\t</script>";
     if ($this->params->get('gmap_action', '0') == '1') {
         $standort = new StdClass();
         $standort->gmap_latitude = '0';
         $standort->gmap_longitude = '0';
         $orga = EinsatzkomponenteHelper::getOrganisationen();
         if ($this->params->get('display_detail_organisationen', '1')) {
             $orga = EinsatzkomponenteHelper::getOrganisationen();
             $organisationen = '[';
             // Feuerwehr Details  ------>
             $n = 0;
             for ($i = 0; $i < count($orga); $i++) {
                 $orga_image = $orga[$i]->gmap_icon_orga;
                 if (!$orga_image) {
                     $orga_image = 'images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png');
                 }
                 if ($i == $n - 1) {
                     $organisationen = $organisationen . '["' . $orga[$i]->name . '",' . $orga[$i]->gmap_latitude . ',' . $orga[$i]->gmap_longitude . ',' . $i . ',"' . $orga_image . '"]';
                 } else {
                     $organisationen = $organisationen . '["' . $orga[$i]->name . '",' . $orga[$i]->gmap_latitude . ',' . $orga[$i]->gmap_longitude . ',' . $i . ',"' . $orga_image . '"';
                     $organisationen = $organisationen . '],';
                 }
             }
             $organisationen = substr($organisationen, 0, strlen($organisationen) - 1);
             $organisationen = $organisationen . ' ];';
         } else {
             $organisationen = '[["",1,1,0,"images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png') . '"],["",1,1,0,"images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png') . '"] ]';
         }
         $display_map_route = 'false';
         $alarmareas1 = $this->gmap_config->gmap_alarmarea;
         // Einsatzgebiet  ---->
         $alarmareas = explode('|', $alarmareas1);
         $einsatzgebiet = '[ ';
         for ($i = 0; $i < count($alarmareas) - 1; $i++) {
             $areas = explode(',', $alarmareas[$i]);
             $einsatzgebiet = $einsatzgebiet . 'new google.maps.LatLng(' . $areas[0] . ',' . $areas[1] . '),';
         }
         $areas = explode(',', $alarmareas[0]);
         $einsatzgebiet = $einsatzgebiet . 'new google.maps.LatLng(' . $areas[0] . ',' . $areas[1] . '),';
         $einsatzgebiet = substr($einsatzgebiet, 0, strlen($einsatzgebiet) - 1);
         $einsatzgebiet = $einsatzgebiet . ' ]';
         if (!$this->params->get('display_home_einsatzgebiet', '1')) {
             $einsatzgebiet = '[[0,0]]';
         }
         $display_detail_popup = 'false';
         $marker1_title = '';
         // leer
         $marker1_lat = '1';
         // leer
         $marker1_lng = '1';
         // leer
         $marker1_image = '../../images/com_einsatzkomponente/images/map/icons/' . $this->params->get('detail_pointer1_image', 'circle.png');
         $marker2_title = '';
         // leer
         $marker2_lat = '';
         // leer
         $marker2_lng = '';
         // leer
         $marker2_image = '';
         // leer
         $marker2_lat = '';
         // leer
         $marker2_lng = '';
         // leer
         $center_lat = $this->gmap_config->start_lat;
         $center_lng = $this->gmap_config->start_lang;
         $gmap_zoom_level = $this->gmap_config->gmap_zoom_level;
         $gmap_onload = $this->gmap_config->gmap_onload;
         $zoom_control = 'true';
         $document->addScript('https://maps.googleapis.com/maps/api/js?v=3.exp');
         $document->addScriptDeclaration(EinsatzkomponenteHelper::getGmap($marker1_title, $marker1_lat, $marker1_lng, $marker1_image, $marker2_title, $marker2_lat, $marker2_lng, $marker2_image, $center_lat, $center_lng, $gmap_zoom_level, $gmap_onload, $zoom_control, $organisationen, $orga_image, $einsatzgebiet, $display_detail_popup, $standort, $display_map_route));
     }
     if ($this->params->get('gmap_action', '0') == '2') {
         $standort = new StdClass();
         $standort->gmap_latitude = '0';
         $standort->gmap_longitude = '0';
         $orga = EinsatzkomponenteHelper::getOrganisationen();
         if ($this->params->get('display_detail_organisationen', '1')) {
             $orga = EinsatzkomponenteHelper::getOrganisationen();
             $organisationen = '[';
             // Feuerwehr Details  ------>
             $n = 0;
             for ($i = 0; $i < count($orga); $i++) {
                 $orga_image = $orga[$i]->gmap_icon_orga;
                 if (!$orga_image) {
                     $orga_image = 'images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png');
                 }
                 if ($i == $n - 1) {
                     $organisationen = $organisationen . '["' . $orga[$i]->name . '",' . $orga[$i]->gmap_latitude . ',' . $orga[$i]->gmap_longitude . ',' . $i . ',"' . $orga_image . '"]';
                 } else {
                     $organisationen = $organisationen . '["' . $orga[$i]->name . '",' . $orga[$i]->gmap_latitude . ',' . $orga[$i]->gmap_longitude . ',' . $i . ',"' . $orga_image . '"';
                     $organisationen = $organisationen . '],';
                 }
             }
             $organisationen = substr($organisationen, 0, strlen($organisationen) - 1);
             $organisationen = $organisationen . ' ];';
         } else {
             $organisationen = '[["",1,1,0,"images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png') . '"],["",1,1,0,"images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png') . '"] ]';
         }
         $alarmareas1 = $this->gmap_config->gmap_alarmarea;
         // Einsatzgebiet  ---->
         $alarmareas = explode('|', $alarmareas1);
         $einsatzgebiet = '[ ';
         for ($i = 0; $i < count($alarmareas) - 1; $i++) {
             $areas = explode(',', $alarmareas[$i]);
             $einsatzgebiet = $einsatzgebiet . '[' . $areas[1] . ',' . $areas[0] . '],';
         }
         $areas = explode(',', $alarmareas[0]);
         $einsatzgebiet = $einsatzgebiet . '[' . $areas[1] . ',' . $areas[0] . '],';
         $einsatzgebiet = substr($einsatzgebiet, 0, strlen($einsatzgebiet) - 1);
         $einsatzgebiet = $einsatzgebiet . ' ]';
         if (!$this->params->get('display_home_einsatzgebiet', '1')) {
             $einsatzgebiet = '[[0,0]]';
         }
         $display_map_route = 'false';
         $display_detail_popup = 'false';
         $marker1_title = '1';
         // leer
         $marker1_lat = '1';
         // leer
         $marker1_lng = '1';
         // leer
         $marker1_image = '../../images/com_einsatzkomponente/images/map/icons/' . $this->params->get('detail_pointer1_image', 'circle.png');
         $marker2_title = '';
         // leer
         $marker2_lat = '';
         // leer
         $marker2_lng = '';
         // leer
         $marker2_image = '';
         // leer
         $marker2_lat = '';
         // leer
         $marker2_lng = '';
         // leer
         $center_lat = $this->gmap_config->start_lat;
         $center_lng = $this->gmap_config->start_lang;
         $gmap_zoom_level = $this->gmap_config->gmap_zoom_level;
         $gmap_onload = $this->gmap_config->gmap_onload;
         $zoom_control = 'true';
         $document->addScript('components/com_einsatzkomponente/assets/osm/util.js');
         $document->addScript('http://www.openlayers.org/api/OpenLayers.js');
         $document->addScript('http://www.openstreetmap.org/openlayers/OpenStreetMap.js');
         $document->addStyleSheet('components/com_einsatzkomponente/assets/osm/map.css');
         $document->addStyleSheet('components/com_einsatzkomponente/assets/osm/ie_map.css');
         $document->addScript('components/com_einsatzkomponente/assets/osm/OpenLayers_Map_minZoom_maxZoom_Patch.js');
         $document->addScriptDeclaration(EinsatzkomponenteHelper::getOsm($marker1_title, $marker1_lat, $marker1_lng, $marker1_image, $marker2_title, $marker2_lat, $marker2_lng, $marker2_image, $center_lat, $center_lng, $gmap_zoom_level, $gmap_onload, $zoom_control, $organisationen, $orga_image, $einsatzgebiet, $display_detail_popup, $standort, $display_map_route));
     }
     if ($this->params->get('display_home_rss', '1')) {
         // RSS-Feed in den Dokumenten-Header einfügen
         $href = 'index.php?option=com_einsatzkomponente&view=einsatzberichte&format=feed&type=rss';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink($href, 'alternate', 'rel', $attribs);
     }
     $this->monate = array(1 => "Januar", 2 => "Februar", 3 => "M&auml;rz", 4 => "April", 5 => "Mai", 6 => "Juni", 7 => "Juli", 8 => "August", 9 => "September", 10 => "Oktober", 11 => "November", 12 => "Dezember");
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
    /**
     * Display the view
     */
    public function display($tpl = null)
    {
        $this->next_id[0] = new stdClass();
        require_once JPATH_SITE . '/administrator/components/com_einsatzkomponente/helpers/einsatzkomponente.php';
        // Helper-class laden
        $app = JFactory::getApplication();
        $selectedOrga = $app->getUserStateFromRequest("com_einsatzkomponente.selectedOrga", 'selectedOrga', 'alle Organisationen');
        //echo $selectedOrga;
        $user = JFactory::getUser();
        //$id = $app->input->get(id);
        $this->state = $this->get('State');
        $this->item = $this->get('Data');
        $this->images = EinsatzkomponenteHelper::getEinsatzbilder($this->item->id);
        $this->prev_id = EinsatzkomponenteHelper::getPrev_id($this->item->date1, $selectedOrga);
        $this->next_id = EinsatzkomponenteHelper::getNext_id($this->item->date1, $selectedOrga);
        $this->params = $app->getParams('com_einsatzkomponente');
        $this->form = $this->get('Form');
        $this->gmap_config = EinsatzkomponenteHelper::load_gmap_config();
        // GMap-Config aus helper laden
        $this->einsatzlogo = EinsatzkomponenteHelper::getEinsatzlogo($this->item->data1);
        $this->tickerKat = EinsatzkomponenteHelper::getTickerKat($this->item->tickerkat);
        $this->alarmierungsart = EinsatzkomponenteHelper::getAlarmierungsart($this->item->alerting);
        // Get active menu
        $app = JFactory::getApplication();
        $menus = $app->getMenu();
        $this->menu = $menus->getActive();
        //print_r ($this->menu);
        //echo $this->menu->anzeigejahr;
        // Import CSS + JS
        $document = JFactory::getDocument();
        $document->addStyleSheet('components/com_einsatzkomponente/assets/css/einsatzkomponente.css');
        $document->addStyleSheet('components/com_einsatzkomponente/assets/css/responsive.css');
        $document->addScript('components/com_einsatzkomponente/assets/highslide/highslide-with-gallery.js');
        $document->addScript('components/com_einsatzkomponente/assets/highslide/highslide.config.js');
        $document->addStyleSheet('components/com_einsatzkomponente/assets/highslide/highslide.css');
        //print_r ($this->menu);
        $this->social = EinsatzkomponenteHelper::getSocial($this->params, $this->item->id, $this->item->summary);
        //		$sef = '';
        //		$sef_rewrite = '';
        //		$conf = JFactory::getConfig();
        //		@$sef = $conf[sef];
        //		@$sef_rewrite = $conf[sef_rewrite];
        //if ($sef_rewrite) :
        @($this->navbar = EinsatzkomponenteHelper::getNavbar($this->params, $this->prev_id['0']->id, $this->next_id['0']->id, $this->item->id, $this->menu->link . '&Itemid=' . $this->menu->id));
        //endif;
        //if (!$sef_rewrite) :
        //@$this->navbar = EinsatzkomponenteHelper::getNavbar($this->params,$this->prev_id['0']->id,$this->next_id['0']->id,$this->item->id,$this->menu->link.'&Itemid='.$this->params->get('homelink','').'');
        //endif;
        if ($this->params->get('gmap_action', '0') == '1') {
            if ($this->params->get('display_detail_organisationen', '1')) {
                $orga = EinsatzkomponenteHelper::getOrganisationen();
                $organisationen = '[';
                // Feuerwehr Details  ------>
                $n = 0;
                for ($i = 0; $i < count($orga); $i++) {
                    $orga_image = $orga[$i]->gmap_icon_orga;
                    if (!$orga_image) {
                        $orga_image = 'images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png');
                    }
                    if ($i == $n - 1) {
                        $organisationen = $organisationen . '["' . $orga[$i]->name . '",' . $orga[$i]->gmap_latitude . ',' . $orga[$i]->gmap_longitude . ',' . $i . ',"' . $orga_image . '"]';
                    } else {
                        $organisationen = $organisationen . '["' . $orga[$i]->name . '",' . $orga[$i]->gmap_latitude . ',' . $orga[$i]->gmap_longitude . ',' . $i . ',"' . $orga_image . '"';
                        $organisationen = $organisationen . '],';
                    }
                }
                $organisationen = substr($organisationen, 0, strlen($organisationen) - 1);
                $organisationen = $organisationen . ' ];';
            } else {
                $organisationen = '[["",1,1,0,"images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png') . '"],["",1,1,0,"images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png') . '"] ]';
            }
            $standort = EinsatzkomponenteHelper::getStandort_orga($this->item->auswahl_orga);
            $display_map_route = $this->params->get('display_map_route', 'true');
            //		 echo $standort->gmap_latitude;
            //		 echo $standort->gmap_longitude;
            //		 echo $standort->name;
            if ($this->params->get('display_detail_einsatzgebiet', '1')) {
                $alarmareas1 = $this->gmap_config->gmap_alarmarea;
                // Einsatzgebiet  ---->
                $alarmareas = explode('|', $alarmareas1);
                $einsatzgebiet = '[ ';
                for ($i = 0; $i < count($alarmareas) - 1; $i++) {
                    $areas = explode(',', $alarmareas[$i]);
                    $einsatzgebiet = $einsatzgebiet . 'new google.maps.LatLng(' . $areas[0] . ',' . $areas[1] . '),';
                }
                $areas = explode(',', $alarmareas[0]);
                $einsatzgebiet = $einsatzgebiet . 'new google.maps.LatLng(' . $areas[0] . ',' . $areas[1] . '),';
                $einsatzgebiet = substr($einsatzgebiet, 0, strlen($einsatzgebiet) - 1);
                $einsatzgebiet = $einsatzgebiet . ' ]';
            } else {
                $einsatzgebiet = '[[0,0]]';
            }
            $display_detail_popup = $this->params->get('display_detail_popup', 'false');
            $marker1_title = '';
            $marker1_lat = '';
            $marker1_lng = '';
            $marker1_image = '';
            $marker2_title = '';
            $marker2_lat = '';
            $marker2_lng = '';
            $marker2_image = '';
            if ($this->params->get('display_detail_einsatz_marker', '1') && $this->item->gmap == '1') {
                $marker1_title = $this->item->summary;
                $marker1_lat = $this->item->gmap_report_latitude;
                $marker1_lng = $this->item->gmap_report_longitude;
                $marker1_image = $this->einsatzlogo->icon;
                //$marker1_image 		= 'images/com_einsatzkomponente/images/map/icons/'.$this->params->get('detail_pointer1_image','circle.png');
            } else {
                $marker1_lat = '1';
                $marker1_lng = '1';
            }
            $center_lat = $this->item->gmap_report_latitude;
            $center_lng = $this->item->gmap_report_longitude;
            $gmap_zoom_level = $this->params->get('detail_gmap_zoom_level', '12');
            $gmap_onload = $this->params->get('detail_gmap_onload', 'HYBRID');
            $zoom_control = $this->params->get('detail_zoom_control', 'false');
            $document->addScript('https://maps.googleapis.com/maps/api/js?v=3.exp');
            $document->addScriptDeclaration(EinsatzkomponenteHelper::getGmap($marker1_title, $marker1_lat, $marker1_lng, $marker1_image, $marker2_title, $marker2_lat, $marker2_lng, $marker2_image, $center_lat, $center_lng, $gmap_zoom_level, $gmap_onload, $zoom_control, $organisationen, $orga_image, $einsatzgebiet, $display_detail_popup, $standort, $display_map_route));
        }
        if ($this->params->get('gmap_action', '0') == '2') {
            if ($this->params->get('display_detail_organisationen', '1')) {
                $orga = EinsatzkomponenteHelper::getOrganisationen();
                $organisationen = '[';
                // Feuerwehr Details  ------>
                $n = 0;
                for ($i = 0; $i < count($orga); $i++) {
                    $orga_image = $orga[$i]->gmap_icon_orga;
                    if (!$orga_image) {
                        $orga_image = 'images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png');
                    }
                    if ($i == $n - 1) {
                        $organisationen = $organisationen . '["' . $orga[$i]->name . '",' . $orga[$i]->gmap_latitude . ',' . $orga[$i]->gmap_longitude . ',' . $i . ',"' . $orga_image . '"]';
                    } else {
                        $organisationen = $organisationen . '["' . $orga[$i]->name . '",' . $orga[$i]->gmap_latitude . ',' . $orga[$i]->gmap_longitude . ',' . $i . ',"' . $orga_image . '"';
                        $organisationen = $organisationen . '],';
                    }
                }
                $organisationen = substr($organisationen, 0, strlen($organisationen) - 1);
                $organisationen = $organisationen . ' ];';
            } else {
                $organisationen = '[["",1,1,0,"images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png') . '"],["",1,1,0,"images/com_einsatzkomponente/images/map/icons/' . $this->params->get('einsatzkarte_orga_image', 'haus_rot.png') . '"] ]';
            }
            if ($this->params->get('display_detail_einsatzgebiet', '1')) {
                $alarmareas1 = $this->gmap_config->gmap_alarmarea;
                // Einsatzgebiet  ---->
                $alarmareas = explode('|', $alarmareas1);
                $einsatzgebiet = '[ ';
                for ($i = 0; $i < count($alarmareas) - 1; $i++) {
                    $areas = explode(',', $alarmareas[$i]);
                    $einsatzgebiet = $einsatzgebiet . '[' . $areas[1] . ',' . $areas[0] . '],';
                }
                $areas = explode(',', $alarmareas[0]);
                $einsatzgebiet = $einsatzgebiet . '[' . $areas[1] . ',' . $areas[0] . '],';
                $einsatzgebiet = substr($einsatzgebiet, 0, strlen($einsatzgebiet) - 1);
                $einsatzgebiet = $einsatzgebiet . ' ]';
            } else {
                $einsatzgebiet = '[[0,0]]';
            }
            $standort = EinsatzkomponenteHelper::getStandort_orga($this->item->auswahl_orga);
            $display_map_route = $this->params->get('$display_map_route', 'true');
            $display_detail_popup = $this->params->get('display_detail_popup', 'false');
            $marker1_title = '';
            $marker1_lat = '';
            $marker1_lng = '';
            $marker1_image = '';
            $marker2_title = '';
            $marker2_lat = '';
            $marker2_lng = '';
            $marker2_image = '';
            if ($this->params->get('display_detail_einsatz_marker', '1')) {
                $marker1_title = $this->item->summary;
                $marker1_lat = $this->item->gmap_report_latitude;
                $marker1_lng = $this->item->gmap_report_longitude;
                $marker1_image = $this->einsatzlogo->icon;
                //$marker1_image 		= 'images/com_einsatzkomponente/images/map/icons/'.$this->params->get('detail_pointer1_image','circle.png');
            } else {
                $marker1_title = $this->item->summary;
                $marker1_lat = '1';
                $marker1_lng = '1';
                $marker1_image = $this->einsatzlogo->icon;
            }
            $center_lat = $this->item->gmap_report_latitude;
            $center_lng = $this->item->gmap_report_longitude;
            $gmap_zoom_level = $this->params->get('detail_gmap_zoom_level', '12');
            $gmap_onload = $this->params->get('detail_gmap_onload', 'HYBRID');
            $zoom_control = $this->params->get('detail_zoom_control', 'false');
            $document->addScript('components/com_einsatzkomponente/assets/osm/util.js');
            $document->addScript('http://www.openlayers.org/api/OpenLayers.js');
            $document->addScript('http://www.openstreetmap.org/openlayers/OpenStreetMap.js');
            $document->addStyleSheet('components/com_einsatzkomponente/assets/osm/map.css');
            $document->addStyleSheet('components/com_einsatzkomponente/assets/osm/ie_map.css');
            $document->addScript('components/com_einsatzkomponente/assets/osm/OpenLayers_Map_minZoom_maxZoom_Patch.js');
            $document->addScriptDeclaration(EinsatzkomponenteHelper::getOsm($marker1_title, $marker1_lat, $marker1_lng, $marker1_image, $marker2_title, $marker2_lat, $marker2_lng, $marker2_image, $center_lat, $center_lng, $gmap_zoom_level, $gmap_onload, $zoom_control, $organisationen, $orga_image, $einsatzgebiet, $display_detail_popup, $standort, $display_map_route));
        }
        if ($this->params->get('display_detail_bootstrap', '0')) {
            // Import Bootstrap
            $document->addScript('components/com_einsatzkomponente/assets/bootstrap/js/bootstrap.min.js');
            $document->addStyleSheet('components/com_einsatzkomponente/assets/bootstrap/css/bootstrap.min.css');
            $document->addStyleSheet('components/com_einsatzkomponente/assets/bootstrap/css/bootstrap-responsive.min.css');
        }
        $document->addStyleDeclaration($this->params->get('detail_css', ''));
        ?>
    <script type="text/javascript">
	// override Highslide settings here
    // instead of editing the highslide.js file
    hs.graphicsDir = '<?php 
        echo JURI::Root();
        ?>
components/com_einsatzkomponente/assets/highslide/graphics/';
    </script>
 
 
 
 <?php 
        // Facebook OpenGraph
        if ($this->item->summary) {
            $summary = strip_tags($this->item->summary);
            $opengraph = '<meta property="og:title" content="#Einsatzinfo: ' . $summary . '"/>';
        }
        $opengraph .= '<meta property="og:type" content="article"/>';
        $opengraph .= '<meta property="og:url"  content="' . JURI::current() . '"/>';
        $opengraph .= '<meta property="og:site_name" content="#Einsatzinfo: ' . $this->einsatzlogo->title . '"/>';
        if ($this->item->summary) {
            $summary = strip_tags($this->item->summary);
            $opengraph .= '<meta property="og:description" content="Datum: ' . date('d.m.Y', strtotime($this->item->date1)) . ' --- Ort: #' . $this->item->address . ' --- #' . $summary . '" />';
        }
        if ($this->item->desc) {
            $desc = strip_tags($this->item->desc);
            $opengraph .= '<meta property="og:description" content="Datum: ' . date('d.m.Y', strtotime($this->item->date1)) . ' --- Ort: #' . $this->item->address . ' --- #' . $desc . '" />';
        }
        if ($this->einsatzlogo->list_icon) {
            $fileName_image = str_replace(' ', '%20', $this->einsatzlogo->list_icon);
            $opengraph .= '<meta property="og:image" content="' . JURI::base() . $fileName_image . '"/>';
        }
        //$opengraph .= '<meta property="article:publisher" content="https://www.einsatzkomponente.de" />';
        if ($this->item->image) {
            $fileName_image = str_replace(' ', '%20', $this->item->image);
            $opengraph .= '<meta property="og:image" content="' . JURI::base() . $fileName_image . '"/>';
        }
        if ($this->images) {
            for ($i = 0; $i < count($this->images); ++$i) {
                $fileName_image = str_replace(' ', '%20', $this->images[$i]->image);
                $opengraph .= '<meta property="og:image" content="' . JURI::base() . $fileName_image . '"/>';
            }
        }
        $document->addCustomTag($opengraph);
        // Wenn Titlebild in Bildergalerie enthalten, dann dieses aus der Bildergalerie löschen
        //	if ($this->images and $this->item->image) :
        //		$i='0';
        //		while ($i < count($this->images)){
        //		if ($this->images[$i]->image == $this->item->image) :
        //			unset($this->images[$i]);$this->images[$i] = '';
        //		endif;
        //		$i++;
        //		}
        //	endif;
        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            throw new Exception(implode("\n", $errors));
        }
        if ($this->_layout == 'edit') {
            $authorised = $user->authorise('core.create', 'com_einsatzkomponente');
            if ($authorised !== true) {
                throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'));
            }
        }
        if ($this->item->state === '0') {
            throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), '0');
        }
        if ($this->item->state === '2') {
            throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), '2');
        }
        if ($this->item->state === '-2') {
            throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), '-2');
        }
        // Increment the hit counter of the event.
        $model = $this->getModel();
        $model->hit();
        $this->_prepareDocument();
        parent::display($tpl);
    }