本文整理匯總了PHP中CRM_Event_BAO_Event::validRegistrationRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Event_BAO_Event::validRegistrationRequest方法的具體用法?PHP CRM_Event_BAO_Event::validRegistrationRequest怎麽用?PHP CRM_Event_BAO_Event::validRegistrationRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Event_BAO_Event
的用法示例。
在下文中一共展示了CRM_Event_BAO_Event::validRegistrationRequest方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
//.........這裏部分代碼省略.........
$minLat = $location['lat'];
}
if ($location['lng'] > $maxLng) {
$maxLng = $location['lng'];
}
if ($location['lng'] < $minLng) {
$minLng = $location['lng'];
}
}
$center = array('lat' => (double) $sumLat / count($locations), 'lng' => (double) $sumLng / count($locations));
$span = array('lat' => (double) ($maxLat - $minLat), 'lng' => (double) ($maxLng - $minLng));
$this->assign_by_ref('center', $center);
$this->assign_by_ref('span', $span);
if ($action == CRM_Core_Action::PREVIEW) {
$mapURL = CRM_Utils_System::url('civicrm/contact/map/event', "eid={$this->_id}&reset=1&action=preview", TRUE, NULL, TRUE, TRUE);
} else {
$mapURL = CRM_Utils_System::url('civicrm/contact/map/event', "eid={$this->_id}&reset=1", TRUE, NULL, TRUE, TRUE);
}
$this->assign('skipLocationType', TRUE);
$this->assign('mapURL', $mapURL);
}
if (CRM_Core_Permission::check('view event participants') && CRM_Core_Permission::check('view all contacts')) {
$statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1', 'label');
$statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0', 'label');
$findParticipants['statusCounted'] = implode(', ', array_values($statusTypes));
$findParticipants['statusNotCounted'] = implode(', ', array_values($statusTypesPending));
$this->assign('findParticipants', $findParticipants);
}
$participantListingID = CRM_Utils_Array::value('participant_listing_id', $values['event']);
if ($participantListingID) {
$participantListingURL = CRM_Utils_System::url('civicrm/event/participant', "reset=1&id={$this->_id}", TRUE, NULL, TRUE, TRUE);
$this->assign('participantListingURL', $participantListingURL);
}
$hasWaitingList = CRM_Utils_Array::value('has_waitlist', $values['event']);
$eventFullMessage = CRM_Event_BAO_Participant::eventFull($this->_id, FALSE, $hasWaitingList);
$allowRegistration = FALSE;
if (!empty($values['event']['is_online_registration'])) {
if (CRM_Event_BAO_Event::validRegistrationRequest($values['event'], $this->_id)) {
// we always generate urls for the front end in joomla
$action_query = $action === CRM_Core_Action::PREVIEW ? "&action={$action}" : '';
$url = CRM_Utils_System::url('civicrm/event/register', "id={$this->_id}&reset=1{$action_query}", TRUE, NULL, TRUE, TRUE);
if (!$eventFullMessage || $hasWaitingList) {
$registerText = ts('Register Now');
if (!empty($values['event']['registration_link_text'])) {
$registerText = $values['event']['registration_link_text'];
}
// check if we're in shopping cart mode for events
$enable_cart = Civi::settings()->get('enable_cart');
if ($enable_cart) {
$link = CRM_Event_Cart_BAO_EventInCart::get_registration_link($this->_id);
$registerText = $link['label'];
$url = CRM_Utils_System::url($link['path'], $link['query'] . $action_query, TRUE, NULL, TRUE, TRUE);
}
//Fixed for CRM-4855
$allowRegistration = CRM_Event_BAO_Event::showHideRegistrationLink($values);
$this->assign('registerText', $registerText);
$this->assign('registerURL', $url);
$this->assign('eventCartEnabled', $enable_cart);
}
} elseif (CRM_Core_Permission::check('register for events')) {
$this->assign('registerClosed', TRUE);
}
}
$this->assign('allowRegistration', $allowRegistration);
$session = CRM_Core_Session::singleton();
$params = array('contact_id' => $session->get('userID'), 'event_id' => CRM_Utils_Array::value('id', $values['event']), 'role_id' => CRM_Utils_Array::value('default_role_id', $values['event']));
if ($eventFullMessage && $noFullMsg == 'false' || CRM_Event_BAO_Event::checkRegistration($params)) {
$statusMessage = $eventFullMessage;
if (CRM_Event_BAO_Event::checkRegistration($params)) {
if ($noFullMsg == 'false') {
if ($values['event']['allow_same_participant_emails']) {
$statusMessage = ts('It looks like you are already registered for this event. You may proceed if you want to create an additional registration.');
} else {
$registerUrl = CRM_Utils_System::url('civicrm/event/register', "reset=1&id={$values['event']['id']}&cid=0");
$statusMessage = ts("It looks like you are already registered for this event. If you want to change your registration, or you feel that you've gotten this message in error, please contact the site administrator.") . ' ' . ts('You can also <a href="%1">register another participant</a>.', array(1 => $registerUrl));
}
}
} elseif ($hasWaitingList) {
$statusMessage = CRM_Utils_Array::value('waitlist_text', $values['event']);
if (!$statusMessage) {
$statusMessage = ts('Event is currently full, but you can register and be a part of waiting list.');
}
}
CRM_Core_Session::setStatus($statusMessage);
}
// we do not want to display recently viewed items, so turn off
$this->assign('displayRecent', FALSE);
// set page title = event title
CRM_Utils_System::setTitle($values['event']['title']);
$this->assign('event', $values['event']);
if (isset($values['feeBlock'])) {
$this->assign('feeBlock', $values['feeBlock']);
}
$this->assign('location', $values['location']);
if (CRM_Core_Permission::check('access CiviEvent')) {
$enableCart = Civi::settings()->get('enable_cart');
$this->assign('manageEventLinks', CRM_Event_Page_ManageEvent::tabs($enableCart));
}
return parent::run();
}
示例2: setTemplateEventValues
/**
* Create the event blocks for upcoming events.
*
* @return void
*/
private static function setTemplateEventValues()
{
$config = CRM_Core_Config::singleton();
$info = CRM_Event_BAO_Event::getCompleteInfo(date("Ymd"));
if ($info) {
$session = CRM_Core_Session::singleton();
// check if registration link should be displayed
foreach ($info as $id => $event) {
//@todo FIXME - validRegistraionRequest takes eventID not contactID as a param
// this is called via an obscure patch from Joomla event block rendering (only)
$info[$id]['onlineRegistration'] = CRM_Event_BAO_Event::validRegistrationRequest($event, $session->get('userID'));
}
self::setProperty(self::EVENT, 'templateValues', array('eventBlock' => $info));
}
}
示例3: setTemplateEventValues
/**
* create the event blocks for upcoming events
*
* @return void
* @access private
*/
private function setTemplateEventValues()
{
$config = CRM_Core_Config::singleton();
$info = CRM_Event_BAO_Event::getCompleteInfo(date("Ymd"));
if ($info) {
$session = CRM_Core_Session::singleton();
// check if registration link should be displayed
foreach ($info as $id => $event) {
$info[$id]['onlineRegistration'] = CRM_Event_BAO_Event::validRegistrationRequest($event, $session->get('userID'));
}
self::setProperty(self::EVENT, 'templateValues', array('eventBlock' => $info));
}
}