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() {
105 return array('name' => ts('Memberships'),
106 'title' => ts('Your Membership(s)'),
107 // this is CiviContribute specific permission, since
108 // there is no permission that could be checked for
110 'perm' => array('make online contributions'),
115 // docs inherited from interface
117 * Provides information about user dashboard element
118 * offered by this component.
120 * @return array|null collection of required dashboard settings,
121 * null if no element offered
127 public function registerTab() {
128 return array('title' => ts('Memberships'),
129 'url' => 'membership',
134 // docs inherited from interface
136 * Provides information about advanced search pane
137 * offered by this component.
139 * @return array|null collection of required pane settings,
140 * null if no element offered
146 public function registerAdvancedSearchPane() {
147 return array('title' => ts('Memberships'),
152 // docs inherited from interface
154 * Provides potential activity types that this
155 * component might want to register in activity history.
156 * Needs to be implemented in component's information
159 * @return array|null collection of activity types
165 public function getActivityTypes() {
169 // add shortcut to Create New
174 public function creatNewShortcut(&$shortCuts, $newCredit) {
175 if (CRM_Core_Permission
::check('access CiviMember') &&
176 CRM_Core_Permission
::check('edit memberships')
179 'path' => 'civicrm/member/add',
180 'query' => "reset=1&action=add&context=standalone",
181 'ref' => 'new-membership',
182 'title' => ts('Membership'),
185 $title = ts('Membership') . '<br /> (' . ts('credit card') . ')';
186 $shortCut[0]['shortCuts'][] = array(
187 'path' => 'civicrm/member/add',
188 'query' => "reset=1&action=add&context=standalone&mode=live",
189 'ref' => 'new-membership-cc',
193 $shortCuts = array_merge($shortCuts, $shortCut);