private function generateExportFile(Pap_Db_PayoutOption $payoutOption, $affiliateNote = '') {
        $header = new Gpf_Templates_Template($payoutOption->getExportHeaderTemplate(), '', Gpf_Templates_Template::FETCH_TEXT);
        $content = $header->getHTML(); 
        $currency = Pap_Common_Utils_CurrencyUtils::getDefaultCurrency();
        $affiliates = 0;
        $commissions = 0;
        
        $selectBuilder = $this->getAffiliatesToPaySelect($payoutOption->getID());
        foreach ($selectBuilder->getAllRowsIterator() as $row) {
            $user = new Pap_Common_User();
            $user->fillFromRecord($row);
            $payout = new Pap_Common_Payout($user, $currency, $row->get('amountRaw'),$this->generateInvoiceNumber());
            $payout->setAffiliateNote($affiliateNote);
            $affiliates++;
            $commissions += $row->get('amountRaw');
            
            $content .= $payout->getExportRow();
        }

        $footer = new Gpf_Templates_Template($payoutOption->getExportFooterTemplate(), '', Gpf_Templates_Template::FETCH_TEXT);
        $footer->assign('affiliates', $affiliates);
        $footer->assign('commissions', round($commissions, Pap_Common_Utils_CurrencyUtils::getDefaultCurrency()->getPrecision()));
        $content .= $footer->getHTML();
        
        $content = str_replace('\t', "\t", $content);
        $content = str_replace('\n', "\n", $content);
                
        return $content;        
    }
Пример #2
0
 /**
  * Set mail variable, which can be replaced in subject or body of mail
  *
  * @param string $id
  * @param string $value
  */
 public function setVariable($id, $value)
 {
     if (!isset($this->templateObject)) {
         $this->templateObject = new Gpf_Templates_Template('gpf_db_mail.tpl');
     }
     $this->templateObject->assign($id, $value);
 }
 private function output($message)
 {
     $template = new Gpf_Templates_Template('quick_task.stpl');
     $template->assign('message', $message);
     $template->assign('title', Gpf_Application::getInstance()->getName() . ' - ' . $this->_('Merchant'));
     echo $template->getHTML();
 }
	protected function fillDataToTemplate(Gpf_Templates_Template $tmpl, Gpf_Rpc_Params $params) {
		$stats = array();
		$stats['clicks'] = new Pap_Stats_Clicks($this->statParams);
		$stats['transactionTypes'] = new Pap_Stats_TransactionTypeStats($this->statParams);
		$stats['transactionTypesFirstTier'] = new Pap_Stats_TransactionTypeStatsFirstTier($this->statParams);
		$tmpl->assign('selected', $stats);
		$tmpl->assign('actionFilter', $this->action);
		$tmpl->assign('commtypeidFilter', $this->commTypeId);
		return $tmpl;
	}
    protected function fillDataToTemplate(Gpf_Templates_Template $tmpl, Gpf_Rpc_Params $params) {
        $tmpl->assign('sumTransaction', new Pap_Merchants_Reports_QuickReportDataTransactionsSum());

        $tmpl->assign('clicks', new Pap_Stats_Clicks($this->statsParams));

        $tmpl->assign('impressions', new Pap_Stats_Impressions($this->statsParams));

        $tmpl->assign('salesTier', new Pap_Stats_SalesHigherTiers($this->statsParams));
        $tmpl->assign('transactionTypesTier', new Pap_Stats_TransactionTypeStatsHigherTiers($this->statsParams));

        return $tmpl;
    }
 public function render() {
     $settings = new Pap_Install_RecommendedSettings();
     
     $template = new Gpf_Templates_Template('installer_recommended_settings.stpl');
     $template->assign('settings', $settings->getSettings());
     return $template->getHTML();
 }
 public function render() {
     $requirements = new Pap_Install_Requirements();
     
     $template = new Gpf_Templates_Template('installer_check_requirements.stpl');
     $template->assign('requirements', $requirements->getRequirements());
     return $template->getHTML();
 }
