forked from tinydeal/SupplierManagement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
personnel_category_controller.php
78 lines (73 loc) · 2.89 KB
/
personnel_category_controller.php
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/*
* @auther
* @date 2013 1-26
*/
require_once './class/log_service.class.php';
$log_service=new LogService();
if(isset($_GET['action'])){
$action=$_GET['action'];
switch ($action){
case 'ls':
require_once './personnel_category_view_ls.php';
break;
case 'add_get':
require_once './personnel_category_view_add_form.php';
break;
case 'add_post':
require_once './class/personnel_category_service.class.php';
require_once 'class/personnel_category.class.php';
$personnel_category_name=$_POST['personnel_category_name'];
$permission_name=$_POST['permission_name'];
$personnel_category=new PersonnelCategory(null,$personnel_category_name ,$permission_name );
$personnel_category_service=new PersonnelCategoryService();
$personnel_category_service->addPersonnelCategory($personnel_category);
$_SESSION['operation']=true;
$_SESSION['operation_msg']="添加人员类别:".$personnel_category_name."成功";
$log_service->addLog("insert","用户",null);
header("Location: ./index.php?mod=personnel_category&action=ls");
break;
case 'edit_get':
if(isset($_GET['eid'])){
$id=$_GET['eid'];
if(is_numeric($id)){
require_once './class/personnel_category_service.class.php';
require_once 'class/personnel_category.class.php';
$personnel_category_service=new PersonnelCategoryService();
$personnel_category=$personnel_category_service->getPersonnelCategoryById($id);
$personnel_category=serialize($personnel_category);
$_SESSION['personnel_category']=$personnel_category;
require_once './personnel_category_view_edit_form.php';
}else{
header("Location: ./index.php?mod=personnel_category&action=ls");
}
}else{
header("Location: ./index.php?mod=personnel_category&action=ls");
}
break;
case 'edit_post':
if(isset($_SESSION["id"])){
require_once './class/personnel_category_service.class.php';
require_once 'class/personnel_category.class.php';
$id=$_SESSION["id"];
unset($_SESSION["id"]);
$personnel_category_name=$_POST['personnel_category_name'];
$permission_name=$_POST['permission_name'];
$personnel_category=new PersonnelCategory($id,$personnel_category_name,$permission_name);
$personnel_category_service=new PersonnelCategoryService();
$personnel_category_service->updatePersonnelCategory($personnel_category);
$_SESSION['operation']=true;
$_SESSION['operation_msg']="修改人员类别:".$personnel_category_name."成功";
$log_service->addLog("update","用户",$id);
}else{
$_SESSION['operation']=false;
$_SESSION['operation_msg']="修改人员类别:".$personnel_category_name."失败";
}
header("Location: ./index.php?mod=personnel_category&action=ls");
default:
break;
}
}else{
header("Location: ./index.php?mod=personnel_category&action=ls");
}
?>