public function render(array $data, $template)
 {
     foreach ($data as $name => $param) {
         $this->_engine->assign($name, $param);
     }
     return $this->_engine->fetch($template);
 }
Пример #2
0
 /**
  * Returns the template's HTML footer
  *
  * @return string HTML footer
  */
 public function getFooter()
 {
     $shop_address = $this->getShopAddress();
     $id_shop = (int) $this->shop->id;
     $this->smarty->assign(array('available_in_your_account' => $this->available_in_your_account, 'shop_address' => $shop_address, 'shop_fax' => Configuration::get('PS_SHOP_FAX', null, null, $id_shop), 'shop_phone' => Configuration::get('PS_SHOP_PHONE', null, null, $id_shop), 'shop_email' => Configuration::get('PS_SHOP_EMAIL', null, null, $id_shop), 'free_text' => Configuration::get('PS_INVOICE_FREE_TEXT', (int) Context::getContext()->language->id, null, $id_shop)));
     return $this->smarty->fetch($this->getTemplate('footer'));
 }
Пример #3
0
function send($id)
{
    $form = is_array($id) ? $id : get($id);
    $results = results($id);
    if (!$results) {
        return false;
    }
    if (!is_array($form['template']) || !strlen($form['template']['recipient'])) {
        return false;
    }
    $smarty = new \Smarty();
    $smarty->compile_check = true;
    $smarty->debugging = false;
    foreach ($results as $nm => $val) {
        $smarty->assign($nm, $val);
    }
    $mail = new \PHPMailer();
    $mail->CharSet = 'UTF-8';
    $mail->Subject = $smarty->fetch('string:' . $form['template']['subject']);
    $addresses = explode(',', $form['template']['recipient']);
    foreach ($addresses as $a) {
        $mail->AddAddress(trim($a));
    }
    $mail->MsgHTML($smarty->fetch('string:' . $form['template']['body']));
    return $mail->Send();
}
Пример #4
0
 /**
  * Renders a template using the provided data.
  *
  * @param string $template_slug
  * @param array $data
  */
 public function render($template_slug, array $data = array())
 {
     if (!empty($data)) {
         array_walk($data, array($this, 'assign_template_var'));
     }
     $template_slug = preg_match('/\\.tpl$/', $template_slug) ? $template_slug : $template_slug . '.tpl';
     return $this->smarty->fetch($template_slug);
 }
Пример #5
0
 /**
  * @test
  * it should call display method on Smarty
  */
 public function it_should_call_display_method_on_smarty()
 {
     $sut = $this->make_instance();
     $this->smarty->assign('key1', 'value1')->shouldBeCalled();
     $this->smarty->assign('key2', 'value2')->shouldBeCalled();
     $this->smarty->fetch('some-template.tpl')->willReturn('foo');
     $sut->render('some-template', ['key1' => 'value1', 'key2' => 'value2']);
 }
Пример #6
0
 /**
  * template render output
  *
  * @return string template render output
  * @throws SynergyException
  */
 protected function getRender()
 {
     if (isset($this->templateFile)) {
         $this->assignSmartyVariables();
         $render = $this->loader->fetch($this->templateFile);
         return $render;
     } else {
         throw new SynergyException(sprintf('Invalid call to %s without setting templateFile', __METHOD__));
     }
 }
Пример #7
0
 public function setMessageFromTemplate($file, $data)
 {
     $smarty = new \Smarty();
     $vars = ['template_dir' => Config::get('path.templates') . 'mail/', 'compile_dir' => Config::get('path.cache') . 'smarty/', 'cache_dir' => Config::get('path.cache')];
     foreach ($vars as $name => $value) {
         $smarty->{$name} = $value;
     }
     foreach ($data as $key => $value) {
         $smarty->assign($key, $value);
     }
     $smarty->assign('content', $smarty->fetch($file . '.html'));
     $this->Body = $smarty->fetch('layout.html');
     return $this;
 }
