fix #91 (SQL error in shift filter) and translate "shifts" and "my shifts" a lot
This commit is contained in:
parent
572a986e48
commit
a007a23d75
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
// there have been some new translations added.
|
||||
// For each of them, check if we already got it and create it if not
|
||||
// We can conviniently do this with "INSERT IGNORE" and a UNIQUE key:
|
||||
|
||||
$res = sql_select("SHOW INDEX FROM `Sprache` WHERE `Key_name` = 'TextID'");
|
||||
if($res[0]['Non_unique'] != 0) {
|
||||
sql_query("ALTER TABLE `Sprache` DROP INDEX `TextID`, ADD UNIQUE (`TextID`, `Sprache`)");
|
||||
$applied = true;
|
||||
}
|
||||
|
||||
$res = mysql_query("INSERT IGNORE INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES
|
||||
('no_access_text', 'DE', 'Du hast keinen Zugriff auf diese Seite. Vermutlich muss du dich erst anmelden/registrieren!'),
|
||||
('no_access_text', 'EN', 'You don't have permission to view this page. You probably have to sign in or register in order to gain access!'),
|
||||
('no_access_title', 'DE', 'Kein Zugriff'),
|
||||
('no_access_title', 'EN', 'No Access'),
|
||||
('rooms', 'DE', 'Räume'),
|
||||
('rooms', 'EN', 'rooms'),
|
||||
('days', 'DE', 'Tage'),
|
||||
('days', 'EN', 'days'),
|
||||
('tasks', 'DE', 'Aufgaben'),
|
||||
('tasks', 'EN', 'tasks'),
|
||||
('occupancy', 'DE', 'Belegung'),
|
||||
('occupancy' ,'EN', 'occupancy')
|
||||
('all', 'DE', 'alle'),
|
||||
('all', 'EN', 'all'),
|
||||
('none', 'DE', 'keine'),
|
||||
('none', 'EN', 'none')
|
||||
('entries', 'DE', 'Einträge'),
|
||||
('entries', 'EN', 'entries'),
|
||||
('time', 'DE', 'Zeit'),
|
||||
('time', 'EN', 'time'),
|
||||
('room', 'DE', 'Raum'),
|
||||
('room' ,'EN', 'room'),
|
||||
('to_filter', 'DE', 'filtern'),
|
||||
('to_filter', 'EN', 'filter'),
|
||||
('pub_schichtplan_tasks_notice', 'DE', 'Die hier angezeigten Aufgaben werden durch die Präferenzen in deinen Einstellungen beeinflusst!'),
|
||||
('pub_schichtplan_tasks_notice', 'EN', 'The tasks shown here are influenced by the preferences you defined in your settings!'),
|
||||
('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\">iCal-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>):'),
|
||||
('helpers', 'DE', 'Helfer'),
|
||||
('helpers', 'EN', 'helpers'),
|
||||
('helper', 'DE', 'Helfer'),
|
||||
('helper', 'EN', 'helper'),
|
||||
('needed', 'DE', 'gebraucht'),
|
||||
('needed', 'EN', 'needed'),
|
||||
('pub_myshifts_intro', 'DE', 'Hier sind Deine Schichten.<br/>Versuche bitte <b>15 Minuten</b> vor Schichtbeginn anwesend zu sein!<br/>Du kannst Dich %d Stunden vor Schichtbeginn noch aus Schichten wieder austragen.'),
|
||||
('pub_myshifts_intro', 'EN', 'These are your shifts.<br/>Please try to appear <b>15 minutes</b> before your shift begins!<br/>You can remove yourself from a shift up to %d hours before it starts.'),
|
||||
('pub_myshifts_goto_shifts', 'DE', 'Gehe zum <a href=\"%s\">Schichtplan</a> um Dich für Schichten einzutragen.'),
|
||||
('pub_myshifts_goto_shifts', 'EN', 'Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some shifts.'),
|
||||
('pub_myshifts_signed_off', 'DE', 'Du wurdest aus der Schicht ausgetragen.'),
|
||||
('pub_myshifts_signed_off', 'EN', 'You have been signed off from the shift.'),
|
||||
('pub_myshifts_too_late', 'DE', 'Es ist zu spät um sich aus der Schicht auszutragen. Frage ggf. den Schichtkoordinator, ob er dich austragen kann.'),
|
||||
('pub_myshifts_too_late', 'EN', 'It\'s too late to sign yourself off the shift. If neccessary, as the dispatcher to do so.'),
|
||||
('sign_off', 'DE', 'austragen'),
|
||||
('sign_off', 'EN', 'sign off'),
|
||||
;");
|
||||
|
||||
if(mysql_affected_rows() > 0)
|
||||
$applied = true;
|
|
@ -58,9 +58,9 @@ function user_myshifts() {
|
|||
$shift = $shift[0];
|
||||
if (($shift['start'] - time() < $LETZTES_AUSTRAGEN * 60) || in_array('user_shifts_admin', $privileges)) {
|
||||
sql_query("DELETE FROM `ShiftEntry` WHERE `id`=" . sql_escape($id) . " LIMIT 1");
|
||||
$msg .= success("Du wurdest aus der Schicht ausgetragen.", true);
|
||||
$msg .= success(Get_Text("pub_myshifts_signed_off"), true);
|
||||
} else
|
||||
$msg .= error("Es ist zu spät um sich aus der Schicht auszutragen. Frage ggf. einen Orga.", true);
|
||||
$msg .= error(Get_Text("pub_myshifts_too_late"), true);
|
||||
} else
|
||||
redirect(page_link_to('user_myshifts'));
|
||||
}
|
||||
|
@ -78,24 +78,25 @@ function user_myshifts() {
|
|||
$html .= '<td>' . $shift['name'] . '</td>';
|
||||
$html .= '<td>' . $shift['Comment'] . '</td>';
|
||||
$html .= '<td>';
|
||||
$html .= '<a href="' . page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '">bearbeiten</a>';
|
||||
$html .= '<a href="' . page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '">' . Get_Text('edit') . '</a>';
|
||||
if ($shift['start'] - time() > $LETZTES_AUSTRAGEN * 60)
|
||||
$html .= ' | <a href="' . page_link_to('user_myshifts') . '&cancel=' . $shift['id'] . '">austragen</a>';
|
||||
$html .= ' | <a href="' . page_link_to('user_myshifts') . '&cancel=' . $shift['id'] . '">' . Get_Text('sign_off') . '</a>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
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>';
|
||||
$html = '<tr><td>' . ucfirst(Get_Text('none')) . '...</td><td></td><td></td><td></td><td></td><td>' . sprintf(Get_Text('pub_myshifts_goto_shifts'), page_link_to('user_shifts')) . '</td></tr>';
|
||||
|
||||
if ($shifts_user['ical_key'] == "")
|
||||
user_reset_ical_key($shifts_user);
|
||||
|
||||
return msg().template_render('../templates/user_myshifts.html', array (
|
||||
'h' => $LETZTES_AUSTRAGEN,
|
||||
'intro' => sprintf(Get_Text('pub_myshifts_intro'), $LETZTES_AUSTRAGEN),
|
||||
'shifts' => $html,
|
||||
'msg' => $msg,
|
||||
'ical_link' => page_link_to_absolute('ical') . '&key=' . $shifts_user['ical_key'],
|
||||
'reset_link' => page_link_to('user_myshifts') . '&reset'
|
||||
'ical_text' => sprintf(Get_Text('pub_schichtplan_ical_text'),
|
||||
page_link_to_absolute('ical') . '&key=' . $shifts_user['ical_key'],
|
||||
page_link_to('user_myshifts') . '&reset'),
|
||||
));
|
||||
}
|
||||
?>
|
|
@ -268,6 +268,8 @@ function view_user_shifts() {
|
|||
$types = sql_select("SELECT `id`, `name` FROM `AngelTypes`");
|
||||
else
|
||||
$types = sql_select("SELECT `AngelTypes`.`id`, `AngelTypes`.`name` FROM `UserAngelTypes` JOIN `AngelTypes` ON (`UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`) WHERE `UserAngelTypes`.`user_id` = " . sql_escape($user['UID']) . " AND (`AngelTypes`.`restricted` = 0 OR NOT `UserAngelTypes`.`confirm_user_id` IS NULL)");
|
||||
if (empty($types))
|
||||
$types = sql_select("SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0");
|
||||
$filled = array (
|
||||
array (
|
||||
'id' => '1',
|
||||
|
@ -347,9 +349,10 @@ function view_user_shifts() {
|
|||
$query .= "`shift_id` = " . sql_escape($shift['SID']);
|
||||
else
|
||||
$query .= "`room_id` = " . sql_escape($shift['RID']);
|
||||
$query .= " AND `count` > 0
|
||||
AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ")
|
||||
ORDER BY `AngelTypes`.`name`";
|
||||
$query .= " AND `count` > 0 ";
|
||||
if (!empty($_SESSION['user_shifts']['types']))
|
||||
$query .= "AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") ";
|
||||
$query .= "ORDER BY `AngelTypes`.`name`";
|
||||
$angeltypes = sql_select($query);
|
||||
|
||||
if (count($angeltypes) > 0) {
|
||||
|
@ -363,12 +366,15 @@ function view_user_shifts() {
|
|||
else
|
||||
$entry_list[] = $entry['Nick'];
|
||||
}
|
||||
// do we need more angles of this type?
|
||||
if ($angeltype['count'] - count($entries) > 0) {
|
||||
if ((time() < $shift['end'] && !$my_shift) || in_array('user_shifts_admin', $privileges)) {
|
||||
$entry_list[] = '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">' . ($angeltype['count'] - count($entries)) . ' Helfer' . ($angeltype['count'] - count($entries) != 1 ? '' : '') . ' gebraucht »</a>';
|
||||
} else {
|
||||
$entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht';
|
||||
}
|
||||
$inner_text = ($angeltype['count'] - count($entries)) . ' ' . Get_Text($angeltype['count'] - count($entries) == 1 ? 'helper' : 'helpers') . ' ' . Get_Text('needed');
|
||||
// is the shift still running or alternatively is the user shift admin?
|
||||
if ((time() < $shift['end'] && !$my_shift) || in_array('user_shifts_admin', $privileges))
|
||||
$entry_list[] = '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">' . $inner_text . ' »</a>';
|
||||
else
|
||||
$entry_list[] = $inner_text;
|
||||
unset($inner_text);
|
||||
$is_free = true;
|
||||
}
|
||||
|
||||
|
@ -391,13 +397,15 @@ function view_user_shifts() {
|
|||
user_reset_ical_key($user);
|
||||
|
||||
return msg() . template_render('../templates/user_shifts.html', array (
|
||||
'room_select' => make_select($rooms, $_SESSION['user_shifts']['rooms'], "rooms", "Räume"),
|
||||
'day_select' => make_select($days, $_SESSION['user_shifts']['days'], "days", "Tage"),
|
||||
'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", "Aufgaben"),
|
||||
'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", "Besetzung"),
|
||||
'room_select' => make_select($rooms, $_SESSION['user_shifts']['rooms'], "rooms", ucfirst(Get_Text("rooms"))),
|
||||
'day_select' => make_select($days, $_SESSION['user_shifts']['days'], "days", ucfirst(Get_Text("days"))),
|
||||
'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", ucfirst(Get_Text("tasks"))) . Get_Text("pub_schichtplan_tasks_notice"),
|
||||
'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", ucfirst(Get_Text("occupancy"))),
|
||||
'shifts_table' => $shifts_table,
|
||||
'ical_link' => make_user_shifts_ical_link($user['ical_key']),
|
||||
'reset_link' => page_link_to('user_myshifts') . '&reset'
|
||||
'ical_text' => sprintf(Get_Text('pub_schichtplan_ical_text'), make_user_shifts_ical_link($user['ical_key']), page_link_to('user_myshifts') . '&reset'),
|
||||
'header1' => ucfirst(Get_Text("time")) . "/" . ucfirst(Get_Text("room")),
|
||||
'header2' => ucfirst(Get_Text("entries")),
|
||||
'filter' => ucfirst(Get_Text("to_filter")),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -430,8 +438,8 @@ function make_select($items, $selected, $name, $title = null) {
|
|||
$html .= implode("\n", $html_items);
|
||||
$html .= '</ul>' . "\n";
|
||||
$html .= buttons(array (
|
||||
button("javascript: check_all('selection_" . $name . "')", "Alle", ""),
|
||||
button("javascript: uncheck_all('selection_" . $name . "')", "Keine", "")
|
||||
button("javascript: check_all('selection_" . $name . "')", Get_Text("all"), ""),
|
||||
button("javascript: uncheck_all('selection_" . $name . "')", Get_Text("none"), "")
|
||||
));
|
||||
$html .= '</div>' . "\n";
|
||||
return $html;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<p>
|
||||
Hier sind Deine Schichten.
|
||||
<br/>
|
||||
Versuche bitte <b>15 Minuten</b>
|
||||
vor Schichtbeginn anwesend zu sein!
|
||||
<br/>
|
||||
Du kannst Dich %h% Stunden vor Schichtbeginn noch aus Schichten wieder austragen.
|
||||
%intro%
|
||||
</p>
|
||||
%msg%
|
||||
<table>
|
||||
|
@ -37,7 +32,5 @@
|
|||
<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>
|
||||
%ical_text%
|
||||
</p>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%type_select%
|
||||
%day_select%
|
||||
%filled_select%
|
||||
<input class="button" type="submit" style="width: 100%;" value="Filtern">
|
||||
<input class="button" type="submit" style="width: 100%;" value="%filter%">
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Zeit/Raum
|
||||
%header1%
|
||||
</th>
|
||||
<th>
|
||||
Einträge
|
||||
%header2%
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -26,7 +26,5 @@
|
|||
</table>
|
||||
<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>
|
||||
%ical_text%
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue