/**
  * @brief Renders the HTML and prints it directly.
  *
  * @param string $id The HTML id attribute for the text input, this is also set as the name attribute.
  * @param string $desc Optional description, shown as label for the checkbox.
  * @return void
  */
 public static function render($id, $checked = false, $desc = '')
 {
     $attrs = array('id' => $id, 'value' => '1', 'checked' => $checked);
     $checkbox = new BTCInputCheckbox($attrs);
     if (!empty($desc)) {
         $out = '<fieldset>';
         $out .= '<legend class="screen-reader-text"><span>' . $desc . '</span></legend>';
         $label = new BTCFormLabel(array(), $desc, $checkbox);
         $out .= $label->render(false);
         $out .= '</fieldset>';
         echo $out;
     } else {
         $checkbox->render();
     }
 }
 /**
  * Creates the meta box for the short description.
  *
  * The short description textarea box uses the post excerpt to store a short
  * description of the event.
  */
 public static function btb_event_short_desc_box($post)
 {
     $event = btb_get_event($post->ID);
     $short_desc_label = new BTCFormLabel(array('htmlClasses' => 'screen-reader-text', 'for' => 'excerpt'), esc_html__('Short description', 'bt-booking'));
     $short_desc_area = new BTCFormTextarea(array('id' => 'excerpt', 'cols' => 40, 'rows' => 1), $event->short_desc);
     $short_desc_label->render();
     $short_desc_area->render();
     echo '<p>' . esc_html__('The short description will be used for displaying events on summary pages as well as the description for the Schema.org structured data. Some themes might use it also for the meta description tag. If the short description is empty and a description page is set, BTBooking will use the excerpt of the description page if one is available.', 'bt-booking') . '</p>';
 }
 /**
  * Displays the shortcode content for the Bootstrap 3 style.
  *
  * @param string $input The input string, can be empty.
  * @param int $bookingid The ID of the BTB_Booking to process.
  * @param array $atts The shortcode attributes. See class description for explanation.
  */
 public static function bs3_style_filter($input, $bookingid, array $atts)
 {
     $ret = $input;
     $ret .= '<div id="btb_checkout_table">';
     // START CREATING FORM
     if (!empty($atts['headline'])) {
         $ret .= '<h3>' . $atts['headline'] . '</h3>';
     }
     $ret .= '<form id="btb_checkout_form" method="post" onSubmit="return checkForm()">';
     $ret .= wp_nonce_field('btb_checkout_data', 'btb_checkout_nonce', true, false);
     $ret .= '<input type="hidden" value="' . $bookingid . '" id="btb_checkout_bookingid" name="btb_checkout_bookingid">';
     $ret .= '<input type="hidden" value="false" id="btb_checkout_cancel" name="btb_checkout_cancel">';
     $ret .= '<div class="row btb_checkout_row">';
     $formLabel = new BTCFormLabel(array('for' => 'btb_checkout_title'), __('Form of address', 'bt-booking'));
     $formSelect = new BTCFormSelect(array('mr' => __('Mr.', 'bt-booking'), 'mrs' => __('Mrs.', 'bt-booking')), array('id' => 'btb_checkout_title'), array('htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-2">' . $formLabel->render(false) . '<br>' . $formSelect->render(false) . '</div>';
     $firstNameLabel = new BTCFormLabel(array('for' => 'btb_checkout_first_name'), __('First name', 'bt-booking') . '<span style="color:red">*</span>');
     $firstNameInput = new BTCInputText(array('id' => 'btb_checkout_first_name', 'required' => true, 'htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-5">' . $firstNameLabel->render(false) . $firstNameInput->render(false) . '</div>';
     $lastNameLabel = new BTCFormLabel(array('for' => 'btb_checkout_last_name'), __('Last name', 'bt-booking') . '<span style="color:red">*</span>');
     $lastNameInput = new BTCInputText(array('id' => 'btb_checkout_last_name', 'required' => true, 'htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-5">' . $lastNameLabel->render(false) . $lastNameInput->render(false) . '</div>';
     $ret .= '</div>';
     $ret .= '<div class="row btb_checkout_row">';
     $addressLabel = new BTCFormLabel(array('for' => 'btb_checkout_address'), __('Address', 'bt-booking') . '<span style="color:red">*</span>');
     $addressInput = new BTCInputText(array('id' => 'btb_checkout_address', 'required' => true, 'htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-12">' . $addressLabel->render(false) . $addressInput->render(false) . '</div>';
     $ret .= '</div>';
     $ret .= '<div class="row btb_checkout_row">';
     $plzLabel = new BTCFormLabel(array('for' => 'btb_checkout_zip'), __('Postal code', 'bt-booking') . '<span style="color:red">*</span>');
     $plzInput = new BTCInputText(array('id' => 'btb_checkout_zip', 'required' => true, 'htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-3">' . $plzLabel->render(false) . $plzInput->render(false) . '</div>';
     $cityLabel = new BTCFormLabel(array('for' => 'btb_checkout_city'), __('City', 'bt-booking') . '<span style="color:red">*</span>');
     $cityInput = new BTCInputText(array('id' => 'btb_checkout_city', 'required' => true, 'htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-4">' . $cityLabel->render(false) . $cityInput->render(false) . '</div>';
     $countryLabel = new BTCFormLabel(array('for' => 'btb_checkout_country'), __('Country', 'bt-booking') . '<span style="color:red">*</span>');
     $countrySelect = new BTCFormSelect(BTBookingCountries::get_countries(), array('id' => 'btb_checkout_country', 'htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-5">' . $countryLabel->render(false) . '<br>' . $countrySelect->render(false) . '</div>';
     $ret .= '</div>';
     $ret .= '<div class="row btb_checkout_row">';
     $phoneLabel = new BTCFormLabel(array('for' => 'btb_checkout_phone'), __('Phone number', 'bt-booking') . '<span style="color:red">*</span>');
     $phoneInput = new BTCInputText(array('id' => 'btb_checkout_phone', 'required' => true, 'pattern' => '^[+0123456789][\\/\\-\\d\\s]*', 'htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-6">' . $phoneLabel->render(false) . $phoneInput->render(false) . '</div>';
     $emailLabel = new BTCFormLabel(array('for' => 'btb_checkout_mail'), __('E-mail address', 'bt-booking') . '<span style="color:red">*</span>');
     $emailInput = new BTCInputText(array('id' => 'btb_checkout_mail', 'required' => true, 'htmlClasses' => 'form-control'));
     $ret .= '<div class="form-group col-md-6">' . $emailLabel->render(false) . $emailInput->render(false) . '</div>';
     $ret .= '</div>';
     $ret .= '<div class="row btb_checkout_row"><div class="col-md-12">';
     $ret .= '<label for="btb_checkout_notes">' . __('Booking notes', 'bt-booking') . '</label><textarea style="width:100%" rows=5 id="btb_checkout_notes" name="btb_checkout_notes" placeholder="' . __('Notes for your booking', 'bt-booking') . '"></textarea>';
     $ret .= '</div></div>';
     $info = get_option('btb_checkout_info', '');
     if (!empty($info)) {
         $ret .= '<div class="row btb_checkout_row"><div class="col-md-12"><div id="btb_checkout_info">' . $info . '</div></div></div>';
     }
     if (get_option('btb_checkout_require_terms', 0)) {
         $ret .= '<div class="row btb_checkout_row"><div class="col-md-12"><fieldset><label for="btb_checkout_terms_accepted"><input type="checkbox" id="btb_checkout_terms_accepted" name="btb_checkout_terms_accepted" value="1" required></input>' . get_option('btb_checkout_require_text', '') . '</label></fieldset></div></div>';
     }
     $ret .= '<div class="row btb_checkout_row"><div class="col-md-12"><div id="error_message_container" style="display:none"></div></div></div>';
     $ret .= '<div class="btb_checkout_row">';
     $ret .= '<button style="float:right" type="submit" class="btn btn-primary btn-sm">' . get_option('btb_checkout_book_now_text', __('Book now', 'bt-booking')) . '</button>';
     $ret .= '<button formnovalidate onClick="cancelBooking()" style="float:left" type="submit" class="btn btn-warning btn-sm">' . __('Cancel booking', 'bt-booking') . '</button>';
     $ret .= '</div>';
     $ret .= '</form>';
     // END CREATING FORM
     $ret .= '</div>';
     // END CONTAINER
     return $ret;
 }