YaWK  24.1
Yet another WebKit
booking-toggle.php
Go to the documentation of this file.
1 <?php
2 // check if language is set
3 if (!isset($language) || (!isset($lang)))
4 { // inject (add) language tags to core $lang array
5  $lang = \YAWK\language::inject(@$lang, "../system/plugins/booking/language/");
6 }
7 include '../system/plugins/booking/classes/booking.php';
9 
10 if (isset($_GET['id'])){
11  $booking->confirmed = $booking->getProperty($db, $_GET['id'], "confirmed");
12  $booking->id = $_GET['id'];
13 
14  if (isset($_GET['invite']) && ($_GET['invite'] === '1')){
15  $booking->email = $booking->getProperty($db, $booking->id, "email");
16  $booking->name = $booking->getProperty($db, $booking->id, "name");
17  $booking->inviteUser($db, $booking->id, $booking->email, $booking->name);
18  }
19  if (isset($_GET['success']) && ($_GET['success'] === '1')){
20  $booking->success = 1;
21  }
22  if (isset($_GET['ban'])){
23  $booking->email = $booking->getProperty($db, $booking->id, "email");
24  $booking->toggleBan($db, $booking->id, $booking->email);
25  \YAWK\backend::setTimeout("index.php?plugin=booking", 0);
26  }
27  if (isset($_GET['outdated'])){
28  $booking->toggleOutdated($db, $booking->id);
29  \YAWK\backend::setTimeout("index.php?plugin=booking", 0);
30  }
31  if (isset($_GET['toggle']) && ($_GET['toggle'] === '1')){
32  // check status and toggle it
33  if ($booking->confirmed === '1') {
34  $booking->confirmed = 0;
35  } else {
36  $booking->confirmed = 1;
37  }
38  if ($booking->success === '1'){
39  $booking->success = 0;
40  }
41 
42  if ($booking->toggleOffline($db, $booking->id, $booking->confirmed, $booking->success)) {
43  \YAWK\backend::setTimeout("index.php?plugin=booking&pluginpage=booking-edit&id=$booking->id", 0);
44  } else {
45  print \YAWK\alert::draw("danger", "$lang[ERROR]", "$lang[BOOKING_TOGGLE_FAILED]","",4200);
46  }
47  }
48 }
49 else { $booking->id = 0; }
50 
51 
52 
print $lang['FILEMAN_UPLOAD']
$booking
Booking Plugin is perfect if you want to let your customers submit appointments from frontend....
Definition: booking.php:23
static setTimeout($location, $wait)
Definition: backend.php:106
static inject(array $lang, string $pathToFile)
allow plugins to inject language tags to $lang array
Definition: language.php:439
print $_GET['id']
Definition: page-edit.php:357