private function updateAccountOfBanners(Pap_Db_Campaign $dbCampaign) {
        $select = new Gpf_SqlBuilder_SelectBuilder();
        $select->select->addAll(Pap_Db_Table_Banners::getInstance());
        $select->from->add(Pap_Db_Table_Banners::getName());
        $select->where->add(Pap_Db_Table_Banners::CAMPAIGN_ID, '=', $dbCampaign->getId());

        $banner = new Pap_Db_Banner();
        $bannersCollection = $banner->loadCollectionFromRecordset($select->getAllRows());
        foreach ($bannersCollection as $banner) {
            $banner->update(array(Pap_Db_Table_Banners::ACCOUNT_ID));
        }
    }
 /**
  * @return Pap_Db_Banner
  * @throws Gpf_Exception
  */
 protected function getBanner($bannerId) {
     $banner = new Pap_Db_Banner();
     $banner->setId($bannerId);
     $banner->load();
     return $banner;
 }
Example #3
0
 public function getDestinationUrl($user = null)
 {
     if ($user === null) {
         return parent::getDestinationUrl();
     }
     $destinationUrl = parent::getDestinationUrl();
     $bannerDestinationCompound = new Pap_Common_BannerDestinationCompound($this, $user);
     Gpf_Plugins_Engine::extensionPoint('PostAffiliate.Banner.getDestinationUrl', $bannerDestinationCompound);
     if ($bannerDestinationCompound->getDestinationUrl() != null) {
         $destinationUrl = $bannerDestinationCompound->getDestinationUrl();
     }
     return $this->replaceUserConstants($destinationUrl, $user);
 }
    private function getAffiliateCount() {
        $banner = new Pap_Db_Banner();
        $banner->setId($this->form->getFieldValue(Pap_Features_Coupon_CreateCoupons::BANNER_ID));
        try {
            $banner->load();
            $campaignId = $banner->getCampaignId();
        } catch (Gpf_DbEngine_NoRowException $e) {
            $campaignId = null;
        }

        $campaign = new Pap_Db_Campaign();
        $campaign->setId($campaignId);
        try {
            $campaign->load();
            $campaignType = $campaign->getCampaignType();
        } catch (Gpf_DbEngine_NoRowException $e) {
            $campaignType = null;
        }

        if ($campaignType != Pap_Db_Campaign::CAMPAIGN_TYPE_PUBLIC) {
            return Pap_Db_Table_UserInCommissionGroup::getUsersInCommissionGroupCount($campaignId);
        }
        return Pap_Db_Table_Users::getInstance()->getAffiliateCount();
    }
 /**
  * @param $bannerId
  * @return String
  */
 private function getAccountIdFromBannerId($bannerId) {
     $banner = new Pap_Db_Banner();
     $banner->setPrimaryKeyValue($bannerId);
     try {
         $banner->load();
     } catch (Gpf_DbEngine_NoRowException $e) {
         throw new Gpf_Exception($this->_('Banner with id %s does not exist.', $bannerId));
     }
     return $banner->getAccountId();
 }
    protected function init() {
        $banner = new Pap_Db_Banner();
        $banner->setId($this->form->getFieldValue(Pap_Features_Coupon_CreateCoupons::BANNER_ID));
        try {
            $banner->load();
            $this->campaignId = $banner->getCampaignId();
        } catch (Gpf_DbEngine_NoRowException $e) {
            $this->campaignId = null;
        }

        $campaign = new Pap_Db_Campaign();
        $campaign->setId($this->campaignId);
        try {
            $campaign->load();
            $this->campaignType = $campaign->getCampaignType();
        } catch (Gpf_DbEngine_NoRowException $e) {
            $this->campaignType = null;
        }
    }