summaryrefslogtreecommitdiff
path: root/includes/pages/user_myshifts.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2011-10-11 22:18:36 +0200
committerPhilip Häusler <msquare@notrademark.de>2011-10-11 22:18:36 +0200
commitf8ec85e4c642802d5698054a22afdd67f6ae6d67 (patch)
tree3a64afe122128b96ba63fd46245aebcc19be1a6f /includes/pages/user_myshifts.php
parent304af8e8f015ac896ad0683c6407a3269e981d97 (diff)
#27 ical export, link explained
Diffstat (limited to 'includes/pages/user_myshifts.php')
-rw-r--r--includes/pages/user_myshifts.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php
index 60c5bba0..78fdf8a1 100644
--- a/includes/pages/user_myshifts.php
+++ b/includes/pages/user_myshifts.php
@@ -44,7 +44,7 @@ function user_myshifts() {
header("Location: " . page_link_to('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($user['UID']) . " ORDER BY `start`");
-
+
$html = "";
foreach ($shifts as $shift) {
if (time() > $shift['end'])
@@ -66,10 +66,17 @@ function user_myshifts() {
if ($html == "")
$html = '<tr><td>Keine...</td><td></td><td></td><td></td><td></td><td>Gehe zum <a href="' . page_link_to('user_shifts') . '">Schichtplan</a> um Dich für Schichten einzutragen.</td></tr>';
+ if ($user['ical_key'] == "") {
+ $user['ical_key'] = md5($user['Nick'] . time() . rand());
+ sql_query("UPDATE `User` SET `ical_key`='" . sql_escape($user['ical_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1");
+ }
+
return template_render('../templates/user_myshifts.html', array (
'h' => $LETZTES_AUSTRAGEN,
'shifts' => $html,
- 'msg' => $msg
+ 'msg' => $msg,
+ 'ical_link' => page_link_to_absolute('ical') . '&key=' . $user['ical_key'],
+ 'reset_link' => page_link_to('user_myshifts') . '&reset'
));
}
?> \ No newline at end of file