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


PHP CRM_Core_SelectValues::contactTokens方法代码示例

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


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

示例1: listTokens

 /**
  * List available tokens for this form.
  *
  * @return array
  */
 public function listTokens()
 {
     $tokens = CRM_Core_SelectValues::contactTokens();
     foreach ($this->_caseIds as $key => $caseId) {
         $caseTypeId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseId, 'case_type_id');
         $tokens += CRM_Core_SelectValues::caseTokens($caseTypeId);
     }
     return $tokens;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:14,代码来源:PDF.php

示例2: 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

示例3: buildQuickForm

 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     $config = CRM_Core_Config::singleton();
     $resources = CRM_Core_Resources::singleton();
     $resources->addSetting(array('kcfinderPath' => $config->userFrameworkResourceURL . 'packages' . DIRECTORY_SEPARATOR));
     $resources->addScriptFile('civicrm', 'templates/CRM/Badge/Form/Layout.js');
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'), true);
     $labelStyle = CRM_Core_BAO_LabelFormat::getList(TRUE, 'name_badge');
     $this->add('select', 'label_format_name', ts('Label Format'), array('' => ts('- select -')) + $labelStyle, TRUE);
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));
     // get the tokens
     $contactTokens = CRM_Core_SelectValues::contactTokens();
     $eventTokens = array('{event.event_id}' => ts('Event ID'), '{event.title}' => ts('Event Title'), '{event.start_date}' => ts('Event Start Date'), '{event.end_date}' => ts('Event End Date'));
     $participantTokens = CRM_Core_SelectValues::participantTokens();
     $tokens = array_merge($contactTokens, $eventTokens, $participantTokens);
     asort($tokens);
     $tokens = array_merge(array('spacer' => ts('- spacer -')) + $tokens);
     $fontSizes = CRM_Core_BAO_LabelFormat::getFontSizes();
     $fontStyles = CRM_Core_BAO_LabelFormat::getFontStyles();
     $fontNames = CRM_Core_BAO_LabelFormat::getFontNames('name_badge');
     $textAlignment = CRM_Core_BAO_LabelFormat::getTextAlignments();
     $rowCount = self::FIELD_ROWCOUNT;
     for ($i = 1; $i <= $rowCount; $i++) {
         $this->add('select', "token[{$i}]", ts('Token'), array('' => ts('- skip -')) + $tokens);
         $this->add('select', "font_name[{$i}]", ts('Font Name'), $fontNames);
         $this->add('select', "font_size[{$i}]", ts('Font Size'), $fontSizes);
         $this->add('select', "font_style[{$i}]", ts('Font Style'), $fontStyles);
         $this->add('select', "text_alignment[{$i}]", ts('Alignment'), $textAlignment);
     }
     $rowCount++;
     $this->assign('rowCount', $rowCount);
     $barcodeTypes = CRM_Core_SelectValues::getBarcodeTypes();
     $this->add('checkbox', 'add_barcode', ts('Barcode?'));
     $this->add('select', "barcode_type", ts('Type'), $barcodeTypes);
     $this->add('select', "barcode_alignment", ts('Alignment'), $textAlignment);
     $attributes = array('readonly' => true);
     $this->add('text', 'image_1', ts('Image (top left)'), $attributes + CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));
     $this->add('text', 'width_image_1', ts('Width (mm)'), array('size' => 6));
     $this->add('text', 'height_image_1', ts('Height (mm)'), array('size' => 6));
     $this->add('text', 'image_2', ts('Image (top right)'), $attributes + CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));
     $this->add('text', 'width_image_2', ts('Width (mm)'), array('size' => 6));
     $this->add('text', 'height_image_2', ts('Height (mm)'), array('size' => 6));
     $this->add('checkbox', 'is_default', ts('Default?'));
     $this->add('checkbox', 'is_active', ts('Enabled?'));
     $this->add('checkbox', 'is_reserved', ts('Reserved?'));
     $this->addRule('width_image_1', ts('Enter valid width'), 'positiveInteger');
     $this->addRule('width_image_2', ts('Enter valid width'), 'positiveInteger');
     $this->addRule('height_image_1', ts('Enter valid height'), 'positiveInteger');
     $this->addRule('height_image_2', ts('Enter valid height'), 'positiveInteger');
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'refresh', 'name' => ts('Save and Preview')), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:62,代码来源:Layout.php

