- static function getGroupedRecordsForInterval($user_id, $start_date, $end_date) {
- // Start by obtaining all records in interval.
- // Then, iterate through them to build an array.
- $records = ttTimeHelper::getRecordsForInterval($user_id, $start_date, $end_date);
- $groupedRecords = array();
- foreach ($records as $record) {
- $record_identifier_no_suffix = ttTimeHelper::makeRecordIdentifier($record);
- // Handle potential multiple records with the same attributes by using a numerical suffix.
- $suffix = 0;
- $record_identifier = $record_identifier_no_suffix.'_'.$suffix;
- while (!empty($groupedRecords[$record_identifier][$record['date']])) {
- $suffix++;
- $record_identifier = $record_identifier_no_suffix.'_'.$suffix;
- }
- $groupedRecords[$record_identifier][$record['date']] = array('id'=>$record['id'], 'duration'=>$record['duration']);
- $groupedRecords[$record_identifier]['client'] = $record['client'];
- $groupedRecords[$record_identifier]['cf_1_value'] = $record['cf_1_value'];
- $groupedRecords[$record_identifier]['project'] = $record['project'];
- $groupedRecords[$record_identifier]['task'] = $record['task'];
- $groupedRecords[$record_identifier]['billable'] = $record['billable'];
- }
-
- return $groupedRecords;
- }
-
- // getDataForWeekView - builds an array to render a table of durations for week view.
- static function getDataForWeekView($user_id, $start_date, $end_date) {
+ //
+ // Description of $dataArray format that the function returns.
+ // $dataArray = array(
+ // array( // Row 0.
+ // 'row_id' => 'cl:546,bl:1,pr:23456,ts:27464,cf_1:7623_0', // Row identifier. See ttTimeHelper::makeRecordIdentifier().
+ // 'label' => 'Anuko - Time Tracker - Coding', // Human readable label for the row describing what this time entry is for.
+ // 'day_0' => array('control_id' => '0_day_0', 'duration' => '00:00'), // control_id is row_id plus day header for column.
+ // 'day_1' => array('control_id' => '0_day_1', 'duration' => '01:00'),
+ // 'day_2' => array('control_id' => '0_day_2', 'duration' => '02:00'),
+ // 'day_3' => array('control_id' => '0_day_3', 'duration' => null),
+ // 'day_4' => array('control_id' => '0_day_4', 'duration' => '04:00'),
+ // 'day_5' => array('control_id' => '0_day_5', 'duration' => '04:00'),
+ // 'day_6' => array('control_id' => '0_day_6', 'duration' => null)
+ // ),
+ // array( // Row 1.
+ // 'row_id' => 'bl:0_0',
+ // 'label' => '', // In this case the label is empty as we don't have anything to put into it, as we only have billable flag.
+ // 'day_0' => array('control_id' => '1_day_0', 'duration' => null),
+ // 'day_1' => array('control_id' => '1_day_1', 'duration' => '01:30'),
+ // 'day_2' => array('control_id' => '1_day_2', 'duration' => null),
+ // 'day_3' => array('control_id' => '1_day_3', 'duration' => '02:30'),
+ // 'day_4' => array('control_id' => '1_day_4', 'duration' => '04:00'),
+ // 'day_5' => array('control_id' => '1_day_5', 'duration' => null),
+ // 'day_6' => array('control_id' => '1_day_6', 'duration' => null)
+ // )
+ // );
+ static function getDataForWeekView($user_id, $start_date, $end_date, $dayHeaders) {