diff options
Diffstat (limited to 'src/views/Template.class.php')
-rw-r--r-- | src/views/Template.class.php | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/views/Template.class.php b/src/views/Template.class.php index bf57e93..9d55b75 100644 --- a/src/views/Template.class.php +++ b/src/views/Template.class.php @@ -1,24 +1,19 @@ <?php +require_once('Singleton.class.php'); +require_once('Site.class.php'); -require_once('Login.class.php'); +require_once('Login.class.php');// used to see if logged in +require_once('Auth.class.php');// used to get username if we are -class Template { +class Template extends Singleton { private $indent = 0; private $ret = false; - private $base = '/'; - private $db = null; - + public function status($status) { header($_SERVER["SERVER_PROTOCOL"]." $status"); header("Status: $status"); } - public function __construct($base_url, $mm=null) { - $this->base = $base_url; - if ($mm!==null) - $this->db = $mm->database(); - } - public function setRet($ret) { $this->ret = $ret; } @@ -92,7 +87,7 @@ class Template { echo $str; } public function url($page) { - return $this->base.$page; + return Site::getInstance()->baseUrl().$page; } public function row($cells) { @@ -112,12 +107,8 @@ class Template { echo $str; } public function header($title) { - $db = $this->db; - if ($db==null) { - $username = false; - } else { - $username = $db->getUsername(Login::isLoggedIn()); - } + // username=false if not logged in or not connected to DB + $username = Auth::getInstance(Login::isLoggedIn())->getName(); $ret = $this->ret; $this->ret = true; |