<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
/**
- * Set variables up before form is built
+ * Set variables up before form is built.
*
* @return void
*/
public function preProcess() {
if (CRM_Mailing_Info::workflowEnabled() &&
- !CRM_Core_Permission::check('schedule mailings')
+ !CRM_Core_Permission::check('schedule mailings') &&
+ !CRM_Core_Permission::check('access CiviMail')
) {
$url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'reset=1&scheduled=false');
CRM_Utils_System::redirect($url);
$this->_scheduleFormOnly = TRUE;
}
}
+
/**
* Set default values for the form.
*
}
/**
- * Build the form object for the last step of the mailing wizard
+ * Build the form object for the last step of the mailing wizard.
*
* @param
*
if ($this->_scheduleFormOnly) {
$title = ts('Schedule Mailing') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing',
- $this->_mailingID,
- 'name'
- );
+ $this->_mailingID,
+ 'name'
+ );
CRM_Utils_System::setTitle($title);
$buttons = array(
array(
- 'type' => 'next',
+ 'type' => 'next',
'name' => ts('Submit Mailing'),
'spacing' => ' ',
'isDefault' => TRUE,
$this->_scheduleFormOnly
) {
// add the preview elements
- $preview = array();
- $preview['type'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'body_html') ? 'html' : 'text';
+ $preview = array();
+ $preview['type'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'body_html') ? 'html' : 'text';
$preview['subject'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing',
$this->_mailingID,
'subject'
* @param $files
* @param $self
*
- * @return boolean True if either we deliver immediately, or the
+ * @return bool
+ * True if either we deliver immediately, or the
* date is properly set.
- * @static
*/
public static function formRule($params, $files, $self) {
if (!empty($params['_qf_Schedule_submit'])) {
}
$urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
- $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
+ $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $self);
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey=$qfKey";
}
CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
CRM_Utils_System::redirect($url);
}
- if (isset($params['now']) || CRM_Utils_Array::value('_qf_Schedule_back', $params) == '<< Previous') {
+ if (isset($params['now']) || CRM_Utils_Array::value('_qf_Schedule_back', $params) == ts('Previous')) {
return TRUE;
}
if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($params['start_date'],
- $params['start_date_time']
- )) < CRM_Utils_Date::format(date('YmdHi00'))) {
+ $params['start_date_time']
+ )) < CRM_Utils_Date::format(date('YmdHi00'))
+ ) {
return array(
'start_date' => ts('Start date cannot be earlier than the current time.'),
);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/mailing/browse/scheduled',
- 'reset=1&scheduled=true'
- ));
+ 'reset=1&scheduled=true'
+ ));
}
/**
- * Display Name of the form
+ * Display Name of the form.
*
*
* @return string
public function getTitle() {
return ts('Schedule or Send');
}
+
}