-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.exportbooking.php
More file actions
58 lines (58 loc) · 2.1 KB
/
Copy pathaction.exportbooking.php
File metadata and controls
58 lines (58 loc) · 2.1 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
<?php
#----------------------------------------------------------------------
# Module: Booker - a resource booking module
# Action: exportbooking - export bookings-data for resource or group or specific booking
#----------------------------------------------------------------------
# See file Booker.module.php for full details of copyright, licence, etc.
#----------------------------------------------------------------------
/*
supplied $params
'item_id'=> from defaultadmin or administer action
'bkg_id'=> from administer only
*/
if ($this->_CheckAccess('admin') || $this->_CheckAccess('see')) {
if (isset($params['bkg_id']))
$bkgid = (int)$params['bkg_id'];
else {
$utils = new Booker\Utils();
$sql = 'SELECT bkg_id FROM '.$mod->DispTable.' WHERE item_id=?';
$bkgid = $utils->SafeGet($sql,array($params['item_id']),'col');
if (!$bkgid) {
$name = $utils->GetItemNameForID($mod,$params['item_id']);
$msg = $this->Lang('nodata_one',$name);
$msg = $this->_PrettyMessage($msg,FALSE,FALSE);
$tab = ($params['item_id'] >= Booker::MINGRPID) ? 'groups':'items';
$this->Redirect($id,'defaultadmin','',array('active_tab'=>$tab,'message'=>$msg));
}
}
$funcs = new Booker\Bookingops();
list($res,$msg) = $funcs->ExportBkg($this,$bkgid);
if (!$res) {
if (isset($params['resume'])) {
$params['resume'] = json_decode(html_entity_decode($params['resume'],ENT_QUOTES|ENT_HTML401));
while (end($params['resume']) == $params['action']) {
array_pop($params['resume']);
}
$resume = array_pop($params['resume']);
} else {
$resume = 'defaultadmin';
}
switch ($resume) {
case 'itembookings':
$newparms = array('item_id'=>$params['item_id'],'task'=>$params['task'],'message'=>$msg);
break;
case 'bookerbookings':
$newparms = array('item_id'=>$params['item_id'],'booker_id'=>$params['booker_id'],
'task'=>$params['task'],'message'=>$msg);
break;
case 'defaultadmin':
$t = ($params['item_id'] >= Booker::MINGRPID) ? 'groups':'items';
$newparms = array('active_tab'=>$t,'message'=>$msg);
break;
default:
$this->Crash();
}
$this->Redirect($id,$resume,'',$newparms);
}
}
exit;