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,5 +1,9 @@
<?php
function credits_title() {
return _("Credits");
}
function guest_credits() {
return template_render('../templates/guest_credits.html', array ());
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

@ -8,30 +8,29 @@ function user_myshifts() {
global $LETZTES_AUSTRAGEN;
global $user, $privileges;
$msg = "";
if (isset ($_REQUEST['id']) && in_array("user_shifts_admin", $privileges) && preg_match("/^[0-9]{1,}$/", $_REQUEST['id']) && sql_num_query("SELECT * FROM `User` WHERE `UID`=" . sql_escape($_REQUEST['id'])) > 0) {
if (isset($_REQUEST['id']) && in_array("user_shifts_admin", $privileges) && preg_match("/^[0-9]{1,}$/", $_REQUEST['id']) && sql_num_query("SELECT * FROM `User` WHERE `UID`=" . sql_escape($_REQUEST['id'])) > 0) {
$id = $_REQUEST['id'];
} else {
$id = $user['UID'];
}
list ($shifts_user) = sql_select("SELECT * FROM `User` WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
if (isset ($_REQUEST['reset'])) {
list($shifts_user) = sql_select("SELECT * FROM `User` WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
if (isset($_REQUEST['reset'])) {
if ($_REQUEST['reset'] == "ack") {
User_reset_api_key($user);
success("Key geändert.");
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'])) {
return template_render('../templates/user_myshifts_reset.html', array());
} 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) {
$shift = $shift[0];
if (isset ($_REQUEST['submit'])) {
if (isset($_REQUEST['submit'])) {
$comment = strip_request_item_nl('comment');
$user_source = User($shift['UID']);
sql_query("UPDATE `ShiftEntry` SET `Comment`='" . sql_escape($comment) . "' WHERE `id`=" . sql_escape($id) . " LIMIT 1");
@ -39,19 +38,11 @@ function user_myshifts() {
success("Schicht gespeichert.");
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) {
@ -65,62 +56,71 @@ function user_myshifts() {
redirect(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($shifts_user['UID']) . " ORDER BY `start`");
$myshifts_table = array();
$html = "";
$timesum = 0;
foreach ($shifts as $shift) {
$shift_info = $shift['name'];
$needed_angel_types_source = sql_select("SELECT DISTINCT `AngelTypes`.* FROM `ShiftEntry` JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id` WHERE `ShiftEntry`.`SID`=" . sql_escape($shift['SID']) . " ORDER BY `AngelTypes`.`name`");
foreach($needed_angel_types_source as $needed_angel_type) {
foreach ($needed_angel_types_source as $needed_angel_type) {
$shift_info .= '<br><b>' . $needed_angel_type['name'] . ':</b> ';
$users_source = sql_select("SELECT `User`.* FROM `ShiftEntry` JOIN `User` ON `ShiftEntry`.`UID`=`User`.`UID` WHERE `ShiftEntry`.`SID`=" . sql_escape($shift['SID']) . " AND `ShiftEntry`.`TID`=" . sql_escape($needed_angel_type['id']));
$shift_entries = array();
foreach($users_source as $user_source) {
if($user['UID'] == $user_source['UID'])
foreach ($users_source as $user_source) {
if ($user['UID'] == $user_source['UID'])
$shift_entries[] = '<b>' . $user_source['Nick'] . '</b>';
else
$shift_entries[] = User_Nick_render($user_source);
}
$shift_info .= join(", ", $shift_entries);
}
$myshift = array(
'date' => date("Y-m-d", $shift['start']),
'time' => date("H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']),
'room' => $shift['Name'],
'shift_info' => $shift_info,
'comment' => $shift['Comment']
'date' => date("Y-m-d", $shift['start']),
'time' => date("H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']),
'room' => $shift['Name'],
'shift_info' => $shift_info,
'comment' => $shift['Comment']
);
$myshift['actions'] = "";
if ($id == $user['UID'])
$myshift['actions'] .= img_button(page_link_to('user_myshifts') . '&edit=' . $shift['id'], 'pencil', _("edit"));
if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges))
$myshift['actions'] .= img_button(page_link_to('user_myshifts') . (($id != $user['UID'])? '&id=' . $id : '') . '&cancel=' . $shift['id'], 'cross', _("sign off"));
$myshift['actions'] .= img_button(page_link_to('user_myshifts') . (($id != $user['UID']) ? '&id=' . $id : '') . '&cancel=' . $shift['id'], 'cross', _("sign off"));
$timesum += $shift['end'] - $shift['start'];
$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' => "");
if (count($myshifts_table) > 0)
$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'))) : '',
table(array(
'date' => "Tag",
'time' => "Zeit",
'room' => "Ort",
'shift_info' => "Name &amp; Kollegen",
'comment' => "Kommentar",
'actions' => "Aktion"
), $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')
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')
)) : '',
table(array(
'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')
));
}
?>

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

@ -5,53 +5,41 @@ function questions_title() {
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>';
if (! isset($_REQUEST['action'])) {
$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>';
if ($answer_user_source === false)
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' :
case 'ask':
$question = strip_request_item_nl('question');
if ($question != "") {
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']))
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'])) {

File diff suppressed because it is too large Load Diff

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>