[ 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\Controller; 12 13 use Joomla\CMS\Application\CMSApplication; 14 use Joomla\CMS\Language\Text; 15 use Joomla\CMS\MVC\Controller\BaseController; 16 use Joomla\CMS\MVC\Factory\MVCFactoryInterface; 17 use Joomla\CMS\Router\Route; 18 use Joomla\Input\Input; 19 use Joomla\String\Inflector; 20 21 // phpcs:disable PSR1.Files.SideEffects 22 \defined('_JEXEC') or die; 23 // phpcs:enable PSR1.Files.SideEffects 24 25 /** 26 * Workflow base controller package. 27 * 28 * @since 4.0.0 29 */ 30 class DisplayController extends BaseController 31 { 32 /** 33 * The default view. 34 * 35 * @var string 36 * @since 4.0.0 37 */ 38 protected $default_view = 'workflows'; 39 40 /** 41 * The extension for which the workflow apply. 42 * 43 * @var string 44 * @since 4.0.0 45 */ 46 protected $extension; 47 48 /** 49 * The section of the current extension 50 * 51 * @var string 52 * @since 4.0.0 53 */ 54 protected $section; 55 56 /** 57 * Constructor. 58 * 59 * @param array $config An optional associative array of configuration settings. 60 * @param MVCFactoryInterface $factory The factory. 61 * @param CMSApplication $app The Application for the dispatcher 62 * @param Input $input Input 63 * 64 * @since 4.0.0 65 * @throws \InvalidArgumentException when no extension is set 66 */ 67 public function __construct($config = array(), MVCFactoryInterface $factory = null, $app = null, $input = null) 68 { 69 parent::__construct($config, $factory, $app, $input); 70 71 // If extension is not set try to get it from input or throw an exception 72 if (empty($this->extension)) { 73 $extension = $this->input->getCmd('extension'); 74 75 $parts = explode('.', $extension); 76 77 $this->extension = array_shift($parts); 78 79 if (!empty($parts)) { 80 $this->section = array_shift($parts); 81 } 82 83 if (empty($this->extension)) { 84 throw new \InvalidArgumentException(Text::_('COM_WORKFLOW_ERROR_EXTENSION_NOT_SET')); 85 } 86 } 87 } 88 89 /** 90 * Method to display a view. 91 * 92 * @param boolean $cachable If true, the view output will be cached 93 * @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. 94 * 95 * @return BaseController|boolean This object to support chaining. 96 * 97 * @since 1.5 98 */ 99 public function display($cachable = false, $urlparams = array()) 100 { 101 $view = $this->input->get('view'); 102 $layout = $this->input->get('layout'); 103 $id = $this->input->getInt('id'); 104 105 // Check for edit form. 106 if (in_array($view, ['workflow', 'stage', 'transition']) && $layout == 'edit' && !$this->checkEditId('com_workflow.edit.' . $view, $id)) { 107 // Somehow the person just went to the form - we don't allow that. 108 if (!\count($this->app->getMessageQueue())) { 109 $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error'); 110 } 111 112 $url = 'index.php?option=com_workflow&view=' . Inflector::pluralize($view) . '&extension=' . $this->input->getCmd('extension'); 113 114 $this->setRedirect(Route::_($url, false)); 115 116 return false; 117 } 118 119 return parent::display(); 120 } 121 }
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 |