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


PHP CRM_Event_PseudoConstant::participantRole方法代码示例

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


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

示例1: browse

 /**
  * Browse all event templates.
  */
 public function browse()
 {
     //get all event templates.
     $allEventTemplates = array();
     $eventTemplate = new CRM_Event_DAO_Event();
     $eventTypes = CRM_Event_PseudoConstant::eventType();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $participantListings = CRM_Event_PseudoConstant::participantListing();
     //find all event templates.
     $eventTemplate->is_template = TRUE;
     $eventTemplate->find();
     while ($eventTemplate->fetch()) {
         CRM_Core_DAO::storeValues($eventTemplate, $allEventTemplates[$eventTemplate->id]);
         //get listing types.
         if ($eventTemplate->participant_listing_id) {
             $allEventTemplates[$eventTemplate->id]['participant_listing'] = $participantListings[$eventTemplate->participant_listing_id];
         }
         //get participant role
         if ($eventTemplate->default_role_id) {
             $allEventTemplates[$eventTemplate->id]['participant_role'] = $participantRoles[$eventTemplate->default_role_id];
         }
         //get event type.
         if (isset($eventTypes[$eventTemplate->event_type_id])) {
             $allEventTemplates[$eventTemplate->id]['event_type'] = $eventTypes[$eventTemplate->event_type_id];
         }
         //form all action links
         $action = array_sum(array_keys($this->links()));
         //add action links.
         $allEventTemplates[$eventTemplate->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $eventTemplate->id), ts('more'), FALSE, 'eventTemplate.manage.action', 'Event', $eventTemplate->id);
     }
     $this->assign('rows', $allEventTemplates);
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:37,代码来源:EventTemplate.php

示例2: __construct

 /**
  * Set up the fields.
  */
 public function __construct()
 {
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name_linked' => array('title' => ts('Participant Name'), 'dbAlias' => 'contact_civireport.sort_name'), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Sort Name'))), 'filters' => array('sort_name' => array('title' => ts('Participant Name'), 'operator' => 'like'), 'employer_id' => array('title' => ts('Employer Name')), 'contact_type' => array('title' => ts('Contact Type (Participant)')), 'contact_sub_type' => array('title' => ts('Contact Subtype (Participant)')))), 'organization' => array('name' => 'civicrm_contact', 'dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name' => array('title' => ts('Organization Name'), 'default' => TRUE)), 'order_bys' => array('org_sort_name' => array('name' => 'sort_name', 'title' => ts('Organization Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC')), 'group_bys' => array('org_id' => array('name' => 'id', 'title' => ts('Organization')))), 'civicrm_event' => array('dao' => 'CRM_Event_DAO_Event', 'grouping' => 'event-fields', 'filters' => array('eid' => array('name' => 'event_type_id', 'title' => ts('Event Type (Recent Period)'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type'), 'joinclause' => TRUE), 'event_start_date1' => array('title' => ts('Event Start Date (Recent Period)'), 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE, 'name' => 'event_start_date', 'default' => 'this.year', 'joinclause' => TRUE))), 'civicrm_participant' => array('dao' => 'CRM_Event_DAO_Participant', 'fields' => array('participant_id' => array('title' => 'Participant ID (Recent Period)'), 'participant_record' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'event_id' => array('default' => TRUE, 'title' => ts('Events Attended (Recent Period)'), 'statistics' => array('count_distinct' => ts('Events Attended (Recent Period)'))), 'unique_staff' => array('name' => 'contact_id', 'default' => TRUE, 'title' => ts('Unique Staff'), 'statistics' => array('count_distinct' => ts('Unique Staff (Recent Period)')))), 'grouping' => 'event-fields', 'filters' => array('event_id' => array('name' => 'event_id', 'title' => ts('Event (Recent Period)'), 'operatorType' => CRM_Report_Form::OP_ENTITYREF, 'type' => CRM_Utils_Type::T_INT, 'attributes' => array('entity' => 'event', 'select' => array('minimumInputLength' => 0)), 'joinclause' => TRUE), 'sid' => array('name' => 'status_id', 'title' => ts('Participant Status (Recent Period)'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'), 'joinclause' => TRUE), 'rid' => array('name' => 'role_id', 'title' => ts('Participant Role (Recent Period)'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole(), 'joinclause' => TRUE), 'participant_register_date' => array('title' => ts('Registration Date (Recent Period)'), 'operatorType' => CRM_Report_Form::OP_DATE, 'joinclause' => TRUE))), 'civicrm_event2' => array('name' => 'civicrm_event', 'dao' => 'CRM_Event_DAO_Event', 'grouping' => 'event-fields', 'filters' => array('eid2' => array('name' => 'event_type_id', 'title' => ts('Event Type (Prior Period)'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type'), 'joinclause' => TRUE), 'event_start_date2' => array('title' => ts('Event Start Date (Prior Period)'), 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE, 'name' => 'event_start_date', 'default' => 'previous.year', 'joinclause' => TRUE))), 'civicrm_participant2' => array('name' => 'civicrm_participant', 'dao' => 'CRM_Event_DAO_Participant', 'fields' => array('participant_id' => array('title' => 'Participant ID (Prior Period)'), 'participant_record2' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'event_id2' => array('name' => 'event_id', 'default' => TRUE, 'title' => ts('Events Attended (Prior Period)'), 'statistics' => array('count_distinct' => ts('Events Attended (Prior Period)'))), 'unique_staff2' => array('name' => 'contact_id', 'default' => TRUE, 'title' => ts('Unique Staff (Prior Period)'), 'statistics' => array('count_distinct' => ts('Unique Staff (Prior Period)')))), 'grouping' => 'event-fields', 'filters' => array('event_id2' => array('name' => 'event_id', 'title' => ts('Event (Prior Period)'), 'operatorType' => CRM_Report_Form::OP_ENTITYREF, 'type' => CRM_Utils_Type::T_INT, 'attributes' => array('entity' => 'event', 'select' => array('minimumInputLength' => 0)), 'joinclause' => TRUE), 'sid2' => array('name' => 'status_id', 'title' => ts('Participant Status (Prior Period)'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'), 'joinclause' => TRUE), 'rid' => array('name' => 'role_id', 'title' => ts('Participant Role (Prior Period)'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole(), 'joinclause' => TRUE), 'participant_register_date2' => array('name' => 'participant_register_date', 'title' => ts('Registration Date (Prior Period)'), 'operatorType' => CRM_Report_Form::OP_DATE, 'joinclause' => TRUE))));
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
     $this->_columns['civicrm_group']['filters']['gid']['title'] = ts('Group (Employer)');
     $this->_columns['civicrm_tag']['filters']['tagid']['title'] = ts('Tag (Employer)');
 }
