Merge pull request #11949 from magnolia61/Hide_waitinglist_for_past_and_registration_...
[civicrm-core.git] / CRM / Event / Info.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
fee14197 4 | CiviCRM version 5 |
6a488035 5 +--------------------------------------------------------------------+
8c9251b3 6 | Copyright CiviCRM LLC (c) 2004-2018 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
27
28/**
29 * This class introduces component to the system and provides all the
30 * information about it. It needs to extend CRM_Core_Component_Info
31 * abstract class.
32 *
33 * @package CRM
8c9251b3 34 * @copyright CiviCRM LLC (c) 2004-2018
6a488035
TO
35 * $Id$
36 *
37 */
38class CRM_Event_Info extends CRM_Core_Component_Info {
39
e7c15cb6
CW
40 /**
41 * @inheritDoc
42 */
6a488035
TO
43 protected $keyword = 'event';
44
0cf587a7 45 /**
e7c15cb6 46 * @inheritDoc
0cf587a7
EM
47 * @return array
48 */
6a488035
TO
49 public function getInfo() {
50 return array(
51 'name' => 'CiviEvent',
52 'translatedName' => ts('CiviEvent'),
53 'title' => ts('CiviCRM Event Engine'),
54 'search' => 1,
55 'showActivitiesInCore' => 1,
56 );
57 }
58
0cf587a7 59 /**
e7c15cb6 60 * @inheritDoc
0cf587a7 61 * @param bool $getAllUnconditionally
221b21b4
AH
62 * @param bool $descriptions
63 * Whether to return permission descriptions
0cf587a7
EM
64 *
65 * @return array
66 */
221b21b4
AH
67 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
68 $permissions = array(
69 'access CiviEvent' => array(
70 ts('access CiviEvent'),
71 ts('Create events, view all events, and view participant records (for visible contacts)'),
72 ),
73 'edit event participants' => array(
74 ts('edit event participants'),
75 ts('Record and update backend event registrations'),
76 ),
77 'edit all events' => array(
78 ts('edit all events'),
79 ts('Edit events even without specific ACL granted'),
80 ),
81 'register for events' => array(
82 ts('register for events'),
83 ts('Register for events online'),
84 ),
85 'view event info' => array(
86 ts('view event info'),
87 ts('View online event information pages'),
88 ),
89 'view event participants' => array(
90 ts('view event participants'),
91 ),
92 'delete in CiviEvent' => array(
93 ts('delete in CiviEvent'),
94 ts('Delete participants and events that you can edit'),
95 ),
bcbb2167 96 'manage event profiles' => array(
97 ts('manage event profiles'),
98 ts('Allow users to create, edit and copy event-related profile forms used for online event registration.'),
99 ),
6a488035 100 );
221b21b4
AH
101
102 if (!$descriptions) {
103 foreach ($permissions as $name => $attr) {
104 $permissions[$name] = array_shift($attr);
105 }
106 }
107
108 return $permissions;
6a488035
TO
109 }
110
0cf587a7
EM
111 /**
112 * @return array
113 */
81bb85ea
AC
114 public function getAnonymousPermissionWarnings() {
115 return array(
116 'access CiviEvent',
117 );
118 }
119
0cf587a7 120 /**
e7c15cb6 121 * @inheritDoc
0cf587a7
EM
122 * @return array
123 */
6a488035 124 public function getUserDashboardElement() {
6ea503d4
TO
125 return array(
126 'name' => ts('Events'),
6a488035
TO
127 'title' => ts('Your Event(s)'),
128 'perm' => array('register for events'),
129 'weight' => 20,
130 );
131 }
132
0cf587a7 133 /**
e7c15cb6 134 * @inheritDoc
0cf587a7
EM
135 * @return array
136 */
6a488035 137 public function registerTab() {
6ea503d4
TO
138 return array(
139 'title' => ts('Events'),
6a488035
TO
140 'id' => 'participant',
141 'url' => 'participant',
142 'weight' => 40,
143 );
144 }
145
0cf587a7 146 /**
e7c15cb6 147 * @inheritDoc
0cf587a7
EM
148 * @return array
149 */
6a488035 150 public function registerAdvancedSearchPane() {
6ea503d4
TO
151 return array(
152 'title' => ts('Events'),
6a488035
TO
153 'weight' => 40,
154 );
155 }
156
0cf587a7 157 /**
e7c15cb6 158 * @inheritDoc
0cf587a7
EM
159 * @return array
160 */
6a488035
TO
161 public function getActivityTypes() {
162 $types = array();
6ea503d4
TO
163 $types['Event'] = array(
164 'title' => ts('Event'),
6a488035
TO
165 'callback' => 'CRM_Event_Page_EventInfo::run()',
166 );
167 return $types;
168 }
169
0cf587a7 170 /**
fe482240 171 * add shortcut to Create New.
0cf587a7
EM
172 * @param $shortCuts
173 * @param $newCredit
174 */
6a488035
TO
175 public function creatNewShortcut(&$shortCuts, $newCredit) {
176 if (CRM_Core_Permission::check('access CiviEvent') &&
177 CRM_Core_Permission::check('edit event participants')
178 ) {
6b5ca1ea 179 $shortCut[] = array(
180 'path' => 'civicrm/participant/add',
181 'query' => "reset=1&action=add&context=standalone",
182 'ref' => 'new-participant',
183 'title' => ts('Event Registration'),
184 );
6a488035
TO
185 if ($newCredit) {
186 $title = ts('Event Registration') . '<br />&nbsp;&nbsp;(' . ts('credit card') . ')';
6b5ca1ea 187 $shortCut[0]['shortCuts'][] = array(
188 'path' => 'civicrm/participant/add',
189 'query' => "reset=1&action=add&context=standalone&mode=live",
190 'ref' => 'new-participant-cc',
191 'title' => $title,
192 );
6a488035 193 }
6b5ca1ea 194 $shortCuts = array_merge($shortCuts, $shortCut);
6a488035
TO
195 }
196 }
96025800 197
6a488035 198}