示例#1
0
 /**
  * @param Pap_Common_User $user
  * @return string
  */
 public function getDescription(Pap_Common_User $user) {
     if ($user->getType() == Pap_Application::ROLETYPE_MERCHANT) {
         $description = $this->get(Pap_Db_Table_Banners::DATA1);
     } else {
         $description = $this->get(Pap_Db_Table_Banners::DATA2);
     }
     
     $description = str_replace('$Affiliate_id', $user->getId(), $description);
     $description = str_replace('$Affiliate_refid', $user->getRefId(), $description);
     $description = str_replace('$Affiliate_name', $user->getName(), $description);
     $description = str_replace('$Affiliate_username', $user->getUserName(), $description);
     
     return $description;
 }
    public function getUserFieldValue($code) {
        if($this->user == null) {
            throw new Gpf_Exception("You have to set User before getting user fields value!");
        }

        if($code == 'refid') {
            return $this->user->getRefId();
        } else if($code == 'firstname') {
            return $this->user->getFirstName();
        } else if($code == 'lastname') {
            return $this->user->getLastName();
        } else if($code == 'password') {
            return $this->user->getPassword();
        } else if($code == 'username') {
            return $this->user->getUserName();
        } else if($this->isCountryCode($code)){
            return $this->getCountryName($this->user->get($code));
        }
        try {
            return $this->user->get($code);
        } catch (Gpf_Exception $e) {
        }
        return '';
    }
示例#3
0
 	public function setUsernameRefid(Pap_Common_User $user) {
 	    $user->setRefId($user->getUserName());
 	}
 private function setFromEmailAndName(Pap_Mail_MassMailTemplate $template, $affiliateId) {
     $user = new Pap_Common_User();
     $user->setAccountUserId($affiliateId);
     try {
         $user->loadFromData(array(Pap_Db_Table_Users::ACCOUNTUSERID));
     } catch (Gpf_Exception $e) {
         Gpf_Log::debug('Unable to load sender information when sending broadcast mail from affiliateid: ' . $affiliateId . ', error: '. $e->getMessage());
         return;
     }      
     $email = $user->getUserName();
     $name = $user->getFirstName() . ' ' . $user->getLastName(); 
     $emailValidator = new Gpf_Rpc_Form_Validator_EmailValidator();
     if ($emailValidator->validate($email)) {            
         $template->setFromEmail($email);
         $template->setFromName($name);
     }
 }