admin_menueditor_model.php 1.5 KB

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