-// Get column headers.
-$dayHeaders = ttTimeHelper::getDayHeadersForWeek($startDate->toString(DB_DATEFORMAT));
-
-// TODO: replace these two sample arrays with real data.
-$durations_with_labels = array(
- array( // Row 0.
- 'id' => 'something goes here too', // Row identifier.
- 'label' => 'This is a label for row 0',
- 'day_0' => array('id' => '0_0', 'duration' => '00:00'),
- 'day_1' => array('id' => '0_1', 'duration' => '01:00'),
- 'day_2' => array('id' => '0_2', 'duration' => '02:00'),
- 'day_3' => array('id' => '0_3', 'duration' => null),
- 'day_4' => array('id' => '0_4', 'duration' => '04:00')
- ),
- array( // Row 1.
- 'label' => 'This is a label for row 1',
- 'day_0' => array('id' => '1_0', 'duration' => '00:30'),
- 'day_1' => array('id' => '1_1', 'duration' => '01:30'),
- 'day_2' => array('id' => '1_2', 'duration' => '02:30'),
- )
-);
-
-$totals = array(
- 'label' => 'Total:',
- 'day_0' => '00:30',
- 'day_1' => '02:30',
- 'day_2' => '04:30',
- 'day_3' => null,
- 'day_4' => '04:00',
- 'day_5' => null,
- 'day_6' => null
-);
-
-// Define rendering class for a label field to the left of durations.
-class LabelCellRenderer extends DefaultCellRenderer {
- function render(&$table, $value, $row, $column, $selected = false) {
- $this->setOptions(array('width'=>200,'valign'=>'middle'));
- $this->setValue(htmlspecialchars($value));
- return $this->toString();
- }
-}
-
-// Define rendering class for a single cell for time entry in week view table.
-class TimeCellRenderer extends DefaultCellRenderer {
- function render(&$table, $value, $row, $column, $selected = false) {
- $field_name = $table->getValueAtName($row,$column)['id']; // Our text field names (and ids) are like x_y (row_column).
- $field = new TextField($field_name);
- $field->setFormName($table->getFormName());
- $field->setSize(2);
- $field->setValue($table->getValueAt($row,$column)['duration']);
- $this->setValue($field->getHtml());
- return $this->toString();
- }
-}
-
-
-
-
-
-
-//$durations = ttTimeHelper::getDurationsForWeek($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT));
-
-
-
-$groupedRecords = ttTimeHelper::getGroupedRecordsForInterval($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT));
-
-
-
-
-
-$dayTotals = ttTimeHelper::getGroupedRecordsTotals($groupedRecords);
-