mc-cms-namelessmc/core/classes/DTO/Announcement.php
Sam 0e77706b29
Merge commit from fork
Co-authored-by: Sam <samerton@users.noreply.github.com>
2025-07-27 10:00:13 +01:00

38 lines
1 KiB
PHP

<?php
class Announcement
{
public int $id;
public string $pages;
public string $groups;
public string $text_colour;
public string $background_colour;
public string $icon;
public bool $closable;
public string $header;
public string $message;
public int $order;
public function __construct(object $row)
{
$this->id = $row->id;
$this->pages = $row->pages;
$this->groups = $row->groups;
$this->text_colour = $row->text_colour;
$this->background_colour = $row->background_colour;
$this->icon = $row->icon;
$this->closable = $row->closable;
$this->header = Output::getClean($row->header);
$this->message = Output::getPurified($row->message, false, false);
$this->order = $row->order;
}
public static function find(int $id): ?Announcement
{
$row = DB::getInstance()->query('SELECT * FROM nl2_announcements WHERE id = ?', [$id])->results();
return $row
? new Announcement($row[0])
: null;
}
}