chengkun
2025-04-30 6ab292fb7415be124651e312ec4f21c594568f17
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
 
class hrclass_controller extends adminCommon{
    function index_action(){
        
        $HrM  =  $this -> MODEL('hr');
        
        $rows   =  $HrM     ->   getClassList(array());
            
        $this->yunset("rows",$rows);
        
        $this->yuntpl(array('admin/admin_hrclass'));
    
    }
    function add_action(){
        $HrM    =    $this->MODEL('hr');
        
        if($_GET['id']){
            
            $id        =    intval($_GET['id']);
            
            $row    =    $HrM   ->  getClassInfo(array("id"=>(int)$_GET['id']));
            
            $this -> yunset("row",  $row);    
            
        }
        if($_POST['submit']){
            
            
            
            
            
                if($_FILES['file']['tmp_name']){
 
                    $UploadM = $this->MODEL('upload');
 
                    $upArr    =  array(
                      'file'  =>  $_FILES['file'],
                      'dir'   =>  'hrclass'
                    );
 
                    $uploadM  =  $this->MODEL('upload');
 
                    $pic      =  $uploadM->newUpload($upArr);
                  
                    if (!empty($pic['msg'])){
 
                      $this->ACT_layer_msg($pic['msg'],8);
 
                    }elseif (!empty($pic['picurl'])){
 
                      $_POST['pic']   =   $pic['picurl'];
 
                    }
                }
                
                
                if($_POST['id']){
                    
                    $nid    =    $HrM->upClassInfo(array('id'=>intval($_POST['id'])),$_POST);
                    
                    $msg    =    "更新";
                
                }else{
                    
                    $nid    =    $HrM -> addClassInfo($_POST);
                    
                    $msg    =    "添加";
                
                }
                
                $nid?$this->ACT_layer_msg( "HR类别(ID:".$_POST['id'].")".$msg."成功!",9,"index.php?m=hrclass",2,1):$this->ACT_layer_msg( "HR类别(ID:".$_POST['id'].")".$msg."失败!",8,"index.php?m=hrclass",2,1);
        
        }
        
        $this->yuntpl(array('admin/admin_hrclass_add'));
    
    }
    
    function del_action(){
        
        if($_GET['del']){
            
            $this -> check_token();
            
            $delID   =  intval($_GET['del']);
        
        }elseif($_POST['del']){
             
            $delID   =  $_POST['del'];
        
        }
        
        $HrM    =    $this -> Model('hr');
        
        $return    =    $HrM -> delHrClass($delID);
        
        $this -> layer_msg($return['msg'],$return['errcode'],$return['layertype'],$_SERVER['HTTP_REFERER']);
        
    
    }
    
}
 
?>