public static function getInstance() { if (null == self::$instance) { self::$instance = new AdsUtils(); } return self::$instance; }
// res $res = ['req' => 'saveAd', 'res' => $res, 'lst' => $lst, 'err' => $err]; break; case 'delete-ad': $utils = Utils::getInstance(); $adsUtils = AdsUtils::getInstance(); $aid = $utils->iStr($app->request()->post('aid'), 64); $user = User::getInstance(); $rid = $user->getRadioId(); $res = $adsUtils->deleteAd($rid, $aid); $err = $res == false ? $session->flushError() : ''; $res = $res == false ? 'false' : $res; $res = array('req' => 'deleteAd', 'aid' => $aid, 'err' => $err, 'res' => $res); break; case 'init-ad': $adsUtils = AdsUtils::getInstance(); $session = Session::getInstance(); $user = User::getInstance(); $rid = $user->getRadioID(); $ad = ['radio_id' => $rid, 'trigger_id' => '0', 'name' => 'title', 'url' => 'url', 'owner' => 'owner', 'campagne_from' => '0', 'campagne_to' => '0']; $res = $adsUtils->initAd($ad); $err = $res == false ? $session->flushError() : ''; $res = $res == false ? 'false' : $res; $lst = $adsUtils->listAdsByRadioId($rid); $res = array('req' => 'initAd', 'err' => $err, 'res' => $res, 'lst' => $lst); break; case 'call-tmp-target': $kommentariUtils = KommentariUtils::getInstance(); $cid = $utils->iStr($app->request()->post('id'), 64); $lnk = $kommentariUtils->placeTmpLink($cid); $res = array('req' => 'callTmpTarget', 'cid' => $cid, 'lnk' => $lnk);
public function __construct() { $this->session = Session::getInstance(); $this->adsUtils = AdsUtils::getInstance(); $this->webDBUtils = WebDBUtils::getInstance(); }