3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2013
35 class CRM_Event_Page_ParticipantListing_NameStatusAndDate
extends CRM_Core_Page
{
39 protected $_participantListingID;
41 protected $_eventTitle;
45 function preProcess() {
46 $this->_id
= CRM_Utils_Request
::retrieve('id', 'Integer', $this, TRUE);
48 // ensure that there is a particpant type for this
49 $this->_participantListingID
= CRM_Core_DAO
::getFieldValue('CRM_Event_DAO_Event',
51 'participant_listing_id'
53 if (!$this->_participantListingID
) {
54 CRM_Core_Error
::fatal(ts("The Participant Listing feature is not currently enabled for this event."));
57 // retrieve Event Title and include it in page title
58 $this->_eventTitle
= CRM_Core_DAO
::getFieldValue('CRM_Event_DAO_Event',
62 CRM_Utils_System
::setTitle(ts('%1 - Participants', array(1 => $this->_eventTitle
)));
64 // we do not want to display recently viewed contacts since this is potentially a public page
65 $this->assign('displayRecent', FALSE);
73 INNER JOIN civicrm_participant ON civicrm_contact.id = civicrm_participant.contact_id
74 INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id
78 WHERE civicrm_event.id = %1";
80 $params = array(1 => array($this->_id
, 'Integer'));
81 $this->pager($fromClause, $whereClause, $params);
82 $orderBy = $this->orderBy();
84 list($offset, $rowCount) = $this->_pager
->getOffsetAndRowCount();
87 SELECT civicrm_contact.id as contact_id ,
88 civicrm_contact.display_name as name ,
89 civicrm_contact.sort_name as sort_name ,
90 civicrm_participant.id as participant_id,
91 civicrm_participant.status_id as status_id ,
92 civicrm_participant.register_date as register_date
96 LIMIT $offset, $rowCount";
99 $object = CRM_Core_DAO
::executeQuery($query, $params);
100 $statusLookup = CRM_Event_PseudoConstant
::participantStatus();
101 while ($object->fetch()) {
103 'id' => $object->contact_id
,
104 'participantID' => $object->participant_id
,
105 'name' => $object->name
,
106 'email' => $object->email
,
107 'status' => CRM_Utils_Array
::value($object->status_id
,
110 'date' => $object->register_date
,
114 $this->assign_by_ref('rows', $rows);
116 return parent
::run();
119 function pager($fromClause, $whereClause, $whereParams) {
123 $params['status'] = ts('Group') . ' %%StatusMessage%%';
124 $params['csvString'] = NULL;
125 $params['buttonTop'] = 'PagerTopButton';
126 $params['buttonBottom'] = 'PagerBottomButton';
127 $params['rowCount'] = $this->get(CRM_Utils_Pager
::PAGE_ROWCOUNT
);
128 if (!$params['rowCount']) {
129 $params['rowCount'] = CRM_Utils_Pager
::ROWCOUNT
;
133 SELECT count( civicrm_contact.id )
137 $params['total'] = CRM_Core_DAO
::singleValueQuery($query, $whereParams);
138 $this->_pager
= new CRM_Utils_Pager($params);
139 $this->assign_by_ref('pager', $this->_pager
);
143 static $headers = NULL;
146 $headers[1] = array('name' => ts('Name'),
147 'sort' => 'civicrm_contact.sort_name',
148 'direction' => CRM_Utils_Sort
::ASCENDING
,
150 $headers[2] = array('name' => ts('Status'),
151 'sort' => 'civicrm_participant.status_id',
152 'direction' => CRM_Utils_Sort
::DONTCARE
,
154 $headers[3] = array('name' => ts('Register Date'),
155 'sort' => 'civicrm_participant.register_date',
156 'direction' => CRM_Utils_Sort
::DONTCARE
,
160 if ($this->get(CRM_Utils_Sort
::SORT_ID
)) {
161 $sortID = CRM_Utils_Sort
::sortIDValue($this->get(CRM_Utils_Sort
::SORT_ID
),
162 $this->get(CRM_Utils_Sort
::SORT_DIRECTION
)
165 $sort = new CRM_Utils_Sort($headers, $sortID);
166 $this->assign_by_ref('headers', $headers);
167 $this->assign_by_ref('sort', $sort);
168 $this->set(CRM_Utils_Sort
::SORT_ID
,
169 $sort->getCurrentSortID()
171 $this->set(CRM_Utils_Sort
::SORT_DIRECTION
,
172 $sort->getCurrentSortDirection()
175 return $sort->orderBy();