Exemplo n.º 1
0
 public function appHouseAds()
 {
     $this->needsApp();
     $this->breadcrumbs[] = array("text" => "House Ads", "link" => "/apps/oneApp/appHouseAds");
     $appHouseAds = array();
     foreach (AppHouseAdUtil::getAppHouseAdsByAid($this->app->id) as $appHouseAd) {
         $appHouseAds[$appHouseAd->cid] = $appHouseAd;
     }
     $houseAds = array();
     fb("getAllHouseAds", "");
     $allHouseAds = HouseAdUtil::getHouseAdsByUid($this->user->id);
     // fb("houseAds",HouseAdUtil::getHouseAdsByAid($this->app->id));
     fb("gotAllHouseAdsForThisUser", "");
     $houseAdsForThisApp = HouseAdUtil::getHouseAdsByAid($this->app->id, $allHouseAds);
     fb("getAllHouseAdsForThisApp", "");
     foreach ($houseAdsForThisApp as $houseAd) {
         if (array_key_exists($houseAd->id, $appHouseAds)) {
             $houseAds[] = $houseAd;
             $houseAd->weight = $appHouseAds[$houseAd->id]->weight;
             $houseAd->ahid = $appHouseAds[$houseAd->id]->id;
         }
     }
     fb("prepAddableHouseAds", "");
     $addableHouseAds = array('' => 'Choose an Ad');
     foreach ($allHouseAds as $houseAd) {
         if (!array_key_exists($houseAd->id, $appHouseAds)) {
             if ($this->app->platform == '1' && $houseAd->isForiPhone() || $this->app->platform == '2' && $houseAd->isForAndroid()) {
                 $addableHouseAds[$houseAd->id] = $houseAd->name;
             }
         }
     }
     fb("doneAddableHouseAds", $addableHouseAds);
     $networks = $this->app->getNetworks();
     if (array_key_exists('9', $networks) && $networks['9']->adsOn == 1) {
         $this->smarty->assign('houseAdShare', $networks['9']->weight);
     }
     usort($houseAds, create_function('$a,$b', "return strcasecmp(\$a->name, \$b->name);"));
     $this->subtitle = "House Ads";
     $this->smarty->assign('app', $this->app);
     $this->smarty->assign('sideNav_current', 'houseAds');
     $this->smarty->assign('linkLabels', HouseAd::$HOUSEAD_LINKTYPES);
     $this->smarty->assign('houseAds', $houseAds);
     $this->smarty->assign('addableHouseAds', $addableHouseAds);
     $this->smarty->assign('houseAdTypes', HouseAd::$HOUSEAD_TYPES);
     fb("smarty", $this->smarty->get_template_vars());
     return $this->smarty->fetch('../tpl/www/apps/appHouseAds.tpl');
 }
Exemplo n.º 2
0
 public function getHouseAds()
 {
     if ($this->houseAds == null) {
         $this->houseAds = HouseAdUtil::getHouseAdsByAid($this->id);
     }
     return $this->houseAds;
 }