Dupe improve custom data handling
[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 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 * $Id$
17 *
18 */
19
20 /**
21 * This is page is for Event Dashboard
22 */
23 class CRM_Event_Page_DashBoard extends CRM_Core_Page {
24
25 /**
26 * Heart of the viewing process. The runner gets all the meta data for
27 * the contact and calls the appropriate type of page to view.
28 *
29 * @return void
30 */
31 public function preProcess() {
32 CRM_Utils_System::setTitle(ts('CiviEvent'));
33
34 $eventSummary = CRM_Event_BAO_Event::getEventSummary();
35 $enableCart = Civi::settings()->get('enable_cart');
36 $eventSummary['tab'] = CRM_Event_Page_ManageEvent::tabs($enableCart);
37
38 $actionColumn = FALSE;
39 if (!empty($eventSummary) &&
40 isset($eventSummary['events']) &&
41 is_array($eventSummary['events'])
42 ) {
43 foreach ($eventSummary['events'] as $e) {
44 if (isset($e['isMap']) || isset($e['configure'])) {
45 $actionColumn = TRUE;
46 break;
47 }
48 }
49 }
50
51 $this->assign('actionColumn', $actionColumn);
52 $this->assign('eventSummary', $eventSummary);
53 }
54
55 /**
56 * the main function that is called when the page loads,
57 * it decides the which action has to be taken for the page.
58 *
59 * @return null
60 */
61 public function run() {
62 $this->preProcess();
63
64 $controller = new CRM_Core_Controller_Simple('CRM_Event_Form_Search', ts('events'), NULL);
65 $controller->setEmbedded(TRUE);
66 $controller->reset();
67 $controller->set('limit', 10);
68 $controller->set('force', 1);
69 $controller->set('context', 'dashboard');
70 $controller->process();
71 $controller->run();
72
73 return parent::run();
74 }
75
76 }