/**
  * 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 = MapaHelper::getActions();
     JToolBarHelper::title(JText::_('COM_MAPA_TITLE_VISTAMAPA'), 'vistamapa.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('vistamapa.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('vistamapa.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('vistamapa.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('vistamapa.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('vistamapa.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('vistamapa.cancel', 'JTOOLBAR_CLOSE');
     }
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/mapa.php';
     $state = $this->get('State');
     $canDo = MapaHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_MAPA_TITLE_VISTAMAPAS'), 'vistamapas.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/vistamapa';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('vistamapa.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('vistamapa.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('vistamapas.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('vistamapas.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('', 'vistamapas.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('vistamapas.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('vistamapas.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('', 'vistamapas.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('vistamapas.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_mapa');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_mapa&view=vistamapas');
     $this->extra_sidebar = '';
     //
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/mapa.php';
     $state = $this->get('State');
     $canDo = MapaHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_MAPA_TITLE_MAPVENEZUELA'), 'mapvenezuela.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/mapadevenezuela';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('mapadevenezuela.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('mapadevenezuela.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('mapvenezuela.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('mapvenezuela.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('', 'mapvenezuela.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('mapvenezuela.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('mapvenezuela.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('', 'mapvenezuela.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('mapvenezuela.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_mapa');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_mapa&view=mapvenezuela');
     $this->extra_sidebar = '';
     //Filter for the field nom_entidad
     $select_label = JText::sprintf('COM_MAPA_FILTER_SELECT_LABEL', 'Entidad');
     $options = array();
     $options[0] = new stdClass();
     $options[0]->value = "VE-A";
     $options[0]->text = "Distrito Capital";
     $options[1] = new stdClass();
     $options[1]->value = "VE-B";
     $options[1]->text = "Anzoátegui";
     $options[2] = new stdClass();
     $options[2]->value = "VE-C";
     $options[2]->text = "Apure";
     $options[3] = new stdClass();
     $options[3]->value = "VE-D";
     $options[3]->text = "Aragua";
     $options[4] = new stdClass();
     $options[4]->value = "VE-Z";
     $options[4]->text = "Amazonas";
     $options[5] = new stdClass();
     $options[5]->value = "VE-E";
     $options[5]->text = "Barinas";
     $options[6] = new stdClass();
     $options[6]->value = "VE-F";
     $options[6]->text = "Bolívar";
     $options[7] = new stdClass();
     $options[7]->value = "VE-G";
     $options[7]->text = "Carabobo";
     $options[8] = new stdClass();
     $options[8]->value = "VE-H";
     $options[8]->text = "Cojedes";
     $options[9] = new stdClass();
     $options[9]->value = "VE-Y";
     $options[9]->text = "Delta Amacuro";
     $options[10] = new stdClass();
     $options[10]->value = "VE-I";
     $options[10]->text = "Falcón";
     $options[11] = new stdClass();
     $options[11]->value = "VE-J";
     $options[11]->text = "Guárico";
     $options[12] = new stdClass();
     $options[12]->value = "VE-K";
     $options[12]->text = "Lara";
     $options[13] = new stdClass();
     $options[13]->value = "VE-L";
     $options[13]->text = "Mérida";
     $options[14] = new stdClass();
     $options[14]->value = "VE-M";
     $options[14]->text = "Miranda";
     $options[15] = new stdClass();
     $options[15]->value = "VE-N";
     $options[15]->text = "Monagas";
     $options[16] = new stdClass();
     $options[16]->value = "VE-O";
     $options[16]->text = "Nueva Esparta";
     $options[17] = new stdClass();
     $options[17]->value = "VE-P";
     $options[17]->text = "Portuguesa";
     $options[18] = new stdClass();
     $options[18]->value = "VE-R";
     $options[18]->text = "Sucre";
     $options[19] = new stdClass();
     $options[19]->value = "VE-S";
     $options[19]->text = "Táchira";
     $options[20] = new stdClass();
     $options[20]->value = "VE-T";
     $options[20]->text = "Trujillo";
     $options[21] = new stdClass();
     $options[21]->value = "VE-U";
     $options[21]->text = "Yaracuy";
     $options[22] = new stdClass();
     $options[22]->value = "VE-V";
     $options[22]->text = "Zulia";
     $options[23] = new stdClass();
     $options[23]->value = "VE-GE";
     $options[23]->text = "Esequibo";
     JHtmlSidebar::addFilter($select_label, 'filter_nom_entidad', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.nom_entidad'), true));
     //Filter for the field col_entidad
     $select_label = JText::sprintf('COM_MAPA_FILTER_SELECT_LABEL', 'Color Entidad');
     $options = array();
     $options[0] = new stdClass();
     $options[0]->value = "#FFFFFF";
     $options[0]->text = "BLANCO";
     $options[1] = new stdClass();
     $options[1]->value = "#FFFF00";
     $options[1]->text = "AMARILLO";
     $options[2] = new stdClass();
     $options[2]->value = "#0000FF";
     $options[2]->text = "AZUL";
     $options[3] = new stdClass();
     $options[3]->value = "#008000";
     $options[3]->text = "VERDE";
     $options[4] = new stdClass();
     $options[4]->value = "#FF0000";
     $options[4]->text = "ROJO";
     $options[5] = new stdClass();
     $options[5]->value = "#000000";
     $options[5]->text = "NEGRO";
     $options[6] = new stdClass();
     $options[6]->value = "#808080";
     $options[6]->text = "GRIS";
     $options[7] = new stdClass();
     $options[7]->value = "#FF8080";
     $options[7]->text = "ROSA";
     $options[8] = new stdClass();
     $options[8]->value = "#800080";
     $options[8]->text = "VIOLETA";
     $options[9] = new stdClass();
     $options[9]->value = "#80FFFF";
     $options[9]->text = "CELESTE";
     $options[10] = new stdClass();
     $options[10]->value = "#800000";
     $options[10]->text = "MARRON";
     $options[11] = new stdClass();
     $options[11]->value = "#FF8000";
     $options[11]->text = "NARANJA";
     $options[12] = new stdClass();
     $options[12]->value = "#8000FF";
     $options[12]->text = "LAVANDA";
     $options[13] = new stdClass();
     $options[13]->value = "#00FF80";
     $options[13]->text = "TURQUESA";
     $options[14] = new stdClass();
     $options[14]->value = "#E49E56";
     $options[14]->text = "DORADO";
     $options[15] = new stdClass();
     $options[15]->value = "#D4AF37";
     $options[15]->text = "ORO METAL";
     JHtmlSidebar::addFilter($select_label, 'filter_col_entidad', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.col_entidad'), true));
 }