appointment.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. if ( ! isset( $appointment ) ) {
  3. return;
  4. }
  5. $date = $appointment['date'];
  6. $title = $appointment['title'];
  7. $timeslot = $appointment['timeslot'];
  8. $timeslot_parts = explode( '-', $timeslot );
  9. $timestamp = strtotime($date.' '.$timeslot_parts[0]);
  10. $this_timeslot_timestamp = ( isset($this_timeslot_timestamp) ? $this_timeslot_timestamp : false );
  11. $appt_date_time_before = apply_filters('booked_fe_appt_form_date_time_before', '', $this_timeslot_timestamp, $timeslot, $calendar_id );
  12. $appt_date_time_after = apply_filters( 'booked_fe_appt_form_date_time_after', '', $this_timeslot_timestamp, $timeslot, $calendar_id );
  13. $date_format = get_option('date_format');
  14. $time_format = get_option('time_format');
  15. $only_titles = get_option('booked_show_only_titles', false);
  16. $hide_end_titles = get_option('booked_hide_end_times');
  17. $all_day_text = esc_html__( 'All day', 'booked' );
  18. if ( $only_titles && ! $title || ! $only_titles ) {
  19. if ( $timeslot_parts[0] === '0000' && $timeslot_parts[1] === '2400' ) {
  20. $timeslotText = $all_day_text;
  21. } else {
  22. $timeslotText = date_i18n( $time_format, strtotime( $timeslot_parts[0] ) );
  23. if ( ! $hide_end_titles ) {
  24. $timeslotText .= ' &ndash; '. date_i18n( $time_format, strtotime( $timeslot_parts[1] ) );
  25. }
  26. }
  27. }
  28. if (!empty($calendar_id)): $calendar_term = get_term_by('id',$calendar_id,'booked_custom_calendars'); $calendar_name = '<p class="calendar-name">' . $calendar_term->name . '</p>'; else: $calendar_name = false; endif;
  29. $appt_title = $title ? '<p class="appointment-title">' . $title . '</p>' : '';
  30. $appt_timeslot = $timeslotText ? $timeslotText : '';
  31. $appt_date_name = date_i18n( $date_format, strtotime( $date ) );
  32. ?><div class="booked-appointment-details" data-appt-key="<?php echo $appointment_key; ?>"><?php
  33. echo $appt_date_time_before;
  34. echo $appt_title;
  35. echo $calendar_name;
  36. if ( $appt_timeslot == $all_day_text ):
  37. ?><p class="appointment-info"><i class="booked-icon booked-icon-calendar"></i>&nbsp;&nbsp;&nbsp;<?php echo sprintf( esc_html__( '%s on %s','booked' ), $appt_timeslot, $appt_date_name ); ?></p><?php
  38. else:
  39. ?><p class="appointment-info"><i class="booked-icon booked-icon-calendar"></i>&nbsp;&nbsp;&nbsp;<?php echo sprintf( esc_html__( '%s at %s','booked' ), $appt_date_name, $appt_timeslot ); ?></p><?php
  40. endif;
  41. echo $appt_date_time_after;
  42. ?><input type="hidden" name="appoinment[]" value="<?php echo $appointment_counter; ?>" />
  43. <input type="hidden" name="appoinment_index[]" value="<?php echo $appointment_key; ?>" />
  44. <input type="hidden" name="calendar_id[]" value="<?php echo intval($calendar_id); ?>" />
  45. <input type="hidden" name="title[]" value="<?php echo esc_attr( $title ); ?>" />
  46. <input type="hidden" name="date[]" value="<?php echo date_i18n( 'Y-m-j', strtotime( $date ) ); ?>" />
  47. <input type="hidden" name="timestamp[]" value="<?php echo $timestamp; ?>" />
  48. <input type="hidden" name="timeslot[]" value="<?php echo $timeslot; ?>" />
  49. </div>