开发者ID:aghstrategies,项目名称:com.aghstrategies.orgeventattendees,代码行数:12,代码来源:OrgSummary.php

示例3: preProcess

 /**  
  * Function to set variables up before form is built  
  *                                                            
  * @return void  
  * @access public  
  */
 public function preProcess()
 {
     require_once 'CRM/Event/BAO/Participant.php';
     $values = $ids = array();
     $params = array('id' => $this->get('id'));
     CRM_Event_BAO_Participant::getValues($params, $values, $ids);
     CRM_Event_BAO_Participant::resolveDefaults($values[$params['id']]);
     if (CRM_Utils_Array::value('fee_level', $values[$params['id']])) {
         CRM_Event_BAO_Participant::fixEventLevel($values[$params['id']]['fee_level']);
     }
     if ($values[$params['id']]['is_test']) {
         $values[$params['id']]['status'] .= ' (test) ';
     }
     // Get Note
     $noteValue = CRM_Core_BAO_Note::getNote($values[$params['id']]['id'], 'civicrm_participant');
     $values[$params['id']]['note'] = array_values($noteValue);
     require_once 'CRM/Price/BAO/LineItem.php';
     // Get Line Items
     $lineItem = CRM_Price_BAO_LineItem::getLineItems($params['id']);
     if (!CRM_Utils_System::isNull($lineItem)) {
         $values[$params['id']]['lineItem'][] = $lineItem;
     }
     $values[$params['id']]['totalAmount'] = $values[$params['id']]['fee_amount'];
     // get the option value for custom data type
     $roleCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantRole', 'name');
     $eventNameCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventName', 'name');
     $roleGroupTree =& CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $params['id'], null, $values[$params['id']]['role_id'], $roleCustomDataTypeID);
     $eventGroupTree =& CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $params['id'], null, $values[$params['id']]['event_id'], $eventNameCustomDataTypeID);
     $groupTree = CRM_Utils_Array::crmArrayMerge($roleGroupTree, $eventGroupTree);
     $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $params['id']));
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     $this->assign($values[$params['id']]);
     // add viewed participant to recent items list
     require_once 'CRM/Utils/Recent.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     $url = CRM_Utils_System::url('civicrm/contact/view/participant', "action=view&reset=1&id={$values[$params['id']]['id']}&cid={$values[$params['id']]['contact_id']}");
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $values[$params['id']]['event_id'], 'title');
     $title = CRM_Contact_BAO_Contact::displayName($values[$params['id']]['contact_id']) . ' (' . $participantRoles[$values[$params['id']]['role_id']] . ' - ' . $eventTitle . ')';
     // add the recently created Activity
     CRM_Utils_Recent::add($title, $url, $values[$params['id']]['id'], 'Participant', $values[$params['id']]['contact_id'], null);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:48,代码来源:ParticipantView.php

示例4: exportComponents


