コード例 #1
0
    /**
     * @service affiliate_email_notification write
     * @param $fields
     */
    public function save(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $bannerFactory = new Pap_Common_Banner_Factory();
        $banner = $bannerFactory->getBanner($form->getFieldValue('bannerId'));

        $bodyHtml = $banner->getPreview($this->getUser());

        if($form->existsField('personalMessage')){
            $bodyHtml = $this->replacePersonalMessage($form,$bodyHtml);
        }

        $form->setField('body_html',$bodyHtml);

        $recipientsList = $this->makeRecepientsList($form);

        if(count($recipientsList) == 0) {
            $form->setErrorMessage($this->_("Please add recepients."));
            return $form;
        }

        $this->saveRecipientsList($form->getFieldValue('recipients'));
        $task = $this->createLongTask($form, $this->createMassMailTemplate($form,'Pap_Mail_AffiliateMailTemplate'), $recipientsList);
        $task->insertTask();

        $form->setInfoMessage($this->_("Thank you, your mail will be delivered within next few minutes."));
        return $form;
    }
コード例 #2
0
 /**
  * @service banner read
  * @param $bannerId
  * @return Gpf_Rpc_Form
  */
 public function load(Gpf_Rpc_Params $params) {
 	$form = new Gpf_Rpc_Form($params);
 	$bannerFactory = new Pap_Common_Banner_Factory();
 	$site = $bannerFactory->getBanner($form->getFieldValue(Gpf_View_FormService::ID));
 	$form->addField('htAccessCode', $site->getHtaccessCode());
 	return $form;
 }
コード例 #3
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
    public static function getBannerCode($refid, $bannerId) {
        $user = new Pap_Affiliates_User();
        $user->setRefId($refid);

        $bannerFactory = new Pap_Common_Banner_Factory();
        $bannerObj = $bannerFactory->getBanner($bannerId);
        return $bannerObj->getCode($user);
    }
コード例 #4
0
	/**
	 * Get banner preview for Window element
	 *
	 * @service banner read
	 * @param Gpf_Rpc_Params $params
	 * @return Pap_Affiliates_Promo_BannerPreview
	 */
	public function getWindowBannerPreview(Gpf_Rpc_Params $params) {
		$form = new Gpf_Rpc_Form($params);
		$bannerFactory = new Pap_Common_Banner_Factory();
		$banner = $bannerFactory->getBanner($form->getFieldValue('bannerId'));
		
		$template = new Gpf_Templates_Template('html_window_preview.stpl');
		$template->assign('bannercode', $banner->getPreview($this->getUser()));
		$this->preview = $template->getHTML();
		
		return $this;
	}
コード例 #5
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 public function initTransactionTypes(Pap_Stats_TransactionTypeStats $transactionTypes) {
     $campaignId = null;
     if ($transactionTypes->getStatParams()->isCampaignIdDefined()) {
         $campaignId = $transactionTypes->getStatParams()->getCampaignId();
     }
     if ($campaignId == null && $transactionTypes->getStatParams()->isBannerIdDefined()) {
         try {
             $banner = $this->bannerFactory->getBanner($transactionTypes->getStatParams()->getBannerId());
             $campaignId = $banner->getCampaignId();
         } catch (Gpf_Exception $e) {
         }
     }
     foreach ($this->getUserCommissionTypes($campaignId) as $commissionType) {
         $transactionTypes->addTransType(Pap_Common_Constants::TYPE_ACTION, $commissionType->get('commtypeid'));
     }
 }
コード例 #6
0
 public function fillCachedBanner(Pap_Db_CachedBanner $cachedBanner, Pap_Common_User $user) {
     $this->parseRotatorBannerDescription();
     $bannerIdToShow = $this->getBannerIdToShow();
     foreach ($this->rotatedBanners as $row) {
         $bannerId = $row->get(Pap_Db_Table_BannersInRotators::ROTATED_BANNER_ID);
         $rank = $row->get(Pap_Db_Table_BannersInRotators::RANK);
         $banner = $this->bannerFactory->getBanner($bannerId);
         $banner->setParentBannerId($this->getId());
         $this->setBannerChannel($banner, $cachedBanner->getChannel());
         if ($bannerIdToShow == $bannerId) {
             $cachedBanner->setCode($banner->getCompleteCode($user, ''));
             $cachedBanner->setRank($rank);
             $cachedBanner->setValidFrom($row->get(Pap_Db_Table_BannersInRotators::VALID_FROM));
             $cachedBanner->setValidUntil($row->get(Pap_Db_Table_BannersInRotators::VALID_UNTIL));
             continue;
         }
         $rotCachedBanner = clone $cachedBanner;
         $rotCachedBanner->setValidFrom($row->get(Pap_Db_Table_BannersInRotators::VALID_FROM));
         $rotCachedBanner->setValidUntil($row->get(Pap_Db_Table_BannersInRotators::VALID_UNTIL));
         $rotCachedBanner->setCode($banner->getCompleteCode($user, ''));
         Pap_Tracking_BannerViewer::addJavascriptCode($rotCachedBanner);
         $rotCachedBanner->setRank($rank);
         try {
             $rotCachedBanner->save();
         } catch (Gpf_DbEngine_Row_ConstraintException $e) {
             // cached banner was saved already by other script
         }
     }
 }
