CRM-16808 standardisation of paypal express
[civicrm-core.git] / CRM / Pledge / Info.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
6a488035 5 +--------------------------------------------------------------------+
e7112fa7 6 | Copyright CiviCRM LLC (c) 2004-2015 |
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 *
33 * @package CRM
e7112fa7 34 * @copyright CiviCRM LLC (c) 2004-2015
6a488035
TO
35 * $Id$
36 *
37 */
38class CRM_Pledge_Info extends CRM_Core_Component_Info {
39
e7c15cb6
CW
40 /**
41 * @inheritDoc
42 */
6a488035
TO
43 protected $keyword = 'pledge';
44
ffd93213
EM
45 /**
46 * Provides base information about the component.
47 * Needs to be implemented in component's information
48 * class.
49 *
a6c01b45
CW
50 * @return array
51 * collection of required component settings
ffd93213 52 */
6a488035
TO
53 public function getInfo() {
54 return array(
55 'name' => 'CiviPledge',
56 'translatedName' => ts('CiviPledge'),
57 'title' => ts('CiviCRM Pledge Engine'),
58 'search' => 1,
59 'showActivitiesInCore' => 1,
60 );
61 }
62
63
ffd93213 64 /**
e7c15cb6 65 * @inheritDoc
ffd93213
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
ffd93213 76 *
72b3a70c
CW
77 * @return array|null
78 * collection of permissions, null if none
ffd93213 79 */
221b21b4
AH
80 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
81 $permissions = array(
82 'access CiviPledge' => array(
83 ts('access CiviPledge'),
84 ts('View pledges'),
85 ),
86 'edit pledges' => array(
87 ts('edit pledges'),
88 ts('Create and update pledges'),
89 ),
90 'delete in CiviPledge' => array(
91 ts('delete in CiviPledge'),
92 ts('Delete pledges'),
93 ),
6a488035 94 );
221b21b4
AH
95
96 if (!$descriptions) {
97 foreach ($permissions as $name => $attr) {
98 $permissions[$name] = array_shift($attr);
99 }
100 }
101
102 return $permissions;
6a488035
TO
103 }
104
ffd93213 105 /**
e7c15cb6 106 * @inheritDoc
ffd93213
EM
107 * Provides information about user dashboard element
108 * offered by this component.
109 *
72b3a70c
CW
110 * @return array|null
111 * collection of required dashboard settings,
ffd93213 112 * null if no element offered
ffd93213
EM
113 */
114 /**
115 * @return array|null
116 */
6a488035 117 public function getUserDashboardElement() {
098201d8 118 return array(
353ffa53 119 'name' => ts('Pledges'),
6a488035
TO
120 'title' => ts('Your Pledge(s)'),
121 // we need to check this permission since you can click on contribution page link for making payment
122 'perm' => array('make online contributions'),
123 'weight' => 15,
124 );
125 }
126
ffd93213 127 /**
e7c15cb6 128 * @inheritDoc
ffd93213
EM
129 * Provides information about user dashboard element
130 * offered by this component.
131 *
72b3a70c
CW
132 * @return array|null
133 * collection of required dashboard settings,
ffd93213 134 * null if no element offered
ffd93213
EM
135 */
136 /**
137 * @return array|null
138 */
6a488035 139 public function registerTab() {
098201d8 140 return array(
353ffa53 141 'title' => ts('Pledges'),
6a488035
TO
142 'url' => 'pledge',
143 'weight' => 25,
144 );
145 }
146
ffd93213 147 /**
e7c15cb6 148 * @inheritDoc
ffd93213
EM
149 * Provides information about advanced search pane
150 * offered by this component.
151 *
72b3a70c
CW
152 * @return array|null
153 * collection of required pane settings,
ffd93213 154 * null if no element offered
ffd93213
EM
155 */
156 /**
157 * @return array|null
158 */
6a488035 159 public function registerAdvancedSearchPane() {
098201d8 160 return array(
353ffa53 161 'title' => ts('Pledges'),
6a488035
TO
162 'weight' => 25,
163 );
164 }
165
ffd93213 166 /**
e7c15cb6 167 * @inheritDoc
ffd93213
EM
168 * Provides potential activity types that this
169 * component might want to register in activity history.
170 * Needs to be implemented in component's information
171 * class.
172 *
72b3a70c
CW
173 * @return array|null
174 * collection of activity types
ffd93213
EM
175 */
176 /**
177 * @return array|null
178 */
6a488035
TO
179 public function getActivityTypes() {
180 return NULL;
181 }
182
ffd93213 183 /**
fe482240 184 * add shortcut to Create New.
ffd93213
EM
185 * @param $shortCuts
186 */
6a488035
TO
187 public function creatNewShortcut(&$shortCuts) {
188 if (CRM_Core_Permission::check('access CiviPledge') &&
189 CRM_Core_Permission::check('edit pledges')
190 ) {
191 $shortCuts = array_merge($shortCuts, array(
098201d8 192 array(
353ffa53
TO
193 'path' => 'civicrm/pledge/add',
194 'query' => 'reset=1&action=add&context=standalone',
195 'ref' => 'new-pledge',
196 'title' => ts('Pledge'),
c301f76e 197 ),
353ffa53 198 ));
6a488035
TO
199 }
200 }
96025800 201
6a488035 202}