public function testRenderWithAbsoluteTemplatePath()
 {
     $engine = new TemplateEngine(__DIR__ . '/../fixtures/templates');
     $result = $engine->render(__DIR__ . '/../fixtures/templates/1.php', array('message' => 'World'));
     $this->assertNotEmpty($result);
     //$this->assertEquals("<h1>Hello World</h1>\n", $result);
 }
 /**
  * Sends an e-mail (text format) from the system to the specified recipient. 
  * Difference to sendSystemEmail(): Content is extracted from a template file.
  * 
  * @param WebSoccer $websoccer current context.
  * @param I18n $i18n messages context
  * @param string $recipient recipient e-mail address
  * @param string $subject Already translated e-mail subject.
  * @param string $templateName name of template (NOT template file name, i.e. WITHOUT file extension!) to use for the e-mail body.
  * @param array $parameters array of parameters to use in the template (key=parameter name, value= parameter value).
  */
 public static function sendSystemEmailFromTemplate(WebSoccer $websoccer, I18n $i18n, $recipient, $subject, $templateName, $parameters)
 {
     $emailTemplateEngine = new TemplateEngine($websoccer, $i18n, null);
     $template = $emailTemplateEngine->loadTemplate('emails/' . $templateName);
     $content = $template->render($parameters);
     self::sendSystemEmail($websoccer, $recipient, $subject, $content);
 }
 public function actionView($id)
 {
     $articleModel = new ArticleModel();
     $article = $articleModel->get($id);
     if ($article === false) {
         throw new Http404();
     }
     $templateEngine = new TemplateEngine();
     return $templateEngine->render('articles/view.html', $article);
 }
Example #4
0
 function render()
 {
     $template = new TemplateEngine($this->filepath);
     $template->set($this->templateData);
     $template->setGlobals($this->templateGlobals);
     $template->display();
     if (isset($_GET['DEBUG'])) {
         echo '<pre>';
         var_dump($this->templateData);
         echo '</pre>';
     }
 }
Example #5
0
 private static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new TemplateEngine();
     }
     return self::$instance;
 }
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public static function setDebug()
 {
     self::$debug_flag = true;
     if (self::$instance instanceof DwooEngine) {
         self::$instance->setDebug();
     }
 }
Example #8
0
 public function beforeRender()
 {
     $menuSource = "";
     foreach ($this->menuEntries as $name => $link) {
         $menuSource .= '<li><a href="' . $link . '">' . $name . '</a></li>';
     }
     TemplateEngine::getInstance()->replaceMarks("menu", $menuSource);
 }
Example #9
0
 public function renderTable(TableContent $content)
 {
     $templates = array('widths' => $content->getTableWidths(), 'as_totals_box' => $content->getAsTotalsBox(), 'num_columns' => $content->getNumColumns(), 'data' => $content->getData(), 'headers' => $content->getHeaders(), 'auto_totals' => $content->getAutoTotals(), 'types' => $content->getDataTypes());
     if ($templates['auto_totals']) {
         $templates['totals'] = $content->getTotals();
     }
     $this->markup .= TemplateEngine::render(__DIR__ . '/html_templates/table.tpl', $templates);
 }
Example #10
0
 private function __construct()
 {
     $this->classloader = Classloader::getInstance();
     $this->classloader->initLoadLib();
     $this->dataConnector = DataConnector::getInstance();
     $this->routingEngine = RoutingEngine::getInstance();
     $this->templateEngine = TemplateEngine::getInstance();
 }
 /**
  * @see	wcf\system\template\TemplateEngine::__construct()
  */
 protected function init()
 {
     parent::init();
     $this->templatePaths = array(1 => WCF_DIR . 'acp/templates/');
     $this->compileDir = WCF_DIR . 'acp/templates/compiled/';
     if (!defined('NO_IMPORTS')) {
         $this->loadTemplateListeners();
     }
 }
