Current Directory: /home/astoriaah/www/old15/administrator/components/com_advancedmodules/controllers
Viewing File: /home/astoriaah/www/old15/administrator/components/com_advancedmodules/controllers/modules.php
<?php
/**
* @package Advanced Module Manager
* @version 4.22.6
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2015 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Modules list controller class.
*
* @since 1.6
*/
class AdvancedModulesControllerModules extends JControllerAdmin
{
/**
* @var string The prefix to use with controller messages.
*/
protected $text_prefix = 'COM_MODULES';
/**
* Method to clone an existing module.
*
* @return void
*
* @since 1.6
*/
public function duplicate()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', array(), 'array');
JArrayHelper::toInteger($pks);
try
{
if (empty($pks))
{
throw new Exception(JText::_('COM_MODULES_ERROR_NO_MODULES_SELECTED'));
}
$model = $this->getModel();
$model->duplicate($pks);
$this->setMessage(JText::plural('COM_MODULES_N_MODULES_DUPLICATED', count($pks)));
}
catch (Exception $e)
{
JError::raiseWarning(500, $e->getMessage());
}
$this->setRedirect('index.php?option=com_advancedmodules&view=modules');
}
/**
* Method to set the color of items
*
* @return void
*
* @since 11.1
*/
public function setcolor()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', array(), 'array');
JArrayHelper::toInteger($pks);
try
{
if (empty($pks))
{
throw new Exception(JText::_('COM_MODULES_ERROR_NO_MODULES_SELECTED'));
}
$color = $this->input->post->get('setcolor', '', 'string');
$model = $this->getModel();
$model->setcolor($pks, $color);
}
catch (Exception $e)
{
JError::raiseWarning(500, $e->getMessage());
}
$this->setRedirect('index.php?option=com_advancedmodules&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 = 'AdvancedModulesModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
}