Source for file module.php
Documentation is available at module.php
* @package Joomla.Administrator
* @subpackage com_modules
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Module controller class.
* @package Joomla.Administrator
* @subpackage com_modules
* Override parent add method.
* @return mixed True if the record can be added, a JError object if not.
// Get the result of the parent method. If an error, just return it.
if ($result instanceof
Exception)
// Look for the Extension ID.
$extensionId =
$app->input->get('eid', 0, 'int');
$app->setUserState('com_modules.add.module.extension_id', $extensionId);
$app->setUserState('com_modules.add.module.params', null);
// Parameters could be coming in for a new item, so let's set them.
$params =
$app->input->get('params', array(), 'array');
$app->setUserState('com_modules.add.module.params', $params);
* Override parent cancel method to reset the add module state.
* @param string $key The name of the primary key of the URL variable.
* @return boolean True if access level checks pass, false otherwise.
public function cancel($key =
null)
$app->setUserState('com_modules.add.module.extension_id', null);
$app->setUserState('com_modules.add.module.params', null);
* Override parent allowSave method.
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
protected function allowSave($data, $key =
'id')
// use custom position if selected
if (isset
($data['custom_position']))
if (empty($data['position']))
$data['position'] =
$data['custom_position'];
unset
($data['custom_position']);
* Method override to check if you can edit an existing record.
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
protected function allowEdit($data =
array(), $key =
'id')
$recordId = (int) isset
($data[$key]) ?
$data[$key] :
0;
$userId =
$user->get('id');
// Check general edit permission first.
if ($user->authorise('core.edit', 'com_modules.module.' .
$recordId))
// Since there is no asset tracking, revert to the component permissions.
* Method to run batch operations.
* @param string $model The model
* @return boolean True on success.
public function batch($model =
null)
$model =
$this->getModel('Module', '', array());
return parent::batch($model);
* Function that allows child controller access to model data after the data has been saved.
* @param JModelLegacy $model The data model object.
* @param array $validData The validated data.
protected function postSaveHook(JModelLegacy $model, $validData =
array())
$app->setUserState('com_modules.add.module.extension_id', $model->getState('module.extension_id'));
$app->setUserState('com_modules.add.module.extension_id', null);
$app->setUserState('com_modules.add.module.params', null);
Documentation generated on Tue, 19 Nov 2013 15:08:43 +0100 by phpDocumentor 1.4.3