<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* used by membership, contributions, event registrations, etc.
*/
class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
- // which (and whether) mailing workflow this template belongs to
+ /**
+ * which (and whether) mailing workflow this template belongs to
+ * @var int
+ */
protected $_workflow_id = NULL;
- // Is document file is already loaded as default value?
+ /**
+ * Is document file is already loaded as default value?
+ * @var bool
+ */
protected $_is_document = FALSE;
public function preProcess() {
// currently, the above action is used solely for previewing default workflow templates
$cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1');
$cancelURL = str_replace('&', '&', $cancelURL);
- $this->addButtons(array(
- array(
- 'type' => 'cancel',
- 'name' => ts('Done'),
- 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
- 'isDefault' => TRUE,
- ),
- )
- );
+ $this->addButtons([
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Done'),
+ 'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"],
+ 'isDefault' => TRUE,
+ ],
+ ]);
}
else {
$this->_workflow_id = CRM_Utils_Array::value('workflow_id', $this->_values);
$cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', "selectedChild={$selectedChild}&reset=1");
$cancelURL = str_replace('&', '&', $cancelURL);
- $buttons[] = array(
+ $buttons[] = [
'type' => 'upload',
'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'),
'isDefault' => TRUE,
- );
+ ];
if (!($this->_action & CRM_Core_Action::DELETE)) {
- $buttons[] = array(
+ $buttons[] = [
'type' => 'submit',
'name' => ts('Save and Done'),
'subName' => 'done',
- );
+ ];
}
- $buttons[] = array(
+ $buttons[] = [
'type' => 'cancel',
'name' => ts('Cancel'),
- 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
- );
+ 'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"],
+ ];
$this->addButtons($buttons);
}
return;
}
- $breadCrumb = array(
- array(
+ $breadCrumb = [
+ [
'title' => ts('Message Templates'),
- 'url' => CRM_Utils_System::url('civicrm/admin/messageTemplates',
- 'action=browse&reset=1'
- ),
- ),
- );
+ 'url' => CRM_Utils_System::url('civicrm/admin/messageTemplates', 'action=browse&reset=1'),
+ ],
+ ];
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'msg_title', ts('Message Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_title'), TRUE);
- $options = array(ts('Compose On-screen'), ts('Upload Document'));
+ $options = [ts('Compose On-screen'), ts('Upload Document')];
$element = $this->addRadio('file_type', ts('Source'), $options);
if ($this->_id) {
$element->freeze();
}
else {
$this->add('wysiwyg', 'msg_html', ts('HTML Message'),
- array(
+ [
'cols' => '80',
'rows' => '8',
'onkeyup' => "return verify(this)",
'preset' => 'civimail',
- )
+ ]
);
}
);
$this->add('select', 'pdf_format_id', ts('PDF Page Format'),
- array(
+ [
'null' => ts('- default -'),
- ) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE
+ ] + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE
);
$this->add('checkbox', 'is_active', ts('Enabled?'));
- $this->addFormRule(array(__CLASS__, 'formRule'), $this);
+ $this->addFormRule([__CLASS__, 'formRule'], $this);
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
}
$messageTemplate = CRM_Core_BAO_MessageTemplate::add($params);
- CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', array(1 => $messageTemplate->msg_title)), ts('Saved'), 'success');
+ CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', [1 => $messageTemplate->msg_title]), ts('Saved'), 'success');
if (isset($this->_submitValues['_qf_MessageTemplates_upload'])) {
// Save button was pressed