function get_day_view_event_data($date, $location = DEFAULT_LOCATION_NAME) { // Get the event data for the selected day, month, year and location. global $location_db_name; list($year, $month, $day) = explode("-", $date); $query = "SELECT *\n\t\t\t\t\t\tFROM " . DATE_TIME_SCHEDULE_TABLE . ", " . BOOKING_EVENT_TABLE . " WHERE\n\t\t\t\t\t\t" . DATE_TIME_SCHEDULE_TABLE . "." . $location_db_name[$location] . " != 0 AND\n\t\t\t\t\t\t" . DATE_TIME_SCHEDULE_TABLE . "." . $location_db_name[$location] . " = " . BOOKING_EVENT_TABLE . ".event_id AND\n\t\t\t\t\t\t" . DATE_TIME_SCHEDULE_TABLE . ".schedule_date_time >= '" . $date . " 00:00:00' AND\n\t\t\t\t\t\t" . DATE_TIME_SCHEDULE_TABLE . ".schedule_date_time <= '" . $date . " 23:59:59'\n\t\t\t\t\t\tORDER BY " . DATE_TIME_SCHEDULE_TABLE . ".schedule_date_time"; //echo $query."<br /><br />"; $result = wrap_db_query($query); $db_num_rows = wrap_db_num_rows($result); // Event Row Data Assoc. Array // $event_row_data['display_time'] = 'db_row_id|row_span|start_time|end_time'; $event_row_data = array(); global $event_row_data; // Get the Display Times and Number of Rows $data_display_times = get_times_in_range(MIN_BOOKING_HOUR, MAX_BOOKING_HOUR, BOOKING_TIME_INTERVAL, true); $number_of_display_time_rows = count($data_display_times); // Create an Assoc. Date array for index lookup. $display_time_lookup = array(); for ($i = 0; $i < $number_of_display_time_rows; $i++) { $display_time_lookup[$data_display_times[$i]] = $i; } // $event_row_data array - build out the schedule time blocks foreach ($data_display_times as $display_time) { $event_row_data[$display_time] = ''; } reset($data_display_times); if (!$result) { //echo "No Database Events / Results<br />"; return false; } // Go thru the database $result data and fill out the $event_row_data array. $previous_event_id = 0; $row_span = 0; $row = 0; $event = array(); //echo "<h1>TESTING</h1>"; for ($row = 0; $row <= $db_num_rows; $row++) { // define db variables $event = wrap_db_fetch_array($result); $db_event_id = $event['event_id']; //echo "ID: $db_event_id<br />"; list($db_starting_date, $db_starting_time) = explode(" ", $event['schedule_date_time']); list($db_hr, $db_min, $db_sec) = explode(":", $db_starting_time); $db_starting_time = sprintf("%02d", $db_hr) . ':' . sprintf("%02d", $db_min); if ($previous_event_id != $db_event_id || $previous_event_id == 0) { // event_id has changed / or first event_id if ($previous_event_id != 0) { // if not first id, then define $event_row_data array // place the event data into $event_row_data: 'db_row_id|row_span|start_time|end_time' $event_row_data[$event_start_time] = $event_start_db_row_id . "|" . $row_span . "|" . $event_start_time . "|" . $data_display_times[$display_time_lookup[$event_start_time] + $row_span]; // echo values for testing //echo "Define Event -> " . $event_row_data[$event_start_time] . "<br />"; // initialize the row_span for the new event $row_span = 1; } // Mark the event starting time and db row id to be used to data_seeking //echo "<strong>Mark Start:</strong> ".$db_starting_time.", ".$row.", ".$db_event_id."<br />"; $event_start_time = $db_starting_time; // mark the starting time $event_start_db_row_id = $row; // mark the starting db row $row_span = 1; } else { // same event_id // Set the 'row_span' for the spanning cells of the event to zero ('row_span' = 0) $event_row_data[$db_starting_time] = 0; //echo "<strong>Same Event ID:</strong> ".$db_starting_time.", ".$row.", ".$db_event_id."<br />"; $row_span++; } $previous_event_id = $db_event_id; } // end of while // Display/Check the $event_row_data for errors //echo "<br />"; //foreach ($data_display_times as $display_time) { // echo $display_time." Event Row Data: ".$event_row_data[$display_time]."<br />"; //} // return the resulting data object return $result; }
*/ if (!$is_admin && empty($_POST['add_event']) && empty($_POST['check_event']) && $page_error_message == '') { ?> <br> <b>Please check your details</b><br> <br> Your booking will not be made until you press the 'Add Booking Event' button.<br> You will then receive your booking confirmation on the following page (if the slot is still available).<br> <br> Please check the details of your booking below:<br> <br> <?php } // Define some arrays for the Input Form below. // Valid booking times in 24 hour format; includes max and min hours. $valid_booking_times = get_times_in_range(MIN_BOOKING_HOUR, MAX_BOOKING_HOUR, BOOKING_TIME_INTERVAL, true); // display the form, new want or problem ?> <!-- add_event.php --> <br /> <div align="center"> <!-- Table for Right Border Section --> <table cellspacing="0" cellpadding="0" border="0"> <tr><td align="right" valign="top">
<strong>Booked Dates<br />and Time Slots:</strong><br /> Slot Duration: <?php echo BOOKING_TIME_INTERVAL; ?> min.<br /><br /> <?php if (count($display_dates_and_time_ranges) > 0) { ?> <table cellspacing="1" cellpadding="0" border="0"> <?php reset($display_dates_and_time_ranges); foreach ($display_dates_and_time_ranges as $display_date_and_time) { list($date, $time_range) = explode(" ", $display_date_and_time); list($from_time, $to_time) = explode("-", $time_range); $time_slots = get_times_in_range($from_time, $to_time, DISPLAY_TIME_INTERVAL); if (count($time_slots) > 1) { $trash = array_pop($time_slots); } foreach ($time_slots as $time_slot) { ?> <tr><td align="left" valign="top" nowrap="nowrap" class="FontSoftSmall"><?php echo short_date_format($date); ?> </td> <td align="left" valign="top" nowrap="nowrap" class="FontSoftSmall"><?php echo format_time_to_ampm($time_slot); ?> </td> <td align="left" valign="top" nowrap="nowrap" class="FontSoftSmall"> <a href="<?php
href="<?php echo href_link(FILENAME_DAY_VIEW, 'date=' . NEXT_DAY_DATE . '&print_view=1&' . make_hidden_fields_workstring(array('view', 'loc')), 'NONSSL'); ?> "><img src="<?php echo DIR_WS_IMAGES; ?> /next.gif" alt="Next Day" /></a></td> </tr> <?php $count = 0; $width_length = 5; $data_display_times = array(); $data_display_times = get_times_in_range(MIN_BOOKING_HOUR, MAX_BOOKING_HOUR, BOOKING_TIME_INTERVAL); array_pop($data_display_times); list($year, $month, $day) = explode("-", SELECTED_DATE); foreach ($data_display_times as $display_time) { //$row_data = $data_sel_day_data[$hour]; list($hour, $min, $sec) = explode(":", $display_time); $time_str = sprintf("%02d:%02d", $hour, $min); $std_time_str = $time_str; // To Cater for the AM PM Hour display if (DEFINE_AM_PM) { // Note that the time placed in the HREF will be in 24 hour $time_str = format_time_to_ampm($time_str); } $count++; $color_ind = count % 2; ?>
<?php include_once "./includes/application_top.php"; $times = get_times_in_range("08:00", "22:44", 14, false); var_dump($times); include_once "application_bottom.php";