<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
* $Id$
*
*/
*
* @var array
*/
- static $_links = NULL;
- static $_membershipTypesLinks = NULL;
+ public static $_links = NULL;
+ public static $_membershipTypesLinks = NULL;
public $_permission = NULL;
public $_contactId = NULL;
$addWhere = "membership_type_id IN (" . implode(',', array_keys($membershipTypes)) . ")";
}
- $membership = array();
+ $membership = [];
$dao = new CRM_Member_DAO_Membership();
$dao->contact_id = $this->_contactId;
$dao->whereAdd($addWhere);
$dao->find();
//CRM--4418, check for view, edit, delete
- $permissions = array(CRM_Core_Permission::VIEW);
+ $permissions = [CRM_Core_Permission::VIEW];
if (CRM_Core_Permission::check('edit memberships')) {
$permissions[] = CRM_Core_Permission::EDIT;
}
//checks membership of contact itself
while ($dao->fetch()) {
- $membership[$dao->id] = array();
+ $membership[$dao->id] = [];
CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
//carry campaign.
//get the membership status and type values.
$statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($dao->id);
- foreach (array('status', 'membership_type') as $fld) {
+ foreach (['status', 'membership_type'] as $fld) {
$membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
}
if (!empty($statusANDType[$dao->id]['is_current_member'])) {
self::getPermissionedLinks($dao->membership_type_id, $links);
$membership[$dao->id]['action'] = CRM_Core_Action::formLink($links,
$currentMask,
- array(
+ [
'id' => $dao->id,
'cid' => $this->_contactId,
- ),
+ ],
ts('Renew') . '...',
FALSE,
'membership.tab.row',
self::getPermissionedLinks($dao->membership_type_id, $links);
$membership[$dao->id]['action'] = CRM_Core_Action::formLink($links,
$mask,
- array(
+ [
'id' => $dao->id,
'cid' => $this->_contactId,
- ),
+ ],
ts('more'),
FALSE,
'membership.tab.row',
WHERE m.owner_membership_id = {$dao->id} AND m.is_test = 0 AND ms.is_current_member = 1 AND ct.is_deleted = 0";
$num_related = CRM_Core_DAO::singleValueQuery($query);
$max_related = CRM_Utils_Array::value('max_related', $membership[$dao->id]);
- $membership[$dao->id]['related_count'] = ($max_related == '' ? ts('%1 created', array(1 => $num_related)) : ts('%1 out of %2', array(
+ $membership[$dao->id]['related_count'] = ($max_related == '' ? ts('%1 created', [1 => $num_related]) : ts('%1 out of %2', [
1 => $num_related,
2 => $max_related,
- )));
+ ]));
}
else {
$membership[$dao->id]['related_count'] = ts('N/A');
//Below code gives list of all Membership Types associated
//with an Organization(CRM-2016)
- $membershipTypesResult = civicrm_api3('MembershipType', 'get', array(
+ $membershipTypesResult = civicrm_api3('MembershipType', 'get', [
'member_of_contact_id' => $this->_contactId,
- 'options' => array(
+ 'options' => [
'limit' => 0,
- ),
- ));
+ ],
+ ]);
$membershipTypes = CRM_Utils_Array::value('values', $membershipTypesResult, NULL);
foreach ($membershipTypes as $key => $value) {
$membershipTypes[$key]['action'] = CRM_Core_Action::formLink(self::membershipTypeslinks(),
$mask,
- array(
+ [
'id' => $value['id'],
'cid' => $this->_contactId,
- ),
+ ],
ts('more'),
FALSE,
'membershipType.organization.action',
$this->assign('displayName', $displayName);
$this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('membership', $this->_contactId);
// Refresh other tabs with related data
- $this->ajaxResponse['updateTabs'] = array(
+ $this->ajaxResponse['updateTabs'] = [
'#tab_activity' => CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId),
'#tab_rel' => CRM_Contact_BAO_Contact::getCountComponent('rel', $this->_contactId),
- );
+ ];
if (CRM_Core_Permission::access('CiviContribute')) {
$this->ajaxResponse['updateTabs']['#tab_contribute'] = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId);
}
$isUpdateBilling = FALSE
) {
if (!CRM_Utils_Array::value('view', self::$_links)) {
- self::$_links['view'] = array(
- CRM_Core_Action::VIEW => array(
+ self::$_links['view'] = [
+ CRM_Core_Action::VIEW => [
'name' => ts('View'),
'url' => 'civicrm/contact/view/membership',
'qs' => 'action=view&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
'title' => ts('View Membership'),
- ),
- );
+ ],
+ ];
}
if (!CRM_Utils_Array::value('all', self::$_links)) {
- $extraLinks = array(
- CRM_Core_Action::UPDATE => array(
+ $extraLinks = [
+ CRM_Core_Action::UPDATE => [
'name' => ts('Edit'),
'url' => 'civicrm/contact/view/membership',
'qs' => 'action=update&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
'title' => ts('Edit Membership'),
- ),
- CRM_Core_Action::RENEW => array(
+ ],
+ CRM_Core_Action::RENEW => [
'name' => ts('Renew'),
'url' => 'civicrm/contact/view/membership',
'qs' => 'action=renew&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
'title' => ts('Renew Membership'),
- ),
- CRM_Core_Action::FOLLOWUP => array(
+ ],
+ CRM_Core_Action::FOLLOWUP => [
'name' => ts('Renew-Credit Card'),
'url' => 'civicrm/contact/view/membership',
'qs' => 'action=renew&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member&mode=live',
'title' => ts('Renew Membership Using Credit Card'),
- ),
- CRM_Core_Action::DELETE => array(
+ ],
+ CRM_Core_Action::DELETE => [
'name' => ts('Delete'),
'url' => 'civicrm/contact/view/membership',
'qs' => 'action=delete&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
'title' => ts('Delete Membership'),
- ),
- );
+ ],
+ ];
if (!$isPaymentProcessor || !$accessContribution) {
//unset the renew with credit card when payment
//processor is not available or user is not permitted to create contributions
if ($isCancelSupported) {
$cancelMessage = ts('WARNING: If you cancel the recurring contribution associated with this membership, the membership will no longer be renewed automatically. However, the current membership status will not be affected.');
- self::$_links['all'][CRM_Core_Action::DISABLE] = array(
+ self::$_links['all'][CRM_Core_Action::DISABLE] = [
'name' => ts('Cancel Auto-renewal'),
'url' => 'civicrm/contribute/unsubscribe',
'qs' => 'reset=1&cid=%%cid%%&mid=%%id%%&context=membership&selectedChild=member',
'title' => ts('Cancel Auto Renew Subscription'),
'extra' => 'onclick = "if (confirm(\'' . $cancelMessage . '\') ) { return true; else return false;}"',
- );
+ ];
}
elseif (isset(self::$_links['all'][CRM_Core_Action::DISABLE])) {
unset(self::$_links['all'][CRM_Core_Action::DISABLE]);
}
if ($isUpdateBilling) {
- self::$_links['all'][CRM_Core_Action::MAP] = array(
+ self::$_links['all'][CRM_Core_Action::MAP] = [
'name' => ts('Change Billing Details'),
'url' => 'civicrm/contribute/updatebilling',
'qs' => 'reset=1&cid=%%cid%%&mid=%%id%%&context=membership&selectedChild=member',
'title' => ts('Change Billing Details'),
- );
+ ];
}
elseif (isset(self::$_links['all'][CRM_Core_Action::MAP])) {
unset(self::$_links['all'][CRM_Core_Action::MAP]);
*/
public static function &membershipTypesLinks() {
if (!self::$_membershipTypesLinks) {
- self::$_membershipTypesLinks = array(
- CRM_Core_Action::VIEW => array(
+ self::$_membershipTypesLinks = [
+ CRM_Core_Action::VIEW => [
'name' => ts('Members'),
'url' => 'civicrm/member/search/',
'qs' => 'reset=1&force=1&type=%%id%%',
'title' => ts('Search'),
- ),
- CRM_Core_Action::UPDATE => array(
+ ],
+ CRM_Core_Action::UPDATE => [
'name' => ts('Edit'),
'url' => 'civicrm/admin/member/membershipType',
'qs' => 'action=update&id=%%id%%&reset=1',
'title' => ts('Edit Membership Type'),
- ),
- );
+ ],
+ ];
}
return self::$_membershipTypesLinks;
}