×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Vlad Krasovsky
Added: Oct 23, 2014 4:05 PM
Views: 11
Tags: no tags
  1. <?php
  2.         dbo::includeDBO("file");
  3.         dbo::includeDBO("onlineNow");
  4.         dbo::includeDBO("city");
  5.         dbo::includeDBO("state");
  6.         dbo::includeDBO("country");
  7.         //$formVals
  8.        
  9.         dbo::includeDBO("onlineNow");
  10.        
  11.         $formVals = array();
  12.         $locationDisplayStr = "";
  13.         $postCity = new city();
  14.         $postState = new state();
  15.         $postCountry = new country();
  16.         $hasLocation = false;
  17.         $urlArr = array();
  18.         if(! empty($_GET["city"])){
  19.                 $hasLocation = true;
  20.                 $formVals["city"] = $_GET["city"];
  21.                 $urlArr["city"] = $_GET["city"];
  22.                 $postCity->initById($_GET["city"]);
  23.                 $locationDisplayStr = $postCity->getName();
  24.         }
  25.         else if(! empty($_GET["state"])){
  26.                 $hasLocation = true;
  27.                 $formVals["state"] = $_GET["state"];
  28.                 $urlArr["state"] = $_GET["state"];
  29.                 $postState->initById($_GET["state"]);
  30.                 $locationDisplayStr = $postState->getFullName();
  31.         }
  32.         else if(! empty($_GET["country"])){
  33.                 $hasLocation = true;
  34.                 $formVals["country"] = $_GET["country"];
  35.                 $urlArr["country"] = $_GET["country"];
  36.                 $postCountry->initById($_GET["country"]);
  37.                 $locationDisplayStr = $postCountry->getName();
  38.         }
  39.        
  40.         $useHashUrl = false;
  41.         $sectionId = 9;
  42. //      $sectionId = $_GET["section"];
  43.         $onlineNowUserArr = onlineNow::findOnlineNowUserArr(null, null, null, true, array("6") ,null,false, array("sectionId"=>$sectionId));
  44.         $onlineNowArr = array();
  45.         $onlineCount = 0;
  46.        
  47.         foreach($onlineNowUserArr as $onlineNowInfo){
  48.                 if(empty($onlineNowInfo["COUNTRY_ID"])) continue;
  49.                 if($hasLocation){
  50.                         if(! empty($formVals["city"]) && $onlineNowInfo["CITY_ID"] != $formVals["city"]) continue;
  51.                         if(! empty($formVals["state"]) && $onlineNowInfo["STATE_ID"] != $formVals["state"]) continue;
  52.                         if(! empty($formVals["country"]) && $onlineNowInfo["COUNTRY_ID"] != $formVals["country"]) continue;
  53.                 }
  54.                 $countryName = $onlineNowInfo["COUNTRY_NAME"]."|".$onlineNowInfo["REGION_CODE"];
  55.                 $stateName = $onlineNowInfo["STATENAME"]."|".$onlineNowInfo["STATE_CODE"];
  56.                 if(! empty($onlineNowInfo["PREMIUM_CITY_SUBDOMAIN"]) && ! empty($onlineNowInfo["PREMIUM_CITY_ID"]) && $onlineNowInfo["CITY_TIER"] == 1)
  57.                         $tSite_name = "{$onlineNowInfo["CITY_NAME"]}|".cityvibeUtils::createUrl ("premium", null, null, $onlineNowInfo["POST_CITY_SUBDOMAIN"])."|{$onlineNowInfo["POST_CITY_SUBDOMAIN"]}";
  58.                 else{
  59.                         if(! empty($onlineNowInfo["COUNTRY_ID"]) && $onlineNowInfo["COUNTRY_ID"] == 1){
  60.                                 $tSite_name = "{$onlineNowInfo["CITY_NAME"]}|".cityvibeUtils::createUrl ("post", null, null, $onlineNowInfo["POST_CITY_SUBDOMAIN"],"Escorts")."|{$onlineNowInfo["POST_CITY_SUBDOMAIN"]}";
  61.                         }
  62.                         else $tSite_name = "{$onlineNowInfo["CITY_NAME"]}|".cityvibeUtils::createUrl ("post", null, null, $onlineNowInfo["POST_CITY_SUBDOMAIN"],"categories")."|{$onlineNowInfo["POST_CITY_SUBDOMAIN"]}";
  63.                 }
  64.                 if(empty($onlineNowArr[$countryName])) $onlineNowArr[$countryName] = array();
  65.                 if(empty($onlineNowArr[$countryName][$stateName])) $onlineNowArr[$countryName][$stateName] = array();
  66.                 if(empty($onlineNowArr[$countryName][$stateName][$tSite_name])) $onlineNowArr[$countryName][$stateName][$tSite_name] = array();
  67.                 if(empty($onlineNowArr[$countryName][$stateName][$tSite_name]['onlineNow'])) $onlineNowArr[$countryName][$stateName][$tSite_name]['onlineNow'] = array();
  68.                 $onlineCount++;
  69.                 array_push($onlineNowArr[$countryName][$stateName][$tSite_name]['onlineNow'], $onlineNowInfo);
  70.         }
  71.  
  72.         $numColumns = 4;
  73.         $columnWidth = floor(962/$numColumns);
  74.        
  75.         $doShowModalVal = 0;
  76.         $tModalSession = fuzzUtils::getSessionValue("available-now-modal");
  77.         if(empty($tModalSession)){
  78.                 $doShowModalVal = 1;
  79.                 fuzzUtils::setSessionValue("available-now-modal", 1);
  80.         }
  81.        
  82.         $opt = array("actionURL"=>  cityvibeUtils::createUrl("post", null, null, null, "available"));
  83.         $cityForm = new fuzzForm("cityForm", "cityvibe", "advertising", "get", false, false, false, $opt);
  84.         city::createFormObjects($cityForm, $formVals, null, false, false, "", array("doHideChildrenCities"=>true));
  85.         $cityForm->setOnChange("city","fuzzForm.validateForm('cityForm');");
  86.         $cityForm->setFormValues($formVals);
  87.        
  88.         $metaTagArr = cityvibeUtils::getMetaInfoArrByTag("available", array("urlArr"=>$urlArr, "postCity"=>$postCity, "postState"=>$postState, "postCountry"=>$postCountry));
  89.         $this->view->set(fuzzView::TEMPLATE_META_TAGS,$metaTagArr);
  90.        
  91. ?>
  92.