- md5
- 89e545bde68d3222a999db8d5090432f
- sha1
- f81cc9bb733b6eb09253bab01e56b948dc98e9a6
- sha256
- d18852e2b06b64e7f978841827fea2ec922d7a65a71f7b3e7d8b1817e6b761d5
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
<?php
/**
* @package Joomla.Administrator
* @subpackage com_modules
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Modules\Administrator\Controller;
\defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\Utilities\ArrayHelper;
/**
* Modules list controller class.
*
* @since 1.6
*/
class ModulesController extends AdminController
{
/**
* Method to clone an existing module.
*
* @return void
*
* @since 1.6
*/
public function duplicate()
{
// Check for request forgeries
$this->checkToken();
$pks = $this->input->post->get('cid', array(), 'array');
$pks = ArrayHelper::toInteger($pks);
try
{
if (empty($pks))
{
throw new \Exception(Text::_('COM_MODULES_ERROR_NO_MODULES_SELECTED'));
}
$model = $this->getModel();
$model->duplicate($pks);
$this->setMessage(Text::plural('COM_MODULES_N_MODULES_DUPLICATED', count($pks)));
}
catch (\Exception $e)
{
$this->app->enqueueMessage($e->getMessage(), 'warning');
}
$this->setRedirect('index.php?option=com_modules&view=modules');
}
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 1.6
*/
public function getModel($name = 'Module', $prefix = 'Administrator', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
/**
* Method to get the number of frontend modules
*
* @return void
*
* @since 4.0
*/
public function getQuickiconContent()
{
$model = $this->getModel('Modules');
$model->setState('filter.state', 1);
$model->setState('filter.client_id', 0);
$amount = (int) $model->getTotal();
$result = [];
$result['amount'] = $amount;
$result['sronly'] = Text::plural('COM_MODULES_N_QUICKICON_SRONLY', $amount);
$result['name'] = Text::plural('COM_MODULES_N_QUICKICON', $amount);
echo new JsonResponse($result);
}
}
The same content is in 4 releases, Joomla 4.0.0-beta2 to 4.0.0-beta5. See them all, or every version of this file.