Merge pull request #5232 from rohankatkar/batch9
[civicrm-core.git] / CRM / Contribute / Info.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
6a488035 5 +--------------------------------------------------------------------+
06b69b18 6 | Copyright CiviCRM LLC (c) 2004-2014 |
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
06b69b18 34 * @copyright CiviCRM LLC (c) 2004-2014
6a488035
TO
35 * $Id$
36 *
37 */
38class CRM_Contribute_Info extends CRM_Core_Component_Info {
39
40
e7c15cb6
CW
41 /**
42 * @inheritDoc
43 */
6a488035
TO
44 protected $keyword = 'contribute';
45
186c9c17 46 /**
e7c15cb6 47 * @inheritDoc
186c9c17
EM
48 * Provides base information about the component.
49 * Needs to be implemented in component's information
50 * class.
51 *
a6c01b45
CW
52 * @return array
53 * collection of required component settings
186c9c17
EM
54 */
55 /**
56 * @return array
57 */
6a488035
TO
58 public function getInfo() {
59 return array(
60 'name' => 'CiviContribute',
61 'translatedName' => ts('CiviContribute'),
62 'title' => ts('CiviCRM Contribution Engine'),
63 'search' => 1,
64 'showActivitiesInCore' => 1,
65 );
66 }
67
186c9c17 68 /**
e7c15cb6 69 * @inheritDoc
186c9c17
EM
70 * Provides permissions that are used by component.
71 * Needs to be implemented in component's information
72 * class.
73 *
74 * NOTE: if using conditionally permission return,
75 * implementation of $getAllUnconditionally is required.
76 *
77 * @param bool $getAllUnconditionally
78 *
72b3a70c
CW
79 * @return array|null
80 * collection of permissions, null if none
186c9c17
EM
81 */
82 /**
83 * @param bool $getAllUnconditionally
84 *
85 * @return array|null
86 */
33777e4a 87 public function getPermissions($getAllUnconditionally = FALSE) {
6a488035
TO
88 return array(
89 'access CiviContribute',
90 'edit contributions',
91 'make online contributions',
92 'delete in CiviContribute',
93 );
94 }
95
186c9c17 96 /**
fe482240 97 * Provides permissions that are unwise for Anonymous Roles to have.
186c9c17 98 *
a6c01b45
CW
99 * @return array
100 * list of permissions
186c9c17
EM
101 * @see CRM_Component_Info::getPermissions
102 */
103 /**
104 * @return array
105 */
81bb85ea
AC
106 public function getAnonymousPermissionWarnings() {
107 return array(
108 'access CiviContribute',
109 );
110 }
6a488035 111
186c9c17 112 /**
e7c15cb6 113 * @inheritDoc
186c9c17
EM
114 * Provides information about user dashboard element
115 * offered by this component.
116 *
72b3a70c
CW
117 * @return array|null
118 * collection of required dashboard settings,
186c9c17 119 * null if no element offered
186c9c17
EM
120 */
121 /**
122 * @return array|null
123 */
6a488035 124 public function getUserDashboardElement() {
874c9be7 125 return array(
353ffa53 126 'name' => ts('Contributions'),
6a488035
TO
127 'title' => ts('Your Contribution(s)'),
128 'perm' => array('make online contributions'),
129 'weight' => 10,
130 );
131 }
132
186c9c17 133 /**
e7c15cb6 134 * @inheritDoc
186c9c17
EM
135 * Provides information about user dashboard element
136 * offered by this component.
137 *
72b3a70c
CW
138 * @return array|null
139 * collection of required dashboard settings,
186c9c17 140 * null if no element offered
186c9c17
EM
141 */
142 /**
143 * @return array|null
144 */
6a488035 145 public function registerTab() {
874c9be7 146 return array(
353ffa53 147 'title' => ts('Contributions'),
6a488035
TO
148 'url' => 'contribution',
149 'weight' => 20,
150 );
151 }
152
186c9c17 153 /**
e7c15cb6 154 * @inheritDoc
186c9c17
EM
155 * Provides information about advanced search pane
156 * offered by this component.
157 *
72b3a70c
CW
158 * @return array|null
159 * collection of required pane settings,
186c9c17 160 * null if no element offered
186c9c17
EM
161 */
162 /**
163 * @return array|null
164 */
6a488035 165 public function registerAdvancedSearchPane() {
a91e698a 166 return array(
167 'title' => ts('Contributions'),
6a488035
TO
168 'weight' => 20,
169 );
170 }
171
186c9c17 172 /**
e7c15cb6 173 * @inheritDoc
186c9c17
EM
174 * Provides potential activity types that this
175 * component might want to register in activity history.
176 * Needs to be implemented in component's information
177 * class.
178 *
72b3a70c
CW
179 * @return array|null
180 * collection of activity types
186c9c17
EM
181 */
182 /**
183 * @return array|null
184 */
6a488035
TO
185 public function getActivityTypes() {
186 return NULL;
187 }
188
186c9c17 189 /**
fe482240 190 * add shortcut to Create New.
186c9c17
EM
191 * @param $shortCuts
192 * @param $newCredit
193 */
6a488035
TO
194 public function creatNewShortcut(&$shortCuts, $newCredit) {
195 if (CRM_Core_Permission::check('access CiviContribute') &&
196 CRM_Core_Permission::check('edit contributions')
197 ) {
6b5ca1ea 198 $shortCut[] = array(
199 'path' => 'civicrm/contribute/add',
200 'query' => "reset=1&action=add&context=standalone",
201 'ref' => 'new-contribution',
202 'title' => ts('Contribution'),
203 );
6a488035
TO
204 if ($newCredit) {
205 $title = ts('Contribution') . '<br />&nbsp;&nbsp;(' . ts('credit card') . ')';
6b5ca1ea 206 $shortCut[0]['shortCuts'][] = array(
207 'path' => 'civicrm/contribute/add',
208 'query' => "reset=1&action=add&context=standalone&mode=live",
209 'ref' => 'new-contribution-cc',
210 'title' => $title,
211 );
6a488035 212 }
6b5ca1ea 213 $shortCuts = array_merge($shortCuts, $shortCut);
6a488035
TO
214 }
215 }
96025800 216
6a488035 217}