Miscellaneous additions (previously untracked)

This commit is contained in:
Miguel Nogueira
2019-01-25 14:17:48 +00:00
parent 437d81838a
commit a8f089e3b2
7 changed files with 52 additions and 4 deletions

View File

@@ -0,0 +1,45 @@
<?php
class EmailRenderer
{
private $templateDir;
public $twig;
public $tmeplateList = [
"accountBillingInformation",
"accountCancellationNotice",
"accountInformationUpdated",
"accountInstallation",
"accountRefunded",
"accounSubscriptionPaymentFailed"
];
public function __construct()
{
$config = new Config();
$cConfigArray = $config->getConfig();
$loader = new Twig_Loader_Filesystem($cConfigArray['templates']['templatesDirectory']);
$this->twig = new Twig_Environment($loader);
}
public function renderTemplate($Tmpl, Array $Data)
{
// $Data is an associative array of data
if(!in_array($this->templateList, $Tmpl))
{
throw new Exception("WARNING: Selected template not available");
}
else
{
return $this->twig->render($Tmpl, $Data);
}
}
}