Пример #8
0
 public function get($file, $assigned_variables)
 {
     // First set all the variables
     $this->assigned_variables = $assigned_variables;
     // Load Smarty
     $this->loadSmarty();
     // Set the directory
     $this->smartyInstance->setTemplateDir($this->directory);
     // Then assign all variables
     foreach ($this->assigned_variables as $key => $value) {
         $this->smartyInstance->assign($key, $value);
     }
     // And finally, load the template
     return $this->smartyInstance->fetch($file);
 }
Пример #9
0
 /**
  * Processes a template and returns the output.
  *
  * @param string $name The template to process.
  * @return string The output.
  */
 public function render($name)
 {
     $this->addFlashMessenger('Info');
     $this->addFlashMessenger('Success');
     $this->addFlashMessenger('Error');
     return $this->_smarty->fetch($name);
 }
Пример #10
0
 /**
  * Converts markdown into HTML
  *
  * @param string $content
  * @param array  $config . Options to configure MarkdownExtra and smarty
  *  - markdown: array for MarkdownExtra configuration parameters
  *  - smarty: array for SmartyPantsTypographer configuration parameters
  *  - custom: array for Custom configuration parameters
  * @param int    $smartyMode the SmartyPantsTypographer processing mode
  *
  * @return string
  * @throws InvalidConfigException if module not set
  */
 public static function convert($content, $config = [], $smartyMode = self::SMARTYPANTS_ATTR_LONG_EM_DASH_SHORT_EN)
 {
     $module = Config::initModule(Module::classname());
     $output = $content;
     if (strlen($output) > 0) {
         $mdConfig = empty($config['markdown']) ? [] : $config['markdown'];
         $output = static::process($content, $mdConfig);
         if ($module->smartyPants) {
             $smConfig = empty($config['smarty']) ? [] : $config['smarty'];
             $smarty = new SmartyPants($smartyMode);
             foreach ($smConfig as $name => $value) {
                 $smarty->{$name} = $value;
             }
             $output = $smarty->transform($output);
             $cuConfig = empty($config['custom']) ? $module->customConversion : $config['custom'];
             $output = static::customProcess($output, $cuConfig);
         }
         if (is_bool($module->smarty) && $module->smarty || (is_string($module->smarty) || is_callable($module->smarty)) && call_user_func($module->smarty, $module)) {
             $smarty = new \Smarty();
             if ($module->smartyYiiApp) {
                 $smarty->assign('app', Yii::$app);
             }
             if ($module->smartyYiiParams) {
                 $smarty->config_vars = Yii::$app->params;
             }
             $output = $smarty->fetch('string:' . $output, null, null, $module->smartyParams);
         }
     }
     return $output;
 }