示例4: buildQuickForm

 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     $this->applyFilter('__ALL__', 'trim');
     // Address Standardization
     $addrProviders = CRM_Core_SelectValues::addressProvider();
     $this->addElement('select', 'address_standardization_provider', ts('Address Provider'), array('' => '- select -') + $addrProviders);
     $this->addFormRule(array('CRM_Admin_Form_Preferences_Address', 'formRule'));
     //get the tokens for Mailing Label field
     $tokens = CRM_Core_SelectValues::contactTokens();
     natcasesort($tokens);
     $this->assign('tokens', json_encode($tokens));
     $this->add('select', 'token1', ts('Insert Token'), $tokens, FALSE, array('size' => "5", 'multiple' => TRUE, 'onclick' => "return tokenReplText(this);"));
     parent::buildQuickForm();
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:20,代码来源:Address.php

示例5: preProcess

 function preProcess()
 {
     //get all preProcessCommon Values
     self::preProcessCommon($this);
     $token = CRM_Core_SelectValues::contactTokens();
     //Membership Tokens
     if ($this->_searchFrom == 'member') {
         $token = $token + CRM_Core_SelectValues::membershipTokens();
     }
     $tokenMerge = array();
     foreach ($token as $key => $label) {
         $tokenMerge[] = array('id' => $key, 'text' => $label);
     }
     //construct array to manage token name and label
     foreach ($tokenMerge as $tmKey => $tmValue) {
         $tokenFullName = str_replace(array('{', '}'), "", $tmValue['id']);
         $explodedTokenName = explode('.', $tokenFullName);
         $tokenMerge[$tmKey]['token_name'] = $explodedTokenName[0] != 'contact' ? $tokenFullName : $explodedTokenName[1];
         if ($explodedTokenName[0] != 'civiqrcode') {
             if ($explodedTokenName[0] != 'contact') {
                 $tokenMerge[$tmKey]['var_name'] = '[' . self::TOKEN_VAR_NAME . '.' . $tokenFullName . ';block=w:tr]';
                 $tokenMerge[$tmKey]['var_name_table'] = '[' . self::TOKEN_VAR_NAME . '.' . $tokenFullName . ';block=w:tbl]';
             } else {
                 //need to do proper fix seems token named as contact.address_block
                 $explodedTokenName[1] = $explodedTokenName[1] == 'address_block' ? 'contact.' . $explodedTokenName[1] : $explodedTokenName[1];
                 $tokenMerge[$tmKey]['var_name'] = '[' . self::TOKEN_VAR_NAME . '.' . $explodedTokenName[1] . ';block=w:tr]';
                 $tokenMerge[$tmKey]['var_name_table'] = '[' . self::TOKEN_VAR_NAME . '.' . $explodedTokenName[1] . ';block=w:tbl]';
             }
         } else {
             $tokenMerge[$tmKey]['var_name'] = '[' . self::TOKEN_VAR_NAME . '.' . $tokenFullName . ';block=w:image;ope=changepic]';
             $tokenMerge[$tmKey]['var_name_table'] = '[' . self::TOKEN_VAR_NAME . '.' . $tokenFullName . ';block=w:image;ope=changepic]';
         }
         $this->_allTokens[$explodedTokenName[0]][] = $explodedTokenName[1];
         $this->_returnProperties[$explodedTokenName[1]] = 1;
     }
     $this->_tokenMerge = $tokenMerge;
     $this->assign('availableTokens', $this->_tokenMerge);
 }
开发者ID:krishgopi,项目名称:uk.co.vedaconsulting.module.wordmailmerge,代码行数:38,代码来源:WordMailMergeForm.php

