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