codeModel.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. class codeModel extends Staple_Model
  3. {
  4. private $db;
  5. private $id;
  6. private $name;
  7. private $multiplier;
  8. private $description;
  9. /**
  10. * @return mixed
  11. */
  12. public function getId()
  13. {
  14. return $this->id;
  15. }
  16. /**
  17. * @param mixed $id
  18. */
  19. public function setId($id)
  20. {
  21. $this->id = $id;
  22. }
  23. /**
  24. * @return mixed
  25. */
  26. public function getName()
  27. {
  28. return $this->name;
  29. }
  30. /**
  31. * @param mixed $name
  32. */
  33. public function setName($name)
  34. {
  35. $this->name = $name;
  36. }
  37. /**
  38. * @return mixed
  39. */
  40. public function getMultiplier()
  41. {
  42. return $this->multiplier;
  43. }
  44. /**
  45. * @param mixed $multiplier
  46. */
  47. public function setMultiplier($multiplier)
  48. {
  49. $this->multiplier = $multiplier;
  50. }
  51. /**
  52. * @return mixed
  53. */
  54. public function getDescription()
  55. {
  56. return $this->description;
  57. }
  58. /**
  59. * @param mixed $description
  60. */
  61. public function setDescription($description)
  62. {
  63. $this->description = $description;
  64. }
  65. function __construct()
  66. {
  67. $this->db = Staple_DB::get();
  68. }
  69. function load($id = NULL)
  70. {
  71. $sql = "SELECT * FROM timeCodes WHERE id = '" . $this->db->real_escape_string($id) . "'";
  72. if ($this->db->query($sql)->fetch_row() > 0) {
  73. $query = $this->db->query($sql);
  74. $result = $query->fetch_assoc();
  75. $this->setId($result['id']);
  76. $this->setName($result['name']);
  77. $this->setMultiplier($result['multiplier']);
  78. $this->setDescription($result['description']);
  79. return true;
  80. }
  81. }
  82. }
  83. ?>