public static function getSignupScriptUrl($useParent = true, Pap_Common_User $user = null) { $url = Gpf_Paths::getAffiliateSignupUrl(); if ($useParent) { if ($user == null) { $user = Pap_Affiliates_User::getUserById(Gpf_Session::getAuthUser()->getPapUserId()); } $url .= '?' . Pap_Tracking_Request::getAffiliateClickParamName() . '=' . $user->getRefId(); } return $url; }
private function processAffiliatesReports($dateFrom) { foreach ($this->getAccountAffiliatesID()->getAllRowsIterator() as $row) { $this->interruptIfMemoryFull(); try { $affiliate = Pap_Affiliates_User::getUserById($row->get(Pap_Db_Table_Users::ID)); Gpf_Db_Table_UserAttributes::getInstance()->loadAttributes($affiliate->getAccountUserId()); } catch (Gpf_DbEngine_NoRowException $e) { $this->setDone(); continue; } if ($this->isAffDailyReportEnabled() && $this->isNotificationPending('affDailyReport', 'Send affiliates daily report', $affiliate) && $this->hasNotifyEnabled('aff_notification_daily_report', Pap_Settings::AFF_NOTIFICATION_DAILY_REPORT_ENABLED, Pap_Settings::AFF_NOTIFICATION_DAILY_REPORT_DEFAULT)) { $this->sendAffReport(new Pap_Mail_Reports_AffDailyReport(new Pap_Stats_Params(new Gpf_DateTime($this->time))), $affiliate); } $this->setDone(); $this->interruptIfMemoryFull(); if ($this->isAffWeeklyReportEnabled() && $this->isNotificationPending('affWeeklyReport', 'Send affiliates weekly report', $affiliate) && $this->hasNotifyEnabled('aff_notification_weekly_report', Pap_Settings::AFF_NOTIFICATION_WEEKLY_REPORT_ENABLED, Pap_Settings::AFF_NOTIFICATION_WEEKLY_REPORT_DEFAULT)) { $this->sendAffWeeklyReport($affiliate, $dateFrom); } $this->setDone(); $this->interruptIfMemoryFull(); if ($this->isAffMonthlyReportEnabled() && $this->isNotificationPending('affMonthlyReport', 'Send affiliates monthly report', $affiliate) && $this->hasNotifyEnabled('aff_notification_monthly_report', Pap_Settings::AFF_NOTIFICATION_MONTHLY_REPORT_ENABLED, Pap_Settings::AFF_NOTIFICATION_MONTHLY_REPORT_DEFAULT)) { $this->sendAffMonthlyReport($affiliate, $dateFrom); } $this->setDone(); } }