Merge pull request #12691 from andrewpthompson/dev-core-343
[civicrm-core.git] / CRM / Report / Info.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
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-2018
34 * $Id$
35 *
36 */
37 class CRM_Report_Info extends CRM_Core_Component_Info {
38
39 /**
40 * @inheritDoc
41 */
42 protected $keyword = 'report';
43
44 /**
45 * @inheritDoc
46 * Provides base information about the component.
47 * Needs to be implemented in component's information
48 * class.
49 *
50 * @return array
51 * collection of required component settings
52 */
53 public function getInfo() {
54 return array(
55 'name' => 'CiviReport',
56 'translatedName' => ts('CiviReport'),
57 'title' => ts('CiviCRM Report Engine'),
58 'search' => 0,
59 'showActivitiesInCore' => 1,
60 );
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 = array(
82 'access CiviReport' => array(
83 ts('access CiviReport'),
84 ts('View reports'),
85 ),
86 'access Report Criteria' => array(
87 ts('access Report Criteria'),
88 ts('Change report search criteria'),
89 ),
90 'save Report Criteria' => array(
91 ts('save Report Criteria'),
92 ts('Save report search criteria'),
93 ),
94 'administer private reports' => array(
95 ts('administer private reports'),
96 ts('Edit all private reports'),
97 ),
98 'administer reserved reports' => array(
99 ts('administer reserved reports'),
100 ts('Edit all reports that have been marked as reserved'),
101 ),
102 'administer Reports' => array(
103 ts('administer Reports'),
104 ts('Manage report templates'),
105 ),
106 'view report sql' => array(
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 /**
123 * @inheritDoc
124 * Provides information about user dashboard element
125 * offered by this component.
126 *
127 * @return array|null
128 * collection of required dashboard settings,
129 * null if no element offered
130 */
131 public function getUserDashboardElement() {
132 // no dashboard element for this component
133 return NULL;
134 }
135
136 /**
137 * Provides component's user dashboard page object.
138 *
139 * @return mixed
140 * component's User Dashboard applet object
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 * @return array|null
161 */
162 public function registerTab() {
163 // this component doesn't use contact record tabs
164 return NULL;
165 }
166
167 /**
168 * @inheritDoc
169 * Provides information about advanced search pane
170 * offered by this component.
171 *
172 * @return array|null
173 * collection of required pane settings,
174 * null if no element offered
175 */
176 /**
177 * @return array|null
178 */
179 public function registerAdvancedSearchPane() {
180 // this component doesn't use advanced search
181 return NULL;
182 }
183
184 /**
185 * @inheritDoc
186 * Provides potential activity types that this
187 * component might want to register in activity history.
188 * Needs to be implemented in component's information
189 * class.
190 *
191 * @return array|null
192 * collection of activity types
193 */
194 /**
195 * @return array|null
196 */
197 public function getActivityTypes() {
198 return NULL;
199 }
200
201 /**
202 * add shortcut to Create New.
203 * @param $shortCuts
204 */
205 public function creatNewShortcut(&$shortCuts) {
206 }
207
208 }