- md5
- ad03b64186e9c249e7772d7a95f75722
- sha1
- a7879f31d37116110eca3adeb4a2a0ccc04a4370
- sha256
- 6abdb824156f8a9ac12e78c48aba3060ead57816ede333b82d9e8fe3a4ad5376
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
<?php
/**
* @package Joomla.Administrator
* @subpackage com_checkin
*
* @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Checkin\Administrator\Controller;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Response\JsonResponse;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Checkin Controller
*
* @since 1.6
*/
class DisplayController extends BaseController
{
/**
* The default view.
*
* @var string
* @since 1.6
*/
protected $default_view = 'checkin';
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types.
* @see \Joomla\CMS\Filter\InputFilter::clean() for valid values.
*
* @return static A \JControllerLegacy object to support chaining.
*/
public function display($cachable = false, $urlparams = [])
{
return parent::display();
}
/**
* Check in a list of items.
*
* @return void
*/
public function checkin()
{
// Check for request forgeries
$this->checkToken();
$ids = (array) $this->input->get('cid', [], 'string');
if (empty($ids)) {
$this->app->enqueueMessage(Text::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'), 'warning');
} else {
// Get the model.
/** @var \Joomla\Component\Checkin\Administrator\Model\CheckinModel $model */
$model = $this->getModel('Checkin');
// Checked in the items.
$this->setMessage(Text::plural('COM_CHECKIN_N_ITEMS_CHECKED_IN', $model->checkin($ids)));
}
$this->setRedirect('index.php?option=com_checkin');
}
/**
* Provide the data for a badge in a menu item via JSON
*
* @return void
*
* @since 4.0.0
* @throws \Exception
*/
public function getMenuBadgeData()
{
if (!$this->app->getIdentity()->authorise('core.manage', 'com_checkin')) {
throw new \Exception(Text::_('JGLOBAL_AUTH_ACCESS_DENIED'));
}
$model = $this->getModel('Checkin');
$amount = (int) \count($model->getItems());
echo new JsonResponse($amount);
}
/**
* Method to get the number of locked icons
*
* @return void
*
* @since 4.0.0
* @throws \Exception
*/
public function getQuickiconContent()
{
if (!$this->app->getIdentity()->authorise('core.manage', 'com_checkin')) {
throw new \Exception(Text::_('JGLOBAL_AUTH_ACCESS_DENIED'));
}
$model = $this->getModel('Checkin');
$amount = (int) \count($model->getItems());
$result = [];
$result['amount'] = $amount;
$result['sronly'] = Text::plural('COM_CHECKIN_N_QUICKICON_SRONLY', $amount);
echo new JsonResponse($result);
}
}
The same content is in 148 releases, Joomla 5.0.0-rc to 6.2.1-rc1. See them all, or every version of this file.