示例6: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 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('&amp;', '&', $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;
     }
     require_once 'CRM/Utils/System.php';
     $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_MessageTemplates', 'msg_title'), true);
     $this->add('text', 'msg_subject', ts('Message Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplates', 'msg_subject'));
     //get the tokens.
     $tokens = CRM_Core_SelectValues::contactTokens();
     //sorted in ascending order tokens by ignoring word case
     natcasesort($tokens);
     $this->assign('tokens', $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->add('textarea', 'msg_text', ts('Text Message'), "cols=50 rows=6");
     $this->add('textarea', 'msg_html', ts('HTML Message'), "cols=50 rows=6");
     $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:ksecor,项目名称:civicrm,代码行数:42,代码来源:MessageTemplates.php

示例7: listTokens

 /**
  * List available tokens for this form.
  *
  * @return array
  */
 public function listTokens()
 {
     $tokens = CRM_Core_SelectValues::contactTokens();
     return $tokens;
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:10,代码来源:Email.php

示例8: updatePledgeStatus

 public static function updatePledgeStatus($params)
 {
     $returnMessages = array();
     $sendReminders = CRM_Utils_Array::value('send_reminders', $params, FALSE);
     $allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     //unset statues that we never use for pledges
     foreach (array('Completed', 'Cancelled', 'Failed') as $statusKey) {
         if ($key = CRM_Utils_Array::key($statusKey, $allStatus)) {
             unset($allStatus[$key]);
         }
     }
     $statusIds = implode(',', array_keys($allStatus));
     $updateCnt = 0;
     $query = "\nSELECT  pledge.contact_id              as contact_id,\n        pledge.id                      as pledge_id,\n        pledge.amount                  as amount,\n        payment.scheduled_date         as scheduled_date,\n        pledge.create_date             as create_date,\n        payment.id                     as payment_id,\n        pledge.currency                as currency,\n        pledge.contribution_page_id    as contribution_page_id,\n        payment.reminder_count         as reminder_count,\n        pledge.max_reminders           as max_reminders,\n        payment.reminder_date          as reminder_date,\n        pledge.initial_reminder_day    as initial_reminder_day,\n        pledge.additional_reminder_day as additional_reminder_day,\n        pledge.status_id               as pledge_status,\n        payment.status_id              as payment_status,\n        pledge.is_test                 as is_test,\n        pledge.campaign_id             as campaign_id,\n        SUM(payment.scheduled_amount)  as amount_due,\n        ( SELECT sum(civicrm_pledge_payment.actual_amount)\n        FROM civicrm_pledge_payment\n        WHERE civicrm_pledge_payment.status_id = 1\n        AND  civicrm_pledge_payment.pledge_id = pledge.id\n        ) as amount_paid\n        FROM      civicrm_pledge pledge, civicrm_pledge_payment payment\n        WHERE     pledge.id = payment.pledge_id\n        AND     payment.status_id IN ( {$statusIds} ) AND pledge.status_id IN ( {$statusIds} )\n        GROUP By  payment.id\n        ";
     $dao = CRM_Core_DAO::executeQuery($query);
     $now = date('Ymd');
     $pledgeDetails = $contactIds = $pledgePayments = $pledgeStatus = array();
     while ($dao->fetch()) {
         $checksumValue = CRM_Contact_BAO_Contact_Utils::generateChecksum($dao->contact_id);
         $pledgeDetails[$dao->payment_id] = array('scheduled_date' => $dao->scheduled_date, 'amount_due' => $dao->amount_due, 'amount' => $dao->amount, 'amount_paid' => $dao->amount_paid, 'create_date' => $dao->create_date, 'contact_id' => $dao->contact_id, 'pledge_id' => $dao->pledge_id, 'checksumValue' => $checksumValue, 'contribution_page_id' => $dao->contribution_page_id, 'reminder_count' => $dao->reminder_count, 'max_reminders' => $dao->max_reminders, 'reminder_date' => $dao->reminder_date, 'initial_reminder_day' => $dao->initial_reminder_day, 'additional_reminder_day' => $dao->additional_reminder_day, 'pledge_status' => $dao->pledge_status, 'payment_status' => $dao->payment_status, 'is_test' => $dao->is_test, 'currency' => $dao->currency, 'campaign_id' => $dao->campaign_id);
         $contactIds[$dao->contact_id] = $dao->contact_id;
         $pledgeStatus[$dao->pledge_id] = $dao->pledge_status;
         if (CRM_Utils_Date::overdue(CRM_Utils_Date::customFormat($dao->scheduled_date, '%Y%m%d'), $now) && $dao->payment_status != array_search('Overdue', $allStatus)) {
             $pledgePayments[$dao->pledge_id][$dao->payment_id] = $dao->payment_id;
         }
     }
     // process the updating script...
     foreach ($pledgePayments as $pledgeId => $paymentIds) {
         // 1. update the pledge /pledge payment status. returns new status when an update happens
         $returnMessages[] = "Checking if status update is needed for Pledge Id: {$pledgeId} (current status is {$allStatus[$pledgeStatus[$pledgeId]]})";
         $newStatus = CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeId, $paymentIds, array_search('Overdue', $allStatus), NULL, 0, FALSE, TRUE);
         if ($newStatus != $pledgeStatus[$pledgeId]) {
             $returnMessages[] = "- status updated to: {$allStatus[$newStatus]}";
             $updateCnt += 1;
         }
     }
     if ($sendReminders) {
         // retrieve domain tokens
         $domain = CRM_Core_BAO_Domain::getDomain();
         $tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
         $domainValues = array();
         foreach ($tokens['domain'] as $token) {
             $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
         }
         //get the domain email address, since we don't carry w/ object.
         $domainValue = CRM_Core_BAO_Domain::getNameAndEmail();
         $domainValues['email'] = $domainValue[1];
         // retrieve contact tokens
         // this function does NOT return Deceased contacts since we don't want to send them email
         list($contactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, $tokens, 'CRM_UpdatePledgeRecord');
         // assign domain values to template
         $template = CRM_Core_Smarty::singleton();
         $template->assign('domain', $domainValues);
         //set receipt from
         $receiptFrom = '"' . $domainValues['name'] . '" <' . $domainValues['email'] . '>';
         foreach ($pledgeDetails as $paymentId => $details) {
             if (array_key_exists($details['contact_id'], $contactDetails)) {
                 $contactId = $details['contact_id'];
                 $pledgerName = $contactDetails[$contactId]['display_name'];
             } else {
                 continue;
             }
             if (empty($details['reminder_date'])) {
                 $nextReminderDate = new DateTime($details['scheduled_date']);
                 $nextReminderDate->modify("-" . $details['initial_reminder_day'] . "day");
                 $nextReminderDate = $nextReminderDate->format("Ymd");
             } else {
                 $nextReminderDate = new DateTime($details['reminder_date']);
                 $nextReminderDate->modify("+" . $details['additional_reminder_day'] . "day");
                 $nextReminderDate = $nextReminderDate->format("Ymd");
             }
             if ($details['reminder_count'] < $details['max_reminders'] && $nextReminderDate <= $now) {
                 $toEmail = $doNotEmail = $onHold = NULL;
                 if (!empty($contactDetails[$contactId]['email'])) {
                     $toEmail = $contactDetails[$contactId]['email'];
                 }
                 if (!empty($contactDetails[$contactId]['do_not_email'])) {
                     $doNotEmail = $contactDetails[$contactId]['do_not_email'];
                 }
                 if (!empty($contactDetails[$contactId]['on_hold'])) {
                     $onHold = $contactDetails[$contactId]['on_hold'];
                 }
                 // 2. send acknowledgement mail
                 if ($toEmail && !($doNotEmail || $onHold)) {
                     //assign value to template
                     $template->assign('amount_paid', $details['amount_paid'] ? $details['amount_paid'] : 0);
                     $template->assign('contact', $contactDetails[$contactId]);
                     $template->assign('next_payment', $details['scheduled_date']);
                     $template->assign('amount_due', $details['amount_due']);
                     $template->assign('checksumValue', $details['checksumValue']);
                     $template->assign('contribution_page_id', $details['contribution_page_id']);
                     $template->assign('pledge_id', $details['pledge_id']);
                     $template->assign('scheduled_payment_date', $details['scheduled_date']);
                     $template->assign('amount', $details['amount']);
                     $template->assign('create_date', $details['create_date']);
                     $template->assign('currency', $details['currency']);
                     list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(array('groupName' => 'msg_tpl_workflow_pledge', 'valueName' => 'pledge_reminder', 'contactId' => $contactId, 'from' => $receiptFrom, 'toName' => $pledgerName, 'toEmail' => $toEmail));
                     // 3. update pledge payment details
                     if ($mailSent) {
                         CRM_Pledge_BAO_PledgePayment::updateReminderDetails($paymentId);
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:Pledge.php

示例9: listTokens

 /**
  * List available tokens for this form.
  *
  * @return array
  */
 public function listTokens()
 {
     $tokens = CRM_Core_SelectValues::contactTokens();
     $tokens = array_merge(CRM_Core_SelectValues::activityTokens(), $tokens);
     $tokens = array_merge(CRM_Core_SelectValues::eventTokens(), $tokens);
     $tokens = array_merge(CRM_Core_SelectValues::membershipTokens(), $tokens);
     $tokens = array_merge(CRM_Core_SelectValues::contributionTokens(), $tokens);
     return $tokens;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:14,代码来源:ScheduleReminders.php

示例10: cancelParticipant

 /**
  * Cancel this participant and finish, send cancellation email. At this point no
  * auto-cancellation of payment is handled, so payment needs to be manually cancelled
  *
  * return @void
  */
 public function cancelParticipant($params)
 {
     //set participant record status to Cancelled, refund payment if possible
     // send email to participant and admin, and log Activity
     $value = array();
     $value['id'] = $this->_participant_id;
     $cancelledId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'"));
     $value['status_id'] = $cancelledId;
     CRM_Event_BAO_Participant::create($value);
     $domainValues = array();
     $domain = CRM_Core_BAO_Domain::getDomain();
     $tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
     foreach ($tokens['domain'] as $token) {
         $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
     }
     $participantRoles = array();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $participantDetails = array();
     $query = "SELECT * FROM civicrm_participant WHERE id = {$this->_participant_id}";
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
         $participantDetails[$dao->id] = array('id' => $dao->id, 'role' => $participantRoles[$dao->role_id], 'is_test' => $dao->is_test, 'event_id' => $dao->event_id, 'status_id' => $dao->status_id, 'fee_amount' => $dao->fee_amount, 'contact_id' => $dao->contact_id, 'register_date' => $dao->register_date, 'registered_by_id' => $dao->registered_by_id);
     }
     $eventDetails = array();
     $eventParams = array('id' => $this->_event_id);
     CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$this->_event_id]);
     //get default participant role.
     $eventDetails[$this->_event_id]['participant_role'] = CRM_Utils_Array::value($eventDetails[$this->_event_id]['default_role_id'], $participantRoles);
     //get the location info
     $locParams = array('entity_id' => $this->_event_id, 'entity_table' => 'civicrm_event');
     $eventDetails[$this->_event_id]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
     //get contact details
     $contactIds[$this->_contact_id] = $this->_contact_id;
     list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, array(), 'CRM_Event_BAO_Participant');
     foreach ($currentContactDetails as $contactId => $contactValues) {
         $contactDetails[$this->_contact_id] = $contactValues;
     }
     //send a 'cancelled' email to user, and cc the event's cc_confirm email
     $mail = CRM_Event_BAO_Participant::sendTransitionParticipantMail($this->_participant_id, $participantDetails[$this->_participant_id], $eventDetails[$this->_event_id], $contactDetails[$this->_contact_id], $domainValues, "Cancelled", "");
     $statusMsg = ts('Event registration information for %1 has been updated.', array(1 => $this->_contact_name));
     $statusMsg .= ' ' . ts('A cancellation email has been sent to %1.', array(1 => $this->_contact_email));
     CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
     $url = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_event_id}&noFullMsg=true");
     CRM_Utils_System::redirect($url);
 }
开发者ID:agileware,项目名称:civicrm-core,代码行数:51,代码来源:SelfSvcUpdate.php

示例11: listTokens

 /**
  * List available tokens for this form.
  *
  * @return array
  */
 public function listTokens()
 {
     $tokens = CRM_Core_SelectValues::contactTokens();
     $tokens = array_merge(CRM_Core_SelectValues::mailingTokens(), $tokens);
     return $tokens;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:11,代码来源:Upload.php

示例12: commonLetterCompose

 /**
  * Function to build the  compose PDF letter form
  *
  * @param   $form
  *
  * @return None
  * @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);
     }
     //sorted in ascending order tokens by ignoring word case
     natcasesort($tokens);
     $form->assign('tokens', json_encode($tokens));
     $form->add('select', 'token1', ts('Insert Tokens'), $tokens, FALSE, array('size' => "5", 'multiple' => TRUE, 'onchange' => "return tokenReplHtml(this);"));
     $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:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:40,代码来源:Mailing.php

示例13: commonCompose

 /**
  * Build the  compose mail form.
  *
  * @param CRM_Core_Form $form
  *
  * @return void
  */
 public static function commonCompose(&$form)
 {
     //get the tokens.
     $tokens = CRM_Core_SelectValues::contactTokens();
     $className = CRM_Utils_System::getClassName($form);
     if ($className == 'CRM_Mailing_Form_Upload') {
         $tokens = array_merge(CRM_Core_SelectValues::mailingTokens(), $tokens);
     } elseif ($className == 'CRM_Admin_Form_ScheduleReminders') {
         $tokens = array_merge(CRM_Core_SelectValues::activityTokens(), $tokens);
         $tokens = array_merge(CRM_Core_SelectValues::eventTokens(), $tokens);
         $tokens = array_merge(CRM_Core_SelectValues::membershipTokens(), $tokens);
     } elseif ($className == 'CRM_Event_Form_ManageEvent_ScheduleReminders') {
         $tokens = array_merge(CRM_Core_SelectValues::eventTokens(), $tokens);
     }
     //TODO standardize on this method
     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');
     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:vakeesan26,项目名称:civicrm-core,代码行数:68,代码来源:Mailing.php

示例14: sendCancellation

 /**
  * Send confirmation of cancellation to source participant
  *
  * return @ void
  */
 public function sendCancellation()
 {
     $domainValues = array();
     $domain = CRM_Core_BAO_Domain::getDomain();
     $tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
     foreach ($tokens['domain'] as $token) {
         $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
     }
     $participantRoles = array();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $participantDetails = array();
     $query = "SELECT * FROM civicrm_participant WHERE id = {$this->_from_participant_id}";
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
         $participantDetails[$dao->id] = array('id' => $dao->id, 'role' => $participantRoles[$dao->role_id], 'is_test' => $dao->is_test, 'event_id' => $dao->event_id, 'status_id' => $dao->status_id, 'fee_amount' => $dao->fee_amount, 'contact_id' => $dao->contact_id, 'register_date' => $dao->register_date, 'registered_by_id' => $dao->registered_by_id);
     }
     $eventDetails = array();
     $eventParams = array('id' => $this->_event_id);
     CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$this->_event_id]);
     //get default participant role.
     $eventDetails[$this->_event_id]['participant_role'] = CRM_Utils_Array::value($eventDetails[$this->_event_id]['default_role_id'], $participantRoles);
     //get the location info
     $locParams = array('entity_id' => $this->_event_id, 'entity_table' => 'civicrm_event');
     $eventDetails[$this->_event_id]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
     //get contact details
     $contactIds[$this->_from_contact_id] = $this->_from_contact_id;
     list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, array(), 'CRM_Event_BAO_Participant');
     foreach ($currentContactDetails as $contactId => $contactValues) {
         $contactDetails[$this->_from_contact_id] = $contactValues;
     }
     //send a 'cancelled' email to user, and cc the event's cc_confirm email
     $mail = CRM_Event_BAO_Participant::sendTransitionParticipantMail($this->_from_participant_id, $participantDetails[$this->_from_participant_id], $eventDetails[$this->_event_id], $contactDetails[$this->_from_contact_id], $domainValues, "Transferred", "");
     $statusMsg = ts('Event registration information for %1 has been updated.', array(1 => $this->_contact_name));
     $statusMsg .= ' ' . ts('A cancellation email has been sent to %1.', array(1 => $this->_contact_email));
     CRM_Core_Session::setStatus($statusMsg, ts('Thanks'), 'success');
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:41,代码来源:SelfSvcTransfer.php

示例15: 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('&amp;', '&', $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


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