YaWK  24.1
Yet another WebKit
YAWK\WIDGETS\BOOKING\FORM\bookingWidget Class Reference

Embed booking plugin on your pages. More...

Public Member Functions

 __construct (object $db)
 Load all widget settings from database and fill object. More...
 
 drawFrontendForm ($lang)
 draw (output) html of the frontend form. This is displayed to the user. He will use to place a booking More...
 
 drawThankYouMessage ($db, $lang)
 draw (output) thank you message (will be displayed after successful submit) More...
 
 init ($db, $lang)
 Init Booking Widget. More...
 
 printObject ()
 Print all object data. More...
 
 setProperties ()
 Set widget properties from database and fill object params. More...
 

Public Attributes

 $bookingAdminEmail = ''
 
 $bookingBand = ''
 
 $bookingContactName = ''
 
 $bookingCrowdAmount = ''
 
 $bookingEmail = ''
 
 $bookingEventDatetime = ''
 
 $bookingEventShowtime = ''
 
 $bookingEventSoundcheck = ''
 
 $bookingFromEmail = ''
 
 $bookingHeading = ''
 
 $bookingHeadline = ''
 
 $bookingHotelAvailable = ''
 
 $bookingHtmlEmail = ''
 
 $bookingIcon = ''
 
 $bookingLocation = ''
 
 $bookingLocationType = ''
 
 $bookingMessage = ''
 
 $bookingPaAvailable = ''
 
 $bookingPhone = ''
 
 $bookingSetAmount = ''
 
 $bookingShowtimeDuration = ''
 
 $bookingSoundcheckDuration = ''
 
 $bookingSubtext = ''
 
 $bookingTechAvailable = ''
 
 $formSettings = ''
 
 $widget = ''
 

Detailed Description

Embed booking plugin on your pages.

Booking Widget of Booking Plugin.

The widget allows you to embed a booking form onto any page and position you need. It is useful to collect bookings from your users. For further information see description of the booking plugin.

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0

Definition at line 20 of file booking.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::__construct ( object  $db)

Load all widget settings from database and fill object.

Parameters
object$dbDatabase Object

Load all widget settings on object init.

Definition at line 86 of file booking.php.

88  {
89  // load this widget settings from db
90  $this->widget = new \YAWK\widget();
91  $settings = $this->widget->getWidgetSettingsArray($db);
92  foreach ($settings as $property => $value) {
93  $this->$property = $value;
94  }
$value
Definition: booking.php:10
if(isset($_POST['save'])) $settings

References $db, $settings, $value, and YAWK\widget\getWidgetSettingsArray().

Member Function Documentation

◆ drawFrontendForm()

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::drawFrontendForm (   $lang)

draw (output) html of the frontend form. This is displayed to the user. He will use to place a booking

Returns
string

Definition at line 428 of file booking.php.

429  : 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;
print $lang['SETUP']
Definition: booking.php:69

References $lang.

Referenced by YAWK\WIDGETS\BOOKING\FORM\bookingWidget\init().

◆ drawThankYouMessage()

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::drawThankYouMessage (   $db,
  $lang 
)

draw (output) thank you message (will be displayed after successful submit)

Returns
string html code

Definition at line 405 of file booking.php.

406  : 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;
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470

References $db, $lang, and YAWK\settings\getSetting().

Referenced by YAWK\WIDGETS\BOOKING\FORM\bookingWidget\init().

◆ init()

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::init (   $db,
  $lang 
)

Init Booking Widget.

This method does the setup and embed job

Parameters
object$dbdb object
array$langlanguage array

Definition at line 113 of file booking.php.

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);
drawThankYouMessage($db, $lang)
draw (output) thank you message (will be displayed after successful submit)
Definition: booking.php:405
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

References $db, $lang, YAWK\WIDGETS\BOOKING\FORM\bookingWidget\drawFrontendForm(), YAWK\WIDGETS\BOOKING\FORM\bookingWidget\drawThankYouMessage(), YAWK\settings\getSetting(), and YAWK\WIDGETS\BOOKING\FORM\bookingWidget\setProperties().

◆ printObject()

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::printObject ( )

Print all object data.

(for development and testing purpose)

Definition at line 100 of file booking.php.

