Profile_Page.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. /**
  10. * List of available {@see CV}.
  11. */
  12. public $cv = [];
  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. */
  21. public function __construct($db, $lang){
  22. global $path;
  23. global $base_url;
  24. parent::__construct($db, $lang);
  25. $this->view = $path["view"] . "profile.php";
  26. $s =
  27. "SELECT id " .
  28. "FROM cv " .
  29. "WHERE visible = 1 " .
  30. "ORDER BY lang = '" . $this->lang . "' DESC;";
  31. $q = mysqli_query($this->db, $s);
  32. while($r = mysqli_fetch_array($q)){
  33. array_push($this->cv, new Cv($this->db, $r["id"]));
  34. }
  35. $this->title = text($this, "USER_NAME");
  36. $this->description = text($this, "SECTION_ME") . " - " . text($this, "USER_NAME");
  37. $this->canonical = $base_url . "/profile/";
  38. }
  39. }
  40. ?>