getUser();
$user = Dap_User_TWDU::loadUserTWDU($user->getId()); //reload to TWDU User object
$product = Dap_Product::loadProductByName(BRONZE);
$userProduct = Dap_UsersProducts::load($user->getId(), $product->getId());
$activeResources = $userProduct->getActiveResources();
//take out bonuses, fix extra
-
$activeResources = str_replace(“
- Keyholder Member Home
- Maximize Your Marketing
- “;
$preBonuses .= $fileResources;
$preBonuses .= “ - Library Credits
“, “”, $activeResources);
$activeResources = str_replace(“
“,””, $activeResources);
$activeResources = str_replace(“
- “, “”, $activeResources);
$activeResources = str_replace(“
“, “”, $activeResources);
$output = ”
var whatRequest; var userId;
function processChange(responseText, responseStatus, responseXML) { if (responseStatus == 200) {// 200 means \"OK\" var resource = eval('(' + responseText + ')'); if(resource.whatRequest == 'toggle') {
var allReminders = document.getElementById('allReminders'); if(allReminders.innerHTML == '') {
allReminders.innerHTML = resource.responseJSON;
allReminders.style.height='auto'; if (document.all) { var rHeight = allReminders.offsetHeight+10; } else { var rHeight = allReminders.offsetHeight; }
allReminders.innerHTML = '';
$('#notice').animate({height:rHeight+25}, 500);
allReminders.innerHTML = resource.responseJSON; } else { allReminders.innerHTML = '';
allReminders.style.height='auto'; if (document.all) { var rHeight = allReminders.offsetHeight+10; } else { var rHeight = allReminders.offsetHeight; }
allReminders.innerHTML = resource.responseJSON;
$('#notice').animate({height:rHeight+25}, 350);
allReminders.innerHTML = ''; } } else { //hide the div updateNotifications(resource.responseJSON); }
} else {// anything else means a problem alert(\"There was a problem in the returned data\"); } }
function updateNotifications(notifyId) { document.getElementById(notifyId).style.display = \"none\";
var allReminders = document.getElementById('allReminders'); allReminders.style.height='auto'; if (document.all) { var rHeight = allReminders.offsetHeight+10; } else { var rHeight = allReminders.offsetHeight; }
document.getElementById(notifyId).style.display = \"block\";
$('#notice').animate({height:rHeight+25}, 450);
document.getElementById(notifyId).style.display = \"none\"; }
function hide(notificationId) { var url = '../dap/admin/ajax/updatePreferencesAjax.php'; var request = new ajaxObject(url,processChange); request.update('notificationId=' + notificationId, 'POST'); }
function toggle() { var url = '../dap/admin/ajax/updateRemindersAjax.php'; var request = new ajaxObject(url,processChange); request.update('whatRequest=toggle', 'POST'); }
“;
$userProducts = Dap_UsersProducts::loadProducts($user->getId());
$counter = 0;
foreach ($userProducts as $userProductSingle) {
$productSingle = Dap_Product::loadProduct($userProductSingle->getProduct_id());
if($productSingle->getName() != BRONZE && $productSingle->getName() != SILVER && $productSingle->getName() != GOLD && $productSingle->getIsBonus() != “Y” && $userProductSingle->getActiveResources() != “
“) {
$fixedResource = str_replace(“
- “, “”, $userProductSingle->getActiveResources());
$fixedResource = str_replace(“
“, “”, $fixedResource);
//List of products
//load the category the product belongs to
if($productSingle->getCategory() == 0 || $productSingle->getCategory() == null) {
$catIndex = 9999999;
if(empty($preOutputArray[$catIndex])) $preOutputArray[$catIndex] = “Other”;
}
else {
$category = Dap_ProductCategories::load($productSingle->getCategory());
//set the category name in the output array
$catIndex = $category->getOrder() * 1000;
if(empty($preOutputArray[$catIndex])) $preOutputArray[$catIndex] = $category->getName();
}
//place the product in out put array at the index order + 000
$preOutputArray[$catIndex] .= $fixedResource;
//$preOutput .= $fixedResource;
//need a list of just library products for latest 3 div
$cleanedUserProducts[] = $userProductSingle;
$counter++;
}
}
//after loop through, we’ll create output string from array
//$preOutput = implode($preOutputArray);
$preOutput .= $preOutputArray[1000] . $preOutputArray[2000] . $preOutputArray[3000] . $preOutputArray[9999999];
//latest 3 div
$lastIndex = (count($cleanedUserProducts) – 1);
//make sure user has at least 1 product
if($lastIndex >= 0) {
$cleanUserProduct = $cleanedUserProducts[0];
$fixedResource = str_replace(“
- “, “”, $cleanUserProduct->getActiveResources());
$fixedResource = str_replace(“
“, “”, $fixedResource);
$top3Output = $fixedResource;
if($lastIndex >= 1) {
$cleanUserProduct = $cleanedUserProducts[1];
$fixedResource = str_replace(“
- “, “”, $cleanUserProduct->getActiveResources());
$fixedResource = str_replace(“
“, “”, $fixedResource);
$top3Output .= $fixedResource;
}
if($lastIndex >= 2) {
$cleanUserProduct = $cleanedUserProducts[2];
$fixedResource = str_replace(“
- “, “”, $cleanUserProduct->getActiveResources());
$fixedResource = str_replace(“
“, “”, $fixedResource);
$top3Output .= $fixedResource;
}
}
$productsForBonuses = Dap_Product::loadProducts(“”, “”);
foreach($productsForBonuses as $productForBonuses) {
if($productForBonuses->getIsBonus() == “Y”) {
$twduMemb = Dap_User::twduMembership($user->getId());
switch($twduMemb) {
case “http://www.thewealthydentistuniversity.com/” . GOLDurl:
$twduMemb = 16;
break;
case “http://www.thewealthydentistuniversity.com/” . SILVERurl:
$twduMemb = 15;
break;
case “http://www.thewealthydentistuniversity.com/” . BRONZEurl:
$twduMemb = 9;
break;
}
//only allow if bonus belongs to their twdu main product
if(in_array($twduMemb, explode(“,”, $productForBonuses->getBonusBelongsTo()))) {
$fileResourcesArray = Dap_Product::displayFileResourcesList($productForBonuses->getId());
if($fileResourcesArray) {
foreach($fileResourcesArray as $fileResources) {
$preBonuses = “
“;
$bonuses = substr_replace($bonuses, $preBonuses, 0, 0);
}
}
}
}
}
if($counter == 0) {
$top3Output = “None added yet.”;
}
//build Notices
//function that returns an array of non-expired notices
$notificationArray = Notifications::loadAllNotExpired($user->getId());
if($notificationArray) {
//everything in array is shown if someone clicks on their notifications list
foreach($notificationArray as $notification) {
$notifyDivs .= “
Newest Additions To Your Library
“.$top3Output.”
” . $product->getName() . “
- ” . $activeResources . “
Video Tutorials
Your Personal Library
- “;
$output .= $preOutput;
if($counter == 0) {$output .= “None added yet.”;}
$output .= ‘
‘;
//Bonuses
$output .= “
Your Bonuses
- “.$bonuses.”
“;
echo $output;
?>