Beispiel #1
0
	public function setCampaignsVariable(Pap_Mail_UserMail $mailTemplate) {
	    if ($mailTemplate->getUser() == null) {
	       $mailTemplate->setVariable('affiliatecampaigns', array());
	       return;
	    }
		$affiliateCampaigns = new Pap_Common_Campaign_AffiliateCampaigns($this->getCampaigns(), $mailTemplate->getUser()->getId());
		$mailTemplate->setVariable('affiliatecampaigns', $affiliateCampaigns->getAffiliateCampaigns()->toArray());
	}
    public function setUserMailTemplateVariables(Pap_Mail_UserMail $template) {
        try {
            if ($template->getUser() == null) {
                throw new Gpf_Exception('User not set in UserMail');
            }
            $location = $this->getLocation($template->getUser()->getIp()); //-----------------------
            
            $template->setVariable('affiliateIpCountryCode', $location->getCountryCode());
            $template->setVariable('affiliateIpCountryName', $location->getCountryName());
            $template->setVariable('affiliateIpCity', $location->getCity());
            $template->setVariable('affiliateIpLongitude', $location->getLongitude());
            $template->setVariable('affiliateIpLatitude', $location->getLatitude());

        } catch (Gpf_Exception $e) {
            $template->setVariable('affiliateIpCountryCode', $this->_('Undefined'));
            $template->setVariable('affiliateIpCountryName', $this->_('Undefined'));
            $template->setVariable('affiliateIpCity', $this->_('Undefined'));
            $template->setVariable('affiliateIpLongitude', $this->_('Undefined'));
            $template->setVariable('affiliateIpLatitude', $this->_('Undefined'));
        }
    }