Profile_Page.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. require_once($path["entity"] . "Cv.php");
  4. require_once($path["helper"] . "text.php");
  5. /**
  6. * Profile page model.
  7. */
  8. class Profile_Page extends Page{
  9. public $category = [
  10. "WORK" => 0,
  11. "EDUCATION" => 1,
  12. "PROJECTS" => 2,
  13. "OTHERS" => 3
  14. ];
  15. public $entry = [
  16. "WORK" => [],
  17. "EDUCATION" => [],
  18. "PROJECTS" => [],
  19. "OTHERS" => []
  20. ];
  21. /**
  22. * Constructor.
  23. *
  24. * Retrieves the data and initializes the variables.
  25. *
  26. * @param MySQL_connection $db Connection to the database.
  27. * @param string $lang Lowercase, two-letter language code.
  28. */
  29. public function __construct($db, $lang){
  30. global $path;
  31. global $root;
  32. parent::__construct($db, $lang);
  33. $this->view = $path["view"] . "profile.php";
  34. foreach ($this->category as $cat){
  35. $s =
  36. "SELECT id " .
  37. "FROM cv " .
  38. "WHERE " .
  39. " visible = 1 AND " .
  40. " category = " . ($cat + 1) . " " .
  41. "ORDER BY " .
  42. " IF(end IS NULL, 9, end) DESC, " .
  43. " start DESC; ";
  44. $q = mysqli_query($this->db, $s);
  45. while($r = mysqli_fetch_array($q)){
  46. $k = array_keys($this->category)[$cat];
  47. $e = new Cv($this->db, $this->lang, $r["id"]);
  48. array_push($this->entry[$k], $e);
  49. }
  50. }
  51. $this->title = text($this, "USER_NAME");
  52. $this->name = text($this, "USER_NAME");
  53. $this->description = text($this, "USER_NAME") . " - " . text($this, "USER_TAGLINE");
  54. $this->favicon = $path["img"]["layout"] . "logo/logo.svg";
  55. $this->icon = $path["img"]["layout"] . "logo/logo.svg";
  56. $this->canonical = $root . $lang . "/profile/";
  57. $this->author = $root . $lang . "/";
  58. }
  59. }
  60. ?>