#119 added links to json export
This commit is contained in:
parent
5b4c7fe15e
commit
fb8241039b
|
@ -1161,8 +1161,8 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES
|
|||
('to_filter', 'EN', 'filter'),
|
||||
('pub_schichtplan_tasks_notice', 'DE', 'Die hier angezeigten Aufgaben werden durch die Präferenzen in deinen Einstellungen beeinflusst! <a href="https://events.ccc.de/congress/2012/wiki/Volunteers#What_kind_of_volunteers_are_needed.3F">Beschreibung der einzelnen Aufgaben</a>.'),
|
||||
('pub_schichtplan_tasks_notice', 'EN', 'The tasks shown here are influenced by the preferences you defined in your settings! <a href="https://events.ccc.de/congress/2012/wiki/Volunteers#What_kind_of_volunteers_are_needed.3F">Description of the jobs</a>.'),
|
||||
('inc_schicht_ical_text', 'DE', 'Zum Abonnieren der angezeigten Schichten in deiner Kalender-Software benutze <a href="%s">diesen Link</a> (bitte geheimhalten, im Notfall Deinen <a href="%s">API-Key zurücksetzen</a>).'),
|
||||
('inc_schicht_ical_text', 'EN', 'To subscribe the shifts shown in your calendar software, use <a href="%s">this link</a> (please keep secret, otherwise <a href="%s">reset the ical key</a>).'),
|
||||
('inc_schicht_ical_text', 'DE', 'Export der angezeigten Schichten. Im <a href="%s">iCal Format</a> oder im <a href="%s">JSON Format</a> (bitte geheimhalten, im Notfall Deinen <a href="%s">API-Key zurücksetzen</a>).'),
|
||||
('inc_schicht_ical_text', 'EN', 'Export of shown shifts. <a href="%s">iCal format</a> or <a href="%s">JSON format</a> available (please keep secret, otherwise <a href="%s">reset the api key</a>).'),
|
||||
('helpers', 'DE', 'Helfer'),
|
||||
('helpers', 'EN', 'helpers'),
|
||||
('helper', 'DE', 'Helfer'),
|
||||
|
|
|
@ -29,7 +29,7 @@ function User_by_api_key($api_key) {
|
|||
* Generates a new api key for given user.
|
||||
* @param User $user
|
||||
*/
|
||||
function User_reset_api_key($user) {
|
||||
function User_reset_api_key(&$user) {
|
||||
$user['api_key'] = md5($user['Nick'] . time() . rand());
|
||||
sql_query("UPDATE `User` SET `api_key`='" . sql_escape($user['api_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1");
|
||||
engelsystem_log("API key resetted.");
|
||||
|
|
|
@ -118,7 +118,7 @@ function user_myshifts() {
|
|||
'actions' => "Aktion"
|
||||
), $myshifts_table),
|
||||
$id == $user['UID'] && count($shifts) == 0 ? error(sprintf(Get_Text('pub_myshifts_goto_shifts'), page_link_to('user_shifts')), true) : '',
|
||||
"<h2>iCal Export</h2>" . sprintf(Get_Text('inc_schicht_ical_text'), page_link_to_absolute('ical') . '&key=' . $shifts_user['api_key'], page_link_to('user_myshifts') . '&reset')
|
||||
"<h2>Exports</h2>" . sprintf(Get_Text('inc_schicht_ical_text'), page_link_to_absolute('ical') . '&key=' . $shifts_user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $shifts_user['api_key'], page_link_to('user_myshifts') . '&reset')
|
||||
));
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -704,12 +704,12 @@ return msg() . template_render('../templates/user_shifts.html', array (
|
|||
'task_notice' => '<sup>1</sup>' . Get_Text("pub_schichtplan_tasks_notice"),
|
||||
'new_style_checkbox' => '<label><input type="checkbox" name="new_style" value="1" ' . ($_SESSION['user_shifts']['new_style']? ' checked' : '') . '> Use new style if possible</label>',
|
||||
'shifts_table' => $shifts_table,
|
||||
'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), htmlspecialchars(make_user_shifts_ical_link($user['api_key'])), page_link_to('user_myshifts') . '&reset'),
|
||||
'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), htmlspecialchars(make_user_shifts_export_link('ical', $user['api_key'])), htmlspecialchars(make_user_shifts_export_link('shifts_json_export', $user['api_key'])), page_link_to('user_myshifts') . '&reset'),
|
||||
'filter' => ucfirst(Get_Text("to_filter")),
|
||||
));
|
||||
}
|
||||
|
||||
function make_user_shifts_ical_link($key) {
|
||||
function make_user_shifts_export_link($page, $key) {
|
||||
$link = "&start_day=" . $_SESSION['user_shifts']['start_day'];
|
||||
$link = "&start_time=" . $_SESSION['user_shifts']['start_time'];
|
||||
$link = "&end_day=" . $_SESSION['user_shifts']['end_day'];
|
||||
|
@ -720,7 +720,7 @@ function make_user_shifts_ical_link($key) {
|
|||
$link .= '&types[]=' . $type;
|
||||
foreach ($_SESSION['user_shifts']['filled'] as $filled)
|
||||
$link .= '&filled[]=' . $filled;
|
||||
return page_link_to_absolute('ical') . $link . '&export=user_shifts&key=' . $key;
|
||||
return page_link_to_absolute($page) . $link . '&export=user_shifts&key=' . $key;
|
||||
}
|
||||
|
||||
function get_ids_from_array($array) {
|
||||
|
|
Loading…
Reference in New Issue