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