本文整理汇总了PHP中CRM_Event_PseudoConstant::participantStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_PseudoConstant::participantStatus方法的具体用法?PHP CRM_Event_PseudoConstant::participantStatus怎么用?PHP CRM_Event_PseudoConstant::participantStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Event_PseudoConstant::participantStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$this->addElement('text', 'api_key', ts('API Key'), array('size' => 48));
$status = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
foreach ($status as $id => $Name) {
$this->addElement('checkbox', "participant_status_id[{$id}]", NULL, $Name);
}
$accessToken = CRM_Core_BAO_Setting::getItem(self::WEBINAR_SETTING_GROUP, 'access_token', NULL, FALSE);
$organizerKey = CRM_Core_BAO_Setting::getItem(self::WEBINAR_SETTING_GROUP, 'organizer_key', NULL, FALSE);
if ($accessToken && $organizerKey) {
$upcomingWebinars = CRM_Gotowebinar_Form_Setting::findUpcomingWebinars();
if (isset($upcomingWebinars['int_err_code']) and $upcomingWebinars['int_err_code'] != '') {
$this->assign('error', $upcomingWebinars);
} else {
$this->assign('responseKey', TRUE);
$this->assign('upcomingWebinars', $upcomingWebinars);
$buttons = array(array('type' => 'submit', 'name' => ts('Save Status')));
$this->addButtons($buttons);
}
} else {
$this->add('text', "email_address", ts('Email Address'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', 'email'), TRUE);
$this->add('text', "password", ts('Password'), array('size' => 48), TRUE);
$buttons = array(array('type' => 'submit', 'name' => ts('Connect To My GoToWebinar')));
// Add the Buttons.
$this->addButtons($buttons);
$this->assign('initial', TRUE);
}
}
示例2: run
/**
* Basic page run function.
*/
public function run()
{
// Get link options for managing events.
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
$tabs = CRM_Event_Page_ManageEvent::tabs($enableCart);
foreach ($tabs as $tab => $tabInfo) {
$tabs[$tab]['name'] = $tabInfo['title'];
$tabs[$tab]['qs'] = $tab == 'reminder' ? 'reset=1&action=browse&setTab=1&id=%%id%%' : 'reset=1&action=update&id=%%id%%';
}
// Get link options for participant listings.
$statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0');
$participantLinks = array();
if (1 || !empty($statusTypes)) {
$participantLinks[2] = array('name' => implode(', ', array_values($statusTypes)), 'url' => 'civicrm/event/search', 'qs' => 'reset=1&force=1&status=true&event=%%id%%', 'title' => ts('Counted', array('domain' => 'com.aghstrategies.eventpermissions')));
}
if (!empty($statusTypesPending)) {
$participantLinks[3] = array('name' => implode(', ', array_values($statusTypesPending)), 'url' => 'civicrm/event/search', 'qs' => 'reset=1&force=1&status=false&event=%%id%%', 'title' => ts('Not Counted', array('domain' => 'com.aghstrategies.eventpermissions')));
}
$participantLinks[4] = array('name' => ts('Public Participant Listing', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/participant', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Public Participant Listing', array('domain' => 'com.aghstrategies.eventpermissions')));
// Get link options for event links.
$eventLinks = array(array('name' => ts('Register Participant', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/participant/add', 'qs' => 'reset=1&action=add&context=standalone&eid=%%id%%', 'title' => ts('Register Participant', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Event Info', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/info', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Event Info', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Online Registration (Test-drive)', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/register', 'qs' => 'reset=1&action=preview&id=%%id%%', 'title' => ts('Online Registration (Test-drive)', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Online Registration (Live)', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/register', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Online Registration (Live)', array('domain' => 'com.aghstrategies.eventpermissions'))));
$utils = new CRM_Eventpermissions_Utils();
$events = array();
foreach ($utils->myUpcomingEvents() as $id => $event) {
$events[] = array('title' => CRM_Utils_System::href($event['title'], 'civicrm/event/info', "id={$id}&reset=1"), 'links' => CRM_Core_Action::formLink($tabs, NULL, array('id' => $id), ts('Configure', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.configure', 'Event', $id), 'participantLinks' => CRM_Core_Action::formLink($participantLinks, $event['participant_listing_id'] ? 6 : 3, array('id' => $id), ts('Participants', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.participants', 'Event', $id), 'eventLinks' => CRM_Core_Action::formLink($eventLinks, NULL, array('id' => $id), ts('Event Links', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.links', 'Event', $id));
}
$this->assign('events', $events);
parent::run();
}
示例3: __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)');
}
示例4: registerParticipant
/**
* @param array $params
* @param $participant
* @param $event
*
* @return mixed
*/
public function registerParticipant($params, &$participant, $event)
{
$transaction = new CRM_Core_Transaction();
// handle register date CRM-4320
$registerDate = date('YmdHis');
$participantParams = array('id' => $participant->id, 'event_id' => $event->id, 'register_date' => $registerDate, 'source' => CRM_Utils_Array::value('participant_source', $params, $this->description), 'is_pay_later' => $this->is_pay_later, 'fee_amount' => CRM_Utils_Array::value('amount', $params, 0), 'fee_currency' => CRM_Utils_Array::value('currencyID', $params));
if ($participant->must_wait) {
$participant_status = 'On waitlist';
} elseif (CRM_Utils_Array::value('is_pay_later', $params, FALSE)) {
$participant_status = 'Pending from pay later';
} else {
$participant_status = 'Registered';
}
$participant_statuses = CRM_Event_PseudoConstant::participantStatus();
$participantParams['status_id'] = array_search($participant_status, $participant_statuses);
$participant_status_label = CRM_Utils_Array::value($participantParams['status_id'], CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'));
$participantParams['participant_status'] = $participant_status_label;
$this->assign('isOnWaitlist', $participant->must_wait);
if ($this->_action & CRM_Core_Action::PREVIEW || CRM_Utils_Array::value('mode', $params) == 'test') {
$participantParams['is_test'] = 1;
} else {
$participantParams['is_test'] = 0;
}
if (self::is_administrator()) {
if (!empty($params['note'])) {
$note_params = array('participant_id' => $participant->id, 'contact_id' => self::getContactID(), 'note' => $params['note']);
CRM_Event_BAO_Participant::update_note($note_params);
}
}
$participant->copyValues($participantParams);
$participant->save();
if (!empty($params['contributionID'])) {
$payment_params = array('participant_id' => $participant->id, 'contribution_id' => $params['contributionID']);
$ids = array();
$paymentParticpant = CRM_Event_BAO_ParticipantPayment::create($payment_params, $ids);
}
$transaction->commit();
$event_values = array();
CRM_Core_DAO::storeValues($event, $event_values);
$location = array();
if (CRM_Utils_Array::value('is_show_location', $event_values) == 1) {
$locationParams = array('entity_id' => $participant->event_id, 'entity_table' => 'civicrm_event');
$location = CRM_Core_BAO_Location::getValues($locationParams, TRUE);
CRM_Core_BAO_Address::fixAddress($location['address'][1]);
}
list($pre_id, $post_id) = CRM_Event_Cart_Form_MerParticipant::get_profile_groups($participant->event_id);
$payer_values = array('email' => '', 'name' => '');
if ($this->payer_contact_id) {
$payer_contact_details = CRM_Contact_BAO_Contact::getContactDetails($this->payer_contact_id);
$payer_values = array('email' => $payer_contact_details[1], 'name' => $payer_contact_details[0]);
}
$values = array('params' => array($participant->id => $participantParams), 'event' => $event_values, 'location' => $location, 'custom_pre_id' => $pre_id, 'custom_post_id' => $post_id, 'payer' => $payer_values);
CRM_Event_BAO_Event::sendMail($participant->contact_id, $values, $participant->id);
return $participant;
}
示例5: buildQuickForm
public function buildQuickForm()
{
// CRM_Event_Form_Task_Batch::buildQuickForm() gets ufGroupId
// from the form, so set it here to the id of the reserved profile
$dao = new CRM_Core_DAO_UFGroup();
$dao->name = 'participant_status';
$dao->find(TRUE);
$this->set('ufGroupId', $dao->id);
$statuses = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
asort($statuses, SORT_STRING);
$this->add('select', 'status_change', ts('Change All Statuses'), array('' => ts('- select status -')) + $statuses);
$this->assign('context', 'statusChange');
# CRM-4321: display info on users being notified if any of the below statuses is enabled
parent::assignToTemplate();
parent::buildQuickForm();
}
示例6: run
function run()
{
$this->preProcess();
$fromClause = "\nFROM civicrm_contact\nINNER JOIN civicrm_participant ON civicrm_contact.id = civicrm_participant.contact_id \nINNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id\n";
$whereClause = "\nWHERE civicrm_event.id = %1";
$params = array(1 => array($this->_id, 'Integer'));
$this->pager($fromClause, $whereClause, $params);
$orderBy = $this->orderBy();
list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
$query = "\nSELECT civicrm_contact.id as contact_id ,\n civicrm_contact.display_name as name ,\n civicrm_contact.sort_name as sort_name ,\n civicrm_participant.id as participant_id,\n civicrm_participant.status_id as status_id ,\n civicrm_participant.register_date as register_date\n {$fromClause}\n {$whereClause}\nORDER BY {$orderBy}\nLIMIT {$offset}, {$rowCount}";
$rows = array();
$object = CRM_Core_DAO::executeQuery($query, $params);
$statusLookup = CRM_Event_PseudoConstant::participantStatus();
while ($object->fetch()) {
$row = array('id' => $object->contact_id, 'participantID' => $object->participant_id, 'name' => $object->name, 'email' => $object->email, 'status' => CRM_Utils_Array::value($object->status_id, $statusLookup), 'date' => $object->register_date);
$rows[] = $row;
}
$this->assign_by_ref('rows', $rows);
return parent::run();
}
示例7: buildQuickForm
function buildQuickForm()
{
// CRM_Event_Form_Task_Batch::buildQuickForm() gets ufGroupId
// from the form, so set it here to the id of the reserved profile
require_once 'CRM/Core/DAO/UFGroup.php';
$dao = new CRM_Core_DAO_UFGroup();
$dao->name = 'participant_status';
$dao->find(true);
$this->set('ufGroupId', $dao->id);
require_once 'CRM/Event/PseudoConstant.php';
$statuses =& CRM_Event_PseudoConstant::participantStatus();
asort($statuses, SORT_STRING);
$this->add('select', 'status_change', ts('Change All Statuses'), array('' => ts('- select status -')) + $statuses, null, array('onchange' => "if (this.value) setStatusesTo(this.value);"));
$this->assign('context', 'statusChange');
# CRM-4321: display info on users being notified if any of the below statuses is enabled
require_once 'CRM/Event/PseudoConstant.php';
$notifyingStatuses = array(ts('Pending from waitlist'), ts('Pending from approval'), ts('Expired'), ts('Cancelled'));
$notifyingStatuses = array_intersect($notifyingStatuses, CRM_Event_PseudoConstant::participantStatus());
$this->assign('notifyingStatuses', implode(', ', $notifyingStatuses));
parent::buildQuickForm();
}
示例8: get_pending_in_cart_status_id
/**
* @return mixed
*/
public static function get_pending_in_cart_status_id()
{
$status_types = CRM_Event_PseudoConstant::participantStatus(NULL, "name='Pending in cart'");
$status_names = array_keys($status_types);
return end($status_names);
}
示例9: getValidAdditionalIds
/**
* Get additional participant Ids for cascading with primary participant status.
*
* @param int $participantId
* Participant id.
* @param int $oldStatusId
* Previous status.
* @param int $newStatusId
* New status.
*
* @return bool
* true if allowed
*/
public static function getValidAdditionalIds($participantId, $oldStatusId, $newStatusId)
{
$additionalParticipantIds = array();
static $participantStatuses = array();
if (empty($participantStatuses)) {
$participantStatuses = CRM_Event_PseudoConstant::participantStatus();
}
if (CRM_Utils_Array::value($participantStatuses[$oldStatusId], self::$_statusTransitionsRules) && in_array($participantStatuses[$newStatusId], self::$_statusTransitionsRules[$participantStatuses[$oldStatusId]])) {
$additionalParticipantIds = self::getAdditionalParticipantIds($participantId, TRUE, $oldStatusId);
}
return $additionalParticipantIds;
}
示例10: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
//get the button.
$buttonName = $this->controller->getButtonName();
$participantId = $this->_participantId;
if ($buttonName == '_qf_ParticipantConfirm_next') {
//lets get contact id in session.
$session = CRM_Core_Session::singleton();
$session->set('userID', $this->_csContactID);
$this->postProcessHook();
//check user registration status is from pending class
$url = CRM_Utils_System::url('civicrm/event/register', "reset=1&id={$this->_eventId}&participantId={$participantId}");
CRM_Utils_System::redirect($url);
} elseif ($buttonName == '_qf_ParticipantConfirm_submit') {
//need to registration status to 'cancelled'.
$cancelledId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'"));
$additionalParticipantIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
$participantIds = array_merge(array($participantId), $additionalParticipantIds);
$results = CRM_Event_BAO_Participant::transitionParticipants($participantIds, $cancelledId, NULL, TRUE);
if (count($participantIds) > 1) {
$statusMessage = ts("%1 Event registration(s) have been cancelled.", array(1 => count($participantIds)));
} else {
$statusMessage = ts("Your event registration has been cancelled.");
}
if (!empty($results['mailedParticipants'])) {
foreach ($results['mailedParticipants'] as $key => $displayName) {
$statusMessage .= "<br />" . ts("Email has been sent to : %1", array(1 => $displayName));
}
}
$this->postProcessHook();
CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_eventId}&noFullMsg=1", FALSE, NULL, FALSE, TRUE));
}
}
示例11: 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;
}
示例12: 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;
}
}
示例13: __construct
function __construct()
{
$this->_columns = array('civicrm_event' => array('dao' => 'CRM_Event_DAO_Event', 'fields' => array('title' => array('title' => ts('Event'), 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'event_type_id' => array('title' => ts('Event Type')), 'fee_label' => array('title' => ts('Fee Label')), 'event_start_date' => array('title' => ts('Event Start Date')), 'event_end_date' => array('title' => ts('Event End Date')), 'max_participants' => array('title' => ts('Capacity'), 'type' => CRM_Utils_Type::T_INT)), 'filters' => array('id' => array('title' => ts('Event Title'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::event(NULL, NULL, "is_template IS NULL OR is_template = 0")), 'event_type_id' => array('name' => 'event_type_id', 'title' => ts('Event Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type')), 'event_start_date' => array('title' => ts('Event Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'event_end_date' => array('title' => ts('Event End Date'), 'operatorType' => CRM_Report_Form::OP_DATE))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem', 'fields' => array('participant_count' => array('title' => ts('Participants'), 'default' => TRUE, 'statistics' => array('count' => ts('Participants'))), 'line_total' => array('title' => ts('Income Statistics'), 'type' => CRM_Utils_Type::T_MONEY, 'default' => TRUE, 'statistics' => array('sum' => ts('Income'), 'avg' => ts('Average'))))), 'civicrm_participant' => array('dao' => 'CRM_Event_DAO_Participant', 'filters' => array('sid' => array('name' => 'status_id', 'title' => ts('Participant Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus()), 'rid' => array('name' => 'role_id', 'title' => ts('Participant Role'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole()), 'participant_register_date' => array('title' => ts('Registration Date'), 'operatorType' => CRM_Report_Form::OP_DATE))));
parent::__construct();
}
示例14: array
/**
* Retrieve list of Scheduled Reminders
*
* @param bool $namesOnly return simple list of names
*
* @param null $entityValue
* @param null $id
*
* @return array (reference) reminder list
* @static
* @access public
*/
static function &getList($namesOnly = FALSE, $entityValue = NULL, $id = NULL)
{
$activity_type = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$activity_status = CRM_Core_PseudoConstant::activityStatus();
$event_type = CRM_Event_PseudoConstant::eventType();
$civicrm_event = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$civicrm_participant_status_type = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
$event_template = CRM_Event_PseudoConstant::eventTemplates();
$civicrm_contact = self::getDateFields();
$auto_renew_options = CRM_Core_OptionGroup::values('auto_renew_options');
$contact_date_reminder_options = CRM_Core_OptionGroup::values('contact_date_reminder_options');
$civicrm_membership_type = CRM_Member_PseudoConstant::membershipType();
$entity = array('civicrm_activity' => 'Activity', 'civicrm_participant' => 'Event', 'civicrm_membership' => 'Member', 'civicrm_contact' => 'Contact');
$query = "\nSELECT\n title,\n cam.entity,\n cas.id as id,\n cam.entity_value as entityValue,\n cas.entity_value as entityValueIds,\n cam.entity_status as entityStatus,\n cas.entity_status as entityStatusIds,\n cas.start_action_date as entityDate,\n cas.start_action_offset,\n cas.start_action_unit,\n cas.start_action_condition,\n cas.absolute_date,\n is_repeat,\n is_active\n\nFROM civicrm_action_schedule cas\nLEFT JOIN civicrm_action_mapping cam ON (cam.id = cas.mapping_id)\n";
$params = CRM_Core_DAO::$_nullArray;
if ($entityValue and $id) {
$where = "\nWHERE cas.entity_value = {$id} AND\n cam.entity_value = '{$entityValue}'";
$query .= $where;
$params = array(1 => array($id, 'Integer'), 2 => array($entityValue, 'String'));
}
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$list[$dao->id]['id'] = $dao->id;
$list[$dao->id]['title'] = $dao->title;
$list[$dao->id]['start_action_offset'] = $dao->start_action_offset;
$list[$dao->id]['start_action_unit'] = $dao->start_action_unit;
$list[$dao->id]['start_action_condition'] = $dao->start_action_condition;
$list[$dao->id]['entityDate'] = ucwords(str_replace('_', ' ', $dao->entityDate));
$list[$dao->id]['absolute_date'] = $dao->absolute_date;
$status = $dao->entityStatus;
$statusArray = explode(CRM_Core_DAO::VALUE_SEPARATOR, $dao->entityStatusIds);
foreach ($statusArray as &$s) {
$s = CRM_Utils_Array::value($s, ${$status});
}
$statusIds = implode(', ', $statusArray);
$value = $dao->entityValue;
$valueArray = explode(CRM_Core_DAO::VALUE_SEPARATOR, $dao->entityValueIds);
foreach ($valueArray as &$v) {
$v = CRM_Utils_Array::value($v, ${$value});
}
$valueIds = implode(', ', $valueArray);
$list[$dao->id]['entity'] = $entity[$dao->entity];
$list[$dao->id]['value'] = $valueIds;
$list[$dao->id]['status'] = $statusIds;
$list[$dao->id]['is_repeat'] = $dao->is_repeat;
$list[$dao->id]['is_active'] = $dao->is_active;
}
return $list;
}
示例15: checkRegistration
/**
* @param $params
*
* @return bool
*/
static function checkRegistration($params)
{
$alreadyRegistered = FALSE;
if (empty($params['contact_id'])) {
return $alreadyRegistered;
}
$statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$participant = new CRM_Event_DAO_Participant();
$participant->copyValues($params);
$participant->is_test = CRM_Utils_Array::value('is_test', $params, 0);
$participant->selectAdd();
$participant->selectAdd('status_id');
if ($participant->find(TRUE) && array_key_exists($participant->status_id, $statusTypes)) {
$alreadyRegistered = TRUE;
}
return $alreadyRegistered;
}