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
19 * This class is for building event(participation) block on user dashboard
21 class CRM_Event_Page_UserDashboard
extends CRM_Contact_Page_View_UserDashBoard
{
24 * List participations for the UF user.
27 public function listParticipations() {
30 $participants = \Civi\Api4\Participant
::get(FALSE)
31 ->addSelect('id', 'contact_id', 'status_id:name', 'status_id:label', 'event_id', 'event_id.title', 'event_id.start_date', 'event_id.end_date')
32 ->addWhere('contact_id', '=', $this->_contactId
)
33 ->addOrderBy('event_id.start_date', 'DESC')
37 // Flatten the results in the format expected by the template
38 foreach ($participants as $p) {
39 $p['participant_id'] = $p['id'];
40 $p['status'] = $p['status_id:name'];
41 $p['participant_status'] = $p['status_id:label'];
42 $p['event_id'] = $p['event_id'];
43 $p['event_title'] = $p['event_id.title'];
44 $p['event_start_date'] = $p['event_id.start_date'];
45 $p['event_end_date'] = $p['event_id.end_date'];
50 $this->assign('event_rows', $event_rows);
54 * the main function that is called when the page
55 * loads, it decides the which action has to be taken for the page.
58 public function run() {
60 $this->listParticipations();