Skip to content

Commit

Permalink
Support non-working work days
Browse files Browse the repository at this point in the history
E.g. when having a 4-day work week

Part of TIM-15

Conflicts:
	config.dist.php
  • Loading branch information
cweiske authored and CybotTM committed Apr 6, 2017
1 parent 97213a8 commit 5e64a31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions data/templates/month.tpl.php
Expand Up @@ -85,7 +85,7 @@
$class = 'alert-danger';
}
$mainclass = '';
if ($day['dow'] >= 6 || $day['holiday']) {
if ($day['required'] == 0 || $day['holiday']) {
$mainclass = 'muted';
}
if ($day['dow'] == 7) {
Expand All @@ -97,7 +97,7 @@

echo "<tr class='$mainclass'>"
. '<td><nobr>' . $day['date'] . '</nobr></td>';
if ($day['holiday'] && $day['worked'] == 0.0) {
if (($day['holiday'] || $day['required'] == 0) && $day['worked'] == 0.0) {
echo '<td colspan="4">' . $day['name'] . '</td>';
} else {
echo '<td class="r">' . $day['required'] . '</td>'
Expand Down
10 changes: 5 additions & 5 deletions src/data.php
Expand Up @@ -170,14 +170,14 @@
'holiday' => isset($holidays[$date]),
'future' => $date > $today,
);
if ($days[$date]['dow'] >= 6 || $days[$date]['holiday']) {
if ($days[$date]['holiday']) {
$days[$date]['required'] = 0;
}
if ($days[$date]['required'] == 0) {
if ($days[$date]['holiday']) {
$days[$date]['name'] = $holidays[$date];
} else if ($days[$date]['dow'] == 6) {
$days[$date]['name'] = 'Sonnabend';
} else if ($days[$date]['dow'] == 7) {
$days[$date]['name'] = 'Sonntag';
} else {
$days[$date]['name'] = strftime('%A', $ts);
}
$days[$date]['holiday'] = true;
}
Expand Down

0 comments on commit 5e64a31

Please sign in to comment.