Пример #8
0
	/**
	 * Get banner preview for Window element
	 *
	 * @service banner read
	 * @param Gpf_Rpc_Params $params
	 * @return Pap_Affiliates_Promo_BannerPreview
	 */
	public function getWindowBannerPreview(Gpf_Rpc_Params $params) {
		$form = new Gpf_Rpc_Form($params);
		$bannerFactory = new Pap_Common_Banner_Factory();
		$banner = $bannerFactory->getBanner($form->getFieldValue('bannerId'));
		
		$template = new Gpf_Templates_Template('html_window_preview.stpl');
		$template->assign('bannercode', $banner->getPreview($this->getUser()));
		$this->preview = $template->getHTML();
		
		return $this;
	}
	protected function fillDataToTemplate(Gpf_Templates_Template $tmpl, Gpf_Rpc_Params $params) {
		$stats = array();
		$stats['clicks'] = new Pap_Stats_Clicks($this->statParams);
		$stats['impressions'] = new Pap_Stats_Impressions($this->statParams);
		$stats['transactionTypes'] = new Pap_Stats_TransactionTypeStats($this->statParams);
		$stats['transactionTypesFirstTier'] = new Pap_Stats_TransactionTypeStatsFirstTier($this->statParams);
		$stats['transactions'] = new Pap_Stats_Transactions($this->statParams);
		$stats['transactionsFirstTier'] = new Pap_Stats_TransactionsFirstTier($this->statParams);
		$stats['transactionsHigherTier'] = new Pap_Stats_TransactionsHigherTiers($this->statParams);
		$tmpl->assign('selected', $stats);
		return $tmpl;
	}
Пример #10
0
 public function toText()
 {
     if ($this->panelWidth == 0) {
         $this->panelWidth = $this->getWidth();
     }
     if ($this->panelHeight == 0) {
         $this->panelHeight = $this->getHeight();
     }
     $template = new Gpf_Templates_Template($this->getTemplateName());
     $template->setDelimiter('/*{', '}*/');
     $template->assign('id', $this->getId());
     $template->assign('name', $this->getName());
     $template->assign('url', $this->getUrl());
     $template->assign('width', $this->getWidth());
     $template->assign('height', $this->getHeight());
     $template->assign('panelWidth', $this->panelWidth - 40);
     $template->assign('panelHeight', $this->panelHeight - 75);
     $template->assign('properties', $this->getProperties());
     $template->assign('autoRefreshTime', $this->getAutorefreshTime());
     return $template->getHTML();
 }
 /**
  *
  * @service
  * @anonym
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Data
  */
 public function getHtml(Gpf_Rpc_Params $params)
 {
     $smarty = new Gpf_Templates_Template("update_version.stpl");
     try {
         $smarty->assign('installedVersion', Gpf_Application::getInstance()->getInstalledVersion());
         $smarty->assign('gpfInstalledVersion', Gpf_Application::getInstance()->getInstalledVersion(true));
     } catch (Gpf_Exception $e) {
         $smarty->assign('installedVersion', $this->_('Not availible'));
         $smarty->assign('gpfInstalledVersion', $this->_('Not availible'));
     }
     $smarty->assign('newVersion', Gpf_Application::getInstance()->getVersion());
     $smarty->assign('gpfNewVersion', Gpf::GPF_VERSION);
     $smarty->assign('applicationName', Gpf_Application::getInstance()->getName());
     return $smarty->getDataResponse();
 }
Пример #12
0
 function addBannersForPreview(Gpf_Templates_Template $template ,Pap_Common_User $user){
     $bannersPreview = '';
     $counter = 0;
     foreach ($this->rotatedBanners as $row) {
         $bannerId = $row->get(Pap_Db_Table_BannersInRotators::ROTATED_BANNER_ID);
         $rank = $row->get(Pap_Db_Table_BannersInRotators::RANK);
         try {
             $bannersPreview .= '<div>'. $this->bannerFactory->getBanner($bannerId)->getPreview($user).'</div><hr>';
             $counter ++;
         } catch (Gpf_Exception $e) {
         }
     }
     if ($counter >= 5) {
         $bannersPreview = '<div class="BannerRotatorPreview">' . $bannersPreview . '</div>';
     }
     $template->assign("banners",$bannersPreview);
 }
