Esempio n. 1
0
	private function getClickParamsArray(Pap_Db_ClickImpression $click, Pap_Contexts_Click $context, Pap_Common_Banner $banner=null) {
	    $columns = array();
	    $columns[Pap_Db_Table_ClicksImpressions::ACCOUNTID] = $context->getAccountId();
        $columns[Pap_Db_Table_ClicksImpressions::USERID] = $context->getUserObject()->getId();
        $columns[Pap_Db_Table_ClicksImpressions::BANNERID] = $banner == null ? '' : $banner->getId();
        $columns[Pap_Db_Table_ClicksImpressions::PARENTBANNERID] = $banner == null ? '' : $banner->getParentBannerId();
        $columns[Pap_Db_Table_ClicksImpressions::CAMPAIGNID] = $context->getCampaignObject() == null ? '' : $context->getCampaignObject()->getId();
        $columns[Pap_Db_Table_ClicksImpressions::COUNTRYCODE] = $context->getCountryCode();
        $columns[Pap_Db_Table_ClicksImpressions::CDATA1] = $context->getExtraDataFromRequest(1);
        $columns[Pap_Db_Table_ClicksImpressions::CDATA2] = $context->getExtraDataFromRequest(2);
        $columns[Pap_Db_Table_ClicksImpressions::CHANNEL] = $this->getChannel($context);
        $timeNow = new Gpf_DateTime($context->getVisitDateTime());
        $columns[Pap_Db_Table_ClicksImpressions::DATEINSERTED] = $timeNow->format("Y-m-d H:00:00");
        return $columns;
	}
    private function initTransactionObject(Pap_Contexts_Click $context) {
        $transaction = new Pap_Common_Transaction();

        $transaction->setTotalCost('');

        $transaction->generateNewTransactionId();
        $transaction->setData1($context->getExtraDataFromRequest(1));
        $transaction->setData2($context->getExtraDataFromRequest(2));
        $transaction->set(Pap_Db_Table_Transactions::REFERER_URL, $context->getReferrerUrl());
        $transaction->set(Pap_Db_Table_Transactions::IP, $context->getIp());
        $transaction->set(Pap_Db_Table_Transactions::BROWSER, $context->getUserAgent());
        $transaction->setType(Pap_Common_Constants::TYPE_CLICK);
        $transaction->setDateInserted($context->getVisitDateTime());
        if ($context->getVisit()!= null && $context->getVisit()->getCountryCode() != '') {
            $transaction->setCountryCode($context->getVisit()->getCountryCode());
        }
        $context->setTransactionObject($transaction);
        $context->debug("Transaction object set");
    }