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