*/ class Mage_XmlConnect_Model_Template extends Mage_Core_Model_Template { /** * Model constructor * * @return null */ protected function _construct() { $this->_init('xmlconnect/template'); } /** * Processing object before save data * Add created_at and modified_at params * * @return Mage_XmlConnect_Model_Template */ protected function _beforeSave() { parent::_beforeSave(); $currentDate = Mage::getSingleton('core/date')->gmtDate(); if (!$this->getId()) { $this->setCreatedAt($currentDate); } $this->setModifiedAt($currentDate); return $this; } /** * Get template type * * @return int */ public function getType() { return self::TYPE_HTML; } /** * Retrieve processed template * * @param array $variables * @return string */ public function getProcessedTemplate(array $variables = array()) { /* @var $processor Mage_Widget_Model_Template_Filter */ $processor = Mage::getModel('widget/template_filter'); $variables['this'] = $this; if (Mage::app()->isSingleStoreMode()) { $processor->setStoreId(Mage::app()->getStore()); } else { $processor->setStoreId(1); } $htmlDescription = <<%s: EOT; $html = sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Push title')) . $this->getPushTitle(); $html .= sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Message title')) . $this->getMessageTitle(); $html .= sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Message content')) . $processor->filter($this->getContent()); return $html; } }