- md5
- d62dc29ffe97ba46d3b58efe1ca5ab1c
- sha1
- f3901ccd635f7d59b9d1aa9ea20180404bc4ab6b
- sha256
- e77eeadddebe8eb4976d2e425e88f384d9ea6e84ba8205b6354cc297316352b4
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
<?php
/**
* @package Joomla.Administrator
* @subpackage com_workflow
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Workflow\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Router\Route;
/**
* Workflow Transitions controller
*
* @since 4.0.0
*/
class TransitionsController extends AdminController
{
/**
* The workflow where the transition takes place
*
* @var integer
* @since 4.0.0
*/
protected $workflowId;
/**
* The extension
*
* @var string
* @since 4.0.0
*/
protected $extension;
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The JApplication for the dispatcher
* @param \JInput $input Input
*
* @since 4.0.0
* @throws \InvalidArgumentException when no extension or workflow id is set
*/
public function __construct($config = array(), MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);
// If workflow id is not set try to get it from input or throw an exception
if (empty($this->workflowId))
{
$this->workflowId = $this->input->getInt('workflow_id');
if (empty($this->workflowId))
{
throw new \InvalidArgumentException(Text::_('COM_WORKFLOW_ERROR_WORKFLOW_ID_NOT_SET'));
}
}
// If extension is not set try to get it from input or throw an exception
if (empty($this->extension))
{
$this->extension = $this->input->getCmd('extension');
if (empty($this->extension))
{
throw new \InvalidArgumentException(Text::_('COM_WORKFLOW_ERROR_EXTENSION_NOT_SET'));
}
}
}
/**
* Proxy for getModel
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config The array of possible config values. Optional.
*
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model.
*
* @since 4.0.0
*/
public function getModel($name = 'Transition', $prefix = 'Administrator', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
/**
* Deletes and returns correctly.
*
* @return void
*
* @since 4.0.0
*/
public function delete()
{
parent::delete();
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. '&extension=' . $this->extension
. '&workflow_id=' . $this->workflowId, false
)
);
}
/**
* Method to publish a list of items
*
* @return void
*
* @since 4.0.0
*/
public function publish()
{
parent::publish();
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. '&extension=' . $this->extension
. '&workflow_id=' . $this->workflowId, false
)
);
}
}
The same content is in 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.