3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * This class introduces component to the system and provides all the
30 * information about it. It needs to extend CRM_Core_Component_Info
34 * @copyright CiviCRM LLC (c) 2004-2014
38 class CRM_Member_Info
extends CRM_Core_Component_Info
{
40 // docs inherited from interface
41 protected $keyword = 'member';
43 // docs inherited from interface
45 * Provides base information about the component.
46 * Needs to be implemented in component's information
49 * @return array collection of required component settings
55 public function getInfo() {
57 'name' => 'CiviMember',
58 'translatedName' => ts('CiviMember'),
59 'title' => 'CiviCRM Membership Engine',
61 'showActivitiesInCore' => 1,
66 // docs inherited from interface
68 * Provides permissions that are used by component.
69 * Needs to be implemented in component's information
72 * NOTE: if using conditionally permission return,
73 * implementation of $getAllUnconditionally is required.
75 * @param bool $getAllUnconditionally
77 * @return array|null collection of permissions, null if none
80 * @param bool $getAllUnconditionally
84 public function getPermissions($getAllUnconditionally = FALSE) {
88 'delete in CiviMember',
92 // docs inherited from interface
94 * Provides information about user dashboard element
95 * offered by this component.
97 * @return array|null collection of required dashboard settings,
98 * null if no element offered
104 public function getUserDashboardElement() {
106 'name' => ts('Memberships'),
107 'title' => ts('Your Membership(s)'),
108 // this is CiviContribute specific permission, since
109 // there is no permission that could be checked for
111 'perm' => array('make online contributions'),
116 // docs inherited from interface
118 * Provides information about user dashboard element
119 * offered by this component.
121 * @return array|null collection of required dashboard settings,
122 * null if no element offered
128 public function registerTab() {
130 'title' => ts('Memberships'),
131 'url' => 'membership',
136 // docs inherited from interface
138 * Provides information about advanced search pane
139 * offered by this component.
141 * @return array|null collection of required pane settings,
142 * null if no element offered
148 public function registerAdvancedSearchPane() {
150 'title' => ts('Memberships'),
155 // docs inherited from interface
157 * Provides potential activity types that this
158 * component might want to register in activity history.
159 * Needs to be implemented in component's information
162 * @return array|null collection of activity types
168 public function getActivityTypes() {
172 // add shortcut to Create New
177 public function creatNewShortcut(&$shortCuts, $newCredit) {
178 if (CRM_Core_Permission
::check('access CiviMember') &&
179 CRM_Core_Permission
::check('edit memberships')
182 'path' => 'civicrm/member/add',
183 'query' => "reset=1&action=add&context=standalone",
184 'ref' => 'new-membership',
185 'title' => ts('Membership'),
188 $title = ts('Membership') . '<br /> (' . ts('credit card') . ')';
189 $shortCut[0]['shortCuts'][] = array(
190 'path' => 'civicrm/member/add',
191 'query' => "reset=1&action=add&context=standalone&mode=live",
192 'ref' => 'new-membership-cc',
196 $shortCuts = array_merge($shortCuts, $shortCut);