} else { $first = ($row['morningstarts'] * 60 + $row['morningstarts_minutes']) * 60; $last = ($row['eveningends'] * 60 + $row['eveningends_minutes']) * 60 + $row['resolution']; // If the end of the day is the same as or before the start time, then it's really on the next day if ($first >= $last) { $last += SECONDS_PER_DAY; } } $row['first'] = $first; $row['last'] = $last; // We don't show the all day checkbox if it's going to result in bookings that // contravene the policy - ie if max_duration is enabled and an all day booking // would be longer than the maximum duration allowed. $row['show_all_day'] = $is_admin || !$row['max_duration_enabled'] || ($row['enable_periods'] && $row['max_duration_periods'] >= count($periods) || !$row['enable_periods'] && $row['max_duration_secs'] >= $last - $first); // Clean up the settings, getting rid of any nulls and casting boolean fields into bools $row = clean_area_row($row); // Now assign the row to the area $areas[$row['id']] = $row; } } if (isset($id) && !isset($copy)) { if ($edit_type == "series") { $token = "editseries"; } else { $token = "editentry"; } } else { if (isset($copy)) { if ($edit_type == "series") { $token = "copyseries"; } else {
} } // Get the details of all the enabled areas $areas = array(); $sql = "SELECT id, area_name, resolution, default_duration, enable_periods,\r\n morningstarts, morningstarts_minutes, eveningends , eveningends_minutes\r\n FROM {$tbl_area}\r\n WHERE disabled=0\r\n ORDER BY area_name"; $res = sql_query($sql); if ($res) { for ($i = 0; $row = sql_row_keyed($res, $i); $i++) { $areas[$row['id']] = $row; // The following config settings aren't yet per-area, but we'll treat them as if // they are to make it easier to change them to per-area settings in the future. $areas[$row['id']]['max_duration_enabled'] = $max_duration_enabled; $areas[$row['id']]['max_duration_secs'] = $max_duration_secs; $areas[$row['id']]['max_duration_periods'] = $max_duration_periods; // Clean up the settings, getting rid of any nulls and casting boolean fields into bools $areas[$row['id']] = clean_area_row($areas[$row['id']]); // Generate some derived settings $areas[$row['id']]['max_duration_qty'] = $areas[$row['id']]['max_duration_secs']; toTimeString($areas[$row['id']]['max_duration_qty'], $areas[$row['id']]['max_duration_units']); } } ?> <script type="text/javascript"> //<![CDATA[ var currentArea = <?php echo $area_id; ?> ; var areas = [];