/**
 * Render comments
 * 
 * Parameters:
 * 
 * - comments - comments that needs to be rendered
 * - page - current_page
 * - total_pages - total pages
 * - counter - counter for comment #
 * - url - base URL for link assembly
 * - parent - parent object
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_mobile_access_object_comments($params, &$smarty)
{
    $url_params = '';
    if (is_foreachable($params)) {
        foreach ($params as $k => $v) {
            if (strpos($k, 'url_param_') !== false && $v) {
                $url_params .= '&' . substr($k, 10) . '=' . $v;
            }
            // if
        }
        // foreach
    }
    // if
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true);
    }
    // if
    $user = array_var($params, 'user');
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('object', $user, '$user is expected to be an instance of User class', true);
    }
    // if
    $page = array_var($params, 'page', 1);
    $page = (int) array_var($_GET, 'page');
    if ($page < 1) {
        $page = 1;
    }
    // if
    $counter = array_var($params, 'counter', 1);
    $counter = ($page - 1) * $object->comments_per_page + $counter;
    list($comments, $pagination) = $object->paginateComments($page, $object->comments_per_page, $user->getVisibility());
    $smarty->assign(array("_mobile_access_comments_comments" => $comments, "_mobile_access_comments_paginator" => $pagination, "_mobile_access_comments_url" => mobile_access_module_get_view_url($object), "_mobile_access_comments_url_params" => $url_params, "_mobile_access_comments_counter" => $counter, "_mobile_access_comments_show_counter" => array_var($params, 'show_counter', true)));
    return $smarty->fetch(get_template_path('_object_comments', null, MOBILE_ACCESS_MODULE));
}
Пример #12
0
 public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
 {
     if (!is_null($template) && is_string($template) && !preg_match('/^(\\/|[a-z]{2,}:)/i', $template)) {
         $template = 'extendsall:' . $template;
     }
     return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
 }
Пример #13
0
 public function Display($file = false, $echo = true)
 {
     global $CMS, $DB, $USER;
     $smarty = new Smarty();
     //set cache and compile dir
     $smarty->setCacheDir("./data/data__hoang_taka_com/cache/");
     $smarty->setCompileDir("./data/data__hoang_taka_com/template_c/");
     $smarty->force_compile = $this->force_compile;
     $smarty->debugging = $this->debugging;
     $smarty->caching = $this->caching;
     $smarty->cache_lifetime = $this->cache_lifetime;
     if ($file) {
         //check template website use.
         $file_dir = "themes/" . $file . ".tpl";
         if (is_file($file_dir)) {
             $smarty->assign($this->data);
             if ($echo) {
                 return $smarty->display($file_dir);
             } else {
                 return $smarty->fetch($file_dir);
             }
         } else {
             echo "File: <b>{$file_dir}</b> is missing.";
         }
     }
 }
Пример #14
0
 public function display()
 {
     //Smarty engine/Smarty 引擎
     require ROOT . '/pf_core/smarty/libs/Smarty.class.php';
     $smarty = new Smarty();
     $table_fields = $this->initSqlFields();
     $smarty->assign('table_fields', $table_fields);
     $data_list = $this->loadData();
     foreach ($data_list as $k => $v) {
         if ($data_list[$k]['products_image']) {
             $data_list[$k]['products_image'] = '<img width="50" height="50" src="http://pandoraf.com/applications/pandoraf/templates/imgServer/thumb/list_grid/' . $v['products_image'] . '"/>';
         }
     }
     $smarty->assign('data_list', $data_list);
     if (0) {
         $contents = $smarty->fetch($this->data_tpl);
         $result = array();
         $result['page'] = 1;
         $result['total_page'] = 2;
         $result['contents'] = $contents;
         echo json_encode($result);
         return;
     }
     $smarty->display('web/table.html');
     exit;
 }
Пример #15
0
 /**
  * Processes a template and returns the output.
  *
  * @param string $name The template to process.
  * @return string The output.
  */
 public function render($name, $cacheId = null)
 {
     /**
      * Create temporary folder for Smarty's compilation and caching if they didn't exist
      */
     /**
      * Compilation folder
      */
     if (!is_dir($this->getCompilePath())) {
         if (ini_get('safe_mode')) {
             throw new Exception('PHP SAFE MODE is ON. System can not create compile folder "' . $this->getCompilePath() . '". Please create it with 777 mode.');
         } else {
             mkdir($this->getCompilePath(), 0777, true);
         }
     } elseif (!is_writable($this->getCompilePath())) {
         throw new Exception('Compile folder "' . $this->getCompilePath() . '" is not writable. Please change it to 777 mode.');
     }
     /**
      * Caching folder
      */
     if (!is_dir($this->getCachePath())) {
         if (ini_get('safe_mode')) {
             throw new Exception('PHP SAFE MODE is ON. System can not create compile folder: ' . $this->getCachePath() . '". Please create it with 777 mode.');
         } else {
             mkdir($this->getCachePath(), 0777, true);
         }
     } elseif (!is_writable($this->getCachePath())) {
         throw new Exception('Compile folder "' . $this->getCachePath() . '" is not writable. Please change it to 777 mode.');
     }
     if (null == $cacheId) {
         $cacheId = $this->cacheId;
     }
     return $this->smarty->fetch($name, $cacheId);
 }
