Collection_Page.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. require_once($path["entity"] . "Monster_Collection.php");
  4. /**
  5. * Collection page model.
  6. */
  7. class Collection_Page extends Page{
  8. /**
  9. * List of all the {@see Monster_base}.
  10. */
  11. public $base_monster = [];
  12. /**
  13. * Constructor.
  14. *
  15. * Retrieves the data and initializes the variables.
  16. *
  17. * @param SQLite3 $db Connection to the database.
  18. */
  19. public function __construct($db){
  20. global $path;
  21. global $root;
  22. parent::__construct($db);
  23. $this->view = $path["view"] . "collection.php";
  24. $s =
  25. "SELECT id " .
  26. "FROM monster_base " .
  27. "ORDER BY name; ";
  28. $q = $this->db->query($s);
  29. while ($r = $q->fetchArray(SQLITE3_ASSOC)){
  30. array_push($this->base_monster, new Monster_Base($this->db, $r["id"]));
  31. }
  32. $this->title = "";
  33. $this->name = "";
  34. $this->description = "";
  35. $this->favicon = "";
  36. $this->icon = "";
  37. $this->canonical = $root . "collection/";
  38. $this->author = $root;
  39. }
  40. }
  41. ?>