Gallery_Page.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. require_once($path["entity"] . "Album.php");
  4. /**
  5. * Gallery page model.
  6. */
  7. class Gallery_Page extends Page{
  8. /**
  9. * List of {@see Album}.
  10. */
  11. public $album = [];
  12. /**
  13. * Constructor.
  14. *
  15. * Retrieves the data and initializes the variables.
  16. *
  17. * @param db Connection to the database.
  18. * @param lang Lowercase, two-letter language code.
  19. */
  20. public function __construct($db, $lang){
  21. global $path;
  22. global $base_url;
  23. global $data;
  24. parent::__construct($db, $lang);
  25. $this->template = $path["template"] . "gallery.php";
  26. $s =
  27. "SELECT id " .
  28. "FROM album " .
  29. "ORDER BY dtime DESC;";
  30. $q = mysqli_query($this->db, $s);
  31. while($r = mysqli_fetch_array($q)){
  32. array_push($this->album, new Album($this->db, $this->lang, $r["id"]));
  33. }
  34. $this->title = $this->string["section_gallery"] . " - " . $data["name"];
  35. $this->description = $this->string["section_gallery"] . " - " . $data["name"];
  36. $this->canonical = $base_url . "/galeria/";
  37. }
  38. }
  39. ?>