/**
 * Render object tasks section
 * 
 * Parameters:
 * 
 * - object - Selected project object
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_tasks($params, &$smarty)
{
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true);
    }
    // if
    $open_tasks = $object->getOpenTasks();
    if (is_foreachable($open_tasks)) {
        foreach ($open_tasks as $open_task) {
            ProjectObjectViews::log($open_task, $smarty->get_template_vars('logged_user'));
        }
        // foreach
    }
    // if
    $completed_tasks = $object->getCompletedTasks(COMPLETED_TASKS_PER_OBJECT);
    if (is_foreachable($completed_tasks)) {
        foreach ($completed_tasks as $completed_task) {
            ProjectObjectViews::log($completed_task, $smarty->get_template_vars('logged_user'));
        }
        // foreach
    }
    // if
    $smarty->assign(array('_object_tasks_object' => $object, '_object_tasks_open' => $open_tasks, '_object_tasks_can_reorder' => (int) $object->canEdit($smarty->get_template_vars('logged_user')), '_object_tasks_completed' => $completed_tasks, '_object_tasks_completed_remaining' => $object->countCompletedTasks() - COMPLETED_TASKS_PER_OBJECT, '_object_tasks_skip_wrapper' => array_var($params, 'skip_wrapper', false), '_object_tasks_skip_head' => array_var($params, 'skip_head', false), '_object_tasks_force_show' => array_var($params, 'force_show', true)));
    return $smarty->fetch(get_template_path('_object_tasks', 'tasks', RESOURCES_MODULE));
}
Пример #17
0
 function save($send_confirmation_email = false)
 {
     $db = DB::connect(DB_CONNECTION_STRING);
     //Check if it exists, the do an update or insert
     $exists = false;
     if ($this->user_id != 0) {
         $sql = "select user_id from user where user_id = " . $this->user_id;
         $results = $db->query($sql);
         if (sizeof($results) != 0) {
             $exists = true;
         }
     }
     if (!$exists) {
         $this->add();
     } else {
         $this->update();
     }
     //Send email
     if ($send_confirmation_email == true) {
         $smarty = new Smarty();
         $smarty->force_compile = true;
         $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
         $smarty->assign("email", $this->email);
         $smarty->assign("postcode", clean_postcode($this->postcode));
         $smarty->assign("url", BASE_URL . "/confirmed.php?cid=" . $this->confirm_id);
         //Get the email text
         $email_text = $smarty->fetch('confirm_email_text.tpl');
         //Send the email
         send_text_email($this->email, EMAIL_FROM_NAME, EMAIL_FROM_ADDRESS, "Please confirm your planning alert", $email_text);
     }
 }
Пример #18
0
 function renderEntries(Search_ResultSet $entries)
 {
     global $tikipath;
     $smarty = new Smarty();
     $smarty->setCompileDir($tikipath . 'templates_c');
     $smarty->setTemplateDir(null);
     $smarty->setTemplateDir(dirname($this->templateFile));
     $smarty->setPluginsDir(array($tikipath . TIKI_SMARTY_DIR, SMARTY_DIR . 'plugins'));
     $secpol = new Tiki_Security_Policy($smarty);
     $secpol->secure_dir[] = dirname($this->templateFile);
     $smarty->enableSecurity($secpol);
     if ($this->changeDelimiters) {
         $smarty->left_delimiter = '{{';
         $smarty->right_delimiter = '}}';
     }
     foreach ($this->data as $key => $value) {
         $smarty->assign($key, $value);
     }
     $smarty->assign('results', $entries);
     $smarty->assign('facets', array_map(function ($facet) {
         return array('name' => $facet->getName(), 'label' => $facet->getLabel(), 'options' => $facet->getOptions());
     }, $entries->getFacets()));
     $smarty->assign('count', count($entries));
     $smarty->assign('offset', $entries->getOffset());
     $smarty->assign('offsetplusone', $entries->getOffset() + 1);
     $smarty->assign('offsetplusmaxRecords', $entries->getOffset() + $entries->getMaxRecords());
     $smarty->assign('maxRecords', $entries->getMaxRecords());
     return $smarty->fetch($this->templateFile);
 }
Пример #19
0
 /**
  * sfSmarty::renderFile()
  * render template file using Smarty
  *
  * @param sfSmartyView $view
  * @param mixed $file
  * @return 
  * @access protected
  **/
 public function renderFile($view, $file)
 {
     $sf_context = sfContext::getInstance();
     $sf_request = $sf_context->getRequest();
     $sf_params = $sf_request->getParameterHolder();
     $sf_user = $sf_context->getUser();
     if ($view->getAttribute('sf_type') == 'layout') {
         self::$smarty->compile_id = $view->getDecoratorTemplate();
     } else {
         self::$smarty->compile_id = $view->getModuleName();
     }
     $this->loadCoreAndStandardHelpers();
     $_escaping = $view->getAttributeHolder()->getEscaping();
     if ($_escaping === true || $_escaping == 'on') {
         $sf_data = $this->getSfData($view, $view->getAttributeHolder()->getEscapingMethod());
     } elseif ($_escaping === false || $_escaping == 'off') {
         $sf_data = $this->getSfData($view);
         $data =& $view->getAttributeHolder()->getAll();
         foreach ($data as $key => &$value) {
             self::$smarty->assign_by_ref($key, $value);
         }
     }
     // we need to add the data to smarty
     self::$smarty->assign_by_ref('sf_data', $sf_data);
     // we need to add the context to smarty
     self::$smarty->assign_by_ref('sf_context', $sf_context);
     // we need to add the request to smarty
     self::$smarty->assign_by_ref('sf_request', $sf_request);
     // we need to add the params to smarty
     self::$smarty->assign_by_ref('sf_params', $sf_params);
     // we need to add the user to smarty
     self::$smarty->assign_by_ref('sf_user', $sf_user);
     return self::$smarty->fetch("file:{$file}");
 }
