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