admin_reviews_model.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. class admin_reviews_model extends Model {
  3. public function getBoxes() {
  4. $result = $this->query("select * from azonics_reviews where box_status<>'0';");
  5. return $result;
  6. }
  7. public function loadBox() {
  8. $box_id = $this->escapeString($_REQUEST['id']);
  9. $row = $this->query("select * from azonics_reviews where box_id='".$box_id."';");
  10. return $row[0];
  11. }
  12. public function saveBox() {
  13. $data = $this->escapeArray($_REQUEST);
  14. if ($data['box_id']!='') {
  15. $this->execute("update azonics_reviews set "
  16. . "box_title='".$data['box_title']."', "
  17. . "box_subtitle='".$data['box_subtitle']."', "
  18. . "box_subtitle_en='".$data['box_subtitle_en']."', "
  19. . "box_button_text='".$data['box_button_text']."', "
  20. . "box_url='".$data['box_url']."' "
  21. . "where box_id='".$data['box_id']."';");
  22. return true;
  23. }
  24. else {
  25. $this->execute("insert into azonics_reviews set "
  26. . "box_title='".$data['box_title']."', "
  27. . "box_subtitle='".$data['box_subtitle']."', "
  28. . "box_subtitle_en='".$data['box_subtitle_en']."', "
  29. . "box_button_text='".$data['box_button_text']."', "
  30. . "box_url='".$data['box_url']."', "
  31. . "box_status='1', "
  32. . "box_user='".$_SESSION['admin_user']->admin_id."';");
  33. return true;
  34. }
  35. }
  36. public function deleteBox() {
  37. $box_id = $this->escapeString($_REQUEST['id']);
  38. $this->execute("update azonics_reviews set box_status='0' where box_id='".$box_id."';");
  39. return true;
  40. }
  41. }