oddluck f7590e79da Add 'TriviaTime/' from commit 'ae216897cd9c45259853c3f84eae826f344482aa'
git-subtree-dir: TriviaTime
git-subtree-mainline: 3551587ecdefc75e34b8b2a87d91a466bdf4c764
git-subtree-split: ae216897cd9c45259853c3f84eae826f344482aa
2019-02-14 13:32:21 -05:00

53 lines
1.3 KiB
PHP

<?php
class Renderer
{
protected $title = '';
protected $currentPage = '';
protected $config;
protected $container;
public function __construct($config, $container) {
$this->config = $config;
$this->container = $container;
}
public function render($page, $values, $useTemplate=true) {
$viewVars = array();
$viewVars['title'] = $this->title;
if($this->title != '') {
$viewVars['title'] .= ' &middot; ';
}
$viewVars['currentPage'] = $this->currentPage;
$container = $this->container;
if($useTemplate) {
include($this->config['viewLocation'] . 'header.html.php');
include($this->config['viewLocation'] . $page);
include($this->config['viewLocation'] . 'footer.html.php');
} else {
include($this->config['viewLocation'] . $page);
}
}
public function setTitle($title) {
$this->title = $title;
}
public function setCurrentPage($currentPage) {
$this->currentPage = $currentPage;
}
public function getContainer() {
return $this->container;
}
public function getTitle() {
return $this->title;
}
public function getCurrentPage() {
return $this->currentPage;
}
}