Projects_Page.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. require_once($path["entity"] . "Project.php");
  4. require_once($path["helper"] . "text.php");
  5. /**
  6. * Projects list page model.
  7. */
  8. class Projects_Page extends Page{
  9. /**
  10. * Array with the {@see Project}.
  11. */
  12. public $project = [];
  13. /**
  14. * Constructor.
  15. *
  16. * Retrieves the data and initializes the variables.
  17. *
  18. * @param MySQL_connection $db Connection to the database.
  19. * @param string $lang Lowercase, two-letter language code.
  20. * @param string $id Project id or permalink.
  21. */
  22. public function __construct($db, $lang){
  23. global $path;
  24. global $base_url;
  25. parent:: __construct($db, $lang);
  26. $this->view = $path["view"] . "projects.php";
  27. $s =
  28. "SELECT id " .
  29. "FROM project " .
  30. "WHERE visible = 1 " .
  31. "ORDER BY idx;";
  32. $q = mysqli_query($this->db, $s);
  33. while($r = mysqli_fetch_array($q)){
  34. array_push($this->project, new Project($this->db, $this->lang, $r["id"]));
  35. }
  36. $this->title = text($this, "PROJECT_TITLE") . " - " . text($this, "USER_NAME");
  37. $this->description = text($this, "PROJECT_DESCRIPTION");
  38. $this->canonical = $base_url . "/project/";
  39. }
  40. }
  41. ?>