Commit | Line | Data |
---|---|---|
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 | +--------------------------------------------------------------------+ | |
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 | |
186c9c17 EM |
51 | * |
52 | */ | |
53 | /** | |
54 | * @return array | |
55 | */ | |
6a488035 TO |
56 | public function getInfo() { |
57 | return array( | |
58 | 'name' => 'CiviContribute', | |
59 | 'translatedName' => ts('CiviContribute'), | |
60 | 'title' => ts('CiviCRM Contribution Engine'), | |
61 | 'search' => 1, | |
62 | 'showActivitiesInCore' => 1, | |
63 | ); | |
64 | } | |
65 | ||
66 | // docs inherited from interface | |
186c9c17 EM |
67 | /** |
68 | * Provides permissions that are used by component. | |
69 | * Needs to be implemented in component's information | |
70 | * class. | |
71 | * | |
72 | * NOTE: if using conditionally permission return, | |
73 | * implementation of $getAllUnconditionally is required. | |
74 | * | |
75 | * @param bool $getAllUnconditionally | |
76 | * | |
77 | * @return array|null collection of permissions, null if none | |
186c9c17 EM |
78 | */ |
79 | /** | |
80 | * @param bool $getAllUnconditionally | |
81 | * | |
82 | * @return array|null | |
83 | */ | |
33777e4a | 84 | public function getPermissions($getAllUnconditionally = FALSE) { |
6a488035 TO |
85 | return array( |
86 | 'access CiviContribute', | |
87 | 'edit contributions', | |
88 | 'make online contributions', | |
89 | 'delete in CiviContribute', | |
90 | ); | |
91 | } | |
92 | ||
186c9c17 EM |
93 | /** |
94 | * Provides permissions that are unwise for Anonymous Roles to have | |
95 | * | |
96 | * @return array list of permissions | |
97 | * @see CRM_Component_Info::getPermissions | |
98 | */ | |
99 | /** | |
100 | * @return array | |
101 | */ | |
81bb85ea AC |
102 | public function getAnonymousPermissionWarnings() { |
103 | return array( | |
104 | 'access CiviContribute', | |
105 | ); | |
106 | } | |
6a488035 TO |
107 | |
108 | // docs inherited from interface | |
186c9c17 EM |
109 | /** |
110 | * Provides information about user dashboard element | |
111 | * offered by this component. | |
112 | * | |
113 | * @return array|null collection of required dashboard settings, | |
114 | * null if no element offered | |
186c9c17 EM |
115 | * |
116 | */ | |
117 | /** | |
118 | * @return array|null | |
119 | */ | |
6a488035 TO |
120 | public function getUserDashboardElement() { |
121 | return array('name' => ts('Contributions'), | |
122 | 'title' => ts('Your Contribution(s)'), | |
123 | 'perm' => array('make online contributions'), | |
124 | 'weight' => 10, | |
125 | ); | |
126 | } | |
127 | ||
128 | // docs inherited from interface | |
186c9c17 EM |
129 | /** |
130 | * Provides information about user dashboard element | |
131 | * offered by this component. | |
132 | * | |
133 | * @return array|null collection of required dashboard settings, | |
134 | * null if no element offered | |
186c9c17 EM |
135 | * |
136 | */ | |
137 | /** | |
138 | * @return array|null | |
139 | */ | |
6a488035 TO |
140 | public function registerTab() { |
141 | return array('title' => ts('Contributions'), | |
142 | 'url' => 'contribution', | |
143 | 'weight' => 20, | |
144 | ); | |
145 | } | |
146 | ||
147 | // docs inherited from interface | |
186c9c17 EM |
148 | /** |
149 | * Provides information about advanced search pane | |
150 | * offered by this component. | |
151 | * | |
152 | * @return array|null collection of required pane settings, | |
153 | * null if no element offered | |
186c9c17 EM |
154 | * |
155 | */ | |
156 | /** | |
157 | * @return array|null | |
158 | */ | |
6a488035 | 159 | public function registerAdvancedSearchPane() { |
a91e698a | 160 | return array( |
161 | 'title' => ts('Contributions'), | |
6a488035 TO |
162 | 'weight' => 20, |
163 | ); | |
164 | } | |
165 | ||
166 | // docs inherited from interface | |
186c9c17 EM |
167 | /** |
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 | * | |
173 | * @return array|null collection of activity types | |
186c9c17 EM |
174 | * |
175 | */ | |
176 | /** | |
177 | * @return array|null | |
178 | */ | |
6a488035 TO |
179 | public function getActivityTypes() { |
180 | return NULL; | |
181 | } | |
182 | ||
183 | // add shortcut to Create New | |
186c9c17 EM |
184 | /** |
185 | * @param $shortCuts | |
186 | * @param $newCredit | |
187 | */ | |
6a488035 TO |
188 | public function creatNewShortcut(&$shortCuts, $newCredit) { |
189 | if (CRM_Core_Permission::check('access CiviContribute') && | |
190 | CRM_Core_Permission::check('edit contributions') | |
191 | ) { | |
6b5ca1ea | 192 | $shortCut[] = array( |
193 | 'path' => 'civicrm/contribute/add', | |
194 | 'query' => "reset=1&action=add&context=standalone", | |
195 | 'ref' => 'new-contribution', | |
196 | 'title' => ts('Contribution'), | |
197 | ); | |
6a488035 TO |
198 | if ($newCredit) { |
199 | $title = ts('Contribution') . '<br /> (' . ts('credit card') . ')'; | |
6b5ca1ea | 200 | $shortCut[0]['shortCuts'][] = array( |
201 | 'path' => 'civicrm/contribute/add', | |
202 | 'query' => "reset=1&action=add&context=standalone&mode=live", | |
203 | 'ref' => 'new-contribution-cc', | |
204 | 'title' => $title, | |
205 | ); | |
6a488035 | 206 | } |
6b5ca1ea | 207 | $shortCuts = array_merge($shortCuts, $shortCut); |
6a488035 TO |
208 | } |
209 | } | |
210 | } |