3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * This class introduces component to the system and provides all the
30 * information about it. It needs to extend CRM_Core_Component_Info
34 * @copyright CiviCRM LLC (c) 2004-2019
36 class CRM_Contribute_Info
extends CRM_Core_Component_Info
{
43 protected $keyword = 'contribute';
47 * Provides base information about the component.
48 * Needs to be implemented in component's information
52 * collection of required component settings
58 public function getInfo() {
60 'name' => 'CiviContribute',
61 'translatedName' => ts('CiviContribute'),
62 'title' => ts('CiviCRM Contribution Engine'),
64 'showActivitiesInCore' => 1,
70 * Provides permissions that are used by component.
71 * Needs to be implemented in component's information
74 * NOTE: if using conditionally permission return,
75 * implementation of $getAllUnconditionally is required.
77 * @param bool $getAllUnconditionally
78 * @param bool $descriptions
79 * Whether to return permission descriptions
82 * collection of permissions, null if none
84 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
86 'access CiviContribute' => [
87 ts('access CiviContribute'),
88 ts('Record backend contributions (with edit contributions) and view all contributions (for visible contacts)'),
90 'edit contributions' => [
91 ts('edit contributions'),
92 ts('Record and update contributions'),
94 'make online contributions' => [
95 ts('make online contributions'),
97 'delete in CiviContribute' => [
98 ts('delete in CiviContribute'),
99 ts('Delete contributions'),
103 if (!$descriptions) {
104 foreach ($permissions as $name => $attr) {
105 $permissions[$name] = array_shift($attr);
113 * Provides permissions that are unwise for Anonymous Roles to have.
116 * list of permissions
117 * @see CRM_Component_Info::getPermissions
123 public function getAnonymousPermissionWarnings() {
125 'access CiviContribute',
131 * Provides information about user dashboard element
132 * offered by this component.
135 * collection of required dashboard settings,
136 * null if no element offered
142 public function getUserDashboardElement() {
144 'name' => ts('Contributions'),
145 'title' => ts('Your Contribution(s)'),
146 'perm' => ['make online contributions'],
153 * Provides information about user dashboard element
154 * offered by this component.
157 * collection of required dashboard settings,
158 * null if no element offered
164 public function registerTab() {
166 'title' => ts('Contributions'),
167 'url' => 'contribution',
176 public function getIcon() {
177 return 'crm-i fa-credit-card';
182 * Provides information about advanced search pane
183 * offered by this component.
186 * collection of required pane settings,
187 * null if no element offered
193 public function registerAdvancedSearchPane() {
195 'title' => ts('Contributions'),
202 * Provides potential activity types that this
203 * component might want to register in activity history.
204 * Needs to be implemented in component's information
208 * collection of activity types
214 public function getActivityTypes() {
219 * add shortcut to Create New.
223 public function creatNewShortcut(&$shortCuts, $newCredit) {
224 if (CRM_Core_Permission
::check('access CiviContribute') &&
225 CRM_Core_Permission
::check('edit contributions')
228 'path' => 'civicrm/contribute/add',
229 'query' => "reset=1&action=add&context=standalone",
230 'ref' => 'new-contribution',
231 'title' => ts('Contribution'),
234 $title = ts('Contribution') . '<br /> (' . ts('credit card') . ')';
235 $shortCut[0]['shortCuts'][] = [
236 'path' => 'civicrm/contribute/add',
237 'query' => "reset=1&action=add&context=standalone&mode=live",
238 'ref' => 'new-contribution-cc',
242 $shortCuts = array_merge($shortCuts, $shortCut);