projects
/
timetracker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
posaune
[timetracker.git]
/
week.php
diff --git
a/week.php
b/week.php
index
6cb6f28
..
9af3564
100644
(file)
--- a/
week.php
+++ b/
week.php
@@
-58,6
+58,9
@@
if (!$user->behalf_id && !$user->can('track_own_time') && !$user->adjustBehalfId
// End of access checks.
$showClient = $user->isPluginEnabled('cl');
// End of access checks.
$showClient = $user->isPluginEnabled('cl');
+$trackingMode = $user->getTrackingMode();
+$showProject = MODE_PROJECTS == $trackingMode || MODE_PROJECTS_AND_TASKS == $trackingMode;
+$showTask = MODE_PROJECTS_AND_TASKS == $trackingMode;
$showFiles = $user->isPluginEnabled('at');
// Initialize and store date in session.
$showFiles = $user->isPluginEnabled('at');
// Initialize and store date in session.
@@
-140,29
+143,33
@@
else
// Build day totals (total durations for each day in week).
$dayTotals = ttWeekViewHelper::getDayTotals($dataArray, $dayHeaders);
// Build day totals (total durations for each day in week).
$dayTotals = ttWeekViewHelper::getDayTotals($dataArray, $dayHeaders);
+$showWeekNote = $user->isOptionEnabled('week_note');
+$showWeekNotes = $user->isOptionEnabled('week_notes');
+
// Define rendering class for a label field to the left of durations.
class LabelCellRenderer extends DefaultCellRenderer {
function render(&$table, $value, $row, $column, $selected = false) {
global $user;
// Define rendering class for a label field to the left of durations.
class LabelCellRenderer extends DefaultCellRenderer {
function render(&$table, $value, $row, $column, $selected = false) {
global $user;
+ $showNotes = $user->isOptionEnabled('week_notes');
$this->setOptions(array('width'=>200,'valign'=>'middle'));
// Special handling for a new week entry (row 0, or 0 and 1 if we show notes).
if (0 == $row) {
$this->setOptions(array('style'=>'text-align: center; font-weight: bold; vertical-align: top;'));
$this->setOptions(array('width'=>200,'valign'=>'middle'));
// Special handling for a new week entry (row 0, or 0 and 1 if we show notes).
if (0 == $row) {
$this->setOptions(array('style'=>'text-align: center; font-weight: bold; vertical-align: top;'));
- } else if ($
user->isPluginEnabled('wvns')
&& (1 == $row)) {
+ } else if ($
showNotes
&& (1 == $row)) {
$this->setOptions(array('style'=>'text-align: right; vertical-align: top;'));
$this->setOptions(array('style'=>'text-align: right; vertical-align: top;'));
- } else if ($
user->isPluginEnabled('wvns')
&& (0 != $row % 2)) {
+ } else if ($
showNotes
&& (0 != $row % 2)) {
$this->setOptions(array('style'=>'text-align: right;'));
}
// Special handling for not billable entries.
$this->setOptions(array('style'=>'text-align: right;'));
}
// Special handling for not billable entries.
- $ignoreRow = $
user->isPluginEnabled('wvns') ? 1 : 0;
+ $ignoreRow = $
showNotes ? 1 : 0;
if ($row > $ignoreRow) {
$row_id = $table->getValueAtName($row,'row_id');
$billable = ttWeekViewHelper::parseFromWeekViewRow($row_id, 'bl');
if (!$billable) {
if ($row > $ignoreRow) {
$row_id = $table->getValueAtName($row,'row_id');
$billable = ttWeekViewHelper::parseFromWeekViewRow($row_id, 'bl');
if (!$billable) {
- if (($
user->isPluginEnabled('wvns') && (0 == $row % 2)) || !$user->isPluginEnabled('wvns')
) {
+ if (($
showNotes && (0 == $row % 2)) || !$showNotes
) {
$this->setOptions(array('style'=>'color: red;')); // TODO: style it properly in CSS.
}
}
$this->setOptions(array('style'=>'color: red;')); // TODO: style it properly in CSS.
}
}
@@
-176,6
+183,7
@@
class LabelCellRenderer extends DefaultCellRenderer {
class WeekViewCellRenderer extends DefaultCellRenderer {
function render(&$table, $value, $row, $column, $selected = false) {
global $user;
class WeekViewCellRenderer extends DefaultCellRenderer {
function render(&$table, $value, $row, $column, $selected = false) {
global $user;
+ $showNotes = $user->isOptionEnabled('week_notes');
$field_name = $table->getValueAt($row,$column)['control_id']; // Our text field names (and ids) are like x_y (row_column).
$field = new TextField($field_name);
$field_name = $table->getValueAt($row,$column)['control_id']; // Our text field names (and ids) are like x_y (row_column).
$field = new TextField($field_name);
@@
-186,11
+194,11
@@
class WeekViewCellRenderer extends DefaultCellRenderer {
$field->setFormName($table->getFormName());
$field->setStyle('width: 60px;'); // TODO: need to style everything properly, eventually.
// Provide visual separation for new entry row.
$field->setFormName($table->getFormName());
$field->setStyle('width: 60px;'); // TODO: need to style everything properly, eventually.
// Provide visual separation for new entry row.
- $rowToSeparate = $
user->isPluginEnabled('wvns')
? 1 : 0;
+ $rowToSeparate = $
showNotes
? 1 : 0;
if ($rowToSeparate == $row) {
$field->setStyle('width: 60px; margin-bottom: 40px');
}
if ($rowToSeparate == $row) {
$field->setStyle('width: 60px; margin-bottom: 40px');
}
- if ($
user->isPluginEnabled('wvns')
) {
+ if ($
showNotes
) {
if (0 == $row % 2) {
$field->setValue($table->getValueAt($row,$column)['duration']); // Duration for even rows.
} else {
if (0 == $row % 2) {
$field->setValue($table->getValueAt($row,$column)['duration']); // Duration for even rows.
} else {
@@
-330,7
+338,7
@@
if ($custom_fields && $custom_fields->fields[0]) {
$form->addInput(array('type'=>'combobox','name'=>'cf_1',
'style'=>'width: 250px;',
'value'=>$cl_cf_1,
$form->addInput(array('type'=>'combobox','name'=>'cf_1',
'style'=>'width: 250px;',
'value'=>$cl_cf_1,
- 'data'=>
$custom_fields->options
,
+ 'data'=>
CustomFields::getOptions($custom_fields->fields[0]['id'])
,
'empty'=>array(''=>$i18n->get('dropdown.select'))));
}
}
'empty'=>array(''=>$i18n->get('dropdown.select'))));
}
}
@@
-380,7
+388,7
@@
if ($request->isPost()) {
$control_id = $rowNumber.'_'.$dayHeader;
// Handle durations and comments in separate blocks of code.
$control_id = $rowNumber.'_'.$dayHeader;
// Handle durations and comments in separate blocks of code.
- if (!$
user->isPluginEnabled('wvns')
|| (0 == $rowNumber % 2)) {
+ if (!$
showWeekNotes
|| (0 == $rowNumber % 2)) {
// Handle durations row here.
// Obtain existing and posted durations.
// Handle durations row here.
// Obtain existing and posted durations.
@@
-419,7
+427,7
@@
if ($request->isPost()) {
// Note: no need to check for a possible conflict with an already existing row
// because we are doing an insert that does not affect already existing data.
// Note: no need to check for a possible conflict with an already existing row
// because we are doing an insert that does not affect already existing data.
- if ($
user->isPluginEnabled('wvn')
) {
+ if ($
showWeekNote
) {
$fields['note'] = $request->getParameter('note');
}
}
$fields['note'] = $request->getParameter('note');
}
}
@@
-427,7
+435,7
@@
if ($request->isPost()) {
$fields['start_date'] = $startDate->toString(DB_DATEFORMAT); // To be able to determine date for the entry using $dayHeader.
$fields['duration'] = $postedDuration;
$fields['browser_today'] = $request->getParameter('browser_today', null);
$fields['start_date'] = $startDate->toString(DB_DATEFORMAT); // To be able to determine date for the entry using $dayHeader.
$fields['duration'] = $postedDuration;
$fields['browser_today'] = $request->getParameter('browser_today', null);
- if ($
user->isPluginEnabled('wvns')
) {
+ if ($
showWeekNotes
) {
// Take note value from the control below duration.
$noteRowNumber = $rowNumber + 1;
$note_control_id = $noteRowNumber.'_'.$dayHeader;
// Take note value from the control below duration.
$noteRowNumber = $rowNumber + 1;
$note_control_id = $noteRowNumber.'_'.$dayHeader;
@@
-445,7
+453,7
@@
if ($request->isPost()) {
}
if (!$result) break; // Break out of the loop in case of first error.
}
if (!$result) break; // Break out of the loop in case of first error.
- } else if ($
user->isPluginEnabled('wvns')
) {
+ } else if ($
showWeekNotes
) {
// Handle commments row here.
// Obtain existing and posted comments.
// Handle commments row here.
// Obtain existing and posted comments.
@@
-509,8
+517,12
@@
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('onload', 'onLoad="fillDropdowns()"');
$smarty->assign('timestring', $startDate->toString($user->date_format).' - '.$endDate->toString($user->date_format));
$smarty->assign('time_records', $records);
$smarty->assign('onload', 'onLoad="fillDropdowns()"');
$smarty->assign('timestring', $startDate->toString($user->date_format).' - '.$endDate->toString($user->date_format));
$smarty->assign('time_records', $records);
-$smarty->assign('show_navigation', !$user->
getConfigOption('menu_week
'));
+$smarty->assign('show_navigation', !$user->
isOptionEnabled('week_menu
'));
$smarty->assign('show_client', $showClient);
$smarty->assign('show_client', $showClient);
+$smarty->assign('show_project', $showProject);
+$smarty->assign('show_task', $showTask);
+$smarty->assign('show_week_note', $showWeekNote);
+$smarty->assign('show_week_list', $user->isOptionEnabled('week_list'));
$smarty->assign('show_files', $showFiles);
$smarty->assign('title', $i18n->get('menu.week'));
$smarty->assign('content_page_name', 'week.tpl');
$smarty->assign('show_files', $showFiles);
$smarty->assign('title', $i18n->get('menu.week'));
$smarty->assign('content_page_name', 'week.tpl');