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


PHP EmailTemplate::_parseUserValues方法代码示例

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


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

示例1: parse_template_bean

 function parse_template_bean($string, $bean_name, &$focus)
 {
     global $current_user;
     global $beanFiles, $beanList;
     $repl_arr = array();
     // cn: bug 9277 - create a replace array with empty strings to blank-out invalid vars
     $acct = new Account();
     $contact = new Contact();
     $lead = new Lead();
     $prospect = new Prospect();
     foreach ($lead->field_defs as $field_def) {
         if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
             continue;
         }
         $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('contact_' . $field_def['name'] => '', 'contact_account_' . $field_def['name'] => ''));
     }
     foreach ($prospect->field_defs as $field_def) {
         if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
             continue;
         }
         $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('contact_' . $field_def['name'] => '', 'contact_account_' . $field_def['name'] => ''));
     }
     foreach ($contact->field_defs as $field_def) {
         if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
             continue;
         }
         $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('contact_' . $field_def['name'] => '', 'contact_account_' . $field_def['name'] => ''));
     }
     foreach ($acct->field_defs as $field_def) {
         if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
             continue;
         }
         $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('account_' . $field_def['name'] => '', 'account_contact_' . $field_def['name'] => ''));
     }
     // cn: end bug 9277 fix
     // feel for Parent account, only for Contacts traditionally, but written for future expansion
     if (isset($focus->account_id) && !empty($focus->account_id)) {
         $acct->retrieve($focus->account_id);
     }
     if ($bean_name == 'Contacts') {
         // cn: bug 9277 - email templates not loading account/opp info for templates
         if (!empty($acct->id)) {
             foreach ($acct->field_defs as $field_def) {
                 if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
                     continue;
                 }
                 if ($field_def['type'] == 'enum') {
                     $translated = translate($field_def['options'], 'Accounts', $acct->{$field_def}['name']);
                     if (isset($translated) && !is_array($translated)) {
                         $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('account_' . $field_def['name'] => $translated, 'contact_account_' . $field_def['name'] => $translated));
                     } else {
                         // unset enum field, make sure we have a match string to replace with ""
                         $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('account_' . $field_def['name'] => '', 'contact_account_' . $field_def['name'] => ''));
                     }
                 } else {
                     // bug 47647 - allow for fields to translate before adding to template
                     $translated = self::_convertToType($field_def['type'], $acct->{$field_def}['name']);
                     $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('account_' . $field_def['name'] => $translated, 'contact_account_' . $field_def['name'] => $translated));
                 }
             }
         }
         if (!empty($focus->assigned_user_id)) {
             $user = new User();
             $user->retrieve($focus->assigned_user_id);
             $repl_arr = EmailTemplate::_parseUserValues($repl_arr, $user);
         }
     } elseif ($bean_name == 'Users') {
         /**
          * This section of code will on do work when a blank Contact, Lead,
          * etc. is passed in to parse the contact_* vars.  At this point,
          * $current_user will be used to fill in the blanks.
          */
         $repl_arr = EmailTemplate::_parseUserValues($repl_arr, $current_user);
     } else {
         // assumed we have an Account in focus
         foreach ($contact->field_defs as $field_def) {
             if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name' || $field_def['type'] == 'link') {
                 continue;
             }
             if ($field_def['type'] == 'enum') {
                 $translated = translate($field_def['options'], 'Accounts', $contact->{$field_def}['name']);
                 if (isset($translated) && !is_array($translated)) {
                     $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('contact_' . $field_def['name'] => $translated, 'contact_account_' . $field_def['name'] => $translated));
                 } else {
                     // unset enum field, make sure we have a match string to replace with ""
                     $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('contact_' . $field_def['name'] => '', 'contact_account_' . $field_def['name'] => ''));
                 }
             } else {
                 if (isset($contact->{$field_def}['name'])) {
                     // bug 47647 - allow for fields to translate before adding to template
                     $translated = self::_convertToType($field_def['type'], $contact->{$field_def}['name']);
                     $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array('contact_' . $field_def['name'] => $translated, 'contact_account_' . $field_def['name'] => $translated));
                 }
                 // if
             }
         }
     }
     ///////////////////////////////////////////////////////////////////////
     ////	LOAD FOCUS DATA INTO REPL_ARR
     foreach ($focus->field_defs as $field_def) {
//.........这里部分代码省略.........
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:101,代码来源:EmailTemplate.php

示例2: parse_template_bean

 function parse_template_bean($string, $bean_name, &$focus)
 {
     global $current_user;
     global $beanFiles, $beanList;
     $repl_arr = array();
     // cn: bug 9277 - create a replace array with empty strings to blank-out invalid vars
     if (!class_exists('Account')) {
         if (!class_exists('Contact')) {
             if (!class_exists('Leads')) {
                 if (!class_exists('Prospects')) {
                     require_once 'modules/Accounts/Account.php';
                 }
             }
         }
     }
     $acct = new Account();
     $contact = new Contact();
     $lead = new Lead();
     $prospect = new Prospect();
     foreach ($lead->field_defs as $field_def) {
         if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
             continue;
         }
         $repl_arr["contact_" . $field_def['name']] = '';
         $repl_arr["contact_account_" . $field_def['name']] = '';
     }
     foreach ($prospect->field_defs as $field_def) {
         if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
             continue;
         }
         $repl_arr["contact_" . $field_def['name']] = '';
         $repl_arr["contact_account_" . $field_def['name']] = '';
     }
     foreach ($contact->field_defs as $field_def) {
         if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
             continue;
         }
         $repl_arr["contact_" . $field_def['name']] = '';
         $repl_arr["contact_account_" . $field_def['name']] = '';
     }
     foreach ($acct->field_defs as $field_def) {
         if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
             continue;
         }
         $repl_arr["account_" . $field_def['name']] = '';
         $repl_arr["account_contact_" . $field_def['name']] = '';
     }
     // cn: end bug 9277 fix
     // feel for Parent account, only for Contacts traditionally, but written for future expansion
     if (isset($focus->account_id) && !empty($focus->account_id)) {
         $acct->retrieve($focus->account_id);
     }
     if ($bean_name == 'Contacts') {
         // cn: bug 9277 - email templates not loading account/opp info for templates
         if (!empty($acct->id)) {
             foreach ($acct->field_defs as $field_def) {
                 if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name') {
                     continue;
                 }
                 if ($field_def['type'] == 'enum') {
                     $translated = translate($field_def['options'], 'Accounts', $acct->{$field_def}['name']);
                     if (isset($translated) && !is_array($translated)) {
                         $repl_arr["account_" . $field_def['name']] = $translated;
                         $repl_arr["contact_account_" . $field_def['name']] = $translated;
                     } else {
                         // unset enum field, make sure we have a match string to replace with ""
                         $repl_arr["account_" . $field_def['name']] = '';
                         $repl_arr["contact_account_" . $field_def['name']] = '';
                     }
                 } else {
                     $repl_arr["account_" . $field_def['name']] = $acct->{$field_def}['name'];
                     $repl_arr["contact_account_" . $field_def['name']] = $acct->{$field_def}['name'];
                 }
             }
         }
         if (!empty($focus->assigned_user_id)) {
             $user = new User();
             $user->retrieve($focus->assigned_user_id);
             $repl_arr = EmailTemplate::_parseUserValues($repl_arr, $user);
         }
     } elseif ($bean_name == 'Users') {
         /**
          * This section of code will on do work when a blank Contact, Lead,
          * etc. is passed in to parse the contact_* vars.  At this point,
          * $current_user will be used to fill in the blanks.
          */
         $repl_arr = EmailTemplate::_parseUserValues($repl_arr, $current_user);
     } else {
         // assumed we have an Account in focus
         foreach ($contact->field_defs as $field_def) {
             if ($field_def['type'] == 'relate' && empty($field_def['custom_type']) || $field_def['type'] == 'assigned_user_name' || $field_def['type'] == 'link') {
                 continue;
             }
             if ($field_def['type'] == 'enum') {
                 $translated = translate($field_def['options'], 'Accounts', $contact->{$field_def}['name']);
                 if (isset($translated) && !is_array($translated)) {
                     $repl_arr["contact_" . $field_def['name']] = $translated;
                     $repl_arr["contact_account_" . $field_def['name']] = $translated;
                 } else {
                     // unset enum field, make sure we have a match string to replace with ""
//.........这里部分代码省略.........
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:101,代码来源:EmailTemplate.php


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