<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
);
$this->assign('action', $this->_action);
- $this->_BAOName = 'CRM_Core_BAO_MessageTemplates';
+ $this->_BAOName = 'CRM_Core_BAO_MessageTemplate';
$this->set('BAOName', $this->_BAOName);
parent::preProcess();
}
*
* @access public
*
- * @return None
+ * @return void
*/
public function setDefaultValues() {
$defaults = $this->_values;
- if (!CRM_Utils_Array::value('pdf_format_id', $defaults)) {
+ if (empty($defaults['pdf_format_id'])) {
$defaults['pdf_format_id'] = 'null';
}
/**
* Function to build the form
*
- * @return None
+ * @return void
* @access public
*/
public function buildQuickForm() {
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$this->applyFilter('__ALL__', 'trim');
- $this->add('text', 'msg_title', ts('Message Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplates', 'msg_title'), TRUE);
+ $this->add('text', 'msg_title', ts('Message Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_title'), TRUE);
$this->add('text', 'msg_subject',
ts('Message Subject'),
- CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplates', 'msg_subject')
+ CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_subject')
);
//get the tokens.
$tokens = CRM_Core_SelectValues::contactTokens();
- //sorted in ascending order tokens by ignoring word case
- natcasesort($tokens);
- $this->assign('tokens', json_encode($tokens));
-
- $this->add('select', 'token1', ts('Insert Tokens'),
- $tokens, FALSE,
- array(
- 'size' => "5",
- 'multiple' => TRUE,
- 'onchange' => "return tokenReplText(this);",
- )
- );
-
- $this->add('select', 'token2', ts('Insert Tokens'),
- $tokens, FALSE,
- array(
- 'size' => "5",
- 'multiple' => TRUE,
- 'onchange' => "return tokenReplHtml(this);",
- )
- );
-
- $this->add('select', 'token3', ts('Insert Tokens'),
- $tokens, FALSE,
- array(
- 'size' => "5",
- 'multiple' => TRUE,
- 'onchange' => "return tokenReplText(this);",
- )
- );
+ $this->assign('tokens', CRM_Utils_Token::formatTokensForDisplay($tokens));
$this->add('textarea', 'msg_text', ts('Text Message'),
"cols=50 rows=6"
// if not a system message use a wysiwyg editor, CRM-5971
if ($this->_id &&
- CRM_Core_DAO::getFieldValue('CRM_Core_DAO_MessageTemplates',
+ CRM_Core_DAO::getFieldValue('CRM_Core_DAO_MessageTemplate',
$this->_id,
'workflow_id'
)
*
* @access public
*
- * @return None
+ * @return void
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
- CRM_Core_BAO_MessageTemplates::del($this->_id);
+ CRM_Core_BAO_MessageTemplate::del($this->_id);
}
elseif ($this->_action & CRM_Core_Action::VIEW) {
// currently, the above action is used solely for previewing default workflow templates
$params['is_active'] = TRUE;
}
- $messageTemplate = CRM_Core_BAO_MessageTemplates::add($params);
+ $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');
if ($this->_workflow_id) {