コード例 #7
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 /**
  * @throws Gpf_Exception
  * @return Pap_Common_Banner
  */
 protected function getBannerFromFactory($bannerID) {
     $bannerFactory = new Pap_Common_Banner_Factory();
     return $bannerFactory->getBanner($bannerID);
 }
コード例 #8
0
    /**
     * @return Pap_Common_Banner
     * @throws Gpf_Exception
     */
    protected function getBannerById(Pap_Contexts_Tracking $context, $id) {
        if (!is_null($context->getCampaignObject())) {
            $campaignId = $context->getCampaignObject()->getId();
        } else {
            $campaignId = '';
        }
        if (isset($this->bannersCache[$id.$campaignId])) {
            return $this->bannersCache[$id.$campaignId];
        }

        $bannerFactory = new Pap_Common_Banner_Factory();
        $banner = $bannerFactory->getBanner($id);
        $this->checkBanner($context, $banner);        
        $this->bannersCache[$id.$campaignId] = $banner;
        return $this->bannersCache[$id.$campaignId];
    }
コード例 #9
0
    /**
     * Get pdf banner for affiliate
     * 
     * @service banner read
     * @param Gpf_Rpc_Params $params
     */
    public function generateAffiliatePdf(Gpf_Rpc_Params $params) {
    	$form = new Gpf_Rpc_Form($params);
        $fileName = $this->correctFilename($form->getFieldValue('fileName'));
        
        try {
            $this->initAffiliate(Gpf_Session::getAuthUser()->getPapUserId());
        } catch (Gpf_DbEngine_NoRowException $e) {
            return $this->getFormResponse($this->_('Affiliate is not defined'));
        }
        
        $bannerFactory = new Pap_Common_Banner_Factory();
        try {
			$banner = $bannerFactory->getBanner($form->getFieldValue('bannerId'));
			
			$channel = $this->findChannel($form->getFieldValue('channel'));
			if($channel != null) {
				$banner->setChannel($channel);
			}
			
        	$html = $banner->get(Pap_Db_Table_Banners::DATA2);
        } catch (Pap_Common_Banner_NotFound $e) {
        	return $this->getFormResponse($this->_("Banner with id '".$params->get('bannerId')."' doesn't exist"));
        }
        
        $html = $this->decodeBanner($html, $banner, 0);
        $this->generatePDF($html);
        
        return new Pap_Common_Banner_PdfGeneratorResponse($fileName, $this->pdf);
    }
コード例 #10
0
 /**
  * @return Pap_Common_Banner
  */
 private function getBanner($bannerId, $userId = null, $channelId = '') {
     $bannerFactory = new Pap_Common_Banner_Factory();
     $banner = $bannerFactory->getBanner($bannerId);
     if(isset($_REQUEST[Pap_Db_Table_CachedBanners::DYNAMIC_LINK])) {
         $banner->setDynamicLink($_REQUEST[Pap_Db_Table_CachedBanners::DYNAMIC_LINK]);
     }
     if ($channelId == '' || $userId == null || $userId == '') {
         return $banner;
     }
     try {
         $banner->setChannel($this->getChannel($userId, $channelId));
     } catch (Gpf_Exception $e) {
         Gpf_Log::info('Invalid channel '.$channelId.' used in banner '.$bannerId.' for user '.$userId.': '. $e->getMessage());
     }
     return $banner;
 }
コード例 #11
0
	/**
	 * @throws Gpf_Exception
	 * @return Pap_Common_Banner
	 * 
	 * do not change public to protected because of compatibility reasons with PAP3(sb.php) 
	 */
	public function getBanner($bannerId) {
		if (!isset($this->bannerCache[$bannerId])) {
			$this->bannerCache[$bannerId] = $this->bannerFactory->getBanner($bannerId);
		}
		return $this->bannerCache[$bannerId];
	}
