本文整理汇总了PHP中CRM_Member_BAO_Membership::getStatusANDTypeVaues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Member_BAO_Membership::getStatusANDTypeVaues方法的具体用法?PHP CRM_Member_BAO_Membership::getStatusANDTypeVaues怎么用?PHP CRM_Member_BAO_Membership::getStatusANDTypeVaues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Member_BAO_Membership
的用法示例。
在下文中一共展示了CRM_Member_BAO_Membership::getStatusANDTypeVaues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listMemberships
/**
* Function to list memberships for the UF user
*
* return null
* @access public
*/
function listMemberships()
{
$membership = array();
require_once "CRM/Member/BAO/Membership.php";
$dao = new CRM_Member_DAO_Membership();
$dao->contact_id = $this->_contactId;
$dao->is_test = 0;
$dao->find();
while ($dao->fetch()) {
$membership[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
//get the membership status and type values.
$statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeVaues($dao->id);
foreach (array('status', 'membership_type') as $fld) {
$membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
}
if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id])) {
$membership[$dao->id]['active'] = true;
}
$membership[$dao->id]['renewPageId'] = CRM_Member_BAO_Membership::getContributionPageId($dao->id);
}
$activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
$inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
$this->assign('activeMembers', $activeMembers);
$this->assign('inActiveMembers', $inActiveMembers);
}
示例2: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
$links =& self::links('all', $this->_isPaymentProcessor, $this->_accessContribution);
$membership = array();
require_once 'CRM/Member/DAO/Membership.php';
$dao = new CRM_Member_DAO_Membership();
$dao->contact_id = $this->_contactId;
$dao->is_test = 0;
//$dao->orderBy('name');
$dao->find();
//CRM--4418, check for view, edit, delete
$permissions = array(CRM_Core_Permission::VIEW);
if (CRM_Core_Permission::check('edit memberships')) {
$permissions[] = CRM_Core_Permission::EDIT;
}
if (CRM_Core_Permission::check('delete in CiviMember')) {
$permissions[] = CRM_Core_Permission::DELETE;
}
$mask = CRM_Core_Action::mask($permissions);
// get deceased status id
require_once 'CRM/Member/PseudoConstant.php';
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
$deceasedStatusId = array_search('Deceased', $allStatus);
//checks membership of contact itself
while ($dao->fetch()) {
$membership[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
//get the membership status and type values.
$statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeVaues($dao->id);
foreach (array('status', 'membership_type') as $fld) {
$membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
}
if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id])) {
$membership[$dao->id]['active'] = true;
}
if (!$dao->owner_membership_id) {
// unset renew and followup link for deceased membership
$currentMask = $mask;
if ($dao->status_id == $deceasedStatusId) {
$currentMask = $currentMask & ~CRM_Core_Action::RENEW & ~CRM_Core_Action::FOLLOWUP;
}
$isCancelSupported = CRM_Member_BAO_Membership::isCancelSubscriptionSupported($membership[$dao->id]['membership_id']);
$membership[$dao->id]['action'] = CRM_Core_Action::formLink(self::links('all', null, null, $isCancelSupported), $currentMask, array('id' => $dao->id, 'cid' => $this->_contactId));
} else {
$membership[$dao->id]['action'] = CRM_Core_Action::formLink(self::links('view'), $mask, array('id' => $dao->id, 'cid' => $this->_contactId));
}
//does membership is auto renew CRM-7137.
if ($isCancelSupported) {
$membership[$dao->id]['auto_renew'] = CRM_Utils_Array::value('contribution_recur_id', $membership[$dao->id]);
}
}
//Below code gives list of all Membership Types associated
//with an Organization(CRM-2016)
include_once 'CRM/Member/BAO/MembershipType.php';
$membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg($this->_contactId);
foreach ($membershipTypes as $key => $value) {
$membershipTypes[$key]['action'] = CRM_Core_Action::formLink(self::membershipTypeslinks(), $mask, array('id' => $value['id'], 'cid' => $this->_contactId));
}
$activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
$inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
$this->assign('activeMembers', $activeMembers);
$this->assign('inActiveMembers', $inActiveMembers);
$this->assign('membershipTypes', $membershipTypes);
if ($this->_contactId) {
require_once 'CRM/Contact/BAO/Contact.php';
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
$this->assign('displayName', $displayName);
}
}