Source for file override.php
Documentation is available at override.php
* @package Joomla.Administrator
* @subpackage com_languages
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Languages Override Controller
* @package Joomla.Administrator
* @subpackage com_languages
* Method to edit an existing override
* @param string $key The name of the primary key of the URL variable (not used here).
* @param string $urlVar The name of the URL variable if different from the primary key (not used here).
public function edit($key =
null, $urlVar =
null)
$cid =
$this->input->post->get('cid', array(), 'array');
$recordId =
(count($cid) ?
$cid[0] :
$this->input->get('id'));
$this->setError(JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'));
$app->setUserState($context.
'.data', null);
* Method to save an override
* @param string $key The name of the primary key of the URL variable (not used here).
* @param string $urlVar The name of the URL variable if different from the primary key (not used here).
public function save($key =
null, $urlVar =
null)
// Check for request forgeries
$data =
$this->input->post->get('jform', array(), 'array');
$recordId =
$this->input->get('id');
$this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
// Validate the posted data
$form =
$model->getForm($data, false);
$app->enqueueMessage($model->getError(), 'error');
// Require helper for filter functions called by JForm
require_once JPATH_COMPONENT.
'/helpers/languages.php';
// Test whether the data is valid.
$validData =
$model->validate($form, $data);
// Check for validation errors.
if ($validData ===
false)
// Get the validation messages
$errors =
$model->getErrors();
// Push up to three validation messages out to the user.
for ($i =
0, $n =
count($errors); $i <
$n &&
$i <
3; $i++
)
if ($errors[$i] instanceof
Exception)
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
$app->enqueueMessage($errors[$i], 'warning');
// Save the data in the session
$app->setUserState($context.
'.data', $data);
// Redirect back to the edit screen
// Attempt to save the data
if (!$model->save($validData))
// Save the data in the session
$app->setUserState($context.
'.data', $validData);
// Redirect back to the edit screen
// Add message of success
// Redirect the user and adjust session state based on the chosen task
// Set the record data in the session
$app->setUserState($context.
'.data', null);
// Redirect back to the edit screen
// Clear the record id and data from the session
$app->setUserState($context.
'.data', null);
// Redirect back to the edit screen
// Clear the record id and data from the session
$app->setUserState($context.
'.data', null);
// Redirect to the list screen
* Method to cancel an edit
* @param string $key The name of the primary key of the URL variable (not used here).
public function cancel($key =
null, $test =
null)
$app->setUserState($context.
'.data', null);
Documentation generated on Tue, 19 Nov 2013 15:09:56 +0100 by phpDocumentor 1.4.3