Merge pull request #21563 from eileenmcnaughton/ev_toke
[civicrm-core.git] / CRM / Report / Info.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 class introduces component to the system and provides all the
14 * information about it. It needs to extend CRM_Core_Component_Info
15 * abstract class.
16 *
17 * @copyright CiviCRM LLC https://civicrm.org/licensing
18 */
19 class CRM_Report_Info extends CRM_Core_Component_Info {
20
21 /**
22 * @var string
23 * @inheritDoc
24 */
25 protected $keyword = 'report';
26
27 /**
28 * @inheritDoc
29 * Provides base information about the component.
30 * Needs to be implemented in component's information
31 * class.
32 *
33 * @return array
34 * collection of required component settings
35 */
36 public function getInfo() {
37 return [
38 'name' => 'CiviReport',
39 'translatedName' => ts('CiviReport'),
40 'title' => ts('CiviCRM Report Engine'),
41 'search' => 0,
42 'showActivitiesInCore' => 1,
43 ];
44 }
45
46 /**
47 * @inheritDoc
48 * Provides permissions that are used by component.
49 * Needs to be implemented in component's information
50 * class.
51 *
52 * NOTE: if using conditionally permission return,
53 * implementation of $getAllUnconditionally is required.
54 *
55 * @param bool $getAllUnconditionally
56 * @param bool $descriptions
57 * Whether to return permission descriptions
58 *
59 * @return array|null
60 * collection of permissions, null if none
61 */
62 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
63 $permissions = [
64 'access CiviReport' => [
65 ts('access CiviReport'),
66 ts('View reports'),
67 ],
68 'access Report Criteria' => [
69 ts('access Report Criteria'),
70 ts('Change report search criteria'),
71 ],
72 'save Report Criteria' => [
73 ts('save Report Criteria'),
74 ts('Save report search criteria'),
75 ],
76 'administer private reports' => [
77 ts('administer private reports'),
78 ts('Edit all private reports'),
79 ],
80 'administer reserved reports' => [
81 ts('administer reserved reports'),
82 ts('Edit all reports that have been marked as reserved'),
83 ],
84 'administer Reports' => [
85 ts('administer Reports'),
86 ts('Manage report templates'),
87 ],
88 'view report sql' => [
89 ts('view report sql'),
90 ts('View sql used in CiviReports'),
91 ],
92 ];
93
94 if (!$descriptions) {
95 foreach ($permissions as $name => $attr) {
96 $permissions[$name] = array_shift($attr);
97 }
98 }
99
100 return $permissions;
101 }
102
103 /**
104 * @inheritDoc
105 * Provides information about user dashboard element
106 * offered by this component.
107 *
108 * @return array|null
109 * collection of required dashboard settings,
110 * null if no element offered
111 */
112 public function getUserDashboardElement() {
113 // no dashboard element for this component
114 return NULL;
115 }
116
117 /**
118 * Provides component's user dashboard page object.
119 *
120 * @return mixed
121 * component's User Dashboard applet object
122 */
123
124 /**
125 * @return mixed
126 */
127 public function getUserDashboardObject() {
128 // no dashboard element for this component
129 return NULL;
130 }
131
132 /**
133 * @inheritDoc
134 * Provides information about user dashboard element
135 * offered by this component.
136 *
137 * @return array|null
138 * collection of required dashboard settings,
139 * null if no element offered
140 */
141
142 /**
143 * @return array|null
144 */
145 public function registerTab() {
146 // this component doesn't use contact record tabs
147 return NULL;
148 }
149
150 /**
151 * @inheritDoc
152 * @return string
153 */
154 public function getIcon() {
155 return 'crm-i fa-table';
156 }
157
158 /**
159 * @inheritDoc
160 * Provides information about advanced search pane
161 * offered by this component.
162 *
163 * @return array|null
164 * collection of required pane settings,
165 * null if no element offered
166 */
167
168 /**
169 * @return array|null
170 */
171 public function registerAdvancedSearchPane() {
172 // this component doesn't use advanced search
173 return NULL;
174 }
175
176 /**
177 * @inheritDoc
178 * Provides potential activity types that this
179 * component might want to register in activity history.
180 * Needs to be implemented in component's information
181 * class.
182 *
183 * @return array|null
184 * collection of activity types
185 */
186
187 /**
188 * @return array|null
189 */
190 public function getActivityTypes() {
191 return NULL;
192 }
193
194 /**
195 * add shortcut to Create New.
196 * @param $shortCuts
197 */
198 public function creatNewShortcut(&$shortCuts) {
199 }
200
201 }