Пример #20
0
 /**
  * Returns the contents of the parsed template
  *
  * @param bool $process Whether to call process template to fill template variables. Default true
  * @return string The contents of the parsed template
  */
 public function getTemplateContents($process = true)
 {
     if ($process) {
         $this->processTemplate();
     }
     return $this->smarty->fetch($this->tpl_name);
 }
Пример #21
0
 public function generate(\Smarty $smarty, $tplName)
 {
     $this->writeLine("Generating file for {$tplName}");
     $smarty->assign('open_php', '<?php');
     if ($this->generateTop) {
         $this->buffer .= $smarty->fetch(ZULG_TOP);
         // Not sure if zulg_center is required here, I don't see
         // any custom logic going between top and center. However,
         // I'll leave it like this in case we do want to have a
         // model top, etc.
         $this->buffer .= $smarty->fetch(ZULG_CENTER);
     }
     $this->buffer .= $smarty->fetch(ZULG_PATH . $tplName . '.tpl');
     $this->writeLine("Generated template for {$tplName}");
     $this->saveToDisk();
 }
Пример #22
0
 function fetch($template = false, $master = 'index.tpl')
 {
     $xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
     if ($xhr) {
         $master = 'ajax.tpl';
     }
     if ($template) {
         $this->smarty->assign('template', $template);
         $css_js = str_replace('PageController', '', get_class($this));
         $css_js[0] = strtolower($css_js[0]);
         $this->smarty->assign('css_js_name', $css_js);
     } else {
         $this->smarty->assign('template', get_class($this) . '/index.tpl');
     }
     return $this->smarty->fetch($master);
 }
Пример #23
0
 public function render(\Ape\Responses\View $response)
 {
     $smarty = new \Smarty();
     // NOTE: it may be a good idea to initialize smarty once and for next fetches just clean it up and reuse
     $smarty->assign($response->data()->all());
     return $smarty->fetch($response->getTemplate());
 }
