function calendar_get_available_times_on_date

6.x calendar.module calendar_get_available_times_on_date($available_slots, $faculty_user_id, $year, $month, $day, $event_type_cid = 0)
2 calls to calendar_get_available_times_on_date()
calendar_display_schedule_appointment_page in modules/calendar/calendar.module
This is the page which lets students schedule an appointment with the faculty member supplied in the user_id.
calendar_schedule_appointment_confirm_form_validate in modules/calendar/calendar.module
This is our last chance to validate the form before saving.

File

modules/calendar/calendar.module, line 2464

Code

function calendar_get_available_times_on_date($available_slots, $faculty_user_id, $year, $month, $day, $event_type_cid = 0) {

  $rtn = array();


  foreach ($available_slots [$year][$month][$day] as $slot) {
    $begin_hm = $slot ['begin_hm'];

    $tz = $slot ['tz'];
    $student_timezone = fp_get_user_timezone();

    // Okay, here is where we actually convert FROM the faculty timezone into the STUDENT's timezone!
    $offset = get_timezone_offset($student_timezone, $tz);
    $test_time = strtotime("$year-$month-$day $begin_hm");

    $adjusted_student_tz_time = $test_time - $offset;
    $student_begin_hm = date("g:ia", $adjusted_student_tz_time);

    $url = fp_url("schedule-appointment/$faculty_user_id/confirm", "event_type_cid=$event_type_cid&date=$year-$month-$day&begin_hm=$student_begin_hm");

    //$rtn .= "<a href='$url' class='select-time'>
    //            $student_begin_hm
    //         </a>";

    $rtn [$student_begin_hm]['html'] = "
        <a href='$url' class='select-time'>
                $student_begin_hm
             </a>   ";


  } // foreach

  return $rtn;
}