*/ class Mage_Adminhtml_Block_Newsletter_Template_Preview extends Mage_Adminhtml_Block_Widget { protected function _toHtml() { /* @var $template Mage_Newsletter_Model_Template */ $template = Mage::getModel('newsletter/template'); if($id = (int)$this->getRequest()->getParam('id')) { $template->load($id); } else { $template->setTemplateType($this->getRequest()->getParam('type')); $template->setTemplateText($this->getRequest()->getParam('text')); $template->setTemplateStyles($this->getRequest()->getParam('styles')); } $storeId = (int)$this->getRequest()->getParam('store_id'); if(!$storeId) { $storeId = Mage::app()->getDefaultStoreView()->getId(); } Varien_Profiler::start("newsletter_template_proccessing"); $vars = array(); $vars['subscriber'] = Mage::getModel('newsletter/subscriber'); if($this->getRequest()->getParam('subscriber')) { $vars['subscriber']->load($this->getRequest()->getParam('subscriber')); } $template->emulateDesign($storeId); $templateProcessed = $template->getProcessedTemplate($vars, true); $template->revertDesign(); if($template->isPlain()) { $templateProcessed = "
" . htmlspecialchars($templateProcessed) . ""; } Varien_Profiler::stop("newsletter_template_proccessing"); return $templateProcessed; } }