×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: asd asd
Added: Oct 24, 2014 6:13 PM
Views: 6
Tags: no tags
  1. <?php
  2.  
  3. include_once("{$fuzz->config->get(fuzzConfig::TYPE_PATH_BASE)}/cityvibe/content/widgets/scroller/scroller.php");
  4. dbo::includeDBO("ad");
  5. dbo::includeDBO("city");
  6. dbo::includeDBO("file");
  7. dbo::includeDBO("premiumPost");
  8. dbo::includeDBO("postCategory");
  9.  
  10. $db = new dbConnector();
  11.  
  12. $postViewObj = $submitData["postViewObj"];
  13. $tPostViewData = $postViewObj->getDataArr();
  14.  
  15. $premiumArr = $tPostViewData["premiumArr"];
  16.  
  17. $premiumPostArr = $tPostViewData["premiumPostArr"];
  18.  
  19. $listingsArr = $tPostViewData["listingsArr"];
  20.  
  21.  
  22. $postCity = $tPostViewData["postCity"];
  23. $tier = $postCity->getTier();
  24. $days = $postCity->getReviewDisplayDate();
  25.  
  26.  
  27. $reviewsArr = array();
  28. $reviewsArr["premiumArr"] = array();
  29. $reviewsArr["premiumPostArr"] = array();
  30. $reviewsArr["listingsArr"] = array();
  31.  
  32.  
  33. //dump($listingsArr);
  34. $now = strtotime('now');
  35. $beg_date = strtotime("-{$days} day");
  36. //dump($now);
  37. //dump($beg_date);
  38.  
  39. foreach ($listingsArr as $element) {
  40.  
  41.     foreach ($element as $key) {
  42.         if (is_array($key)) {
  43.             foreach ($key as $keyValue) {
  44.                 if (is_array($keyValue)) {
  45.                     foreach ($keyValue as $value) {
  46.                         $elDate = strtotime($value["last_review_date"]);
  47.                         if ($elDate !== false && $elDate >= $beg_date && $elDate <= $now) {
  48.                             $reviewsArr["listingsArr"][] = $value;
  49.                         }
  50.                     }
  51.                 }
  52.             }
  53.         }
  54.     }
  55.  
  56.  
  57.  
  58.     //dump($element["last_review_date"]);
  59.     //dump($elDate);
  60. }
  61.  
  62. foreach ($premiumPostArr as $element) {
  63.     $elDate = strtotime($element["last_review_date"]);
  64.     if ($elDate !== false && $elDate >= $beg_date && $elDate <= $now) {
  65.         $reviewsArr["premiumPostArr"][] = $element;
  66.     }
  67. }
  68.  
  69. foreach ($premiumArr as $element) {
  70.     $elDate = strtotime($element["last_review_date"]);
  71.     if ($elDate !== false && $elDate >= $beg_date && $elDate <= $now) {
  72.         $reviewsArr["premiumArr"][] = $element;
  73.     }
  74. }
  75.  
  76. dump($reviewsArr);
  77. ////////////////////////////////////////////////////////////////////////////////////////
  78. // Set up the ad scroller
  79. $totalAdsPerPage = 12;
  80. $totalPostPremiumPerPage = 6;
  81. $pageWidth = 878;
  82. $itemWidth = floor($pageWidth / $totalAdsPerPage);
  83. $postPremiumItemWidth = floor($pageWidth / $totalPostPremiumPerPage);
  84.  
  85. $postPremiumThumbWidth = $postPremiumItemWidth - 10;
  86. $thumbWidth = $itemWidth - 10;
  87. $itemCount = 1;
  88. $totalAdCount = count($legacyAdArr) + count($premiumPostArr);
  89. $lastPage = 0;
  90.  
  91. // set up the gallery items (if needed)
  92. $galleryWidth = 972;
  93. $galleryPerRow = 12;
  94. $galleryItemWidth = floor($galleryWidth / $galleryPerRow);
  95. ///////////////////////////////////////////////////////////////////////////////////////////
  96. //
  97. //foreach( $reviewsArr["premiumPostArr"] as $adArr){
  98. //      $tArr = array();
  99. //      $tArr["name"] = $adArr["name"];
  100. //      $tUrl = cityvibeUtils::createUrl("premium-post", $adArr["id"], $adArr["name"]." ".$adArr["title"], $adArr["subdomain"], "VIP");
  101. //      //$tArr["onClick"] = "javascript:scrollerWidget.forwardItemUrl('premiumScroller','premium-post-item-{$adArr["id"]}','{$tUrl}');";
  102. //      $tArr["url"] = $tUrl;
  103. //     
  104. //      $imgAlt = cityvibeUtils::getImgAlt("vip", array("city"=>$postCity->getName(), "name"=>$adArr["name"]));
  105. //
  106. //      ob_start();
  107. //              file::displayThumbnail($adArr["handle"], $postPremiumThumbWidth, $postPremiumThumbWidth, false, "no-image", array("alt"=>$imgAlt));
  108. //      $tArr["img"] = ob_get_clean();
  109. //      $tArr["id"] = $adArr["id"];
  110. //
  111. //
  112. //      $page = ceil($itemCount / $totalPostPremiumPerPage);
  113. //
  114. //      if($page != $lastPage){
  115. //              $lastPage = $page;
  116. //              $premiumScroller->addPage("ad-page-{$page}");
  117. //             
  118. //      }
  119. //      $premiumScroller->addItem("ad-page-{$page}", "premium-post-item-{$tArr["id"]}", $tArr, "vipTemplate");
  120. //      $itemCount++;
  121. //
  122. //}
  123.  
  124. $onlineNowInfoArr = array();
  125. $onlineNowInfoArr["post"] = array();
  126. $onlineNowInfoArr["ad"] = array();
  127.  
  128. foreach ($reviewsArr["listingsArr"] as $onlineArr) {
  129.     $tOnlineNowInfo = array();
  130.     $imgSrc = $fuzz->assets->getUrl("blank.png", array("shared"));
  131.     $imgHandle = false;
  132.     $tOnlineNowInfo["isTextMsg"] = ($onlineArr["is_mobile"] == "1");
  133.     $tOnlineNowInfo["latitude"] = $onlineArr["latitude"];
  134.     $tOnlineNowInfo["longitude"] = $onlineArr["longitude"];
  135.     if ($onlineArr["is_mobile"] == 0) {
  136.         $tOnlineNowInfo["icon"] = "<img style='margin:1px -3px 0px -3px;' src='{$fuzz->assets->getUrl("onlinenow_update.gif", array("shared", "icons"))}'>";
  137.     } else {
  138.         $tOnlineNowInfo["icon"] = "<img style='margin:0px 2px 0px 0px;' src='{$fuzz->assets->getUrl("onlinenow_mobile.gif", array("shared", "icons"))}'>";
  139.     }
  140.     if (!empty($onlineArr["post_id"])) {
  141.         $catFolder = array($onlineArr["post_category_folder_name"]);
  142.         $tOnlineNowInfo["url"] = cityvibeUtils::createUrl("post", $onlineArr["post_id"], $onlineArr["post_title"], $postCity->getSubdomain(), $catFolder, array(), true);
  143.         $tOnlineNowInfo["onClick"] = "postsView.displayListing(event,this,'post',{$onlineArr["psot_id"]})";
  144.         $tOnlineNowInfo["id"] = $onlineArr["ad_id"];
  145.  
  146.         $username = $onlineArr["myc_username"];
  147.         if (!empty($onlineArr["post_name"]))
  148.             $username = $onlineArr["post_name"];
  149.         else if (is_numeric($username) && $onlineArr["myc_email"] == "placeholder@noemail.com") {
  150.             $username = $onlineArr["post_title"];
  151.         }
  152.         $tOnlineNowInfo["name"] = (!empty($onlineArr["post_name"])) ? $onlineArr["post_name"] : $onlineArr["myc_username"];
  153.         $tOnlineNowInfo["imgAlt"] = cityvibeUtils::getImgAlt("post", array("city" => $onlineArr["city_name"], "category" => $onlineArr["post_category_name"], "name" => $username));
  154.  
  155.         if (!empty($onlineArr["post_img_handle"])) {
  156.             $imgSrc = file::getURLByHandle($onlineArr["post_img_handle"]);
  157.             $imgHandle = $onlineArr["post_img_handle"];
  158.         }
  159.         $tOnlineNowInfo["imgHandle"] = $imgHandle;
  160.         $tOnlineNowInfo["img"] = $imgSrc;
  161.         $onlineNowInfoArr["post"]["{$onlineArr["post_id"]}"] = $tOnlineNowInfo;
  162.     } else if (!empty($onlineArr["ad_id"])) {
  163.         $imgSrc = ad::getImageUrl($onlineArr['th_photofile'], $onlineArr['site_id']);
  164.         $tOnlineNowInfo["img"] = $imgSrc;
  165.         $tOnlineNowInfo["id"] = $onlineArr["ad_id"];
  166.         $tOnlineNowInfo["name"] = $onlineArr["name"];
  167.         $tOnlineNowInfo["imgAlt"] = cityvibeUtils::getImgAlt("premium", array("city" => $onlineArr["city_name"], "name" => $onlineArr["ad_name"]));
  168.  
  169.         $onlineNowInfoArr["ad"]["{$onlineArr["ad_id"]}"] = $tOnlineNowInfo;
  170.     }
  171. }
  172.  
  173. dump($onlineNowInfoArr);
  174.