You are here

function _timefield_weekly_summary_build_time_column in Timefield 7

Same name and namespace in other branches
  1. 1.0.x timefield.module \_timefield_weekly_summary_build_time_column()

Helper function to build the time column for the minical table.

1 call to _timefield_weekly_summary_build_time_column()
timefield_weekly_summary_build_rows in ./timefield.module
Add rows to the table

File

./timefield.module, line 1477
Defines a Field API field for time

Code

function _timefield_weekly_summary_build_time_column($settings, $start_times = array()) {
  $time_array = array();
  $start = timefield_time_to_integer($settings['absolute_start']);
  $end = timefield_time_to_integer($settings['absolute_end']);
  $total_range = $end - $start;
  $step_amount = $settings['range'] * 60;
  $steps = ceil($total_range / $step_amount);
  for ($index = 0; $index < $steps; $index++) {
    if ($index == 0) {
      $current = $start;
    }
    $time_array[$current] = array(
      'start' => $current,
      'stop' => $current + $step_amount,
      'display' => timefield_integer_to_time($settings['column_format'], $current) . ' - ' . timefield_integer_to_time($settings['column_format'], $current + $step_amount),
      'last_row' => $index + 1 == $steps ? TRUE : FALSE,
    );
    $current += $step_amount;
  }
  return $time_array;
}