You are here

function _timefield_weekly_summary_explode_items in Timefield 1.0.x

Same name and namespace in other branches
  1. 7 timefield.module \_timefield_weekly_summary_explode_items()

Helper function to explode all items in a timefield value array so that we can sort across multivalue fields

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

File

./timefield.module, line 455
Contains timefield.module.

Code

function _timefield_weekly_summary_explode_items(&$items) {
  $new_array = array();
  foreach ($items as $item) {
    foreach (array_keys(_timefield_weekly_summary_days()) as $day) {
      if ($item->{$day}) {
        $ar = array(
          'label' => isset($item->label) ? $item->label : '',
          'mon' => FALSE,
          'tue' => FALSE,
          'wed' => FALSE,
          'thu' => FALSE,
          'fri' => FALSE,
          'sat' => FALSE,
          'sun' => FALSE,
          'value' => $item->value,
          'value2' => $item->value2,
        );
        $ar[$day] = TRUE;
        $new_array[] = $ar;
      }
    }
  }

  // Sort our new array.
  uasort($new_array, '_timefield_weekly_summary_time_sort');
  $items = $new_array;
}