Esempio n. 1
0
 /**
  * Tests the JHtmlList::users method.
  *
  * @return  void
  *
  * @since   3.1
  */
 public function testUsers()
 {
     $result = JHtmlList::users('user-list', '43', '1');
     // Build the container to check the <select> element
     $matcher = array('id' => 'user-list', 'tag' => 'select', 'child' => array('tag' => 'option', 'content' => 'Publisher', 'attributes' => array('selected' => 'selected', 'value' => '43')));
     $this->assertTag($matcher, $result, 'Expected a <select> element with id "user-list" containing a child <option value="43" selected="selected">Publisher</option>');
     $result = JHtmlList::users('user-list', '42');
     // Build the container to check the <select> element
     $matcher = array('id' => 'user-list', 'tag' => 'select', 'child' => array('tag' => 'option', 'content' => 'Publisher', 'attributes' => array('value' => '43')));
     $this->assertTag($matcher, $result, 'Expected a <select> element with id "user-list" containing a child <option value="43">Publisher</option>');
 }
 /**
  * Tests the JHtmlList::users method.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function testUsers()
 {
     $this->assertThat(JHtmlList::users('user-list', '43', '1'), $this->StringContains('<option value="43" selected="selected">Publisher</option>'));
     $this->assertThat(JHtmlList::users('user-list', '42'), $this->StringContains('<option value="43">Publisher</option>'));
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/einsatzkomponente.php';
     $state = $this->get('State');
     $canDo = EinsatzkomponenteHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_EINSATZKOMPONENTE_TITLE_EINSATZBILDMANAGER'), 'einsatzbildmanager.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/einsatzbilderbearbeiten';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('einsatzbilderbearbeiten.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('einsatzbilderbearbeiten.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('einsatzbildmanager.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('einsatzbildmanager.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('', 'einsatzbildmanager.delete', 'JTOOLBAR_DELETE');
             }
         }
         //            if (isset($this->items[0]->state)) {
         //			    JToolBarHelper::divider();
         //			    JToolBarHelper::archiveList('einsatzbildmanager.archive','JTOOLBAR_ARCHIVE');
         //            }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('einsatzbildmanager.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
         }
     }
     JToolBarHelper::custom('einsatzbildmanager.thumb', 'edit', 'edit', 'Thumbs erstellen', true);
     JToolBarHelper::custom('einsatzbildmanager.repid', 'upload', 'upload', 'Flash Uploader', false);
     //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('', 'einsatzbildmanager.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 //JToolBarHelper::trash('einsatzbildmanager.trash','JTOOLBAR_TRASH');
                 JToolBarHelper::deleteList('', 'einsatzbildmanager.delete', 'JTOOLBAR_DELETE');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_einsatzkomponente');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_einsatzkomponente&view=einsatzbildmanager');
     //Filter for the field created_by
     $this->extra_sidebar .= '<small><label for="filter_created_by">Created by</label></small>';
     $this->extra_sidebar .= JHtmlList::users('filter_created_by', $this->state->get('filter.created_by'), 1, 'onchange="this.form.submit();"');
     $options = '';
     $options[] = JHtml::_('select.option', '1', 'JPUBLISHED');
     $options[] = JHtml::_('select.option', '0', 'JUNPUBLISHED');
     $options[] = JHtml::_('select.option', '*', 'JALL');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.state'), true));
     $this->extra_sidebar = '';
 }
Esempio n. 4
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/localize_empresa.php';
     $state = $this->get('State');
     $canDo = Localize_empresaHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_LOCALIZE_EMPRESA_TITLE_CADASTRODEEMPRESAS'), 'cadastrodeempresas.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/cadastrodeempresa';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('cadastrodeempresa.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('cadastrodeempresa.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('cadastrodeempresas.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('cadastrodeempresas.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('', 'cadastrodeempresas.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('cadastrodeempresas.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('cadastrodeempresas.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('', 'cadastrodeempresas.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('cadastrodeempresas.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_localize_empresa');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_localize_empresa&view=cadastrodeempresas');
     $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));
     //Filter for the field corretores
     $this->extra_sidebar .= '<div class="other-filters">';
     $this->extra_sidebar .= '<small><label for="filter_corretores">Corretores</label></small>';
     $this->extra_sidebar .= JHtmlList::users('filter_corretores', $this->state->get('filter.corretores'), 1, 'onchange="this.form.submit();"');
     $this->extra_sidebar .= '</div>';
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/einsatzkomponente.php';
     $state = $this->get('State');
     $canDo = EinsatzkomponenteHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_EINSATZKOMPONENTE_TITLE_EINSATZBERICHTE'), 'einsatzberichte.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/einsatzbericht';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('einsatzbericht.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('einsatzbericht.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('einsatzberichte.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('einsatzberichte.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('', 'einsatzberichte.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('einsatzberichte.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('', 'einsatzberichte.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 //JToolBarHelper::trash('einsatzberichte.trash','JTOOLBAR_TRASH');
                 JToolBarHelper::deleteList('', 'einsatzberichte.delete', 'JTOOLBAR_DELETE');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_einsatzkomponente');
         if ($this->params->get('send_mail_backend', '0')) {
             JToolBarHelper::custom('einsatzberichte.sendMail', 'edit', 'edit', 'Als Mail versenden', true);
         }
     }
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::custom('einsatzberichte.article', 'edit', 'edit', 'Als Artikel erstellen', true);
         }
         JToolBarHelper::custom('einsatzberichte.pdf', 'upload', 'upload', 'Als PDF exportieren', true);
     }
     if ($canDo->get('core.create')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('einsatzberichte.archive', 'Als Folgeeinsatz markieren');
         }
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_einsatzkomponente&view=einsatzberichte');
     $this->extra_sidebar = '';
     //Filter for the field auswahl_orga;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_einsatzkomponente.einsatzbericht', 'einsatzbericht');
     $field = $form->getField('auswahl_orga');
     $query = $form->getFieldAttribute('filter_auswahl_orga', 'query');
     $translate = $form->getFieldAttribute('filter_auswahl_orga', 'translate');
     $key = $form->getFieldAttribute('filter_auswahl_orga', 'key_field');
     $value = $form->getFieldAttribute('filter_auswahl_orga', '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('$auswahl_orga', 'filter_auswahl_orga', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.auswahl_orga')), true);
     //Filter for the field tickerkat;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_einsatzkomponente.einsatzbericht', 'einsatzbericht');
     $field = $form->getField('tickerkat');
     $query = $form->getFieldAttribute('filter_tickerkat', 'query');
     $translate = $form->getFieldAttribute('filter_tickerkat', 'translate');
     $key = $form->getFieldAttribute('filter_tickerkat', 'key_field');
     $value = $form->getFieldAttribute('filter_tickerkat', '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('$tickerkat', 'filter_tickerkat', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.tickerkat')), true);
     //Filter for the field data1;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_einsatzkomponente.einsatzbericht', 'einsatzbericht');
     $field = $form->getField('data1');
     $query = $form->getFieldAttribute('filter_data1', 'query');
     $translate = $form->getFieldAttribute('filter_data1', 'translate');
     $key = $form->getFieldAttribute('filter_data1', 'key_field');
     $value = $form->getFieldAttribute('filter_data1', '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('$data1', 'filter_data1', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.data1')), true);
     //Filter for the field alerting;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_einsatzkomponente.einsatzbericht', 'einsatzbericht');
     $field = $form->getField('alerting');
     $query = $form->getFieldAttribute('filter_alerting', 'query');
     $translate = $form->getFieldAttribute('filter_alerting', 'translate');
     $key = $form->getFieldAttribute('filter_alerting', 'key_field');
     $value = $form->getFieldAttribute('filter_alerting', '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('$alerting', 'filter_alerting', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.alerting')), true);
     //Filter for the field date1
     $this->extra_sidebar .= '<div class="div_side_filter">';
     $this->extra_sidebar .= '<small><label for="filter_from_date1">ab Datum</label></small>';
     $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.date1.from'), 'filter_from_date1', 'filter_from_date1', '%Y-%m-%d', array('style' => 'width:142px;', 'onchange' => 'this.form.submit();'));
     $this->extra_sidebar .= '<small><label for="filter_to_date1">bis Datum</label></small>';
     $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.date1.to'), 'filter_to_date1', 'filter_to_date1', '%Y-%m-%d', array('style' => 'width:142px;', 'onchange' => 'this.form.submit();'));
     $this->extra_sidebar .= '<hr class="hr-condensed">';
     $this->extra_sidebar .= '</div>';
     $options = '';
     $options[] = JHtml::_('select.option', '1', 'JPUBLISHED');
     $options[] = JHtml::_('select.option', '0', 'JUNPUBLISHED');
     $options[] = JHtml::_('select.option', '2', 'Folgeeinsatz');
     $options[] = JHtml::_('select.option', '*', 'JALL');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.state'), true));
     //Filter for the field created_by
     $this->extra_sidebar .= '<div class="div_side_filter">';
     $this->extra_sidebar .= '<small><label for="filter_created_by">Erstellt von</label></small>';
     $this->extra_sidebar .= JHtmlList::users('filter_created_by', $this->state->get('filter.created_by'), 1, 'onchange="this.form.submit();"');
     $this->extra_sidebar .= '</div>';
 }