-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminusers.php
120 lines (102 loc) · 2.77 KB
/
adminusers.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php include("secureaccess.php");
class Adminusers extends SecureAccess
{
function __construct()
{
parent::__construct();
$this->load->library("customtable_lib");
$this->load->model("admin/adminuser_model");
}
public function index()
{
$data['oObj'] = $this;
$this->load->view("admin/includes/admin_header",$data);
//The page view to be added
$this->load->model("admin/usertype_model");
$usertypes["user_types"] = $this->usertype_model->getadminUsers();
$this->load->view('admin/adminusers_view',$usertypes);
//The datatable creation
$userData = $this->adminuser_model->getbackendUsers();
// echo "<pre>";print_r($userData);die;
$headings = array
(
"admin_username"=>"User Name",
"admin_password"=>"Password",
"admin_name"=>"Name",
//"user_type_dpname"=>"User Type",
"admin_email"=>"Email ID",
"admin_mobile"=>"Mobile",
//"creator"=>"Created By",
//"created_date"=>"Created On"
);
$action = array
(
"btns"=>array("edit","delete"),
"text"=>array("Edit","Delete"),
"dbcols"=>array("admin_id","admin_id"),
"link"=>array(base_url()."admin/adminusers/getuserbyid/%@$%",base_url()."admin/adminusers/deleteuser/%@$%"),
"clickable"=>array("#adminusers_modal","")
);
$label = "Backend Users Data";
$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 createadminuser()
{
if(!(empty($_POST)) && $this->validate_admin_user($_POST))
{
$postedData = $_POST;
$postedData['creator_id'] = $this->userData[0]['admin_id'];
$postedData['created_date'] = "".$this->cur_date_time;
// echo "<pre>";print_r($postedData);die;
$this->adminuser_model->createadminuser($postedData);
$this->listPage();
}
else
{
$this->backtologin();
}
}
function deleteuser($admin_id = "")
{
if($admin_id)
{
$this->adminuser_model->delete_admin($admin_id);
$this->listPage();
}
else
{
$this->backtologin();
}
}
function getuserbyid($user_id)
{
$data = $this->adminuser_model->getbackendUsers($user_id);
echo json_encode(array("status"=>"success","data"=>$data));
}
function editeduser()
{
if(!(empty($_POST)) && $this->validate_admin_user($_POST))
{
$postedData = $_POST;
// $postedData ['allowed_modules'] = implode(",",$postedData ['allowed_modules']);
// echo "<pre>";print_r($postedData);die;
$this->adminuser_model->editadminuser($postedData);
$this->listPage();
}
else
{
$this->backtologin();
}
}
private function listPage()
{
redirect(base_url()."admin/adminusers","refresh");
}
private function validate_admin_user($postData)
{
return TRUE;
}
}
?>