[ 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_workflow 6 * 7 * @copyright (C) 2018 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\Workflow\Administrator\View\Transitions; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\Helper\ContentHelper; 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\Router\Route; 19 use Joomla\CMS\Toolbar\Toolbar; 20 use Joomla\CMS\Toolbar\ToolbarHelper; 21 22 // phpcs:disable PSR1.Files.SideEffects 23 \defined('_JEXEC') or die; 24 // phpcs:enable PSR1.Files.SideEffects 25 26 /** 27 * Transitions view class for the Workflow package. 28 * 29 * @since 4.0.0 30 */ 31 class HtmlView extends BaseHtmlView 32 { 33 /** 34 * An array of transitions 35 * 36 * @var array 37 * @since 4.0.0 38 */ 39 protected $transitions; 40 41 /** 42 * The model state 43 * 44 * @var object 45 * @since 4.0.0 46 */ 47 protected $state; 48 49 /** 50 * The HTML for displaying sidebar 51 * 52 * @var string 53 * @since 4.0.0 54 */ 55 protected $sidebar; 56 57 /** 58 * The pagination object 59 * 60 * @var \Joomla\CMS\Pagination\Pagination 61 * 62 * @since 4.0.0 63 */ 64 protected $pagination; 65 66 /** 67 * Form object for search filters 68 * 69 * @var \Joomla\CMS\Form\Form 70 * 71 * @since 4.0.0 72 */ 73 public $filterForm; 74 75 /** 76 * The active search filters 77 * 78 * @var array 79 * @since 4.0.0 80 */ 81 public $activeFilters; 82 83 /** 84 * The current workflow 85 * 86 * @var object 87 * @since 4.0.0 88 */ 89 protected $workflow; 90 91 /** 92 * The ID of current workflow 93 * 94 * @var integer 95 * @since 4.0.0 96 */ 97 protected $workflowID; 98 99 /** 100 * The name of current extension 101 * 102 * @var string 103 * @since 4.0.0 104 */ 105 protected $extension; 106 107 /** 108 * The section of the current extension 109 * 110 * @var string 111 * @since 4.0.0 112 */ 113 protected $section; 114 115 /** 116 * Display the view 117 * 118 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 119 * 120 * @return void 121 * 122 * @since 4.0.0 123 */ 124 public function display($tpl = null) 125 { 126 $this->state = $this->get('State'); 127 $this->transitions = $this->get('Items'); 128 $this->pagination = $this->get('Pagination'); 129 $this->filterForm = $this->get('FilterForm'); 130 $this->activeFilters = $this->get('ActiveFilters'); 131 $this->workflow = $this->get('Workflow'); 132 133 // Check for errors. 134 if (count($errors = $this->get('Errors'))) { 135 throw new GenericDataException(implode("\n", $errors), 500); 136 } 137 138 $this->workflowID = $this->workflow->id; 139 140 $parts = explode('.', $this->workflow->extension); 141 142 $this->extension = array_shift($parts); 143 144 if (!empty($parts)) { 145 $this->section = array_shift($parts); 146 } 147 148 $this->addToolbar(); 149 150 parent::display($tpl); 151 } 152 153 /** 154 * Add the page title and toolbar. 155 * 156 * @return void 157 * 158 * @since 4.0.0 159 */ 160 protected function addToolbar() 161 { 162 $canDo = ContentHelper::getActions($this->extension, 'workflow', $this->workflowID); 163 164 $user = $this->getCurrentUser(); 165 166 $toolbar = Toolbar::getInstance('toolbar'); 167 168 ToolbarHelper::title(Text::sprintf('COM_WORKFLOW_TRANSITIONS_LIST', Text::_($this->state->get('active_workflow'))), 'address contact'); 169 170 $arrow = Factory::getLanguage()->isRtl() ? 'arrow-right' : 'arrow-left'; 171 172 ToolbarHelper::link( 173 Route::_('index.php?option=com_workflow&view=workflows&extension=' . $this->escape($this->workflow->extension)), 174 'JTOOLBAR_BACK', 175 $arrow 176 ); 177 178 if ($canDo->get('core.create')) { 179 $toolbar->addNew('transition.add'); 180 } 181 182 if ($canDo->get('core.edit.state') || $user->authorise('core.admin')) { 183 $dropdown = $toolbar->dropdownButton('status-group') 184 ->text('JTOOLBAR_CHANGE_STATUS') 185 ->toggleSplit(false) 186 ->icon('icon-ellipsis-h') 187 ->buttonClass('btn btn-action') 188 ->listCheck(true); 189 190 $childBar = $dropdown->getChildToolbar(); 191 192 $childBar->publish('transitions.publish', 'JTOOLBAR_ENABLE'); 193 $childBar->unpublish('transitions.unpublish', 'JTOOLBAR_DISABLE'); 194 195 if ($canDo->get('core.admin')) { 196 $childBar->checkin('transitions.checkin')->listCheck(true); 197 } 198 199 if ($this->state->get('filter.published') !== '-2') { 200 $childBar->trash('transitions.trash'); 201 } 202 } 203 204 if ($this->state->get('filter.published') === '-2' && $canDo->get('core.delete')) { 205 $toolbar->delete('transitions.delete') 206 ->text('JTOOLBAR_EMPTY_TRASH') 207 ->message('JGLOBAL_CONFIRM_DELETE') 208 ->listCheck(true); 209 } 210 211 $toolbar->help('Transitions_List:_Basic_Workflow'); 212 } 213 }
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 |