Пример #24
0
 /**
  * fetch a template, echos the result,
  *
  * @see Zend_View_Abstract::render()
  * @param string $name the template
  * @return void
  */
 protected function _run()
 {
     $this->strictVars(true);
     //assign variables to the template engine
     $vars = get_object_vars($this);
     foreach ($vars as $key => $value) {
         if ('_' != substr($key, 0, 1)) {
             $this->_smarty->assign($key, $value);
         }
     }
     //why 'this'?
     //to emulate standard zend view functionality
     //doesn't mess up smarty in any way
     $this->_smarty->assign_by_ref('this', $this);
     //smarty needs a template_dir, and can only use templates,
     //found in that directory, so we have to strip it from the
     // filename
     //This checks the default application/smarty/template directory
     // as well as the module views/scripts directory to find the
     // template
     $paths = $this->getScriptPaths();
     $arg = func_get_arg(0);
     foreach ($paths as $path) {
         if (0 === strpos($arg, $path)) {
             if ($file = substr($arg, strlen($path))) {
                 $this->_smarty->template_dir = $path;
                 break;
             }
         }
     }
     //process the template (and filter the output)
     echo $this->_smarty->fetch($file);
 }
/**
 * Render pagination block
 * 
 * Parameters:
 * 
 * - page - current_page
 * - total_pages - total pages
 * - route - route for URL assembly
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_mobile_access_paginator($params, &$smarty)
{
    $url_params = '';
    if (is_foreachable($params)) {
        foreach ($params as $k => $v) {
            if (strpos($k, 'url_param_') !== false && $v) {
                $url_params .= '&amp;' . substr($k, 10) . '=' . $v;
            }
            // if
        }
        // foreach
    }
    // if
    $paginator = array_var($params, 'paginator', new Pager());
    $paginator_url = array_var($params, 'url', ROOT_URL);
    $paginator_anchor = array_var($params, 'anchor', '');
    $smarty->assign(array("_mobile_access_paginator_url" => $paginator_url, "_mobile_access_paginator" => $paginator, '_mobile_access_paginator_anchor' => $paginator_anchor, "_mobile_access_paginator_url_params" => $url_params));
    $paginator_url = strpos($paginator_url, '?') === false ? $paginator_url . '?' : $paginator_url . '&';
    if (!$paginator->isFirst()) {
        $smarty->assign('_mobile_access_paginator_prev_url', $paginator_url . 'page=' . ($paginator->getCurrentPage() - 1) . $url_params . $paginator_anchor);
    }
    // if
    if (!$paginator->isLast()) {
        $smarty->assign('_mobile_access_paginator_next_url', $paginator_url . 'page=' . ($paginator->getCurrentPage() + 1) . $url_params . $paginator_anchor);
    }
    // if
    return $smarty->fetch(get_template_path('_paginator', null, MOBILE_ACCESS_MODULE));
}
Пример #26
0
/** filegal_uploader: Adds a widget to the page to upload files
 *
 * @param array $params
 *     'galleryId' => int	file gallery to upload into by default
 *
 * @param Smarty $smarty
 * @return string html
 */
