✨ Add a message system
This commit is contained in:
parent
24b7226086
commit
7a759bdee6
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 $numqueries;
|
||||
global $starttime;
|
||||
global $messages;
|
||||
|
||||
$this->prepare("STYLE_FOLDER", '/theme/default/');
|
||||
$this->prepare("dkgamename", $controlrow["gamename"]);
|
||||
|
@ -45,6 +46,7 @@ class Renderer {
|
|||
$this->prepare("numqueries", $numqueries);
|
||||
$this->prepare("version", DRAGONFORK_VERSION);
|
||||
$this->prepare("build", DRAGONFORK_BUILD);
|
||||
$this->prepare("messages", $messages->messageList());
|
||||
|
||||
echo $this->twig->render($template, $this->data);
|
||||
die();
|
||||
|
|
Loading…
Add table
Reference in a new issue