• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/paysystem/baseservicehandler.php
  • Класс: BitrixSalePaySystemBaseServiceHandler
  • Вызов: BaseServiceHandler::showTemplate
public function showTemplate(Payment $payment = null, $template = '')
{
	$result = new ServiceResult();

	global $APPLICATION, $USER, $DB;

	$templatePath = $this->searchTemplate($template);

	if ($templatePath != '' && IOFile::isFileExists($templatePath))
	{
		$params = array_merge($this->getParamsBusValue($payment), $this->getExtraParams());

		if ($this->initiateMode == self::STREAM)
		{
			require($templatePath);

			if ($this->service->getField('ENCODING') != '')
			{
				define("BX_SALE_ENCODING", $this->service->getField('ENCODING'));
				AddEventHandler('main', 'OnEndBufferContent', array($this, 'OnEndBufferContent'));
			}
		}
		elseif ($this->initiateMode == self::STRING)
		{
			ob_start();
			$content = require($templatePath);

			$buffer = ob_get_contents();
			if ($buffer <> '')
				$content = $buffer;

			if ($this->service->getField('ENCODING') != '')
			{
				$encoding = Context::getCurrent()->getCulture()->getCharset();
				$content = TextEncoding::convertEncoding($content, $encoding, $this->service->getField('ENCODING'));
			}

			$result->setTemplate($content);
			ob_end_clean();
		}
	}
	else
	{
		$result->addError(new Error(Loc::getMessage('SALE_PS_BASE_SERVICE_TEMPLATE_ERROR')));
	}

	return $result;
}