3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 class CRM_Event_Page_ParticipantListing
extends CRM_Core_Page
{
21 protected $_participantListingID;
23 protected $_eventTitle;
27 public function preProcess() {
28 $this->_id
= CRM_Utils_Request
::retrieve('id', 'Integer', $this, TRUE);
30 // ensure that there is a participant type for this
31 $this->_participantListingID
= CRM_Core_DAO
::getFieldValue('CRM_Event_DAO_Event',
33 'participant_listing_id'
35 if (!$this->_participantListingID
) {
36 CRM_Core_Error
::statusBounce(ts('The Participant Listing feature is not currently enabled for this event.'));
39 // retrieve Event Title and include it in page title
40 $this->_eventTitle
= CRM_Core_DAO
::getFieldValue('CRM_Event_DAO_Event',
44 CRM_Utils_System
::setTitle(ts('%1 - Participants', array(1 => $this->_eventTitle
)));
46 // we do not want to display recently viewed contacts since this is potentially a public page
47 $this->assign('displayRecent', FALSE);
55 public function run() {
58 // get the class name from the participantListingID
59 $className = CRM_Utils_Array
::value($this->_participantListingID
,
60 CRM_Core_PseudoConstant
::get(
61 'CRM_Event_BAO_Event',
62 'participant_listing_id',
63 ['keyColumn' => 'value', 'labelColumn' => 'description']
66 if ($className == 'CRM_Event_Page_ParticipantListing') {
67 CRM_Core_Error
::statusBounce(ts("Participant listing code file cannot be '%1'",
68 array(1 => $className)
72 $classFile = str_replace('_',
76 $error = include_once $classFile;
77 if ($error == FALSE) {
78 CRM_Core_Error
::statusBounce(ts('Participant listing code file: %1 does not exist. Please verify your custom participant listing settings in CiviCRM administrative panel.', [1 => $classFile]));
81 $participantListingClass = new $className();
83 $participantListingClass->preProcess();
84 $participantListingClass->run();