コード例 #1
0
ファイル: temp.php プロジェクト: cvelayo/worklog
function get_query_strings($user, $month, $day, $year, $s)
{
    global $morningstarts, $morningstarts_minutes;
    $query_strings = array();
    // check to see if the time is really on the next day
    $date = getdate(mktime(0, 0, $s, $month, $day, $year));
    if (hm_before($date, array('hours' => $morningstarts, 'minutes' => $morningstarts_minutes))) {
        $date['hours'] += 24;
    }
    $hour = $date['hours'];
    $minute = $date['minutes'];
    $period = period_index($s);
    $query_strings['new_periods'] = "user={$user}&period={$period}&year={$year}&month={$month}&day={$day}";
    $query_strings['new_times'] = "user={$user}&hour={$hour}&minute={$minute}&year={$year}&month={$month}&day={$day}";
    $query_strings['booking'] = "user={$user}&day={$day}&month={$month}&year={$year}";
    return $query_strings;
}
コード例 #2
0
     $var = "area_max_per_{$interval_type}_enabled";
     ${$var} = !empty(${$var}) ? 1 : 0;
 }
 if (!$area_enable_periods) {
     // Avoid divide by zero errors
     if ($area_res_mins == 0) {
         $valid_resolution = FALSE;
     } else {
         // Check morningstarts, eveningends, and resolution for consistency
         $start_first_slot = $area_morningstarts * 60 + $area_morningstarts_minutes;
         // minutes
         $start_last_slot = $area_eveningends * 60 + $area_eveningends_minutes;
         // minutes
         $start_difference = $start_last_slot - $start_first_slot;
         // minutes
         if (hm_before(array('hours' => $area_eveningends, 'minutes' => $area_eveningends_minutes), array('hours' => $area_morningstarts, 'minutes' => $area_morningstarts_minutes))) {
             $start_difference += SECONDS_PER_HOUR;
         }
         if ($start_difference % $area_res_mins != 0) {
             $valid_resolution = FALSE;
         }
         // Check that the number of slots we now have is no greater than $max_slots
         // defined in the config file - otherwise we won't generate enough CSS classes
         $n_slots = $start_difference / $area_res_mins + 1;
         if ($n_slots > $max_slots) {
             $enough_slots = FALSE;
         }
     }
 }
 // If everything is OK, update the database
 if (FALSE != $valid_email && FALSE != $valid_resolution && FALSE != $enough_slots) {