/** * 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 = TjfieldsHelper::getActions(); JToolBarHelper::title(JText::_('COM_TJFIELDS_TITLE_FIELD'), 'field.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('field.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('field.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::custom('field.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('field.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } if (empty($this->item->id)) { JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/tjfields.php'; $state = $this->get('State'); $canDo = TjfieldsHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_TJFIELDS_TITLE_GROUPS'), 'groups.png'); //Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/group'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('group.add', 'JTOOLBAR_NEW'); } /* if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('group.edit','JTOOLBAR_EDIT'); }*/ } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('groups.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('groups.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('', 'groups.delete', 'JTOOLBAR_DELETE'); } } /* if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('groups.archive','JTOOLBAR_ARCHIVE'); }*/ if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('groups.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('', 'groups.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('groups.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_tjfields'); } $this->extra_sidebar = ''; if (JVERSION >= '3.0') { //Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_tjfields&view=groups'); 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. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/tjfields.php'; $state = $this->get('State'); $canDo = TjfieldsHelper::getActions(); // Let's get the extension name $client = JFactory::getApplication()->input->get('client', '', 'STRING'); $extensionName = strtoupper($client); // Need to load the menu language file as mod_menu hasn't been loaded yet. $lang = JFactory::getLanguage(); $lang->load($client, JPATH_ADMINISTRATOR, null, false, true); if (JVERSION >= '3.0') { JToolBarHelper::title(JText::_($extensionName) . ': ' . JText::_('COM_TJFIELDS_TITLE_COUNTRIES'), 'list'); } else { JToolBarHelper::title(JText::_($extensionName) . ': ' . JText::_('COM_TJFIELDS_TITLE_COUNTRIES'), 'countries.png'); } // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/country'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('country.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('country.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('countries.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('countries.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_tjfields'); } if (JVERSION >= '3.0') { // Set sidebar action JHtmlSidebar::setAction('index.php?option=com_tjfields&view=countries'); } $this->extra_sidebar = ''; }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; // Let's get the extension name $client = JFactory::getApplication()->input->get('client', '', 'STRING'); $extensionName = strtoupper($client); // Need to load the menu language file as mod_menu hasn't been loaded yet. $lang = JFactory::getLanguage(); $lang->load($client, JPATH_ADMINISTRATOR, null, false, true); $viewTitle = JText::_($extensionName); if ($isNew) { $viewTitle = $viewTitle . ': ' . JText::_('COM_TJFIELDS_ADD_CITY'); } else { $viewTitle = $viewTitle . ': ' . JText::_('COM_TJFIELDS_EDIT_CITY'); } if (JVERSION >= '3.0') { JToolBarHelper::title($viewTitle, 'pencil-2'); } else { JToolBarHelper::title($viewTitle, 'city.png'); } if (isset($this->item->checked_out)) { $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); } else { $checkedOut = false; } $canDo = TjfieldsHelper::getActions(); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('city.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('city.save', 'JTOOLBAR_SAVE'); } if (empty($this->item->id)) { JToolBarHelper::cancel('city.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('city.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/tjfields.php'; $state = $this->get('State'); $canDo = TjfieldsHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_TJFIELDS_TITLE_FIELDS'), 'fields.png'); //Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/field'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('field.add', 'JTOOLBAR_NEW'); } /* if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('field.edit','JTOOLBAR_EDIT'); }*/ } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('fields.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('fields.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('', 'fields.delete', 'JTOOLBAR_DELETE'); } } /* if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('fields.archive','JTOOLBAR_ARCHIVE'); }*/ if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('fields.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('', 'fields.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('fields.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_tjfields'); } $input = jFactory::getApplication()->input; $this->extra_sidebar = ''; //Filter for the field field_type $select_label = JText::sprintf('COM_TJFIELDS_FILTER_SELECT_LABEL', 'Field Type'); $options = array(); $options[0] = new stdClass(); $options[0]->value = "text"; $options[0]->text = "Text"; $options[1] = new stdClass(); $options[1]->value = "radio"; $options[1]->text = "Radio"; $options[2] = new stdClass(); $options[2]->value = "single_select"; $options[2]->text = "Single select"; $options[3] = new stdClass(); $options[3]->value = "multi_select"; $options[3]->text = "Multiple select"; $options[4] = new stdClass(); $options[4]->value = "hidden"; $options[4]->text = "Hidden"; $options[5] = new stdClass(); $options[5]->value = "textarea"; $options[5]->text = "Textarea"; $options[6] = new stdClass(); $options[6]->value = "checkbox"; $options[6]->text = "Checkbox"; $options[7] = new stdClass(); $options[7]->value = "calender"; $options[7]->text = "Calender"; $options[8] = new stdClass(); $options[8]->value = "editor"; $options[8]->text = "Editor"; $options[9] = new stdClass(); $options[9]->value = "email_field"; $options[9]->text = "Email"; $options[10] = new stdClass(); $options[10]->value = "password"; $options[10]->text = "Password"; $options[11] = new stdClass(); $options[11]->value = "file"; $options[11]->text = "File"; if (JVERSION >= '3.0') { //Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_tjfields&view=fields&client="' . $input->get('client', '', 'STRING') . '"'); JHtmlSidebar::addFilter($select_label, 'filter_field_type', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.type'), true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); } }