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


PHP CRM_Core_BAO_ActionSchedule::getMapping方法代码示例

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


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

示例1: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->_mappingID = $mappingID = NULL;
     if ($this->_action & CRM_Core_Action::DELETE) {
         $reminderName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'title');
         $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
         if ($this->_context == 'event') {
             $this->_eventId = CRM_Utils_Request::retrieve('eventId', 'Integer', $this);
         }
         $this->assign('reminderName', $reminderName);
         return;
     } elseif ($this->_action & CRM_Core_Action::UPDATE) {
         $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'mapping_id');
         $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
         if ($this->_context == 'event') {
             $this->_eventId = CRM_Utils_Request::retrieve('eventId', 'Integer', $this);
         }
     }
     if (!empty($_POST) && CRM_Utils_Array::value('entity', $_POST)) {
         $mappingID = $_POST['entity'][0];
     } elseif ($this->_mappingID) {
         $mappingID = $this->_mappingID;
     }
     $this->add('text', 'title', ts('Title'), array('size' => 45, 'maxlength' => 128), TRUE);
     $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection($mappingID);
     extract($selectionOptions);
     if (empty($sel1)) {
         CRM_Core_Error::fatal('Could not find mapping for scheduled reminders.');
     }
     $this->assign('entityMapping', json_encode($entityMapping));
     $this->assign('recipientMapping', json_encode($recipientMapping));
     $sel =& $this->add('hierselect', 'entity', ts('Entity'), array('name' => 'entity[0]', 'style' => 'vertical-align: top;'), TRUE);
     $sel->setOptions(array($sel1, $sel2, $sel3));
     if (is_a($sel->_elements[1], 'HTML_QuickForm_select')) {
         // make second selector a multi-select -
         $sel->_elements[1]->setMultiple(TRUE);
         $sel->_elements[1]->setSize(5);
     }
     if (is_a($sel->_elements[2], 'HTML_QuickForm_select')) {
         // make third selector a multi-select -
         $sel->_elements[2]->setMultiple(TRUE);
         $sel->_elements[2]->setSize(5);
     }
     //get the frequency units.
     $this->_freqUnits = array('hour' => 'hour') + CRM_Core_OptionGroup::values('recur_frequency_units');
     //pass the mapping ID in UPDATE mode
     $mappings = CRM_Core_BAO_ActionSchedule::getMapping($mappingID);
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30);
     //reminder_interval
     $this->add('select', 'start_action_offset', ts('When'), $numericOptions);
     foreach ($this->_freqUnits as $val => $label) {
         $freqUnitsDisplay[$val] = ts('%1(s)', array(1 => $label));
     }
     $this->addDate('absolute_date', ts('Start Date'), FALSE, array('formatType' => 'mailing'));
     //reminder_frequency
     $this->add('select', 'start_action_unit', ts('Frequency'), $freqUnitsDisplay, TRUE);
     $condition = array('before' => ts('before'), 'after' => ts('after'));
     //reminder_action
     $this->add('select', 'start_action_condition', ts('Action Condition'), $condition);
     $this->add('select', 'start_action_date', ts('Date Field'), $sel4, TRUE);
     $this->addElement('checkbox', 'is_repeat', ts('Repeat'), NULL, array('onclick' => "return showHideByValue('is_repeat',true,'repeatFields','table-row','radio',false);"));
     $this->add('select', 'repetition_frequency_unit', ts('every'), $freqUnitsDisplay);
     $this->add('select', 'repetition_frequency_interval', ts('every'), $numericOptions);
     $this->add('select', 'end_frequency_unit', ts('until'), $freqUnitsDisplay);
     $this->add('select', 'end_frequency_interval', ts('until'), $numericOptions);
     $this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE);
     $this->add('select', 'end_date', ts('Date Field'), $sel4, TRUE);
     $recipient = 'activity_contacts';
     $recipientListingOptions = array();
     if ($mappingID) {
         $recipient = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $mappingID, 'entity_recipient');
     }
     $this->add('select', 'recipient', ts('Recipient(s)'), $sel5[$recipient], FALSE, array('onClick' => "showHideByValue('recipient','manual','recipientManual','table-row','select',false); showHideByValue('recipient','group','recipientGroup','table-row','select',false);"));
     if (CRM_Utils_Array::value('is_recipient_listing', $_POST)) {
         $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($_POST['entity'][0], $_POST['recipient']);
     } elseif (CRM_Utils_Array::value('recipient_listing', $this->_values)) {
         $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($this->_values['mapping_id'], $this->_values['recipient']);
     }
     $recipientListing = $this->add('select', 'recipient_listing', ts('Recipient Listing'), $recipientListingOptions);
     $recipientListing->setMultiple(TRUE);
     $this->add('hidden', 'is_recipient_listing', empty($recipientListingOptions) ? FALSE : TRUE, array('id' => 'is_recipient_listing'));
     //autocomplete url
     $dataUrl = CRM_Utils_System::url('civicrm/ajax/rest', 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=activity&reset=1', FALSE, NULL, FALSE);
     $this->assign('dataUrl', $dataUrl);
     //tokeninput url
     $tokenUrl = CRM_Utils_System::url('civicrm/ajax/checkemail', 'noemail=1', FALSE, NULL, FALSE);
     $this->assign('tokenUrl', $tokenUrl);
     $this->add('text', 'recipient_manual_id', ts('Manual Recipients'));
     $this->addElement('select', 'group_id', ts('Group'), CRM_Core_PseudoConstant::staticGroup());
     CRM_Mailing_BAO_Mailing::commonCompose($this);
     $this->add('text', 'subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActionSchedule', 'subject'));
     $this->add('checkbox', 'is_active', ts('Send email'));
     $this->addFormRule(array('CRM_Admin_Form_ScheduleReminders', 'formRule'));
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:ScheduleReminders.php

