Ejemplo n.º 1
0
 private function getBannerId(Pap_Contexts_Impression $context) {
     $bannerObj = $context->getBannerObject();
     if($bannerObj != null) {
         return $bannerObj->getId();
     }
     return null;
 }
Ejemplo n.º 2
0
	private function saveCpmTransaction(Pap_Contexts_Impression $context) {
	    $campaign = new Pap_Common_Campaign();
	    $campaign->setId($context->getBannerObject()->getCampaignId());
	    $campaign->load();
	    $context->setCampaignObject($campaign);
	    $transaction = new Pap_Common_Transaction();
	    $transaction->setType(Pap_Common_Constants::TYPE_CPM);
	    $context->setTransactionObject($transaction);

	    $commissionType = new Pap_Tracking_Common_RecognizeCommType();
	    $commissionType->process($context);

	    $commissionGroup = new Pap_Tracking_Common_RecognizeCommGroup();
        $commissionGroup->recognize($context);

        $commissionSettings = new Pap_Tracking_Common_RecognizeCommSettings();
        $commissionSettings->recognize($context);

        $saveCommissions = new Pap_Tracking_Common_UpdateAllCommissions();
        $saveCommissions->process($context);
        $saveCommissions->saveChanges();
	}
Ejemplo n.º 3
0
    private function saveAndIncrementImpressionCount(Pap_Contexts_Impression $context, Pap_Db_Impression $impression) {
        $impression = $this->getImpression($impression);

        if ($context->isUnique()) {
            $context->debug('    Impression is unique');
            $impression->addUniqueCount($context->getCount());
        } else {
            $context->debug('    Impression is not unique');
        }

        $impression->addRawCount($context->getCount());
         
        $impression->save();

        Gpf_Plugins_Engine::extensionPoint('Tracker.impression.afterSave', $context);
    }
Ejemplo n.º 4
0
 /**
  * @return Pap_Db_Channel
  * @throws Gpf_Exception
  */
 private function getChannelFromParameter(Pap_Contexts_Impression $context)
 {
     $context->debug('Trying to get channel from parameter');
     return $this->getChannelById($context, $context->getRequestObject()->getChannelId());
 }
	protected function importImpression(Pap_Db_RawImpression $impression, $count = 1) {
		$impressionContext = new Pap_Contexts_Impression($impression);
	    
	    try {
			$impressionContext->setUserObject($this->getUser($impression->getUserId()));
		} catch (Gpf_Exception $e) {
			$this->debug('Invalid user '.$impression->getUserId().'. Skipping');
			return;
		}

		try {
			$impressionContext->setBannerObject($this->getBanner($impression->getBannerId()));
		} catch (Gpf_Exception $e) {
			$this->debug('Invalid banner '.$impression->getBannerId().'. Skipping');
			return;
		}
		
		try {
		    $campaign = $this->getCampaign($impressionContext->getBannerObject()->getCampaignId());
		    $impressionContext->setAccountId($campaign->getAccountID(), Pap_Contexts_Tracking::ACCOUNT_RECOGNIZED_FROM_CAMPAIGN);
		} catch (Gpf_Exception $e) {
		    $this->debug('Invalid campaign '.$impressionContext->getBannerObject()->getCampaignId().'. Skipping');
		    return;
		}

		try {
			$impressionContext->setChannelObject($this->getChannel($impression->getChannel(), $impressionContext));
		} catch (Gpf_Exception $e) {
		}
		
		$impressionContext->setCount($count);
		$this->saveImpression($impressionContext);		
	}