- md5
- 8553326a50dcaddcbfa70e88c1b5e129
- sha1
- 8d612a76fa63ed147a3f78d90d27b0dbba91de19
- sha256
- 604d50a2efd217d2f98ecd6fd3a81cbd95b89b8c2ab1cc71c84f3bdbd9710f04
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
<?php
/**
* @package Joomla.Administrator
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
/**
* User note edit view
*
* @package Joomla.Administrator
* @subpackage com_users
* @since 2.5
*/
class UsersViewNote extends JViewLegacy
{
/**
* The edit form.
*
* @var JForm
* @since 2.5
*/
protected $form;
/**
* The item data.
*
* @var object
* @since 2.5
*/
protected $item;
/**
* The model state.
*
* @var JObject
* @since 2.5
*/
protected $state;
/**
* Override the display method for the view.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Initialise view variables.
$this->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'));
$canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
JToolBarHelper::title(JText::_('COM_USERS_NOTES'), '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
{
JToolBarHelper::cancel('note.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_USERS_USER_NOTES_EDIT');
}
}
The same content is in 11 releases, Joomla 2.5.18 to 2.5.28. See them all, or every version of this file.