/**
  * @return Pap_Db_Banner
  * @throws Gpf_Exception
  */
 protected function getBanner($bannerId) {
     $banner = new Pap_Db_Banner();
     $banner->setId($bannerId);
     $banner->load();
     return $banner;
 }
 /**
  * @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();
 }
    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();
    }
    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;
        }
    }