- md5
- cc8d2bf2576ac3fcfb207d0b7edb47df
- sha1
- 61da6712ef8c9a84c7847275da9870118a5ea202
- sha256
- 9d8a729f93afa9c69b63ca8db0cb95699c8807e4c6b8af73bff476365234bacc
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
<?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;
use Joomla\Utilities\ArrayHelper;
/**
* 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 remove from the request.
$cid = $this->input->get('cid', array(), 'array');
if (!is_array($cid) || count($cid) < 1)
{
$this->app->enqueueMessage(Text::_('COM_CONTENTHISTORY_NO_ITEM_SELECTED'), 'warning');
}
else
{
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
$cid = ArrayHelper::toInteger($cid);
// Remove the 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 2 releases, Joomla 4.0.0-beta6 to 4.0.0-beta7. See them all, or every version of this file.