Projects_Page.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 $root;
  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. $q = mysqli_query($this->db, $s);
  32. while($r = mysqli_fetch_array($q)){
  33. array_push($this->project, new Project($this->db, $this->lang, $r["id"]));
  34. }
  35. $this->title = text($this, "PROJECT_TITLE") . " - " . text($this, "USER_NAME");
  36. $this->name = text($this, "USER_NAME");
  37. $this->description = text($this, "PROJECT_DESCRIPTION");
  38. $this->favicon = $path["img"]["layout"] . "logo/logo.svg";
  39. $this->icon = $path["img"]["layout"] . "logo/logo.svg";
  40. $this->canonical = $root . $lang . "/project/";
  41. $this->author = $root . $lang . "/";
  42. }
  43. }
  44. ?>