//.........这里部分代码省略.........
                                                 $hdr .= "-" . CRM_Utils_Array::value($type[1], $imProviders);
                                             }
                                         }
                                         $headerName = $field . '-' . $hdr;
                                         $headerRows[] = $headerName;
                                         self::sqlColumnDefn($query, $sqlColumns, $headerName);
                                     }
                                 }
                             }
                         }
                     } elseif ($selectedPaymentFields && array_key_exists($field, self::componentPaymentFields())) {
                         $headerRows[] = CRM_Utils_Array::value($field, self::componentPaymentFields());
                     } else {
                         $headerRows[] = $field;
                     }
                     if (!$sqlDone) {
                         self::sqlColumnDefn($query, $sqlColumns, $field);
                     }
                 }
                 // add im_provider to $dao object
                 if ($field == 'im_provider' && property_exists($iterationDAO, 'provider_id')) {
                     $iterationDAO->im_provider = $iterationDAO->provider_id;
                 }
                 //build row values (data)
                 $fieldValue = NULL;
                 if (property_exists($iterationDAO, $field)) {
                     $fieldValue = $iterationDAO->{$field};
                     // to get phone type from phone type id
                     if ($field == 'phone_type_id' && isset($phoneTypes[$fieldValue])) {
                         $fieldValue = $phoneTypes[$fieldValue];
                     } elseif ($field == 'provider_id' || $field == 'im_provider') {
                         $fieldValue = CRM_Utils_Array::value($fieldValue, $imProviders);
                     } elseif ($field == 'participant_role_id') {
                         $participantRoles = CRM_Event_PseudoConstant::participantRole();
                         $sep = CRM_Core_DAO::VALUE_SEPARATOR;
                         $viewRoles = array();
                         foreach (explode($sep, $iterationDAO->{$field}) as $k => $v) {
                             $viewRoles[] = $participantRoles[$v];
                         }
                         $fieldValue = implode(',', $viewRoles);
                     } elseif ($field == 'master_id') {
                         $masterAddressId = NULL;
                         if (isset($iterationDAO->master_id)) {
                             $masterAddressId = $iterationDAO->master_id;
                         }
                         // get display name of contact that address is shared.
                         $fieldValue = CRM_Contact_BAO_Contact::getMasterDisplayName($masterAddressId, $iterationDAO->contact_id);
                     }
                 }
                 if ($field == 'id') {
                     $row[$field] = $iterationDAO->contact_id;
                     // special case for calculated field
                 } elseif ($field == 'source_contact_id') {
                     $row[$field] = $iterationDAO->contact_id;
                 } elseif ($field == 'pledge_balance_amount') {
                     $row[$field] = $iterationDAO->pledge_amount - $iterationDAO->pledge_total_paid;
                     // special case for calculated field
                 } elseif ($field == 'pledge_next_pay_amount') {
                     $row[$field] = $iterationDAO->pledge_next_pay_amount + $iterationDAO->pledge_outstanding_amount;
                 } elseif (is_array($value) && $field == 'location') {
                     // fix header for location type case
                     foreach ($value as $ltype => $val) {
                         foreach (array_keys($val) as $fld) {
                             $type = explode('-', $fld);
                             $fldValue = "{$ltype}-" . $type[0];
                             // CRM-14076 - fix label to work as the query object expects
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:67,代码来源:Export.php

示例5: alterParticipantRole

 function alterParticipantRole($value)
 {
     if (empty($value)) {
         return;
     }
     $roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
     $value = array();
     foreach ($roles as $role) {
         $value[$role] = CRM_Event_PseudoConstant::participantRole($role, FALSE);
     }
     return implode(', ', $value);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:12,代码来源:Extended.php

示例6: get_attendee_role_id

 /**
  * @return mixed
  */
 public static function get_attendee_role_id()
 {
     $roles = CRM_Event_PseudoConstant::participantRole(NULL, "v.label='Attendee'");
     $role_names = array_keys($roles);
     return end($role_names);
 }
开发者ID:agloa,项目名称:tournament,代码行数:9,代码来源:MerParticipant.php

示例7: recipient

 function recipient()
 {
     $params = array('recipient');
     foreach ($params as $param) {
         ${$param} = CRM_Utils_Array::value($param, $_POST);
     }
     if (!$recipient) {
         CRM_Utils_JSON::output(array('error_msg' => 'required params missing.'));
     }
     switch ($recipient) {
         case 'Participant Status':
             $values = CRM_Event_PseudoConstant::participantStatus();
             break;
         case 'participant_role':
             $values = CRM_Event_PseudoConstant::participantRole();
             break;
         default:
             exit;
     }
     $elements = array();
     foreach ($values as $id => $name) {
         $elements[] = array('name' => $name, 'value' => $id);
     }
     CRM_Utils_JSON::output($elements);
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:25,代码来源:AJAX.php

示例8: array

 /**
  * Returns all the rows in the given offset and rowCount.
  *
  * @param string $action
  *   The action being performed.
  * @param int $offset
  *   The row number to start from.
  * @param int $rowCount
  *   The number of rows to return.
  * @param string $sort
  *   The sql string that describes the sort order.
  * @param string $output
  *   What should the result set include (web/email/csv).
  *
  * @return array
  *   rows in the given offset and rowCount
  */
 public function &getRows($action, $offset, $rowCount, $sort, $output = NULL)
 {
     $result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, FALSE, FALSE, FALSE, FALSE, $this->_eventClause);
     // process the result of the query
     $rows = array();
     //lets handle view, edit and delete separately. CRM-4418
     $permissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('edit event participants')) {
         $permissions[] = CRM_Core_Permission::EDIT;
     }
     if (CRM_Core_Permission::check('delete in CiviEvent')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     $statusTypes = CRM_Event_PseudoConstant::participantStatus();
     $statusClasses = CRM_Event_PseudoConstant::participantStatusClass();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $sep = CRM_Core_DAO::VALUE_SEPARATOR;
     //get all campaigns.
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
     while ($result->fetch()) {
         $row = array();
         // the columns we are interested in
         foreach (self::$_properties as $property) {
             if (isset($result->{$property})) {
                 $row[$property] = $result->{$property};
             }
         }
         //carry campaign on selectors.
         $row['campaign'] = CRM_Utils_Array::value($result->participant_campaign_id, $allCampaigns);
         $row['campaign_id'] = $result->participant_campaign_id;
         // gross hack to show extra information for pending status
         $statusClass = NULL;
         if (isset($row['participant_status_id']) && ($statusId = array_search($row['participant_status_id'], $statusTypes))) {
             $statusClass = $statusClasses[$statusId];
         }
         $row['showConfirmUrl'] = $statusClass == 'Pending' ? TRUE : FALSE;
         if (!empty($row['participant_is_test'])) {
             $row['participant_status'] .= ' (' . ts('test') . ')';
         }
         $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->participant_id;
         $links = self::links($this->_key, $this->_context, $this->_compContext);
         if ($statusTypes[$row['participant_status_id']] == 'Partially paid') {
             $links[CRM_Core_Action::ADD] = array('name' => ts('Record Payment'), 'url' => 'civicrm/payment', 'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event', 'title' => ts('Record Payment'));
         }
         if ($statusTypes[$row['participant_status_id']] == 'Pending refund') {
             $links[CRM_Core_Action::ADD] = array('name' => ts('Record Refund'), 'url' => 'civicrm/payment', 'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event', 'title' => ts('Record Refund'));
         }
         $row['action'] = CRM_Core_Action::formLink($links, $mask, array('id' => $result->participant_id, 'cid' => $result->contact_id, 'cxt' => $this->_context), ts('more'), FALSE, 'participant.selector.row', 'Participant', $result->participant_id);
         $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id);
         $row['paid'] = CRM_Event_BAO_Event::isMonetary($row['event_id']);
         if (!empty($row['participant_fee_level'])) {
             CRM_Event_BAO_Participant::fixEventLevel($row['participant_fee_level']);
         }
         if (CRM_Event_BAO_Event::usesPriceSet($row['event_id'])) {
             // add line item details if applicable
             $lineItems[$row['participant_id']] = CRM_Price_BAO_LineItem::getLineItems($row['participant_id']);
         }
         if (!empty($row['participant_role_id'])) {
             $viewRoles = array();
             foreach (explode($sep, $row['participant_role_id']) as $k => $v) {
                 $viewRoles[] = $participantRoles[$v];
             }
             $row['participant_role_id'] = implode(', ', $viewRoles);
         }
         $rows[] = $row;
     }
     CRM_Core_Selector_Controller::$_template->assign_by_ref('lineItems', $lineItems);
     return $rows;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:87,代码来源:Search.php

示例9: transitionParticipants

 /**
  * Function takes participant ids and statuses
  * update status from $fromStatusId to $toStatusId
  * and send mail + create activities.
  *
  * @param array $participantIds
  *   Participant ids.
  * @param int $toStatusId
  *   Update status id.
  * @param int $fromStatusId
  *   From status id.
  * @param bool $returnResult
  * @param bool $skipCascadeRule
  *
  * @return array|NULL
  */
 public static function transitionParticipants($participantIds, $toStatusId, $fromStatusId = NULL, $returnResult = FALSE, $skipCascadeRule = FALSE)
 {
     if (!is_array($participantIds) || empty($participantIds) || !$toStatusId) {
         return NULL;
     }
     //thumb rule is if we triggering  primary participant need to triggered additional
     $allParticipantIds = $primaryANDAdditonalIds = array();
     foreach ($participantIds as $id) {
         $allParticipantIds[] = $id;
         if (self::isPrimaryParticipant($id)) {
             //filter additional as per status transition rules, CRM-5403
             if ($skipCascadeRule) {
                 $additionalIds = self::getAdditionalParticipantIds($id);
             } else {
                 $additionalIds = self::getValidAdditionalIds($id, $fromStatusId, $toStatusId);
             }
             if (!empty($additionalIds)) {
                 $allParticipantIds = array_merge($allParticipantIds, $additionalIds);
                 $primaryANDAdditonalIds[$id] = $additionalIds;
             }
         }
     }
     //get the unique participant ids,
     $allParticipantIds = array_unique($allParticipantIds);
     //pull required participants, contacts, events  data, if not in hand
     static $eventDetails = array();
     static $domainValues = array();
     static $contactDetails = array();
     $contactIds = $eventIds = $participantDetails = array();
     $statusTypes = CRM_Event_PseudoConstant::participantStatus();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'");
     //first thing is pull all necessory data from db.
     $participantIdClause = '(' . implode(',', $allParticipantIds) . ')';
     //get all participants data.
     $query = "SELECT * FROM civicrm_participant WHERE id IN {$participantIdClause}";
     $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);
         if (!array_key_exists($dao->contact_id, $contactDetails)) {
             $contactIds[$dao->contact_id] = $dao->contact_id;
         }
         if (!array_key_exists($dao->event_id, $eventDetails)) {
             $eventIds[$dao->event_id] = $dao->event_id;
         }
     }
     //get the domain values.
     if (empty($domainValues)) {
         // making all tokens available to templates.
         $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);
         }
     }
     //get all required contacts detail.
     if (!empty($contactIds)) {
         // get the contact details.
         list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, array(), 'CRM_Event_BAO_Participant');
         foreach ($currentContactDetails as $contactId => $contactValues) {
             $contactDetails[$contactId] = $contactValues;
         }
     }
     //get all required events detail.
     if (!empty($eventIds)) {
         foreach ($eventIds as $eventId) {
             //retrieve event information
             $eventParams = array('id' => $eventId);
             CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$eventId]);
             //get default participant role.
             $eventDetails[$eventId]['participant_role'] = CRM_Utils_Array::value($eventDetails[$eventId]['default_role_id'], $participantRoles);
             //get the location info
             $locParams = array('entity_id' => $eventId, 'entity_table' => 'civicrm_event');
             $eventDetails[$eventId]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
         }
     }
     //now we are ready w/ all required data.
     //take a decision as per statuses.
     $emailType = NULL;
     $toStatus = $statusTypes[$toStatusId];
     $fromStatus = CRM_Utils_Array::value($fromStatusId, $statusTypes);
     switch ($toStatus) {
         case 'Pending from waitlist':
         case 'Pending from approval':
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:Participant.php

示例10: _assignMessageVariablesToTemplate

 /**
  * Apply variables for message to smarty template - this function is part of analysing what is in the huge
  * function & breaking it down into manageable chunks. Eventually it will be refactored into something else
  * Note we send directly from this function in some cases because it is only partly refactored
  * Don't call this function directly as the signature will change
  *
  * @param $values
  * @param $input
  * @param CRM_Core_SMARTY $template
  * @param bool $recur
  * @param bool $returnMessageText
  *
  * @return mixed
  */
 public function _assignMessageVariablesToTemplate(&$values, $input, &$template, $recur = FALSE, $returnMessageText = TRUE)
 {
     $template->assign('first_name', $this->_relatedObjects['contact']->first_name);
     $template->assign('last_name', $this->_relatedObjects['contact']->last_name);
     $template->assign('displayName', $this->_relatedObjects['contact']->display_name);
     if (!empty($values['lineItem']) && !empty($this->_relatedObjects['membership'])) {
         $template->assign('useForMember', TRUE);
     }
     //assign honor information to receipt message
     $softRecord = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id);
     if (isset($softRecord['soft_credit'])) {
         //if id of contribution page is present
         if (!empty($values['id'])) {
             $values['honor'] = array('honor_profile_values' => array(), 'honor_profile_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'uf_group_id', 'entity_id'), 'honor_id' => $softRecord['soft_credit'][1]['contact_id']);
             $softCreditTypes = CRM_Core_OptionGroup::values('soft_credit_type');
             $template->assign('soft_credit_type', $softRecord['soft_credit'][1]['soft_credit_type_label']);
             $template->assign('honor_block_is_active', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'is_active', 'entity_id'));
         } else {
             //offline contribution
             $softCreditTypes = $softCredits = array();
             foreach ($softRecord['soft_credit'] as $key => $softCredit) {
                 $softCreditTypes[$key] = $softCredit['soft_credit_type_label'];
                 $softCredits[$key] = array('Name' => $softCredit['contact_name'], 'Amount' => CRM_Utils_Money::format($softCredit['amount'], $softCredit['currency']));
             }
             $template->assign('softCreditTypes', $softCreditTypes);
             $template->assign('softCredits', $softCredits);
         }
     }
     $dao = new CRM_Contribute_DAO_ContributionProduct();
     $dao->contribution_id = $this->id;
     if ($dao->find(TRUE)) {
         $premiumId = $dao->product_id;
         $template->assign('option', $dao->product_option);
         $productDAO = new CRM_Contribute_DAO_Product();
         $productDAO->id = $premiumId;
         $productDAO->find(TRUE);
         $template->assign('selectPremium', TRUE);
         $template->assign('product_name', $productDAO->name);
         $template->assign('price', $productDAO->price);
         $template->assign('sku', $productDAO->sku);
     }
     $template->assign('title', CRM_Utils_Array::value('title', $values));
     $amount = CRM_Utils_Array::value('total_amount', $input, CRM_Utils_Array::value('amount', $input), NULL);
     if (empty($amount) && isset($this->total_amount)) {
         $amount = $this->total_amount;
     }
     $template->assign('amount', $amount);
     // add the new contribution values
     if (strtolower($this->_component) == 'contribute') {
         //PCP Info
         $softDAO = new CRM_Contribute_DAO_ContributionSoft();
         $softDAO->contribution_id = $this->id;
         if ($softDAO->find(TRUE)) {
             $template->assign('pcpBlock', TRUE);
             $template->assign('pcp_display_in_roll', $softDAO->pcp_display_in_roll);
             $template->assign('pcp_roll_nickname', $softDAO->pcp_roll_nickname);
             $template->assign('pcp_personal_note', $softDAO->pcp_personal_note);
             //assign the pcp page title for email subject
             $pcpDAO = new CRM_PCP_DAO_PCP();
             $pcpDAO->id = $softDAO->pcp_id;
             if ($pcpDAO->find(TRUE)) {
                 $template->assign('title', $pcpDAO->title);
             }
         }
     }
     if ($this->financial_type_id) {
         $values['financial_type_id'] = $this->financial_type_id;
     }
     $template->assign('trxn_id', $this->trxn_id);
     $template->assign('receive_date', CRM_Utils_Date::mysqlToIso($this->receive_date));
     $template->assign('contributeMode', 'notify');
     $template->assign('action', $this->is_test ? 1024 : 1);
     $template->assign('receipt_text', CRM_Utils_Array::value('receipt_text', $values));
     $template->assign('is_monetary', 1);
     $template->assign('is_recur', (bool) $recur);
     $template->assign('currency', $this->currency);
     $template->assign('address', CRM_Utils_Address::format($input));
     if (!empty($values['customGroup'])) {
         $template->assign('customGroup', $values['customGroup']);
     }
     if ($this->_component == 'event') {
         $template->assign('title', $values['event']['title']);
         $participantRoles = CRM_Event_PseudoConstant::participantRole();
         $viewRoles = array();
         foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->_relatedObjects['participant']->role_id) as $k => $v) {
             $viewRoles[] = $participantRoles[$v];
//.........这里部分代码省略.........
开发者ID:nganivet,项目名称:civicrm-core,代码行数:101,代码来源:Contribution.php

示例11: addActivity

 /**
  * Add activity for Membership/Event/Contribution.
  *
  * @param object $activity
  *   (reference) particular component object.
  * @param string $activityType
  *   For Membership Signup or Renewal.
  * @param int $targetContactID
  *
  * @return bool|NULL
  */
 public static function addActivity(&$activity, $activityType = 'Membership Signup', $targetContactID = NULL)
 {
     if ($activity->__table == 'civicrm_membership') {
         $membershipType = CRM_Member_PseudoConstant::membershipType($activity->membership_type_id);
         if (!$membershipType) {
             $membershipType = ts('Membership');
         }
         $subject = "{$membershipType}";
         if (!empty($activity->source) && $activity->source != 'null') {
             $subject .= " - {$activity->source}";
         }
         if ($activity->owner_membership_id) {
             $query = "\nSELECT  display_name\n  FROM  civicrm_contact, civicrm_membership\n WHERE  civicrm_contact.id    = civicrm_membership.contact_id\n   AND  civicrm_membership.id = {$activity->owner_membership_id}\n";
             $displayName = CRM_Core_DAO::singleValueQuery($query);
             $subject .= " (by {$displayName})";
         }
         $subject .= " - Status: " . CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $activity->status_id, 'label');
         // CRM-72097 changed from start date to today
         $date = date('YmdHis');
         $component = 'Membership';
     } elseif ($activity->__table == 'civicrm_participant') {
         $event = CRM_Event_BAO_Event::getEvents(1, $activity->event_id, TRUE, FALSE);
         $roles = CRM_Event_PseudoConstant::participantRole();
         $status = CRM_Event_PseudoConstant::participantStatus();
         $subject = $event[$activity->event_id];
         if (!empty($roles[$activity->role_id])) {
             $subject .= ' - ' . $roles[$activity->role_id];
         }
         if (!empty($status[$activity->status_id])) {
             $subject .= ' - ' . $status[$activity->status_id];
         }
         $date = date('YmdHis');
         if ($activityType != 'Email') {
             $activityType = 'Event Registration';
         }
         $component = 'Event';
     } elseif ($activity->__table == 'civicrm_contribution') {
         // create activity record only for Completed Contributions
         if ($activity->contribution_status_id != 1) {
             return NULL;
         }
         $subject = NULL;
         $subject .= CRM_Utils_Money::format($activity->total_amount, $activity->currency);
         if (!empty($activity->source) && $activity->source != 'null') {
             $subject .= " - {$activity->source}";
         }
         $date = CRM_Utils_Date::isoToMysql($activity->receive_date);
         $activityType = $component = 'Contribution';
     }
     $activityParams = array('source_contact_id' => $activity->contact_id, 'source_record_id' => $activity->id, 'activity_type_id' => CRM_Core_OptionGroup::getValue('activity_type', $activityType, 'name'), 'subject' => $subject, 'activity_date_time' => $date, 'is_test' => $activity->is_test, 'status_id' => CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name'), 'skipRecentView' => TRUE, 'campaign_id' => $activity->campaign_id);
     // create activity with target contacts
     $session = CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if ($id) {
         $activityParams['source_contact_id'] = $id;
         $activityParams['target_contact_id'][] = $activity->contact_id;
     }
     // CRM-14945
     if (property_exists($activity, 'details')) {
         $activityParams['details'] = $activity->details;
     }
     //CRM-4027
     if ($targetContactID) {
         $activityParams['target_contact_id'][] = $targetContactID;
     }
     if (is_a(self::create($activityParams), 'CRM_Core_Error')) {
         CRM_Core_Error::fatal("Failed creating Activity for {$component} of id {$activity->id}");
         return FALSE;
     }
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:81,代码来源:Activity.php

示例12: buildEventReport

 function buildEventReport($eventIDs)
 {
     $this->assign('events', $eventIDs);
     $eventID = implode(',', $eventIDs);
     $participantStatus = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1");
     $participantRole = CRM_Event_PseudoConstant::participantRole();
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
     $rows = $eventSummary = $roleRows = $statusRows = $instrumentRows = $count = array();
     $optionGroupDAO = new CRM_Core_DAO_OptionGroup();
     $optionGroupDAO->name = 'event_type';
     $optionGroupId = NULL;
     if ($optionGroupDAO->find(TRUE)) {
         $optionGroupId = $optionGroupDAO->id;
     }
     //show the income of active participant status (Counted = filter = 1)
     $activeParticipantStatusIDArray = $activeParticipantStatusLabelArray = array();
     foreach ($participantStatus as $id => $label) {
         $activeParticipantStatusIDArray[] = $id;
         $activeParticipantStatusLabelArray[] = $label;
     }
     $activeParticipantStatus = implode(',', $activeParticipantStatusIDArray);
     $activeparticipnatStutusLabel = implode(', ', $activeParticipantStatusLabelArray);
     $activeParticipantClause = " AND civicrm_participant.status_id IN ( {$activeParticipantStatus} ) ";
     $sql = "\n            SELECT  civicrm_event.id                    as event_id,\n                    civicrm_event.title                 as event_title,\n                    civicrm_event.max_participants      as max_participants, \n                    civicrm_event.start_date            as start_date,\n                    civicrm_event.end_date              as end_date, \n                    civicrm_option_value.label          as event_type, \n                    SUM(civicrm_participant.fee_amount) as total,\n                    COUNT(civicrm_participant.id)       as participant\n\n            FROM       civicrm_event\n            LEFT JOIN  civicrm_option_value \n                   ON  ( civicrm_event.event_type_id = civicrm_option_value.value AND\n                         civicrm_option_value.option_group_id = {$optionGroupId} )\n            LEFT JOIN  civicrm_participant ON ( civicrm_event.id = civicrm_participant.event_id \n                       {$activeParticipantClause} AND civicrm_participant.is_test  = 0 )\n\n            WHERE      civicrm_event.id IN( {$eventID}) \n                      \n            GROUP BY   civicrm_event.id\n            ";
     $eventDAO = CRM_Core_DAO::executeQuery($sql);
     while ($eventDAO->fetch()) {
         $eventSummary[$eventDAO->event_id]['Title'] = $eventDAO->event_title;
         $eventSummary[$eventDAO->event_id]['Max Participants'] = $eventDAO->max_participants;
         $eventSummary[$eventDAO->event_id]['Start Date'] = CRM_Utils_Date::customFormat($eventDAO->start_date);
         $eventSummary[$eventDAO->event_id]['End Date'] = CRM_Utils_Date::customFormat($eventDAO->end_date);
         $eventSummary[$eventDAO->event_id]['Event Type'] = $eventDAO->event_type;
         $eventSummary[$eventDAO->event_id]['Event Income'] = CRM_Utils_Money::format($eventDAO->total);
         $eventSummary[$eventDAO->event_id]['Registered Participant'] = "{$eventDAO->participant} ({$activeparticipnatStutusLabel})";
     }
     $this->assign_by_ref('summary', $eventSummary);
     //Total Participant Registerd for the Event
     $pariticipantCount = "\n            SELECT COUNT(civicrm_participant.id ) as count, civicrm_participant.event_id as event_id\n\n            FROM     civicrm_participant\n\n            WHERE    civicrm_participant.event_id IN( {$eventID}) AND \n                     civicrm_participant.is_test  = 0 \n                     {$activeParticipantClause}\n            GROUP BY civicrm_participant.event_id\n             ";
     $counteDAO = CRM_Core_DAO::executeQuery($pariticipantCount);
     while ($counteDAO->fetch()) {
         $count[$counteDAO->event_id] = $counteDAO->count;
     }
     //Count the Participant by Role ID for Event
     $role = "\n            SELECT civicrm_participant.role_id         as ROLEID, \n                   COUNT( civicrm_participant.id )     as participant, \n                   SUM(civicrm_participant.fee_amount) as amount,\n                   civicrm_participant.event_id        as event_id\n\n            FROM     civicrm_participant\n\n            WHERE    civicrm_participant.event_id IN ( {$eventID}) AND\n                     civicrm_participant.is_test  = 0 \n                     {$activeParticipantClause}\n            GROUP BY civicrm_participant.role_id, civicrm_participant.event_id\n            ";
     $roleDAO = CRM_Core_DAO::executeQuery($role);
     while ($roleDAO->fetch()) {
         // fix for multiple role, CRM-6507
         $roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $roleDAO->ROLEID);
         foreach ($roles as $roleId) {
             if (!isset($roleRows[$roleDAO->event_id][$participantRole[$roleId]])) {
                 $roleRows[$roleDAO->event_id][$participantRole[$roleId]]['total'] = 0;
                 $roleRows[$roleDAO->event_id][$participantRole[$roleId]]['round'] = 0;
                 $roleRows[$roleDAO->event_id][$participantRole[$roleId]]['amount'] = 0;
             }
             $roleRows[$roleDAO->event_id][$participantRole[$roleId]]['total'] += $roleDAO->participant;
             $roleRows[$roleDAO->event_id][$participantRole[$roleId]]['amount'] += $roleDAO->amount;
         }
     }
     foreach ($roleRows as $eventId => $roleInfo) {
         foreach ($participantRole as $roleName) {
             if (isset($roleInfo[$roleName])) {
                 $roleRows[$eventId][$roleName]['round'] = round($roleRows[$eventId][$roleName]['total'] / $count[$eventId] * 100, 2);
             }
         }
     }
     $rows['Role'] = $roleRows;
     //Count the Participant by status ID for Event
     $status = "\n            SELECT civicrm_participant.status_id       as STATUSID, \n                   COUNT( civicrm_participant.id )     as participant, \n                   SUM(civicrm_participant.fee_amount) as amount,\n                   civicrm_participant.event_id        as event_id\n\n            FROM     civicrm_participant\n\n            WHERE    civicrm_participant.event_id IN ({$eventID}) AND\n                     civicrm_participant.is_test  = 0 \n                     {$activeParticipantClause}\n            GROUP BY civicrm_participant.status_id, civicrm_participant.event_id\n            ";
     $statusDAO = CRM_Core_DAO::executeQuery($status);
     while ($statusDAO->fetch()) {
         $statusRows[$statusDAO->event_id][$participantStatus[$statusDAO->STATUSID]]['total'] = $statusDAO->participant;
         $statusRows[$statusDAO->event_id][$participantStatus[$statusDAO->STATUSID]]['round'] = round($statusDAO->participant / $count[$statusDAO->event_id] * 100, 2);
         $statusRows[$statusDAO->event_id][$participantStatus[$statusDAO->STATUSID]]['amount'] = $statusDAO->amount;
     }
     $rows['Status'] = $statusRows;
     //Count the Participant by payment instrument ID for Event
     //e.g. Credit Card, Check,Cash etc
     $paymentInstrument = "\n            SELECT c.payment_instrument_id               as INSTRUMENT, \n                   COUNT( c.id )                         as participant, \n                   SUM(civicrm_participant.fee_amount)   as amount,\n                   civicrm_participant.event_id          as event_id\n\n            FROM      civicrm_participant\n            LEFT JOIN civicrm_participant_payment pp ON(pp.participant_id = civicrm_participant.id )\n            LEFT JOIN civicrm_contribution c ON ( pp.contribution_id = c.id)\n\n            WHERE     civicrm_participant.event_id IN ( {$eventID}) AND\n                      civicrm_participant.is_test  = 0\n                      {$activeParticipantClause}\n            GROUP BY  c.payment_instrument_id, civicrm_participant.event_id\n            ";
     $instrumentDAO = CRM_Core_DAO::executeQuery($paymentInstrument);
     while ($instrumentDAO->fetch()) {
         //allow only if instrument is present in contribution table
         if ($instrumentDAO->INSTRUMENT) {
             $instrumentRows[$instrumentDAO->event_id][$paymentInstruments[$instrumentDAO->INSTRUMENT]]['total'] = $instrumentDAO->participant;
             $instrumentRows[$instrumentDAO->event_id][$paymentInstruments[$instrumentDAO->INSTRUMENT]]['round'] = round($instrumentDAO->participant / $count[$instrumentDAO->event_id] * 100, 2);
             $instrumentRows[$instrumentDAO->event_id][$paymentInstruments[$instrumentDAO->INSTRUMENT]]['amount'] = $instrumentDAO->amount;
         }
     }
     $rows['Payment Method'] = $instrumentRows;
     $this->assign_by_ref('rows', $rows);
     if (!$this->_setVariable) {
         $this->_params['id_value'] = NULL;
     }
     $this->assign('statistics', $this->statistics($eventIDs));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:93,代码来源:Income.php

示例13: displayProfile


//.........这里部分代码省略.........
                                             if (is_array($pref)) {
                                                 foreach ($pref as $k => $v) {
                                                     if ($v) {
                                                         $compref[] = $communicationFields[$k];
                                                     }
                                                 }
                                             }
                                             $values[$index] = implode(",", $compref);
                                         } else {
                                             if ($name == 'group') {
                                                 require_once 'CRM/Contact/BAO/GroupContact.php';
                                                 $groups = CRM_Contact_BAO_GroupContact::getGroupList();
                                                 $title = array();
                                                 foreach ($params[$name] as $gId => $dontCare) {
                                                     if ($dontCare) {
                                                         $title[] = $groups[$gId];
                                                     }
                                                 }
                                                 $values[$index] = implode(', ', $title);
                                             } else {
                                                 if ($name == 'tag') {
                                                     require_once 'CRM/Core/BAO/EntityTag.php';
                                                     $entityTags = $params[$name];
                                                     $allTags =& CRM_Core_PseudoConstant::tag();
                                                     $title = array();
                                                     if (is_array($entityTags)) {
                                                         foreach ($entityTags as $tagId => $dontCare) {
                                                             $title[] = $allTags[$tagId];
                                                         }
                                                     }
                                                     $values[$index] = implode(', ', $title);
                                                 } else {
                                                     if ('participant_role_id' == $name) {
                                                         $roles = CRM_Event_PseudoConstant::participantRole();
                                                         $values[$index] = $roles[$params[$name]];
                                                     } else {
                                                         if ('participant_status_id' == $name) {
                                                             $status = CRM_Event_PseudoConstant::participantStatus();
                                                             $values[$index] = $status[$params[$name]];
                                                         } else {
                                                             if (strpos($name, '-') !== false) {
                                                                 list($fieldName, $id) = CRM_Utils_System::explode('-', $name, 2);
                                                                 $detailName = str_replace(' ', '_', $name);
                                                                 if (in_array($fieldName, array('state_province', 'country', 'county'))) {
                                                                     $values[$index] = $params[$detailName];
                                                                     $idx = $detailName . '_id';
                                                                     $values[$index] = $params[$idx];
                                                                 } else {
                                                                     if ($fieldName == 'im') {
                                                                         $providerName = null;
                                                                         if ($providerId = $detailName . '-provider_id') {
                                                                             $providerName = CRM_Utils_Array::value($params[$providerId], $imProviders);
                                                                         }
                                                                         if ($providerName) {
                                                                             $values[$index] = $params[$detailName] . " (" . $providerName . ")";
                                                                         } else {
                                                                             $values[$index] = $params[$detailName];
                                                                         }
                                                                     } else {
                                                                         $values[$index] = $params[$detailName];
                                                                     }
                                                                 }
                                                             } else {
                                                                 if (substr($name, 0, 7) === 'do_not_' or substr($name, 0, 3) === 'is_') {
                                                                     if ($params[$name]) {
                                                                         $values[$index] = '[ x ]';
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:67,代码来源:Event.php

示例14: updateParticipantStatus

 public function updateParticipantStatus()
 {
     require_once 'CRM/Event/PseudoConstant.php';
     $participantRole = CRM_Event_PseudoConstant::participantRole();
     $pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'");
     $expiredStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'");
     $waitingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Waiting'");
     //build the required status ids.
     $statusIds = '(' . implode(',', array_merge(array_keys($pendingStatuses), array_keys($waitingStatuses))) . ')';
     $participantDetails = $fullEvents = array();
     $expiredParticipantCount = $waitingConfirmCount = $waitingApprovalCount = 0;
     //get all participant who's status in class pending and waiting
     $query = "SELECT * FROM civicrm_participant WHERE status_id IN {$statusIds} ORDER BY register_date";
     $query = "\n   SELECT  participant.id,\n           participant.contact_id,\n           participant.status_id,\n           participant.register_date,\n           participant.registered_by_id,\n           participant.event_id,\n           event.title as eventTitle,\n           event.registration_start_date,\n           event.registration_end_date,\n           event.end_date,\n           event.expiration_time,\n           event.requires_approval\n     FROM  civicrm_participant participant\nLEFT JOIN  civicrm_event event ON ( event.id = participant.event_id )\n    WHERE  participant.status_id IN {$statusIds}\n     AND   (event.end_date > now() OR event.end_date IS NULL)\n     AND   event.is_active = 1 \n ORDER BY  participant.register_date, participant.id \n";
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
         $participantDetails[$dao->id] = array('id' => $dao->id, 'event_id' => $dao->event_id, 'status_id' => $dao->status_id, 'contact_id' => $dao->contact_id, 'register_date' => $dao->register_date, 'registered_by_id' => $dao->registered_by_id, 'eventTitle' => $dao->eventTitle, 'registration_start_date' => $dao->registration_start_date, 'registration_end_date' => $dao->registration_end_date, 'end_date' => $dao->end_date, 'expiration_time' => $dao->expiration_time, 'requires_approval' => $dao->requires_approval);
     }
     if (!empty($participantDetails)) {
         //cron 1. move participant from pending to expire if needed
         foreach ($participantDetails as $participantId => $values) {
             //process the additional participant at the time of
             //primary participant, don't process separately.
             if (CRM_Utils_Array::value('registered_by_id', $values)) {
                 continue;
             }
             $expirationTime = CRM_Utils_Array::value('expiration_time', $values);
             if ($expirationTime && array_key_exists($values['status_id'], $pendingStatuses)) {
                 //get the expiration and registration pending time.
                 $expirationSeconds = $expirationTime * 3600;
                 $registrationPendingSeconds = CRM_Utils_Date::unixTime($values['register_date']);
                 // expired registration since registration cross allow confirmation time.
                 if ($expirationSeconds + $registrationPendingSeconds < time()) {
                     //lets get the transaction mechanism.
                     require_once 'CRM/Core/Transaction.php';
                     $transaction = new CRM_Core_Transaction();
                     require_once 'CRM/Event/BAO/Participant.php';
                     $ids = array($participantId);
                     $expiredId = array_search('Expired', $expiredStatuses);
                     $results = CRM_Event_BAO_Participant::transitionParticipants($ids, $expiredId, $values['status_id'], TRUE, TRUE);
                     $transaction->commit();
                     if (!empty($results)) {
                         //diaplay updated participants
                         if (is_array($results['updatedParticipantIds']) && !empty($results['updatedParticipantIds'])) {
                             foreach ($results['updatedParticipantIds'] as $processedId) {
                                 $expiredParticipantCount += 1;
                                 echo "<br /><br />- status updated to: Expired";
                                 //mailed participants.
                                 if (is_array($results['mailedParticipants']) && array_key_exists($processedId, $results['mailedParticipants'])) {
                                     echo "<br />Expiration Mail sent to: {$results['mailedParticipants'][$processedId]}";
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //cron 1 end.
         //cron 2. lets move participants from waiting list to pending status
         foreach ($participantDetails as $participantId => $values) {
             //process the additional participant at the time of
             //primary participant, don't process separately.
             if (CRM_Utils_Array::value('registered_by_id', $values)) {
                 continue;
             }
             if (array_key_exists($values['status_id'], $waitingStatuses) && !array_key_exists($values['event_id'], $fullEvents)) {
                 if ($waitingStatuses[$values['status_id']] == 'On waitlist' && CRM_Event_BAO_Event::validRegistrationDate($values)) {
                     //check the target event having space.
                     require_once 'CRM/Event/BAO/Participant.php';
                     $eventOpenSpaces = CRM_Event_BAO_Participant::eventFull($values['event_id'], TRUE, FALSE);
                     if ($eventOpenSpaces && is_numeric($eventOpenSpaces) || $eventOpenSpaces === NULL) {
                         //get the additional participant if any.
                         $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
                         $allIds = array($participantId);
                         if (!empty($additionalIds)) {
                             $allIds = array_merge($allIds, $additionalIds);
                         }
                         $pClause = ' participant.id IN ( ' . implode(' , ', $allIds) . ' )';
                         $requiredSpaces = CRM_Event_BAO_Event::eventTotalSeats($values['event_id'], $pClause);
                         //need to check as to see if event has enough speces
                         if ($requiredSpaces <= $eventOpenSpaces || $eventOpenSpaces === NULL) {
                             require_once 'CRM/Core/Transaction.php';
                             $transaction = new CRM_Core_Transaction();
                             require_once 'CRM/Event/BAO/Participant.php';
                             $ids = array($participantId);
                             $updateStatusId = array_search('Pending from waitlist', $pendingStatuses);
                             //lets take a call to make pending or need approval
                             if ($values['requires_approval']) {
                                 $updateStatusId = array_search('Awaiting approval', $waitingStatuses);
                             }
                             $results = CRM_Event_BAO_Participant::transitionParticipants($ids, $updateStatusId, $values['status_id'], TRUE, TRUE);
                             //commit the transaction.
                             $transaction->commit();
                             if (!empty($results)) {
                                 //diaplay updated participants
                                 if (is_array($results['updatedParticipantIds']) && !empty($results['updatedParticipantIds'])) {
                                     foreach ($results['updatedParticipantIds'] as $processedId) {
                                         if ($values['requires_approval']) {
                                             $waitingApprovalCount += 1;
                                             echo "<br /><br />- status updated to: Awaiting approval";
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:ParticipantProcessor.php

示例15: postProcess


//.........这里部分代码省略.........
     }
     // also store lineitem stuff here
     if ($this->_lineItem) {
         require_once 'CRM/Price/BAO/LineItem.php';
         foreach ($this->_contactIds as $num => $contactID) {
             foreach ($this->_lineItem as $key => $value) {
                 if (is_array($value) && $value != 'skip') {
                     foreach ($value as $line) {
                         $line['entity_table'] = 'civicrm_participant';
                         $line['entity_id'] = $participants[$num]->id;
                         CRM_Price_BAO_LineItem::create($line);
                     }
                 }
             }
         }
     }
     $updateStatusMsg = null;
     //send mail when participant status changed, CRM-4326
     if ($this->_participantId && $this->_statusId && $this->_statusId != CRM_Utils_Array::value('status_id', $params) && CRM_Utils_Array::value('is_notify', $params)) {
         require_once "CRM/Event/BAO/Participant.php";
         $updateStatusMsg = CRM_Event_BAO_Participant::updateStatusMessage($this->_participantId, $params['status_id'], $this->_statusId);
     }
     if (CRM_Utils_Array::value('send_receipt', $params)) {
         $receiptFrom = "{$userName} <{$userEmail}>";
         $this->assign('module', 'Event Registration');
         //use of the message template below requires variables in different format
         $event = $events = array();
         $returnProperties = array('fee_label', 'start_date', 'end_date', 'is_show_location', 'title');
         //get all event details.
         CRM_Core_DAO::commonRetrieveAll('CRM_Event_DAO_Event', 'id', $params['event_id'], $events, $returnProperties);
         $event = $events[$params['event_id']];
         unset($event['start_date']);
         unset($event['end_date']);
         $role = CRM_Event_PseudoConstant::participantRole();
         $event['participant_role'] = $role[$params['role_id']];
         $event['is_monetary'] = $this->_isPaidEvent;
         if ($params['receipt_text']) {
             $event['confirm_email_text'] = $params['receipt_text'];
         }
         $this->assign('isAmountzero', 1);
         $this->assign('event', $event);
         $this->assign('isShowLocation', $event['is_show_location']);
         if (CRM_Utils_Array::value('is_show_location', $event) == 1) {
             $locationParams = array('entity_id' => $params['event_id'], 'entity_table' => 'civicrm_event');
             require_once 'CRM/Core/BAO/Location.php';
             $location = CRM_Core_BAO_Location::getValues($locationParams, true);
             $this->assign('location', $location);
         }
         $status = CRM_Event_PseudoConstant::participantStatus();
         if ($this->_isPaidEvent) {
             $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
             if (!$this->_mode) {
                 $this->assign('paidBy', CRM_Utils_Array::value($params['payment_instrument_id'], $paymentInstrument));
             }
             $this->assign('totalAmount', $contributionParams['total_amount']);
             $this->assign('isPrimary', 1);
             $this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
         }
         if ($this->_mode) {
             if (CRM_Utils_Array::value('billing_first_name', $params)) {
                 $name = $params['billing_first_name'];
             }
             if (CRM_Utils_Array::value('billing_middle_name', $params)) {
                 $name .= " {$params['billing_middle_name']}";
             }
             if (CRM_Utils_Array::value('billing_last_name', $params)) {
开发者ID:ksecor,项目名称:civicrm,代码行数:67,代码来源:Participant.php


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