Source for file mail.php
Documentation is available at mail.php
* @package Joomla.Administrator
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @package Joomla.Administrator
* Method to get the row form.
* @param array $data An optional array of data for the form to interogate.
* @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_users.mail', 'mail', array('control' =>
'jform', 'load_data' =>
$loadData));
* Method to get the data that should be injected in the form.
* @return mixed The data for the form.
// Check the session for previously entered form data.
* Override preprocessForm to load the user plugin group instead of content.
* @param object A form object.
* @param mixed The data expected for the form.
* @throws Exception if there is an error in the form event.
protected function preprocessForm(JForm $form, $data, $group =
'user')
parent::preprocessForm($form, $data, $group);
$data =
$app->input->post->get('jform', array(), 'array');
// automatically removes html formatting
// Check for a message body and subject
if (!$message_body ||
!$subject)
$app->setUserState('com_users.display.mail.data', $data);
$this->setError(JText::_('COM_USERS_MAIL_PLEASE_FILL_IN_THE_FORM_CORRECTLY'));
// get users in the group out of the acl
$to =
$access->getUsersByGroup($grp, $recurse);
// Get all users email and group except for senders
$query =
$db->getQuery(true)
->where('id != '.(int)
$user->get('id'));
$query->where('id IN (' .
implode(',', $to) .
')');
$query->where("block = 0");
$rows =
$db->loadColumn();
// Check to see if there are any users in this group before we continue
$app->setUserState('com_users.display.mail.data', $data);
$this->setError(JText::_('COM_USERS_MAIL_ONLY_YOU_COULD_BE_FOUND_IN_THIS_GROUP'));
$this->setError(JText::_('COM_USERS_MAIL_NO_USERS_COULD_BE_FOUND_IN_THIS_GROUP'));
// Build email message format.
$mailer->setSender(array($app->getCfg('mailfrom'), $app->getCfg('fromname')));
$mailer->setSubject($params->get('mailSubjectPrefix') .
stripslashes($subject));
$mailer->setBody($message_body .
$params->get('mailBodySuffix'));
$mailer->addRecipient($app->getCfg('mailfrom'));
$mailer->addRecipient($rows);
if ($rs instanceof
Exception)
$app->setUserState('com_users.display.mail.data', $data);
$app->setUserState('com_users.display.mail.data', $data);
$this->setError(JText::_('COM_USERS_MAIL_THE_MAIL_COULD_NOT_BE_SENT'));
// Fill the data (specially for the 'mode', 'group' and 'bcc': they could not exist in the array
// when the box is not checked and in this case, the default value would be used instead of the '0'
$data['subject'] =
$subject;
$data['recurse'] =
$recurse;
$data['message'] =
$message_body;
$app->setUserState('com_users.display.mail.data', array());
$app->enqueueMessage(JText::plural('COM_USERS_MAIL_EMAIL_SENT_TO_N_USERS', count($rows)), 'message');
Documentation generated on Tue, 19 Nov 2013 15:07:29 +0100 by phpDocumentor 1.4.3