Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-02-02-18-36-16
[civicrm-core.git] / CRM / Pledge / Info.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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
34 * @copyright CiviCRM LLC (c) 2004-2014
35 * $Id$
36 *
37 */
38 class CRM_Pledge_Info extends CRM_Core_Component_Info {
39
40 /**
41 * @inheritDoc
42 */
43 protected $keyword = 'pledge';
44
45 /**
46 * Provides base information about the component.
47 * Needs to be implemented in component's information
48 * class.
49 *
50 * @return array
51 * collection of required component settings
52 */
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
64 /**
65 * @inheritDoc
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
74 *
75 * @return array|null
76 * collection of permissions, null if none
77 */
78 /**
79 * @param bool $getAllUnconditionally
80 *
81 * @return array|null
82 */
83 public function getPermissions($getAllUnconditionally = FALSE) {
84 return array(
85 'access CiviPledge',
86 'edit pledges',
87 'delete in CiviPledge',
88 );
89 }
90
91 /**
92 * @inheritDoc
93 * Provides information about user dashboard element
94 * offered by this component.
95 *
96 * @return array|null
97 * collection of required dashboard settings,
98 * null if no element offered
99 */
100 /**
101 * @return array|null
102 */
103 public function getUserDashboardElement() {
104 return array(
105 'name' => ts('Pledges'),
106 'title' => ts('Your Pledge(s)'),
107 // we need to check this permission since you can click on contribution page link for making payment
108 'perm' => array('make online contributions'),
109 'weight' => 15,
110 );
111 }
112
113 /**
114 * @inheritDoc
115 * Provides information about user dashboard element
116 * offered by this component.
117 *
118 * @return array|null
119 * collection of required dashboard settings,
120 * null if no element offered
121 */
122 /**
123 * @return array|null
124 */
125 public function registerTab() {
126 return array(
127 'title' => ts('Pledges'),
128 'url' => 'pledge',
129 'weight' => 25,
130 );
131 }
132
133 /**
134 * @inheritDoc
135 * Provides information about advanced search pane
136 * offered by this component.
137 *
138 * @return array|null
139 * collection of required pane settings,
140 * null if no element offered
141 */
142 /**
143 * @return array|null
144 */
145 public function registerAdvancedSearchPane() {
146 return array(
147 'title' => ts('Pledges'),
148 'weight' => 25,
149 );
150 }
151
152 /**
153 * @inheritDoc
154 * Provides potential activity types that this
155 * component might want to register in activity history.
156 * Needs to be implemented in component's information
157 * class.
158 *
159 * @return array|null
160 * collection of activity types
161 */
162 /**
163 * @return array|null
164 */
165 public function getActivityTypes() {
166 return NULL;
167 }
168
169 /**
170 * add shortcut to Create New
171 * @param $shortCuts
172 */
173 public function creatNewShortcut(&$shortCuts) {
174 if (CRM_Core_Permission::check('access CiviPledge') &&
175 CRM_Core_Permission::check('edit pledges')
176 ) {
177 $shortCuts = array_merge($shortCuts, array(
178 array(
179 'path' => 'civicrm/pledge/add',
180 'query' => 'reset=1&action=add&context=standalone',
181 'ref' => 'new-pledge',
182 'title' => ts('Pledge'),
183 ),
184 ));
185 }
186 }
187
188 }