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