phpcs - Fix error, "Expected 1 newline at end of file; XXX found".
[civicrm-core.git] / CRM / Member / 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_Member_Info extends CRM_Core_Component_Info {
39
40 // docs inherited from interface
41 protected $keyword = 'member';
42
43 // docs inherited from interface
44 /**
45 * Provides base information about the component.
46 * Needs to be implemented in component's information
47 * class.
48 *
49 * @return array collection of required component settings
50 *
51 */
52 /**
53 * @return array
54 */
55 public function getInfo() {
56 return array(
57 'name' => 'CiviMember',
58 'translatedName' => ts('CiviMember'),
59 'title' => 'CiviCRM Membership Engine',
60 'search' => 1,
61 'showActivitiesInCore' => 1,
62 );
63 }
64
65
66 // docs inherited from interface
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
78 */
79 /**
80 * @param bool $getAllUnconditionally
81 *
82 * @return array|null
83 */
84 public function getPermissions($getAllUnconditionally = FALSE) {
85 return array(
86 'access CiviMember',
87 'edit memberships',
88 'delete in CiviMember',
89 );
90 }
91
92 // docs inherited from interface
93 /**
94 * Provides information about user dashboard element
95 * offered by this component.
96 *
97 * @return array|null collection of required dashboard settings,
98 * null if no element offered
99 *
100 */
101 /**
102 * @return array|null
103 */
104 public function getUserDashboardElement() {
105 return array('name' => ts('Memberships'),
106 'title' => ts('Your Membership(s)'),
107 // this is CiviContribute specific permission, since
108 // there is no permission that could be checked for
109 // CiviMember
110 'perm' => array('make online contributions'),
111 'weight' => 30,
112 );
113 }
114
115 // docs inherited from interface
116 /**
117 * Provides information about user dashboard element
118 * offered by this component.
119 *
120 * @return array|null collection of required dashboard settings,
121 * null if no element offered
122 *
123 */
124 /**
125 * @return array|null
126 */
127 public function registerTab() {
128 return array('title' => ts('Memberships'),
129 'url' => 'membership',
130 'weight' => 30,
131 );
132 }
133
134 // docs inherited from interface
135 /**
136 * Provides information about advanced search pane
137 * offered by this component.
138 *
139 * @return array|null collection of required pane settings,
140 * null if no element offered
141 *
142 */
143 /**
144 * @return array|null
145 */
146 public function registerAdvancedSearchPane() {
147 return array('title' => ts('Memberships'),
148 'weight' => 30,
149 );
150 }
151
152 // docs inherited from interface
153 /**
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 collection of activity types
160 *
161 */
162 /**
163 * @return array|null
164 */
165 public function getActivityTypes() {
166 return NULL;
167 }
168
169 // add shortcut to Create New
170 /**
171 * @param $shortCuts
172 * @param $newCredit
173 */
174 public function creatNewShortcut(&$shortCuts, $newCredit) {
175 if (CRM_Core_Permission::check('access CiviMember') &&
176 CRM_Core_Permission::check('edit memberships')
177 ) {
178 $shortCut[] = array(
179 'path' => 'civicrm/member/add',
180 'query' => "reset=1&action=add&context=standalone",
181 'ref' => 'new-membership',
182 'title' => ts('Membership'),
183 );
184 if ($newCredit) {
185 $title = ts('Membership') . '<br />&nbsp;&nbsp;(' . ts('credit card') . ')';
186 $shortCut[0]['shortCuts'][] = array(
187 'path' => 'civicrm/member/add',
188 'query' => "reset=1&action=add&context=standalone&mode=live",
189 'ref' => 'new-membership-cc',
190 'title' => $title,
191 );
192 }
193 $shortCuts = array_merge($shortCuts, $shortCut);
194 }
195 }
196 }