X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/fc0eb9d0e457236fc7a588b8be95a6829354dd25..ee5e708bbc30bbca24d77c4e3b0e75214c1296f8:/week.php?ds=inline diff --git a/week.php b/week.php index 4de08c99..f4bde294 100644 --- a/week.php +++ b/week.php @@ -33,6 +33,7 @@ import('form.Table'); import('form.TextField'); import('ttUserHelper'); import('ttTeamHelper'); +import('ttWeekViewHelper'); import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); @@ -73,7 +74,7 @@ if ($user->isPluginEnabled('cf')) { $smarty->assign('custom_fields', $custom_fields); } -// TODO: how is this plugin supposed to work for week view? +// Use Monthly Quotas plugin, if applicable. if ($user->isPluginEnabled('mq')){ require_once('plugins/MonthlyQuota.class.php'); $quota = new MonthlyQuota(); @@ -110,10 +111,10 @@ $cl_note = trim($request->getParameter('note')); // Get the data we need to display week view. // Get column headers, which are day numbers in month. -$dayHeaders = ttTimeHelper::getDayHeadersForWeek($startDate->toString(DB_DATEFORMAT)); -$lockedDays = ttTimeHelper::getLockedDaysForWeek($startDate->toString(DB_DATEFORMAT)); +$dayHeaders = ttWeekViewHelper::getDayHeadersForWeek($startDate->toString(DB_DATEFORMAT)); +$lockedDays = ttWeekViewHelper::getLockedDaysForWeek($startDate->toString(DB_DATEFORMAT)); // Build data array for the table. Format is described in the function.. -$dataArray = ttTimeHelper::getDataForWeekView($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT), $dayHeaders); +$dataArray = ttWeekViewHelper::getDataForWeekView($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT), $dayHeaders); // Build day totals (total durations for each day in week). $dayTotals = ttTimeHelper::getDayTotals($dataArray, $dayHeaders); @@ -128,7 +129,7 @@ class LabelCellRenderer extends DefaultCellRenderer { // Special handling for not billable entries. if ($row > 0) { $row_id = $table->getValueAtName($row,'row_id'); - $billable = ttTimeHelper::parseFromWeekViewRow($row_id, 'bl'); + $billable = ttWeekViewHelper::parseFromWeekViewRow($row_id, 'bl'); if (!$billable) { $this->setOptions(array('style'=>'color: red;')); // TODO: style it properly in CSS. } @@ -179,8 +180,7 @@ if ($user->canManageTeam()) { } // Create week_durations table. -$table = new Table('week_durations'); -// $table->setIAScript('markModified'); // TODO: write a script to mark table or particular cells as modified. +$table = new Table('week_durations', 'week_view_table'); $table->setTableOptions(array('width'=>'100%','cellspacing'=>'1','cellpadding'=>'3','border'=>'0')); $table->setRowOptions(array('class'=>'tableHeaderCentered')); $table->setData($dataArray); @@ -310,8 +310,8 @@ if ($request->isPost()) { // Process the table of values. if ($err->no()) { - // Obtain values. Perhaps, it's best to iterate throigh posted parameters one by one, - // see if anything changed, and apply one change at a time until we see an error. + // Obtain values. Iterate through posted parameters one by one, + // see if value changed, apply one change at a time until we see an error. $result = true; $rowNumber = 0; // Iterate through existing rows. @@ -346,14 +346,15 @@ if ($request->isPost()) { $fields = array(); $fields['row_id'] = $dataArray[$rowNumber]['row_id']; if (!$fields['row_id']) { - // Special handling for row 0, a new entry. Need to construct row_id. + // Special handling for row 0, a new entry. Need to construct new row_id. $record = array(); $record['client_id'] = $cl_client; $record['billable'] = $cl_billable ? '1' : '0'; $record['project_id'] = $cl_project; $record['task_id'] = $cl_task; $record['cf_1_value'] = $cl_cf_1; - $fields['row_id'] = ttTimeHelper::makeRecordIdentifier($record).'_0'; + $fields['row_id'] = ttWeekViewHelper::makeRowIdentifier($record).'_0'; // TODO: Handle a possible conflict with already existing row... + // We may have to increment the suffix here. $fields['note'] = $cl_note; } $fields['day_header'] = $dayHeader;