Example #12
0
 /**
  * renders tree into menu template
  * @return  object
  */
 public function renderTree()
 {
     if (!$this->getConfig()->template_menu) {
         return;
     }
     if (!$this->tree) {
         return;
     }
     $template = new TemplateEngine($this->templatePath . $this->getConfig()->template_menu);
     $template->setCacheable(true);
     $cache = Cache::getInstance();
     if (!$cache->isCached('submenu')) {
         $childs = array();
         $childlist = $this->tree->getChildList($this->tree->getCurrentId());
         foreach ($childlist as $item) {
             if (isset($item['visible']) && !$item['visible']) {
                 continue;
             }
             $item['path'] = $this->tree->getPath($item['id']);
             $childs[] = $item;
         }
         $template->setVariable('submenu', $childs, false);
         $cache->save(serialize($childs), 'submenu');
     } else {
         $template->setVariable('submenu', unserialize($cache->getCache('submenu')), false);
     }
     // check if template is in cache
     if ($template->isCached()) {
         return $template;
     }
     $menu = $this->tree->getRootList();
     // get selected main menu item
     $firstNode = $this->tree->getFirstAncestorNode($this->tree->getCurrentId());
     $firstId = $firstNode ? $firstNode['id'] : 0;
     foreach ($menu as &$item) {
         $item['path'] = isset($item['external']) && $item['external'] ? $item['url'] : $this->tree->getPath($item['id']);
         $item['selected'] = $item['id'] == $firstId;
     }
     $template->setVariable('menu', $menu, false);
     $auth = Authentication::getInstance();
     $template->setVariable('loginName', $auth->getUserName(), false);
     return $template;
 }
 /**
  * Render informer html-code reserved for page URL
  * Use cache
  *
  * @param $url
  * @return string
  */
 public function render($url)
 {
     $data = $this->getData($url);
     if (!empty($data['informer_id'])) {
         $engine = new TemplateEngine();
         $cacheKey = 'compiled_' . $data['informer_id'];
         $compiled = $this->cache->get($cacheKey);
         if (!$compiled) {
             $template = $this->getTemplate($data['informer_id']);
             if (empty($template['error']) && !empty($template['code']) && !empty($template['items']) && isset($template['replace'])) {
                 $compiled = $engine->compileWithItems($template['code'], $template['items'], $template['replace']);
             }
             $this->cache->set($cacheKey, $compiled);
         }
         return $engine->render($compiled, $data['params']);
     } else {
         return '';
     }
 }
Example #14
0
function renderNavBar()
{
    //Conexion a la BD
    $db = DBManager::getInstance();
    $db->connect();
    $dbm = Driver::getInstance();
    $navBar = new TemplateEngine();
    //---x---x--- Por defecto ---x---x---
    $navBar->log = 0;
    //el usuario NO está logeado
    $navBar->admin = 0;
    //por lo tanto no puede ser administrador
    $navBar->materia = 0;
    //ni administrador de materia
    $navBar->user_id = null;
    //y no hay ID de usuario
    //Se ha hecho login?
    if (isset($_SESSION["name"])) {
        //---x---x--- Si se ha hecho... ---x---x---
        $navBar->log = 1;
        //el usuario está logeado
        $usuario = new Usuario($dbm);
        $usuario = $usuario->findBy('user_name', $_SESSION['name']);
        //CAMBIAME
        $navBar->user_id = $usuario[0]->getUser_id();
        //El usuario es un administrador?
        if ($db->existUserRol($_SESSION["name"], "AdminApuntorium")) {
            $navBar->admin = 1;
            //el usuario es administrador
        } else {
            //El usuario es administrador de materia?
            $administra = new Administra($dbm);
            if ($administra->findBy('user_id', $usuario[0]->getUser_id()) != null) {
                $navBar->materia = 1;
                //el usuario administra una materia
            }
        }
    } else {
    }
    return $navBar->render('navbar_v.php');
}
Example #15
0
 /**
  * Returns an instance of template engine driver.
  * If the requested driver is already created, the same instance is returned.
  *
  * @param string $driver Name of the template engine driver. Must correspond to components.template_engine.engines.{$driver}.
  *
  * @return \Webiny\Component\TemplateEngine\Bridge\TemplateEngineInterface
  * @throws TemplateEngineException
  * @throws \Exception
  */
 static function getInstance($driver)
 {
     if (isset(self::$instances[$driver])) {
         return self::$instances[$driver];
     }
     $driverConfig = TemplateEngine::getConfig()->get('Engines.' . $driver, false);
     if (!$driverConfig) {
         throw new TemplateEngineException('Unable to read driver configuration: TemplateEngine.Engines.' . $driver);
     }
     try {
         self::$instances[$driver] = TemplateEngineBridge::getInstance($driver, $driverConfig);
         return self::$instances[$driver];
     } catch (\Exception $e) {
         throw $e;
     }
 }
