Unit_Page.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Unit view page file.
  4. *
  5. * Provides a class with all the properties and methods to display the page.
  6. *
  7. * @author Iñigo Valentin <i@inigovalentin.com>
  8. * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
  9. * @package SWDB
  10. */
  11. require_once(PATH::PAGE . "Page.php");
  12. require_once(PATH::ENTITY . "Unit.php");
  13. /**
  14. * Unit view page model.
  15. *
  16. * @category Page
  17. */
  18. class Unit_Page extends Page{
  19. /**
  20. * @var Unit Selected Unit.
  21. */
  22. private $unit;
  23. /**
  24. * Constructor.
  25. *
  26. * Retrieves the data and initializes the variables.
  27. *
  28. * @param string $id Selected unit id
  29. */
  30. public function __construct($id){
  31. $this->view = PATH::VIEW . "unit.php";
  32. $this->unit = new Unit($id, true);
  33. $this->title = $this->unit->get_title() ." - SWDB";
  34. $this->description = "Owned " . $this->unit->get_title();
  35. $this->canonical = URL::BASE . "monster/" . $id;
  36. }
  37. /**
  38. * Retrieves the selected unit.
  39. *
  40. * @return Unit Selected unit.
  41. */
  42. public function get_unit(){
  43. return $this->unit;
  44. }
  45. }