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


PHP CRM_Event_BAO_Participant::fetch方法代码示例

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


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

示例1: find_all_by_params

 public static function find_all_by_params($params)
 {
     $participant = new CRM_Event_BAO_Participant();
     $participant->copyValues($params);
     $result = array();
     if ($participant->find()) {
         while ($participant->fetch()) {
             $result[] = new CRM_Event_Cart_BAO_MerParticipant(clone $participant);
         }
     }
     return $result;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:12,代码来源:MerParticipant.php

示例2: getValues

 /**
  * Given the list of params in the params array, fetch the object
  * and store the values in the values array
  *
  * @param array $params
  *   Input parameters to find object.
  * @param array $values
  *   Output values of the object.
  *
  * @param $ids
  *
  * @return CRM_Event_BAO_Participant|null the found object or null
  */
 public static function getValues(&$params, &$values, &$ids)
 {
     if (empty($params)) {
         return NULL;
     }
     $participant = new CRM_Event_BAO_Participant();
     $participant->copyValues($params);
     $participant->find();
     $participants = array();
     while ($participant->fetch()) {
         $ids['participant'] = $participant->id;
         CRM_Core_DAO::storeValues($participant, $values[$participant->id]);
         $participants[$participant->id] = $participant;
     }
     return $participants;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:29,代码来源:Participant.php

示例3: validate

 function validate()
 {
     parent::validate();
     if ($this->_errors) {
         return FALSE;
     }
     $this->cart->load_associations();
     $fields = $this->_submitValues;
     foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) {
         $price_set_id = CRM_Event_BAO_Event::usesPriceSet($event_in_cart->event_id);
         if ($price_set_id) {
             $priceField = new CRM_Price_DAO_PriceField();
             $priceField->price_set_id = $price_set_id;
             $priceField->find();
             $check = array();
             while ($priceField->fetch()) {
                 if (!empty($fields["event_{$event_in_cart->event_id}_price_{$priceField->id}"])) {
                     $check[] = $priceField->id;
                 }
             }
             //XXX
             if (empty($check)) {
                 $this->_errors['_qf_default'] = ts("Select at least one option from Price Levels.");
             }
             $lineItem = array();
             if (is_array($this->_values['fee']['fields'])) {
                 CRM_Price_BAO_PriceSet::processAmount($this->_values['fee']['fields'], $fields, $lineItem);
                 //XXX total...
                 if ($fields['amount'] < 0) {
                     $this->_errors['_qf_default'] = ts("Price Levels can not be less than zero. Please select the options accordingly");
                 }
             }
         }
         foreach ($event_in_cart->participants as $mer_participant) {
             $participant_fields = $fields['event'][$event_in_cart->event_id]['participant'][$mer_participant->id];
             //TODO what to do when profile responses differ for the same contact?
             $contact_id = self::find_contact($participant_fields);
             if ($contact_id) {
                 $participant = new CRM_Event_BAO_Participant();
                 $participant->event_id = $event_in_cart->event_id;
                 $participant->contact_id = $contact_id;
                 $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
                 $participant->find();
                 while ($participant->fetch()) {
                     if (array_key_exists($participant->status_id, $statusTypes)) {
                         $form = $mer_participant->get_form();
                         $this->_errors[$form->html_field_name('email')] = ts("The participant %1 is already registered for %2 (%3).", array(1 => $participant_fields['email'], 2 => $event_in_cart->event->title, 3 => $event_in_cart->event->start_date));
                     }
                 }
             }
         }
     }
     return empty($this->_errors);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:54,代码来源:ParticipantsAndPrices.php

示例4: checkRegistration

 /**
  * Method to check if the user is already registered for the event
  * and if result found redirect to the event info page
  *
  * @param array $fields  the input form values(anonymous user)
  * @param array $self    event data
  * @param boolean $isAdditional treat isAdditional participants a bit differently
  * @param boolean $returnContactId just find and return the contactID match to use
  * @param boolean $useDedupeRules force usage of dedupe rules
  *
  * @return void
  * @access public
  */
 static function checkRegistration($fields, &$self, $isAdditional = FALSE, $returnContactId = FALSE, $useDedupeRules = FALSE)
 {
     // CRM-3907, skip check for preview registrations
     // CRM-4320 participant need to walk wizard
     if (!$returnContactId && ($self->_mode == 'test' || $self->_allowConfirmation)) {
         return FALSE;
     }
     $contactID = NULL;
     $session = CRM_Core_Session::singleton();
     if (!$isAdditional) {
         $contactID = $self->getContactID();
     }
     if (!$contactID && is_array($fields) && $fields) {
         //CRM-6996
         //as we are allowing w/ same email address,
         //lets check w/ other contact params.
         if ($self->_values['event']['allow_same_participant_emails']) {
             $params = $fields;
             $level = $isAdditional ? 'Supervised' : 'Unsupervised';
             $dedupeParams = CRM_Dedupe_Finder::formatParams($params, 'Individual');
             // disable permission based on cache since event registration is public page/feature.
             $dedupeParams['check_permission'] = FALSE;
             $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual', $level);
             $contactID = CRM_Utils_Array::value(0, $ids);
         } else {
             foreach ($fields as $fieldname => $fieldvalue) {
                 if (substr($fieldname, 0, 6) == 'email-') {
                     $emailString = trim($fieldvalue);
                     if (!empty($emailString)) {
                         $match = CRM_Contact_BAO_Contact::matchContactOnEmail($emailString, 'Individual');
                         if (!empty($match)) {
                             $contactID = $match->contact_id;
                         }
                     }
                 }
             }
         }
     }
     if ($returnContactId) {
         // CRM-7377
         // return contactID if contact already exists
         return $contactID;
     }
     if ($contactID) {
         $participant = new CRM_Event_BAO_Participant();
         $participant->contact_id = $contactID;
         $participant->event_id = $self->_values['event']['id'];
         if (!empty($fields['participant_role']) && is_numeric($fields['participant_role'])) {
             $participant->role_id = $fields['participant_role'];
         } else {
             $participant->role_id = $self->_values['event']['default_role_id'];
         }
         $participant->is_test = 0;
         $participant->find();
         $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
         while ($participant->fetch()) {
             if (array_key_exists($participant->status_id, $statusTypes)) {
                 if (!$isAdditional && !$self->_values['event']['allow_same_participant_emails']) {
                     $registerUrl = CRM_Utils_System::url('civicrm/event/register', "reset=1&id={$self->_values['event']['id']}&cid=0");
                     if ($self->_pcpId) {
                         $registerUrl .= '&pcpId=' . $self->_pcpId;
                     }
                     $status = ts("It looks like you are already registered for this event. If you want to change your registration, or you feel that you've gotten this message in error, please contact the site administrator.") . ' ' . ts('You can also <a href="%1">register another participant</a>.', array(1 => $registerUrl));
                     $session->setStatus($status, ts('Oops.'), 'alert');
                     $url = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$self->_values['event']['id']}&noFullMsg=true");
                     if ($self->_action & CRM_Core_Action::PREVIEW) {
                         $url .= '&action=preview';
                     }
                     if ($self->_pcpId) {
                         $url .= '&pcpId=' . $self->_pcpId;
                     }
                     CRM_Utils_System::redirect($url);
                 }
                 if ($isAdditional) {
                     $status = ts("It looks like this participant is already registered for this event. If you want to change your registration, or you feel that you've gotten this message in error, please contact the site administrator.");
                     $session->setStatus($status, ts('Oops.'), 'alert');
                     return $participant->id;
                 }
             }
         }
     }
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:95,代码来源:Register.php

示例5: checkRegistration

 /** 
  * Method to check if the user is already registered for the event   
  * and if result found redirect to the event info page
  *
  * @param array $fields  the input form values(anonymous user) 
  * @param array $self    event data 
  * 
  * @return void  
  * @access public 
  */
 function checkRegistration($fields, &$self, $isAdditional = false, $returnContactId = false)
 {
     // CRM-3907, skip check for preview registrations
     // CRM-4320 participant need to walk wizard
     if (!$returnContactId && ($self->_mode == 'test' || $self->_allowConfirmation)) {
         return false;
     }
     $contactID = null;
     $session = CRM_Core_Session::singleton();
     if (!$isAdditional) {
         $contactID = parent::getContactID();
     }
     if (!$contactID && is_array($fields) && !empty($fields)) {
         //CRM-6996
         //as we are allowing w/ same email address,
         //lets check w/ other contact params.
         if ($self->_values['event']['allow_same_participant_emails']) {
             $params = $fields;
             $level = $isAdditional ? 'Fuzzy' : 'Strict';
             require_once 'CRM/Dedupe/Finder.php';
             $dedupeParams = CRM_Dedupe_Finder::formatParams($params, 'Individual');
             // disable permission based on cache since event registration is public page/feature.
             $dedupeParams['check_permission'] = false;
             $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual', $level);
             $contactID = CRM_Utils_Array::value(0, $ids);
         } else {
             if (isset($fields["email-{$self->_bltID}"])) {
                 $emailString = trim($fields["email-{$self->_bltID}"]);
                 if (!empty($emailString)) {
                     $contactID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $emailString, 'contact_Id', 'email');
                 }
             }
         }
     }
     if ($returnContactId) {
         // CRM-7377
         // return contactID if contact already exists
         return $contactID;
     }
     if ($contactID) {
         require_once 'CRM/Event/BAO/Participant.php';
         $participant = new CRM_Event_BAO_Participant();
         $participant->contact_id = $contactID;
         $participant->event_id = $self->_values['event']['id'];
         $participant->role_id = $self->_values['event']['default_role_id'];
         $participant->is_test = 0;
         $participant->find();
         require_once 'CRM/Event/PseudoConstant.php';
         $statusTypes = CRM_Event_PseudoConstant::participantStatus(null, "is_counted = 1");
         while ($participant->fetch()) {
             if (array_key_exists($participant->status_id, $statusTypes)) {
                 if (!$isAdditional) {
                     $registerUrl = CRM_Utils_System::url('civicrm/event/register', "reset=1&id={$self->_values['event']['id']}&cid=0");
                     $status = ts("Oops. It looks like you are already registered for this event. If you want to change your registration, or you feel that you've gotten this message in error, please contact the site administrator.") . ' ' . ts('You can also <a href="%1">register another participant</a>.', array(1 => $registerUrl));
                     $session->setStatus($status);
                     $url = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$self->_values['event']['id']}&noFullMsg=true");
                     if ($self->_action & CRM_Core_Action::PREVIEW) {
                         $url .= '&action=preview';
                     }
                     CRM_Utils_System::redirect($url);
                 }
                 if ($isAdditional) {
                     $status = ts("Oops. It looks like this participant is already registered for this event. If you want to change your registration, or you feel that you've gotten this message in error, please contact the site administrator.");
                     $session->setStatus($status);
                     return $participant->id;
                 }
             }
         }
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:80,代码来源:Register.php


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