- md5
- d9935cb58b19f9869b289a2e351e1d3d
- sha1
- 97a5a176f0daeda5b135eb38db0ee1e008bad394
- sha256
- 44c2bdec93a0eb547f88a68aa556948286e964b7dd9e996d787e46787bff8953
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
<?php
/**
* @package Joomla.Administrator
* @subpackage com_contenthistory
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Contenthistory\Administrator\Controller;
\defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
/**
* Contenthistory list controller class.
*
* @since 3.2
*/
class HistoryController extends AdminController
{
/**
* Proxy for getModel.
*
* @param string $name The name of the model
* @param string $prefix The prefix for the model
* @param array $config An additional array of parameters
*
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model
*
* @since 3.2
*/
public function getModel($name = 'History', $prefix = 'Administrator', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
/**
* Toggles the keep forever value for one or more history rows. If it was Yes, changes to No. If No, changes to Yes.
*
* @return void
*
* @since 3.2
*/
public function keep()
{
$this->checkToken();
// Get items to toggle keep forever from the request.
$cid = (array) $this->input->get('cid', array(), 'int');
// Remove zero values resulting from input filter
$cid = array_filter($cid);
if (empty($cid))
{
$this->app->enqueueMessage(Text::_('COM_CONTENTHISTORY_NO_ITEM_SELECTED'), 'warning');
}
else
{
// Get the model.
$model = $this->getModel();
// Toggle keep forever status of the selected items.
if ($model->keep($cid))
{
$this->setMessage(Text::plural('COM_CONTENTHISTORY_N_ITEMS_KEEP_TOGGLE', count($cid)));
}
else
{
$this->setMessage($model->getError(), 'error');
}
}
$this->setRedirect(
Route::_(
'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&item_id='
. $this->input->getCmd('item_id') . '&' . Session::getFormToken() . '=1', false
)
);
}
/**
* Gets the URL arguments to append to a list redirect.
*
* @return string The arguments to append to the redirect URL.
*
* @since 4.0.0
*/
protected function getRedirectToListAppend()
{
return '&layout=modal&tmpl=component&item_id=' . $this->input->get('item_id') . '&' . Session::getFormToken() . '=1';
}
}
The same content is in 14 releases, Joomla 4.1.1 to 4.2.0-beta2. See them all, or every version of this file.