Source for file config.php
Documentation is available at config.php
* @package Joomla.Administrator
* @subpackage com_messages
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Message configuration model.
* @package Joomla.Administrator
* @subpackage com_messages
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
$this->setState('user.id', $user->get('id'));
* Method to get a single record.
* @param integer The id of the primary key.
* @return mixed Object on success, false on failure.
$query =
$db->getQuery(true)
->select('cfg_name, cfg_value')
->from('#__messages_cfg')
->where('user_id = '.(int)
$this->getState('user.id'));
$rows =
$db->loadObjectList();
catch
(RuntimeException $e)
$item->set($row->cfg_name, $row->cfg_value);
* Method to get the record form.
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
public function getForm($data =
array(), $loadData =
true)
$form =
$this->loadForm('com_messages.config', 'config', array('control' =>
'jform', 'load_data' =>
$loadData));
* Method to save the form data.
* @param array The form data.
* @return boolean True on success.
public function save($data)
if ($userId = (int)
$this->getState('user.id'))
'DELETE FROM #__messages_cfg'.
' WHERE user_id = '.
$userId
catch
(RuntimeException $e)
foreach ($data as $k =>
$v)
$tuples[] =
'(' .
$userId.
', ' .
$db->quote($k) .
', ' .
$db->quote($v) .
')';
'INSERT INTO #__messages_cfg'.
' (user_id, cfg_name, cfg_value)'.
catch
(RuntimeException $e)
$this->setError('COM_MESSAGES_ERR_INVALID_USER');
Documentation generated on Tue, 19 Nov 2013 14:56:28 +0100 by phpDocumentor 1.4.3