a few fixes and polishes in myshifts, shifts and menu

This commit is contained in:
Jan-Philipp Litza 2012-12-29 14:41:09 +01:00
parent b60603d76c
commit 2d0b2542c9
4 changed files with 16 additions and 4 deletions

View File

@ -71,6 +71,7 @@ function user_myshifts() {
$shifts = sql_select("SELECT * FROM `ShiftEntry` JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) WHERE `UID`=" . sql_escape($shifts_user['UID']) . " ORDER BY `start`"); $shifts = sql_select("SELECT * FROM `ShiftEntry` JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) WHERE `UID`=" . sql_escape($shifts_user['UID']) . " ORDER BY `start`");
$html = ""; $html = "";
$timesum = 0;
foreach ($shifts as $shift) { foreach ($shifts as $shift) {
if (time() > $shift['end']) if (time() > $shift['end'])
$html .= '<tr class="done">'; $html .= '<tr class="done">';
@ -91,6 +92,7 @@ function user_myshifts() {
$shift_entries[] = $user_source['Nick']; $shift_entries[] = $user_source['Nick'];
} }
$html .= join(", ", $shift_entries); $html .= join(", ", $shift_entries);
$timesum += ($shift['end'] - $shift['start']) / (60*60);
} }
$html .= '</td>'; $html .= '</td>';
@ -109,6 +111,7 @@ function user_myshifts() {
return msg().template_render('../templates/user_myshifts.html', array ( return msg().template_render('../templates/user_myshifts.html', array (
'intro' => sprintf(Get_Text('pub_myshifts_intro'), $LETZTES_AUSTRAGEN), 'intro' => sprintf(Get_Text('pub_myshifts_intro'), $LETZTES_AUSTRAGEN),
'shifts' => $html, 'shifts' => $html,
'time_sum' => $timesum,
'msg' => $msg, 'msg' => $msg,
'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), 'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'),
page_link_to_absolute('ical') . '&key=' . $shifts_user['ical_key'], page_link_to_absolute('ical') . '&key=' . $shifts_user['ical_key'],

View File

@ -262,8 +262,7 @@ function user_shifts() {
} }
return template_render('../templates/user_shifts_add.html', array ( return template_render('../templates/user_shifts_add.html', array (
//'date' => date("Y-m-d H:i", $shift['start']) . ', ' . date("H:i", $shift['end'] - $shift['start']) . 'h', 'date' => date("Y-m-d H:i", $shift['start']) . ' &ndash; ' . date('Y-m-d H:i', $shift['end']) . ' (' . shift_length($shift) . ')',
'date' => date("Y-m-d H:i", $shift['start']) . ', ' . shift_length($shift),
'title' => $shift['name'], 'title' => $shift['name'],
'location' => $shift['Name'], 'location' => $shift['Name'],
'angel' => $user_text, 'angel' => $user_text,

View File

@ -121,8 +121,8 @@ function make_langselect() {
else else
$URL = $_SERVER["REQUEST_URI"] . "?SetLanguage="; $URL = $_SERVER["REQUEST_URI"] . "?SetLanguage=";
$html = '<p class="content"><a class="sprache" href="' . $URL . 'DE"><img src="pic/flag/de.png" alt="DE" title="Deutsch"></a>'; $html = '<p class="content"><a class="sprache" href="' . htmlspecialchars($URL) . 'DE"><img src="pic/flag/de.png" alt="DE" title="Deutsch"></a>';
$html .= '<a class="sprache" href="' . $URL . 'EN"><img src="pic/flag/en.png" alt="EN" title="English"></a></p>'; $html .= '<a class="sprache" href="' . htmlspecialchars($URL) . 'EN"><img src="pic/flag/en.png" alt="EN" title="English"></a></p>';
return '<nav class="container"><h4>' . Get_Text("Sprache") . '</h4>' . $html . '</nav>'; return '<nav class="container"><h4>' . Get_Text("Sprache") . '</h4>' . $html . '</nav>';
} }
?> ?>

View File

@ -28,6 +28,16 @@
<tbody> <tbody>
%shifts% %shifts%
</tbody> </tbody>
<tfoot>
<tr>
<th>Summe</th>
<th>%time_sum% Stunden</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
</table> </table>
<hr /> <hr />
<h2>iCal Export</h2> <h2>iCal Export</h2>