protected function addToolBar() { $canDo = SmartIconsHelper::getActions(); JToolBarHelper::title(JText::_('COM_SMARTICONS_MANAGER_ICONS'), 'smarticons'); if ($canDo->get('core.create')) { JToolBarHelper::addNew('icon.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit')) { JToolBarHelper::editList('icon.edit', 'JTOOLBAR_EDIT'); JToolBarHelper::divider(); } if ($canDo->get('core.edit.state')) { JToolBarHelper::custom('icons.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('icons.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); JToolBarHelper::custom('icons.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); JToolBarHelper::divider(); } if ($canDo->get('core.create')) { $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Popup', 'upload', 'COM_SMARTICONS_ICONS_TOOLBAR_IMPORT', 'index.php?option=com_smarticons&view=import&tmpl=component', 500, 180); $bar->appendButton('Link', 'download', 'COM_SMARTICONS_ICONS_TOOLBAR_EXPORT', 'index.php?option=com_smarticons&task=icons.export&format=raw'); // JToolBarHelper::custom('icons.export', 'download.png', 'download_f2.png', 'COM_SMARTICONS_ICONS_TOOLBAR_EXPORT', true); JToolBarHelper::divider(); } if ($canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'icons.delete', 'JTOOLBAR_DELETE'); JToolBarHelper::divider(); } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_smarticons'); } }
function addToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->id; $isNew = $this->item->idIcon == 0; $canDo = SmartIconsHelper::getActions($this->item->idIcon); JToolBarHelper::title($isNew ? JText::_('COM_SMARTICONS_MANAGER_ICON_NEW') : JText::_('COM_SMARTICONS_MANAGER_ICON_EDIT'), 'smarticons'); // Built the actions for new and existing records. if ($isNew) { // For new records, check the create permission. if ($canDo->get('core.create')) { JToolBarHelper::apply('icon.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('icon.save', 'JTOOLBAR_SAVE'); JToolBarHelper::custom('icon.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } JToolBarHelper::cancel('icon.cancel', 'JTOOLBAR_CANCEL'); } else { if ($canDo->get('core.edit')) { // We can save the new record JToolBarHelper::apply('icon.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('icon.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { JToolBarHelper::custom('icon.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } if ($canDo->get('core.create')) { JToolBarHelper::custom('icon.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } JToolBarHelper::cancel('icon.cancel', 'JTOOLBAR_CLOSE'); } }