/** * Get parse only Template standard or custom. * * @param array $params - The type, t_style_id, rules * * @return string The template name * @since 1.0 */ public function getTemplate($params = false) { // render the content of letter for each user // If can't determine the type of doc... if (empty($params['type']) || !in_array($params['type'], array('html', 'plain'))) { $this->setError('Type is not defined'); return false; } /* if we get int then this is the custom template (schematic mode), * otherwise set raw mode */ //$params['renderMode'] = ($params['t_style_id'] == strval(intval($params['t_style_id']))) ? 'schematic' : 'raw'; // No more RAW mode. It displayed not correct if (empty($params['renderMode'])) { $params['renderMode'] = 'schematic'; } $document = MigurMailerDocument::factory($params['type'], $params); //$this->triggerEvent('onMailerBeforeRender'); $document->render(false, $params); $tpl = $document->getTemplate(); //$this->triggerEvent('onMailerAfterRender'); unset($document); return $tpl; }
/** * Gets the rendered template. * * @param mixed $id template id * @param string $mode * @return object */ public function getRenderedBy($id, $mode = 'schematic') { //TODO: Check. If this method is not used anywhere then remove it. $params = array('t_style_id' => $id, 'renderMode' => $mode); $document = MigurMailerDocument::getInstance('html', $params); $template = $document->parse($params); $template['content'] = $document->render(false, $params); return $template; }