EduCommentAction.class.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. class EduCommentAction extends CommonAction
  3. {
  4. public function course()
  5. {
  6. $map = array('type' => 1, 'reply_id' => intval($_REQUEST['reply_id']));
  7. $title = strim($_REQUEST['title']);
  8. if (!empty($title)) {
  9. $map['content'] = array('like', '%' . $title . '%');
  10. }
  11. $this->assign("default_map", $map);
  12. parent::index();
  13. }
  14. public function booking()
  15. {
  16. $map = array('type' => 3, 'reply_id' => intval($_REQUEST['reply_id']));
  17. $title = strim($_REQUEST['title']);
  18. if (!empty($title)) {
  19. $map['content'] = array('like', '%' . $title . '%');
  20. }
  21. $this->assign("default_map", $map);
  22. parent::index();
  23. }
  24. public function org()
  25. {
  26. $map = array('type' => 2, 'reply_id' => intval($_REQUEST['reply_id']));
  27. $title = strim($_REQUEST['title']);
  28. if (!empty($title)) {
  29. $map['content'] = array('like', '%' . $title . '%');
  30. }
  31. $this->assign("default_map", $map);
  32. parent::index();
  33. }
  34. public function delete()
  35. {
  36. //删除指定记录
  37. $ajax = intval($_REQUEST['ajax']);
  38. $id = $_REQUEST ['id'];
  39. if (isset ($id)) {
  40. $condition = array('id' => array('in', explode(',', $id)));
  41. $rel_data = M(MODULE_NAME)->where($condition)->findAll();
  42. foreach ($rel_data as $data) {
  43. $info[] = $data['content'];
  44. }
  45. if ($info) {
  46. $info = implode(",", $info);
  47. }
  48. $list = M(MODULE_NAME)->where($condition)->delete();
  49. if ($list !== false) {
  50. save_log($info . l("DELETE_SUCCESS"), 1);
  51. $this->success(l("DELETE_SUCCESS"), $ajax);
  52. } else {
  53. save_log($info . l("DELETE_FAILED"), 0);
  54. $this->error(l("DELETE_FAILED"), $ajax);
  55. }
  56. } else {
  57. $this->error(l("INVALID_OPERATION"), $ajax);
  58. }
  59. }
  60. }