Esempio n. 1
0
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     $jinput = JFactory::getApplication()->input;
     $jinput->set('hidemainmenu', true);
     $recurrence = $this->item->recurrence_groupcheck;
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = JemHelperBackend::getActions();
     JToolBarHelper::title($isNew ? JText::_('COM_JEM_ADD_EVENT') : JText::_('COM_JEM_EDIT_EVENT'), 'eventedit');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('event.apply');
         JToolBarHelper::save('event.save');
     }
     if (!$recurrence) {
         if (!$checkedOut && $canDo->get('core.create')) {
             JToolBarHelper::save2new('event.save2new');
         }
         // If an existing item, can save to a copy.
         if (!$isNew && $canDo->get('core.create')) {
             JToolBarHelper::save2copy('event.save2copy');
         }
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('event.cancel');
     } else {
         JToolBarHelper::cancel('event.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('editevents', true);
 }
Esempio n. 2
0
	/**
	 * Add Toolbar
	 */
	protected function addToolbar()
	{
		JFactory::getApplication()->input->set('hidemainmenu', true);

		//get vars
		$cid        = JFactory::getApplication()->input->get('cid', array(), 'array');
		$user       = JemFactory::getUser();
		$checkedOut = false; // don't know, table hasn't such a field
		$canDo      = JemHelperBackend::getActions();

		if (empty($cid[0])) {
			JToolBarHelper::title(JText::_('COM_JEM_ADD_ATTENDEE'), 'users');
		} else {
			JToolBarHelper::title(JText::_('COM_JEM_EDIT_ATTENDEE'), 'users');
		}

		// If not checked out, can save the item.
		if (!$checkedOut && ($canDo->get('core.edit')||$canDo->get('core.create'))) {
			JToolBarHelper::apply('attendee.apply');
			JToolBarHelper::save('attendee.save');
		}

		if (!$checkedOut && $canDo->get('core.create')) {
			JToolBarHelper::save2new('attendee.save2new');
		}

		// If an existing item, can save to a copy.
		if (!empty($cid[0]) && $canDo->get('core.create')) {
			JToolBarHelper::save2copy('attendee.save2copy');
		}

		if (empty($cid[0])) {
			JToolBarHelper::cancel('attendee.cancel');
		} else {
			JToolBarHelper::cancel('attendee.cancel', 'JTOOLBAR_CLOSE');
		}

		JToolBarHelper::divider();
		JToolBarHelper::help('editattendee', true);
	}