/** * Generate JSON for the specified site */ function getJsonList() { $banners = array(); // See if we have any preferred campaigns for this language and project $campaigns = CentralNoticeDB::getCampaigns($this->project, $this->language, null, 1, 1, $this->location); // Quick short circuit to show preferred campaigns if ($campaigns) { // Pull banners $banners = CentralNoticeDB::getCampaignBanners($campaigns); } // Didn't find any preferred banners so do an old style lookup if (!$banners) { $banners = CentralNoticeDB::getBannersByTarget($this->project, $this->language, $this->location); } return FormatJson::encode($banners); }