YaWK  24.1
Yet another WebKit
booking.php
Go to the documentation of this file.
1 <?php
3 {
4 
5  use YAWK\db;
6  use YAWK\settings;
7 
8  /**
9  * @details<b>Booking Widget of Booking Plugin.</b>
10  *
11  * <p>The widget allows you to embed a booking form onto any page and position you need.
12  * It is useful to collect bookings from your users. For further information see description
13  * of the booking plugin.</p>
14  *
15  *
16  * @author Daniel Retzl <[email protected]>
17  * @copyright 2019 Daniel Retzl
18  * @version 1.0.0
19  * @brief Embed booking plugin on your pages.
20  */
21  class bookingWidget
22  {
23  // BASIC WIDGET SETTINGS
24  /** @param object global widget object data */
25  public $widget = '';
26  /** @param array Form Settings */
27  public $formSettings = '';
28  /** @param string Headline HTML Markup */
29  public $bookingHeadline = '';
30 
31  // FORM SETTINGS
32  /** @param string Heading */
33  public $bookingHeading = '';
34  /** @param string Subtext */
35  public $bookingSubtext = '';
36  /** @param string Headline Prepend Icon */
37  public $bookingIcon = '';
38  /** @param string Email address that will be used as sender */
39  public $bookingFromEmail = '';
40 
41  // FORM FIELDS (required[visible, mandatory] | true[visible, not mandatory] | false[invisible, not mandatory])
42  /** @param string Booking Band Select Field required|true|false */
43  public $bookingBand = '';
44  /** @param string Event Date + Time required|true|false */
45  public $bookingEventDatetime = '';
46  /** @param string Soundcheck Time required|true|false*/
47  public $bookingEventSoundcheck = '';
48  /** @param string Showtime required|true|false*/
49  public $bookingEventShowtime = '';
50  /** @param string How long is the soundcheck time? required|true|false */
51  public $bookingSoundcheckDuration = '';
52  /** @param string How long is the showtime? required|true|false */
53  public $bookingShowtimeDuration = '';
54  /** @param string Booking Location (indoor / outdoor) required|true|false */
55  public $bookingLocation = '';
56  /** @param string Booking Location Type (party / wedding / private society) required|true|false */
57  public $bookingLocationType = '';
58  /** @param string How many people are invited? required|true|false */
59  public $bookingCrowdAmount = '';
60  /** @param string PA available? required|true|false */
61  public $bookingPaAvailable = '';
62  /** @param string Tech guy available? required|true|false */
63  public $bookingTechAvailable = '';
64  /** @param string Overnight possible? required|true|false */
65  public $bookingHotelAvailable = '';
66  /** @param string message / note required|true|false */
67  public $bookingMessage = '';
68  /** @param string email required|true|false */
69  public $bookingEmail = '';
70  /** @param string contact name required|true|false */
71  public $bookingContactName = '';
72  /** @param string contact phone number required|true|false */
73  public $bookingPhone = '';
74  /** @param string how many sets should be played? required|true|false */
75  public $bookingSetAmount = '';
76  /** @param string admin email address where booking will be sent to */
77  public $bookingAdminEmail = '';
78  /** @param string html email true|false */
79  public $bookingHtmlEmail = '';
80 
81 
82  /**
83  * @brief Load all widget settings from database and fill object
84  * @param object $db Database Object
85  * @brief Load all widget settings on object init.
86  */
87  public function __construct(object $db)
88  {
89  // load this widget settings from db
90  $this->widget = new \YAWK\widget();
92  foreach ($settings as $property => $value) {
93  $this->$property = $value;
94  }
95  }
96 
97  /**
98  * @brief Print all object data
99  * @brief (for development and testing purpose)
100  */
101  public function printObject()
102  {
103  echo "<pre>";
104  print_r($this);
105  echo "</pre>";
106  }
107 
108  /**
109  * @brief Init Booking Widget
110  * @brief This method does the setup and embed job
111  * @param object $db db object
112  * @param array $lang language array
113  */
114  public function init($db, $lang)
115  {
116  // set widget obj properties
117  $this->setProperties();
118 
119  // init JS code variable
120  $validateJsCode = "";
121 
122  // check required fields and set validate JS code
123  // name field
124  if ($this->bookingContactName === "required")
125  {
126  $validateJsCode .= "
127  name: {
128  required: true,
129  minlength: 3
130  },";
131  }
132  else
133  {
134  $validateJsCode .= "
135  name: {
136  required: false,
137  minlength: 3
138  },";
139  }
140 
141  // email field
142  if ($this->bookingEmail === "required")
143  {
144  $validateJsCode .= "
145  email: {
146  required: true,
147  email: true,
148  maxlength: 128
149  },";
150  }
151  else
152  {
153  $validateJsCode .= "
154  email: {
155  required: false,
156  email: true,
157  maxlength: 128
158  },";
159  }
160 
161  // phone field
162  if ($this->bookingPhone === "required")
163  { $validateJsCode .= "
164  phone: {
165  required: true,
166  },";
167  }
168 
169  // band select field
170  if ($this->bookingBand === "required")
171  { $validateJsCode .= "
172  band: {
173  required: true,
174  },";
175  }
176 
177  // event date + time
178  if ($this->bookingEventDatetime === "required")
179  { $validateJsCode .= "
180  eventDateTime: {
181  required: true,
182  },";
183  }
184 
185  // soundcheck time
186  if ($this->bookingEventSoundcheck === "required")
187  { $validateJsCode .= "
188  eventSoundcheck: {
189  required: true,
190  },";
191  }
192 
193  // showtime
194  if ($this->bookingEventShowtime === "required")
195  { $validateJsCode .= "
196  eventShowtime: {
197  required: true,
198  },";
199  }
200 
201  // soundcheck duration
202  if ($this->bookingSoundcheckDuration === "required")
203  { $validateJsCode .= "
204  soundcheckDuration: {
205  required: true,
206  },";
207  }
208 
209  // showtime duration
210  if ($this->bookingShowtimeDuration === "required")
211  { $validateJsCode .= "
212  showtimeDuration: {
213  required: true,
214  },";
215  }
216 
217  // location (indoor / outdoor)
218  if ($this->bookingLocation === "required")
219  { $validateJsCode .= "
220  location: {
221  required: true,
222  },";
223  }
224 
225  // location type (birthday, wedding, company event...)
226  if ($this->bookingLocationType === "required")
227  { $validateJsCode .= "
228  locationType: {
229  required: true,
230  },";
231  }
232 
233  // crowd amount (estimated)
234  if ($this->bookingCrowdAmount === "required")
235  { $validateJsCode .= "
236  crowdAmount: {
237  required: true,
238  },";
239  }
240 
241  // PA available?
242  if ($this->bookingPaAvailable === "required")
243  { $validateJsCode .= "
244  paAvailable: {
245  required: true,
246  },";
247  }
248 
249  // tech available?
250  if ($this->bookingTechAvailable === "required")
251  { $validateJsCode .= "
252  techAvailable: {
253  required: true,
254  },";
255  }
256 
257  // hotel / overnight
258  if ($this->bookingHotelAvailable === "required")
259  { $validateJsCode .= "
260  hotelAvailable: {
261  required: true,
262  },";
263  }
264 
265  // message / note
266  if ($this->bookingMessage === "required")
267  { $validateJsCode .= "
268  message: {
269  required: true,
270  },";
271  }
272 
273  // set amount (how many sets should be played)
274  if ($this->bookingSetAmount === "required")
275  { $validateJsCode .= "
276  setAmount: {
277  required: true,
278  },";
279  }
280 
281 
282  // embed required javascripts
283  echo "
284  <!-- bootstrap date-timepicker -->
285  <link type=\"text/css\" href=\"system/engines/datetimepicker/css/bootstrap-datetimepicker.min.css\" rel=\"stylesheet\">
286  <script src=\"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js\"></script>";
287 
288  echo "<script type=\"text/javascript\" src=\"system/engines/datetimepicker/js/bootstrap-datetimepicker.min.js\"></script>
289  <script type=\"text/javascript\" src=\"system/engines/jquery/jquery.validate.min.js\"></script>
290  <script type=\"text/javascript\" src=\"system/widgets/booking/js/booking.js\"></script>
291  <link rel=\"stylesheet\" href=\"system/engines/jquery/timepicker/jquery.timepicker.css\">
292  <script src=\"//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js\"></script>";
293 
294  if (settings::getSetting($db, "frontendLanguage") === "de-DE")
295  {
296  echo "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/locale/de.js\"></script>
297  <script type=\"text/javascript\" src=\"system/engines/jquery/messages_de.min.js\"></script>";
298  }
299 
300 
301  echo "
302  <script type=\"text/javascript\">
303  $(document).ready(function () {
304 
305  var bookingForm = $('#bookingForm');
306  (bookingForm).validate({
307  // initialize the plugin
308  rules: {
309  $validateJsCode
310  },
311  submitHandler: function(){
312  //var data = $(form).serialize();
313  //do your ajax with the data here
314 
315  var type = 'POST';
316  var url = 'system/widgets/booking/js/process-booking-data.php';
317  var thankYouMessage = $('#thankYouMessage');
318 
319  $.ajax({
320  type: type,
321  url: url,
322  data: bookingForm.serialize(), // serializes the form's elements.
323  success: function(data)
324  {
325  // hide form
326  $(bookingForm).hide();
327  // display thank you message
328  thankYouMessage.removeClass('hidden d-none').addClass('animated fadeIn speed6');
329  },
330  error: function (request, status, error)
331  {
332  // error output
333  alert('error: '+data);
334  console.log('ERROR: ajax post failed with error '+data);
335 
336  // shake form
337  $(bookingForm).shake();
338  }
339  });
340  }
341  });
342 
343  $('#eventDateTime').datetimepicker({
344  format: 'YYYY-DD-MM HH:mm',
345  locale: 'de'
346  });
347 
348  $('.timepicker').timepicker({
349  timeFormat: 'HH:mm',
350  interval: 30,
351  startTime: '18:00',
352  dynamic: false,
353  dropdown: true,
354  scrollbar: false
355  });
356  });
357  </script>";
358 
359  // draw headline, if set
360  echo "$this->bookingHeadline<hr>";
361 
362  // draw booking form
363  echo $this->drawFrontendForm($lang);
364 
365  // draw thank you message div (hidden until submit)
366  echo $this->drawThankYouMessage($db, $lang);
367  }
368 
369  /**
370  * @brief Set widget properties from database and fill object params
371  * @brief Load all widget settings.
372  */
373  public function setProperties()
374  {
375  // if a heading is set and not empty
376  if (isset($this->bookingHeading) && (!empty($this->bookingHeading)))
377  {
378  // check if booking icon is set
379  if (isset($this->bookingIcon) && (!empty($this->bookingIcon)))
380  { // add booking icon markup
381  $this->bookingIcon = "<i class=\"".$this->bookingIcon."\"></i>&nbsp;";
382  }
383 
384  // if subtext is set, add <small> subtext to string
385  if (isset($this->bookingSubtext) && (!empty($this->bookingSubtext)))
386  { // build a headline with heading and subtext
387  $this->bookingSubtext = "<small>$this->bookingSubtext</small>";
388  $this->bookingHeadline = "<div id=\"bookingHeading\" class=\"animated fadeIn speed2\"><h1>&nbsp;$this->bookingIcon"."$this->bookingHeading&nbsp;"."$this->bookingSubtext</h1></div>";
389  }
390  else
391  { // headline only - without subtext
392  $this->bookingHeadline = "<h1 class=\"animated fadeIn speed2\">$this->bookingHeading</h1>"; // draw just the heading
393  }
394  }
395  else
396  { // leave empty if it's not set
397  $this->bookingHeadline = '';
398  }
399  }
400 
401  /**
402  * @brief draw (output) thank you message
403  * (will be displayed after successful submit)
404  * @return string html code
405  */
406  public function drawThankYouMessage($db, $lang): string
407  {
408  $hostname = settings::getSetting($db, "host");
409  $html = "";
410  $html .= "
411  <div class=\"hidden d-none\" id=\"thankYouMessage\">
412  <div class=\"col-md-2\">&nbsp;</div>
413  <div class=\"col-md-8 text-center\"><h2>".$lang['BOOKING_THANK_YOU_HEADING']."<br>
414  <small>".$lang['BOOKING_THANK_YOU_SUBLINE']."</small><br><br>
415  <i class=\"fa fa-handshake-o text-muted\"></i></h2>
416  <br><hr><a href=\"".$hostname."\" target=\"_self\">".$lang['BOOKING_BACK']."</a>
417  | <a href=\"booking.html\" target=\"_self\">".$lang['BOOKING_AGAIN']."</a></div>
418  <div class=\"col-md-2\">&nbsp;</div>
419  </div>
420  ";
421  // return html data
422  return $html;
423  }
424 
425  /**
426  * @brief draw (output) html of the frontend form. This is displayed to the user. He will use to place a booking
427  * @return string
428  */
429  public function drawFrontendForm($lang): string
430  {
431  // init form html code markup variable
432  $html = "";
433 
434  $html .= "
435 <form class=\"form\" id=\"bookingForm\" method=\"post\" action=\"\">
436 
437 <div class=\"container-fluid\">
438 <div class=\"row\">
439  <div class=\"col-md-4 animated fadeIn speed3\">
440  <input type=\"hidden\" name=\"adminEmail\" id=\"adminEmail\" value=\"".$this->bookingAdminEmail."\">
441  <input type=\"hidden\" name=\"bookingHtmlEmail\" id=\"bookingHtmlEmail\" value=\"".$this->bookingHtmlEmail."\">";
442 
443  // NAME
444  if ($this->bookingContactName !== "false")
445  {
446  if ($this->bookingContactName === "required")
447  { $requiredMarkup = "*"; }
448  else { $requiredMarkup = ""; }
449 
450  $html .= "
451  <label for=\"name\">".$lang['BOOKING_NAME'].$requiredMarkup."
452  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_NAME']."\"></i>
453  </label>
454  <input type=\"text\" name=\"name\" id=\"name\" class=\"form-control\" placeholder=\"Name / Veranstalter\" autocomplete=\"off\">
455  <br>";
456  }
457 
458  // EMAIL
459  if ($this->bookingEmail !== "false")
460  {
461  if ($this->bookingEmail === "required")
462  { $requiredMarkup = "*"; }
463  else { $requiredMarkup = ""; }
464 
465  $html .= "
466  <label for=\"email\">".$lang['LABEL_BOOKING_EMAIL'].$requiredMarkup."
467  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_EMAIL']."\"></i>
468  </label>
469  <input type=\"text\" name=\"email\" id=\"email\" class=\"form-control\" placeholder=\"[email protected]\" autocomplete=\"off\">
470  <br>";
471  }
472 
473  // PHONE
474  if ($this->bookingPhone !== "false")
475  {
476  if ($this->bookingPhone === "required")
477  { $requiredMarkup = "*"; }
478  else { $requiredMarkup = ""; }
479 
480  $html .= "
481  <label for=\"phone\">".$lang['LABEL_BOOKING_PHONE'].$requiredMarkup."
482  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_PHONE']."\"></i>
483  </label>
484  <input type=\"text\" name=\"phone\" id=\"phone\" class=\"form-control\" placeholder=\"+43 1234 12345678\" autocomplete=\"off\">
485  <br>
486  <div class=\"animated fadeIn speed4 delay-10s\">
487  ".$lang['BOOKING_HELP_TEXT']."
488  </div>";
489 
490  }
491  $html .= "
492 <br><br>
493  </div>
494  <div class=\"col-md-8 animated fadeIn speed4 delay-6s\">
495  <div class=\"row\">
496  <div class=\"col-md-5\">
497  <!-- left -->";
498 
499  // EVENT DATE TIME
500  if ($this->bookingEventDatetime !== "false")
501  {
502  if ($this->bookingEventDatetime === "required")
503  { $requiredMarkup = "*"; }
504  else { $requiredMarkup = ""; }
505 
506  $html .= "
507  <label for=\"eventDateTime\">".$lang['LABEL_BOOKING_EVENTDATETIME'].$requiredMarkup."
508  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_DATETIME']."\"></i>
509  </label>
510  <input type=\"text\" name=\"eventDateTime\" autocomplete=\"off\" id=\"eventDateTime\" class=\"form-control\" placeholder=\"".$lang['BOOKING_HELP_DATE_AND_TIME']."\">
511  <br>";
512  }
513 
514  // SHOWTIME Duration
515  if ($this->bookingShowtimeDuration !== "false")
516  {
517  if ($this->bookingShowtimeDuration === "required")
518  { $requiredMarkup = "*"; }
519  else { $requiredMarkup = ""; }
520 
521  $html .= "
522  <label for=\"showtimeDuration\">".$lang['LABEL_BOOKING_SHOWTIME_DURATION'].$requiredMarkup."
523  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_SHOWTIME_DURATION']."\"></i>
524  </label>
525  <select name=\"showtimeDuration\" id=\"showtimeDuration\" class=\"form-control\">
526  <option value=\"\">".$lang['BOOKING_PLEASE_SELECT']."</option>
527  <option value=\"".$lang['BOOKING_30MIN']."\">".$lang['BOOKING_30MIN']."</option>
528  <option value=\"".$lang['BOOKING_45MIN']."\">".$lang['BOOKING_45MIN']."</option>
529  <option value=\"".$lang['BOOKING_1H']."\">".$lang['BOOKING_1H']."</option>
530  <option value=\"".$lang['BOOKING_2H']."\">".$lang['BOOKING_2H']."</option>
531  <option value=\"".$lang['BOOKING_3H']."\">".$lang['BOOKING_3H']."</option>
532  <option value=\"".$lang['BOOKING_4H']."\">".$lang['BOOKING_4H']."</option>
533  <option value=\"".$lang['BOOKING_NOT_SPECIFIED']."\">".$lang['BOOKING_NOT_SPECIFIED']."</option>
534  </select><br>";
535  }
536 
537  // SOUNDCHECK TIME
538  if ($this->bookingEventSoundcheck !== "false")
539  {
540  if ($this->bookingEventSoundcheck === "required")
541  { $requiredMarkup = "*"; }
542  else { $requiredMarkup = ""; }
543 
544  $html .= "
545  <label for=\"eventSoundcheck\">".$lang['LABEL_BOOKING_SOUNDCHECK'].$requiredMarkup."
546  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_SOUNDCHECK']."\"></i>
547  </label>
548  <input type=\"text\" name=\"eventSoundcheck\" autocomplete=\"off\" id=\"eventSoundcheck\" class=\"form-control timepicker\" placeholder=\"".$lang['BOOKING_HELP_SELECT_TIME']."\">
549  <br>";
550  }
551 
552  // SOUNDCHECK Duration
553  if ($this->bookingSoundcheckDuration !== "false")
554  {
555  if ($this->bookingSoundcheckDuration === "required")
556  { $requiredMarkup = "*"; }
557  else { $requiredMarkup = ""; }
558 
559  $html .= "
560  <label for=\"soundcheckDuration\">".$lang['LABEL_BOOKING_SOUNDCHECK_DURATION'].$requiredMarkup."
561  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_SOUNDCHECK_DURATION']."\"></i>
562  </label>
563  <select name=\"soundcheckDuration\" id=\"soundcheckDuration\" class=\"form-control\">
564  <option value=\"\">".$lang['BOOKING_PLEASE_SELECT']."</option>
565  <option value=\"".$lang['BOOKING_30MIN']."\">".$lang['BOOKING_30MIN']."</option>
566  <option value=\"".$lang['BOOKING_45MIN']."\">".$lang['BOOKING_45MIN']."</option>
567  <option value=\"".$lang['BOOKING_60MIN']."\">".$lang['BOOKING_60MIN']."</option>
568  <option value=\"".$lang['BOOKING_NOT_SPECIFIED']."\">".$lang['BOOKING_NOT_SPECIFIED']."</option>
569  </select>
570  <br>";
571  }
572 
573  // SHOWTIME Time
574  if ($this->bookingEventShowtime !== "false")
575  {
576  if ($this->bookingEventShowtime === "required")
577  { $requiredMarkup = "*"; }
578  else { $requiredMarkup = ""; }
579 
580  $html .= "
581  <label for=\"eventShowtime\">".$lang['LABEL_BOOKING_SHOWTIME'].$requiredMarkup."
582  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_SHOWTIME']."\"></i>
583  </label>
584  <input type=\"text\" name=\"eventShowtime\" autocomplete=\"off\" id=\"eventShowtime\" class=\"form-control timepicker\" placeholder=\"".$lang['BOOKING_HELP_SELECT_TIME']."\">
585  <br>";
586  }
587 
588  // SET AMOUNT
589  if ($this->bookingSetAmount !== "false")
590  {
591  if ($this->bookingSetAmount === "required")
592  { $requiredMarkup = "*"; }
593  else { $requiredMarkup = ""; }
594 
595  $html .= "
596  <label for=\"setAmount\">".$lang['LABEL_BOOKING_SET_AMOUNT'].$requiredMarkup."
597  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_SET_AMOUNT']."\"></i>
598  </label>
599  <select name=\"setAmount\" id=\"setAmount\" class=\"form-control\">
600  <option value=\"\">".$lang['BOOKING_PLEASE_SELECT']."</option>
601  <option value=\"1\">1</option>
602  <option value=\"2\">2</option>
603  <option value=\"3\">3</option>
604  <option value=\"4\">4</option>
605  <option value=\"".$lang['BOOKING_NOT_SPECIFIED']."\">".$lang['BOOKING_NOT_SPECIFIED']."</option>
606  </select>";
607  }
608 
609  $html .= "</div>
610  <div class=\"col-md-7 animated fadeIn speed4 delay-8s\">
611  <!-- right -->";
612 
613  // BAND SELECT FIELD
614  /*
615  if ($this->bookingBand !== "false")
616  {
617  if ($this->bookingBand === "required")
618  { $requiredMarkup = "*"; }
619  else { $requiredMarkup = ""; }
620 
621  $html .= "
622  <label for=\"band\">".$lang['LABEL_BOOKING_BAND'].$requiredMarkup."
623  <i class=\"fa fa-question-circle-o text-info\" data-placement=\"auto right\" data-toggle=\"tooltip\" title=\"Bitte geben Sie hier an, welche Band sie buchen m&ouml;chten.\"></i>
624  </label>
625  <select name=\"band\" id=\"band\" class=\"form-control\">
626  <option value=\"\">".$lang['BOOKING_PLEASE_SELECT']."</option>
627  <option value=\"Your Band here\">Your Band here</option>
628  <option value=\"".$lang['BOOKING_NOT_SPECIFIED']."\">".$lang['BOOKING_NOT_SPECIFIED']."</option>
629  </select>
630  <br>";
631  }
632  */
633 
634  // EVENT TYPE
635  if ($this->bookingLocationType !== "false")
636  {
637  if ($this->bookingLocationType === "required")
638  { $requiredMarkup = "*"; }
639  else { $requiredMarkup = ""; }
640 
641  $html .= "
642  <label for=\"locationType\">".$lang['LABEL_BOOKING_LOCATION_TYPE'].$requiredMarkup."
643  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_LOCATION_TYPE']."\"></i>
644  </label>
645  <select name=\"locationType\" id=\"locationType\" class=\"form-control\">
646  <option value=\"\">".$lang['BOOKING_PLEASE_SELECT']."</option>
647  <option value=\"".$lang['BOOKING_PRIVATE_EVENT']."\">".$lang['BOOKING_PRIVATE_EVENT']."</option>
648  <option value=\"".$lang['BOOKING_COMPANY_EVENT']."\">".$lang['BOOKING_COMPANY_EVENT']."</option>
649  <option value=\"".$lang['BOOKING_MARRIAGE_EVENT']."\">".$lang['BOOKING_MARRIAGE_EVENT']."</option>
650  <option value=\"".$lang['BOOKING_BIG_EVENT']."\">".$lang['BOOKING_BIG_EVENT']."</option>
651  <option value=\"".$lang['BOOKING_FESTIVAL_EVENT']."\">".$lang['BOOKING_FESTIVAL_EVENT']."</option>
652  <option value=\"".$lang['BOOKING_BENEFIT_EVENT']."\">".$lang['BOOKING_BENEFIT_EVENT']."</option>
653  <option value=\"".$lang['BOOKING_NOT_SPECIFIED']."\">".$lang['BOOKING_NOT_SPECIFIED']."</option>
654  </select>
655  <br>";
656  }
657 
658  // LOCATION
659  if ($this->bookingLocation !== "false")
660  {
661  if ($this->bookingLocation === "required")
662  { $requiredMarkup = "*"; }
663  else { $requiredMarkup = ""; }
664 
665  $html .= "
666  <label for=\"location\">".$lang['LABEL_BOOKING_LOCATION'].$requiredMarkup."
667  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_LOCATION']."\"></i>
668  </label>
669  <select name=\"location\" id=\"location\" class=\"form-control\">
670  <option value=\"\">".$lang['BOOKING_PLEASE_SELECT']."</option>
671  <option value=\"".$lang['BOOKING_INDOOR']."\">".$lang['BOOKING_INDOOR']."</option>
672  <option value=\"".$lang['BOOKING_OUTDOOR']."\">".$lang['BOOKING_OUTDOOR']."</option>
673  <option value=\"".$lang['BOOKING_NOT_SPECIFIED']."\">".$lang['BOOKING_NOT_SPECIFIED']."</option>
674  </select>
675  <br>";
676  }
677 
678  // SIZE (CROWD AMOUNT)
679  if ($this->bookingCrowdAmount !== "false")
680  {
681  if ($this->bookingCrowdAmount === "required")
682  { $requiredMarkup = "*"; }
683  else { $requiredMarkup = ""; }
684 
685  $html .= "
686  <label for=\"crowdAmount\">".$lang['LABEL_BOOKING_CROWD_AMOUNT'].$requiredMarkup."
687  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_CROWD_AMOUNT']."\"></i>
688  </label>
689  <select name=\"crowdAmount\" id=\"crowdAmount\" class=\"form-control\">
690  <option value=\"\">".$lang['BOOKING_PLEASE_SELECT']."</option>
691  <option value=\"".$lang['BOOKING_50']."\">".$lang['BOOKING_50']."</option>
692  <option value=\"".$lang['BOOKING_100']."\">".$lang['BOOKING_100']."</option>
693  <option value=\"".$lang['BOOKING_200']."\">".$lang['BOOKING_200']."</option>
694  <option value=\"".$lang['BOOKING_500']."\">".$lang['BOOKING_500']."</option>
695  <option value=\"".$lang['BOOKING_1000']."\">".$lang['BOOKING_1000']."</option>
696  <option value=\"".$lang['BOOKING_BIGGER_1000']."\">".$lang['BOOKING_BIGGER_1000']."</option>
697  <option value=\"".$lang['BOOKING_NOT_SPECIFIED']."\">".$lang['BOOKING_NOT_SPECIFIED']."</option>
698  </select>
699  <br>";
700  }
701 
702  // PA AVAILABLE
703  if ($this->bookingPaAvailable !== "false")
704  {
705  if ($this->bookingPaAvailable === "required")
706  { $requiredMarkup = "*"; }
707  else { $requiredMarkup = ""; }
708 
709  $html .= "
710  <div class=\"text-right\">
711  &nbsp;&nbsp;<i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_PA']."\"></i>
712  <label for=\"paAvailable\">".$lang['LABEL_BOOKING_PA_AVAILABLE'].$requiredMarkup."&nbsp;&nbsp;</label>
713  <input type=\"radio\" name=\"paAvailable\" value=\"".$lang['BOOKING_YES']."\"> ".$lang['BOOKING_YES']."
714  &nbsp;&nbsp;<input type=\"radio\" name=\"paAvailable\" value=\"".$lang['BOOKING_NO']."\"> ".$lang['BOOKING_NO']."
715  </div><hr>";
716  }
717 
718  // Tech AVAILABLE
719  if ($this->bookingTechAvailable !== "false")
720  {
721  if ($this->bookingTechAvailable === "required")
722  { $requiredMarkup = "*"; }
723  else { $requiredMarkup = ""; }
724 
725  $html .= "
726  <div class=\"text-right\">
727  &nbsp;&nbsp;<i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_TECH']."\"></i>
728  <label for=\"techAvailable\">".$lang['LABEL_BOOKING_TECH_AVAILABLE'].$requiredMarkup."&nbsp;&nbsp;</label>
729  <input type=\"radio\" name=\"techAvailable\" value=\"".$lang['BOOKING_YES']."\"> ".$lang['BOOKING_YES']."
730  &nbsp;&nbsp;<input type=\"radio\" name=\"techAvailable\" value=\"".$lang['BOOKING_NO']."\"> ".$lang['BOOKING_NO']."
731  </div><hr>";
732  }
733 
734  // Hotel AVAILABLE
735  if ($this->bookingHotelAvailable !== "false")
736  {
737  if ($this->bookingHotelAvailable === "required")
738  { $requiredMarkup = "*"; }
739  else { $requiredMarkup = ""; }
740 
741  $html .= "
742  <div class=\"text-right\">
743  &nbsp;&nbsp;<i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_HOTEL']."\"></i>
744  <label for=\"hotelAvailable\">".$lang['LABEL_BOOKING_HOTEL_AVAILABLE'].$requiredMarkup."&nbsp;&nbsp;</label>
745  <input type=\"radio\" name=\"hotelAvailable\" value=\"".$lang['BOOKING_YES']."\"> ".$lang['BOOKING_YES']."
746  &nbsp;&nbsp;<input type=\"radio\" name=\"hotelAvailable\" value=\"".$lang['BOOKING_NO']."\"> ".$lang['BOOKING_NO']."
747  </div>";
748  }
749 
750  $html .="</div>
751  </div>";
752 
753  // MESSAGE
754  if ($this->bookingMessage !== "false")
755  {
756  if ($this->bookingMessage === "required")
757  { $requiredMarkup = "*"; }
758  else { $requiredMarkup = ""; }
759 
760  $html .= "
761  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_MSG']."\"></i>
762  <label for=\"message\">".$lang['LABEL_BOOKING_MESSAGE'].$requiredMarkup."
763  </label>
764  <textarea name=\"message\" id=\"message\" class=\"form-control\" rows=\"4\" autocomplete=\"off\"></textarea>
765  <br>";
766  }
767 
768  $html .="
769  <i class=\"fa fa-question-circle-o text-info\" data-toggle=\"tooltip\" title=\"".$lang['BOOKING_HELP_MAILCOPY']."\"></i>
770  <label for=\"mailCopy\">".$lang['BOOKING_COPY']." &nbsp;
771  <input type=\"checkbox\" name=\"mailCopy\" value=\"true\" id=\"mailCopy\" aria-checked=\"true\" checked></label>
772  <button type=\"submit\" id=\"submitbutton\" class=\"btn btn-success pull-right hvr-grow\" style=\"margin-top:1%;\" contenteditable=\"false\"><i class=\"fa fa-paper-plane-o\"></i> &nbsp;".$lang['BOOKING_SUBMIT_BTN']."</button>
773  <input type=\"hidden\" name=\"sent\" value=\"1\">";
774 
775 
776  $html .= "</div></div></div>
777  <!-- </div> -->
778  </form>";
779  return $html;
780  } /* EOFunction getTable */
781  }
782 }
Embed booking plugin on your pages.
Definition: booking.php:21
drawThankYouMessage($db, $lang)
draw (output) thank you message (will be displayed after successful submit)
Definition: booking.php:405
__construct(object $db)
Load all widget settings from database and fill object.
Definition: booking.php:86
init($db, $lang)
Init Booking Widget.
Definition: booking.php:113
printObject()
Print all object data.
Definition: booking.php:100
setProperties()
Set widget properties from database and fill object params.
Definition: booking.php:372
drawFrontendForm($lang)
draw (output) html of the frontend form. This is displayed to the user. He will use to place a bookin...
Definition: booking.php:428
Mysqli database class; returns db connection object.
Definition: db.php:16
Settings class: get and set YaWK system settings.
Definition: settings.php:9
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
Widgets are small, useful tools that you can include everywhere in your website.
Definition: widget.php:22
getWidgetSettingsArray($db)
Get widget settings and return it as array.
Definition: widget.php:69
$value
Definition: booking.php:10
print $lang['SETUP']
Definition: booking.php:69
if(isset($_POST['save'])) $settings