angel views in english complete

This commit is contained in:
Philip Häusler 2013-11-25 21:56:56 +01:00
parent 813751ac7a
commit 85d9bf4f9c
11 changed files with 534 additions and 601 deletions

View File

@ -1,4 +1,8 @@
<?php
function credits_title() {
return _("Credits");
}
function guest_credits() {
return template_render('../templates/guest_credits.html', array());
}

View File

@ -1,4 +1,15 @@
<?php
function login_title() {
return _("Login");
}
function register_title() {
return _("Register");
}
function logout_title() {
return _("Logout");
}
// Engel registrieren
function guest_register() {

View File

@ -24,8 +24,7 @@ function user_myshifts() {
redirect(page_link_to('user_myshifts'));
}
return template_render('../templates/user_myshifts_reset.html', array());
}
elseif (isset ($_REQUEST['edit']) && preg_match("/^[0-9]*$/", $_REQUEST['edit'])) {
} elseif (isset($_REQUEST['edit']) && preg_match("/^[0-9]*$/", $_REQUEST['edit'])) {
$id = $_REQUEST['edit'];
$shift = sql_select("SELECT `ShiftEntry`.`Comment`, `ShiftEntry`.`UID`, `Shifts`.*, `Room`.`Name`, `AngelTypes`.`name` as `angel_type` FROM `ShiftEntry` JOIN `AngelTypes` ON (`ShiftEntry`.`TID` = `AngelTypes`.`id`) JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) WHERE `ShiftEntry`.`id`=" . sql_escape($id) . " AND `UID`=" . sql_escape($shifts_user['UID']) . " LIMIT 1");
if (count($shift) > 0) {
@ -40,18 +39,10 @@ function user_myshifts() {
redirect(page_link_to('user_myshifts'));
}
return template_render('../templates/user_shifts_add.html', array (
'angel' => User_Nick_render($shifts_user),
'date' => date("Y-m-d H:i", $shift['start']) . ', ' . shift_length($shift),
'location' => $shift['Name'],
'title' => $shift['name'],
'type' => $shift['angel_type'],
'comment' => $shift['Comment']
));
return ShiftEntry_edit_view(User_Nick_render($shifts_user), date("Y-m-d H:i", $shift['start']) . ', ' . shift_length($shift), $shift['Name'], $shift['name'], $shift['angel_type'], $shift['Comment']);
} else
redirect(page_link_to('user_myshifts'));
}
elseif (isset ($_REQUEST['cancel']) && preg_match("/^[0-9]*$/", $_REQUEST['cancel'])) {
} elseif (isset($_REQUEST['cancel']) && preg_match("/^[0-9]*$/", $_REQUEST['cancel'])) {
$id = $_REQUEST['cancel'];
$shift = sql_select("SELECT `Shifts`.`start` FROM `Shifts` INNER JOIN `ShiftEntry` USING (`SID`) WHERE `ShiftEntry`.`id`=" . sql_escape($id) . " AND `UID`=" . sql_escape($shifts_user['UID']) . " LIMIT 1");
if (count($shift) > 0) {
@ -104,23 +95,32 @@ function user_myshifts() {
$myshifts_table[] = $myshift;
}
if (count($myshifts_table) > 0)
$myshifts_table[] = array('date' => "<b>Summe:</b>", 'time' => "<b>" . round($timesum / (60*60), 1) . " h</b>", 'room' => "", 'shift_info' => "", 'comment' => "", 'actions' => "");
$myshifts_table[] = array(
'date' => '<b>' . _("Sum:") . '</b>',
'time' => "<b>" . round($timesum / (60 * 60), 1) . " h</b>",
'room' => "",
'shift_info' => "",
'comment' => "",
'actions' => ""
);
return page(array(
msg(),
$id == $user['UID'] ? sprintf(_('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.'), $LETZTES_AUSTRAGEN) : '',
$id != $user['UID'] ? info(sprintf("You are viewing %s's shifts.", $shifts_user['Nick']), true) : '',
$id != $user['UID'] ? buttons(array(button(page_link_to('admin_user') . '&amp;id=' . $shifts_user['UID'], "Edit " . $shifts_user['Nick'], 'edit'))) : '',
$id != $user['UID'] ? buttons(array(
button(page_link_to('admin_user') . '&amp;id=' . $shifts_user['UID'], "Edit " . $shifts_user['Nick'], 'edit')
)) : '',
table(array(
'date' => "Tag",
'time' => "Zeit",
'room' => "Ort",
'shift_info' => "Name &amp; Kollegen",
'comment' => "Kommentar",
'actions' => "Aktion"
'date' => _("Day"),
'time' => _("Time"),
'room' => _("Location"),
'shift_info' => _("Name &amp; workmates"),
'comment' => _("Comment"),
'actions' => _("Action")
), $myshifts_table),
$id == $user['UID'] && count($shifts) == 0 ? error(sprintf(_("Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some shifts."), page_link_to('user_shifts')), true) : '',
"<h2>Exports</h2>" . sprintf(_("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>)."), 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')
'<h2>' . _("Exports") . '</h2>' . sprintf(_("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>)."), 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')
));
}
?>

View File

@ -1,4 +1,8 @@
<?php
function user_news_comments_title() {
return _("News comments");
}
function news_title() {
return _("News");
}
@ -72,7 +76,7 @@ function user_news_comments() {
$text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['text']));
sql_query("INSERT INTO `news_comments` (`Refid`, `Datum`, `Text`, `UID`) VALUES ('" . sql_escape($nid) . "', '" . date("Y-m-d H:i:s") . "', '" . sql_escape($text) . "', '" . sql_escape($user["UID"]) . "')");
engelsystem_log("Created news_comment: " . $text);
$html .= success("Eintrag wurde gespeichert", true);
$html .= success(_("Entry saved."), true);
}
$html .= '<a href="' . page_link_to("news") . '">&laquo; Back</a>';
@ -100,22 +104,22 @@ function user_news_comments() {
$html .= '
<br />
<hr>
<h2>Neuer Kommentar:</h2>
<h2>' . _("New Comment:") . '</h2>
<a name="Neu">&nbsp;</a>
<form action="' . page_link_to("news_comments") . '" method="post">
<input type="hidden" name="nid" value="' . $_REQUEST["nid"] . '">
<table>
<tr>
<td align="right" valign="top">Text:</td>
<td align="right" valign="top">' . _("Message:") . '</td>
<td><textarea name="text" cols="50" rows="10"></textarea></td>
</tr>
</table>
<br />
<input type="submit" value="sichern...">
<input type="submit" value="' . _("Save") . '">
</form>';
} else {
$html .= "Fehlerhafter Aufruf!";
$html .= _("Fehlerhafter Aufruf!");
}
return $html;

View File

@ -7,29 +7,17 @@ function user_questions() {
global $user;
if (! isset($_REQUEST['action'])) {
$open_questions = "";
$questions = sql_select("SELECT * FROM `Questions` WHERE `AID`=0 AND `UID`=" . sql_escape($user['UID']));
foreach ($questions as $question)
$open_questions .= '<tr><td>' . str_replace("\n", '<br />', $question['Question']) . '</td><td><a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">Löschen</a></td><tr>';
$answered_questions = "";
$questions = sql_select("SELECT * FROM `Questions` WHERE `AID`>0 AND `UID`=" . sql_escape($user['UID']));
foreach ($questions as $question) {
$answered_questions .= '<tr><td>' . str_replace("\n", '<br />', $question['Question']) . '</td>';
$open_questions = sql_select("SELECT * FROM `Questions` WHERE `AID`=0 AND `UID`=" . sql_escape($user['UID']));
$answered_questions = sql_select("SELECT * FROM `Questions` WHERE `AID`>0 AND `UID`=" . sql_escape($user['UID']));
foreach ($answered_questions as &$question) {
$answer_user_source = User($question['AID']);
if ($answer_user_source === false)
engelsystem_error("Unable to load user.");
$answered_questions .= '<td>' . User_Nick_render($answer_user_source) . '</td><td>' . str_replace("\n", '<br />', $question['Answer']) . '</td>';
$answered_questions .= '<td><a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">Löschen</a></td><tr>';
engelsystem_error(_("Unable to load user."));
$question['answer_user'] = User_Nick_render($answer_user_source);
}
return template_render('../templates/user_questions.html', array (
'link' => page_link_to("user_questions"),
'open_questions' => $open_questions,
'answered_questions' => $answered_questions
));
return Questions_view($open_questions, $answered_questions, page_link_to("user_questions") . '&action=ask');
} else {
switch ($_REQUEST['action']) {
case 'ask':
@ -38,20 +26,20 @@ function user_questions() {
sql_query("INSERT INTO `Questions` SET `UID`=" . sql_escape($user['UID']) . ", `Question`='" . sql_escape($question) . "'");
redirect(page_link_to("user_questions"));
} else
return error("Gib eine Frage ein!", true);
return error(_("Please enter a question!"), true);
break;
case 'delete':
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
$id = $_REQUEST['id'];
else
return error("Incomplete call, missing Question ID.", true);
return error(_("Incomplete call, missing Question ID."), true);
$question = sql_select("SELECT * FROM `Questions` WHERE `QID`=" . sql_escape($id) . " LIMIT 1");
if (count($question) > 0 && $question[0]['UID'] == $user['UID']) {
sql_query("DELETE FROM `Questions` WHERE `QID`=" . sql_escape($id) . " LIMIT 1");
redirect(page_link_to("user_questions"));
} else
return error("No question found.", true);
return error(_("No question found."), true);
break;
}
}

View File

@ -1,4 +1,8 @@
<?php
function settings_title() {
return _("Settings");
}
function user_settings() {
global $enable_tshirt_size, $tshirt_sizes, $themes, $locales;
global $user;
@ -108,7 +112,7 @@ function user_settings() {
}
engelsystem_log("Own angel types set to: " . join(", ", $user_angel_type_info));
success("Settings saved.");
success(_("Settings saved."));
redirect(page_link_to('user_settings'));
}
} elseif (isset($_REQUEST['submit_password'])) {

View File

@ -20,11 +20,10 @@ function user_shifts() {
engelsystem_log("Deleted " . User_Nick_render($shift_entry_source) . "'s shift: " . $shift_entry_source['name'] . " at " . $shift_entry_source['Name'] . " from " . date("y-m-d H:i", $shift_entry_source['start']) . " to " . date("y-m-d H:i", $shift_entry_source['end']) . " as " . $shift_entry_source['angel_type']);
success("Der Schicht-Eintrag wurde gelöscht.");
}
else error("Entry not found.");
} else
error("Entry not found.");
redirect(page_link_to('user_shifts'));
}
// Schicht bearbeiten
} // Schicht bearbeiten
elseif (isset($_REQUEST['edit_shift']) && in_array('admin_shifts', $privileges)) {
$msg = "";
$ok = true;
@ -35,10 +34,7 @@ function user_shifts() {
redirect(page_link_to('user_shifts'));
/*
if (sql_num_query("SELECT * FROM `ShiftEntry` WHERE `SID`=" . sql_escape($shift_id) . " LIMIT 1") > 0) {
error("Du kannst nur Schichten bearbeiten, bei denen niemand eingetragen ist.");
redirect(page_link_to('user_shift'));
}
* if (sql_num_query("SELECT * FROM `ShiftEntry` WHERE `SID`=" . sql_escape($shift_id) . " LIMIT 1") > 0) { error("Du kannst nur Schichten bearbeiten, bei denen niemand eingetragen ist."); redirect(page_link_to('user_shift')); }
*/
$shift = sql_select("SELECT * FROM `Shifts` JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) WHERE `SID`=" . sql_escape($shift_id) . " LIMIT 1");
@ -155,8 +151,7 @@ function user_shifts() {
'end' => date("Y-m-d H:i", $end),
'angel_types' => $angel_types
));
}
// Schicht komplett löschen (nur für admins/user mit user_shifts_admin privileg)
} // Schicht komplett löschen (nur für admins/user mit user_shifts_admin privileg)
elseif (isset($_REQUEST['delete_shift']) && in_array('user_shifts_admin', $privileges)) {
if (isset($_REQUEST['delete_shift']) && preg_match("/^[0-9]*$/", $_REQUEST['delete_shift']))
$shift_id = $_REQUEST['delete_shift'];
@ -185,8 +180,7 @@ function user_shifts() {
'end' => date("H:i", $shift['end']),
'id' => $shift_id
));
}
elseif (isset ($_REQUEST['shift_id'])) {
} elseif (isset($_REQUEST['shift_id'])) {
if (isset($_REQUEST['shift_id']) && preg_match("/^[0-9]*$/", $_REQUEST['shift_id']))
$shift_id = $_REQUEST['shift_id'];
else
@ -270,14 +264,7 @@ function user_shifts() {
$angeltyppe_select = $type['name'];
}
return template_render('../templates/user_shifts_add.html', array (
'date' => date("Y-m-d H:i", $shift['start']) . ' &ndash; ' . date('Y-m-d H:i', $shift['end']) . ' (' . shift_length($shift) . ')',
'title' => $shift['name'],
'location' => $shift['Name'],
'angel' => $user_text,
'type' => $angeltyppe_select,
'comment' => ""
));
return ShiftEntry_edit_view(date("Y-m-d H:i", $shift['start']) . ' &ndash; ' . date('Y-m-d H:i', $shift['end']) . ' (' . shift_length($shift) . ')', $shift['name'], $shift['Name'], $user_text, $angeltyppe_select, "");
} else {
return view_user_shifts();
}
@ -340,7 +327,10 @@ function view_user_shifts() {
}
if (! isset($_SESSION['user_shifts']['new_style']))
$_SESSION['user_shifts']['new_style'] = true;
foreach (array ('start', 'end') as $key) {
foreach (array(
'start',
'end'
) as $key) {
if (isset($_REQUEST[$key . '_day']) && in_array($_REQUEST[$key . '_day'], $days))
$_SESSION['user_shifts'][$key . '_day'] = $_REQUEST[$key . '_day'];
if (isset($_REQUEST[$key . '_time']) && preg_match('#^\d{1,2}:\d\d$#', $_REQUEST[$key . '_time']))
@ -363,7 +353,9 @@ function view_user_shifts() {
$endtime = $endtime->getTimestamp();
if (! isset($_SESSION['user_shifts']['rooms']) || count($_SESSION['user_shifts']['rooms']) == 0)
$_SESSION['user_shifts']['rooms'] = array(0);
$_SESSION['user_shifts']['rooms'] = array(
0
);
$SQL = "SELECT DISTINCT `Shifts`.*, `Room`.`Name` as `room_name`, nat2.`special_needs` > 0 AS 'has_special_needs'
FROM `Shifts`
@ -395,19 +387,7 @@ function view_user_shifts() {
$shifts_table = "";
// qqqq
/*
[0] => Array
(
[SID] => 1
[start] => 1355958000
[end] => 1355961600
[RID] => 1
[name] =>
[URL] =>
[PSID] =>
[room_name] => test1
[has_special_needs] => 1
[is_full] => 0
)
* [0] => Array ( [SID] => 1 [start] => 1355958000 [end] => 1355961600 [RID] => 1 [name] => [URL] => [PSID] => [room_name] => test1 [has_special_needs] => 1 [is_full] => 0 )
*/
if ($_SESSION['user_shifts']['new_style']) {
$first = 15 * 60 * floor($starttime / (15 * 60));
@ -711,7 +691,7 @@ return msg() . template_render('../templates/user_shifts.html', array (
'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(_("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>)."), page_link_to_absolute('ical') . '&key=' . $user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'], page_link_to('user_myshifts') . '&reset'),
'filter' => _("Filter"),
'filter' => _("Filter")
));
}

View File

@ -17,19 +17,19 @@ function header_toolbar() {
$toolbar_items = array();
if (in_array('register', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('register'), 'register', "Register", $p == 'register');
$toolbar_items[] = toolbar_item_link(page_link_to('register'), 'register', register_title(), $p == 'register');
if (in_array('user_myshifts', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('user_myshifts'), 'engel', $user['Nick'], $p == 'user_myshifts');
if (in_array('user_settings', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('user_settings'), 'settings', "Settings", $p == 'user_settings');
$toolbar_items[] = toolbar_item_link(page_link_to('user_settings'), 'settings', settings_title(), $p == 'user_settings');
if (in_array('login', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('login'), 'login', "Login", $p == 'login');
$toolbar_items[] = toolbar_item_link(page_link_to('login'), 'login', login_title(), $p == 'login');
if (in_array('logout', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('logout'), 'logout', "Logout", $p == 'logout');
$toolbar_items[] = toolbar_item_link(page_link_to('logout'), 'logout', logout_title(), $p == 'logout');
return toolbar($toolbar_items);
}

View File

@ -13,7 +13,9 @@ require_once ('includes/sys_template.php');
require_once ('includes/model/LogEntries_model.php');
require_once ('includes/model/User_model.php');
require_once ('includes/view/Questions_view.php');
require_once ('includes/view/Shifts_view.php');
require_once ('includes/view/ShiftEntry_view.php');
require_once ('includes/view/User_view.php');
require_once ('includes/helper/internationalization_helper.php');
@ -37,10 +39,12 @@ require_once ('includes/pages/admin_shifts.php');
require_once ('includes/pages/admin_user.php');
require_once ('includes/pages/admin_user_angeltypes.php');
require_once ('includes/pages/guest_faq.php');
require_once ('includes/pages/guest_login.php');
require_once ('includes/pages/user_messages.php');
require_once ('includes/pages/user_myshifts.php');
require_once ('includes/pages/user_news.php');
require_once ('includes/pages/user_questions.php');
require_once ('includes/pages/user_settings.php');
require_once ('includes/pages/user_shifts.php');
require_once ('includes/pages/user_wakeup.php');
@ -83,6 +87,7 @@ elseif (in_array($p, $privileges)) {
$content = user_news();
} elseif ($p == "news_comments") {
require_once ('includes/pages/user_news.php');
$title = user_news_comments_title();
$content = user_news_comments();
} elseif ($p == "user_meetings") {
$title = meetings_title();
@ -103,16 +108,16 @@ elseif (in_array($p, $privileges)) {
$title = wakeup_title();
$content = user_wakeup();
} elseif ($p == "user_settings") {
require_once ('includes/pages/user_settings.php');
$title = settings_title();
$content = user_settings();
} elseif ($p == "login") {
require_once ('includes/pages/guest_login.php');
$title = login_title();
$content = guest_login();
} elseif ($p == "register") {
require_once ('includes/pages/guest_login.php');
$title = register_title();
$content = guest_register();
} elseif ($p == "logout") {
require_once ('includes/pages/guest_login.php');
$title = logout_title();
$content = guest_logout();
} elseif ($p == "admin_questions") {
$title = admin_questions_title();
@ -165,6 +170,7 @@ elseif (in_array($p, $privileges)) {
}
} elseif ($p == "credits") {
require_once ('includes/pages/guest_credits.php');
$title = credits_title();
$content = guest_credits();
} elseif ($p == "faq") {
$title = faq_title();

View File

@ -1,22 +1,3 @@
<p>
Unbeantwortete Fragen:
</p>
<table>
<thead>
<tr>
<th>
Frage
</th>
<th>
&nbsp;
</th>
</tr>
</thead>
<tbody>
%open_questions%
</tbody>
</table>
<hr/>
<p>
Beantwortete Fragen:
</p>

View File

@ -1,45 +0,0 @@
<form action="" method="post">
<fieldset>
<p>
<label>
Helfer:
</label>
%angel%
</p>
<p>
<label>
Datum/Dauer:
</label>
%date%
</p>
<p>
<label>
Ort:
</label>
%location%
</p>
<p>
<label>
Titel:
</label>
%title%
</p>
<p>
<label>
Typ:
</label>
%type%
</p>
<p>
<label>
Kommentar:
<br/>
(Nur für Dich)
</label>
<textarea name="comment">%comment%</textarea>
</p>
<p>
<input type="submit" name="submit" value="Speichern" />
</p>
</fieldset>
</form>