Пример #13
0
    protected function fillDataToTemplate(Gpf_Templates_Template $tmpl, Gpf_Rpc_Params $params) {
        $todayParams = $this->getStatsParams('T');
        $thisMonthParams = $this->getStatsParams('TM');
        
        $tmpl->assign('todayClicks', new Pap_Stats_Clicks($todayParams));
        $tmpl->assign('todayImpressions', new Pap_Stats_Impressions($todayParams));
        $tmpl->assign('todaySales', new Pap_Stats_Sales($todayParams));
        $tmpl->assign('todayCommissions', new Pap_Stats_Transactions($todayParams));
        $tmpl->assign('todayRefunds', new Pap_Stats_Refunds($todayParams));
        $tmpl->assign('todayChargebacks', new Pap_Stats_Chargebacks($todayParams));
        $tmpl->assign('todayTransactionTypes', new Pap_Stats_TransactionTypeStats($todayParams));
        
        $signupBonus = new Pap_Stats_Transactions($todayParams);
        $signupBonus->setTransactionType(Pap_Db_Transaction::TYPE_SIGNUP_BONUS);
        $tmpl->assign('todaySignupBonus', $signupBonus);
        
        $tmpl->assign('thisMonthClicks', new Pap_Stats_Clicks($thisMonthParams));
        $tmpl->assign('thisMonthImpressions', new Pap_Stats_Impressions($thisMonthParams));
        $tmpl->assign('thisMonthSales', $s = new Pap_Stats_Sales($thisMonthParams));
        $tmpl->assign('thisMonthCommissions', new Pap_Stats_Transactions($thisMonthParams));
        $tmpl->assign('thisMonthRefunds', new Pap_Stats_Refunds($thisMonthParams));
        $tmpl->assign('thisMonthChargebacks', new Pap_Stats_Chargebacks($thisMonthParams));
        $tmpl->assign('thisMonthTransactionTypes', new Pap_Stats_TransactionTypeStats($thisMonthParams));
        
        $signupBonusMonth = new Pap_Stats_Transactions($thisMonthParams);
        $signupBonusMonth->setTransactionType(Pap_Db_Transaction::TYPE_SIGNUP_BONUS);
        $tmpl->assign('thisMonthSignupBonus', $signupBonusMonth);

        $actionCommissionsEnabled = Gpf::NO;
        $types = new Pap_Stats_TransactionTypeStatsFirstTier($thisMonthParams);
        foreach ($types->getTypes() as $transactionType) {
            if($transactionType->getType() == Pap_Common_Constants::TYPE_ACTION) {
                $actionCommissionsEnabled = Gpf::YES;
                $tmpl->assign('todayActionCommissions', new Pap_Stats_Actions($todayParams));
                $tmpl->assign('thisMonthActionCommissions', new Pap_Stats_Actions($thisMonthParams));
                break;
            }
        }
        $tmpl->assign('actionCommissionsEnabled', $actionCommissionsEnabled);

        if (Gpf_Session::getAuthUser()->hasPrivilege(Pap_Privileges::PENDING_TASK, Pap_Privileges::P_READ)) {
            $pendingTasksGadget = new Pap_Merchants_ApplicationGadgets_PendingTasksGadgets();
            $pendingTasksData = $pendingTasksGadget->load($params);
            $tmpl->assign('pendingTasks', array('affiliates' => $pendingTasksData->getValue('pendingAffiliates'),'links'=>$pendingTasksData->getValue('pendingDirectLinks'),'emails'=>$pendingTasksData->getValue('unsentEmails'),'commissions'=>$pendingTasksData->getValue('pendingCommissions'),'totalcosts'=>$pendingTasksData->getValue('totalCommissions')));
        } else {
            $tmpl->assign('pendingTasks', false);
        }
        
        return $tmpl;
    }
Пример #14
0
 public static function assignTemplateVariables(Gpf_Templates_Template $template)
 {
     if (Gpf_Session::getAuthUser()->isLogged()) {
         $template->assign('isLogged', '1');
     } else {
         $template->assign('isLogged', '0');
     }
     $template->assign('papCopyrightText', Gpf_Settings::get(Pap_Settings::BRANDING_TEXT));
     $template->assign('papVersionText', 'version ' . Gpf_Application::getInstance()->getVersion());
     $template->assign('postAffiliatePro', Gpf_Settings::get(Pap_Settings::BRANDING_TEXT_POST_AFFILIATE_PRO));
     $template->assign('qualityUnitPostaffiliateproLink', Gpf_Settings::get(Pap_Settings::BRANDING_QUALITYUNIT_POSTAFFILIATEPRO_LINK));
     $template->assign('postAffiliateProHelp', Gpf_Settings::get(Pap_Settings::BRANDING_POST_AFFILIATE_PRO_HELP_LINK));
     $template->assign('qualityUnitChangeLog', Gpf_Settings::get(Pap_Settings::BRANDING_QUALITYUNIT_CHANGELOG_LINK));
     $template->assign('knowledgebaseUrl', Gpf_Settings::get(Pap_Settings::BRANDING_KNOWLEDGEBASE_LINK));
     $template->assign('PAP', Gpf_Settings::get(Pap_Settings::BRANDING_QUALITYUNIT_PAP));
     $template->assign('tutorialVideosBaseLink', Gpf_Settings::get(Pap_Settings::BRANDING_TUTORIAL_VIDEOS_BASE_LINK));
 }
