1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed'); |
4
|
|
|
|
5
|
|
|
class Room_move extends My_Force_Login { |
6
|
|
|
|
7
|
|
|
public function __construct() { |
8
|
|
|
parent::__construct(); |
9
|
|
|
$this->load->model('computing-support/Room_move_model', 'room_move_model'); |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
public function index() { |
13
|
|
|
|
14
|
|
|
$this->load->helper('form'); |
15
|
|
|
$this->load->library('form_validation'); |
16
|
|
|
|
17
|
|
|
//validation |
18
|
|
|
$this->form_validation->set_rules('move', 'Move date', 'trim|required'); |
19
|
|
|
$this->form_validation->set_rules('from', 'Room from', 'trim|required|min_length[4]'); |
20
|
|
|
$this->form_validation->set_rules('to', 'Room to', 'trim|required'); |
21
|
|
|
$this->form_validation->set_rules('furniture', 'Furniture', 'trim|required'); |
22
|
|
|
$this->form_validation->set_rules('reason', 'Reason for move', 'required'); |
23
|
|
|
$this->form_validation->set_rules('full_name', 'Staff Involved', 'trim|required'); |
24
|
|
|
|
25
|
|
|
if ($this->form_validation->run() === FALSE) { |
26
|
|
|
|
27
|
|
|
$this->load->view('templates/header'); |
28
|
|
|
$this->load->view('computing-support/room-move/view'); |
29
|
|
|
$this->load->view('templates/footer'); |
30
|
|
|
} else { |
31
|
|
|
|
32
|
|
|
$requester = $this->input->post('logged'); |
33
|
|
|
$move = $this->input->post('move'); |
34
|
|
|
$from = $this->input->post('from'); |
35
|
|
|
$to = $this->input->post('to'); |
36
|
|
|
$furniture = $this->input->post('furniture'); |
37
|
|
|
$reason = $this->input->post('reason'); |
38
|
|
|
$full_name = $this->input->post('full_name'); |
39
|
|
|
$full_name2 = $this->input->post('full_name2'); |
40
|
|
|
$full_name3 = $this->input->post('full_name3'); |
41
|
|
|
$full_name4 = $this->input->post('full_name4'); |
42
|
|
|
$full_name5 = $this->input->post('full_name5'); |
43
|
|
|
$full_name6 = $this->input->post('full_name6'); |
44
|
|
|
$full_name7 = $this->input->post('full_name7'); |
45
|
|
|
$full_name8 = $this->input->post('full_name8'); |
46
|
|
|
$full_name9 = $this->input->post('full_name9'); |
47
|
|
|
$full_name10 = $this->input->post('full_name10'); |
48
|
|
|
|
49
|
|
|
if ($this->room_move_model->create($requester, $move, $from, $to, $furniture, $reason, $full_name, $full_name2, $full_name3, $full_name4, $full_name5, $full_name6, $full_name7, $full_name8, $full_name9, $full_name10)) { |
50
|
|
|
|
51
|
|
|
$this->load->view('templates/header'); |
52
|
|
|
$this->load->view('computing-support/room-move/complete'); |
53
|
|
|
$this->load->view('templates/footer'); |
54
|
|
|
|
55
|
|
|
if ($furniture == "No Furniture"){ |
56
|
|
|
|
57
|
|
|
$to_add = array('[email protected]', '[email protected]', '[email protected]'); |
58
|
|
|
|
59
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
60
|
|
|
$this->email->to($to_add); |
61
|
|
|
$this->email->subject('Room Move Request'); |
62
|
|
|
$this->email->message('A room move request has been submitted by '.$requester.' and does not need Estates approval. |
63
|
|
|
|
64
|
|
|
Move date: '.$move.' |
65
|
|
|
Room from: '.$from.' |
66
|
|
|
Room to: '.$to.' |
67
|
|
|
Furniture: '.$furniture.' |
68
|
|
|
|
69
|
|
|
Reason for move: |
70
|
|
|
'.$reason.' |
71
|
|
|
|
72
|
|
|
Use the following link to view more information or to approve and reject the request: |
73
|
|
|
https://intranet.cant-col.ac.uk/dashboard/computing-support/room-move/pending'); |
74
|
|
|
$this->email->send(); |
75
|
|
|
|
76
|
|
|
} else { |
77
|
|
|
|
78
|
|
|
$to_add = array('[email protected]', '[email protected]'); |
79
|
|
|
|
80
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
81
|
|
|
$this->email->to($to_add); |
82
|
|
|
$this->email->subject('Room Move Request'); |
83
|
|
|
$this->email->message('A room move request has been submitted by '.$requester.' |
84
|
|
|
|
85
|
|
|
Move date: '.$move.' |
86
|
|
|
Room from: '.$from.' |
87
|
|
|
Room to: '.$to.' |
88
|
|
|
Furniture: '.$furniture.' |
89
|
|
|
|
90
|
|
|
Reason for move: |
91
|
|
|
'.$reason.' |
92
|
|
|
|
93
|
|
|
Use the following link to view more information or to approve and reject the request: |
94
|
|
|
https://intranet.cant-col.ac.uk/dashboard/computing-support/room-move/pending'); |
95
|
|
|
$this->email->send(); |
96
|
|
|
|
97
|
|
|
$to = array('[email protected]', '[email protected]'); |
98
|
|
|
|
99
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
100
|
|
|
$this->email->to($to); |
101
|
|
|
$this->email->subject('Room Move Request'); |
102
|
|
|
$this->email->message('A room move request has been submitted by '.$requester.' BUT needs Estates approval. |
103
|
|
|
|
104
|
|
|
Move date: '.$move.' |
105
|
|
|
Room from: '.$from.' |
106
|
|
|
Room to: '.$to.' |
107
|
|
|
|
108
|
|
|
Reason for move: |
109
|
|
|
'.$reason.' |
110
|
|
|
|
111
|
|
|
Use the following link to view more information or to approve and reject the request: |
112
|
|
|
https://intranet.cant-col.ac.uk/dashboard/computing-support/room-move/pending'); |
113
|
|
|
$this->email->send(); |
114
|
|
|
|
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name'), $user_un); |
118
|
|
|
$user_un = $user_un[1]; |
119
|
|
View Code Duplication |
if (isset($full_name2)) { |
|
|
|
|
120
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name2'), $user_un2); |
121
|
|
|
$user_un2 = $user_un2[1]; |
122
|
|
|
} else { $user_un2 = NULL; } if (isset($full_name3)) { |
123
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name3'), $user_un3); |
124
|
|
|
$user_un3 = $user_un3[1]; |
125
|
|
View Code Duplication |
} else { $user_un3 = NULL; } if (isset($full_name4)) { |
|
|
|
|
126
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name4'), $user_un4); |
127
|
|
|
$user_un4 = $user_un4[1]; |
128
|
|
|
} else { $user_un4 = NULL; } if (isset($full_name5)) { |
129
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name5'), $user_un5); |
130
|
|
|
$user_un5 = $user_un5[1]; |
131
|
|
View Code Duplication |
} else { $user_un5 = NULL; } if (isset($full_name6)) { |
|
|
|
|
132
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name6'), $user_un6); |
133
|
|
|
$user_un6 = $user_un6[1]; |
134
|
|
|
} else { $user_un6 = NULL; } if (isset($full_name7)) { |
135
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name7'), $user_un7); |
136
|
|
|
$user_un7 = $user_un7[1]; |
137
|
|
View Code Duplication |
} else { $user_un7 = NULL; } if (isset($full_name8)) { |
|
|
|
|
138
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name8'), $user_un8); |
139
|
|
|
$user_un8 = $user_un8[1]; |
140
|
|
|
} else { $user_un8 = NULL; } if (isset($full_name9)) { |
141
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name9'), $user_un9); |
142
|
|
|
$user_un9 = $user_un9[1]; |
143
|
|
View Code Duplication |
} else { $user_un9 = NULL; } if (isset($full_name10)) { |
|
|
|
|
144
|
|
|
preg_match('#\((.*?)\)#', $this->input->post('full_name10'), $user_un10); |
145
|
|
|
$user_un10 = $user_un10[1]; |
146
|
|
|
} else { $user_un10 = NULL; } |
147
|
|
|
|
148
|
|
|
$requester_email = $_SESSION['ldap']['email']; |
149
|
|
|
|
150
|
|
|
$staff_involved_un = $user_un; |
151
|
|
|
$staff_involved_email = $this->room_move_model->get_email_username($staff_involved_un); |
152
|
|
|
|
153
|
|
|
$staff_involved_un2 = $user_un2; |
154
|
|
|
$staff_involved_email2 = $this->room_move_model->get_email_username($staff_involved_un2); |
155
|
|
|
|
156
|
|
|
$staff_involved_un3 = $user_un3; |
157
|
|
|
$staff_involved_email3 = $this->room_move_model->get_email_username($staff_involved_un3); |
158
|
|
|
|
159
|
|
|
$staff_involved_un4 = $user_un4; |
160
|
|
|
$staff_involved_email4 = $this->room_move_model->get_email_username($staff_involved_un4); |
161
|
|
|
|
162
|
|
|
$staff_involved_un5 = $user_un5; |
163
|
|
|
$staff_involved_email5 = $this->room_move_model->get_email_username($staff_involved_un5); |
164
|
|
|
|
165
|
|
|
$staff_involved_un6 = $user_un6; |
166
|
|
|
$staff_involved_email6 = $this->room_move_model->get_email_username($staff_involved_un6); |
167
|
|
|
|
168
|
|
|
$staff_involved_un7= $user_un7; |
169
|
|
|
$staff_involved_email7 = $this->room_move_model->get_email_username($staff_involved_un7); |
170
|
|
|
|
171
|
|
|
$staff_involved_un8 = $user_un8; |
172
|
|
|
$staff_involved_email8 = $this->room_move_model->get_email_username($staff_involved_un8); |
173
|
|
|
|
174
|
|
|
$staff_involved_un9 = $user_un9; |
175
|
|
|
$staff_involved_email9 = $this->room_move_model->get_email_username($staff_involved_un9); |
176
|
|
|
|
177
|
|
|
$staff_involved_un10 = $user_un10; |
178
|
|
|
$staff_involved_email10 = $this->room_move_model->get_email_username($staff_involved_un10); |
179
|
|
|
|
180
|
|
|
$cc = array($staff_involved_email, $staff_involved_email2, $staff_involved_email3, $staff_involved_email4, $staff_involved_email5, $staff_involved_email6, $staff_involved_email7, $staff_involved_email8, $staff_involved_email9, $staff_involved_email10); |
181
|
|
|
|
182
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
183
|
|
|
$this->email->to($requester_email); |
184
|
|
|
$this->email->cc($cc); |
185
|
|
|
$this->email->subject('Room Move Request'); |
186
|
|
|
$this->email->message('A room move request has been requested by '.$requester.'. |
187
|
|
|
|
188
|
|
|
Move date: '.$move.' |
189
|
|
|
Room from: '.$from.' |
190
|
|
|
Room to: '.$to.' |
191
|
|
|
|
192
|
|
|
Use the following link to view more information: |
193
|
|
|
https://intranet.cant-col.ac.uk/dashboard/computing-support/room-move/check'); |
194
|
|
|
$this->email->send(); |
195
|
|
|
|
196
|
|
View Code Duplication |
} else { |
|
|
|
|
197
|
|
|
|
198
|
|
|
$data = new stdClass(); |
199
|
|
|
$data->error = 'There was a problem requesting this move. Please try again.'; |
200
|
|
|
|
201
|
|
|
// failed to create user |
202
|
|
|
$this->load->view('templates/header'); |
203
|
|
|
$this->load->view('computing-support/room-move/view', $data); |
204
|
|
|
$this->load->view('templates/footer'); |
205
|
|
|
} |
206
|
|
|
} |
207
|
|
|
} |
208
|
|
|
|
209
|
|
View Code Duplication |
public function history() { |
|
|
|
|
210
|
|
|
|
211
|
|
|
if (in_array('CN=DG06,OU=Distribution Groups,OU=Email Groups,OU=Accounts,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups']) || |
212
|
|
|
in_array('CN=Dashboard_Estates_Room_Move,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) { |
213
|
|
|
|
214
|
|
|
$data = array(); |
215
|
|
|
$data['room_move'] = $this->room_move_model->get_all(); |
216
|
|
|
|
217
|
|
|
$this->load->view('templates/header'); |
218
|
|
|
$this->load->view('computing-support/room-move/history', $data); |
219
|
|
|
$this->load->view('templates/footer'); |
220
|
|
|
} else { |
221
|
|
|
redirect('permissions'); |
222
|
|
|
} |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
public function check() { |
226
|
|
|
|
227
|
|
|
$data = array(); |
228
|
|
|
$data['room_move'] = $this->room_move_model->check_status(); |
229
|
|
|
|
230
|
|
|
$this->load->view('templates/header'); |
231
|
|
|
$this->load->view('computing-support/room-move/check', $data); |
232
|
|
|
$this->load->view('templates/footer'); |
233
|
|
|
} |
234
|
|
|
|
235
|
|
View Code Duplication |
public function pending() { |
|
|
|
|
236
|
|
|
|
237
|
|
|
if (in_array('CN=Dashboard_CS_NS,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups']) || |
238
|
|
|
in_array('CN=Dashboard_Estates_Room_Move,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) { |
239
|
|
|
|
240
|
|
|
$data = array(); |
241
|
|
|
$data['room_move'] = $this->room_move_model->get_pending(); |
242
|
|
|
|
243
|
|
|
$this->load->view('templates/header'); |
244
|
|
|
$this->load->view('computing-support/room-move/pending', $data); |
245
|
|
|
$this->load->view('templates/footer'); |
246
|
|
|
} else { |
247
|
|
|
redirect('permissions'); |
248
|
|
|
} |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
public function cancel() { |
252
|
|
|
|
253
|
|
|
$id = $_GET['id']; |
254
|
|
|
$check_user = $this->room_move_model->match_id_user($id); |
255
|
|
|
if ($check_user[0]['requester_un'] == $_SESSION['username']) { |
256
|
|
|
|
257
|
|
|
if (isset($_GET['id'])) { |
258
|
|
|
|
259
|
|
|
$id = $_GET['id']; |
260
|
|
|
$this->room_move_model->cancel($id); |
261
|
|
|
|
262
|
|
|
$function = 'room_move_CANCEL_' . $id; |
263
|
|
|
$this->user_model->function_log($function); |
264
|
|
|
|
265
|
|
|
$get_request = $this->room_move_model->get_request($id); |
266
|
|
|
|
267
|
|
|
$requester_un = $get_request[0]['requester_un']; |
268
|
|
|
$requester_email = $this->room_move_model->get_email_username($requester_un); |
269
|
|
|
|
270
|
|
|
$staff_involved_un = $get_request[0]['staff_involved_un']; |
271
|
|
|
$staff_involved_email = $this->room_move_model->get_email_username($staff_involved_un); |
272
|
|
|
|
273
|
|
|
$staff_involved_un2 = $get_request[0]['staff_involved_un2']; |
274
|
|
|
$staff_involved_email2 = $this->room_move_model->get_email_username($staff_involved_un2); |
275
|
|
|
|
276
|
|
|
$staff_involved_un3 = $get_request[0]['staff_involved_un3']; |
277
|
|
|
$staff_involved_email3 = $this->room_move_model->get_email_username($staff_involved_un3); |
278
|
|
|
|
279
|
|
|
$staff_involved_un4 = $get_request[0]['staff_involved_un4']; |
280
|
|
|
$staff_involved_email4 = $this->room_move_model->get_email_username($staff_involved_un4); |
281
|
|
|
|
282
|
|
|
$staff_involved_un5 = $get_request[0]['staff_involved_un5']; |
283
|
|
|
$staff_involved_email5 = $this->room_move_model->get_email_username($staff_involved_un5); |
284
|
|
|
|
285
|
|
|
$staff_involved_un6 = $get_request[0]['staff_involved_un6']; |
286
|
|
|
$staff_involved_email6 = $this->room_move_model->get_email_username($staff_involved_un6); |
287
|
|
|
|
288
|
|
|
$staff_involved_un7= $get_request[0]['staff_involved_un7']; |
289
|
|
|
$staff_involved_email7 = $this->room_move_model->get_email_username($staff_involved_un7); |
290
|
|
|
|
291
|
|
|
$staff_involved_un8 = $get_request[0]['staff_involved_un8']; |
292
|
|
|
$staff_involved_email8 = $this->room_move_model->get_email_username($staff_involved_un8); |
293
|
|
|
|
294
|
|
|
$staff_involved_un9 = $get_request[0]['staff_involved_un9']; |
295
|
|
|
$staff_involved_email9 = $this->room_move_model->get_email_username($staff_involved_un9); |
296
|
|
|
|
297
|
|
|
$staff_involved_un10 = $get_request[0]['staff_involved_un10']; |
298
|
|
|
$staff_involved_email10 = $this->room_move_model->get_email_username($staff_involved_un10); |
299
|
|
|
|
300
|
|
|
$to = array('[email protected]', '[email protected]', $requester_email); |
301
|
|
|
$cc = array($staff_involved_email, $staff_involved_email2, $staff_involved_email3, $staff_involved_email4, $staff_involved_email5, $staff_involved_email6, $staff_involved_email7, $staff_involved_email8, $staff_involved_email9, $staff_involved_email10); |
302
|
|
|
|
303
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
304
|
|
|
$this->email->to($to); |
305
|
|
|
$this->email->cc($cc); |
306
|
|
|
$this->email->subject('Room Move Request'); |
307
|
|
|
$this->email->message('A room move request has been canceled by '.$get_request[0]['requester'].' |
308
|
|
|
|
309
|
|
|
Move date: '.$get_request[0]['move'].' |
310
|
|
|
Room from: '.$get_request[0]['from'].' |
311
|
|
|
Room to: '.$get_request[0]['to']); |
312
|
|
|
$this->email->send(); |
313
|
|
|
|
314
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
315
|
|
|
redirect($url); |
316
|
|
|
} |
317
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
318
|
|
|
redirect($url); |
319
|
|
|
} else { |
320
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
321
|
|
|
redirect($url); |
322
|
|
|
} |
323
|
|
|
} |
324
|
|
|
|
325
|
|
View Code Duplication |
public function eh_reject() { |
|
|
|
|
326
|
|
|
|
327
|
|
|
if (in_array('CN=Dashboard_Estates_Room_Move,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) { |
328
|
|
|
|
329
|
|
|
if (isset($_GET['id'])) { |
330
|
|
|
|
331
|
|
|
$id = $_GET['id']; |
332
|
|
|
$this->room_move_model->eh_reject($id); |
333
|
|
|
|
334
|
|
|
$function = 'room_move_EH_REJECT_' . $id; |
335
|
|
|
$this->user_model->function_log($function); |
336
|
|
|
|
337
|
|
|
$get_request = $this->room_move_model->get_request($id); |
338
|
|
|
|
339
|
|
|
$requester_un = $get_request[0]['requester_un']; |
340
|
|
|
$requester_email = $this->room_move_model->get_email_username($requester_un); |
341
|
|
|
|
342
|
|
|
$staff_involved_un = $get_request[0]['staff_involved_un']; |
343
|
|
|
$staff_involved_email = $this->room_move_model->get_email_username($staff_involved_un); |
344
|
|
|
|
345
|
|
|
$staff_involved_un2 = $get_request[0]['staff_involved_un2']; |
346
|
|
|
$staff_involved_email2 = $this->room_move_model->get_email_username($staff_involved_un2); |
347
|
|
|
|
348
|
|
|
$staff_involved_un3 = $get_request[0]['staff_involved_un3']; |
349
|
|
|
$staff_involved_email3 = $this->room_move_model->get_email_username($staff_involved_un3); |
350
|
|
|
|
351
|
|
|
$staff_involved_un4 = $get_request[0]['staff_involved_un4']; |
352
|
|
|
$staff_involved_email4 = $this->room_move_model->get_email_username($staff_involved_un4); |
353
|
|
|
|
354
|
|
|
$staff_involved_un5 = $get_request[0]['staff_involved_un5']; |
355
|
|
|
$staff_involved_email5 = $this->room_move_model->get_email_username($staff_involved_un5); |
356
|
|
|
|
357
|
|
|
$staff_involved_un6 = $get_request[0]['staff_involved_un6']; |
358
|
|
|
$staff_involved_email6 = $this->room_move_model->get_email_username($staff_involved_un6); |
359
|
|
|
|
360
|
|
|
$staff_involved_un7= $get_request[0]['staff_involved_un7']; |
361
|
|
|
$staff_involved_email7 = $this->room_move_model->get_email_username($staff_involved_un7); |
362
|
|
|
|
363
|
|
|
$staff_involved_un8 = $get_request[0]['staff_involved_un8']; |
364
|
|
|
$staff_involved_email8 = $this->room_move_model->get_email_username($staff_involved_un8); |
365
|
|
|
|
366
|
|
|
$staff_involved_un9 = $get_request[0]['staff_involved_un9']; |
367
|
|
|
$staff_involved_email9 = $this->room_move_model->get_email_username($staff_involved_un9); |
368
|
|
|
|
369
|
|
|
$staff_involved_un10 = $get_request[0]['staff_involved_un10']; |
370
|
|
|
$staff_involved_email10 = $this->room_move_model->get_email_username($staff_involved_un10); |
371
|
|
|
|
372
|
|
|
$to = array('[email protected]', '[email protected]', $requester_email); |
373
|
|
|
$cc = array($staff_involved_email, $staff_involved_email2, $staff_involved_email3, $staff_involved_email4, $staff_involved_email5, $staff_involved_email6, $staff_involved_email7, $staff_involved_email8, $staff_involved_email9, $staff_involved_email10); |
374
|
|
|
|
375
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
376
|
|
|
$this->email->to($to); |
377
|
|
|
$this->email->cc($cc); |
378
|
|
|
$this->email->subject('Room Move Request'); |
379
|
|
|
$this->email->message('A room move request has been rejected by Estates. |
380
|
|
|
|
381
|
|
|
Requested by: '.$get_request[0]['requester'].' |
382
|
|
|
Move date: '.$get_request[0]['move'].' |
383
|
|
|
Room from: '.$get_request[0]['from'].' |
384
|
|
|
Room to: '.$get_request[0]['to']); |
385
|
|
|
$this->email->send(); |
386
|
|
|
|
387
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
388
|
|
|
redirect($url); |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
392
|
|
|
redirect($url); |
393
|
|
|
} else { |
394
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
395
|
|
|
redirect($url); |
396
|
|
|
} |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
public function eh_approve() { |
400
|
|
|
|
401
|
|
|
if (in_array('CN=Dashboard_Estates_Room_Move,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) { |
402
|
|
|
|
403
|
|
|
if (isset($_GET['id'])) { |
404
|
|
|
|
405
|
|
|
$id = $_GET['id']; |
406
|
|
|
$this->room_move_model->eh_approve($id); |
407
|
|
|
|
408
|
|
|
$function = 'room_move_EH_APPROVED_' . $id; |
409
|
|
|
$this->user_model->function_log($function); |
410
|
|
|
|
411
|
|
|
$get_request = $this->room_move_model->get_request($id); |
412
|
|
|
|
413
|
|
|
$to = array('[email protected]', '[email protected]'); |
414
|
|
|
|
415
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
416
|
|
|
$this->email->to($to); |
417
|
|
|
$this->email->subject('Room Move Request'); |
418
|
|
|
$this->email->message('A room move request has been approved by Estates. |
419
|
|
|
|
420
|
|
|
Requested by: '.$get_request[0]['requester'].' |
421
|
|
|
Move date: '.$get_request[0]['move'].' |
422
|
|
|
Room from: '.$get_request[0]['from'].' |
423
|
|
|
Room to: '.$get_request[0]['to'].' |
424
|
|
|
|
425
|
|
|
Reason for move: |
426
|
|
|
'.$get_request[0]['reason']); |
427
|
|
|
$this->email->send(); |
428
|
|
|
|
429
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
430
|
|
|
redirect($url); |
431
|
|
|
} |
432
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
433
|
|
|
redirect($url); |
434
|
|
|
} else { |
435
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
436
|
|
|
redirect($url); |
437
|
|
|
} |
438
|
|
|
} |
439
|
|
|
|
440
|
|
View Code Duplication |
public function cs_reject() { |
|
|
|
|
441
|
|
|
|
442
|
|
|
if (in_array('CN=Dashboard_CS_NS,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) { |
443
|
|
|
|
444
|
|
|
if (isset($_GET['id'])) { |
445
|
|
|
|
446
|
|
|
$id = $_GET['id']; |
447
|
|
|
$reason = $_GET['reason']; |
|
|
|
|
448
|
|
|
$this->room_move_model->cs_reject($id); |
449
|
|
|
|
450
|
|
|
$function = 'room_move_CS_REJECT_' . $id; |
451
|
|
|
$this->user_model->function_log($function); |
452
|
|
|
|
453
|
|
|
$get_request = $this->room_move_model->get_request($id); |
454
|
|
|
|
455
|
|
|
$requester_un = $get_request[0]['requester_un']; |
456
|
|
|
$requester_email = $this->room_move_model->get_email_username($requester_un); |
457
|
|
|
|
458
|
|
|
$staff_involved_un = $get_request[0]['staff_involved_un']; |
459
|
|
|
$staff_involved_email = $this->room_move_model->get_email_username($staff_involved_un); |
460
|
|
|
|
461
|
|
|
$staff_involved_un2 = $get_request[0]['staff_involved_un2']; |
462
|
|
|
$staff_involved_email2 = $this->room_move_model->get_email_username($staff_involved_un2); |
463
|
|
|
|
464
|
|
|
$staff_involved_un3 = $get_request[0]['staff_involved_un3']; |
465
|
|
|
$staff_involved_email3 = $this->room_move_model->get_email_username($staff_involved_un3); |
466
|
|
|
|
467
|
|
|
$staff_involved_un4 = $get_request[0]['staff_involved_un4']; |
468
|
|
|
$staff_involved_email4 = $this->room_move_model->get_email_username($staff_involved_un4); |
469
|
|
|
|
470
|
|
|
$staff_involved_un5 = $get_request[0]['staff_involved_un5']; |
471
|
|
|
$staff_involved_email5 = $this->room_move_model->get_email_username($staff_involved_un5); |
472
|
|
|
|
473
|
|
|
$staff_involved_un6 = $get_request[0]['staff_involved_un6']; |
474
|
|
|
$staff_involved_email6 = $this->room_move_model->get_email_username($staff_involved_un6); |
475
|
|
|
|
476
|
|
|
$staff_involved_un7= $get_request[0]['staff_involved_un7']; |
477
|
|
|
$staff_involved_email7 = $this->room_move_model->get_email_username($staff_involved_un7); |
478
|
|
|
|
479
|
|
|
$staff_involved_un8 = $get_request[0]['staff_involved_un8']; |
480
|
|
|
$staff_involved_email8 = $this->room_move_model->get_email_username($staff_involved_un8); |
481
|
|
|
|
482
|
|
|
$staff_involved_un9 = $get_request[0]['staff_involved_un9']; |
483
|
|
|
$staff_involved_email9 = $this->room_move_model->get_email_username($staff_involved_un9); |
484
|
|
|
|
485
|
|
|
$staff_involved_un10 = $get_request[0]['staff_involved_un10']; |
486
|
|
|
$staff_involved_email10 = $this->room_move_model->get_email_username($staff_involved_un10); |
487
|
|
|
|
488
|
|
|
$to = array($requester_email, '[email protected]'); |
489
|
|
|
$cc = array($staff_involved_email, $staff_involved_email2, $staff_involved_email3, $staff_involved_email4, $staff_involved_email5, $staff_involved_email6, $staff_involved_email7, $staff_involved_email8, $staff_involved_email9, $staff_involved_email10); |
490
|
|
|
|
491
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
492
|
|
|
$this->email->to($to); |
493
|
|
|
$this->email->cc($cc); |
494
|
|
|
$this->email->subject('Room Move Request'); |
495
|
|
|
$this->email->message('A room move request has been rejected by Computing Support. |
496
|
|
|
|
497
|
|
|
Requested by: '.$get_request[0]['requester'].' |
498
|
|
|
Move date: '.$get_request[0]['move'].' |
499
|
|
|
Room from: '.$get_request[0]['from'].' |
500
|
|
|
Room to: '.$get_request[0]['to']); |
501
|
|
|
$this->email->send(); |
502
|
|
|
|
503
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
504
|
|
|
redirect($url); |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
508
|
|
|
redirect($url); |
509
|
|
|
} else { |
510
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
511
|
|
|
redirect($url); |
512
|
|
|
} |
513
|
|
|
} |
514
|
|
|
|
515
|
|
View Code Duplication |
public function cs_approve() { |
|
|
|
|
516
|
|
|
|
517
|
|
|
if (in_array('CN=Dashboard_CS_NS,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) { |
518
|
|
|
|
519
|
|
|
if (isset($_GET['id'])) { |
520
|
|
|
|
521
|
|
|
$id = $_GET['id']; |
522
|
|
|
$this->room_move_model->cs_approve($id); |
523
|
|
|
|
524
|
|
|
$function = 'room_move_CS_APPROVED_' . $id; |
525
|
|
|
$this->user_model->function_log($function); |
526
|
|
|
|
527
|
|
|
$get_request = $this->room_move_model->get_request($id); |
528
|
|
|
|
529
|
|
|
$requester_un = $get_request[0]['requester_un']; |
530
|
|
|
$requester_email = $this->room_move_model->get_email_username($requester_un); |
531
|
|
|
|
532
|
|
|
$staff_involved_un = $get_request[0]['staff_involved_un']; |
533
|
|
|
$staff_involved_email = $this->room_move_model->get_email_username($staff_involved_un); |
534
|
|
|
|
535
|
|
|
$staff_involved_un2 = $get_request[0]['staff_involved_un2']; |
536
|
|
|
$staff_involved_email2 = $this->room_move_model->get_email_username($staff_involved_un2); |
537
|
|
|
|
538
|
|
|
$staff_involved_un3 = $get_request[0]['staff_involved_un3']; |
539
|
|
|
$staff_involved_email3 = $this->room_move_model->get_email_username($staff_involved_un3); |
540
|
|
|
|
541
|
|
|
$staff_involved_un4 = $get_request[0]['staff_involved_un4']; |
542
|
|
|
$staff_involved_email4 = $this->room_move_model->get_email_username($staff_involved_un4); |
543
|
|
|
|
544
|
|
|
$staff_involved_un5 = $get_request[0]['staff_involved_un5']; |
545
|
|
|
$staff_involved_email5 = $this->room_move_model->get_email_username($staff_involved_un5); |
546
|
|
|
|
547
|
|
|
$staff_involved_un6 = $get_request[0]['staff_involved_un6']; |
548
|
|
|
$staff_involved_email6 = $this->room_move_model->get_email_username($staff_involved_un6); |
549
|
|
|
|
550
|
|
|
$staff_involved_un7= $get_request[0]['staff_involved_un7']; |
551
|
|
|
$staff_involved_email7 = $this->room_move_model->get_email_username($staff_involved_un7); |
552
|
|
|
|
553
|
|
|
$staff_involved_un8 = $get_request[0]['staff_involved_un8']; |
554
|
|
|
$staff_involved_email8 = $this->room_move_model->get_email_username($staff_involved_un8); |
555
|
|
|
|
556
|
|
|
$staff_involved_un9 = $get_request[0]['staff_involved_un9']; |
557
|
|
|
$staff_involved_email9 = $this->room_move_model->get_email_username($staff_involved_un9); |
558
|
|
|
|
559
|
|
|
$staff_involved_un10 = $get_request[0]['staff_involved_un10']; |
560
|
|
|
$staff_involved_email10 = $this->room_move_model->get_email_username($staff_involved_un10); |
561
|
|
|
|
562
|
|
|
$to = array('[email protected]', '[email protected]', $requester_email); |
563
|
|
|
$cc = array($staff_involved_email, $staff_involved_email2, $staff_involved_email3, $staff_involved_email4, $staff_involved_email5, $staff_involved_email6, $staff_involved_email7, $staff_involved_email8, $staff_involved_email9, $staff_involved_email10); |
564
|
|
|
|
565
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
566
|
|
|
$this->email->to($to); |
567
|
|
|
$this->email->cc($cc); |
568
|
|
|
$this->email->subject('Room Move Request'); |
569
|
|
|
$this->email->message('A room move request has been accepted by Computing Support. |
570
|
|
|
|
571
|
|
|
Requested by: '.$get_request[0]['requester'].' |
572
|
|
|
Move date: '.$get_request[0]['move'].' |
573
|
|
|
Room from: '.$get_request[0]['from'].' |
574
|
|
|
Room to: '.$get_request[0]['to']); |
575
|
|
|
$this->email->send(); |
576
|
|
|
|
577
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
578
|
|
|
redirect($url); |
579
|
|
|
} |
580
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
581
|
|
|
redirect($url); |
582
|
|
|
} else { |
583
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
584
|
|
|
redirect($url); |
585
|
|
|
} |
586
|
|
|
} |
587
|
|
|
|
588
|
|
View Code Duplication |
public function cs_complete() { |
|
|
|
|
589
|
|
|
|
590
|
|
|
if (in_array('CN=DG06,OU=Distribution Groups,OU=Email Groups,OU=Accounts,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) { |
591
|
|
|
|
592
|
|
|
if (isset($_GET['id'])) { |
593
|
|
|
|
594
|
|
|
$id = $_GET['id']; |
595
|
|
|
$this->room_move_model->cs_complete($id); |
596
|
|
|
|
597
|
|
|
$function = 'room_move_CS_COMPLETE_' . $id; |
598
|
|
|
$this->user_model->function_log($function); |
599
|
|
|
|
600
|
|
|
$get_request = $this->room_move_model->get_request($id); |
601
|
|
|
|
602
|
|
|
$requester_un = $get_request[0]['requester_un']; |
603
|
|
|
$requester_email = $this->room_move_model->get_email_username($requester_un); |
604
|
|
|
|
605
|
|
|
$staff_involved_un = $get_request[0]['staff_involved_un']; |
606
|
|
|
$staff_involved_email = $this->room_move_model->get_email_username($staff_involved_un); |
607
|
|
|
|
608
|
|
|
$staff_involved_un2 = $get_request[0]['staff_involved_un2']; |
609
|
|
|
$staff_involved_email2 = $this->room_move_model->get_email_username($staff_involved_un2); |
610
|
|
|
|
611
|
|
|
$staff_involved_un3 = $get_request[0]['staff_involved_un3']; |
612
|
|
|
$staff_involved_email3 = $this->room_move_model->get_email_username($staff_involved_un3); |
613
|
|
|
|
614
|
|
|
$staff_involved_un4 = $get_request[0]['staff_involved_un4']; |
615
|
|
|
$staff_involved_email4 = $this->room_move_model->get_email_username($staff_involved_un4); |
616
|
|
|
|
617
|
|
|
$staff_involved_un5 = $get_request[0]['staff_involved_un5']; |
618
|
|
|
$staff_involved_email5 = $this->room_move_model->get_email_username($staff_involved_un5); |
619
|
|
|
|
620
|
|
|
$staff_involved_un6 = $get_request[0]['staff_involved_un6']; |
621
|
|
|
$staff_involved_email6 = $this->room_move_model->get_email_username($staff_involved_un6); |
622
|
|
|
|
623
|
|
|
$staff_involved_un7= $get_request[0]['staff_involved_un7']; |
624
|
|
|
$staff_involved_email7 = $this->room_move_model->get_email_username($staff_involved_un7); |
625
|
|
|
|
626
|
|
|
$staff_involved_un8 = $get_request[0]['staff_involved_un8']; |
627
|
|
|
$staff_involved_email8 = $this->room_move_model->get_email_username($staff_involved_un8); |
628
|
|
|
|
629
|
|
|
$staff_involved_un9 = $get_request[0]['staff_involved_un9']; |
630
|
|
|
$staff_involved_email9 = $this->room_move_model->get_email_username($staff_involved_un9); |
631
|
|
|
|
632
|
|
|
$staff_involved_un10 = $get_request[0]['staff_involved_un10']; |
633
|
|
|
$staff_involved_email10 = $this->room_move_model->get_email_username($staff_involved_un10); |
634
|
|
|
|
635
|
|
|
$to = array('[email protected]', '[email protected]', $requester_email); |
636
|
|
|
$cc = array($staff_involved_email, $staff_involved_email2, $staff_involved_email3, $staff_involved_email4, $staff_involved_email5, $staff_involved_email6, $staff_involved_email7, $staff_involved_email8, $staff_involved_email9, $staff_involved_email10); |
637
|
|
|
|
638
|
|
|
$this->email->from('[email protected]', 'Room Move Request'); |
639
|
|
|
$this->email->to($to); |
640
|
|
|
$this->email->cc($cc); |
641
|
|
|
$this->email->subject('Room Move Request'); |
642
|
|
|
$this->email->message('A room move request has been completed. |
643
|
|
|
|
644
|
|
|
Requested by: '.$get_request[0]['requester'].' |
645
|
|
|
Move date: '.$get_request[0]['move'].' |
646
|
|
|
Room from: '.$get_request[0]['from'].' |
647
|
|
|
Room to: '.$get_request[0]['to']); |
648
|
|
|
$this->email->send(); |
649
|
|
|
|
650
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
651
|
|
|
redirect($url); |
652
|
|
|
} |
653
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
654
|
|
|
redirect($url); |
655
|
|
|
} else { |
656
|
|
|
$url = preg_replace('/\?.*/', '', $_SERVER['HTTP_REFERER']); |
657
|
|
|
redirect($url); |
658
|
|
|
} |
659
|
|
|
} |
660
|
|
|
|
661
|
|
|
} |
662
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.