Files
ops-Gazelle/app/Stylesheet.php
2021-03-29 19:25:40 +00:00

33 lines
867 B
PHP

<?php
namespace Gazelle;
class Stylesheet extends Base {
protected $stylesheets;
public function __construct() {
parent::__construct();
if (($this->stylesheets = $this->cache->get_value('stylesheets')) === false) {
$this->db->prepared_query("
SELECT
ID,
lower(replace(Name, ' ', '_')) AS Name,
Name AS ProperName
FROM stylesheets
ORDER BY ID ASC
");
$this->stylesheets = $this->db->to_array('ID', MYSQLI_BOTH);
$this->cache->cache_value('stylesheets', $this->stylesheets, 86400 * 7);
}
}
public function list (): array {
return $this->stylesheets;
}
public function getName(int $id): string {
return $this->stylesheets[$id]['Name'];
}
}