2015-04-22 12:23:57 +02:00
|
|
|
<?php namespace Todaymade\Daux\Server;
|
|
|
|
|
2015-05-18 14:26:29 +02:00
|
|
|
use Todaymade\Daux\Format\HTML\SimplePage;
|
|
|
|
use Todaymade\Daux\Format\HTML\Template;
|
2015-04-21 17:11:43 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2019-12-05 21:25:58 +01:00
|
|
|
private $config;
|
2015-04-21 17:11:43 +02:00
|
|
|
|
2015-07-17 23:38:06 +02:00
|
|
|
/**
|
|
|
|
* @param string $title
|
|
|
|
* @param string $content
|
2019-12-05 21:25:58 +01:00
|
|
|
* @param \Todaymade\Daux\Config $config
|
2015-07-17 23:38:06 +02:00
|
|
|
*/
|
2019-12-05 21:25:58 +01:00
|
|
|
public function __construct($title, $content, $config)
|
2015-04-23 00:32:30 +02:00
|
|
|
{
|
2015-04-21 17:11:43 +02:00
|
|
|
parent::__construct($title, $content);
|
2019-12-05 21:25:58 +01:00
|
|
|
$this->config = $config;
|
2015-04-21 17:11:43 +02:00
|
|
|
}
|
|
|
|
|
2015-07-17 23:38:06 +02:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2015-05-18 14:26:29 +02:00
|
|
|
protected function generatePage()
|
2015-04-23 00:32:30 +02:00
|
|
|
{
|
2019-12-05 21:25:58 +01:00
|
|
|
$config = $this->config;
|
2015-07-17 23:38:06 +02:00
|
|
|
$page = [
|
|
|
|
'title' => $this->title,
|
2016-03-13 21:51:15 +01:00
|
|
|
'content' => $this->getPureContent(),
|
2015-07-19 14:04:29 +02:00
|
|
|
'language' => '',
|
2015-07-17 23:38:06 +02:00
|
|
|
];
|
2015-04-21 17:11:43 +02:00
|
|
|
|
2019-12-05 21:25:58 +01:00
|
|
|
$template = new Template($config);
|
2016-07-27 21:32:51 +02:00
|
|
|
|
2019-12-05 21:25:58 +01:00
|
|
|
return $template->render('error', ['page' => $page, 'config' => $config]);
|
2015-04-21 17:11:43 +02:00
|
|
|
}
|
|
|
|
}
|