YaWK  24.1
Yet another WebKit
booking-edit.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';
8 // get db vars
9 
10 // generate new booking object
11 $booking = new \YAWK\PLUGINS\BOOKING\booking();
12 
13 // TEMPLATE WRAPPER - HEADER & breadcrumbs
14 echo "
15  <!-- Content Wrapper. Contains page content -->
16  <div class=\"content-wrapper\" id=\"content-FX\">
17  <!-- Content Header (Page header) -->
18  <section class=\"content-header\">";
19 /* draw Title on top */
20 echo \YAWK\backend::getTitle($lang['BOOKING'], $lang['BOOKING_DETAILS']);
21 echo"<ol class=\"breadcrumb\">
22  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
23  <li><a href=\"index.php?page=plugins\" title=\"$lang[PLUGINS]\"> $lang[PLUGINS]</a></li>
24  <li class=\"active\"><a href=\"index.php?plugin=booking\" title=\"$lang[BOOKING]\"> $lang[BOOKING]</a></li>
25  </ol>
26  </section>
27  <!-- Main content -->
28  <section class=\"content\">";
29 /* page content start here */
30 
31 // form sent: prepare vars and add into db
32 if (isset($_POST['create'])){
33  if (isset($_GET['id'])){
34  $booking->id = $db->quote($_GET['id']);
35  }
36  if (isset($_POST['income'])){
37  $booking->income = $db->quote($_POST['income']);
38  // $booking->success = 1;
39  } else { $booking->income = 0;
40  $booking->success = 0;
41  }
42  if (isset($_POST['grade'])){
43  $booking->grade = $db->quote($_POST['grade']);
44  } else { $booking->grade = '';
45  }
46  if (isset($_POST['comment'])){
47  $booking->comment = $db->quote($_POST['comment']);
48  } else { $booking->comment = '';
49  }
50  if (isset($_POST['date_wish'])){
51  $booking->date_wish = $db->quote($_POST['date_wish']);
52  }
53  if (isset($_POST['date_alternative'])){
54  $booking->date_alternative = $db->quote($_POST['date_alternative']);
55  }
56  if(!$booking->save($db)){
57  \YAWK\alert::draw("warning", "$lang[ERROR]", "$lang[BOOKING_SAVE_FAILED]","",4200);
58  }
59 }
60 
61 // check _GET var
62 if (isset($_GET['id'])){
63  $booking->loadProperties($db, $_GET['id']);
64  // get logic, a lot of if x then y....
65  $year = date('Y');
66  if ($booking->ip === '::1') {
67  $booking->ip = "::1 (localhost)";
68  }
69  $splitDate_created = \YAWK\sys::splitDate($booking->date_created);
70  $splitDate_wish = \YAWK\sys::splitDate($booking->date_wish);
71  $splitDate_alternative = \YAWK\sys::splitDate($booking->date_alternative);
72  // date created
73  $year_created = $splitDate_created['year'];
74  $day_created = $splitDate_created['day'];
75  $month_created = $splitDate_created['month'];
76  $time_created = $splitDate_created['time'];
77  // date wish
78  $year_wish = $splitDate_wish['year'];
79  $day_wish = $splitDate_wish['day'];
80  $month_wish = $splitDate_wish['month'];
81  $time_wish = $splitDate_wish['time'];
82  // date alternative
83  $year_alt = $splitDate_alternative['year'];
84  $day_alt = $splitDate_alternative['day'];
85  $month_alt = $splitDate_alternative['month'];
86  $time_alt = $splitDate_alternative['time'];
87  // make dates pretty
88  $prettydate_created = "$day_created.$month_created $year, $time_created";
89  $prettydate_wish = "$day_wish.$month_wish, $time_wish ";
90  $prettydate_alternative = "$day_alt.$month_alt, $time_alt ";
91 
92  // if alternative is zero, make it empty for a better tbl view experience
93  if ($prettydate_alternative === "0.00, 00:00 Uhr"){
94  $prettydate_alternative = '&nbsp;';
95  }
96  if ($booking->invited === '1'){
97  $inviteHtml = "<a class=\"btn btn-success\" href=\"index.php?plugin=booking&pluginpage=booking-toggle&id=$booking->id&invite=1\" style=\"float:right;\">
98  <i class=\"fa fa-envelope-o\"></i> &nbsp;$lang[BOOKING_INVITATION_SENT]</a>";
99  }
100  else {
101  $inviteHtml = "<a class=\"btn btn-warning\" href=\"index.php?plugin=booking&pluginpage=booking-toggle&id=$booking->id&invite=1\" style=\"float:right;\">
102  <i class=\"fa fa-envelope-o\"></i> &nbsp;$lang[BOOKING_INVITATION_SEND]</a>";
103  }
104  if ($booking->confirmed === '1'){
105  $confirmedHtml = "<span class='text-success'>$lang[CONFIRMED]</span>";
106  $confirmedIcon = "<i class='fa fa-check'></i>";
107  } else {
108  $confirmedHtml = "<span class='text-warning'>$lang[NOT_CONFIRMED]</span>";
109  $confirmedIcon = "<i class='fa fa-times'></i>";
110  }
111  if ($booking->success === '1'){
112  $confirmedHtml = "<span class='text-info'>$lang[SUCCESSFUL]</span>";
113  $confirmedIcon = "<i class='fa fa-trophy'></i>";
114  }
115  if ($booking->outdated === '1'){
116  $confirmedHtml = "<span class='text-inverse'>$lang[OUTDATED]</span>";
117  }
118  if (!isset($booking->referer)) { $booking->referer = ""; }
119 
120  if ($booking->uid !== '0' && $booking->gid !== '0'){
121  $filename = '../media/images/users/user_'.$booking->name.'.jpg';
122  if (file_exists($filename)){
123  $imgHtml = "<img src=\"$filename\" width=\"180\" class=\"img-thumbnail\">";
124  }
125  else {
126  $imgHtml = "<i class=\"fa fa-user fa-5x\"></i>";
127  }
128  }
129  else {
130  $imgHtml = "<i class=\"fa fa-user fa-5x\"></i>";
131  }
132 ?>
133 
134  <div class="box box-default">
135  <div class="box-body">
136  <div class="row">
137  <div class="col-md-8">
138  <ul class="list-group">
139  <li class="list-group-item"><h4><?php echo "$lang[DETAILS] <small>$lang[OF_THIS_BOOKING]</small>"; ?></h4></li>
140  <li class="list-group-item"><h4><strong><?php echo $booking->name; ?></strong> <?php echo "$lang[SENT_FOLLOWING_BOOKING] :"; ?> <strong><?php echo $prettydate_wish; ?></strong></h4></li>
141  <li class="list-group-item"><i class="fa fa-envelope"></i> &nbsp;<strong><?php echo "<a href=\"mailto:$booking->email\">$booking->email</a>"; ?></strong></li>
142  <li class="list-group-item"><i class="fa fa-phone"></i> &nbsp;<strong><?php echo $booking->phone; ?></strong></li>
143  <li class="list-group-item"><i class="fa fa-clock-o"></i> &nbsp;<strong><?php echo $prettydate_alternative; ?></strong> <small>[alternativ]</small></li>
144  </ul>
145  <ul class="list-group">
146  <li class="list-group-item"><i class="fa fa-comments-o"></i> &nbsp;<strong><?php echo $booking->text; ?></strong></li>
147  </ul>
148  <ul class="list-group">
149  <li class="list-group-item"><h6>sent from<strong>&nbsp;<?php echo $booking->name; ?>&nbsp;</strong>
150  am <?php echo "$prettydate_created $lang[VIA_IP_ADDRESS]"; ?> <?php echo $booking->ip; ?><br><small>
151  <i><?php echo $booking->useragent; ?></i>
152  <br><?php echo $booking->referer; ?></small></h6></li>
153  </ul>
154  <ul class="list-group">
155  <li class="list-group-item">
156  <form class="form-inline" method="post" action="index.php?plugin=booking&pluginpage=booking-edit&id=<?php echo $booking->id; ?>">
157  <label for="cut"><i class="fa fa-scissors"></i>&nbsp;</label>
158  <label for="income">&euro;&nbsp;</label>
159  <input type="text" value="<?php echo $booking->income;?>" size="5" class="form-control" placeholder="150" id="income" name="income">&nbsp;&nbsp;&nbsp;
160  <label for="income"><i class="fa fa-line-chart"></i>&nbsp; </label>
161  <label for="grade"><?php echo "$lang[VOTING]"; ?></label>
162  <select class="form-control" name="grade" id="grade">
163  <option value="0" selected disabled>&nbsp;</option>
164  <option value="1">1</option>
165  <option value="2">2</option>
166  <option value="3">3</option>
167  <option value="4">4</option>
168  <option value="5">5</option>
169  </select>&nbsp;&nbsp;&nbsp;
170  <label for="comment"><i class="fa fa-commenting-o"></i></label>
171  <textarea name="comment" id="comment" class="form-control" cols="46" rows="2"><?php echo $booking->comment;?></textarea>
172  <br>
173  </li>
174  <li class="list-group-item">
175  <label for="date_wish"><?php echo "$lang[EDIT_DATE]"; ?></label>
176  <input type="text" class="form-control" name="date_wish" size="10" id="date_wish" value="<?php echo $booking->date_wish;?>"><br>
177  <label for="date_alternative"><?php echo "$lang[ALT_DATE]"; ?> </label>
178  <input type="text" class="form-control" name="date_alternative" size="10" id="date_alternative" value="<?php echo $booking->date_alternative;?>">
179  <!-- SAVE BUTTON -->
180  <input id="savebutton" class="btn btn-success" type="submit" name="create" style="margin-left:14px;" value="<?php echo $lang['SAVE']; ?>">
181  </form>
182  </li>
183  </ul>
184  </div>
185  <div class="col-md-4">
186  <ul class="list-group">
187  <li class="list-group-item"><?php echo $imgHtml; ?></li>
188  </ul>
189 
190  <ul class="list-group">
191  <li class="list-group-item"><?php echo $confirmedIcon; ?>
192  &nbsp;Status: <h3 style="margin-top:-4%; margin-left: 50%;"><?php echo $confirmedHtml; ?></h3>
193 
194  <li class="list-group-item"><i class="fa fa-trophy"></i>
195  &nbsp;Success: <h3 style="margin-top:-4%; margin-left: 50%;"><?php echo $booking->success; ?></h3>
196  </li>
197  <li class="list-group-item"><i class="fa fa-money"></i>
198  &nbsp;Earned: <h3 style="margin-top:-4%; margin-left: 50%;">&euro;&nbsp;<?php echo $booking->income; ?></h3>
199  </li>
200  <li class="list-group-item"><i class="fa fa-line-chart"></i>
201  &nbsp;Vote: <h3 style="margin-top:-4%; margin-left: 50%;"><?php echo $booking->grade; ?></h3>
202  </li>
203  <li class="list-group-item"><i class="fa fa-heart"></i>
204  &nbsp;Visits:<h3 style="margin-top:-4%; margin-left: 50%;"><?php echo $booking->countVisits($db, $booking->email); ?></h3>
205  </li>
206  <li class="list-group-item"><i class="fa fa-commenting-o"></i>
207  &nbsp;Comment: <h4 style="margin-top:-4%; margin-left: 50%;"><?php echo $booking->comment; ?></h4>
208  </li>
209  </ul>
210  <?php echo $inviteHtml; ?>
211  <a class="btn btn-info" href="index.php?plugin=booking&pluginpage=booking-toggle&toggle=1&id=<?php echo $booking->id; ?>&success=1" style="float:right;">
212  <i class="fa fa-trophy"></i> &nbsp;<?php print $lang['BOOKING_TOGGLE']; ?></a>
213  <a class="btn btn-default" href="index.php?plugin=booking" style="float:right;">
214  <i class="glyphicon glyphicon-backward"></i> &nbsp;<?php print $lang['BACK']; ?></a>
215  </div>
216  </div>
217  </div>
218  </div>
219 <?php
220 }
221 
222 ?>
$filename
Definition: actions.php:10
print $lang['FILEMAN_UPLOAD']
$booking
static draw($type, $title, $text, $redirect, $delay)
Definition: alert.php:30
static inject(array $lang, string $pathToFile)
allow plugins to inject language tags to $lang array
Definition: language.php:439
static splitDate($date)
split a date to month, day, year and time
Definition: sys.php:1502
function a
Definition: browser.js:14
type
Definition: menu-new.php:35
print $_GET['id']
Definition: page-edit.php:357
function i(e, t)
Definition: plyr.js:1
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$template name
print $tourdates date