public function GetLocations() { # Create Location Drop-Down $this->CheckMyLocation(); parent::SetQuery("SELECT * FROM `aggregate_deal_region` ORDER BY location ASC"); $locations = parent::DoQuery(); $locationLinks = array(); parent::SetQuery("SELECT * FROM `aggregate_deal_region` WHERE aggregate_deal_region_id='{$this->localData["location_id"]}'"); $cityInfo = parent::DoQuery(); $first_city = $cityInfo[0]["location"]; foreach ($locations as $location) { // location dropdowns $link_div = new HtmlElement('div'); $link_div->Set('style', 'padding: 8px; padding-left: 20px;'); $link_div->Set('onmouseover', 'this.style.backgroundColor=\'#794933\';'); $link_div->Set('onmouseout', 'this.style.backgroundColor=\'transparent\';'); $link = new HtmlElement('a'); $link->Set('href', $this->localData["current_page"] . '?location_id=' . $location["location_id"]); $link->Set('class', 'city-dropdown-link'); $link->Set('text', $location["location"]); $link_div->Inject($link); if ($location["location"] != $first_city) { // don't display the currently selected city $locationLinks[] = $link_div->ReturnData(); } } $this->JsonOutput(array("first_city" => $first_city, "cities" => join("", $locationLinks))); }