/** * @service banner read */ public function showPreview(Gpf_Rpc_Params $params) { $banner = Pap_Features_RebrandPdfBanner_Banner::create($params); $banner->load(); $form = new Gpf_Rpc_Form($params); $user = new Pap_Common_User(); $user->setId($form->getFieldValue('affiliateId')); $user->load(); $processor = new Pap_Features_RebrandPdfBanner_Pdf_Processor(); $processor->showBannerByUser($user, $banner); }
public function getGeneralAffiliateLinkNoRpc($affiliateId = null) { if ($affiliateId == null) { $affiliateId = Gpf_Session::getAuthUser()->getUserId(); } $affiliate = new Pap_Common_User(); $affiliate->setId($affiliateId); $affiliate->load(); $mainSiteUrl = Gpf_Settings::get(Pap_Settings::MAIN_SITE_URL); return Pap_Tracking_ClickTracker::getInstance()->getClickUrl(null, $affiliate, $mainSiteUrl); }
/** * @return Pap_Common_User or null */ public function getChosenUser($chosenUserId) { $user = new Pap_Common_User(); $user->setId($chosenUserId); try { $user->load(); return $user; } catch (Gpf_Exception $e) { return null; } }
private function sendMail(Gpf_Db_MailTemplate $dbTemplate, Gpf_Rpc_Form $form) { $user = new Pap_Common_User(); $user->setId($form->getFieldValue('userid')); $user->load(); $template = new Pap_Mail_MassMailTemplate(); $template->setTemplateId($dbTemplate->getId()); $template->setUser($user); $template->addRecipient($user->getEmail()); $template->send(); }
/** * @param Gpf_Rpc_Form $form * @return Pap_Common_User */ private function getUser(Gpf_Rpc_Form $form) { $user = new Pap_Common_User(); try { $user->setId(Gpf_Session::getAuthUser()->getPapUserId()); $user->load(); } catch (Gpf_Exception $e) { $form->setErrorMessage($e->getMessage()); return null; } return $user; }
public function getAttributes() { $ret = parent::getAttributes(); if ($this->isLogged()) { $user = new Pap_Common_User(); $user->setId($this->getPapUserId()); $user->load(); for ($i=1; $i<=25; $i++) { $ret['data'.$i] = $user->get('data'.$i); } $ret[Pap_Db_Table_Users::PARENTUSERID] = $user->getParentUserId(); } return $ret; }
private function loginFromSession($session){ Gpf_Session::create(null, $session); $papAlertData = new Pap_Alert_Data(); $papAlertData->computeTimeOffset(); $this->user = new Pap_Common_User(); try { $this->user->setId(Gpf_Session::getAuthUser()->getPapUserId()); } catch (Exception $e) { throw new Gpf_Rpc_SessionExpiredException(); } $this->user->load(); $this->initializeApplication(); }
public function authenticate($username, $password) { try { $userId = $this->findUserId($username, $password); $this->user = new Pap_Common_User(); $this->user->setId($userId); $this->user->load(); Gpf_Session::create(new Pap_Tracking_ModuleBase()); $this->computeTimeOffset(); } catch (Gpf_Exception $e) { Gpf_Log::warning($e->getMessage()); $this->user = null; } }
private function getParentWhoReachedCondition($userId, array $reachedConditionUserIds) { $user = new Pap_Common_User(); $user->setId($userId); $user->load(); if (is_null($user->getParentUserId()) || $user->getParentUserId() == '') { return null; } if (in_array($user->getParentUserId(), $reachedConditionUserIds)) { return $user->getParentUserId(); } return $this->getParentWhoReachedCondition($user->getParentUserId(), $reachedConditionUserIds); }
protected function processAccountIdAndVisitorId(Pap_Tracking_ActionTracker $saleTracker, $cookie) { parent::processAccountIdAndVisitorId($saleTracker, $cookie); if (Gpf_Settings::get(PayPal_Config::APPROVE_AFFILIATE) == Gpf::YES) { $this->debug('Automatic approval of affiliates with sale is enabled'); $userId = $this->computeAffiliateId($saleTracker->getVisitorId(), $saleTracker->getAccountId()); try { $affiliate = new Pap_Common_User(); $affiliate->setId($userId); $affiliate->load(); if ($affiliate->getStatus() == Pap_Common_Constants::STATUS_PENDING) { $affiliate->setStatus(Pap_Common_Constants::STATUS_APPROVED); $affiliate->update(); } } catch (Gpf_Exception $e) { $this->debug('Error occured during approving affiliate with id=' . $userId); } } }
/** * @throws Gpf_DbEngine_NoRowException * @param $userId * @return Pap_Common_User */ public static function getUserById($userId) { $user = new Pap_Common_User(); $user->setId($userId); $user->load(); return $user; }
/** * * @param $affId * @return Pap_Common_User */ private function loadAffiliate($affId) { $affUser = new Pap_Common_User(); $affUser->setId($affId); $affUser->load(); return $affUser; }
protected function getUserById($userId) { $user = new Pap_Common_User(); $user->setId($userId); $user->load(); return $user; }
/** * @throws Gpf_DbEngine_NoRowException */ private function getUser() { $user = new Pap_Common_User(); $user->setId(Gpf_Session::getAuthUser()->getPapUserId()); $user->load(); return $user; }
/** * @param Gpf_Data_Row $row */ private function addVATData(Gpf_Data_Row $row) { try { $user = new Pap_Common_User(); $user->setId($row->get('userid')); $user->load(); } catch (Gpf_Exception $e) { $row->add('vat', $this->_('N/A')); $row->add('amounttopay', $this->_('N/A')); return; } $currency = Pap_Common_Utils_CurrencyUtils::getDefaultCurrency(); $payout = new Pap_Common_Payout($user, $currency, $row->get(Pap_Db_Table_Transactions::COMMISSION), null); if (!$payout->getApplyVat()) { $row->add('vat', $this->_('N/A')); $row->add('amounttopay', $row->get(Pap_Db_Table_Transactions::COMMISSION)); return; } $row->add('vat', $payout->getVatPercentage() . ' %'); $row->add('amounttopay', $payout->getAmountWithVat()); }
private function isExistsUser($userId) { $user = new Pap_Common_User(); $user->setId($userId); try { $user->load(); return true; } catch (Gpf_DbEngine_NoRowException $e) { return false; } }
public function loadUser($userId) { $this->user = new Pap_Common_User(); $this->user->setId(Gpf_Session::getAuthUser()->getPapUserId()); $this->user->load(); return $this->user; }