Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | * $Id$ |
17 | * | |
18 | */ | |
19 | class CRM_Event_Page_ParticipantListing extends CRM_Core_Page { | |
20 | ||
21 | protected $_id; | |
22 | ||
23 | protected $_participantListingID; | |
24 | ||
25 | protected $_eventTitle; | |
26 | ||
27 | protected $_pager; | |
353ffa53 | 28 | |
00be9182 | 29 | public function preProcess() { |
6a488035 TO |
30 | $this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this, TRUE); |
31 | ||
32 | // ensure that there is a particpant type for this | |
33 | $this->_participantListingID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', | |
34 | $this->_id, | |
35 | 'participant_listing_id' | |
36 | ); | |
37 | if (!$this->_participantListingID) { | |
38 | CRM_Core_Error::fatal(ts('The Participant Listing feature is not currently enabled for this event.')); | |
39 | } | |
40 | ||
41 | // retrieve Event Title and include it in page title | |
42 | $this->_eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', | |
43 | $this->_id, | |
44 | 'title' | |
45 | ); | |
46 | CRM_Utils_System::setTitle(ts('%1 - Participants', array(1 => $this->_eventTitle))); | |
47 | ||
48 | // we do not want to display recently viewed contacts since this is potentially a public page | |
49 | $this->assign('displayRecent', FALSE); | |
50 | } | |
51 | ||
f2ac86d1 | 52 | /** |
53 | * Run listing page. | |
54 | * | |
55 | * @throws \Exception | |
56 | */ | |
00be9182 | 57 | public function run() { |
6a488035 TO |
58 | $this->preProcess(); |
59 | ||
60 | // get the class name from the participantListingID | |
676159c9 | 61 | $className = CRM_Utils_Array::value($this->_participantListingID, |
62 | CRM_Core_PseudoConstant::get( | |
63 | 'CRM_Event_BAO_Event', | |
64 | 'participant_listing_id', | |
65 | ['keyColumn' => 'value', 'labelColumn' => 'description'] | |
66 | ) | |
6a488035 | 67 | ); |
6a488035 TO |
68 | if ($className == 'CRM_Event_Page_ParticipantListing') { |
69 | CRM_Core_Error::fatal(ts("Participant listing code file cannot be '%1'", | |
353ffa53 TO |
70 | array(1 => $className) |
71 | )); | |
6a488035 TO |
72 | } |
73 | ||
74 | $classFile = str_replace('_', | |
353ffa53 TO |
75 | DIRECTORY_SEPARATOR, |
76 | $className | |
77 | ) . '.php'; | |
0479b4c8 | 78 | $error = include_once $classFile; |
6a488035 TO |
79 | if ($error == FALSE) { |
80 | CRM_Core_Error::fatal('Participant listing code file: ' . $classFile . ' does not exist. Please verify your custom particpant listing settings in CiviCRM administrative panel.'); | |
81 | } | |
82 | ||
4d5c2eb5 | 83 | $participantListingClass = new $className(); |
6a488035 TO |
84 | |
85 | $participantListingClass->preProcess(); | |
86 | $participantListingClass->run(); | |
87 | } | |
96025800 | 88 | |
6a488035 | 89 | } |