本文整理汇总了PHP中CRM_Core_Permission::event方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Permission::event方法的具体用法?PHP CRM_Core_Permission::event怎么用?PHP CRM_Core_Permission::event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Permission
的用法示例。
在下文中一共展示了CRM_Core_Permission::event方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* This function takes care of all the things common to all pages.
*
* This typically involves assigning the appropriate smarty variables :)
*/
public function run()
{
$transaction = new CRM_Core_Transaction();
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
if (!CRM_Core_Permission::event(CRM_Core_Permission::VIEW, $this->_id, 'register for events')) {
CRM_Core_Error::fatal(ts('You do not have permission to register for this event'));
}
$cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
$event_in_cart = $cart->add_event($this->_id);
$url = CRM_Utils_System::url('civicrm/event/view_cart');
CRM_Utils_System::setUFMessage(ts("<b>%1</b> has been added to your cart. <a href='%2'>View your cart.</a>", array(1 => $event_in_cart->event->title, 2 => $url)));
$transaction->commit();
return CRM_Utils_System::redirect($_SERVER['HTTP_REFERER']);
}
示例2: preProcess
/**
* Set variables up before form is built.
*/
public function preProcess()
{
$this->_eventId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
//CRM-4320
$this->_participantId = CRM_Utils_Request::retrieve('participantId', 'Positive', $this);
// current mode
$this->_mode = $this->_action == 1024 ? 'test' : 'live';
$this->_values = $this->get('values');
$this->_fields = $this->get('fields');
$this->_bltID = $this->get('bltID');
$this->_paymentProcessor = $this->get('paymentProcessor');
$this->_priceSetId = $this->get('priceSetId');
$this->_priceSet = $this->get('priceSet');
$this->_lineItem = $this->get('lineItem');
$this->_isEventFull = $this->get('isEventFull');
$this->_lineItemParticipantsCount = $this->get('lineItemParticipants');
if (!is_array($this->_lineItem)) {
$this->_lineItem = array();
}
if (!is_array($this->_lineItemParticipantsCount)) {
$this->_lineItemParticipantsCount = array();
}
$this->_availableRegistrations = $this->get('availableRegistrations');
$this->_participantIDS = $this->get('participantIDs');
//check if participant allow to walk registration wizard.
$this->_allowConfirmation = $this->get('allowConfirmation');
// check for Approval
$this->_requireApproval = $this->get('requireApproval');
// check for waitlisting.
$this->_allowWaitlist = $this->get('allowWaitlist');
$this->_forcePayement = $this->get('forcePayement');
//get the additional participant ids.
$this->_additionalParticipantIds = $this->get('additionalParticipantIds');
$config = CRM_Core_Config::singleton();
if (!$this->_values) {
// create redirect URL to send folks back to event info page is registration not available
$infoUrl = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_eventId}", FALSE, NULL, FALSE, TRUE);
// this is the first time we are hitting this, so check for permissions here
if (!CRM_Core_Permission::event(CRM_Core_Permission::EDIT, $this->_eventId, 'register for events')) {
CRM_Core_Error::statusBounce(ts('You do not have permission to register for this event'), $infoUrl);
}
// get all the values from the dao object
$this->_values = $this->_fields = array();
$this->_forcePayement = FALSE;
//retrieve event information
$params = array('id' => $this->_eventId);
CRM_Event_BAO_Event::retrieve($params, $this->_values['event']);
// check for is_monetary status
$isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values['event']);
// check for ability to add contributions of type
if ($isMonetary && CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($this->_values['event']['financial_type_id']))) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
$this->checkValidEvent($infoUrl);
// get the participant values, CRM-4320
$this->_allowConfirmation = FALSE;
if ($this->_participantId) {
$this->processFirstParticipant($this->_participantId);
}
//check for additional participants.
if ($this->_allowConfirmation && $this->_values['event']['is_multiple_registrations']) {
$additionalParticipantIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_participantId);
$cnt = 1;
foreach ($additionalParticipantIds as $additionalParticipantId) {
$this->_additionalParticipantIds[$cnt] = $additionalParticipantId;
$cnt++;
}
$this->set('additionalParticipantIds', $this->_additionalParticipantIds);
}
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $this->_values['event']));
$this->_allowWaitlist = $this->_isEventFull = FALSE;
if ($eventFull && !$this->_allowConfirmation) {
$this->_isEventFull = TRUE;
//lets redirecting to info only when to waiting list.
$this->_allowWaitlist = CRM_Utils_Array::value('has_waitlist', $this->_values['event']);
if (!$this->_allowWaitlist) {
CRM_Utils_System::redirect($infoUrl);
}
}
$this->set('isEventFull', $this->_isEventFull);
$this->set('allowWaitlist', $this->_allowWaitlist);
//check for require requires approval.
$this->_requireApproval = FALSE;
if (!empty($this->_values['event']['requires_approval']) && !$this->_allowConfirmation) {
$this->_requireApproval = TRUE;
}
$this->set('requireApproval', $this->_requireApproval);
if (isset($this->_values['event']['default_role_id'])) {
$participant_role = CRM_Core_OptionGroup::values('participant_role');
$this->_values['event']['participant_role'] = $participant_role["{$this->_values['event']['default_role_id']}"];
}
$isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later');
//check for various combinations for paylater, payment
//process with paid event.
if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) {
$this->_paymentProcessorIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('payment_processor', $this->_values['event']));
//.........这里部分代码省略.........
示例3: validRegistrationDate
static function validRegistrationDate(&$values, $contactID)
{
// make sure that we are between registration start date and registration end date
$startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('registration_start_date', $values));
$endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('registration_end_date', $values));
$now = time();
$validDate = true;
if ($startDate && $startDate >= $now) {
$validDate = false;
}
if ($endDate && $endDate < $now) {
$validDate = false;
}
// also check that the user has permission to register for this event
$hasPermission = CRM_Core_Permission::event(CRM_Core_Permission::EDIT, $contactID);
return $validDate && $hasPermission;
}
示例4: validRegistrationRequest
/**
* Check if event registration is valid according to permissions AND Dates
*
* @param array $values
* @param integer $eventID
* @return boolean
*/
static function validRegistrationRequest($values, $eventID)
{
// check that the user has permission to register for this event
$hasPermission = CRM_Core_Permission::event(CRM_Core_Permission::EDIT, $eventID, 'register for events');
return $hasPermission && self::validRegistrationDate($values);
}
示例5: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
*
* @return void
* @access public
*
*/
function run()
{
//get the event id.
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
$config =& CRM_Core_Config::singleton();
require_once 'CRM/Event/BAO/Event.php';
// ensure that the user has permission to see this page
if (!CRM_Core_Permission::event(CRM_Core_Permission::VIEW, $this->_id)) {
CRM_Core_Error::fatal(ts('You do not have permission to view this event'));
}
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false);
$context = CRM_Utils_Request::retrieve('context', 'String', $this, false, 'register');
$this->assign('context', $context);
// Sometimes we want to suppress the Event Full msg
$noFullMsg = CRM_Utils_Request::retrieve('noFullMsg', 'String', $this, false, 'false');
// set breadcrumb to append to 2nd layer pages
$breadCrumbPath = CRM_Utils_System::url("civicrm/event/info", "id={$this->_id}&reset=1");
$additionalBreadCrumb = "<a href=\"{$breadCrumbPath}\">" . ts('Events') . '</a>';
//retrieve event information
$params = array('id' => $this->_id);
CRM_Event_BAO_Event::retrieve($params, $values['event']);
if (!$values['event']['is_active']) {
// form is inactive, die a fatal death
CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
}
$this->assign('isShowLocation', CRM_Utils_Array::value('is_show_location', $values['event']));
// show event fees.
require_once 'CRM/Price/BAO/Set.php';
if ($this->_id && CRM_Utils_Array::value('is_monetary', $values['event'])) {
// get price set options, - CRM-5209
if ($priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $this->_id)) {
$setDetails = CRM_Price_BAO_Set::getSetDetail($priceSetId);
eval("\$priceSetFields = \$setDetails[{$priceSetId}][fields];");
if (is_array($priceSetFields)) {
$fieldCnt = 1;
foreach ($priceSetFields as $fid => $fieldValues) {
if (!is_array($fieldValues['options']) || empty($fieldValues['options'])) {
continue;
}
foreach ($fieldValues['options'] as $optionId => $optionVal) {
$values['feeBlock']['value'][$fieldCnt] = $optionVal['value'];
$values['feeBlock']['label'][$fieldCnt] = $optionVal['description'];
$fieldCnt++;
}
}
}
} else {
//retrieve event fee block.
require_once 'CRM/Core/OptionGroup.php';
require_once 'CRM/Core/BAO/Discount.php';
$discountId = CRM_Core_BAO_Discount::findSet($this->_id, 'civicrm_event');
if ($discountId) {
CRM_Core_OptionGroup::getAssoc(CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Discount', $discountId, 'option_group_id'), $values['feeBlock'], false, 'id');
} else {
CRM_Core_OptionGroup::getAssoc("civicrm_event.amount.{$this->_id}", $values['feeBlock']);
}
}
}
$params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event');
require_once 'CRM/Core/BAO/Location.php';
$values['location'] = CRM_Core_BAO_Location::getValues($params, true);
//retrieve custom field information
require_once 'CRM/Core/BAO/CustomGroup.php';
$groupTree =& CRM_Core_BAO_CustomGroup::getTree("Event", $this, $this->_id, 0, $values['event']['event_type_id']);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
$this->assign('action', CRM_Core_Action::VIEW);
//To show the event location on maps directly on event info page
$locations =& CRM_Event_BAO_Event::getMapInfo($this->_id);
if (!empty($locations) && CRM_Utils_Array::value('is_map', $values['event'])) {
$this->assign('locations', $locations);
$this->assign('mapProvider', $config->mapProvider);
$this->assign('mapKey', $config->mapAPIKey);
$sumLat = $sumLng = 0;
$maxLat = $maxLng = -400;
$minLat = $minLng = +400;
foreach ($locations as $location) {
$sumLat += $location['lat'];
$sumLng += $location['lng'];
if ($location['lat'] > $maxLat) {
$maxLat = $location['lat'];
}
if ($location['lat'] < $minLat) {
$minLat = $location['lat'];
}
if ($location['lng'] > $maxLng) {
$maxLng = $location['lng'];
}
if ($location['lng'] < $minLng) {
$minLng = $location['lng'];
//.........这里部分代码省略.........
示例6: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
*
* @return void
*/
public function run()
{
//get the event id.
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$config = CRM_Core_Config::singleton();
// ensure that the user has permission to see this page
if (!CRM_Core_Permission::event(CRM_Core_Permission::VIEW, $this->_id, 'view event info')) {
CRM_Utils_System::setUFMessage(ts('You do not have permission to view this event'));
return CRM_Utils_System::permissionDenied();
}
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
$context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'register');
$this->assign('context', $context);
// Sometimes we want to suppress the Event Full msg
$noFullMsg = CRM_Utils_Request::retrieve('noFullMsg', 'String', $this, FALSE, 'false');
// set breadcrumb to append to 2nd layer pages
$breadCrumbPath = CRM_Utils_System::url('civicrm/event/info', "id={$this->_id}&reset=1");
//retrieve event information
$params = array('id' => $this->_id);
CRM_Event_BAO_Event::retrieve($params, $values['event']);
if (!$values['event']['is_active']) {
// form is inactive, die a fatal death
CRM_Utils_System::setUFMessage(ts('The event you requested is currently unavailable (contact the site administrator for assistance).'));
return CRM_Utils_System::permissionDenied();
}
if (!empty($values['event']['is_template'])) {
// form is an Event Template
CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
}
// Add Event Type to $values in case folks want to display it
$values['event']['event_type'] = CRM_Utils_Array::value($values['event']['event_type_id'], CRM_Event_PseudoConstant::eventType());
$this->assign('isShowLocation', CRM_Utils_Array::value('is_show_location', $values['event']));
// show event fees.
if ($this->_id && !empty($values['event']['is_monetary'])) {
//CRM-6907
$config = CRM_Core_Config::singleton();
$config->defaultCurrency = CRM_Utils_Array::value('currency', $values['event'], $config->defaultCurrency);
//CRM-10434
$discountId = CRM_Core_BAO_Discount::findSet($this->_id, 'civicrm_event');
if ($discountId) {
$priceSetId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Discount', $discountId, 'price_set_id');
} else {
$priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $this->_id);
}
// get price set options, - CRM-5209
if ($priceSetId) {
$setDetails = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId, TRUE, TRUE);
$priceSetFields = $setDetails[$priceSetId]['fields'];
if (is_array($priceSetFields)) {
$fieldCnt = 1;
$visibility = CRM_Core_PseudoConstant::visibility('name');
// CRM-14492 Admin price fields should show up on event registration if user has 'administer CiviCRM' permissions
$adminFieldVisible = FALSE;
if (CRM_Core_Permission::check('administer CiviCRM')) {
$adminFieldVisible = TRUE;
}
foreach ($priceSetFields as $fid => $fieldValues) {
if (!is_array($fieldValues['options']) || empty($fieldValues['options']) || CRM_Utils_Array::value('visibility_id', $fieldValues) != array_search('public', $visibility) && $adminFieldVisible == FALSE) {
continue;
}
if (count($fieldValues['options']) > 1) {
$values['feeBlock']['value'][$fieldCnt] = '';
$values['feeBlock']['label'][$fieldCnt] = $fieldValues['label'];
$values['feeBlock']['lClass'][$fieldCnt] = 'price_set_option_group-label';
$values['feeBlock']['isDisplayAmount'][$fieldCnt] = CRM_Utils_Array::value('is_display_amounts', $fieldValues);
$fieldCnt++;
$labelClass = 'price_set_option-label';
} else {
$labelClass = 'price_set_field-label';
}
// show tax rate with amount
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
$displayOpt = CRM_Utils_Array::value('tax_display_settings', $invoiceSettings);
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
foreach ($fieldValues['options'] as $optionId => $optionVal) {
$values['feeBlock']['isDisplayAmount'][$fieldCnt] = CRM_Utils_Array::value('is_display_amounts', $fieldValues);
if ($invoicing && isset($optionVal['tax_amount'])) {
$values['feeBlock']['value'][$fieldCnt] = CRM_Price_BAO_PriceField::getTaxLabel($optionVal, 'amount', $displayOpt, $taxTerm);
$values['feeBlock']['tax_amount'][$fieldCnt] = $optionVal['tax_amount'];
} else {
$values['feeBlock']['value'][$fieldCnt] = $optionVal['amount'];
}
$values['feeBlock']['label'][$fieldCnt] = $optionVal['label'];
$values['feeBlock']['lClass'][$fieldCnt] = $labelClass;
$fieldCnt++;
}
}
}
// Tell tpl we have price set fee data and whether it's a quick_config price set
$this->assign('isPriceSet', 1);
//.........这里部分代码省略.........
示例7: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
$this->_eventId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
//CRM-4320
$this->_participantId = CRM_Utils_Request::retrieve('participantId', 'Positive', $this);
// current mode
$this->_mode = $this->_action == 1024 ? 'test' : 'live';
$this->_values = $this->get('values');
$this->_fields = $this->get('fields');
$this->_bltID = $this->get('bltID');
$this->_paymentProcessor = $this->get('paymentProcessor');
$this->_priceSetId = $this->get('priceSetId');
$this->_priceSet = $this->get('priceSet');
$this->_lineItem = $this->get('lineItem');
$this->_isEventFull = $this->get('isEventFull');
$this->_lineItemParticipantsCount = $this->get('lineItemParticipants');
if (!is_array($this->_lineItem)) {
$this->_lineItem = array();
}
if (!is_array($this->_lineItemParticipantsCount)) {
$this->_lineItemParticipantsCount = array();
}
$this->_availableRegistrations = $this->get('availableRegistrations');
$this->_participantIDS = $this->get('participantIDs');
//check if participant allow to walk registration wizard.
$this->_allowConfirmation = $this->get('allowConfirmation');
// check for Approval
$this->_requireApproval = $this->get('requireApproval');
// check for waitlisting.
$this->_allowWaitlist = $this->get('allowWaitlist');
$this->_forcePayement = $this->get('forcePayement');
//get the additional participant ids.
$this->_additionalParticipantIds = $this->get('additionalParticipantIds');
$config = CRM_Core_Config::singleton();
if (!$this->_values) {
// create redirect URL to send folks back to event info page is registration not available
$infoUrl = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_eventId}", FALSE, NULL, FALSE, TRUE);
// this is the first time we are hitting this, so check for permissions here
if (!CRM_Core_Permission::event(CRM_Core_Permission::EDIT, $this->_eventId, 'register for events')) {
CRM_Core_Error::statusBounce(ts('You do not have permission to register for this event'), $infoUrl);
}
// get all the values from the dao object
$this->_values = $this->_fields = array();
$this->_forcePayement = FALSE;
//retrieve event information
$params = array('id' => $this->_eventId);
CRM_Event_BAO_Event::retrieve($params, $this->_values['event']);
$this->checkValidEvent($infoUrl);
// get the participant values, CRM-4320
$this->_allowConfirmation = FALSE;
if ($this->_participantId) {
$this->processFirstParticipant($this->_participantId);
}
//check for additional participants.
if ($this->_allowConfirmation && $this->_values['event']['is_multiple_registrations']) {
$additionalParticipantIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_participantId);
$cnt = 1;
foreach ($additionalParticipantIds as $additionalParticipantId) {
$this->_additionalParticipantIds[$cnt] = $additionalParticipantId;
$cnt++;
}
$this->set('additionalParticipantIds', $this->_additionalParticipantIds);
}
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $this->_values['event']));
$this->_allowWaitlist = $this->_isEventFull = FALSE;
if ($eventFull && !$this->_allowConfirmation) {
$this->_isEventFull = TRUE;
//lets redirecting to info only when to waiting list.
$this->_allowWaitlist = CRM_Utils_Array::value('has_waitlist', $this->_values['event']);
if (!$this->_allowWaitlist) {
CRM_Utils_System::redirect($infoUrl);
}
}
$this->set('isEventFull', $this->_isEventFull);
$this->set('allowWaitlist', $this->_allowWaitlist);
//check for require requires approval.
$this->_requireApproval = FALSE;
if (!empty($this->_values['event']['requires_approval']) && !$this->_allowConfirmation) {
$this->_requireApproval = TRUE;
}
$this->set('requireApproval', $this->_requireApproval);
if (isset($this->_values['event']['default_role_id'])) {
$participant_role = CRM_Core_OptionGroup::values('participant_role');
$this->_values['event']['participant_role'] = $participant_role["{$this->_values['event']['default_role_id']}"];
}
// check for is_monetary status
$isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values['event']);
$isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later');
//check for variour combination for paylater, payment
//process with paid event.
if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) {
$ppID = CRM_Utils_Array::value('payment_processor', $this->_values['event']);
if (!$ppID) {
//.........这里部分代码省略.........
示例8: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
$this->_eventId = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false);
//CRM-4320
$this->_participantId = CRM_Utils_Request::retrieve('participantId', 'Positive', $this);
// current mode
$this->_mode = $this->_action == 1024 ? 'test' : 'live';
$this->_values = $this->get('values');
$this->_fields = $this->get('fields');
$this->_bltID = $this->get('bltID');
$this->_paymentProcessor = $this->get('paymentProcessor');
$this->_priceSetId = $this->get('priceSetId');
$this->_priceSet = $this->get('priceSet');
//check if participant allow to walk registration wizard.
$this->_allowConfirmation = $this->get('allowConfirmation');
// check for Approval
$this->_requireApproval = $this->get('requireApproval');
// check for waitlisting.
$this->_allowWaitlist = $this->get('allowWaitlist');
//get the additional participant ids.
$this->_additionalParticipantIds = $this->get('additionalParticipantIds');
$config =& CRM_Core_Config::singleton();
if (!$this->_values) {
// create redirect URL to send folks back to event info page is registration not available
$infoUrl = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_eventId}", false, null, false, true);
// this is the first time we are hitting this, so check for permissions here
if (!CRM_Core_Permission::event(CRM_Core_Permission::EDIT, $this->_eventId)) {
CRM_Core_Error::statusBounce(ts('You do not have permission to register for this event'), $infoUrl);
}
// get all the values from the dao object
$this->_values = array();
$this->_fields = array();
// get the participant values, CRM-4320
$this->_allowConfirmation = false;
if ($this->_participantId) {
require_once 'CRM/Event/BAO/Event.php';
$ids = $participantValues = array();
$participantParams = array('id' => $this->_participantId);
require_once 'CRM/Event/BAO/Participant.php';
CRM_Event_BAO_Participant::getValues($participantParams, $participantValues, $ids);
$this->_values['participant'] = $participantValues[$this->_participantId];
//allow pending status class walk registration wizard.
require_once 'CRM/Core/PseudoConstant.php';
if (array_key_exists($participantValues[$this->_participantId]['status_id'], CRM_Event_PseudoConstant::participantStatus(null, "class = 'Pending'"))) {
$this->_allowConfirmation = true;
$this->set('allowConfirmation', true);
}
}
//retrieve event information
require_once 'CRM/Event/BAO/Event.php';
$params = array('id' => $this->_eventId);
CRM_Event_BAO_Event::retrieve($params, $this->_values['event']);
require_once 'CRM/Event/BAO/Participant.php';
//check for additional participants.
if ($this->_allowConfirmation && $this->_values['event']['is_multiple_registrations']) {
$this->_additionalParticipantIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_participantId);
$this->set('additionalParticipantIds', $this->_additionalParticipantIds);
}
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId);
$this->_allowWaitlist = false;
if ($eventFull && !$this->_allowConfirmation) {
//lets redirecting to info only when to waiting list.
$this->_allowWaitlist = CRM_Utils_Array::value('has_waitlist', $this->_values['event']);
if (!$this->_allowWaitlist) {
CRM_Utils_System::redirect($infoUrl);
}
}
$this->set('allowWaitlist', $this->_allowWaitlist);
//check for require requires approval.
$this->_requireApproval = false;
if (CRM_Utils_Array::value('requires_approval', $this->_values['event']) && !$this->_allowConfirmation) {
$this->_requireApproval = true;
}
$this->set('requireApproval', $this->_requireApproval);
// also get the accounting code
if (CRM_Utils_Array::value('contribution_type_id', $this->_values['event'])) {
$this->_values['event']['accountingCode'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionType', $this->_values['event']['contribution_type_id'], 'accounting_code');
}
if (isset($this->_values['event']['default_role_id'])) {
require_once 'CRM/Core/OptionGroup.php';
$participant_role = CRM_Core_OptionGroup::values('participant_role');
$this->_values['event']['participant_role'] = $participant_role["{$this->_values['event']['default_role_id']}"];
}
// is the event active (enabled)?
if (!$this->_values['event']['is_active']) {
// form is inactive, die a fatal death
CRM_Core_Error::statusBounce(ts('The event you requested is currently unavailable (contact the site administrator for assistance).'));
}
// is online registration is enabled?
if (!$this->_values['event']['is_online_registration']) {
CRM_Core_Error::statusBounce(ts('Online registration is not currently available for this event (contact the site administrator for assistance).'), $infoUrl);
}
// is this an event template ?
//.........这里部分代码省略.........