[REF] Preliminary cleanup for #17339
[civicrm-core.git] / CRM / Event / Page / DashBoard.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * This is page is for Event Dashboard
14 */
15 class CRM_Event_Page_DashBoard extends CRM_Core_Page {
16
17 /**
18 * Heart of the viewing process. The runner gets all the meta data for
19 * the contact and calls the appropriate type of page to view.
20 *
21 * @return void
22 */
23 public function preProcess() {
24 CRM_Utils_System::setTitle(ts('CiviEvent'));
25
26 $eventSummary = CRM_Event_BAO_Event::getEventSummary();
27 $eventSummary['tab'] = CRM_Event_Page_ManageEvent::tabs();
28
29 $actionColumn = FALSE;
30 if (!empty($eventSummary) &&
31 isset($eventSummary['events']) &&
32 is_array($eventSummary['events'])
33 ) {
34 foreach ($eventSummary['events'] as $e) {
35 if (isset($e['isMap']) || isset($e['configure'])) {
36 $actionColumn = TRUE;
37 break;
38 }
39 }
40 }
41
42 $this->assign('actionColumn', $actionColumn);
43 $this->assign('eventSummary', $eventSummary);
44 $this->assign('iCal', CRM_Event_BAO_Event::getICalLinks());
45 }
46
47 /**
48 * the main function that is called when the page loads,
49 * it decides the which action has to be taken for the page.
50 *
51 * @return null
52 */
53 public function run() {
54 $this->preProcess();
55
56 $controller = new CRM_Core_Controller_Simple('CRM_Event_Form_Search', ts('events'), NULL);
57 $controller->setEmbedded(TRUE);
58 $controller->reset();
59 $controller->set('limit', 10);
60 $controller->set('force', 1);
61 $controller->set('context', 'dashboard');
62 $controller->process();
63 $controller->run();
64
65 return parent::run();
66 }
67
68 }