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 | ||
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 | |
6a488035 | 30 | */ |
00be9182 | 31 | public function preProcess() { |
6a488035 TO |
32 | CRM_Utils_System::setTitle(ts('CiviEvent')); |
33 | ||
34 | $eventSummary = CRM_Event_BAO_Event::getEventSummary(); | |
aaffa79f | 35 | $enableCart = Civi::settings()->get('enable_cart'); |
d7d7d5ab | 36 | $eventSummary['tab'] = CRM_Event_Page_ManageEvent::tabs($enableCart); |
6a488035 TO |
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 | /** | |
dc195289 | 56 | * the main function that is called when the page loads, |
6a488035 TO |
57 | * it decides the which action has to be taken for the page. |
58 | * | |
76e7a76c | 59 | * @return null |
6a488035 | 60 | */ |
00be9182 | 61 | public function run() { |
6a488035 TO |
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 | } | |
96025800 | 75 | |
6a488035 | 76 | } |