[ 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_scheduler 6 * 7 * @copyright (C) 2021 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\Scheduler\Administrator\View\Task; 12 13 use Joomla\CMS\Application\AdministratorApplication; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Form\Form; 16 use Joomla\CMS\Helper\ContentHelper; 17 use Joomla\CMS\Language\Text; 18 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 19 use Joomla\CMS\Object\CMSObject; 20 use Joomla\CMS\Toolbar\Toolbar; 21 use Joomla\CMS\Toolbar\ToolbarHelper; 22 23 // phpcs:disable PSR1.Files.SideEffects 24 \defined('_JEXEC') or die; 25 // phpcs:enable PSR1.Files.SideEffects 26 27 /** 28 * The MVC View for Task configuration page (TaskView). 29 * 30 * @since 4.1.0 31 */ 32 class HtmlView extends BaseHtmlView 33 { 34 /** 35 * @var AdministratorApplication $app 36 * @since 4.1.0 37 */ 38 protected $app; 39 40 /** 41 * The Form object 42 * 43 * @var Form 44 * @since 4.1.0 45 */ 46 protected $form; 47 48 /** 49 * The active item 50 * 51 * @var object 52 * @since 4.1.0 53 */ 54 protected $item; 55 56 /** 57 * The model state 58 * 59 * @var CMSObject 60 * @since 4.1.0 61 */ 62 protected $state; 63 64 /** 65 * The actions the user is authorised to perform 66 * 67 * @var CMSObject 68 * @since 4.1.0 69 */ 70 protected $canDo; 71 72 /** 73 * Overloads the parent constructor. 74 * Just needed to fetch the Application object. 75 * 76 * @param array $config A named configuration array for object construction. 77 * name: the name (optional) of the view (defaults to the view class name suffix). 78 * charset: the character set to use for display 79 * escape: the name (optional) of the function to use for escaping strings 80 * base_path: the parent path (optional) of the `views` directory (defaults to the 81 * component folder) template_plath: the path (optional) of the layout directory (defaults 82 * to base_path + /views/ + view name helper_path: the path (optional) of the helper files 83 * (defaults to base_path + /helpers/) layout: the layout (optional) to use to display the 84 * view 85 * 86 * @since 4.1.0 87 * @throws \Exception 88 */ 89 public function __construct($config = array()) 90 { 91 $this->app = Factory::getApplication(); 92 parent::__construct($config); 93 } 94 95 /** 96 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 97 * 98 * @return void 99 * 100 * @since 4.1.0 101 * @throws \Exception 102 */ 103 public function display($tpl = null): void 104 { 105 /* 106 * Will call the getForm() method of TaskModel 107 */ 108 $this->form = $this->get('Form'); 109 $this->item = $this->get('Item'); 110 $this->state = $this->get('State'); 111 $this->canDo = ContentHelper::getActions('com_scheduler', 'task', $this->item->id); 112 113 $this->addToolbar(); 114 115 parent::display($tpl); 116 } 117 118 /** 119 * Adds the page title and toolbar 120 * 121 * @return void 122 * 123 * @since 4.1.0 124 */ 125 protected function addToolbar(): void 126 { 127 $app = $this->app; 128 129 $app->getInput()->set('hidemainmenu', true); 130 $isNew = ($this->item->id == 0); 131 $canDo = $this->canDo; 132 133 /* 134 * Get the toolbar object instance 135 * !! @todo : Replace usage with ToolbarFactoryInterface 136 */ 137 $toolbar = Toolbar::getInstance(); 138 139 ToolbarHelper::title($isNew ? Text::_('COM_SCHEDULER_MANAGER_TASK_NEW') : Text::_('COM_SCHEDULER_MANAGER_TASK_EDIT'), 'clock'); 140 141 if (($isNew && $canDo->get('core.create')) || (!$isNew && $canDo->get('core.edit'))) { 142 $toolbar->apply('task.apply'); 143 $toolbar->save('task.save'); 144 } 145 146 // @todo | ? : Do we need save2new, save2copy? 147 148 $toolbar->cancel('task.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'); 149 $toolbar->help('Scheduled_Tasks:_Edit'); 150 } 151 }
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 |