Highway to PSR2
[openemr.git] / portal / patient / fwk / libs / verysimple / Phreeze / SmartyRenderEngine.php
blob58339fa47466add22eee292a49e9059963de29e4
1 <?php
2 /** @package verysimple::Phreeze */
4 /**
5 * import supporting libraries
6 */
7 require_once("smarty/Smarty.class.php");
8 require_once("verysimple/Phreeze/IRenderEngine.php");
10 /**
11 * SmartyRenderEngine is an implementation of IRenderEngine that uses
12 * the Smarty template engine to render views
14 * @package verysimple::Phreeze
15 * @author VerySimple Inc.
16 * @copyright 1997-2011 VerySimple, Inc.
17 * @license http://www.gnu.org/licenses/lgpl.html LGPL
18 * @version 1.0
20 class SmartyRenderEngine implements IRenderEngine
23 /** @var Smarty */
24 public $smarty;
26 /**
28 * @param string $templatePath
29 * @param string $compilePath
31 function __construct($templatePath = '', $compilePath = '')
33 $this->smarty = new Smarty();
35 if ($templatePath) {
36 $this->smarty->template_dir = $templatePath;
39 if ($compilePath) {
40 $this->smarty->compile_dir = $compilePath;
41 $this->smarty->config_dir = $compilePath;
42 $this->smarty->cache_dir = $compilePath;
46 /**
48 * @see IRenderEngine::assign()
50 function assign($key, $value)
52 return $this->smarty->assign($key, $value);
55 /**
57 * @see IRenderEngine::display()
59 function display($template)
61 return $this->smarty->display($template);
64 /**
66 * @see IRenderEngine::fetch()
68 function fetch($template)
70 return $this->smarty->fetch($template);
73 /**
75 * @see IRenderEngine::clear()
77 function clear($key)
79 $this->smarty->clearAssign($key);
82 /**
84 * @see IRenderEngine::clearAll()
86 function clearAll()
88 $this->smarty->clearAllAssign();
91 /**
93 * @see IRenderEngine::getAll()
95 function getAll()
97 return $this->smarty->getTemplateVars();