help.inc.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. global $_GPC, $_W;
  3. // $action = 'ad';
  4. // $title = $this->actions_titles[$action];
  5. $GLOBALS['frames'] = $this->getMainMenu();
  6. $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
  7. if ($operation == 'display') {
  8. $list = pdo_getall('zhtc_help',array('uniacid'=>$_W['uniacid']),array() , '' , 'sort ASC');
  9. } elseif ($operation == 'post') {
  10. $list = pdo_get('zhtc_help',array('id'=>$_GPC['id']));
  11. if(checksubmit('submit')){
  12. $data['created_time']=date("Y-m-d H:i:s");
  13. $data['question']=$_GPC['question'];
  14. $data['answer']=html_entity_decode($_GPC['answer']);
  15. $data['sort']=$_GPC['sort'];
  16. $data['uniacid']=$_W['uniacid'];
  17. if($_GPC['id']==''){
  18. $res=pdo_insert('zhtc_help',$data);
  19. if($res){
  20. message('添加成功',$this->createWebUrl('help',array()),'success');
  21. }else{
  22. message('添加失败','','error');
  23. }
  24. }else{
  25. $res = pdo_update('zhtc_help', $data, array('id' => $_GPC['id']));
  26. if($res){
  27. message('编辑成功',$this->createWebUrl('help',array()),'success');
  28. }else{
  29. message('编辑失败','','error');
  30. }
  31. }
  32. }
  33. } elseif ($operation == 'delete') {
  34. $id=$_GPC['id'];
  35. $result = pdo_delete('zhtc_help', array('id'=>$id));
  36. if($result){
  37. message('删除成功',$this->createWebUrl('help',array()),'success');
  38. }else{
  39. message('删除失败','','error');
  40. }
  41. }
  42. include $this->template('web/help');