本文整理汇总了PHP中CRM_Event_PseudoConstant类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_PseudoConstant类的具体用法?PHP CRM_Event_PseudoConstant怎么用?PHP CRM_Event_PseudoConstant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Event_PseudoConstant类的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: 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'));
}
示例4: __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)');
}
示例5: 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;
}
示例6: 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();
}
示例7: 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);
}
示例8: 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();
}
示例9: 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();
}
示例10: rolebasedpricing_civicrm_buildAmount
/**
* Implementation of buildAmount hook
* To modify the priceset on the basis of participant role/price field id provided from the url
*/
function rolebasedpricing_civicrm_buildAmount($pageType, &$form, &$amount)
{
if ($pageType == 'event') {
$priceSetId = $form->get('priceSetId');
$backupPriceSet = $form->_priceSet;
$priceSet =& $form->_priceSet;
$participantrole = '';
$participantroleHashed = CRM_Utils_Request::retrieve('participantrole', 'String', $form);
$allParticipantRoles = CRM_Event_PseudoConstant::participantRole();
//If we find participantrole in url
if ($participantroleHashed) {
foreach ($allParticipantRoles as $roleId => $roleName) {
if (md5($roleId) == $participantroleHashed) {
$participantrole = $roleId;
break;
}
}
} else {
$defaultParticipantRole = $form->_values['event']['default_role_id'];
$participantrole = $defaultParticipantRole;
}
if (isset($participantrole) && !empty($participantrole)) {
if (!empty($priceSetId)) {
$backupAmount = $amount;
$feeBlock =& $amount;
$counter = 0;
foreach ($feeBlock as $k => &$fee) {
if (!is_array($fee['options'])) {
continue;
}
$price_field_id = $fee['id'];
foreach ($fee['options'] as $key => &$option) {
$fieldID = $option['id'];
$sql = "SELECT COUNT(*) as count\n FROM civicrm_participantrole_price\n WHERE participant_role = %1\n AND price_field_id = %2\n AND field_id = %3";
$params = array(1 => array((int) $participantrole, 'Integer'), 2 => array((int) $price_field_id, 'Integer'), 3 => array((int) $fieldID, 'Integer'));
$founInPriceRoleSetting = CRM_Core_DAO::singleValueQuery($sql, $params);
if ($founInPriceRoleSetting == 1) {
$counter++;
} else {
unset($feeBlock[$k]);
//unsetting it from $form->priceSet as it leaves the labels of Price Options behind
unset($priceSet['fields'][$price_field_id]);
}
}
}
//Restore priceset
if ($counter < 1) {
$feeBlock = $backupAmount;
$priceSet = $backupPriceSet;
}
}
}
}
}
示例11: getPcpDashboardInfo
/**
* Return PCP Block info for dashboard.
*
* @param int $contactId
*
* @return array
* array of Pcp if found
*/
public static function getPcpDashboardInfo($contactId)
{
$links = self::pcpLinks();
$query = "\nSELECT * FROM civicrm_pcp pcp\nWHERE pcp.is_active = 1\n AND pcp.contact_id = %1\nORDER BY page_type, page_id";
$params = array(1 => array($contactId, 'Integer'));
$pcpInfoDao = CRM_Core_DAO::executeQuery($query, $params);
$pcpInfo = array();
$hide = $mask = array_sum(array_keys($links['all']));
$contactPCPPages = array();
$event = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$contribute = CRM_Contribute_PseudoConstant::contributionPage();
$pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus();
$approved = CRM_Utils_Array::key('Approved', $pcpStatus);
while ($pcpInfoDao->fetch()) {
$mask = $hide;
if ($links) {
$replace = array('pcpId' => $pcpInfoDao->id, 'pcpBlock' => $pcpInfoDao->pcp_block_id, 'pageComponent' => $pcpInfoDao->page_type);
}
$pcpLink = $links['all'];
$class = '';
if ($pcpInfoDao->status_id != $approved || $pcpInfoDao->is_active != 1) {
$class = 'disabled';
if (!$pcpInfoDao->tellfriend) {
$mask -= CRM_Core_Action::DETACH;
}
}
if ($pcpInfoDao->is_active == 1) {
$mask -= CRM_Core_Action::ENABLE;
} else {
$mask -= CRM_Core_Action::DISABLE;
}
$action = CRM_Core_Action::formLink($pcpLink, $mask, $replace, ts('more'), FALSE, 'pcp.dashboard.active', 'PCP', $pcpInfoDao->id);
$component = $pcpInfoDao->page_type;
$pageTitle = CRM_Utils_Array::value($pcpInfoDao->page_id, ${$component});
$pcpInfo[] = array('pageTitle' => $pageTitle, 'pcpId' => $pcpInfoDao->id, 'pcpTitle' => $pcpInfoDao->title, 'pcpStatus' => $pcpStatus[$pcpInfoDao->status_id], 'action' => $action, 'class' => $class);
$contactPCPPages[$pcpInfoDao->page_type][] = $pcpInfoDao->page_id;
}
$excludePageClause = $clause = NULL;
if (!empty($contactPCPPages)) {
foreach ($contactPCPPages as $component => $entityIds) {
$excludePageClause[] = "\n( target_entity_type = '{$component}'\nAND target_entity_id NOT IN ( " . implode(',', $entityIds) . ") )";
}
$clause = ' AND ' . implode(' OR ', $excludePageClause);
}
$query = "\nSELECT *\nFROM civicrm_pcp_block block\nLEFT JOIN civicrm_pcp pcp ON pcp.pcp_block_id = block.id\nWHERE block.is_active = 1\n{$clause}\nGROUP BY block.id\nORDER BY target_entity_type, target_entity_id\n";
$pcpBlockDao = CRM_Core_DAO::executeQuery($query);
$pcpBlock = array();
$mask = 0;
while ($pcpBlockDao->fetch()) {
if ($links) {
$replace = array('pageId' => $pcpBlockDao->target_entity_id, 'pageComponent' => $pcpBlockDao->target_entity_type);
}
$pcpLink = $links['add'];
$action = CRM_Core_Action::formLink($pcpLink, $mask, $replace, ts('more'), FALSE, 'pcp.dashboard.other', "{$pcpBlockDao->target_entity_type}_PCP", $pcpBlockDao->target_entity_id);
$component = $pcpBlockDao->target_entity_type;
if ($pageTitle = CRM_Utils_Array::value($pcpBlockDao->target_entity_id, ${$component})) {
$pcpBlock[] = array('pageId' => $pcpBlockDao->target_entity_id, 'pageTitle' => $pageTitle, 'action' => $action);
}
}
return array($pcpBlock, $pcpInfo);
}
示例12: 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;
}
示例13: 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));
}
}
示例14: 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;
}
示例15: browse
/**
* Browse all custom data groups.
*
* @param string $action the action to be invoked
*
* @return void
* @access public
*/
function browse($action = NULL)
{
// get all custom groups sorted by weight
$customGroup = array();
$dao = new CRM_Core_DAO_CustomGroup();
$dao->orderBy('weight, title');
$dao->find();
while ($dao->fetch()) {
$customGroup[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $customGroup[$dao->id]);
// form all action links
$action = array_sum(array_keys($this->actionLinks()));
// update enable/disable links depending on custom_group properties.
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$customGroup[$dao->id]['order'] = $customGroup[$dao->id]['weight'];
$customGroup[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
}
$customGroupExtends = CRM_Core_SelectValues::customGroupExtends();
foreach ($customGroup as $key => $array) {
CRM_Core_DAO_CustomGroup::addDisplayEnums($customGroup[$key]);
$customGroup[$key]['extends_display'] = $customGroupExtends[$customGroup[$key]['extends']];
}
//fix for Displaying subTypes
$subTypes = array();
$subTypes['Activity'] = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
$subTypes['Contribution'] = CRM_Contribute_PseudoConstant::contributionType();
$subTypes['Membership'] = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE);
$subTypes['Event'] = CRM_Core_OptionGroup::values('event_type');
$subTypes['Grant'] = CRM_Core_OptionGroup::values('grant_type');
$subTypes['Campaign'] = CRM_Campaign_PseudoConstant::campaignType();
$subTypes['Participant'] = array();
$subTypes['ParticipantRole'] = CRM_Core_OptionGroup::values('participant_role');
$subTypes['ParticipantEventName'] = CRM_Event_PseudoConstant::event();
$subTypes['ParticipantEventType'] = CRM_Core_OptionGroup::values('event_type');
$subTypes['Individual'] = CRM_Contact_BAO_ContactType::subTypePairs('Individual', FALSE, NULL);
$subTypes['Household'] = CRM_Contact_BAO_ContactType::subTypePairs('Household', FALSE, NULL);
$subTypes['Organization'] = CRM_Contact_BAO_ContactType::subTypePairs('Organization', FALSE, NULL);
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
$relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
$relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
$allRelationshipType = array();
$allRelationshipType = array_merge($relTypeInd, $relTypeOrg);
$allRelationshipType = array_merge($allRelationshipType, $relTypeHou);
//adding subtype specific relationships CRM-5256
$relSubType = CRM_Contact_BAO_ContactType::subTypeInfo();
foreach ($relSubType as $subType => $val) {
$subTypeRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'], FALSE, 'label', TRUE, $subType);
$allRelationshipType = array_merge($allRelationshipType, $subTypeRelationshipTypes);
}
$subTypes['Relationship'] = $allRelationshipType;
$cSubTypes = CRM_Core_Component::contactSubTypes();
$contactSubTypes = array();
foreach ($cSubTypes as $key => $value) {
$contactSubTypes[$key] = $key;
}
$subTypes['Contact'] = $contactSubTypes;
CRM_Core_BAO_CustomGroup::getExtendedObjectTypes($subTypes);
foreach ($customGroup as $key => $values) {
$subValue = CRM_Utils_Array::value('extends_entity_column_value', $customGroup[$key]);
$subName = CRM_Utils_Array::value('extends_entity_column_id', $customGroup[$key]);
$type = CRM_Utils_Array::value('extends', $customGroup[$key]);
if ($subValue) {
$subValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subValue, 1, -1));
$colValue = NULL;
foreach ($subValue as $sub) {
if ($sub) {
if ($type == 'Participant') {
if ($subName == 1) {
$colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantRole'][$sub] : $subTypes['ParticipantRole'][$sub];
} elseif ($subName == 2) {
$colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantEventName'][$sub] : $subTypes['ParticipantEventName'][$sub];
} elseif ($subName == 3) {
$colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantEventType'][$sub] : $subTypes['ParticipantEventType'][$sub];
}
} elseif ($type == 'Relationship') {
$colValue = $colValue ? $colValue . ', ' . $subTypes[$type][$sub . '_a_b'] : $subTypes[$type][$sub . '_a_b'];
if (isset($subTypes[$type][$sub . '_b_a'])) {
$colValue = $colValue ? $colValue . ', ' . $subTypes[$type][$sub . '_b_a'] : $subTypes[$type][$sub . '_b_a'];
}
} else {
$colValue = $colValue ? $colValue . (isset($subTypes[$type][$sub]) ? ', ' . $subTypes[$type][$sub] : '') : (isset($subTypes[$type][$sub]) ? $subTypes[$type][$sub] : '');
}
}
}
$customGroup[$key]["extends_entity_column_value"] = $colValue;
} else {
if (is_array(CRM_Utils_Array::value($type, $subTypes))) {
$customGroup[$key]["extends_entity_column_value"] = ts("Any");
//.........这里部分代码省略.........