Example #16
0
 protected function init($name) {
     Logger::enter_group('Template');
     Logger::debug('Loading Template');
     $this->name = $name;
     
     $this->tpl_engine = TemplateEngine::instance();
     $this->tpl_engine->set_opts(array(
         'loader' => array(
             APP_ROOT . "/views/",
             APP_ROOT . "/views/" . $this->name
         ),
         'cache' => Config::instance('framework')->get_value('cache'),
         'debug' => Config::instance('framework')->get_value('debug')
     ));
     $this->tpl_engine->load();
 }
Example #17
0
 /** Display output of TSunic
  *
  * Call this function to display the output of TSunic.
  * If you call this function from an ajax request, it will return xml output
  *
  * @param string $template
  *	Request output of certain template only
  *
  * @return bool
  */
 public function display($template = false)
 {
     // validate template
     if (empty($template)) {
         $template = $this->Input->get('tmpl');
         // is tmpl?
         if (empty($template)) {
             $template = '$$$html';
         }
     }
     // display templates
     if (!$this->isAjax()) {
         $this->Tmpl->display($template);
     } else {
         $this->Tmpl->responseAjax();
     }
     return true;
 }
Example #18
0
 public function __construct()
 {
     if (is_null(self::$smarty)) {
         // 实例化模版引擎对象
         $smarty = new Smarty();
         // 设置模版、缓存、编译目录
         $smarty->template_dir = APP_VIEWS_PATH . '/' . CONTROLLER;
         $smarty->compile_dir = APP_STORAGE_COMPILE_PATH;
         $smarty->cache_dir = APP_STORAGE_CACHE_PATH;
         // 设置模版使用分隔符号
         $smarty->left_delimiter = C('LEFT_DELIMITER');
         $smarty->right_delimiter = C('RIGHT_DELIMITER');
         // 设置模版缓存信息
         $smarty->caching = C('CACHE_START');
         $smarty->cache_lifetime = C('CACHE_LIFE_TIME');
         // 将模版引擎对象保存在类属性中
         self::$smarty = $smarty;
     }
 }
