Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06b69b18 | 4 | | CiviCRM version 4.5 | |
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 | +--------------------------------------------------------------------+ | |
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 | * @package CRM | |
06b69b18 | 34 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
35 | * $Id$ |
36 | * | |
37 | */ | |
38 | class CRM_Contribute_Info extends CRM_Core_Component_Info { | |
39 | ||
40 | ||
41 | // docs inherited from interface | |
42 | protected $keyword = 'contribute'; | |
43 | ||
44 | // docs inherited from interface | |
186c9c17 EM |
45 | /** |
46 | * Provides base information about the component. | |
47 | * Needs to be implemented in component's information | |
48 | * class. | |
49 | * | |
50 | * @return array collection of required component settings | |
51 | * @access public | |
52 | * | |
53 | */ | |
54 | /** | |
55 | * @return array | |
56 | */ | |
6a488035 TO |
57 | public function getInfo() { |
58 | return array( | |
59 | 'name' => 'CiviContribute', | |
60 | 'translatedName' => ts('CiviContribute'), | |
61 | 'title' => ts('CiviCRM Contribution Engine'), | |
62 | 'search' => 1, | |
63 | 'showActivitiesInCore' => 1, | |
64 | ); | |
65 | } | |
66 | ||
67 | // docs inherited from interface | |
186c9c17 EM |
68 | /** |
69 | * Provides permissions that are used by component. | |
70 | * Needs to be implemented in component's information | |
71 | * class. | |
72 | * | |
73 | * NOTE: if using conditionally permission return, | |
74 | * implementation of $getAllUnconditionally is required. | |
75 | * | |
76 | * @param bool $getAllUnconditionally | |
77 | * | |
78 | * @return array|null collection of permissions, null if none | |
79 | * @access public | |
80 | */ | |
81 | /** | |
82 | * @param bool $getAllUnconditionally | |
83 | * | |
84 | * @return array|null | |
85 | */ | |
33777e4a | 86 | public function getPermissions($getAllUnconditionally = FALSE) { |
6a488035 TO |
87 | return array( |
88 | 'access CiviContribute', | |
89 | 'edit contributions', | |
90 | 'make online contributions', | |
91 | 'delete in CiviContribute', | |
92 | ); | |
93 | } | |
94 | ||
186c9c17 EM |
95 | /** |
96 | * Provides permissions that are unwise for Anonymous Roles to have | |
97 | * | |
98 | * @return array list of permissions | |
99 | * @see CRM_Component_Info::getPermissions | |
100 | */ | |
101 | /** | |
102 | * @return array | |
103 | */ | |
81bb85ea AC |
104 | public function getAnonymousPermissionWarnings() { |
105 | return array( | |
106 | 'access CiviContribute', | |
107 | ); | |
108 | } | |
6a488035 TO |
109 | |
110 | // docs inherited from interface | |
186c9c17 EM |
111 | /** |
112 | * Provides information about user dashboard element | |
113 | * offered by this component. | |
114 | * | |
115 | * @return array|null collection of required dashboard settings, | |
116 | * null if no element offered | |
117 | * @access public | |
118 | * | |
119 | */ | |
120 | /** | |
121 | * @return array|null | |
122 | */ | |
6a488035 TO |
123 | public function getUserDashboardElement() { |
124 | return array('name' => ts('Contributions'), | |
125 | 'title' => ts('Your Contribution(s)'), | |
126 | 'perm' => array('make online contributions'), | |
127 | 'weight' => 10, | |
128 | ); | |
129 | } | |
130 | ||
131 | // docs inherited from interface | |
186c9c17 EM |
132 | /** |
133 | * Provides information about user dashboard element | |
134 | * offered by this component. | |
135 | * | |
136 | * @return array|null collection of required dashboard settings, | |
137 | * null if no element offered | |
138 | * @access public | |
139 | * | |
140 | */ | |
141 | /** | |
142 | * @return array|null | |
143 | */ | |
6a488035 TO |
144 | public function registerTab() { |
145 | return array('title' => ts('Contributions'), | |
146 | 'url' => 'contribution', | |
147 | 'weight' => 20, | |
148 | ); | |
149 | } | |
150 | ||
151 | // docs inherited from interface | |
186c9c17 EM |
152 | /** |
153 | * Provides information about advanced search pane | |
154 | * offered by this component. | |
155 | * | |
156 | * @return array|null collection of required pane settings, | |
157 | * null if no element offered | |
158 | * @access public | |
159 | * | |
160 | */ | |
161 | /** | |
162 | * @return array|null | |
163 | */ | |
6a488035 | 164 | public function registerAdvancedSearchPane() { |
a91e698a | 165 | return array( |
166 | 'title' => ts('Contributions'), | |
6a488035 TO |
167 | 'weight' => 20, |
168 | ); | |
169 | } | |
170 | ||
171 | // docs inherited from interface | |
186c9c17 EM |
172 | /** |
173 | * Provides potential activity types that this | |
174 | * component might want to register in activity history. | |
175 | * Needs to be implemented in component's information | |
176 | * class. | |
177 | * | |
178 | * @return array|null collection of activity types | |
179 | * @access public | |
180 | * | |
181 | */ | |
182 | /** | |
183 | * @return array|null | |
184 | */ | |
6a488035 TO |
185 | public function getActivityTypes() { |
186 | return NULL; | |
187 | } | |
188 | ||
189 | // add shortcut to Create New | |
186c9c17 EM |
190 | /** |
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 /> (' . 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 | } | |
216 | } | |
217 |