daux.io/libs/Server/ErrorPage.php

43 lines
1.0 KiB
PHP
Raw Normal View History

2015-04-22 12:23:57 +02:00
<?php namespace Todaymade\Daux\Server;
use Todaymade\Daux\Format\HTML\SimplePage;
use Todaymade\Daux\Format\HTML\Template;
class ErrorPage extends SimplePage
{
const NORMAL_ERROR_TYPE = 'NORMAL_ERROR';
const MISSING_PAGE_ERROR_TYPE = 'MISSING_PAGE_ERROR';
const FATAL_ERROR_TYPE = 'FATAL_ERROR';
2015-07-17 23:38:06 +02:00
/**
* @var \Todaymade\Daux\Config
*/
private $params;
2015-07-17 23:38:06 +02:00
/**
* @param string $title
* @param string $content
* @param \Todaymade\Daux\Config $params
*/
2015-04-23 00:32:30 +02:00
public function __construct($title, $content, $params)
{
parent::__construct($title, $content);
$this->params = $params;
}
2015-07-17 23:38:06 +02:00
/**
* @return string
*/
protected function generatePage()
2015-04-23 00:32:30 +02:00
{
$params = $this->params;
2015-07-17 23:38:06 +02:00
$page = [
'title' => $this->title,
'content' => $this->content,
];
2015-04-23 10:24:50 +02:00
$template = new Template($params['templates'], $params['theme']['templates']);
return $template->render('error', ['page' => $page, 'params' => $params]);
}
}