diff options
-rw-r--r-- | includes/pages/user_myshifts.php | 11 | ||||
-rw-r--r-- | includes/sys_menu.php | 4 | ||||
-rw-r--r-- | templates/user_myshifts.html | 12 |
3 files changed, 23 insertions, 4 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 diff --git a/includes/sys_menu.php b/includes/sys_menu.php index 448323e1..00bf4801 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -3,6 +3,10 @@ function page_link_to($page) { return '?p=' . $page; } +function page_link_to_absolute($page) { + return (isset ($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . preg_replace("/\?.*$/", '', $_SERVER['REQUEST_URI']) . page_link_to($page); +} + function make_navigation() { global $p; global $privileges; diff --git a/templates/user_myshifts.html b/templates/user_myshifts.html index 9aee533d..97f66601 100644 --- a/templates/user_myshifts.html +++ b/templates/user_myshifts.html @@ -1,9 +1,10 @@ <p> Hier sind Deine Schichten. <br/> - Versuche bitte <b>15 Minuten</b> vor Schichtbeginn anwesend zu sein! + Versuche bitte <b>15 Minuten</b> + vor Schichtbeginn anwesend zu sein! <br/> - Du kannst Dich %h% Stunden vor Schichtbeginn noch aus Schichten wieder austragen. + Du kannst Dich %h% Stunden vor Schichtbeginn noch aus Schichten wieder austragen. </p> %msg% <table> @@ -33,3 +34,10 @@ %shifts% </tbody> </table> +<hr /> +<h2>iCal Export</h2> +<p> + Zum abonnieren in Deiner Kalender-Software benutze folgenden öffentlichen Link (daher bitte geheimhalten, im Notfall Deinen <a href="%reset_link%">Key zurücksetzen</a>): + <br/> + <a href="%ical_link%">%ical_link%</a> +</p> |