/** * Style the template previews * @param array $templateArray template data * @return array html and text views */ protected function getPreview($templateArray) { $multi = false; if (count($templateArray) > 1) { $multi = true; $allLanguages = $this->util->getLocalized()->getLanguages(); } $htmlView = \MUtil_Html::create()->div(); $textView = \MUtil_Html::create()->div(); foreach ($templateArray as $template) { $content = ''; if ($template['gctt_subject'] || $template['gctt_body']) { if ($multi) { $htmlView->h3()->append($allLanguages[$template['gctt_lang']]); $textView->h3()->append($allLanguages[$template['gctt_lang']]); } $content .= '[b]'; $content .= $this->_('Subject:'); $content .= '[/b] [i]'; $content .= $this->mailer->applyFields($template['gctt_subject']); $content .= "[/i]\n\n"; $content .= $this->mailer->applyFields($template['gctt_body']); $htmlView->div(array('class' => 'mailpreview'))->raw(\MUtil_Markup::render($content, 'Bbcode', 'Html')); $textView->pre(array('class' => 'mailpreview'))->raw(\MUtil_Markup::render($content, 'Bbcode', 'Text')); } } return array('html' => $htmlView, 'text' => $textView); }