function smarty_function_filegal_uploader($params, $smarty)
{
    $headerlib = TikiLib::lib('header');
    //	Image loader and canvas libs
    $headerlib->add_jsfile('vendor/blueimp/javascript-load-image/js/load-image.all.min.js');
    $headerlib->add_jsfile('vendor/blueimp/javascript-canvas-to-blob/js/canvas-to-blob.min.js');
    //	The Iframe Transport is required for browsers without support for XHR file uploads
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.iframe-transport.js');
    //	The basic File Upload plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js');
    //	The File Upload processing plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js');
    //	The File Upload image preview & resize plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js');
    //	The File Upload audio preview plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-audio.js');
    //	The File Upload video preview plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-video.js');
    //	The File Upload validation plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js');
    //	The File Upload user interface plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js');
    // CSS
    $headerlib->add_cssfile('vendor/blueimp/jquery-file-upload/css/jquery.fileupload.css');
    $headerlib->add_cssfile('vendor/blueimp/jquery-file-upload/css/jquery.fileupload-ui.css');
    //	Tiki customised application script
    $headerlib->add_jsfile('lib/jquery_tiki/tiki-jquery_upload.js');
    $return = $smarty->fetch('file/jquery_upload.tpl');
    return $return;
}
Пример #27
0
function compile_CFG($prop)
{
    $smarty = new Smarty();
    $smarty->assign($prop);
    $string = $smarty->fetch(dirname(__FILE__) . '/compile.tpl');
    return $string;
}
Пример #28
0
 /**
  * Execute output html using a layout template
  *
  * @return string
  */
 protected function renderTemplateWithLayout()
 {
     foreach ($this->_vars as $key => $val) {
         $this->_smarty->assign($key, $val);
     }
     $ext = NameManager::getTemplateExtension();
     $templateDir = PathManager::getViewTemplateDirectory();
     $template = $this->_template . '.' . $ext;
     $templatePath = $templateDir . '/' . $template;
     if (!file_exists($templatePath)) {
         throw new FileNotExistException($templatePath);
     }
     $layoutDir = PathManager::getViewLayoutDirectory();
     $layout = $this->_layout . '.' . $ext;
     $layoutPath = $layoutDir . '/' . $layout;
     if (!file_exists($layoutPath)) {
         throw new FileNotExistException($layoutPath);
     }
     $this->_smarty->template_dir = $templateDir;
     $contents = $this->_smarty->fetch($template);
     $this->_smarty->assign('inner_contents', $contents);
     $this->_smarty->template_dir = $layoutDir;
     $rendered = $this->_smarty->fetch($layout);
     return $rendered;
 }
Пример #29
0
 function request($class, $proc, $param = array(), $lRet = false)
 {
     $globals = $GLOBALS['globals'];
     $objData = Controller::Call($class, $proc, $globals, $param);
     if (isset($objData->view_file)) {
         $file = $objData->view_file . '.tpl';
     } else {
         $file = $class . '/' . $proc . '.tpl';
     }
     if (is_string($objData)) {
         if ($lRet) {
             return $objData;
         }
         echo $objData;
     } else {
         //if( file_exists( $globals->environment->dir_view . $file ) ){
         $smarty = new Smarty();
         $smarty->setTemplateDir($globals->environment->dir_view);
         $smarty->assign('class', $class);
         $smarty->assign('proc', $proc);
         $smarty->assign('param', $param);
         $smarty->assign('objData', $objData);
         $smarty->assign('tools', $globals->tools);
         $smarty->assign('environment', $globals->environment);
         if ($lRet) {
             return $smarty->fetch($file);
         }
         $smarty->display($file);
     }
 }
Пример #30
0
 /**
  * Processes a template and returns the output.
  *
  * @param string $name The template to process.
  * @return string The output.
  */
 public function render($name, $vars = null)
 {
     if ($name instanceof ViewModel) {
         $model = $name;
         $name = $model->getTemplate();
         if (empty($name)) {
             throw new Exception\DomainException(sprintf('%s: received View Model argument, but template is empty', __METHOD__));
         }
         // Give view model awareness via ViewModel helper
         $helper = $this->plugin('view_model');
         $helper->setCurrent($model);
         foreach ($model->getVariables() as $key => $value) {
             $this->assign($key, $value);
         }
         unset($model);
         $this->file = $this->resolver($name);
         $content = $this->_smarty->fetch($this->file);
         return $this->getFilterChain()->filter($this->_smarty->fetch($this->file));
     } else {
         if (null !== $vars) {
             foreach ($vars as $k => $v) {
                 $this->assign($k, $v);
             }
         }
         //$this->file = $this->resolver($name);
         $this->file = $name;
         $this->this = $this;
         return $this->getFilterChain()->filter($this->_smarty->fetch($this->file));
     }
 }