Beispiel #1
0
     $actions .= MM_Utils::getDeleteIcon("Delete Product", 'margin-left:5px;', $deleteActionUrl);
 } else {
     $actions .= MM_Utils::getDeleteIcon("This product is currently being used and cannot be deleted", 'margin-left:5px;', '', true);
 }
 $purchaseLinks = '<a title="Get purchase links" onclick="mmjs.showPurchaseLinks(' . $product->getId() . ',\'' . htmlentities(addslashes($product->getName()), ENT_QUOTES) . '\')" class="mm-ui-button" style="margin:0px;">' . MM_Utils::getIcon('money', '', '1.3em', '1px', '', 'margin-right:0px;') . '</a>';
 // Associated Access
 $accessGranted = "";
 $membership = $product->getAssociatedMembership();
 if ($membership->isValid()) {
     $accessGranted .= MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP);
     $accessGranted .= " <a href='" . MM_ModuleUtils::getUrl(MM_MODULE_PRODUCT_SETTINGS, MM_MODULE_MEMBERSHIP_LEVELS) . "&autoload=" . $membership->getId() . "'>" . $membership->getName() . "</a>";
 }
 if (empty($accessGranted)) {
     $bundle = $product->getAssociatedBundle();
     if ($bundle->isValid()) {
         $accessGranted .= MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE);
         $accessGranted .= " <a href='" . MM_ModuleUtils::getUrl(MM_MODULE_PRODUCT_SETTINGS, MM_MODULE_BUNDLES) . "&autoload=" . $bundle->getId() . "'>" . $bundle->getName() . "</a>";
     }
 }
 if (empty($accessGranted)) {
     $accessGranted = MM_NO_DATA;
 }
 // Attributes
 $attributes = "";
 if ($product->hasTrial()) {
     $attributes .= MM_Utils::getIcon('clock-o', 'beige', '1.3em', '0px', 'Has Trial', 'margin-right:5px;');
 } else {
     $attributes .= "<img title='No Trial' style='margin-right:5px;' src='" . MM_Utils::getImageUrl("clear") . "' />";
 }
 if ($product->isRecurring()) {
     if ($product->doLimitPayments()) {
    $obj->id = "mt_" . $id;
    $obj->value = $name;
    $obj->image = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP, '', 'float:left; padding-right: 5px; padding-left: 5px;');
    $options[$obj->id] = $obj;
    $rows[] = $obj;
    if (isset($selectedTypes[$obj->id])) {
        $showRows[] = $obj;
    }
}
$accessTags = MM_Bundle::getBundlesList();
foreach ($accessTags as $id => $name) {
    $at = new MM_Bundle($id);
    $obj = new stdClass();
    $obj->id = "at_" . $id;
    $obj->value = $name;
    $obj->image = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE, '', 'float:left; padding-right: 5px; padding-left: 5px;');
    $options[$obj->id] = $obj;
    $rows[] = $obj;
    if (isset($selectedTypes[$obj->id])) {
        $showRows[] = $obj;
    }
}
$maxCheckboxLength = 18;
$maxHeaderLength = 14;
$maxPostLength = 25;
$maxPostLengthPlus = $maxPostLength + 20;
$viewDeliveryAccessTypes = MM_HtmlUtils::createCheckboxGroup($options, "view_schedules[]", $selectedTypes, null, "", null, $maxCheckboxLength);
$copyAccessTypesFrom = MM_HtmlUtils::createCheckboxGroup($options, "copy_schedules_from", $selectedFromCopy, "", null, "", $maxCheckboxLength, true);
$copyAccessTypesTo = MM_HtmlUtils::createCheckboxGroup($options, "copy_schedules_to", $selectedToCopy, "", null, "", $maxCheckboxLength, true);
//style
$color = "#666";
         $details = "Account created with <em>{$accessName}</em> membership";
         break;
     case MM_Event::$MEMBER_STATUS_CHANGE:
         $eventType = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP, "Membership status changed");
         $details = "<em>{$accessName}</em> membership status changed to {$accessStatusInfo}";
         break;
     case MM_Event::$MEMBER_MEMBERSHIP_CHANGE:
         $eventType = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP, "Membership level changed");
         $details = "Membership changed to <em>{$accessName}</em>";
         break;
     case MM_Event::$BUNDLE_ADD:
         $eventType = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE, "Bundle added");
         $details = "<em>{$accessName}</em> bundle added to account";
         break;
     case MM_Event::$BUNDLE_STATUS_CHANGE:
         $eventType = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE, "Bundle status changed");
         $details = "<em>{$accessName}</em> bundle status changed to {$accessStatusInfo}";
         break;
 }
 // add complimentary indicator
 if (isset($params[MM_ActivityLog::$PARAM_ACCESS_IS_COMPLIMENTARY]) && $params[MM_ActivityLog::$PARAM_ACCESS_IS_COMPLIMENTARY] == "true") {
     switch ($params[MM_ActivityLog::$PARAM_ACCESS_EVENT]) {
         case MM_Event::$MEMBER_ADD:
         case MM_Event::$MEMBER_MEMBERSHIP_CHANGE:
         case MM_Event::$BUNDLE_ADD:
             $compDescription = $params[MM_ActivityLog::$PARAM_ACCESS_EVENT] == MM_Event::$BUNDLE_ADD ? "Bundle" : "Membership";
             $compDescription .= " is complimentary";
             $details .= MM_Utils::getDiscountIcon($compDescription, "margin-left:5px;");
             break;
         case MM_Event::$MEMBER_STATUS_CHANGE:
         case MM_Event::$BUNDLE_STATUS_CHANGE:
Beispiel #4
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;
                 }
             }
         }
     }
 }