Example #19
0
if ($user != null && $user->checkPermissions(1, 1)) {
    // falls Admin-Rechte
    $isAdmin = 1;
} else {
    $isAdmin = 0;
    if ($user != null && $user->checkPermissions(0, 0, 0, 1, 1)) {
        // wenn ORDERER
        redirectURI("/orderer/index.php");
    }
    if ($user != null && $user->checkPermissions(0, 0, 1)) {
        // wenn USER
        redirectURI("/user/index.php");
    }
}
$LOG = new Log();
$tpl = new TemplateEngine("template/viewProduct.html", "template/frame.html", $lang["viewer_viewProduct"]);
$LOG->write('3', 'viewer/viewProduct.php');
$pID = $_GET['pID'];
$tpl->assign('ID', $pID);
//Produktdaten
$product_query = DB_query("SELECT\n\t\t\t\t*\n\t\t\t\tFROM products\n\t\t\t\tWHERE products_id = " . $pID . "\n\t\t\t\tAND deleted = 0\n\t\t\t\tORDER BY sort_order, name\n\t\t\t\t");
$product = DB_fetchArray($product_query);
$tpl->assign('name', $product['name']);
$tpl->assign('description', $product['description']);
//$tpl->assign('sort_order',$product['sort_order']);
$tpl->assign('active', $product['active']);
// zur Unterscheidung, ob anzeigbar, weiterhin mitliefern
$tpl->assign('image_small', $product['image_small']);
$tpl->assign('image_big', $product['image_big']);
$tpl->assign('stock', $product['stock']);
$tpl->assign('price', $product['price']);
Example #20
0
require_once '../cancerbero/cancerbero.php';
$cerb = new Cancerbero('AP_MisTitulaciones');
$cerb->handleAuto();
//Includes iniciales
require_once '../views/templateEngine.php';
// se carga la clase TemplateEngine
require_once '../model/Titulacion.php';
require_once '../model/Usuario.php';
require_once '../model/driver.php';
require_once 'navbar.php';
//Inclusión de navbar. Omitible si no la necesita
//Conexion a la BD
$db = Driver::getInstance();
//Instancias TemplateEngine, renderizan elementos
$renderMain = new TemplateEngine();
$rendermistit = new TemplateEngine();
$titulaciones = new Titulacion($db);
$usuario = new Usuario($db);
$usuario = $usuario->findBy('user_name', $_SESSION['name']);
$misTitulaciones = $usuario[0]->titulaciones();
$alltitulaciones = $titulaciones->all();
$rendermistit->misTitulaciones = $misTitulaciones;
$rendermistit->allTitulaciones = $alltitulaciones;
$renderMain->title = "Mis titulaciones";
//Titulo y cabecera de la pagina
$renderMain->navbar = renderNavBar();
//Inserción de navBar en la pagina. Omitible si no la necesita
$renderMain->content = $rendermistit->render('misTitulaciones_v.php');
//Inserción del contenido de la página
echo $renderMain->renderMain();
// Dibujado de la página al completo
Example #21
0
 private function handleUserPost()
 {
     $request = Request::getInstance();
     $user = new NewsLetterUser($this->plugin);
     $usr_used = $request->getValue('usr_used');
     if (!$usr_used) {
         $usr_used = array();
     }
     try {
         if (!$request->exists('id')) {
             throw new Exception('User group is missing.');
         }
         $id = intval($request->getValue('id'));
         $key = array('id' => $id);
         $this->removeUser($key);
         foreach ($usr_used as $item) {
             $user->addGroup(array('id' => $item), $key);
         }
         viewManager::getInstance()->setType(NewsLetter::VIEW_GROUP_OVERVIEW);
         $this->handleOverview();
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
         $this->handleUserGet(false);
     }
 }
Example #22
0
 private function handleTreeDeletePost()
 {
     $request = Request::getInstance();
     $values = $request->getRequest(Request::POST);
     try {
         if (!$request->exists('id')) {
             throw new Exception('Post ontbreekt.');
         }
         $id = $request->getValue('id');
         $key = array('id' => $id);
         $this->delete($key);
         viewManager::getInstance()->setType(Calendar::VIEW_COMMENT_OVERVIEW);
         $this->handleHttpGetRequest();
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
         $this->handleTreeDeleteGet();
     }
 }
Example #23
0
 private function handleExtensionForm($theme)
 {
     $request = Request::getInstance();
     try {
         if (!$request->exists('ext_id')) {
             throw new Exception('Extension ontbreekt.');
         }
         $id = intval($request->getValue('ext_id'));
         $extension = $this->director->extensionManager->getExtensionFromId(array('id' => $id));
         $extension->renderForm($theme);
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
     }
 }
Example #24
0
 /**
  * handle navigation for sub classes / pages
  */
 public function handleAdminSubLinks($keyName, $title, $addBreadcrumb = false)
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $template = new TemplateEngine();
     if (!$request->exists('nl_id')) {
         return;
     }
     $nl_id = $request->getValue('nl_id');
     $newsLetterName = $this->getName(array('id' => $nl_id));
     $template->setVariable('pageTitle', $newsLetterName, false);
     $tree_id = $request->getValue('tree_id');
     $tag = $request->getValue('tag');
     $template->setVariable('tree_id', $tree_id, false);
     $template->setVariable('tag', $tag, false);
     $template->setVariable('nl_id', $nl_id, false);
     if (!$addBreadcrumb) {
         return;
     }
     $url = new Url(true);
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     $url->setParameter('id', $nl_id);
     $url->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $breadcrumb = array('name' => $newsLetterName, 'path' => $url->getUrl(true));
     $this->addBreadcrumb($breadcrumb);
 }
