Port entirely to a MVC-like pattern #37

Open
kazhnuz wants to merge 29 commits from refactor/use-bludit-boot-code into main
2 changed files with 36 additions and 0 deletions
Showing only changes of commit 7a759bdee6 - Show all commits

34
kernel/messages.php Normal file
View 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;
}
}

View file

@ -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();