예제 #1
0
 /**
  * Replace all variables in text with variable values
  *
  * @param string $text
  * @return string
  */
 private function replaceVariables($text)
 {
     if (isset($this->templateObject)) {
         return $this->templateObject->getHTML($text);
     }
     return $text;
 }
 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();
 }
 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();
 }
 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();
 }
    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;        
    }
예제 #6
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;
	}
예제 #7
0
 /**
  *
  * @return Gpf_Db_Mail
  */
 protected function createMail($toRecipients, $bccRecipients = null)
 {
     //save mail
     $mail = new Gpf_Db_Mail();
     $mail->setSubject($this->subjectTemplate->getHTML());
     $mail->setHtmlBody($this->bodyHtmlTemplate->getHTML());
     $mail->setTextBody($this->bodyTextTemplate->getHTML());
     $mail->setRecipients($toRecipients);
     if (!is_null($bccRecipients) || $bccRecipients != '') {
         $mail->setBccRecipients($bccRecipients);
     }
     if ($this->mailAccount !== null) {
         $mail->setMailAccount($this->mailAccount);
     }
     $mail->setFromMail($this->fromMail);
     $mail->setReplyTo($this->replyTo);
     $mail->insert();
     $this->createMailAttachments($this->mailTemplate, $mail);
     return $mail;
 }
예제 #8
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();
 }
예제 #9
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();
 }
 public function getTemplateNoRpc($templateName)
 {
     $template = new Gpf_Templates_Template($templateName . '.tpl');
     return $this->createTemplateRecordSet($templateName, $template->getHTML());
 }
예제 #11
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();
 }
	private function createList() {
		$payAffTemplate = new Gpf_Templates_Template('pay_affiliates_list.tpl', 'merchants');
		$payAffTemplate->assignByRef('payaffiliates', $this->iterator);
		$payAffTemplate->assignByRef('currency', Pap_Common_Utils_CurrencyUtils::getDefaultCurrency()->getSymbol());
		return $payAffTemplate->getHTML();
	}
예제 #13
0
 public function __construct($templateName, $panel='') {
     parent::__construct(null);
     $this->templateName = $templateName;
     $template = new Gpf_Templates_Template($templateName, $panel);
     $this->templateHtml = $template->getHTML();
 }