<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
+ * @copyright CiviCRM LLC (c) 2004-2015
*/
/**
- * Choose include / exclude groups and mass sms
- *
+ * Choose include / exclude groups and mass sms.
*/
class CRM_SMS_Form_Group extends CRM_Contact_Form_Task {
/**
- * Set variables up before form is built
- *
- * @return void
- * @access public
+ * Set variables up before form is built.
*/
public function preProcess() {
if (!CRM_SMS_BAO_Provider::activeProviderCount()) {
/**
* Set default values for the form.
- * the default values are retrieved from the database
- *
- * @access public
- *
- * @return void
+ * The default values are retrieved from the database.
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
}
/**
- * Build the form object
- *
- * @return void
- * @access public
+ * Build the form object.
*/
public function buildQuickForm() {
- //get the context
+ // Get the context.
$context = $this->get('context');
$this->assign('context', $context);
TRUE
);
- //get the mailing groups.
+ // Get the mailing groups.
$groups = CRM_Core_PseudoConstant::nestedGroup('Mailing');
- //get the sms mailing list
+ // Get the sms mailing list.
$mailings = CRM_Mailing_PseudoConstant::completed('sms');
if (!$mailings) {
$mailings = array();
$this->addFormRule(array('CRM_SMS_Form_Group', 'formRule'));
$buttons = array(
- array('type' => 'next',
- 'name' => ts('Next >>'),
+ array(
+ 'type' => 'next',
+ 'name' => ts('Next'),
'spacing' => ' ',
'isDefault' => TRUE,
),
$groups = array();
foreach (array(
- 'name', 'group_id', 'is_sms') as $n) {
+ 'name',
+ 'group_id',
+ 'is_sms',
+ ) as $n) {
if (!empty($values[$n])) {
$params[$n] = $values[$n];
}
$qf_Group_submit = $this->controller->exportValue($this->_name, '_qf_Group_submit');
$this->set('name', $params['name']);
- $inGroups = $values['includeGroups'];
- $outGroups = $values['excludeGroups'];
- $inMailings = $values['includeMailings'];
+ $inGroups = $values['includeGroups'];
+ $outGroups = $values['excludeGroups'];
+ $inMailings = $values['includeMailings'];
$outMailings = $values['excludeMailings'];
if (is_array($inGroups)) {
}
}
- $session = CRM_Core_Session::singleton();
- $params['groups'] = $groups;
+ $session = CRM_Core_Session::singleton();
+ $params['groups'] = $groups;
$params['mailings'] = $mailings;
- $ids = array();
+ $ids = array();
if ($this->get('mailing_id')) {
// don't create a new mass sms if already exists
// delete previous includes/excludes, if mailing already existed
foreach (array(
- 'groups', 'mailings') as $entity) {
- $mg = new CRM_Mailing_DAO_MailingGroup();
- $mg->mailing_id = $ids['mailing_id'];
+ 'groups',
+ 'mailings',
+ ) as $entity) {
+ $mg = new CRM_Mailing_DAO_MailingGroup();
+ $mg->mailing_id = $ids['mailing_id'];
$mg->entity_table = ($entity == 'groups') ? $groupTableName : $mailingTableName;
$mg->find();
while ($mg->fetch()) {
// also compute the recipients and store them in the mailing recipients table
CRM_Mailing_BAO_Mailing::getRecipients($mailing->id,
$mailing->id,
- NULL,
- NULL,
TRUE,
FALSE,
'sms'
}
/**
- * Display Name of the form
+ * Display Name of the form.
*
- * @access public
*
* @return string
*/
}
/**
- * Global validation rules for the form
+ * Global validation rules for the form.
*
- * @param array $fields posted values of the form
+ * @param array $fields
+ * Posted values of the form.
*
- * @return array list of errors to be posted back to the form
- * @static
- * @access public
+ * @return array
+ * list of errors to be posted back to the form
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (isset($fields['includeGroups']) &&
is_array($fields['includeGroups']) &&
return empty($errors) ? TRUE : $errors;
}
-}
+}