/**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     if (isset($this->item->checked_out)) {
         $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     } else {
         $checkedOut = false;
     }
     $canDo = FirefightersHelper::getActions();
     JToolBarHelper::title(JText::_('COM_FIREFIGHTERS_TITLE_AUSBILDUNG'), 'ausbildung.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('ausbildung.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('ausbildung.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('ausbildung.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('ausbildung.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('ausbildung.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('ausbildung.cancel', 'JTOOLBAR_CLOSE');
     }
 }
    /**
     * Method to get the field input markup.
     *
     * @return  string	The field input markup.
     * @since   3.0
     */
    protected function getInput()
    {
        $document = JFactory::getDocument();
        require_once JPATH_SITE . '/administrator/components/com_firefighters/helpers/firefighters.php';
        $html = array();
        $val = '';
        $val = FirefightersHelper::getValidation();
        if ($val == '12') {
            $html[] = '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">x</button><span aria-hidden="true" class="icon-cancel"></span> ' . JText::_('<p>Diese Version von <b>Einsatzkomponente</b> ist validiert. <br/> Vielen Dank f&uuml;r Ihre Unterst&uuml;tzung.</p><p>- Die Copyrights im Frontend, sollten jetzt alle entfernt sein.</p>');
        } else {
            $html[] = '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">x</button><span aria-hidden="true" class="icon-cancel"></span>Diese Version von <b>Firefighters Team Manager</b> ist nicht validiert. Sie k&ouml;nnen selbstverst&auml;ndlich <b>alle Funktionen</b> kostenlos nutzen,<br/> aber &uuml;ber eine kleine Unterst&uuml;tzung an die Entwickler, w&uuml;rden wir uns nat&uuml;rlich sehr freuen. <br/>Helfen Sie uns, damit wir Ihnen dieses und weitere Projekte auch in Zukunft kostenlos und ohne Werbung anbieten k&ouml;nnen. <br/><br/>Schicken Sie eine Anfrage via Mail an validate@einsatzkomponente.de und holen Sie sich heute noch den Validation-Schl&uuml;ssel.<br/><br/><p>kleiner Vorteil:<br/>- Das Copyright im Frontend wird dadurch entfernt.  ;-)<br/>- und bevorzugten Support im Forum und via Email</p></div><a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XPQALX4UFFGM4"><div>Spende &uuml;ber PAYPAL : <img border=0  src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif" /></div></a><br/><br/>
';
            if ($val == '1') {
                $html[] = '<span class="label label-important">Achtung !! Dies ist keine g&uuml;ltige URL. (Wenden Sie sich bitte an den Support im Forum)</span>';
            }
            if ($val == '2') {
                $html[] = '<span class="label label-important">Achtung !! Dies ist kein g&uuml;ltiges Passwort. (Wenden Sie sich bitte an den Support im Forum)</span>';
            }
        }
        $html[] = '<h2>Firefighters Team Manager Version</h2>';
        if ($val == '12') {
            $html[] = '';
        } else {
            $html[] = '<h3>Entwickler-Version</h3>';
        }
        $html[] = '<p></p>';
        $html[] = '<p><a href="http://www.einsatzkomponente.de/" target="_blank">Supportforum: http://www.einsatzkomponente.de/</a></p>';
        return implode($html);
    }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/firefighters.php';
     $state = $this->get('State');
     $canDo = FirefightersHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_FIREFIGHTERS_TITLE_ABTEILUNGEN'), 'abteilungen.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/abteilung';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('abteilung.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('abteilung.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('abteilungen.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('abteilungen.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         } else {
             if (isset($this->items[0])) {
                 //If this component does not use state then show a direct delete button as we can not trash
                 JToolBarHelper::deleteList('', 'abteilungen.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('abteilungen.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('abteilungen.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
         }
     }
     //Show trash and delete for components that uses the state field
     if (isset($this->items[0]->state)) {
         if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'abteilungen.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('abteilungen.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_firefighters');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_firefighters&view=abteilungen');
     $this->extra_sidebar = '';
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true));
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/firefighters.php';
     $state = $this->get('State');
     $canDo = FirefightersHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_FIREFIGHTERS_TITLE_KONTROLLCENTERS'), 'kontrollcenters.png');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_firefighters');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_firefighters&view=kontrollcenter');
     $this->extra_sidebar = '';
     //
 }
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->params = $app->getParams('com_firefighters');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     require_once JPATH_SITE . '/administrator/components/com_firefighters/helpers/firefighters.php';
     // Helper-class laden
     $document = JFactory::getDocument();
     // Import CSS
     $document->addStyleSheet('components/com_einsatzkomponente/assets/css/firefighters.css');
     $document->addStyleDeclaration($this->params->get('mitglieder_css', ''));
     //Komponentenversion aus Datenbank lesen
     $this->version = FirefightersHelper::getVersion();
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/firefighters.php';
     $state = $this->get('State');
     $canDo = FirefightersHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_FIREFIGHTERS_TITLE_TERMINE'), 'termine.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/termin';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('termin.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('termin.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('termine.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('termine.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         } else {
             if (isset($this->items[0])) {
                 //If this component does not use state then show a direct delete button as we can not trash
                 JToolBarHelper::deleteList('', 'termine.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('termine.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('termine.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
         }
     }
     //Show trash and delete for components that uses the state field
     if (isset($this->items[0]->state)) {
         if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'termine.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('termine.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_firefighters');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_firefighters&view=termine');
     $this->extra_sidebar = '';
     //Filter for the field abteilungen;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_firefighters.termin', 'termin');
     $field = $form->getField('abteilungen');
     $query = $form->getFieldAttribute('filter_abteilungen', 'query');
     $translate = $form->getFieldAttribute('filter_abteilungen', 'translate');
     $key = $form->getFieldAttribute('filter_abteilungen', 'key_field');
     $value = $form->getFieldAttribute('filter_abteilungen', 'value_field');
     // Get the database object.
     $db = JFactory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     JHtmlSidebar::addFilter('$Abteilungen', 'filter_abteilungen', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.abteilungen')), true);
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true));
 }