102  {
103  echo "<pre>";
104  print_r($this);
105  echo "</pre>";

◆ setProperties()

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::setProperties ( )

Set widget properties from database and fill object params.

Load all widget settings.

Definition at line 372 of file booking.php.

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  }

Referenced by YAWK\WIDGETS\BOOKING\FORM\bookingWidget\init().

Member Data Documentation

◆ $bookingAdminEmail

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingAdminEmail = ''
Parameters
stringadmin email address where booking will be sent to

Definition at line 76 of file booking.php.

◆ $bookingBand

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingBand = ''
Parameters
stringBooking Band Select Field required|true|false

Definition at line 42 of file booking.php.

◆ $bookingContactName

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingContactName = ''
Parameters
stringcontact name required|true|false

Definition at line 70 of file booking.php.

◆ $bookingCrowdAmount

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingCrowdAmount = ''
Parameters
stringHow many people are invited? required|true|false

Definition at line 58 of file booking.php.

◆ $bookingEmail

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingEmail = ''
Parameters
stringemail required|true|false

Definition at line 68 of file booking.php.

◆ $bookingEventDatetime

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingEventDatetime = ''
Parameters
stringEvent Date + Time required|true|false

Definition at line 44 of file booking.php.

◆ $bookingEventShowtime

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingEventShowtime = ''
Parameters
stringShowtime required|true|false

Definition at line 48 of file booking.php.

◆ $bookingEventSoundcheck

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingEventSoundcheck = ''
Parameters
stringSoundcheck Time required|true|false

Definition at line 46 of file booking.php.

◆ $bookingFromEmail

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingFromEmail = ''
Parameters
stringEmail address that will be used as sender

Definition at line 38 of file booking.php.

◆ $bookingHeading

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingHeading = ''
Parameters
stringHeading

Definition at line 32 of file booking.php.

◆ $bookingHeadline

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingHeadline = ''
Parameters
stringHeadline HTML Markup

Definition at line 28 of file booking.php.

◆ $bookingHotelAvailable

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingHotelAvailable = ''
Parameters
stringOvernight possible? required|true|false

Definition at line 64 of file booking.php.

◆ $bookingHtmlEmail

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingHtmlEmail = ''
Parameters
stringhtml email true|false

Definition at line 78 of file booking.php.

◆ $bookingIcon

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingIcon = ''
Parameters
stringHeadline Prepend Icon

Definition at line 36 of file booking.php.

◆ $bookingLocation

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingLocation = ''
Parameters
stringBooking Location (indoor / outdoor) required|true|false

Definition at line 54 of file booking.php.

◆ $bookingLocationType

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingLocationType = ''
Parameters
stringBooking Location Type (party / wedding / private society) required|true|false

Definition at line 56 of file booking.php.

◆ $bookingMessage

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingMessage = ''
Parameters
stringmessage / note required|true|false

Definition at line 66 of file booking.php.

◆ $bookingPaAvailable

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingPaAvailable = ''
Parameters
stringPA available? required|true|false

Definition at line 60 of file booking.php.

◆ $bookingPhone

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingPhone = ''
Parameters
stringcontact phone number required|true|false

Definition at line 72 of file booking.php.

◆ $bookingSetAmount

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingSetAmount = ''
Parameters
stringhow many sets should be played? required|true|false

Definition at line 74 of file booking.php.

◆ $bookingShowtimeDuration

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingShowtimeDuration = ''
Parameters
stringHow long is the showtime? required|true|false

Definition at line 52 of file booking.php.

◆ $bookingSoundcheckDuration

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingSoundcheckDuration = ''
Parameters
stringHow long is the soundcheck time? required|true|false

Definition at line 50 of file booking.php.

◆ $bookingSubtext

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingSubtext = ''
Parameters
stringSubtext

Definition at line 34 of file booking.php.

◆ $bookingTechAvailable

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$bookingTechAvailable = ''
Parameters
stringTech guy available? required|true|false

Definition at line 62 of file booking.php.

◆ $formSettings

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$formSettings = ''
Parameters
arrayForm Settings

Definition at line 26 of file booking.php.

◆ $widget

YAWK\WIDGETS\BOOKING\FORM\bookingWidget::$widget = ''
Parameters
objectglobal widget object data

Definition at line 24 of file booking.php.


The documentation for this class was generated from the following file: