Пример #1
0
 public function runGetMilestone(TBGRequest $request)
 {
     $milestone = new TBGMilestone($request['milestone_id']);
     return $this->renderJSON(array('content' => TBGAction::returnTemplateHTML('project/milestonebox', array('milestone' => $milestone)), 'milestone_id' => $milestone->getID(), 'milestone_name' => $milestone->getName(), 'milestone_order' => array_keys($milestone->getProject()->getMilestonesForRoadmap())));
 }
 protected function _prepareMessages()
 {
     if ($this->template !== null) {
         if ($this->message_plain === null && $this->message_html === null) {
             if ($this->language !== null) {
                 try {
                     $current_language = TBGContext::getI18n()->getCurrentLanguage();
                     TBGContext::getI18n()->setLanguage($this->language);
                     $this->message_html = TBGAction::returnTemplateHTML("mailing/{$this->template}.html", $this->template_parameters);
                     if ($this->message_html == '') {
                         $this->message_html = null;
                     }
                     $this->message_plain = TBGAction::returnTemplateHTML("mailing/{$this->template}.text", $this->template_parameters);
                     if ($this->message_plain == '') {
                         $this->message_plain = null;
                     }
                     TBGContext::getI18n()->setLanguage($current_language);
                 } catch (Exception $e) {
                     TBGContext::getI18n()->setLanguage($current_language);
                     throw $e;
                 }
             } else {
                 $this->message_html = TBGAction::returnTemplateHTML("mailing/{$this->template}.html", $this->template_parameters);
                 $this->message_plain = TBGAction::returnTemplateHTML("mailing/{$this->template}.text", $this->template_parameters);
             }
         }
     }
 }
Пример #3
0
/**
 * Return a rendered template with specified parameters
 *
 * @param string	$template	name of template to load, or module/template to load
 * @param array 	$params  	key => value pairs of parameters for the template
 */
function get_template_html($template, $params = array())
{
    return TBGAction::returnTemplateHTML($template, $params);
}
 protected function _parse_add_toc($matches)
 {
     if (TBGContext::isCLI()) {
         return '';
     }
     return TBGAction::returnTemplateHTML('publish/toc', array('toc' => $this->toc));
 }
Пример #5
0
    public function getEmailTemplates($template, $parameters = array())
    {
        if (!array_key_exists('module', $parameters)) {
            $parameters['module'] = $this;
        }
        $message_plain = TBGAction::returnTemplateHTML("mailing/{$template}.text", $parameters);
        $html = TBGAction::returnTemplateHTML("mailing/{$template}.html", $parameters);
        $styles = file_get_contents(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'fixtures' . DS . TBGSettings::getThemeName() . '.css');
        $message_html = <<<EOT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
\t<html>
\t\t<head>
\t\t\t<meta http-equiv=Content-Type content="text/html; charset=utf-8">
\t\t\t<style type="text/css">
\t\t\t\t{$styles}
\t\t\t</style>
\t\t</head>
\t\t<body>
\t\t\t{$html}
\t\t</body>
\t</html>
EOT;
        return array($message_plain, $message_html);
    }