theme_inform.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * Theme Inform
  4. *
  5. *
  6. *********************************/
  7. defined('InShopNC') or exit('Access Invalid!');
  8. class theme_informControl extends BaseCircleControl{
  9. protected $c_id = 0; // 圈子id
  10. protected $identity = 0; // 身份 0游客 1圈主 2管理 3成员 4申请中 5申请失败
  11. protected $circle_info = array();
  12. protected $cm_info = array();
  13. public function __construct(){
  14. parent::__construct();
  15. $this->c_id = intval($_GET['c_id']);
  16. if($this->c_id <= 0){
  17. echo '<script>DialogManager.close("inform");</script>';
  18. }
  19. Tpl::output('c_id', $this->c_id);
  20. Language::read('manage_inform');
  21. }
  22. /**
  23. * Share the binding
  24. */
  25. public function indexOp(){
  26. // memberInfo
  27. $this->memberInfo();
  28. if(empty($this->cm_info)){
  29. showDialog(L('circle_inform_error'));
  30. }
  31. $t_id = intval($_GET['t_id']);
  32. if($t_id <= 0){
  33. echo '<script>DialogManager.close("inform");</script>';
  34. }
  35. $model = Model();
  36. $r_id = intval($_GET['r_id']);
  37. $where = array();
  38. $where['circle_id'] = $this->c_id;
  39. $where['theme_id'] = $t_id;
  40. $where['reply_id'] = $r_id;
  41. $inform_info = $model->table('circle_inform')->where($where)->find();
  42. if(!empty($inform_info)){
  43. echo '<script>showError("'.L('circle_inform_have_been_reported').'");DialogManager.close("inform");</script>';exit;
  44. }
  45. if(chksubmit()){
  46. $circle_info = $model->table('circle')->field('circle_name')->find($this->c_id);
  47. if(!empty($circle_info)){
  48. echo '<script>DialogManager.close("inform");</script>';
  49. }
  50. $theme_info = $model->table('circle_theme')->field('theme_name')->find($t_id);
  51. if(!empty($theme_info)){
  52. echo '<script>DialogManager.close("inform");</script>';
  53. }
  54. $insert = array();
  55. $insert['circle_id'] = $this->c_id;
  56. $insert['circle_name'] = $circle_info['circle_name'];
  57. $insert['theme_id'] = $t_id;
  58. $insert['theme_name'] = $theme_info['theme_name'];
  59. $insert['reply_id'] = $r_id;
  60. $insert['member_id'] = $_SESSION['member_id'];
  61. $insert['member_name'] = $_SESSION['member_name'];
  62. $insert['inform_content'] = $_POST['content'];
  63. $insert['inform_time'] = time();
  64. $insert['inform_type'] = 0;
  65. $insert['inform_state'] = 0;
  66. $model->table('circle_inform')->insert($insert);
  67. // Update the inform number
  68. $update = array(
  69. 'circle_id'=>$this->c_id,
  70. 'new_informcount'=>array('exp', 'new_informcount+1')
  71. );
  72. $model->table('circle')->update($update);
  73. showDialog(L('nc_common_op_succ'), '', 'succ', '$(\'a[nctype="inform_cancel"]\').click();');
  74. }
  75. Tpl::output('t_id', $t_id);
  76. Tpl::showpage('theme.inform','null_layout');
  77. }
  78. }