| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- require_once($path["page"] . "Page.php");
- /**
- * Catalog page model.
- */
- class Catalog_Page extends Page{
- /**
- * List of all the monsters in the database.
- */
- public $entry = [];
- /**
- * Constructor.
- *
- * Retrieves the data and initializes the variables.
- *
- * @param SQLite3 $db Connection to the database.
- */
- public function __construct($db){
- global $path;
- global $root;
- parent::__construct($db);
- $this->view = $path["view"] . "catalog.php";
- $s =
- "SELECT id, " .
- " element, " .
- " name, " .
- " img, " .
- " img_aw, " .
- " stars, " .
- " awakeable, " .
- " ( " .
- " SELECT count(id) > 0 " .
- " FROM monster_collection " .
- " WHERE monster = monster.id " .
- " ) AS owned " .
- "FROM monster " .
- "ORDER BY " .
- " element, " .
- " stars, " .
- " awakeable ";
- $q = $this->db->query($s);
- error_log($s);
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
- $mon = [
- "id" => $r["id"],
- "element" => $r["element"],
- "name" => $r["name"],
- "image" => $path["img"]["monster"] . $r["img"],
- "image_aw" => $path["img"]["monster"] . $r["img_aw"],
- "stars" => $r["stars"],
- "awakeable" => $r["awakeable"],
- "owned" => $r["owned"],
- ];
- array_push($this->entry, $mon);
- }
- $this->title = "Catalog - SWDB";
- $this->name = "SWDB";
- $this->description = "Catalog of all monsters";
- $this->favicon = "";
- $this->icon = "";
- $this->canonical = $root . "/catalog/";
- $this->author = $root;
- }
- }
- ?>
|