Ejemplo n.º 1
1
 public function delete()
 {
     $appHouseAds = AppHouseAdUtil::getAppHouseAdsByCid($this->id);
     foreach ($appHouseAds as $appHouseAd) {
         $appHouseAd->delete();
     }
     if (!empty($this->imageLink)) {
         if (extension_loaded('curl') && !@dl(PHP_SHLIB_SUFFIX == 'so' ? 'curl.so' : 'php_curl.dll')) {
             $s3 = new S3(HouseAd::$HOUSEAD_AWS_KEY, HouseAd::$HOUSEAD_AWS_SECRET);
             $s3->deleteObject(HouseAd::$HOUSEAD_BUCKET, basename($this->imageLink));
         }
     }
     parent::delete();
     CacheUtil::invalidateCustom($this->id);
 }
Ejemplo n.º 2
0
 public function edit()
 {
     $this->jsFiles[] = "/js/jqsm135.js";
     $this->jsFiles[] = "/js/jquery.validate.min.js";
     $this->needsHouseAd();
     $this->jsFiles[] = "/js/ajaxupload.js";
     $this->smarty->assign('returnPage', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null);
     $apps = AppUtil::getAppsByUid($this->user->id);
     $appHouseAds = array();
     foreach (AppHouseAdUtil::getAppHouseAdsByCid($this->houseAd->id) as $appHouseAd) {
         $appHouseAds[$appHouseAd->aid] = $appHouseAd;
     }
     foreach ($apps as $app) {
         if (array_key_exists($app->id, $appHouseAds)) {
             $app->ahid = $appHouseAds[$app->id]->id;
         }
     }
     $this->smarty->assign('apps', $apps);
     $hasiPhoneApp = false;
     $hasAndroidApp = false;
     foreach ($apps as $app) {
         $hasiPhoneApp |= $app->platform == 1;
         $hasAndroidApp |= $app->platform == 2;
     }
     $this->smarty->assign('hasNoiPhoneApp', !$hasiPhoneApp);
     $this->smarty->assign('hasNoAndroidApp', !$hasAndroidApp);
     $this->styleSheets[] = "/css/preview.css";
     $this->smarty->assign('linkTypeOptions', HouseAd::$HOUSEAD_LINKTYPES);
     $this->smarty->assign('typeOptions', HouseAd::$HOUSEAD_TYPES);
     $this->smarty->assign('createOrEdit', 'edit');
     $this->smarty->assign('appHouseAds', $appHouseAds);
     $this->breadcrumbs[] = array('text' => "Edit", 'link' => '/houseAds/ad/edit');
     $this->smarty->assign('houseAd', $this->houseAd);
     fb("smarty", $this->smarty->get_template_vars());
     return $this->smarty->fetch('../tpl/www/houseAds/create.tpl');
 }