english/administrator/components/com_menus/views/item/view.html.php
/**
	 * Add the page title and toolbar.
	 *
	 * @since	1.6
	 */
Add the page title and toolbar.
Add the page title and toolbar .
protected function addToolbar()
	{
		JRequest::setVar('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 ($isNew && $canDo->get('core.create')) {
			if ($canDo->get('core.edit')) {
				JToolBarHelper::apply('item.apply');
			}
			JToolBarHelper::save('item.save');
		}
		if (!$isNew && !$checkedOut && $canDo->get('core.edit')) {
			JToolBarHelper::apply('item.apply');
			JToolBarHelper::save('item.save');
		}
		if ($canDo->get('core.create')) {
			JToolBarHelper::save2new('item.save2new');
		}
		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();
		$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);
	}
protected function addToolbar ( ) { JRequest :: setVar ( '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 ( $ isNew && $ canDo -> get ( 'core.create' ) ) { if ( $ canDo -> get ( 'core.edit' ) ) { JToolBarHelper :: apply ( 'item.apply' ) ; } JToolBarHelper :: save ( 'item.save' ) ; } if ( ! $ isNew && ! $ checkedOut && $ canDo -> get ( 'core.edit' ) ) { JToolBarHelper :: apply ( 'item.apply' ) ; JToolBarHelper :: save ( 'item.save' ) ; } if ( $ canDo -> get ( 'core.create' ) ) { JToolBarHelper :: save2new ( 'item.save2new' ) ; } 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 ( ) ; $ 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 ) ; }
Add the page title and toolbar.
Add the page title and toolbar .
// If a new item, can save the item.  Allow users with edit permissions to apply changes to prevent returning to grid. // If not checked out, can save the item. // If the user can create new items, allow them to see Save & New // If an existing item, can save to a copy only if we have create rights. // Get the help information for the menu item.