| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | CiviCRM version 4.7 | |
| 5 | +--------------------------------------------------------------------+ |
| 6 | | Copyright CiviCRM LLC (c) 2004-2016 | |
| 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-2016 |
| 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' => '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 | 'administer private reports' => array( |
| 91 | ts('administer private reports'), |
| 92 | ts('Edit all private reports'), |
| 93 | ), |
| 94 | 'administer reserved reports' => array( |
| 95 | ts('administer reserved reports'), |
| 96 | ts('Edit all reports that have been marked as reserved'), |
| 97 | ), |
| 98 | 'administer Reports' => array( |
| 99 | ts('administer Reports'), |
| 100 | ts('Manage report templates'), |
| 101 | ), |
| 102 | 'view report sql' => array( |
| 103 | ts('view report sql'), |
| 104 | ts('View sql used in CiviReports'), |
| 105 | ), |
| 106 | ); |
| 107 | |
| 108 | if (!$descriptions) { |
| 109 | foreach ($permissions as $name => $attr) { |
| 110 | $permissions[$name] = array_shift($attr); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | return $permissions; |
| 115 | } |
| 116 | |
| 117 | |
| 118 | /** |
| 119 | * @inheritDoc |
| 120 | * Provides information about user dashboard element |
| 121 | * offered by this component. |
| 122 | * |
| 123 | * @return array|null |
| 124 | * collection of required dashboard settings, |
| 125 | * null if no element offered |
| 126 | */ |
| 127 | public function getUserDashboardElement() { |
| 128 | // no dashboard element for this component |
| 129 | return NULL; |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * Provides component's user dashboard page object. |
| 134 | * |
| 135 | * @return mixed |
| 136 | * component's User Dashboard applet object |
| 137 | */ |
| 138 | /** |
| 139 | * @return mixed |
| 140 | */ |
| 141 | public function getUserDashboardObject() { |
| 142 | // no dashboard element for this component |
| 143 | return NULL; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * @inheritDoc |
| 148 | * Provides information about user dashboard element |
| 149 | * offered by this component. |
| 150 | * |
| 151 | * @return array|null |
| 152 | * collection of required dashboard settings, |
| 153 | * null if no element offered |
| 154 | */ |
| 155 | /** |
| 156 | * @return array|null |
| 157 | */ |
| 158 | public function registerTab() { |
| 159 | // this component doesn't use contact record tabs |
| 160 | return NULL; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * @inheritDoc |
| 165 | * Provides information about advanced search pane |
| 166 | * offered by this component. |
| 167 | * |
| 168 | * @return array|null |
| 169 | * collection of required pane settings, |
| 170 | * null if no element offered |
| 171 | */ |
| 172 | /** |
| 173 | * @return array|null |
| 174 | */ |
| 175 | public function registerAdvancedSearchPane() { |
| 176 | // this component doesn't use advanced search |
| 177 | return NULL; |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * @inheritDoc |
| 182 | * Provides potential activity types that this |
| 183 | * component might want to register in activity history. |
| 184 | * Needs to be implemented in component's information |
| 185 | * class. |
| 186 | * |
| 187 | * @return array|null |
| 188 | * collection of activity types |
| 189 | */ |
| 190 | /** |
| 191 | * @return array|null |
| 192 | */ |
| 193 | public function getActivityTypes() { |
| 194 | return NULL; |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * add shortcut to Create New. |
| 199 | * @param $shortCuts |
| 200 | */ |
| 201 | public function creatNewShortcut(&$shortCuts) { |
| 202 | } |
| 203 | |
| 204 | } |