当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Utils_Token::formatTokensForDisplay方法代码示例

本文整理汇总了PHP中CRM_Utils_Token::formatTokensForDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Token::formatTokensForDisplay方法的具体用法?PHP CRM_Utils_Token::formatTokensForDisplay怎么用?PHP CRM_Utils_Token::formatTokensForDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Utils_Token的用法示例。


在下文中一共展示了CRM_Utils_Token::formatTokensForDisplay方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     $this->applyFilter('__ALL__', 'trim');
     $this->addFormRule(array('CRM_Admin_Form_Preferences_Address', 'formRule'));
     //get the tokens for Mailing Label field
     $tokens = CRM_Core_SelectValues::contactTokens();
     $this->assign('tokens', CRM_Utils_Token::formatTokensForDisplay($tokens));
     parent::buildQuickForm();
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:12,代码来源:Address.php

示例2: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     // For VIEW we only want Done button
     if ($this->_action & CRM_Core_Action::VIEW) {
         // 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)));
     } else {
         parent::buildQuickForm();
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $breadCrumb = array(array('title' => ts('Message Templates'), '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);
     $this->add('text', 'msg_subject', ts('Message Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_subject'));
     //get the tokens.
     $tokens = CRM_Core_SelectValues::contactTokens();
     $this->assign('tokens', CRM_Utils_Token::formatTokensForDisplay($tokens));
     // if not a system message use a wysiwyg editor, CRM-5971
     if ($this->_id && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_MessageTemplate', $this->_id, 'workflow_id')) {
         $this->add('textarea', 'msg_html', ts('HTML Message'), "cols=50 rows=6");
     } else {
         $this->addWysiwyg('msg_html', ts('HTML Message'), array('cols' => '80', 'rows' => '8', 'onkeyup' => "return verify(this)"));
     }
     $this->add('textarea', 'msg_text', ts('Text Message'), "cols=50 rows=6");
     $this->add('select', 'pdf_format_id', ts('PDF Page Format'), array('null' => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE);
     $this->add('checkbox', 'is_active', ts('Enabled?'));
     if ($this->_action & CRM_Core_Action::VIEW) {
         $this->freeze();
         CRM_Utils_System::setTitle(ts('View System Default Message Template'));
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:41,代码来源:MessageTemplates.php

示例3: commonCompose

 /**
  * Build the  compose mail form.
  *
  * @param CRM_Core_Form $form
  *
  * @return void
  */
 public static function commonCompose(&$form)
 {
     //get the tokens.
     $tokens = array();
     if (method_exists($form, 'listTokens')) {
         $tokens = array_merge($form->listTokens(), $tokens);
     }
     //sorted in ascending order tokens by ignoring word case
     $form->assign('tokens', CRM_Utils_Token::formatTokensForDisplay($tokens));
     $templates = array();
     $textFields = array('text_message' => ts('HTML Format'), 'sms_text_message' => ts('SMS Message'));
     $modePrefixes = array('Mail' => NULL, 'SMS' => 'SMS');
     $className = CRM_Utils_System::getClassName($form);
     if ($className != 'CRM_SMS_Form_Upload' && $className != 'CRM_Contact_Form_Task_SMS' && $className != 'CRM_Contact_Form_Task_SMS') {
         $form->add('wysiwyg', 'html_message', ts('HTML Format'), array('cols' => '80', 'rows' => '8', 'onkeyup' => "return verify(this)"));
         if ($className != 'CRM_Admin_Form_ScheduleReminders') {
             unset($modePrefixes['SMS']);
         }
     } else {
         unset($textFields['text_message']);
         unset($modePrefixes['Mail']);
     }
     //insert message Text by selecting "Select Template option"
     foreach ($textFields as $id => $label) {
         $prefix = NULL;
         if ($id == 'sms_text_message') {
             $prefix = "SMS";
             $form->assign('max_sms_length', CRM_SMS_Provider::MAX_SMS_CHAR);
         }
         $form->add('textarea', $id, $label, array('cols' => '80', 'rows' => '8', 'onkeyup' => "return verify(this, '{$prefix}')"));
     }
     foreach ($modePrefixes as $prefix) {
         if ($prefix == 'SMS') {
             $templates[$prefix] = CRM_Core_BAO_MessageTemplate::getMessageTemplates(FALSE, TRUE);
         } else {
             $templates[$prefix] = CRM_Core_BAO_MessageTemplate::getMessageTemplates(FALSE);
         }
         if (!empty($templates[$prefix])) {
             $form->assign('templates', TRUE);
             $form->add('select', "{$prefix}template", ts('Use Template'), array('' => ts('- select -')) + $templates[$prefix], FALSE, array('onChange' => "selectValue( this.value, '{$prefix}');"));
         }
         $form->add('checkbox', "{$prefix}updateTemplate", ts('Update Template'), NULL);
         $form->add('checkbox', "{$prefix}saveTemplate", ts('Save As New Template'), NULL, FALSE, array('onclick' => "showSaveDetails(this, '{$prefix}');"));
         $form->add('text', "{$prefix}saveTemplateName", ts('Template Title'));
     }
     // I'm not sure this is ever called.
     $action = CRM_Utils_Request::retrieve('action', 'String', $form, FALSE);
     if (CRM_Utils_System::getClassName($form) == 'CRM_Contact_Form_Task_PDF' && $action == CRM_Core_Action::VIEW) {
         $form->freeze('html_message');
     }
 }
开发者ID:scardinius,项目名称:civicrm-core-api-mailing,代码行数:58,代码来源:Mailing.php

示例4: civicrm_api3_mailing_gettokens

/**
 * Get tokens for one or more entity type
 *
 * Output will be formatted either as a flat list,
 * or pass sequential=1 to retrieve as a hierarchy formatted for select2.
 *
 * @param array $params
 *   Should contain an array of entities to retrieve tokens for.
 *
 * @return array
 * @throws \API_Exception
 */
function civicrm_api3_mailing_gettokens($params)
{
    $tokens = array();
    foreach ((array) $params['entity'] as $ent) {
        $func = lcfirst($ent) . 'Tokens';
        if (!method_exists('CRM_Core_SelectValues', $func)) {
            throw new API_Exception('Unknown token entity: ' . $ent);
        }
        $tokens = array_merge(CRM_Core_SelectValues::$func(), $tokens);
    }
    if (!empty($params['sequential'])) {
        $tokens = CRM_Utils_Token::formatTokensForDisplay($tokens);
    }
    return civicrm_api3_create_success($tokens, $params, 'Mailing', 'gettokens');
}
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:27,代码来源:Mailing.php

示例5: commonLetterCompose

 /**
  * Function to build the  compose PDF letter form
  *
  * @param   $form
  *
  * @return void
  * @access public
  */
 public static function commonLetterCompose(&$form)
 {
     //get the tokens.
     $tokens = CRM_Core_SelectValues::contactTokens();
     if (CRM_Utils_System::getClassName($form) == 'CRM_Mailing_Form_Upload') {
         $tokens = array_merge(CRM_Core_SelectValues::mailingTokens(), $tokens);
     }
     //@todo move this fn onto the form
     if (CRM_Utils_System::getClassName($form) == 'CRM_Contribute_Form_Task_PDFLetter') {
         $tokens = array_merge(CRM_Core_SelectValues::contributionTokens(), $tokens);
     }
     if (method_exists($form, 'listTokens')) {
         $tokens = array_merge($form->listTokens(), $tokens);
     }
     $form->assign('tokens', CRM_Utils_Token::formatTokensForDisplay($tokens));
     $form->_templates = CRM_Core_BAO_MessageTemplate::getMessageTemplates(FALSE);
     if (!empty($form->_templates)) {
         $form->assign('templates', TRUE);
         $form->add('select', 'template', ts('Select Template'), array('' => ts('- select -')) + $form->_templates, FALSE, array('onChange' => "selectValue( this.value );"));
         $form->add('checkbox', 'updateTemplate', ts('Update Template'), NULL);
     }
     $form->add('checkbox', 'saveTemplate', ts('Save As New Template'), NULL, FALSE, array('onclick' => "showSaveDetails(this);"));
     $form->add('text', 'saveTemplateName', ts('Template Title'));
     $form->addWysiwyg('html_message', ts('Your Letter'), array('cols' => '80', 'rows' => '8', 'onkeyup' => "return verify(this)"));
     $action = CRM_Utils_Request::retrieve('action', 'String', $form, FALSE);
     if (CRM_Utils_System::getClassName($form) == 'CRM_Contact_Form_Task_PDF' && $action == CRM_Core_Action::VIEW) {
         $form->freeze('html_message');
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:37,代码来源:Mailing.php


注:本文中的CRM_Utils_Token::formatTokensForDisplay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。