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


PHP EmailTemplate::parse_template_bean方法代码示例

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


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

示例1: aop_parse_template

/**
 * Custom parse template method since sugars own doesn't deal with custom fields.
 */
function aop_parse_template($string, &$bean_arr)
{
    global $beanFiles, $beanList;
    $typeMap = array('dynamicenum' => 'enum');
    foreach ($bean_arr as $bean_name => $bean_id) {
        require_once $beanFiles[$beanList[$bean_name]];
        $focus = new $beanList[$bean_name]();
        $result = $focus->retrieve($bean_id);
        if ($bean_name == 'Leads' || $bean_name == 'Prospects') {
            $bean_name = 'Contacts';
        }
        foreach ($focus->field_defs as $key => $field_def) {
            if (array_key_exists($field_def['type'], $typeMap)) {
                $focus->field_defs[$key]['type'] = $typeMap[$field_def['type']];
            }
        }
        if (isset($this) && isset($this->module_dir) && $this->module_dir == 'EmailTemplates') {
            $string = $this->parse_template_bean($string, $bean_name, $focus);
        } else {
            $string = EmailTemplate::parse_template_bean($string, $bean_name, $focus);
        }
    }
    return $string;
}
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:27,代码来源:util.php

示例2: action_sendinvitemails

 public function action_sendinvitemails()
 {
     global $db;
     global $sugar_config;
     global $mod_strings;
     $id = $_GET['record'];
     //get event
     $event = new FP_events();
     $event->retrieve($id);
     $event->load_relationship('fp_events_contacts');
     // get related contacts
     $event->load_relationship('fp_events_prospects_1');
     //get related targets
     $event->load_relationship('fp_events_leads_1');
     //get related leads
     //Count the number of delegates linked to the event that have not yet been invited
     $query = "SELECT * FROM fp_events_contacts_c WHERE fp_events_contactsfp_events_ida='" . $event->id . "' AND (invite_status='Not Invited' OR invite_status='' OR invite_status IS NULL) AND deleted='0'";
     $result = $db->query($query);
     $contact_count = $db->getRowCount($result);
     //count contacts
     $query = "SELECT * FROM fp_events_prospects_1_c WHERE fp_events_prospects_1fp_events_ida='" . $event->id . "' AND (invite_status='Not Invited' OR invite_status='' OR invite_status IS NULL) AND deleted='0'";
     $result = $db->query($query);
     $prospect_count = $db->getRowCount($result);
     //count targets
     $query = "SELECT * FROM fp_events_leads_1_c WHERE fp_events_leads_1fp_events_ida='" . $event->id . "' AND (invite_status='Not Invited' OR invite_status='' OR invite_status IS NULL) AND deleted='0'";
     $result = $db->query($query);
     $lead_count = $db->getRowCount($result);
     //count leads
     $delegate_count = $contact_count + $prospect_count + $lead_count;
     //Total up delegates
     $invite_count = 0;
     //used to count the number of emails sent
     $error_count = 0;
     //used to count the number of failed email attempts
     //loop through related contacts
     foreach ($event->fp_events_contacts->getBeans() as $contact) {
         //Get accept status of contact
         $query = 'SELECT invite_status FROM fp_events_contacts_c WHERE fp_events_contactsfp_events_ida="' . $event->id . '" AND fp_events_contactscontacts_idb="' . $contact->id . '"';
         $status = $db->getOne($query);
         if ($status == null || $status == '' || $status == 'Not Invited') {
             $invite_count++;
             //set email links
             $event->link = "<a href='" . $sugar_config['site_url'] . "/index.php?entryPoint=responseEntryPoint&event=" . $event->id . "&delegate=" . $contact->id . "&type=c&response=accept'>Accept</a>";
             $event->link_declined = "<a href='" . $sugar_config['site_url'] . "/index.php?entryPoint=responseEntryPoint&event=" . $event->id . "&delegate=" . $contact->id . "&type=c&response=decline'>Decline</a>";
             //Get the TO name and e-mail address for the message
             $rcpt_name = $contact->first_name . ' ' . $contact->last_name;
             $rcpt_email = $contact->email1;
             $emailTemp = new EmailTemplate();
             $emailTemp->disable_row_level_security = true;
             $emailTemp->retrieve($event->invite_templates);
             //Use the ID value of the email template record
             //check email template is set, if not return error
             if ($emailTemp->id == '') {
                 SugarApplication::appendErrorMessage($mod_strings['LBL_ERROR_MSG_5']);
                 SugarApplication::redirect("index.php?module=FP_events&return_module=FP_events&action=DetailView&record=" . $event->id);
                 die;
             }
             //parse the lead varibales first
             $firstpass = $emailTemp->parse_template_bean($emailTemp->body_html, 'Contacts', $contact);
             $email_subject = $emailTemp->parse_template_bean($emailTemp->subject, 'FP_events', $event);
             $email_body = from_html($emailTemp->parse_template_bean($firstpass, 'FP_events', $event));
             $alt_emailbody = wordwrap($emailTemp->parse_template_bean($firstpass, 'FP_events', $event), 900);
             //get attachments
             $attachmentBean = new Note();
             $attachment_list = $attachmentBean->get_full_list('', "parent_type = 'Emails' AND parent_id = '" . $event->invite_templates . "'");
             $attachments = array();
             if ($attachment_list != null) {
                 foreach ($attachment_list as $attachment) {
                     $attachments[] = $attachment;
                 }
             }
             //send the email
             $send_invite = $this->sendEmail($rcpt_email, $email_subject, $rcpt_name, $email_body, $alt_emailbody, $contact, $attachments);
             //Send the message, log if error occurs
             if (!$send_invite) {
                 $GLOBALS['log']->fatal('ERROR: Invite email failed to send to: ' . $rcpt_name . ' at ' . $rcpt_email);
                 $error_count++;
             } else {
                 //update contact to invites
                 $query = 'UPDATE fp_events_contacts_c SET invite_status="Invited" WHERE fp_events_contactsfp_events_ida="' . $event->id . '" AND fp_events_contactscontacts_idb="' . $contact->id . '"';
                 $res = $db->query($query);
             }
         }
     }
     //loop through related targets
     foreach ($event->fp_events_prospects_1->getBeans() as $target) {
         //Get accept status of contact
         $query = 'SELECT invite_status FROM fp_events_prospects_1_c WHERE fp_events_prospects_1fp_events_ida="' . $event->id . '" AND fp_events_prospects_1prospects_idb="' . $target->id . '"';
         $status = $db->getOne($query);
         if ($status == null || $status == '' || $status == 'Not Invited') {
             $invite_count++;
             //set email links
             $event->link = "<a href='" . $sugar_config['site_url'] . "/index.php?entryPoint=responseEntryPoint&event=" . $event->id . "&delegate=" . $target->id . "&type=t&response=accept'>Accept</a>";
             $event->link_declined = "<a href='" . $sugar_config['site_url'] . "/index.php?entryPoint=responseEntryPoint&event=" . $event->id . "&delegate=" . $target->id . "&type=t&response=decline'>Decline</a>";
             //Get the TO name and e-mail address for the message
             $rcpt_name = $target->first_name . ' ' . $target->last_name;
             $rcpt_email = $target->email1;
             $emailTemp = new EmailTemplate();
             $emailTemp->disable_row_level_security = true;
             $emailTemp->retrieve($event->invite_templates);
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:SelkirkCRM,代码行数:101,代码来源:controller.php

示例3: parse_template

 function parse_template($string, &$bean_arr)
 {
     global $beanFiles, $beanList;
     foreach ($bean_arr as $bean_name => $bean_id) {
         require_once $beanFiles[$beanList[$bean_name]];
         $focus = new $beanList[$bean_name]();
         $result = $focus->retrieve($bean_id);
         if ($bean_name == 'Leads' || $bean_name == 'Prospects') {
             $bean_name = 'Contacts';
         }
         if (isset($this) && isset($this->module_dir) && $this->module_dir == 'EmailTemplates') {
             $string = $this->parse_template_bean($string, $bean_name, $focus);
         } else {
             $string = EmailTemplate::parse_template_bean($string, $bean_name, $focus);
         }
     }
     return $string;
 }
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:18,代码来源:EmailTemplate.php

示例4: testparse_template_bean

 public function testparse_template_bean()
 {
     $emailTemplate = new EmailTemplate();
     $contact = new Contact();
     $user = new User(1);
     $account = new Account();
     $contact->name = 'test';
     $account->name = 'test';
     //test with empty string
     $actual = $emailTemplate->parse_template_bean('', 'Contacts', $contact);
     $this->assertEquals('', $actual);
     //test with valid string
     $actual = $emailTemplate->parse_template_bean('test', 'Users', $user);
     $this->assertEquals('test', $actual);
     //test with empty string and different module
     $actual = $emailTemplate->parse_template_bean('', 'Accounts', $account);
     $this->assertEquals('', $actual);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:18,代码来源:EmailTemplateTest.php

示例5: parse_template

 function parse_template($string, $bean_arr)
 {
     global $beanFiles, $beanList;
     foreach ($bean_arr as $bean_name => $bean_id) {
         $focus = BeanFactory::getBean($bean_name, $bean_id);
         if ($bean_name == 'Leads' || $bean_name == 'Prospects') {
             $bean_name = 'Contacts';
         }
         if (isset($this) && isset($this->module_dir) && $this->module_dir == 'EmailTemplates') {
             $string = $this->parse_template_bean($string, $bean_name, $focus);
         } else {
             $string = EmailTemplate::parse_template_bean($string, $bean_name, $focus);
         }
     }
     return $string;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:16,代码来源:EmailTemplate.php


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