Example #25
0
$cerb = new Cancerbero('AP_NuevaNota');
$cerb->handleAuto();
//Includes iniciales
require_once '../views/templateEngine.php';
// se carga la clase TemplateEngine
require_once '../model/Nota.php';
require_once '../model/Usuario.php';
require_once 'navbar.php';
//Inclusión de navbar. Omitible si no la necesita
require_once '../model/driver.php';
//Inclusión de Driver de las clases de "model". Omitible si no las usamos
//Conexion a la BD (Permite usar las funciones de DBManager de Cancerbero)
$db = Driver::getInstance();
//Instancias TemplateEngine, renderizan elementos
$renderMain = new TemplateEngine();
$renderPlantilla = new TemplateEngine();
//FUNCIONES DEL CONTROLADOR
//Escribimos aquí lo que hace este controlador en concreto (Comprueba el login, redirecciona...)
$renderMain->title = "Nueva Nota";
//Titulo y cabecera de la pagina
if (isset($_POST['editor'])) {
    $user = new Usuario($db);
    $user = $user->findBy('user_name', $_SESSION['name'])[0];
    $nota = new Nota($db);
    $nota->setNota_name($_POST['title']);
    $nota->setContenido(htmlspecialchars($_POST['editor']));
    $nota->setUser_id($user->getUser_id());
    $date = getdate();
    $buffer = $date['year'] . "-" . $date['mon'] . "-" . $date['mday'];
    $nota->setFecha($buffer);
    $nota->create();
Example #26
0
<?php

include '../includes/includes.inc';
include '../includes/startApplication.php';
include '../includes/functions/verifyadmin.inc';
$user = restoreUser();
if ($user == null || !$user->checkPermissions(1, 1)) {
    redirectURI("/admin/login.php", "camefrom=users.php");
}
$LOG = new Log();
$tpl = new TemplateEngine("template/editUser.html", "template/frame.html", $lang["admin_users"]);
if (isset($_POST['action'])) {
    $LOG->write('3', 'admin/editUser.php: action set');
    if ($_POST['action'] == 'add') {
        $LOG->write('3', 'admin/editUser.php: action=add');
        if ($_POST['password'] == $_POST['repeatPassword']) {
            addUser();
            $LOG->write('2', 'Nutzer ' . mysql_insert_id() . ' hinzugefügt');
            redirectURI('/admin/users.php');
        } else {
            // falsche Passwortwiederholung
            $passwordError = "1";
            $tpl->assign('action', 'add');
            $tpl->assign('uID', '');
            $tpl->assign('password_error', $passwordError);
            $tpl->assign('name', $_POST['name']);
            $tpl->assign('lastname', $_POST['lastname']);
            $tpl->assign('email', $_POST['email']);
            $tpl->assign('bill_name', $_POST['bill_name']);
            $tpl->assign('bill_street', $_POST['bill_street']);
            $tpl->assign('bill_postcode', $_POST['bill_postcode']);
Example #27
0
require_once '../model/Materia.php';
require_once '../model/Titulacion.php';
require_once 'comboboxes.php';
//Conexion a la BD
$db = Driver::getInstance();
//inicio instancias render y creacion de comboboxes
$usuario = new Usuario($db);
$usuario = $usuario->findBy('user_name', $_SESSION['name']);
$usuario = $usuario[0];
$materias = new Materia($db);
$titulaciones = new Titulacion($db);
$materias = $materias->all();
$titulaciones = $titulaciones->all();
//Instancias TemplateEngine, renderizan elementos
$renderMain = new TemplateEngine();
$renderPlantilla = new TemplateEngine();
$apuntes = $usuario->apuntes();
$tieneapuntes = $usuario->tieneApuntes();
$renderPlantilla->titulos = null;
$renderPlantilla->materias = $materias;
$renderPlantilla->anho = anhoRenderComboBox();
//fin Instancias
//FUNCIONES DEL CONTROLADOR
if (isset($_POST['materia']) || isset($_POST['anho'])) {
    if ($_POST['materia'] != "nil") {
        $materiafiltro = new Materia($db);
        $materiafiltro = $materiafiltro->findBy('mat_name', $_POST['materia']);
        if ($materiafiltro) {
            $materiafiltro = $materiafiltro[0];
            foreach ($apuntes as $key => $apunte) {
                if ($apunte->getMat_id() != $materiafiltro->getMat_id()) {
Example #28
0
File: login.php Project: MOGP95/ET3
<?php

// Controlador de login hecho por FVieira.
session_start();
// se inicia el manejo de sesiones
require_once '../views/templateEngine.php';
// se carga la clase TemplateEngine
require_once '../cancerbero/php/DBManager.php';
// se carga el driver de cancerbero
require_once 'modal.php';
$db = DBManager::getInstance();
$db->connect();
$renderMain = new TemplateEngine();
$renderlogin = new TemplateEngine();
//instancias de TemplateEngine
$renderlogin->status = null;
//por defecto no hay ningun error (en la plantilla login_v la variable $status valdrá <br/>)
if (isset($_POST['name']) && isset($_POST['pass'])) {
    // si ya se hizo algun post
    if ($db->tryLogin($_POST['name'], $_POST['pass'])) {
        //comprueba los datos nombre de Usuario y contrseña
        $_SESSION["name"] = $_POST['name'];
        header("location: home.php");
    }
    $status = "Usuario y/o contraseña invalido";
    $contenido = "Por favor, compruebe sus datos de acceso y compruebe si no tiene la tecla bloq mayus activada";
    $renderlogin->status = renderModalError($status, $contenido);
}
$renderMain->title = "Login";
$renderMain->navbar = null;
//el login no tiene navbar
Example #29
0
 private function handleConfigPost()
 {
     $request = Request::getInstance();
     $values = $request->getRequest(Request::POST);
     try {
         if (!$request->exists('id')) {
             throw new Exception('Thema ontbreekt.');
         }
         $id = intval($request->getValue('id'));
         $key = array('id' => $id);
         $theme = $this->director->themeManager->getThemeFromId($key);
         $fileTpl = $theme->getTemplateFile();
         $fileIni = $theme->getConfigFile();
         $fileCss = $theme->getStyleSheetFile();
         $tpl_content = $request->getValue('file_tpl');
         $ini_content = $request->getValue('file_ini');
         $css_content = $request->getValue('file_css');
         if (!$tpl_content) {
             throw new Exception("Template file is empty.");
         }
         if (!$ini_content) {
             throw new Exception("Configuration file is empty.");
         }
         if (!$css_content) {
             throw new Exception("Stylesheet file is empty.");
         }
         if (!($hTpl = fopen($fileTpl, "w"))) {
             throw new Exception("Error opening {$fileTpl} for writing.");
         }
         if (!($hIni = fopen($fileIni, "w"))) {
             throw new Exception("Error opening {$fileIni} for writing.");
         }
         if (!($hCss = fopen($fileCss, "w"))) {
             throw new Exception("Error opening {$fileCss} for writing.");
         }
         fputs($hTpl, $tpl_content);
         fputs($hIni, $ini_content);
         fputs($hCss, $css_content);
         fclose($hTpl);
         fclose($hIni);
         fclose($hCss);
         // clear cache
         $cache = Cache::getInstance();
         $cache->clear();
         viewManager::getInstance()->setType(ViewManager::ADMIN_OVERVIEW);
         $this->handleAdminOverview();
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
         $this->handleConfigGet(false);
     }
 }
Example #30
0
 /**
  * handle optin confirm
  */
 private function handleOptin()
 {
     $taglist = $this->getTagList();
     if (!$taglist) {
         return;
     }
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $objUser = $this->getObject(self::TYPE_USER);
     $objSettings = $this->getObject(self::TYPE_SETTINGS);
     try {
         if (!$request->exists('key')) {
             throw new Exception('Parameter does not exist.');
         }
         $keyValue = $request->getValue('key');
         if (!$keyValue) {
             throw new Exception('Parameter is empty.');
         }
         $key = array('optin' => $keyValue);
         $objUser->enable($key);
         // retrieve settings to get redirect location
         $searchcriteria = array();
         foreach ($taglist as $item) {
             $searchcriteria = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
         }
         $settings = $objSettings->getSettings($searchcriteria['tree_id'], $searchcriteria['tag']);
         $location = $settings['optin_tree_id'] ? $this->director->tree->getPath($settings['optin_tree_id']) : '/';
         header("Location: {$location}");
         exit;
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('newsLetterErrorMessage', $e->getMessage(), false);
         $this->log->info($e->getMessage());
         $view->setType(ViewManager::OVERVIEW);
         $this->handleHttpGetRequest();
     }
 }