Пример #15
0
 public function toText()
 {
     if ($this->panelWidth == 0) {
         $this->panelWidth = $this->getWidth();
     }
     if ($this->panelHeight == 0) {
         $this->panelHeight = $this->getHeight();
     }
     $template = new Gpf_Templates_Template($this->getTemplateName());
     $template->setDelimiter('/*{', '}*/');
     $template->assign('id', $this->getId());
     $template->assign('name', $this->getName());
     $template->assign('url', $this->getUrl());
     $template->assign('width', $this->getWidth());
     $template->assign('height', $this->getHeight());
     $template->assign('panelWidth', $this->panelWidth - 10);
     $template->assign('panelHeight', $this->panelHeight - 10);
     $template->assign('properties', $this->getProperties());
     $template->assign('rssEntries', $this->getRssEntries());
     $template->assign('rssEntryImgUrl', Gpf_Paths::getInstance()->getImageUrl('icon-rss-small.png'));
     $template->assign('rssImgUrl', Gpf_Paths::getInstance()->getImageUrl('icon-rss-big.png'));
     return $template->getHTML();
 }
Пример #16
0
    private function assignPayoutVariablesToTemplate(Gpf_Templates_Template $template) {
        $template->assignAttributes($this->user);
        $template->assign('vat_number', $this->vatNumber);
        $template->assign('reg_number', $this->regNumber);
        $template->assign('amount_of_reg_capital', $this->amountOfRegCapital);
        $template->assign('vat_percentage', $this->vatPercentage);
        $template->assign('payoutcurrency', $this->currency->getName());
        $template->assign('affiliate_note', $this->getAffiliateNote());
        $template->assign('payment', $this->getAmount());
        $template->assign('amount', str_replace('.', ',', $this->getAmount()));
        $template->assign('currency', $this->currency->getName());

        if ($this->payoutOption != null) {
            $template->assign('payoutmethod', $this->_localize($this->payoutOption->getName()));
        }
        $template->assign('payment_vat_part', $this->amountVatPart);
        $template->assign('payment_incl_vat', $this->amountWithVat);
        $template->assign('payment_excl_vat', $this->amountWithoutWat);

        $historyItem = $this->getPayoutHistoryItem();
        if ($historyItem === null) {
            
            $template->assign('date', Gpf_Common_DateUtils::getDateInLocaleFormat());
            $template->assign('time', Gpf_Common_DateUtils::getTimeInLocaleFormat());
        } else {
            $time = new Gpf_DateTime($historyItem->getDateInserted());
            $template->assign('date', Gpf_Common_DateUtils::getDateInLocaleFormat($time->toTimestamp()));
            $template->assign('time', Gpf_Common_DateUtils::getTimeInLocaleFormat($time->toTimestamp()));
        }
        $template->assign('invoicenumber',$this->getInvoiceNumber());

        if ($this->payoutOptionFields != null) {
            $userPayoutOptions = Pap_Db_Table_UserPayoutOptions::getInstance()->getValues(
            $this->payoutOption->getFormId(), $this->user->getId());
            foreach ($this->payoutOptionFields as $payoutOptionField) {
                $code = $payoutOptionField->get('code');
                if (array_key_exists($code, $userPayoutOptions)) {
                    $template->assign($code, $userPayoutOptions[$code]->getValue());
                }
            }
        }
    }
Пример #17
0
 /**
  * @return Gpf_Templates_Template
  */
 protected function getBodyTemplate()
 {
     $template = new Gpf_Templates_Template($this->bodyTemplateName);
     $template->assign('content', $this->getContentTemplate()->getHTML());
     return $template;
 }
Пример #18
0
 protected function setVariableRaw($id, $value)
 {
     $this->subjectTemplate->assign($id, $value);
     $this->bodyHtmlTemplate->assign($id, $value);
     $this->bodyTextTemplate->assign($id, $value);
 }
Пример #19
0
 private function postResponseTo($url, $response)
 {
     $template = new Gpf_Templates_Template("post_response.stpl");
     $cumulativeErrorMessage = "";
     $fields = array();
     foreach ($response as $field) {
         $error = $field->get(Gpf_Rpc_Form::FIELD_ERROR);
         $fields[] = array("name" => $field->get(Gpf_Rpc_Form::FIELD_NAME), "value" => $field->get(Gpf_Rpc_Form::FIELD_VALUE), "error" => $error);
         if ($error != "") {
             $cumulativeErrorMessage .= $error . "<br>";
         }
     }
     if ($response->getErrorMessage() != '') {
         $cumulativeErrorMessage .= $response->getErrorMessage() . "<br>";
     }
     $template->assign('fields', $fields);
     $template->assign('errorMessage', $response->getErrorMessage());
     $template->assign('cumulativeErrorMessage', $cumulativeErrorMessage);
     $template->assign('successMessage', $response->getInfoMessage());
     $template->assign('url', $url);
     return $template->getHTML();
 }
Пример #20
0
 public function assignTemplateVariables(Gpf_Templates_Template $template) {
     if ($this->channels === null) {
         $this->loadChannels();
     }
     $template->assign('channels', $this->channels);
 }