protected function addToolbar() { $state = $this->get('State'); $canDo = SimplefilemanagerHelper::getActions($state->get('filter.category_id')); $user = JFactory::getUser(); $bar = JToolBar::getInstance('toolbar'); JToolbarHelper::title(JText::_('COM_SIMPLEFILEMANAGER_MANAGER_SIMPLEFILEMANAGERS'), 'file-2'); // User should be authorized to publish at least in a category if ($canDo->get('core.create') && count($user->getAuthorisedCategories('com_simplefilemanager', 'core.create')) > 0) { JToolbarHelper::addNew('simplefilemanager.add'); } if ($canDo->get('core.edit')) { JToolbarHelper::editList('simplefilemanager.edit'); } if ($canDo->get('core.edit.state')) { JToolbarHelper::publish('simplefilemanagers.publish', 'JTOOLBAR_PUBLISH', true); JToolbarHelper::unpublish('simplefilemanagers.unpublish', 'JTOOLBAR_UNPUBLISH', true); JToolbarHelper::archiveList('simplefilemanagers.archive'); JToolbarHelper::checkin('simplefilemanagers.checkin'); } $state = $this->get('State'); if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'simplefilemanagers.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('simplefilemanagers.trash'); } if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_simplefilemanager'); } JToolBarHelper::help('COM_SIMPLEFILEMANAGER_HELP_VIEW_SIMPLEFILEMANANGERS', false, 'http://www.simplefilemanager.eu/support'); JHtmlSidebar::setAction('index.php?option=com_simplefilemanager&view=simplefilemanagers'); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true)); $this->category = JFormHelper::loadFieldType('catid', false); $this->categoryOptions = $this->category->getOptions(); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category', JHtml::_('select.options', $this->categoryOptions, 'value', 'text', $this->state->get('filter.category'))); $this->visibilityOptions = array(1 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_PUBLIC'), 2 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_REGISTRED'), 3 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_USER'), 4 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_GROUP'), 5 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_AUTHOR')); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_VISIBILITY'), 'filter_visibility', JHtml::_('select.options', $this->visibilityOptions, 'value', 'text', $this->state->get('filter.visibility'))); }
protected function addToolbar() { $input = JFactory::getApplication()->input; $input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $canDo = SimplefilemanagerHelper::getActions($this->item->catid, 0); if ($isNew) { JToolBarHelper::title(JText::_('COM_simplefilemanager_new_simplefilemanager')); } else { JToolBarHelper::title(JText::_('COM_simplefilemanager_edit_simplefilemanager')); } if ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_simplefilemanager', 'core.create'))) { JToolbarHelper::apply('simplefilemanager.apply'); JToolbarHelper::save('simplefilemanager.save'); if (!$isNew) { JToolbarHelper::save2new('simplefilemanager.save2new'); JToolbarHelper::save2copy('simplefilemanager.save2copy'); } } JToolBarHelper::cancel('simplefilemanager.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'); }