-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.adminbooker.php
More file actions
82 lines (78 loc) · 2.95 KB
/
Copy pathaction.adminbooker.php
File metadata and controls
82 lines (78 loc) · 2.95 KB
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
<?php
#----------------------------------------------------------------------
# Module: Booker - a resource booking module
# Action: adminbooker
# Admin-side booker operations
#----------------------------------------------------------------------
# See file Booker.module.php for full details of copyright, licence, etc.
#----------------------------------------------------------------------
if (!$this->_CheckAccess()) exit;
if (isset($params['cancel'])) {
$this->Redirect($id,'defaultadmin','',array('active_tab'=>$params['active_tab']));
} elseif (isset($params['task'])) { //clicked link
switch ($params['task']) {
case 'see':
case 'add':
case 'edit':
$params['resume'] = json_encode(array('defaultadmin'));
$this->Redirect($id,'openbooker','',$params);
break;
case 'delete':
$funcs = new Booker\Userops($this);
$funcs->DeleteUser($this,$params['booker_id']);
break;
case 'toggle':
$funcs = new Booker\Userops($this);
$funcs->SetActive($this,$params['booker_id'],!$params['active']);
break;
case 'export';
$funcs = new Booker\Bookingops();
$sql = 'SELECT bkg_id FROM '.$this->OnceTable.' WHERE booker_id=?';
$bkgid = $db->GetCol($sql,array($params['booker_id']));
list($res,$msg) = $funcs->ExportBkg($this,$bkgid);
if ($res)
exit;
$this->Redirect($id,'defaultadmin','',array(
'active_tab'=>'people',
'message'=>$this->_PrettyMessage($msg,FALSE,FALSE)));
break;
}
$this->Redirect($id,'defaultadmin','',array('active_tab'=>'people'));
} elseif (isset($params['delete'])) {
if (!isset($params['selbkr']))
$this->Redirect($id,'defaultadmin','',array(
'active_tab'=>$params['active_tab'],
'message'=>$this->_PrettyMessage('nosel',FALSE)));
$funcs = new Booker\Userops($this);
if (!$funcs->DeleteUser($this,$params['selbkr']))
$this->Redirect($id,'defaultadmin','',array(
'active_tab'=>$params['active_tab'],
'message'=>$this->_PrettyMessage('err_system',FALSE)));
} else if (isset($params['export'])) {
if (!isset($params['selbkr']))
$this->Redirect($id,'defaultadmin','',array(
'active_tab'=>$params['active_tab'],
'message'=>$this->_PrettyMessage('nosel',FALSE)));
$funcs = new Booker\Export();
list($res,$key) = $funcs->ExportBookers($this,$params['selbkr']);
if ($res)
exit;
$this->Redirect($id,'defaultadmin','',array(
'active_tab'=>$params['active_tab'],
'message'=>$this->_PrettyMessage($key,FALSE)));
} else if (isset($params['exportbkg'])) {
if (!isset($params['selbkr']))
$this->Redirect($id,'defaultadmin','',array(
'active_tab'=>$params['active_tab'],
'message'=>$this->_PrettyMessage('nosel',FALSE)));
$funcs = new Booker\Export();
list($res,$key) = $funcs->ExportBookings($this,'*','*',$params['selbkr']);
if ($res)
exit;
$this->Redirect($id,'defaultadmin','',array(
'active_tab'=>$params['active_tab'],
'message'=>$this->_PrettyMessage($key,FALSE)));
} elseif (isset($params['import'])) {
$this->Crash();
}
$this->Redirect($id,'defaultadmin','',array('active_tab'=>$params['active_tab']));