Decoration.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. require_once($path["entity"] . "Entity.php");
  3. require_once($path["entity"] . "K_Decoration.php");
  4. /**
  5. * A Decoration.
  6. *
  7. * Represents an object from the table 'decoration'.
  8. */
  9. class Decoration extends Entity{
  10. /**
  11. * Owner identifier.
  12. */
  13. public $uid;
  14. /**
  15. * {@see K_Decoration}.
  16. */
  17. public $decoration;
  18. /**
  19. * I honestly don't know what the gin is.
  20. */
  21. public $level;
  22. /**
  23. * Constructor.
  24. *
  25. * Searches the database and retrieves the information about the
  26. * decoration, populating it and it's items.
  27. *
  28. * @param SQLite3 $db Connection to the database.
  29. * @param int $id Building identifier.
  30. */
  31. public function __construct($db, $id){
  32. global $path;
  33. parent::__construct($db);
  34. $s = "
  35. SELECT
  36. uid,
  37. decoration,
  38. level
  39. FROM decoration
  40. WHERE decoration = $id;
  41. ";
  42. $q = $this->db->query($s);
  43. $r = $q->fetchArray(SQLITE3_ASSOC);
  44. $this->uid = $r["uid"];
  45. $this->decoration = new K_Decoration($this->db, $r["decoration"]);
  46. $this->level = $r["level"];
  47. }
  48. }
  49. ?>