Custom_Filter.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. require_once($path["entity"] . "Entity.php");
  3. /**
  4. * A custom_Filter.
  5. *
  6. * Represents an object from the table 'filter'.
  7. */
  8. class Custom_Filter extends Entity{
  9. /**
  10. * Player identifier.
  11. */
  12. public $uid;
  13. /**
  14. * Filter identifier.
  15. */
  16. public $id;
  17. /**
  18. * Name of the pge the filter is for.
  19. */
  20. public $page;
  21. /**
  22. * Filter name.
  23. */
  24. public $name;
  25. /**
  26. * Filter description.
  27. */
  28. public $description;
  29. /**
  30. * Filter condition.
  31. */
  32. public $condition;
  33. /**
  34. * Constructor.
  35. *
  36. * Searches the database and retrieves the information about the
  37. * run, populating it and it's items.
  38. *
  39. * @param SQLite3 $db Connection to the database.
  40. * @param int $id Filter identifier.
  41. */
  42. public function __construct($db, $id){
  43. parent::__construct($db);
  44. $s = "
  45. SELECT
  46. uid,
  47. id,
  48. page,
  49. name,
  50. description,
  51. condition
  52. FROM filter
  53. WHERE id = $id;
  54. ";
  55. $q = $this->db->query($s);
  56. $r = $q->fetchArray(SQLITE3_ASSOC);
  57. $this->id = $r["id"];
  58. $this->uid = $r["uid"];
  59. $this->page = $r["page"];
  60. $this->name = $r["name"];
  61. $this->description = $r["description"];
  62. $this->condition = $r["condition"];
  63. }
  64. }
  65. ?>