示例2: buildQuickForm

 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->_mappingID = $mappingID = NULL;
     $providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
     if ($this->_action & CRM_Core_Action::DELETE) {
         $reminderName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'title');
         $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
         if ($this->_context == 'event') {
             $this->_eventId = CRM_Utils_Request::retrieve('eventId', 'Integer', $this);
         }
         $this->assign('reminderName', $reminderName);
         return;
     } elseif ($this->_action & CRM_Core_Action::UPDATE) {
         $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'mapping_id');
         $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
         if ($this->_context == 'event') {
             $this->_eventId = CRM_Utils_Request::retrieve('eventId', 'Integer', $this);
         }
     }
     if (!empty($_POST) && !empty($_POST['entity'])) {
         $mappingID = $_POST['entity'][0];
     } elseif ($this->_mappingID) {
         $mappingID = $this->_mappingID;
     }
     $this->add('text', 'title', ts('Title'), array('size' => 45, 'maxlength' => 128), TRUE);
     $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection($mappingID);
     extract($selectionOptions);
     if (empty($sel1)) {
         CRM_Core_Error::fatal('Could not find mapping for scheduled reminders.');
     }
     $this->assign('entityMapping', json_encode($entityMapping));
     $this->assign('recipientMapping', json_encode($recipientMapping));
     $sel =& $this->add('hierselect', 'entity', ts('Entity'), array('name' => 'entity[0]', 'style' => 'vertical-align: top;'), TRUE);
     $sel->setOptions(array($sel1, $sel2, $sel3));
     if (is_a($sel->_elements[1], 'HTML_QuickForm_select')) {
         // make second selector a multi-select -
         $sel->_elements[1]->setMultiple(TRUE);
         $sel->_elements[1]->setSize(5);
     }
     if (is_a($sel->_elements[2], 'HTML_QuickForm_select')) {
         // make third selector a multi-select -
         $sel->_elements[2]->setMultiple(TRUE);
         $sel->_elements[2]->setSize(5);
     }
     //get the frequency units.
     $this->_freqUnits = CRM_Core_SelectValues::getScheduleReminderFrequencyUnits();
     //pass the mapping ID in UPDATE mode
     $mappings = CRM_Core_BAO_ActionSchedule::getMapping($mappingID);
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30);
     //reminder_interval
     $this->add('select', 'start_action_offset', ts('When'), $numericOptions);
     $title = ts('Email');
     $isActive = ts('Send email');
     $recordActivity = ts('Record activity for automated email');
     if ($providersCount) {
         $this->assign('sms', $providersCount);
         $title = ts('Email or SMS');
         $isActive = ts('Send email or SMS');
         $recordActivity = ts('Record activity for automated email or SMS');
         $options = CRM_Core_OptionGroup::values('msg_mode');
         $this->add('select', 'mode', ts('Send as'), $options);
         $providers = CRM_SMS_BAO_Provider::getProviders(NULL, NULL, TRUE, 'is_default desc');
         $providerSelect = array();
         foreach ($providers as $provider) {
             $providerSelect[$provider['id']] = $provider['title'];
         }
         $this->add('select', 'sms_provider_id', ts('From'), $providerSelect, TRUE);
     }
     $this->assign('title', $title);
     foreach ($this->_freqUnits as $val => $label) {
         $freqUnitsDisplay[$val] = ts('%1(s)', array(1 => $label));
     }
     $this->addDate('absolute_date', ts('Start Date'), FALSE, array('formatType' => 'mailing'));
     //reminder_frequency
     $this->add('select', 'start_action_unit', ts('Frequency'), $freqUnitsDisplay, TRUE);
     $condition = array('before' => ts('before'), 'after' => ts('after'));
     //reminder_action
     $this->add('select', 'start_action_condition', ts('Action Condition'), $condition);
     $this->add('select', 'start_action_date', ts('Date Field'), $sel4, TRUE);
     $this->addElement('checkbox', 'record_activity', $recordActivity);
     $this->addElement('checkbox', 'is_repeat', ts('Repeat'), NULL, array('onchange' => "return showHideByValue('is_repeat',true,'repeatFields','table-row','radio',false);"));
     $this->add('select', 'repetition_frequency_unit', ts('every'), $freqUnitsDisplay);
     $this->add('select', 'repetition_frequency_interval', ts('every'), $numericOptions);
     $this->add('select', 'end_frequency_unit', ts('until'), $freqUnitsDisplay);
     $this->add('select', 'end_frequency_interval', ts('until'), $numericOptions);
     $this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE);
     $this->add('select', 'end_date', ts('Date Field'), $sel4, TRUE);
     $this->add('text', 'from_name', ts('From Name'));
     $this->add('text', 'from_email', ts('From Email'));
     $recipient = 'activity_contacts';
     $recipientListingOptions = array();
     if ($mappingID) {
         $recipient = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $mappingID, 'entity_recipient');
