Merge pull request #4818 from pratikshad/CRM-15770
[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 // docs inherited from interface
41 protected $keyword = 'pledge';
42
43 /**
44 * Provides base information about the component.
45 * Needs to be implemented in component's information
46 * class.
47 *
48 * @return array collection of required component settings
49 */
50 public function getInfo() {
51 return array(
52 'name' => 'CiviPledge',
53 'translatedName' => ts('CiviPledge'),
54 'title' => ts('CiviCRM Pledge Engine'),
55 'search' => 1,
56 'showActivitiesInCore' => 1,
57 );
58 }
59
60
61 // docs inherited from interface
62 /**
63 * Provides permissions that are used by component.
64 * Needs to be implemented in component's information
65 * class.
66 *
67 * NOTE: if using conditionally permission return,
68 * implementation of $getAllUnconditionally is required.
69 *
70 * @param bool $getAllUnconditionally
71 *
72 * @return array|null collection of permissions, null if none
73 */
74 /**
75 * @param bool $getAllUnconditionally
76 *
77 * @return array|null
78 */
79 public function getPermissions($getAllUnconditionally = FALSE) {
80 return array(
81 'access CiviPledge',
82 'edit pledges',
83 'delete in CiviPledge',
84 );
85 }
86
87 // docs inherited from interface
88 /**
89 * Provides information about user dashboard element
90 * offered by this component.
91 *
92 * @return array|null collection of required dashboard settings,
93 * null if no element offered
94 *
95 */
96 /**
97 * @return array|null
98 */
99 public function getUserDashboardElement() {
100 return array('name' => ts('Pledges'),
101 'title' => ts('Your Pledge(s)'),
102 // we need to check this permission since you can click on contribution page link for making payment
103 'perm' => array('make online contributions'),
104 'weight' => 15,
105 );
106 }
107
108 // docs inherited from interface
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
115 *
116 */
117 /**
118 * @return array|null
119 */
120 public function registerTab() {
121 return array('title' => ts('Pledges'),
122 'url' => 'pledge',
123 'weight' => 25,
124 );
125 }
126
127 // docs inherited from interface
128 /**
129 * Provides information about advanced search pane
130 * offered by this component.
131 *
132 * @return array|null collection of required pane settings,
133 * null if no element offered
134 *
135 */
136 /**
137 * @return array|null
138 */
139 public function registerAdvancedSearchPane() {
140 return array('title' => ts('Pledges'),
141 'weight' => 25,
142 );
143 }
144
145 // docs inherited from interface
146 /**
147 * Provides potential activity types that this
148 * component might want to register in activity history.
149 * Needs to be implemented in component's information
150 * class.
151 *
152 * @return array|null collection of activity types
153 *
154 */
155 /**
156 * @return array|null
157 */
158 public function getActivityTypes() {
159 return NULL;
160 }
161
162 // add shortcut to Create New
163 /**
164 * @param $shortCuts
165 */
166 public function creatNewShortcut(&$shortCuts) {
167 if (CRM_Core_Permission::check('access CiviPledge') &&
168 CRM_Core_Permission::check('edit pledges')
169 ) {
170 $shortCuts = array_merge($shortCuts, array(
171 array('path' => 'civicrm/pledge/add',
172 'query' => 'reset=1&action=add&context=standalone',
173 'ref' => 'new-pledge',
174 'title' => ts('Pledge'),
175 )));
176 }
177 }
178 }