Esempio n. 1
0
        $endtime = mktime($eveningends, $eveningends_minutes, 0, $month, $day, $year, is_dst($month, $day, $year, $eveningends));
        $endtime += $resolution;
        // add on the duration (in seconds) of the last slot as
        // $eveningends and $eveningends_minutes specify the
        // beginning of the last slot
        // We need to set the duration and units because they are needed for email notifications
        $duration = $endtime - $starttime;
        $dur_units = "seconds";
        // Convert them into something sensible (but don't translate because
        // that's done later)
        toTimeString($duration, $dur_units, FALSE);
    }
} else {
    // Get the duration in seconds
    $dur_seconds = $duration;
    $enable_periods ? fromPeriodString($period, $dur_seconds, $dur_units) : fromTimeString($dur_seconds, $dur_units);
    if (!$twentyfourhour_format) {
        if (isset($ampm) && $ampm == "pm" && $hour < 12) {
            $hour += 12;
        }
        if (isset($ampm) && $ampm == "am" && $hour > 11) {
            $hour -= 12;
        }
    }
    $starttime = mktime($hour, $minute, 0, $month, $day, $year, is_dst($month, $day, $year, $hour));
    $endtime = mktime($hour, $minute, 0, $month, $day, $year, is_dst($month, $day, $year, $hour)) + $dur_seconds;
    // Round down the starttime and round up the endtime to the nearest slot boundaries
    $am7 = mktime($morningstarts, $morningstarts_minutes, 0, $month, $day, $year, is_dst($month, $day, $year, $morningstarts));
    $starttime = round_t_down($starttime, $resolution, $am7);
    $endtime = round_t_up($endtime, $resolution, $am7);
    // If they asked for 0 minutes, and even after the rounding the slot length is still
     }
     if ($area_morning_ampm == "am" && $area_morningstarts > 11) {
         $area_morningstarts -= 12;
     }
 }
 if (!empty($area_evening_ampm)) {
     if ($area_evening_ampm == "pm" && $area_eveningends < 12) {
         $area_eveningends += 12;
     }
     if ($area_evening_ampm == "am" && $area_eveningends > 11) {
         $area_eveningends -= 12;
     }
 }
 // Convert the book ahead times into seconds
 fromTimeString($area_min_ba_value, $area_min_ba_units);
 fromTimeString($area_max_ba_value, $area_max_ba_units);
 // If we are using periods, round these down to the nearest whole day
 // (anything less than a day is meaningless when using periods)
 if ($area_enable_periods) {
     if (isset($area_min_ba_value)) {
         $area_min_ba_value -= $area_min_ba_value % SECONDS_PER_DAY;
     }
     if (isset($area_max_ba_value)) {
         $area_max_ba_value -= $area_max_ba_value % SECONDS_PER_DAY;
     }
 }
 // Convert booleans into 0/1 (necessary for PostgreSQL)
 $area_disabled = !empty($area_disabled) ? 1 : 0;
 $area_def_duration_all_day = !empty($area_def_duration_all_day) ? 1 : 0;
 $area_min_ba_enabled = !empty($area_min_ba_enabled) ? 1 : 0;
 $area_max_ba_enabled = !empty($area_max_ba_enabled) ? 1 : 0;
Esempio n. 3
0
     }
 }
 if (!empty($area_evening_ampm)) {
     if ($area_evening_ampm == "pm" && $area_eveningends < 12) {
         $area_eveningends += 12;
     }
     if ($area_evening_ampm == "am" && $area_eveningends > 11) {
         $area_eveningends -= 12;
     }
 }
 // Convert the book ahead times into seconds
 fromTimeString($area_min_create_ahead_value, $area_min_create_ahead_units);
 fromTimeString($area_max_create_ahead_value, $area_max_create_ahead_units);
 fromTimeString($area_min_delete_ahead_value, $area_min_delete_ahead_units);
 fromTimeString($area_max_delete_ahead_value, $area_max_delete_ahead_units);
 fromTimeString($area_max_duration_value, $area_max_duration_units);
 // If we are using periods, round these down to the nearest whole day
 // (anything less than a day is meaningless when using periods)
 if ($area_enable_periods) {
     $vars = array('area_min_create_ahead_value', 'area_max_create_ahead_value', 'area_min_delete_ahead_value', 'area_max_delete_ahead_value');
     foreach ($vars as $var) {
         if (isset(${$var})) {
             ${$var} -= ${$var} % SECONDS_PER_DAY;
         }
     }
 }
 // Convert booleans into 0/1 (necessary for PostgreSQL)
 $vars = array('area_disabled', 'area_def_duration_all_day', 'area_min_create_ahead_enabled', 'area_max_create_ahead_enabled', 'area_min_delete_ahead_enabled', 'area_max_delete_ahead_enabled', 'area_max_duration_enabled', 'area_private_enabled', 'area_private_default', 'area_private_mandatory', 'area_approval_enabled', 'area_reminders_enabled', 'area_enable_periods', 'area_confirmation_enabled', 'area_confirmed_default');
 foreach ($interval_types as $interval_type) {
     $vars[] = "area_max_per_{$interval_type}_enabled";
 }