Activity_Page.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. require_once($path["entity"] . "Activity.php");
  4. /**
  5. * Activity page model.
  6. */
  7. class Activity_Page extends Page{
  8. /**
  9. * The selected {@see Activity}.
  10. */
  11. public $activity;
  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. * @param id Activity id or permalink.
  20. */
  21. public function __construct($db, $lang, $id){
  22. global $path;
  23. global $base_url;
  24. global $static;
  25. global $data;
  26. parent:: __construct($db, $lang);
  27. $this->activity = new Activity($this->db, $this->lang, $id);
  28. if ($this->activity->is_past()){
  29. $this->template = $path["template"] . "activity_past.php";
  30. }
  31. else{
  32. $this->template = $path["template"] . "activity_future.php";
  33. }
  34. $this->title = $this->activity->title . " - " . $data["name"];
  35. $this->description = $this->activity->title . " - " . $data["name"];
  36. if (sizeof($this->activity->image) > 0){
  37. $this->icon = $static["content"] . "activity/" . $this->activity->image[0]->image;
  38. }
  39. else{
  40. $this->icon = $static["layout"] . "logo/logo.svg";
  41. }
  42. $this->canonical = $base_url . "/actividades/" . $this->activity->permalink . "/";
  43. }
  44. }
  45. ?>