unlockModel.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. class unlockModel extends Staple_Model
  3. {
  4. private $db;
  5. private $username;
  6. private $id;
  7. private $startTime;
  8. private $endTime;
  9. private $userId;
  10. /**
  11. * @return mixed
  12. */
  13. public function getId()
  14. {
  15. return $this->id;
  16. }
  17. /**
  18. * @param mixed $id
  19. */
  20. public function setId($id)
  21. {
  22. $this->id = $id;
  23. }
  24. /**
  25. * @return mixed
  26. */
  27. public function getStartTime()
  28. {
  29. return $this->startTime;
  30. }
  31. /**
  32. * @param mixed $startTime
  33. */
  34. public function setStartTime($startTime)
  35. {
  36. $this->startTime = $startTime;
  37. }
  38. /**
  39. * @return mixed
  40. */
  41. public function getEndTime()
  42. {
  43. return $this->endTime;
  44. }
  45. /**
  46. * @param mixed $endTime
  47. */
  48. public function setEndTime($endTime)
  49. {
  50. $this->endTime = $endTime;
  51. }
  52. /**
  53. * @return mixed
  54. */
  55. public function getUserId()
  56. {
  57. return $this->userId;
  58. }
  59. /**
  60. * @param mixed $userId
  61. */
  62. public function setUserId($userId)
  63. {
  64. $this->userId = $userId;
  65. }
  66. function __construct()
  67. {
  68. $this->db = Staple_DB::get();
  69. $auth = Staple_Auth::get();
  70. $this->username = $auth->getAuthId();
  71. }
  72. function load($uid)
  73. {
  74. $sql = "SELECT * type FROM overrideDates WHERE username = '".$this->db->real_escape_string($uid)."'";
  75. if($this->db->query($sql)->fetch_row() > 0)
  76. {
  77. $query = $this->db->query($sql);
  78. $result = $query->fetch_assoc();
  79. $this->setId($result['id']);
  80. $this->setStartTime($result['startTime']);
  81. $this->setEndTime($result['startTime']);
  82. }
  83. }
  84. }
  85. ?>