[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_messages 6 * 7 * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Messages\Administrator\View\Message; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\Language\Text; 15 use Joomla\CMS\MVC\View\GenericDataException; 16 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 17 use Joomla\CMS\Toolbar\ToolbarHelper; 18 use Joomla\CMS\User\User; 19 20 // phpcs:disable PSR1.Files.SideEffects 21 \defined('_JEXEC') or die; 22 // phpcs:enable PSR1.Files.SideEffects 23 24 /** 25 * HTML View class for the Messages component 26 * 27 * @since 1.6 28 */ 29 class HtmlView extends BaseHtmlView 30 { 31 /** 32 * The Form object 33 * 34 * @var \Joomla\CMS\Form\Form 35 */ 36 protected $form; 37 38 /** 39 * The active item 40 * 41 * @var object 42 */ 43 protected $item; 44 45 /** 46 * The model state 47 * 48 * @var \Joomla\CMS\Object\CMSObject 49 */ 50 protected $state; 51 52 /** 53 * Execute and display a template script. 54 * 55 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 56 * 57 * @return void 58 * 59 * @since 1.6 60 */ 61 public function display($tpl = null) 62 { 63 $this->form = $this->get('Form'); 64 $this->item = $this->get('Item'); 65 $this->state = $this->get('State'); 66 67 // Check for errors. 68 if (count($errors = $this->get('Errors'))) { 69 throw new GenericDataException(implode("\n", $errors), 500); 70 } elseif ($this->getLayout() !== 'edit' && empty($this->item->message_id)) { 71 throw new GenericDataException(Text::_('JERROR_ALERTNOAUTHOR'), 403); 72 } 73 74 parent::display($tpl); 75 $this->addToolbar(); 76 } 77 78 /** 79 * Add the page title and toolbar. 80 * 81 * @return void 82 * 83 * @since 1.6 84 */ 85 protected function addToolbar() 86 { 87 $app = Factory::getApplication(); 88 89 if ($this->getLayout() == 'edit') { 90 $app->input->set('hidemainmenu', true); 91 ToolbarHelper::title(Text::_('COM_MESSAGES_WRITE_PRIVATE_MESSAGE'), 'envelope-open-text new-privatemessage'); 92 ToolbarHelper::custom('message.save', 'envelope', '', 'COM_MESSAGES_TOOLBAR_SEND', false); 93 ToolbarHelper::cancel('message.cancel'); 94 ToolbarHelper::help('Private_Messages:_Write'); 95 } else { 96 ToolbarHelper::title(Text::_('COM_MESSAGES_VIEW_PRIVATE_MESSAGE'), 'envelope inbox'); 97 $sender = User::getInstance($this->item->user_id_from); 98 99 if ( 100 $sender->id !== $app->getIdentity()->get('id') && ($sender->authorise('core.admin') 101 || $sender->authorise('core.manage', 'com_messages') && $sender->authorise('core.login.admin')) 102 && $app->getIdentity()->authorise('core.manage', 'com_users') 103 ) { 104 ToolbarHelper::custom('message.reply', 'redo', '', 'COM_MESSAGES_TOOLBAR_REPLY', false); 105 } 106 107 ToolbarHelper::cancel('message.cancel'); 108 ToolbarHelper::help('Private_Messages:_Read'); 109 } 110 } 111 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |