| Joomla! | PHP Cross Reference | Web Portals |
1 <?php 2 /** 3 * @package Joomla.Administrator 4 * @subpackage com_users 5 * 6 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 7 * @license GNU General Public License version 2 or later; see LICENSE 8 */ 9 10 defined('_JEXEC') or die; 11 12 /** 13 * User notes list view 14 * 15 * @package Joomla.Administrator 16 * @subpackage com_users 17 * @since 2.5 18 */ 19 class UsersViewNotes extends JViewLegacy 20 { 21 /** 22 * A list of user note objects. 23 * 24 * @var array 25 * @since 2.5 26 */ 27 protected $items; 28 29 /** 30 * The pagination object. 31 * 32 * @var JPagination 33 * @since 2.5 34 */ 35 protected $pagination; 36 37 /** 38 * The model state. 39 * 40 * @var JObject 41 * @since 2.5 42 */ 43 protected $state; 44 45 /** 46 * The model state. 47 * 48 * @var JUser 49 * @since 2.5 50 */ 51 protected $user; 52 53 /** 54 * Override the display method for the view. 55 * 56 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 57 * 58 * @return mixed A string if successful, otherwise a JError object. 59 * 60 * @since 2.5 61 */ 62 public function display($tpl = null) 63 { 64 // Initialise view variables. 65 $this->items = $this->get('Items'); 66 $this->pagination = $this->get('Pagination'); 67 $this->state = $this->get('State'); 68 $this->user = $this->get('User'); 69 70 UsersHelper::addSubmenu('notes'); 71 72 // Check for errors. 73 if (count($errors = $this->get('Errors'))) 74 { 75 throw new Exception(implode("\n", $errors), 500); 76 } 77 78 // Get the component HTML helpers 79 JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); 80 81 // turn parameters into registry objects 82 foreach ($this->items as $item) 83 { 84 $item->cparams = new JRegistry; 85 $item->cparams->loadString($item->category_params); 86 } 87 88 $this->addToolbar(); 89 $this->sidebar = JHtmlSidebar::render(); 90 parent::display($tpl); 91 } 92 93 /** 94 * Display the toolbar. 95 * 96 * @return void 97 * 98 * @since 2.5 99 */ 100 protected function addToolbar() 101 { 102 $canDo = UsersHelper::getActions(); 103 104 JToolbarHelper::title(JText::_('COM_USERS_VIEW_NOTES_TITLE'), 'user'); 105 106 if ($canDo->get('core.create')) 107 { 108 JToolbarHelper::addNew('note.add'); 109 } 110 111 if ($canDo->get('core.edit')) 112 { 113 JToolbarHelper::editList('note.edit'); 114 } 115 116 if ($canDo->get('core.edit.state')) 117 { 118 JToolbarHelper::divider(); 119 JToolbarHelper::publish('notes.publish', 'JTOOLBAR_PUBLISH', true); 120 JToolbarHelper::unpublish('notes.unpublish', 'JTOOLBAR_UNPUBLISH', true); 121 122 JToolbarHelper::divider(); 123 JToolbarHelper::archiveList('notes.archive'); 124 JToolbarHelper::checkin('notes.checkin'); 125 } 126 127 if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) 128 { 129 JToolbarHelper::deleteList('', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH'); 130 JToolbarHelper::divider(); 131 } 132 elseif ($canDo->get('core.edit.state')) 133 { 134 JToolbarHelper::trash('notes.trash'); 135 JToolbarHelper::divider(); 136 } 137 138 if ($canDo->get('core.admin')) 139 { 140 JToolbarHelper::preferences('com_users'); 141 JToolbarHelper::divider(); 142 } 143 JToolbarHelper::help('JHELP_USERS_USER_NOTES'); 144 145 JHtmlSidebar::setAction('index.php?option=com_users&view=notes'); 146 147 JHtmlSidebar::addFilter( 148 JText::_('JOPTION_SELECT_PUBLISHED'), 149 'filter_published', 150 JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true) 151 ); 152 153 JHtmlSidebar::addFilter( 154 JText::_('JOPTION_SELECT_CATEGORY'), 155 'filter_category_id', 156 JHtml::_('select.options', JHtml::_('category.options', 'com_users.notes'), 'value', 'text', $this->state->get('filter.category_id')) 157 ); 158 } 159 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title