Exemple #1
1
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = SibdietHelper::getActions();
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_ERRAND'), 'database errands');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('errand.apply');
         JToolBarHelper::save('errand.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('errand.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('errand.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('errand.cancel');
     } else {
         JToolBarHelper::cancel('errand.cancel', 'JTOOLBAR_CLOSE');
     }
 }
 /**
  * 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;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = $this->canDo;
     JToolbarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_CLIENT_NEW') : JText::_('COM_BANNERS_MANAGER_CLIENT_EDIT'), 'bookmark banners-clients');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolbarHelper::apply('client.apply');
         JToolbarHelper::save('client.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('client.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('client.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('client.cancel');
     } else {
         if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
             JToolbarHelper::versions('com_banners.client', $this->item->id);
         }
         JToolbarHelper::cancel('client.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS_EDIT');
 }
Exemple #3
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     // Built the actions for new and existing records.
     $canDo = JHelperContent::getActions('com_testyourself');
     JToolBarHelper::title(JText::_('COM_TESTYOURSELF_MANAGER_QUESTION'), 'question questions');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('question.apply');
         JToolBarHelper::save('question.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('question.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('question.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('question.cancel');
     } else {
         JToolBarHelper::cancel('question.cancel', 'JTOOLBAR_CLOSE');
     }
 }
 /**
  * Add the page title and toolbar.
  *
  */
 protected function addToolbar()
 {
     $isNew = $this->item->id == 0;
     $canDo = SnippetsHelper::getActions();
     JHtml::stylesheet('nnframework/style.min.css', false, true);
     JHtml::stylesheet('snippets/style.min.css', false, true);
     JFactory::getApplication()->input->set('hidemainmenu', true);
     // Set document title
     JFactory::getDocument()->setTitle(JText::_('SNIPPETS') . ': ' . JText::_('NN_ITEM'));
     // Set ToolBar title
     JToolbarHelper::title(JText::_('SNIPPETS') . ': ' . JText::_('NN_ITEM'), 'snippets icon-nonumber');
     // If not checked out, can save the item.
     if ($canDo->get('core.edit')) {
         JToolbarHelper::apply('item.apply');
         JToolbarHelper::save('item.save');
     }
     if ($canDo->get('core.edit') && $canDo->get('core.create')) {
         JToolbarHelper::save2new('item.save2new');
     }
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('item.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('item.cancel');
     } else {
         JToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemple #5
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !true;
     // Since we don't track these assets at the item level, use the category id.
     JToolbarHelper::title(JText::_('COM_HTRAININGLOGS_MANAGER_H_TR_SESSION'), 'link h_tr_sessions');
     // If not checked out, can save the item.
     if (!$checkedOut || count($user->getAuthorisedCategories('com_htraininglogs', 'core.create'))) {
         JToolbarHelper::apply('h_tr_session.apply');
         JToolbarHelper::save('h_tr_session.save');
     }
     if (!$checkedOut && count($user->getAuthorisedCategories('com_htraininglogs', 'core.create'))) {
         JToolbarHelper::save2new('h_tr_session.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count($user->getAuthorisedCategories('com_htraininglogs', 'core.create')) > 0) {
         JToolbarHelper::save2copy('h_tr_session.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('h_tr_session.cancel');
     } else {
         if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
             JToolbarHelper::versions('com_htraininglogs.h_tr_session', $this->item->id);
         }
         JToolbarHelper::cancel('h_tr_session.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_H_tr_sessionS_LINKS_EDIT');
 }
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jcomments.php';
     $userId = JFactory::getUser()->get('id');
     $canDo = JCommentsHelper::getActions();
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $isNew = $this->item->id == 0;
     JFactory::getApplication()->input->set('hidemainmenu', 1);
     if (version_compare(JVERSION, '3.0', 'ge')) {
         JToolBarHelper::title(JText::_('A_CUSTOM_BBCODE'));
     } else {
         JToolBarHelper::title(JText::_('A_CUSTOM_BBCODE_EDIT'), 'jcomments-custombbcodes');
     }
     if (!$checkedOut && $canDo->get('core.edit')) {
         JToolBarHelper::apply('custombbcode.apply');
         JToolBarHelper::save('custombbcode.save');
     }
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('custombbcode.save2copy');
     }
     if ($isNew) {
         JToolBarHelper::cancel('custombbcode.cancel');
     } else {
         JToolBarHelper::cancel('custombbcode.cancel', 'JTOOLBAR_CLOSE');
     }
 }
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     $canDo = $this->canDo;
     JToolbarHelper::title($isNew ? JText::_('COM_TEMPLATES_MANAGER_ADD_STYLE') : JText::_('COM_TEMPLATES_MANAGER_EDIT_STYLE'), 'eye thememanager');
     // If not checked out, can save the item.
     if ($canDo->get('core.edit')) {
         JToolbarHelper::apply('style.apply');
         JToolbarHelper::save('style.save');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('style.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('style.cancel');
     } else {
         JToolbarHelper::cancel('style.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     // Get the help information for the template item.
     $lang = JFactory::getLanguage();
     $help = $this->get('Help');
     if ($lang->hasKey($help->url)) {
         $debug = $lang->setDebug(false);
         $url = JText::_($help->url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     JToolbarHelper::help($help->key, false, $url);
 }
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Since we don't track these assets at the item level, use the category id.
     $canDo = BannersHelper::getActions($this->item->catid, 0);
     JToolbarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_BANNER_NEW') : JText::_('COM_BANNERS_MANAGER_BANNER_EDIT'), 'banners.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0)) {
         JToolbarHelper::apply('banner.apply');
         JToolbarHelper::save('banner.save');
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2new('banner.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('banner.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('banner.cancel');
     } else {
         JToolbarHelper::cancel('banner.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS_EDIT');
 }
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $canDo = ReservaHelper::getActions($this->item->catid, 0);
     JToolbarHelper::title(JText::_('COM_RESEVA_MANAGER_EVENTO'), '');
     if ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_reserva', 'core.create'))) {
         JToolbarHelper::apply('evento.apply');
         JToolbarHelper::save('evento.save');
     }
     if (count($user->getAuthorisedCategories('com_reserva', 'core.create'))) {
         JToolbarHelper::save2new('evento.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count($user->getAuthorisedCategories('com_reserva', 'core.create')) > 0) {
         JToolbarHelper::save2copy('evento.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('evento.cancel');
     } else {
         JToolbarHelper::cancel('evento.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemple #10
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     //$checkedOut	= !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     // Since we don't track these assets at the item level, use the category id.
     //$canDo		= WcatalogHelper::getActions($this->item->catid, 0);
     JToolbarHelper::title(JText::_('COM_WCATALOG_MANAGER_CATEGORY'), 'categories.png');
     // If not checked out, can save the item.
     //if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_wcatalog', 'core.create')) > 0))
     //{
     JToolbarHelper::apply('category.apply');
     JToolbarHelper::save('category.save');
     //}
     //if (!$checkedOut && count($user->getAuthorisedCategories('com_wcatalog', 'core.create')) > 0){
     JToolbarHelper::save2new('category.save2new');
     //}
     // If an existing item, can save to a copy.
     //if (!$isNew && $canDo->get('core.create'))
     //{
     JToolbarHelper::save2copy('category.save2copy');
     //}
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('category.cancel');
     } else {
         JToolbarHelper::cancel('category.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_WCATALOG_CATEGORIES_EDIT');
 }
Exemple #11
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Built the actions for new and existing records.
     $canDo = $this->canDo;
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_UNIT'), 'database units');
     if (in_array('units', $this->permissions)) {
         // If not checked out, can save the item.
         if (!$checkedOut && ($canDo->get('core.edit') || $isNew && $canDo->get('core.create'))) {
             JToolBarHelper::apply('unit.apply');
             JToolBarHelper::save('unit.save');
             if ($canDo->get('core.create')) {
                 JToolbarHelper::save2new('unit.save2new');
             }
         }
         // If an existing item, can save to a copy.
         if (!$isNew && $canDo->get('core.create')) {
             JToolbarHelper::save2copy('unit.save2copy');
         }
     }
     if ($isNew) {
         JToolBarHelper::cancel('unit.cancel');
     } else {
         JToolBarHelper::cancel('unit.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemple #12
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.0.0
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = CMDonationHelper::getActions();
     JToolbarHelper::title(JText::_('COM_CMDONATION_MANAGER_DONATIONS'), 'donation icon-heart-2');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolbarHelper::apply('donation.apply');
         JToolbarHelper::save('donation.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('donation.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('donation.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('donation.cancel');
     } else {
         JToolbarHelper::cancel('donation.cancel', 'JTOOLBAR_CLOSE');
     }
 }
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     // Since we don't track these assets at the item level, use the category id.
     $canDo = JHelperContent::getActions('com_newsfeeds', 'category', $this->item->catid);
     JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEED'), 'feed newsfeeds');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) {
         JToolbarHelper::apply('newsfeed.apply');
         JToolbarHelper::save('newsfeed.save');
     }
     if (!$checkedOut && count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
         JToolbarHelper::save2new('newsfeed.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('newsfeed.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('newsfeed.cancel');
     } else {
         if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
             JToolbarHelper::versions('com_newsfeeds.newsfeed', $this->item->id);
         }
         JToolbarHelper::cancel('newsfeed.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS_EDIT');
 }
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     $canDo = JHelperContent::getActions('com_users');
     JToolbarHelper::title(JText::_($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'users levels-add');
     if ($canDo->get('core.edit') || $canDo->get('core.create')) {
         JToolbarHelper::apply('level.apply');
         JToolbarHelper::save('level.save');
     }
     if ($canDo->get('core.create')) {
         JToolbarHelper::save2new('level.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('level.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('level.cancel');
     } else {
         JToolbarHelper::cancel('level.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_USERS_ACCESS_LEVELS_EDIT');
 }
 /**
  * Visform view display method
  *
  * @return void
  **/
 public function display($tpl = null)
 {
     VisformsHelper::addSubmenu('visforms');
     $this->sidebar = JHtmlSidebar::render();
     $doc = JFactory::getDocument();
     $css = '.icon-visform {background:url(../administrator/components/com_visforms/images/visforms_logo_32.png) no-repeat;}' . ' [class^="icon-visform"] {display: block; float: left; height: 32px; line-height: 32px; width: 32px;}' . '  .visformbottom {	text-align: center;	padding-top: 15px;	color: #999;}';
     $doc->addStyleDeclaration($css);
     $doc->addStyleSheet(JURI::root(true) . '/administrator/components/com_visforms/css/visforms_min.css');
     // What Access Permissions does this user have? What can (s)he do?
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->canDo = VisformsHelper::getActions($this->item->id);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $isNew = $this->item->id == 0;
     $text = $isNew ? JText::_('COM_VISFORMS_NEW') : JText::_('COM_VISFORMS_EDIT');
     JToolbarHelper::title(JText::_('COM_VISFORMS') . ': <small><small>[ ' . $text . ' ]</small></small>', 'visform');
     if ($isNew) {
         if ($this->canDo->get('core.create')) {
             JToolbarHelper::apply('visform.apply');
             JToolbarHelper::save('visform.save');
             JToolbarHelper::save2new('visform.save2new');
             JToolbarHelper::divider();
             JToolbarHelper::custom('visform.fields', 'forms', 'forms', 'COM_VISFORMS_FIELDS', false);
             JToolbarHelper::divider();
         }
         JToolbarHelper::cancel('visform.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checkedOut) {
             if ($this->canDo->get('core.edit') || $this->canDo->get('core.edit.own') && $this->item->created_by == $userId) {
                 JToolbarHelper::apply('visform.apply');
                 JToolbarHelper::save('visform.save');
                 if ($this->canDo->get('core.create')) {
                     JToolbarHelper::save2new('visform.save2new');
                 }
             }
         }
         if ($this->canDo->get('core.create')) {
             JToolbarHelper::save2copy('visform.save2copy');
         }
         if (!$checkedOut) {
             if ($this->canDo->get('core.edit')) {
                 JToolbarHelper::divider();
                 JToolbarHelper::custom('visform.fields', 'forms', 'forms', 'COM_VISFORMS_FIELDS', false);
                 JToolbarHelper::divider();
             }
         }
         // for existing items the button is renamed `close`
         JToolbarHelper::cancel('visform.cancel', 'COM_VISFORMS_CLOSE');
     }
     JFactory::getApplication()->input->set('hidemainmenu', 1);
     $doc->addStyleSheet(JURI::root(true) . '/administrator/components/com_visforms/css/visforms.css');
     parent::display($tpl);
 }
 protected function addToolBar()
 {
     $input = JFactory::getApplication()->input;
     $input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     JToolBarHelper::title($isNew ? JText::_('New') : JText::_('Edit'));
     JToolBarHelper::apply('page.apply');
     JToolBarHelper::save('page.save');
     if (!$isNew) {
         JToolbarHelper::save2copy('page.save2copy');
     }
     JToolBarHelper::cancel('page.cancel', $isNew ? 'Cancel' : 'Close');
 }
Exemple #17
0
 private function addToolbar()
 {
     $isNew = $this->item->id < 1;
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     JToolbarHelper::title(JText::_('COM_EVENTGALLERY_IMAGETYPESETS') . ': <small>[ ' . $text . ' ]</small>');
     JToolbarHelper::apply('imagetypeset.apply');
     JToolbarHelper::save('imagetypeset.save');
     if ($isNew) {
         JToolbarHelper::cancel('imagetypeset.cancel');
     } else {
         JToolbarHelper::save2copy('imagetypeset.save2copy');
         JToolbarHelper::cancel('imagetypeset.cancel', JText::_('JTOOLBAR_CLOSE'));
     }
 }
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $input = JFactory::getApplication()->input;
     $input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
     JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_ITEM_TITLE' : 'COM_MENUS_VIEW_EDIT_ITEM_TITLE'), 'menu-add');
     // If a new item, can save the item.  Allow users with edit permissions to apply changes to prevent returning to grid.
     if ($isNew && $canDo->get('core.create')) {
         if ($canDo->get('core.edit')) {
             JToolbarHelper::apply('item.apply');
         }
         JToolbarHelper::save('item.save');
     }
     // If not checked out, can save the item.
     if (!$isNew && !$checkedOut && $canDo->get('core.edit')) {
         JToolbarHelper::apply('item.apply');
         JToolbarHelper::save('item.save');
     }
     // If the user can create new items, allow them to see Save & New
     if ($canDo->get('core.create')) {
         JToolbarHelper::save2new('item.save2new');
     }
     // If an existing item, can save to a copy only if we have create rights.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('item.save2copy');
     }
     if ($isNew) {
         JToolbarHelper::cancel('item.cancel');
     } else {
         JToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     // Get the help information for the menu item.
     $lang = JFactory::getLanguage();
     $help = $this->get('Help');
     if ($lang->hasKey($help->url)) {
         $debug = $lang->setDebug(false);
         $url = JText::_($help->url);
         $lang->setDebug($debug);
     } else {
         $url = $help->url;
     }
     JToolbarHelper::help($help->key, $help->local, $url);
 }
Exemple #19
0
 /**
  * Add the page title and toolbar.
  *
  * @since  3.1
  *
  * @return void
  */
 protected function addToolbar()
 {
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Need to load the menu language file as mod_menu hasn't been loaded yet.
     $lang = JFactory::getLanguage();
     $lang->load('com_tags', JPATH_BASE, null, false, true) || $lang->load('com_tags', JPATH_ADMINISTRATOR . '/components/com_tags', null, false, true);
     // Get the results for each action.
     $canDo = $this->canDo;
     $title = JText::_('COM_TAGS_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE');
     /**
      * Prepare the toolbar.
      * If it is new we get: `tag tag-add add`
      * else we get `tag tag-edit edit`
      */
     JToolbarHelper::title($title, 'tag tag-' . ($isNew ? 'add add' : 'edit edit'));
     // For new records, check the create permission.
     if ($isNew) {
         JToolbarHelper::apply('tag.apply');
         JToolbarHelper::save('tag.save');
         JToolbarHelper::save2new('tag.save2new');
     } elseif (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_user_id == $userId)) {
         JToolbarHelper::apply('tag.apply');
         JToolbarHelper::save('tag.save');
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2new('tag.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('tag.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('tag.cancel');
     } else {
         if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
             JToolbarHelper::versions('com_tags.tag', $this->item->id);
         }
         JToolbarHelper::cancel('tag.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_TAGS_MANAGER_EDIT');
     JToolbarHelper::divider();
 }
Exemple #20
0
 /**
  * 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;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = $this->canDo;
     JToolbarHelper::title(JText::sprintf('COM_MODULES_MANAGER_MODULE', JText::_($this->item->module)), 'cube module');
     // For new records, check the create permission.
     if ($isNew && $canDo->get('core.create')) {
         JToolbarHelper::apply('module.apply');
         JToolbarHelper::save('module.save');
         JToolbarHelper::save2new('module.save2new');
         JToolbarHelper::cancel('module.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checkedOut) {
             // Since it's an existing record, check the edit permission.
             if ($canDo->get('core.edit')) {
                 JToolbarHelper::apply('module.apply');
                 JToolbarHelper::save('module.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::save2new('module.save2new');
                 }
             }
         }
         // If checked out, we can still save
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2copy('module.save2copy');
         }
         JToolbarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE');
     }
     // Get the help information for the menu item.
     $lang = JFactory::getLanguage();
     $help = $this->get('Help');
     if ($lang->hasKey($help->url)) {
         $debug = $lang->setDebug(false);
         $url = JText::_($help->url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     JToolbarHelper::help($help->key, false, $url);
 }
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Since we don't track these assets at the item level, use the category id.
     $canDo = JHelperContent::getActions($this->item->catid, 0, 'com_contact');
     JToolbarHelper::title(JText::_('COM_CONTACT_MANAGER_CONTACT'), 'address contact');
     // Build the actions for new and existing records.
     if ($isNew) {
         // For new records, check the create permission.
         if ($isNew && count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) {
             JToolbarHelper::apply('contact.apply');
             JToolbarHelper::save('contact.save');
             JToolbarHelper::save2new('contact.save2new');
         }
         JToolbarHelper::cancel('contact.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checkedOut) {
             // Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
             if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) {
                 JToolbarHelper::apply('contact.apply');
                 JToolbarHelper::save('contact.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::save2new('contact.save2new');
                 }
             }
         }
         // If checked out, we can still save
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2copy('contact.save2copy');
         }
         if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
             JToolbarHelper::versions('com_contact.contact', $this->item->id);
         }
         JToolbarHelper::cancel('contact.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_CONTACTS_CONTACTS_EDIT');
 }
Exemple #22
0
 private function addToolbar()
 {
     $isNew = $this->item->id < 1;
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     $bar = JToolbar::getInstance('toolbar');
     JToolbarHelper::title(JText::_('COM_EVENTGALLERY_EVENTS') . ': <small><small>[ ' . $text . ' ]</small></small>');
     JToolbarHelper::apply('event.apply');
     JToolbarHelper::save('event.save');
     if ($isNew) {
         JToolbarHelper::cancel('event.cancel');
     } else {
         JToolbarHelper::save2copy('event.save2copy');
         JToolbarHelper::cancel('event.cancel', JText::_('JTOOLBAR_CLOSE'));
         if ($this->folder->getFolderType()->getName() == 'local') {
             JToolbarHelper::spacer(100);
             $bar->appendButton('Link', 'folder', 'COM_EVENTGALLERY_BUTTON_FILES_DESC', JRoute::_('index.php?option=com_eventgallery&view=files&folderid=' . $this->item->id), false);
             $bar->appendButton('Link', 'upload', 'COM_EVENTGALLERY_BUTTON_UPLOAD_DESC', JRoute::_('index.php?option=com_eventgallery&task=upload.upload&folderid=' . $this->item->id), false);
         }
     }
 }
Exemple #23
0
 /**
  * Add the page title and toolbar.
  *
  * @since  3.1
  */
 protected function addToolbar()
 {
     $input = JFactory::getApplication()->input;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Need to load the menu language file as mod_menu hasn't been loaded yet.
     $lang = JFactory::getLanguage();
     $lang->load('com_tags', JPATH_BASE, null, false, false) || $lang->load('com_tags', JPATH_ADMINISTRATOR . '/components/com_tags', null, false, false) || $lang->load('com_tags', JPATH_BASE, $lang->getDefault(), false, false) || $lang->load('com_tags', JPATH_ADMINISTRATOR . '/components/com_tags', $lang->getDefault(), false, false);
     // Load the tags helper.
     require_once JPATH_COMPONENT . '/helpers/tags.php';
     // Get the results for each action.
     $canDo = TagsHelper::getActions('com_tags', $this->item->id);
     $title = JText::_('COM_TAGS_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE');
     // Prepare the toolbar.
     JToolbarHelper::title($title, 'tag-' . ($isNew ? 'add' : 'edit') . ($isNew ? 'add' : 'edit'));
     // For new records, check the create permission.
     if ($isNew) {
         JToolbarHelper::apply('tag.apply');
         JToolbarHelper::save('tag.save');
         JToolbarHelper::save2new('tag.save2new');
     } elseif (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_user_id == $userId)) {
         JToolbarHelper::apply('tag.apply');
         JToolbarHelper::save('tag.save');
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2new('tag.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('tag.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('tag.cancel');
     } else {
         JToolbarHelper::cancel('tag.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::help('JHELP_COMPONENTS_TAGS_MANAGER_EDIT');
     JToolbarHelper::divider();
 }
Exemple #24
0
 /**
  * Method to configure the toolbar for this view.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->filter_id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $canDo = JHelperContent::getActions('com_finder');
     // Configure the toolbar.
     JToolbarHelper::title(JText::_('COM_FINDER_FILTER_EDIT_TOOLBAR_TITLE'), 'zoom-in finder');
     // Set the actions for new and existing records.
     if ($isNew) {
         // For new records, check the create permission.
         if ($canDo->get('core.create')) {
             JToolbarHelper::apply('filter.apply');
             JToolbarHelper::save('filter.save');
             JToolbarHelper::save2new('filter.save2new');
         }
         JToolbarHelper::cancel('filter.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checkedOut) {
             // Since it's an existing record, check the edit permission.
             if ($canDo->get('core.edit')) {
                 JToolbarHelper::apply('filter.apply');
                 JToolbarHelper::save('filter.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::save2new('filter.save2new');
                 }
             }
         }
         // If an existing item, can save as a copy
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2copy('filter.save2copy');
         }
         JToolbarHelper::cancel('filter.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_FINDER_MANAGE_SEARCH_FILTERS_EDIT');
 }
Exemple #25
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     // Since we don't track these assets at the item level, use the manufacturer id.
     JToolbarHelper::title($isNew ? JText::_('COM_CATALOGUE_MANAGER_ATTRDIR_NEW') : JText::_('COM_CATALOGUE_MANAGER_ATTRDIR_EDIT'));
     // If not checked out, can save the item.
     JToolbarHelper::apply('attrdir.apply');
     JToolbarHelper::save('attrdir.save');
     JToolbarHelper::save2new('attrdir.save2new');
     // If an existing item, can save to a copy.
     if (!$isNew) {
         JToolbarHelper::save2copy('attrdir.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('attrdir.cancel');
     } else {
         JToolbarHelper::cancel('attrdir.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
 }
Exemple #26
0
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->id;
     $isNew = $this->item->id == 0;
     JToolbarHelper::title($isNew ? JText::_('New ' . ucfirst($this->view)) : JText::_('Edit ' . ucfirst($this->view)), 'address contact');
     if ($isNew) {
         if ($isNew && count($user->getAuthorisedCategories($this->option, 'core.create')) > 0) {
             JToolbarHelper::apply($this->view . '.apply');
             JToolbarHelper::save($this->view . '.save');
         }
         JToolbarHelper::apply($this->view . '.apply');
         JToolbarHelper::save($this->view . '.save');
         JToolbarHelper::cancel($this->view . '.cancel');
     } else {
         JToolbarHelper::apply($this->view . '.apply');
         JToolbarHelper::save($this->view . '.save');
         JToolbarHelper::cancel($this->view . '.cancel', 'JTOOLBAR_CLOSE');
         JToolbarHelper::save2copy($this->view . '.save2copy');
     }
 }
Exemple #27
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $canDo = ContentHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     JToolbarHelper::title(JText::_('COM_CONTENT_PAGE_' . ($checkedOut ? 'VIEW_ARTICLE' : ($isNew ? 'ADD_ARTICLE' : 'EDIT_ARTICLE'))), 'article-add.png');
     // Built the actions for new and existing records.
     // For new records, check the create permission.
     if ($isNew && count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) {
         JToolbarHelper::apply('article.apply');
         JToolbarHelper::save('article.save');
         JToolbarHelper::save2new('article.save2new');
         JToolbarHelper::cancel('article.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checkedOut) {
             // Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
             if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) {
                 JToolbarHelper::apply('article.apply');
                 JToolbarHelper::save('article.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::save2new('article.save2new');
                 }
             }
         }
         // If checked out, we can still save
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2copy('article.save2copy');
         }
         JToolbarHelper::cancel('article.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_CONTENT_ARTICLE_MANAGER_EDIT');
 }
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = ModulesHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     $item = $this->get('Item');
     JToolbarHelper::title(JText::sprintf('COM_MODULES_MANAGER_MODULE', JText::_($this->item->module)), 'module.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolbarHelper::apply('module.apply');
         JToolbarHelper::save('module.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('module.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('module.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('module.cancel');
     } else {
         JToolbarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE');
     }
     // Get the help information for the menu item.
     $lang = JFactory::getLanguage();
     $help = $this->get('Help');
     if ($lang->hasKey($help->url)) {
         $debug = $lang->setDebug(false);
         $url = JText::_($help->url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     JToolbarHelper::help($help->key, false, $url);
 }
 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');
 }
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Since we don't track these assets at the item level, use the category id.
     /** @noinspection PhpUndefinedClassInspection */
     $canDo = CatalogueHelper::getActions($this->item->id, 0);
     JToolbarHelper::title($isNew ? JText::_('COM_CATALOGUE_MANAGER_ITEM_NEW') : JText::_('COM_CATALOGUE_MANAGER_ITEM_EDIT'), 'banners.png');
     // If not checked out, can save the item.
     if (!$checkedOut && $canDo->get('core.edit')) {
         JToolbarHelper::apply('item.apply');
         JToolbarHelper::save('item.save');
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2new('item.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('item.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('item.cancel');
     } else {
         JToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
     }
 }