3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * This class introduces component to the system and provides all the
14 * information about it. It needs to extend CRM_Core_Component_Info
18 * @copyright CiviCRM LLC https://civicrm.org/licensing
20 class CRM_Member_Info
extends CRM_Core_Component_Info
{
26 protected $keyword = 'member';
30 * Provides base information about the component.
31 * Needs to be implemented in component's information
35 * collection of required component settings
41 public function getInfo() {
43 'name' => 'CiviMember',
44 'translatedName' => ts('CiviMember'),
45 'title' => ts('CiviCRM Membership Engine'),
47 'showActivitiesInCore' => 1,
53 * Provides permissions that are used by component.
54 * Needs to be implemented in component's information
57 * NOTE: if using conditionally permission return,
58 * implementation of $getAllUnconditionally is required.
60 * @param bool $getAllUnconditionally
61 * @param bool $descriptions
62 * Whether to return permission descriptions
65 * collection of permissions, null if none
67 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
69 'access CiviMember' => [
70 ts('access CiviMember'),
71 ts('View memberships'),
73 'edit memberships' => [
74 ts('edit memberships'),
75 ts('Create and update memberships'),
77 'delete in CiviMember' => [
78 ts('delete in CiviMember'),
79 ts('Delete memberships'),
84 foreach ($permissions as $name => $attr) {
85 $permissions[$name] = array_shift($attr);
94 * Provides information about user dashboard element
95 * offered by this component.
98 * collection of required dashboard settings,
99 * null if no element offered
105 public function getUserDashboardElement() {
107 'name' => ts('Memberships'),
108 'title' => ts('Your Membership(s)'),
109 // this is CiviContribute specific permission, since
110 // there is no permission that could be checked for
112 'perm' => ['make online contributions'],
119 * Provides information about user dashboard element
120 * offered by this component.
123 * collection of required dashboard settings,
124 * null if no element offered
130 public function registerTab() {
132 'title' => ts('Memberships'),
133 'url' => 'membership',
142 public function getIcon() {
143 return 'crm-i fa-id-badge';
148 * Provides information about advanced search pane
149 * offered by this component.
152 * collection of required pane settings,
153 * null if no element offered
159 public function registerAdvancedSearchPane() {
161 'title' => ts('Memberships'),
168 * Provides potential activity types that this
169 * component might want to register in activity history.
170 * Needs to be implemented in component's information
174 * collection of activity types
180 public function getActivityTypes() {
185 * add shortcut to Create New.
189 public function creatNewShortcut(&$shortCuts, $newCredit) {
190 if (CRM_Core_Permission
::check('access CiviMember') &&
191 CRM_Core_Permission
::check('edit memberships')
194 'path' => 'civicrm/member/add',
195 'query' => "reset=1&action=add&context=standalone",
196 'ref' => 'new-membership',
197 'title' => ts('Membership'),
200 $title = ts('Membership') . '<br /> (' . ts('credit card') . ')';
201 $shortCut[0]['shortCuts'][] = [
202 'path' => 'civicrm/member/add',
203 'query' => "reset=1&action=add&context=standalone&mode=live",
204 'ref' => 'new-membership-cc',
208 $shortCuts = array_merge($shortCuts, $shortCut);