admin_faq_model.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. class admin_faq_model extends Model {
  3. public function getBoxes() {
  4. $result = $this->query("select * from azonics_faq 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_faq 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_faq set "
  16. . "box_title='".$data['box_title']."', "
  17. . "box_subtitle='".$data['box_subtitle']."' "
  18. . "where box_id='".$data['box_id']."';");
  19. return true;
  20. }
  21. else {
  22. $this->execute("insert into azonics_faq set "
  23. . "box_title='".$data['box_title']."', "
  24. . "box_subtitle='".$data['box_subtitle']."', "
  25. . "box_status='1', "
  26. . "box_user='".$_SESSION['admin_user']->admin_id."';");
  27. return true;
  28. }
  29. }
  30. public function deleteBox() {
  31. $box_id = $this->escapeString($_REQUEST['id']);
  32. $this->execute("update azonics_faq set box_status='0' where box_id='".$box_id."';");
  33. return true;
  34. }
  35. }