*/ class Mage_Adminhtml_Block_Newsletter_Queue_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')) { $queue = Mage::getModel('newsletter/queue'); $queue->load($id); $template->setTemplateType($queue->getNewsletterType()); $template->setTemplateText($queue->getNewsletterText()); $template->setTemplateStyles($queue->getNewsletterStyles()); } 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_queue_proccessing"); $vars = array(); $vars['subscriber'] = Mage::getModel('newsletter/subscriber'); $template->emulateDesign($storeId); $templateProcessed = $template->getProcessedTemplate($vars, true); $template->revertDesign(); if($template->isPlain()) { $templateProcessed = "
" . htmlspecialchars($templateProcessed) . ""; } Varien_Profiler::stop("newsletter_queue_proccessing"); return $templateProcessed; } }