Beispiel #5
0
    }
    // Name / Subscribers
    if (!empty($item->member_count)) {
        $item->name .= '<p>' . MM_Utils::getIcon('users', 'blue', '1.2em', '1px', '', 'margin-right:2px; margin-left:25px;') . ' <a href="' . MM_ModuleUtils::getUrl(MM_MODULE_MANAGE_MEMBERS, MM_MODULE_BROWSE_MEMBERS) . '&membershipId=' . $item->id . '">' . $item->member_count . ' Members</a></p>';
    } else {
        $item->name .= '<p>' . MM_Utils::getIcon('users', 'grey', '1.2em', '1px', '', 'margin-right:2px; margin-left:25px;') . ' <i>No Subscribers</i></p>';
    }
    // Bundles
    $bundles = array();
    if (!empty($item->bundles)) {
        foreach ($item->bundles as $bundle) {
            $bundles[] = "<a href='" . MM_ModuleUtils::getUrl(MM_MODULE_PRODUCT_SETTINGS, MM_MODULE_BUNDLES) . "&autoload=" . $bundle->id . "'>" . $bundle->name . "</a>";
        }
    }
    if (!empty($bundles)) {
        $item->bundles = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE, '', 'margin-right:5px;');
        $item->bundles .= join(', ', $bundles);
    } else {
        $item->bundles = MM_NO_DATA;
    }
    // Actions
    $editActionUrl = 'onclick="mmjs.edit(\'mm-member-types-dialog\', \'' . $item->id . '\')"';
    $deleteActionUrl = 'onclick="mmjs.remove(\'' . $item->id . '\')"';
    $actions = MM_Utils::getEditIcon("Edit Membership Level", '', $editActionUrl);
    if (!$membership->hasAssociations() && intval($item->member_count) <= 0) {
        $actions .= MM_Utils::getDeleteIcon("Delete Membership Level", 'margin-left:5px;', $deleteActionUrl);
    } else {
        $actions .= MM_Utils::getDeleteIcon("This membership level is currently being used and cannot be deleted", 'margin-left:5px;', '', true);
    }
    $rows[] = array(array('content' => $defaultFlag . " <span title='ID [" . $item->id . "]'>" . $item->name . "</span>"), array('content' => $membershipLevel), array('content' => $productAssociations), array('content' => $item->bundles), array('content' => $purchaseLinks), array('content' => MM_Utils::getStatusImage($item->status)), array('content' => $actions));
}