- md5
- 10365a955e6d6aa2eb9c3de142ad249c
- sha1
- 671ad444190a930cc23544b05b18496a0ae6f890
- sha256
- f239ceb520aa81ff54099755442a4f5ba14d6b3626859cdd80d6f1e12c62ecfc
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
<?php
/**
* @version $Id: module.php 21032 2011-03-29 16:38:31Z dextercowley $
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
jimport('joomla.application.component.controllerform');
/**
* Module controller class.
*
* @package Joomla.Administrator
* @subpackage com_modules
* @version 1.6
*/
class ModulesControllerModule extends JControllerForm
{
/**
* Override parent add method.
*/
public function add()
{
// Initialise variables.
$app = JFactory::getApplication();
// Get the result of the parent method. If an error, just return it.
$result = parent::add();
if (JError::isError($result)) {
return $result;
}
// Look for the Extension ID.
$extensionId = JRequest::getInt('eid');
if (empty($extensionId)) {
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.'&layout=edit', false));
return JError::raiseWarning(500, JText::_('COM_MODULES_ERROR_INVALID_EXTENSION'));
}
$app->setUserState('com_modules.add.module.extension_id', $extensionId);
}
/**
* Override parent cancel method to reset the add module state.
*/
public function cancel($key = null)
{
// Initialise variables.
$app = JFactory::getApplication();
parent::cancel();
$app->setUserState('com_modules.add.module.extension_id', null);
}
/**
* Override parent allowSave method.
*/
protected function allowSave($data, $key = 'id')
{
// use custom position if selected
if (empty($data['position'])) {
$data['position'] = $data['custom_position'];
}
unset($data['custom_position']);
return parent::allowSave($data, $key);
}
/**
* Function that allows child controller access to model data after the data has been saved.
*
* @param JModel $model The data model object.
*
* @return void
* @since 1.6
*/
protected function postSaveHook(JModel &$model, $validData = array())
{
// Initialise variables.
$app = JFactory::getApplication();
$task = $this->getTask();
switch ($task)
{
case 'save2new':
$app->setUserState('com_modules.add.module.extension_id', $model->getState('module.extension_id'));
break;
default:
$app->setUserState('com_modules.add.module.extension_id', null);
break;
}
}
}
The same content is in 11 releases, Joomla 1.6.2 to 1.7.5. See them all, or every version of this file.