Port entirely to a MVC-like pattern #37
2 changed files with 36 additions and 0 deletions
34
kernel/messages.php
Normal file
34
kernel/messages.php
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Messages {
|
||||||
|
private $messages = [];
|
||||||
|
|
||||||
|
public function restoreFromSession() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function put($type, $start) {
|
||||||
|
$this->messages[] = [
|
||||||
|
'type' => $type,
|
||||||
|
'content' => "<p>{$start}</p>"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function putList($type, $start, $list) {
|
||||||
|
$content = "<p>{$start}</p><ul>";
|
||||||
|
foreach ($list as $listElement) {
|
||||||
|
$content .= "<li>{$listElement}</li>";
|
||||||
|
}
|
||||||
|
$content .= "</ul>";
|
||||||
|
|
||||||
|
$this->messages[] = [
|
||||||
|
'type' => $type,
|
||||||
|
'content' => $content
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messageList() {
|
||||||
|
return $this->messages;
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,6 +38,7 @@ class Renderer {
|
||||||
global $controlrow;
|
global $controlrow;
|
||||||
global $numqueries;
|
global $numqueries;
|
||||||
global $starttime;
|
global $starttime;
|
||||||
|
global $messages;
|
||||||
|
|
||||||
$this->prepare("STYLE_FOLDER", '/theme/default/');
|
$this->prepare("STYLE_FOLDER", '/theme/default/');
|
||||||
$this->prepare("dkgamename", $controlrow["gamename"]);
|
$this->prepare("dkgamename", $controlrow["gamename"]);
|
||||||
|
@ -45,6 +46,7 @@ class Renderer {
|
||||||
$this->prepare("numqueries", $numqueries);
|
$this->prepare("numqueries", $numqueries);
|
||||||
$this->prepare("version", DRAGONFORK_VERSION);
|
$this->prepare("version", DRAGONFORK_VERSION);
|
||||||
$this->prepare("build", DRAGONFORK_BUILD);
|
$this->prepare("build", DRAGONFORK_BUILD);
|
||||||
|
$this->prepare("messages", $messages->messageList());
|
||||||
|
|
||||||
echo $this->twig->render($template, $this->data);
|
echo $this->twig->render($template, $this->data);
|
||||||
die();
|
die();
|
||||||
|
|
Loading…
Add table
Reference in a new issue