state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } // Get the component HTML helpers JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); parent::display($tpl); $this->addToolbar(); } /** * Display the toolbar. * * @return void * * @since 2.5 */ protected function addToolbar() { $input = JFactory::getApplication()->input; $input->set('hidemainmenu', 1); $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_users', 'category', $this->item->catid); JToolbarHelper::title(JText::_('COM_USERS_NOTES'), 'users user'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) { JToolbarHelper::apply('note.apply'); JToolbarHelper::save('note.save'); } if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) { JToolbarHelper::save2new('note.save2new'); } // If an existing item, can save to a copy. if (!$isNew && (count($user->getAuthorisedCategories('com_users', 'core.create')) > 0)) { JToolbarHelper::save2copy('note.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('note.cancel'); } else { if (JComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) { JToolbarHelper::versions('com_users.note', $this->item->id); } JToolbarHelper::cancel('note.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_USERS_USER_NOTES_EDIT'); } }