コード例 #12
0
    /**
     * @return Pap_Features_SiteReplication_Site
     */
    private function loadSite($siteId) {
        $select = new Gpf_SqlBuilder_SelectBuilder();
        $select->from->add(Pap_Db_Table_Banners::getName());
        $select->select->addAll(Pap_Db_Table_Banners::getInstance());
        $whereCondition = new Gpf_SqlBuilder_CompoundWhereCondition();
        $whereCondition->add(Pap_Db_Table_Banners::ID, '=', $siteId, 'OR');
        $whereCondition->add(Pap_Db_Table_Banners::DATA1, '=', 'D'.$siteId, 'OR');
        $select->where->addCondition($whereCondition);
        $select->where->add(Pap_Db_Table_Banners::TYPE, '=', Pap_Features_SiteReplication_Config::BannerTypeSite);

        try {
            $bannerFactory = new Pap_Common_Banner_Factory();
            return $bannerFactory->getBannerFromRecord($select->getOneRow());
        } catch (Gpf_Exception $e) {
            throw new Gpf_Exception($this->_sys('Replicated site \'%s\' does not exist', $siteId));
        }
    }
コード例 #13
0
	/**
	 * @param String $bannerId	 
	 */
	private function initBanner($bannerId) {
		$bannerFactory = new Pap_Common_Banner_Factory();
		$this->banner = $bannerFactory->getBanner($bannerId);
	}
コード例 #14
0
 /**
  * @return Pap_Common_Banner
  */
 protected function getBannerById($bannerId) {
     $bannerFactory = new Pap_Common_Banner_Factory();
     try {
         $banner = $bannerFactory->getBanner($bannerId);
         return $banner;
     } catch (Pap_Common_Banner_NotFound $e) {
         return null;
     } catch (Gpf_Exception $e) {
         return null;
     }
 }
コード例 #15
0
    /**
     * processes match and sets userid, campaign, banner, channel
     */
    protected function fillParametersFromMatch(Pap_Contexts_Click $context, $match) {
        if($match == null || $match == false || !is_array($match) || count($match) != 5) {
            $context->debug("    Matching data are in incorrect format");
        }

        $userId = $match['userid'];
        $url = $match['url'];
        $channelid = $match['channelid'];
        $campaignid = $match['campaignid'];
        $bannerid = $match['bannerid'];

        $context->debug("    Referrer matched '$url' pattern");

        // user
        if ($userId == '') {
            $context->debug("    DirectLink affiliate Id is empty stopping");
            $context->setDoTrackerSave(false);
            return;
        }

        try {
            $user = Pap_Affiliates_User::loadFromId($userId);
        } catch (Gpf_Exception $e) {
            $context->debug(" DirectLink affiliate with id '$userId' doesn't exist");
            $context->setDoTrackerSave(false);
            return;
        }

        $context->debug("    Setting affiliate from referrer URL. Affiliate Id: ".$userId."");
        $context->setUserObject($user);


        // banner
        $banner = null;
        try {
            $bannerFactory = new Pap_Common_Banner_Factory();
            $banner = $bannerFactory->getBanner($bannerid);
            $context->debug("Setting banner from referrer URL. Banner Id: ".$bannerid."");
            $context->setBannerObject($banner);
        } catch (Gpf_Exception $e) {
            $context->debug("Banner parameter in DirectLink is empty");
        }

        // campaign
        $campaign = $this->getCampaignById($context, $campaignid);
        if($campaignid != '' && $campaign != null) {
            $context->debug("    Setting campaign from DirectLink. Campaign Id: ".$campaignid."");
            $context->setCampaignObject($campaign);
        } else {
            $context->debug("    Campaign parameter in DirectLink is empty");
        }
        	
        if($banner != null) {
            $context->debug("    Trying to get campaign from banner");
            $campaign = $this->getCampaignFromBanner($context, $banner);
        }

        if($campaign == null) {
            $campaign = $this->getDefaultCampaign($context);
        }

        if($campaign != null) {
            $context->setCampaignObject($campaign);
        } else {
            $context->setDoTrackerSave(false);
            $context->debug("        No default campaign defined");
        }
        
        // channel
        $channel = $this->getChannelById($context, $channelid);
        if($channelid != '' && $channel != null) {
            $context->debug("    Setting channel from referrer URL. Channel Id: ".$channelid."");
            $context->setChannelObject($channel);
        } else {
            $context->debug("    Channel parameter in DirectLink is empty");
        }
        
        // account
        if ($campaign != null) {
            $context->setAccountId($campaign->getAccountId(), Pap_Contexts_Tracking::ACCOUNT_RECOGNIZED_FROM_CAMPAIGN);
        }
    }
コード例 #16
0
ファイル: Impression.php プロジェクト: AmineCherrai/rostanvo
 /**
  * @throws Gpf_DbEngine_NoRowException
  * @return Pap_Common_Banner
  */
 public function getParentBanner()
 {
     if ($this->parentBanner == null && $this->parentBannerId != null) {
         $factory = new Pap_Common_Banner_Factory();
         $this->parentBanner = $factory->getBanner($this->parentBannerId);
     }
     return $this->parentBanner;
 }
コード例 #17
0
 /**
  * @return Pap_Common_Banner
  */
 protected function createBannerObject($type) {
     return Pap_Common_Banner_Factory::getBannerObjectFromType($type);
 }