[ 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\Select; 12 13 use Joomla\CMS\Application\AdministratorApplication; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\MVC\View\GenericDataException; 17 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 18 use Joomla\CMS\Object\CMSObject; 19 use Joomla\CMS\Toolbar\Toolbar; 20 use Joomla\CMS\Toolbar\ToolbarHelper; 21 use Joomla\Component\Scheduler\Administrator\Task\TaskOption; 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 the routine selection page (SelectView). 29 * This view lets the user choose from a list of plugin defined task routines. 30 * 31 * @since 4.1.0 32 */ 33 class HtmlView extends BaseHtmlView 34 { 35 /** 36 * @var AdministratorApplication 37 * @since 4.1.0 38 */ 39 protected $app; 40 41 /** 42 * The model state 43 * 44 * @var CMSObject 45 * @since 4.1.0 46 */ 47 protected $state; 48 49 /** 50 * An array of items 51 * 52 * @var TaskOption[] 53 * @since 4.1.0 54 */ 55 protected $items; 56 57 /** 58 * A suffix for links for modal use [?] 59 * 60 * @var string 61 * @since 4.1.0 62 */ 63 protected $modalLink; 64 65 /** 66 * HtmlView constructor. 67 * 68 * @param array $config A named configuration array for object construction. 69 * name: the name (optional) of the view (defaults to the view class name suffix). 70 * charset: the character set to use for display 71 * escape: the name (optional) of the function to use for escaping strings 72 * base_path: the parent path (optional) of the `views` directory (defaults to the component 73 * folder) template_plath: the path (optional) of the layout directory (defaults to 74 * base_path + /views/ + view name helper_path: the path (optional) of the helper files 75 * (defaults to base_path + /helpers/) layout: the layout (optional) to use to display the 76 * view 77 * 78 * @since 4.1.0 79 * @throws \Exception 80 */ 81 public function __construct($config = []) 82 { 83 $this->app = Factory::getApplication(); 84 85 parent::__construct($config); 86 } 87 88 /** 89 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 90 * 91 * @return void 92 * 93 * @since 4.1.0 94 * @throws \Exception 95 */ 96 public function display($tpl = null): void 97 { 98 $this->state = $this->get('State'); 99 $this->items = $this->get('Items'); 100 $this->modalLink = ''; 101 102 // Check for errors. 103 if (\count($errors = $this->get('Errors'))) { 104 throw new GenericDataException(implode("\n", $errors), 500); 105 } 106 107 $this->addToolbar(); 108 109 parent::display($tpl); 110 } 111 112 /** 113 * Add the page title and toolbar. 114 * 115 * @return void 116 * 117 * @since 4.1.0 118 */ 119 protected function addToolbar(): void 120 { 121 /* 122 * Get the global Toolbar instance 123 * @todo : Replace usage with ToolbarFactoryInterface. but how? 124 * Probably some changes in the core, since mod_menu calls and renders the getInstance() toolbar 125 */ 126 $toolbar = Toolbar::getInstance(); 127 128 // Add page title 129 ToolbarHelper::title(Text::_('COM_SCHEDULER_MANAGER_TASKS'), 'clock'); 130 131 $toolbar->linkButton('cancel') 132 ->url('index.php?option=com_scheduler') 133 ->buttonClass('btn btn-danger') 134 ->icon('icon-times') 135 ->text(Text::_('JCANCEL')); 136 } 137 }
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 |