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
22 class CRM_Member_Info
extends CRM_Core_Component_Info
{
28 protected $keyword = 'member';
32 * Provides base information about the component.
33 * Needs to be implemented in component's information
37 * collection of required component settings
43 public function getInfo() {
45 'name' => 'CiviMember',
46 'translatedName' => ts('CiviMember'),
47 'title' => ts('CiviCRM Membership Engine'),
49 'showActivitiesInCore' => 1,
55 * Provides permissions that are used by component.
56 * Needs to be implemented in component's information
59 * NOTE: if using conditionally permission return,
60 * implementation of $getAllUnconditionally is required.
62 * @param bool $getAllUnconditionally
63 * @param bool $descriptions
64 * Whether to return permission descriptions
67 * collection of permissions, null if none
69 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
71 'access CiviMember' => [
72 ts('access CiviMember'),
73 ts('View memberships'),
75 'edit memberships' => [
76 ts('edit memberships'),
77 ts('Create and update memberships'),
79 'delete in CiviMember' => [
80 ts('delete in CiviMember'),
81 ts('Delete memberships'),
86 foreach ($permissions as $name => $attr) {
87 $permissions[$name] = array_shift($attr);
96 * Provides information about user dashboard element
97 * offered by this component.
100 * collection of required dashboard settings,
101 * null if no element offered
107 public function getUserDashboardElement() {
109 'name' => ts('Memberships'),
110 'title' => ts('Your Membership(s)'),
111 // this is CiviContribute specific permission, since
112 // there is no permission that could be checked for
114 'perm' => ['make online contributions'],
121 * Provides information about user dashboard element
122 * offered by this component.
125 * collection of required dashboard settings,
126 * null if no element offered
132 public function registerTab() {
134 'title' => ts('Memberships'),
135 'url' => 'membership',
144 public function getIcon() {
145 return 'crm-i fa-id-badge';
150 * Provides information about advanced search pane
151 * offered by this component.
154 * collection of required pane settings,
155 * null if no element offered
161 public function registerAdvancedSearchPane() {
163 'title' => ts('Memberships'),
170 * Provides potential activity types that this
171 * component might want to register in activity history.
172 * Needs to be implemented in component's information
176 * collection of activity types
182 public function getActivityTypes() {
187 * add shortcut to Create New.
191 public function creatNewShortcut(&$shortCuts, $newCredit) {
192 if (CRM_Core_Permission
::check('access CiviMember') &&
193 CRM_Core_Permission
::check('edit memberships')
196 'path' => 'civicrm/member/add',
197 'query' => "reset=1&action=add&context=standalone",
198 'ref' => 'new-membership',
199 'title' => ts('Membership'),
202 $title = ts('Membership') . '<br /> (' . ts('credit card') . ')';
203 $shortCut[0]['shortCuts'][] = [
204 'path' => 'civicrm/member/add',
205 'query' => "reset=1&action=add&context=standalone&mode=live",
206 'ref' => 'new-membership-cc',
210 $shortCuts = array_merge($shortCuts, $shortCut);