<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Fetch object based on array of properties
*
- * @param array $params (reference ) an assoc array of name/value pairs
- * @param array $defaults (reference ) an assoc array to hold the flattened values
+ * @param array $params
+ * (reference ) an assoc array of name/value pairs.
+ * @param array $defaults
+ * (reference ) an assoc array to hold the flattened values.
*
* @return CRM_Core_BAO_MessageTemplate object
- * @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$messageTemplates = new CRM_Core_DAO_MessageTemplate();
$messageTemplates->copyValues($params);
if ($messageTemplates->find(TRUE)) {
/**
* Update the is_active flag in the db
*
- * @param int $id id of the database record
- * @param boolean $is_active value we want to set the is_active field
+ * @param int $id
+ * Id of the database record.
+ * @param bool $is_active
+ * Value we want to set the is_active field.
*
- * @return Object DAO object on sucess, null otherwise
+ * @return Object
+ * DAO object on sucess, NULL otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_MessageTemplate', $id, 'is_active', $is_active);
}
/**
* Add the Message Templates
*
- * @param array $params reference array contains the values submitted by the form
+ * @param array $params
+ * Reference array contains the values submitted by the form.
*
- * @access public
* @static
*
* @return object
*/
- static function add(&$params) {
+ public static function add(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'MessageTemplate', CRM_Utils_Array::value('id', $params), $params);
/**
* Delete the Message Templates
*
- * @access public
* @static
*
* @param int $messageTemplatesID
*
* @return object
*/
- static function del($messageTemplatesID) {
+ public static function del($messageTemplatesID) {
// make sure messageTemplatesID is an integer
if (!CRM_Utils_Rule::positiveInteger($messageTemplatesID)) {
CRM_Core_Error::fatal(ts('Invalid Message template'));
/**
* Get the Message Templates
*
- * @access public
* @static
*
* @param bool $all
*
* @return object
*/
- static function getMessageTemplates($all = TRUE, $isSMS = FALSE) {
+ public static function getMessageTemplates($all = TRUE, $isSMS = FALSE) {
$msgTpls = array();
$messageTemplates = new CRM_Core_DAO_MessageTemplate();
* @param int $messageTemplateID
* @param $from
*
- * @return bool|null
+ * @return bool|NULL
*/
- static function sendReminder($contactId, $email, $messageTemplateID, $from) {
+ public static function sendReminder($contactId, $email, $messageTemplateID, $from) {
$messageTemplates = new CRM_Core_DAO_MessageTemplate();
$messageTemplates->id = $messageTemplateID;
}
list($details) = CRM_Utils_Token::getTokenDetails(array($contactId),
$returnProperties,
- null, null, false,
+ NULL, NULL, FALSE,
$tokens,
'CRM_Core_BAO_MessageTemplate');
- $contact = reset( $details );
+ $contact = reset($details);
// call token hook
$hookTokens = array();
$bodyType = "body_{$value}";
if ($$bodyType) {
CRM_Utils_Token::replaceGreetingTokens($$bodyType, NULL, $contact['contact_id']);
- $$bodyType = CRM_Utils_Token::replaceDomainTokens($$bodyType, $domain, true, $tokens, true);
- $$bodyType = CRM_Utils_Token::replaceContactTokens($$bodyType, $contact, false, $tokens, false, true);
- $$bodyType = CRM_Utils_Token::replaceComponentTokens($$bodyType, $contact, $tokens, true);
- $$bodyType = CRM_Utils_Token::replaceHookTokens($$bodyType, $contact , $categories, true);
+ $$bodyType = CRM_Utils_Token::replaceDomainTokens($$bodyType, $domain, TRUE, $tokens, TRUE);
+ $$bodyType = CRM_Utils_Token::replaceContactTokens($$bodyType, $contact, FALSE, $tokens, FALSE, TRUE);
+ $$bodyType = CRM_Utils_Token::replaceComponentTokens($$bodyType, $contact, $tokens, TRUE);
+ $$bodyType = CRM_Utils_Token::replaceHookTokens($$bodyType, $contact, $categories, TRUE);
}
}
$html = $body_html;
}
// do replacements in message subject
- $messageSubject = CRM_Utils_Token::replaceContactTokens($body_subject, $contact, false, $tokens);
- $messageSubject = CRM_Utils_Token::replaceDomainTokens($messageSubject, $domain, true, $tokens);
- $messageSubject = CRM_Utils_Token::replaceComponentTokens($messageSubject, $contact, $tokens, true);
- $messageSubject = CRM_Utils_Token::replaceHookTokens($messageSubject, $contact, $categories, true);
+ $messageSubject = CRM_Utils_Token::replaceContactTokens($body_subject, $contact, FALSE, $tokens);
+ $messageSubject = CRM_Utils_Token::replaceDomainTokens($messageSubject, $domain, TRUE, $tokens);
+ $messageSubject = CRM_Utils_Token::replaceComponentTokens($messageSubject, $contact, $tokens, TRUE);
+ $messageSubject = CRM_Utils_Token::replaceHookTokens($messageSubject, $contact, $categories, TRUE);
$messageSubject = $smarty->fetch("string:{$messageSubject}");
/**
* Revert a message template to its default subject+text+HTML state
*
- * @param integer id id of the template
+ * @param int id id of the template
*
* @return void
*/
- static function revert($id) {
+ public static function revert($id) {
$diverted = new self;
$diverted->id = (int) $id;
$diverted->find(1);
/**
* Send an email from the specified template based on an array of params
*
- * @param array $params a string-keyed array of function params, see function body for details
+ * @param array $params
+ * A string-keyed array of function params, see function body for details.
*
- * @return array of four parameters: a boolean whether the email was sent, and the subject, text and HTML templates
+ * @return array
+ * of four parameters: a boolean whether the email was sent, and the subject, text and HTML templates
*/
- static function sendTemplate($params) {
+ public static function sendTemplate($params) {
$defaults = array(
// option group name of the template
'groupName' => NULL,
if (empty($params['attachments'])) {
$params['attachments'] = array();
}
- $params['attachments'][] = CRM_Utils_Mail::appendPDF('Invoice.pdf', $pdfHtml, $format) ;
+ $params['attachments'][] = CRM_Utils_Mail::appendPDF('Invoice.pdf', $pdfHtml, $format);
}
$pdf_filename = '';
if ($config->doNotAttachPDFReceipt &&