Merge pull request #4983 from colemanw/CRM-15842
[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 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
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
e7c15cb6
CW
40 /**
41 * @inheritDoc
42 */
6a488035
TO
43 protected $keyword = 'pledge';
44
ffd93213
EM
45 /**
46 * Provides base information about the component.
47 * Needs to be implemented in component's information
48 * class.
49 *
a6c01b45
CW
50 * @return array
51 * collection of required component settings
ffd93213 52 */
6a488035
TO
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
ffd93213 64 /**
e7c15cb6 65 * @inheritDoc
ffd93213
EM
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 *
72b3a70c
CW
75 * @return array|null
76 * collection of permissions, null if none
ffd93213
EM
77 */
78 /**
79 * @param bool $getAllUnconditionally
80 *
81 * @return array|null
82 */
33777e4a 83 public function getPermissions($getAllUnconditionally = FALSE) {
6a488035
TO
84 return array(
85 'access CiviPledge',
86 'edit pledges',
87 'delete in CiviPledge',
88 );
89 }
90
ffd93213 91 /**
e7c15cb6 92 * @inheritDoc
ffd93213
EM
93 * Provides information about user dashboard element
94 * offered by this component.
95 *
72b3a70c
CW
96 * @return array|null
97 * collection of required dashboard settings,
ffd93213 98 * null if no element offered
ffd93213
EM
99 */
100 /**
101 * @return array|null
102 */
6a488035 103 public function getUserDashboardElement() {
098201d8 104 return array(
353ffa53 105 'name' => ts('Pledges'),
6a488035
TO
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
ffd93213 113 /**
e7c15cb6 114 * @inheritDoc
ffd93213
EM
115 * Provides information about user dashboard element
116 * offered by this component.
117 *
72b3a70c
CW
118 * @return array|null
119 * collection of required dashboard settings,
ffd93213 120 * null if no element offered
ffd93213
EM
121 */
122 /**
123 * @return array|null
124 */
6a488035 125 public function registerTab() {
098201d8 126 return array(
353ffa53 127 'title' => ts('Pledges'),
6a488035
TO
128 'url' => 'pledge',
129 'weight' => 25,
130 );
131 }
132
ffd93213 133 /**
e7c15cb6 134 * @inheritDoc
ffd93213
EM
135 * Provides information about advanced search pane
136 * offered by this component.
137 *
72b3a70c
CW
138 * @return array|null
139 * collection of required pane settings,
ffd93213 140 * null if no element offered
ffd93213
EM
141 */
142 /**
143 * @return array|null
144 */
6a488035 145 public function registerAdvancedSearchPane() {
098201d8 146 return array(
353ffa53 147 'title' => ts('Pledges'),
6a488035
TO
148 'weight' => 25,
149 );
150 }
151
ffd93213 152 /**
e7c15cb6 153 * @inheritDoc
ffd93213
EM
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 *
72b3a70c
CW
159 * @return array|null
160 * collection of activity types
ffd93213
EM
161 */
162 /**
163 * @return array|null
164 */
6a488035
TO
165 public function getActivityTypes() {
166 return NULL;
167 }
168
ffd93213 169 /**
4f1f1f2a 170 * add shortcut to Create New
ffd93213
EM
171 * @param $shortCuts
172 */
6a488035
TO
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(
098201d8 178 array(
353ffa53
TO
179 'path' => 'civicrm/pledge/add',
180 'query' => 'reset=1&action=add&context=standalone',
181 'ref' => 'new-pledge',
182 'title' => ts('Pledge'),
c301f76e 183 ),
353ffa53 184 ));
6a488035
TO
185 }
186 }
96025800 187
6a488035 188}