-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.notifybooker.php
More file actions
61 lines (56 loc) · 2.06 KB
/
Copy pathaction.notifybooker.php
File metadata and controls
61 lines (56 loc) · 2.06 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
<?php
#----------------------------------------------------------------------
# Module: Booker - a resource booking module
# Action: notifybooker - send message to recorded users of 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'))) exit;
$this->Crash();
if (isset($params['bkg_id']))
$bkgid = (int)$params['bkg_id'];
else {
$utils = new Booker\Utils();
$sql = 'SELECT bkg_id FROM '.$this->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\Messager();
list($res,$msg) = $funcs->NotifyBooker($this,$bkgid,$params[custmsg]);
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 'bookerbookings':
$newparms = array('item_id'=>$params['item_id'],'booker_id'=>$params['booker_id'],'task'=>$params['task']);
break;
case 'itembookings':
$newparms = array('item_id'=>$params['item_id'],'task'=>$params['task']);
break;
case 'defaultadmin':
$t = ($params['item_id'] >= Booker::MINGRPID) ? 'groups':'items';
$newparms = array('active_tab'=>$t);
break;
default:
$this->Crash();
}
if ($msg)
$newparms['message'] = $msg;
$this->Redirect($id,$resume,'',$newparms);