english/administrator/components/com_contact/views/contact/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();
		$userId		= $user->get('id');
		$isNew		= ($this->item->id == 0);
		$checkedOut	= !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
		$canDo		= ContactHelper::getActions($this->state->get('filter.category_id'));
		JToolBarHelper::title(JText::_('COM_CONTACT_MANAGER_CONTACT'), 'contact.png');
		if ($isNew)  {
			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 {
			if (!$checkedOut) {
				if ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId)) {
					JToolBarHelper::apply('contact.apply');
					JToolBarHelper::save('contact.save');
					if ($canDo->get('core.create')) {
						JToolBarHelper::save2new('contact.save2new');
					}
				}
			}
			if ($canDo->get('core.create')) {
				JToolBarHelper::save2copy('contact.save2copy');
			}
			JToolBarHelper::cancel('contact.cancel', 'JTOOLBAR_CLOSE');
		}
		JToolBarHelper::divider();
		JToolBarHelper::help('JHELP_COMPONENTS_CONTACTS_CONTACTS_EDIT');
	}
protected function addToolbar ( ) { JRequest :: setVar ( '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 = ContactHelper :: getActions ( $ this -> state -> get ( 'filter.category_id' ) ) ; JToolBarHelper :: title ( JText :: _ ( 'COM_CONTACT_MANAGER_CONTACT' ) , 'contact.png' ) ; if ( $ isNew ) { 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 { if ( ! $ checkedOut ) { if ( $ canDo -> get ( 'core.edit' ) || ( $ canDo -> get ( 'core.edit.own' ) && $ this -> item -> created_by == $ userId ) ) { JToolBarHelper :: apply ( 'contact.apply' ) ; JToolBarHelper :: save ( 'contact.save' ) ; if ( $ canDo -> get ( 'core.create' ) ) { JToolBarHelper :: save2new ( 'contact.save2new' ) ; } } } if ( $ canDo -> get ( 'core.create' ) ) { JToolBarHelper :: save2copy ( 'contact.save2copy' ) ; } JToolBarHelper :: cancel ( 'contact.cancel' , 'JTOOLBAR_CLOSE' ) ; } JToolBarHelper :: divider ( ) ; JToolBarHelper :: help ( 'JHELP_COMPONENTS_CONTACTS_CONTACTS_EDIT' ) ; }
Add the page title and toolbar.
Add the page title and toolbar .
// Build the actions for new and existing records. // For new records, check the create permission. // Can't save the record if it's checked out. // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. // We can save this record, but check the create permission to see if we can return to make a new one. // If checked out, we can still save