Beispiel #1
0
<?php

/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
$product = new MM_Product($p->id);
$enableNumberOfPayments = $product->doLimitPayments() ? "" : "disabled='disabled'";
$associatedMembership = $product->getAssociatedMembership();
$associatedBundle = $product->getAssociatedBundle();
$noAccessAssociation = !$associatedMembership->isValid() && !$associatedBundle->isValid() ? true : false;
if ($associatedMembership->isValid()) {
    $lastAccessAssociationType = "membership";
    $lastAccessAssociationId = $associatedMembership->getId();
} else {
    if ($associatedBundle->isValid()) {
        $lastAccessAssociationType = "bundle";
        $lastAccessAssociationId = $associatedBundle->getId();
    } else {
        $lastAccessAssociationType = "";
        $lastAccessAssociationId = "";
    }
}
$hasBeenPurchased = false;
if ($product->isValid()) {
    $hasBeenPurchased = MM_Product::hasBeenPurchased($product->getId());
}
$periodsArr = array('days' => 'days', 'weeks' => 'weeks', 'months' => 'months', 'years' => 'years');
$trialFrequencyList = MM_HtmlUtils::generateSelectionsList($periodsArr, $product->getTrialFrequency());
$rebillFrequencyList = MM_HtmlUtils::generateSelectionsList($periodsArr, $product->getRebillFrequency());
Beispiel #2
0
 public function postCustomColumns($column_name, $postId)
 {
     if ($column_name === 'core_page_type') {
         $data = "";
         if (MM_CorePage::isDefaultCorePage($postId)) {
             $data = MM_Utils::getDefaultFlag("", "", true, 'margin-right:5px;');
         }
         $cp = MM_CorePage::getCorePageInfo($postId);
         if (isset($cp->core_page_type_name)) {
             switch ($cp->core_page_type_id) {
                 case MM_CorePageType::$FREE_CONFIRMATION:
                     $data .= "Confirmation (Free)";
                     break;
                 default:
                     $data .= $cp->core_page_type_name;
                     break;
             }
         }
         if (empty($data)) {
             echo MM_NO_DATA;
         } else {
             echo $data;
         }
     } else {
         if ($column_name === 'access_rights') {
             /// display access rights for post/page
             $associations = MM_ProtectedContentEngine::getAccessRights($postId);
             if (count($associations) <= 0) {
                 $memberTypesStr = "";
                 $accessTagStr = "";
                 $pages = MM_CorePage::getCorePagesByPageID($postId);
                 if (is_array($pages)) {
                     foreach ($pages as $page) {
                         switch ($page->ref_type) {
                             case "product":
                                 $product = new MM_Product($page->ref_id);
                                 $membership = $product->getAssociatedMembership();
                                 if ($membership->isValid()) {
                                     if (empty($memberTypesStr)) {
                                         $memberTypesStr = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP, '', 'margin-right:4px;');
                                     }
                                     $memberTypesStr .= $membership->getName() . ", ";
                                 }
                                 $bundle = $product->getAssociatedBundle();
                                 if ($bundle->isValid()) {
                                     if (empty($accessTagStr)) {
                                         $accessTagStr = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE, '', 'margin-right:4px;');
                                     }
                                     $accessTagStr .= $bundle->getName() . ", ";
                                 }
                                 break;
                             case "member_type":
                                 if (empty($memberTypesStr)) {
                                     $memberTypesStr = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP, '', 'margin-right:4px;');
                                 }
                                 $memberTypesStr .= $page->mt_name . ", ";
                                 break;
                             case "access_tag":
                                 if (empty($accessTagStr)) {
                                     $accessTagStr = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE, '', 'margin-right:4px;');
                                 }
                                 $accessTagStr .= $page->at_name . ", ";
                                 break;
                         }
                     }
                 }
                 if (empty($memberTypesStr) && empty($accessTagStr)) {
                     echo MM_NO_DATA;
                 } else {
                     if (strlen($memberTypesStr) > 0) {
                         $memberTypesStr = substr($memberTypesStr, 0, strlen($memberTypesStr) - 2);
                     }
                     if (strlen($accessTagStr) > 0) {
                         $accessTagStr = substr($accessTagStr, 0, strlen($accessTagStr) - 2);
                     }
                     echo $memberTypesStr . " " . $accessTagStr;
                 }
             } else {
                 $memberTypesStr = "";
                 $accessTagStr = "";
                 foreach ($associations as $rights) {
                     switch ($rights->access_type) {
                         case "member_type":
                             if (empty($memberTypesStr)) {
                                 $memberTypesStr = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP, '', 'margin-right:4px;');
                             }
                             $memberTypesStr .= $rights->mt_name . ", ";
                             break;
                         case "access_tag":
                             if (empty($accessTagStr)) {
                                 $accessTagStr = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE, '', 'margin-right:4px;');
                             }
                             $accessTagStr .= $rights->at_name . ", ";
                             break;
                     }
                 }
                 if (empty($memberTypesStr) && empty($accessTagStr)) {
                     echo MM_NO_DATA;
                 } else {
                     if (strlen($memberTypesStr) > 0) {
                         $memberTypesStr = substr($memberTypesStr, 0, strlen($memberTypesStr) - 2);
                     }
                     if (strlen($accessTagStr) > 0) {
                         $accessTagStr = substr($accessTagStr, 0, strlen($accessTagStr) - 2);
                     }
                     echo $memberTypesStr . " " . $accessTagStr;
                 }
             }
         }
     }
 }