//.........这里部分代码省略.........
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:ScheduleReminders.php

示例3: formRule

 /**
  * Global form rule.
  *
  * @param array $fields
  *   The input form values.
  * @param array $files
  * @param CRM_Admin_Form_ScheduleReminders $self
  *
  * @return array|bool
  *   True if no errors, else array of errors
  */
 public static function formRule($fields, $files, $self)
 {
     $errors = array();
     if (array_key_exists(1, $fields['entity']) && $fields['entity'][1][0] === 0 || array_key_exists(2, $fields['entity']) && $fields['entity'][2][0] == 0) {
         $errors['entity'] = ts('Please select appropriate value');
     }
     if (!empty($fields['is_active']) && CRM_Utils_System::isNull($fields['subject'])) {
         $errors['subject'] = ts('Subject is a required field.');
     }
     if (!empty($fields['is_active']) && CRM_Utils_System::isNull(trim(strip_tags($fields['html_message'])))) {
         $errors['html_message'] = ts('The HTML message is a required field.');
     }
     if (empty($self->_context) && CRM_Utils_System::isNull(CRM_Utils_Array::value(1, $fields['entity']))) {
         $errors['entity'] = ts('Please select entity value');
     }
     if (!CRM_Utils_System::isNull($fields['absolute_date'])) {
         if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($fields['absolute_date'], NULL)) < CRM_Utils_Date::format(date('Ymd'))) {
             $errors['absolute_date'] = ts('Absolute date cannot be earlier than the current time.');
         }
     }
     $recipientKind = array('participant_role' => array('name' => 'participant role', 'target_id' => 'recipient_listing'), 'manual' => array('name' => 'recipient', 'target_id' => 'recipient_manual_id'));
     if ($fields['limit_to'] != '' && array_key_exists($fields['recipient'], $recipientKind) && empty($fields[$recipientKind[$fields['recipient']]['target_id']])) {
         $errors[$recipientKind[$fields['recipient']]['target_id']] = ts('If "Also include" or "Limit to" are selected, you must specify at least one %1', array(1 => $recipientKind[$fields['recipient']]['name']));
     }
     $actionSchedule = $self->parseActionSchedule($fields);
     if ($actionSchedule->mapping_id) {
         $mapping = CRM_Core_BAO_ActionSchedule::getMapping($actionSchedule->mapping_id);
         CRM_Utils_Array::extend($errors, $mapping->validateSchedule($actionSchedule));
     }
     if (!empty($errors)) {
         return $errors;
     }
     return empty($errors) ? TRUE : $errors;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:45,代码来源:ScheduleReminders.php

示例4: mappingList

 /**
  * Get a list of mappings.
  *
  * This appears to be only used by scheduled reminders.
  */
 public static function mappingList()
 {
     if (empty($_GET['mappingID'])) {
         CRM_Utils_JSON::output(array('status' => 'error', 'error_msg' => 'required params missing.'));
     }
     $mapping = CRM_Core_BAO_ActionSchedule::getMapping($_GET['mappingID']);
     $dateFieldLabels = $mapping ? $mapping->getDateFields() : array();
     // The UX here is quirky -- for "Activity" types, there's a simple drop "Recipients"
     // dropdown which is always displayed. For other types, the "Recipients" drop down is
     // conditional upon the weird isLimit ('Limit To / Also Include / Neither') dropdown.
     $noThanksJustKidding = !$_GET['isLimit'];
     if ($mapping instanceof CRM_Activity_ActionMapping || !$noThanksJustKidding) {
         $entityRecipientLabels = $mapping ? $mapping->getRecipientTypes() + CRM_Core_BAO_ActionSchedule::getAdditionalRecipients() : array();
     } else {
         $entityRecipientLabels = CRM_Core_BAO_ActionSchedule::getAdditionalRecipients();
     }
     $recipientMapping = array_combine(array_keys($entityRecipientLabels), array_keys($entityRecipientLabels));
     $output = array('sel4' => CRM_Utils_Array::toKeyValueRows($dateFieldLabels), 'sel5' => CRM_Utils_Array::toKeyValueRows($entityRecipientLabels), 'recipientMapping' => $recipientMapping);
     CRM_Utils_JSON::output($output);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:25,代码来源:AJAX.php


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