3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2020 |
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-2020
38 class CRM_Member_Info
extends CRM_Core_Component_Info
{
44 protected $keyword = 'member';
48 * Provides base information about the component.
49 * Needs to be implemented in component's information
53 * collection of required component settings
59 public function getInfo() {
61 'name' => 'CiviMember',
62 'translatedName' => ts('CiviMember'),
63 'title' => ts('CiviCRM Membership Engine'),
65 'showActivitiesInCore' => 1,
71 * Provides permissions that are used by component.
72 * Needs to be implemented in component's information
75 * NOTE: if using conditionally permission return,
76 * implementation of $getAllUnconditionally is required.
78 * @param bool $getAllUnconditionally
79 * @param bool $descriptions
80 * Whether to return permission descriptions
83 * collection of permissions, null if none
85 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
87 'access CiviMember' => [
88 ts('access CiviMember'),
89 ts('View memberships'),
91 'edit memberships' => [
92 ts('edit memberships'),
93 ts('Create and update memberships'),
95 'delete in CiviMember' => [
96 ts('delete in CiviMember'),
97 ts('Delete memberships'),
101 if (!$descriptions) {
102 foreach ($permissions as $name => $attr) {
103 $permissions[$name] = array_shift($attr);
112 * Provides information about user dashboard element
113 * offered by this component.
116 * collection of required dashboard settings,
117 * null if no element offered
123 public function getUserDashboardElement() {
125 'name' => ts('Memberships'),
126 'title' => ts('Your Membership(s)'),
127 // this is CiviContribute specific permission, since
128 // there is no permission that could be checked for
130 'perm' => ['make online contributions'],
137 * Provides information about user dashboard element
138 * offered by this component.
141 * collection of required dashboard settings,
142 * null if no element offered
148 public function registerTab() {
150 'title' => ts('Memberships'),
151 'url' => 'membership',
160 public function getIcon() {
161 return 'crm-i fa-id-badge';
166 * Provides information about advanced search pane
167 * offered by this component.
170 * collection of required pane settings,
171 * null if no element offered
177 public function registerAdvancedSearchPane() {
179 'title' => ts('Memberships'),
186 * Provides potential activity types that this
187 * component might want to register in activity history.
188 * Needs to be implemented in component's information
192 * collection of activity types
198 public function getActivityTypes() {
203 * add shortcut to Create New.
207 public function creatNewShortcut(&$shortCuts, $newCredit) {
208 if (CRM_Core_Permission
::check('access CiviMember') &&
209 CRM_Core_Permission
::check('edit memberships')
212 'path' => 'civicrm/member/add',
213 'query' => "reset=1&action=add&context=standalone",
214 'ref' => 'new-membership',
215 'title' => ts('Membership'),
218 $title = ts('Membership') . '<br /> (' . ts('credit card') . ')';
219 $shortCut[0]['shortCuts'][] = [
220 'path' => 'civicrm/member/add',
221 'query' => "reset=1&action=add&context=standalone&mode=live",
222 'ref' => 'new-membership-cc',
226 $shortCuts = array_merge($shortCuts, $shortCut);