コード例 #1
0
 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)));
 }
コード例 #2
0
ファイル: rss.php プロジェクト: jamesming/find-my-monkey
 public function CreateRSS($query, $title_p, $link_p, $description_p)
 {
     // recent
     $rss_top = new HtmlElement('rss');
     $rss_top->Set('version', '2.0');
     $channel = new HtmlElement('channel');
     $title = new HtmlElement('title');
     $title->Set('text', $title_p);
     $link = new HtmlElement('link');
     $link->Set('text', $link_p);
     $description = new HtmlElement('description');
     $description->Set('text', $description_p);
     $language = new HtmlElement('language');
     $language->Set('text', 'en-us');
     $webmaster = new HtmlElement('webMaster');
     $webmaster->Set('text', '*****@*****.**');
     $channel->Inject($title);
     $channel->Inject($link);
     $channel->Inject($description);
     $channel->Inject($language);
     $channel->Inject($webmaster);
     parent::SetQuery($query);
     $exists = parent::CountDBResults();
     if ($exists) {
         // records exist
         $num = 0;
         $results = parent::DoQuery();
         while ($results[$num]) {
             // loop through results
             $item = new HtmlElement('item');
             $title = new HtmlElement('title');
             $title->Set('text', $results[$num]["one_liner"]);
             $link = new HtmlElement('link');
             $append_to_url[] = "offer_id={$results[$num]["offer_id"]}";
             $offer_url = "offer-details";
             if ($this->localData["aff_id"]) {
                 // affiliate set
                 $append_to_url[] = "aff_id={$this->localData["aff_id"]}";
             }
             if ($this->localData["location_id"]) {
                 // location id set
                 //$append_to_url[] = "location_id={$this->localData["location_id"]}";
                 $offer_url = "offer-details";
             }
             if (sizeOf($append_to_url) > 0) {
                 // append parameters to URL
                 $appended_url_string = "?" . join("&", $append_to_url);
             }
             $link->Set('text', 'http://www.findmymonkey.com/' . $offer_url . $appended_url_string);
             parent::SetQuery("SELECT * FROM `table_offerlocations`,`table_locations` WHERE \r\n\t\t\t\t`table_offerlocations`.`location_id`=`table_locations`.`location_id`\r\n\t\t\t\tAND\r\n\t\t\t\t`table_offerlocations`.`offer_id`='{$results[$num]["offer_id"]}'");
             $offerLocations = parent::DoQuery();
             $locationArr = array();
             foreach ($offerLocations as $offerLocation) {
                 // loop through each location
                 $locationArr[] = $offerLocation["location"];
             }
             $locationStr = join(", ", $locationArr);
             $description = new HtmlElement('description');
             $description->Set('text', $results[$num]["description"] . htmlentities("<br/><br/>A <b>\${$results[$num]["value"]} value</b> for <i>only</i> <b>\${$results[$num]["price"]}</b>" . " - Limit: <b>{$results[$num]["limit"]}</b>" . "<br/><br/>Offer Available for these Locations: {$locationStr}<br/><br/>" . "", ENT_QUOTES));
             $pubDate = new HtmlElement('pubDate');
             $pubDate->Set('text', date("M-d-Y H:i:s", time()));
             $item->Inject($title);
             $item->Inject($link);
             $item->Inject($description);
             $item->Inject($pubDate);
             $channel->Inject($item);
             $num += 1;
         }
         $rss_top->Inject($channel);
         echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
         echo $rss_top->BuildHTML();
     }
 }