예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $this->params = $app->getParams('com_einsatzkomponente');
     $this->pagination = $this->get('Pagination');
     require_once JPATH_SITE . '/administrator/components/com_einsatzkomponente/helpers/einsatzkomponente.php';
     // Helper-class laden
     $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' ?
     $rows = EinsatzkomponenteHelper::letze_x_einsatzdaten($this->params->get('rss_items', '10'));
     $years = EinsatzkomponenteHelper::getYear();
     foreach ($years as $year) {
         $yeararray[$year->id] = EinsatzkomponenteHelper::einsatz_daten_bestimmtes_jahr($year->id, 9999, 0);
         $eicount[$year->id] = count($yeararray[$year->id]);
     }
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     $this->document->link = JRoute::_('index.php?option=com_einsatzkomponente&view=einsatzberichte&Itemid=' . $menu->id);
     foreach ($rows as $row) {
         $data = array();
         foreach (explode(',', $row->auswahl_orga) as $value) {
             $db = JFactory::getDbo();
             $query = $db->getQuery(true);
             $query->select('name')->from('`#__eiko_organisationen`')->where('id = "' . $value . '"');
             $db->setQuery($query);
             $results = $db->loadObjectList();
             if (count($results)) {
                 $data[] = '' . $results[0]->name . '';
             }
         }
         $auswahl_orga = implode(',', $data);
         $auswahl_orga = str_replace(",", " +++ ", $auswahl_orga);
         $title = html_entity_decode($title);
         $summary = $this->escape($row->summary);
         $title = html_entity_decode($summary);
         $desc = strip_tags($row->desc);
         $desc = strlen($desc) > $this->params->get('rss_chars', '1000') ? substr($desc, 0, strrpos(substr($desc, 0, $this->params->get('rss_chars', '1000') + 1), ' ')) . ' ...' : $desc;
         // url link to article
         // & used instead of &amp; as this is converted by feed creator
         $link = JRoute::_('index.php?option=com_einsatzkomponente&view=einsatzbericht' . $this->layout_detail_link . '&id=' . $row->id);
         // strip html from feed item description text
         /*$description	= ($params->get('feed_summary', 0) ? $row->introtext.$row->fulltext : $row->introtext);
         			$author			= $row->created_by_alias ? $row->created_by_alias : $row->author;
         */
         // load individual item creator class
         $item = new JFeedItem();
         $itemyear = date("Y", strtotime($row->date1));
         $rssnr = $eicount[$itemyear];
         $item->title = "+++ Einsatz Nr: " . $rssnr . " - " . $title . " +++";
         $item->link = $link;
         $item->description .= '<table>';
         if ($this->params->get('show_rss_image', '1')) {
             if ($row->foto) {
                 $item->description .= '<tr><td><img src="' . JURI::base() . $row->foto . '" width="' . $this->params->get('rss_image_width', '150px') . '" height="' . $this->params->get('rss_image_height', '') . '" /></td></tr>';
             }
         }
         if ($row->desc) {
             $item->description .= '<tr><td>' . $desc . '</td></tr>';
         }
         if ($row->auswahl_orga) {
             $item->description .= '<tr><td><b>Einsatzkräfte</b>: +++ ' . $auswahl_orga . '</td></tr>';
         }
         $item->date = date('r', strtotime($row->date1));
         $item->description .= '</table>';
         /*$item->category   	= $row->category;
         			$item->author		= $author;
         			if ($feedEmail == 'site') {
         				$item->authorEmail = $siteEmail;
         			}
         			else {
         				$item->authorEmail = $row->author_email;
         			}
         */
         // loads item info into rss array
         $this->document->addItem($item);
         $eicount[$itemyear]--;
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     parent::display($tpl);
 }