-
Notifications
You must be signed in to change notification settings - Fork 0
/
useraccess.php
106 lines (90 loc) · 2.5 KB
/
useraccess.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
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
106
<?php include("secureaccess.php");
class Useraccess extends SecureAccess
{
function __construct()
{
parent::__construct();
$this->load->library("customtable_lib");
$this->load->model("admin/usertype_model");
}
public function index()
{
$data['oObj'] = $this;
$this->load->view("admin/includes/admin_header",$data);
//The page view to be added
$mod_data['modules'] = $this->usertype_model->getAllmodules();
$this->load->view('admin/useraccess_view',$mod_data);
//The datatable creation
$userData = $this->usertype_model->getadminUsers();
// echo "<pre>";print_r($userData);
$headings = array
(
"user_type_name"=>"User Name",
"user_type_dpname"=>"Display Name",
"allowed_links"=>"Allowed Modules"
);
$action = array
(
"btns"=>array("edit","delete"),
"text"=>array("Edit","Delete"),
"dbcols"=>array("user_type_id","user_type_id"),
"link"=>array(base_url()."admin/useraccess/editusertype/%@$%",base_url()."admin/useraccess/deleteusertype/%@$%"),
"clickable"=>array("#useredit_modal","")
);
$label = "User Type and Module Access";
$tableData = $this->customtable_lib->formatTableCells($label,$headings,$userData,"",$action);
$this->load->view('helpers/members_table_view',$tableData);
$this->load->view("admin/includes/admin_footer");
}
function createusertype()
{
if(!(empty($_POST)) && $this->validate_usertype($_POST))
{
$postedData = $_POST;
$postedData ['allowed_modules'] = implode(",",$postedData ['allowed_modules']);
$this->usertype_model->createusertype($postedData);
redirect(base_url()."admin/useraccess","refresh");
}
else
{
$this->backtologin();
}
}
function deleteusertype($user_type_id = "")
{
if($user_type_id)
{
$this->usertype_model->delete_usertype($user_type_id);
redirect(base_url()."admin/useraccess","refresh");
}
else
{
$this->backtologin();
}
}
function editusertype($type_id)
{
$data = $this->usertype_model->getusertype($type_id);
echo json_encode(array("status"=>"success","data"=>$data));
}
function editeduser()
{
if(!(empty($_POST)) && $this->validate_usertype($_POST))
{
$postedData = $_POST;
$postedData ['allowed_modules'] = implode(",",$postedData ['allowed_modules']);
// echo "<pre>";print_r($postedData);die;
$this->usertype_model->editusertype($postedData);
redirect(base_url()."admin/useraccess","refresh");
}
else
{
$this->backtologin();
}
}
private function validate_usertype($postData)
{
return TRUE;
}
}
?>