From 74647e16d37fac9425a4561b49618b52cdc3e75c Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Fri, 22 Aug 2014 22:34:13 +0200 Subject: add basic bootstrap theme --- includes/controller/angeltypes_controller.php | 2 +- includes/controller/users_controller.php | 48 +++++- includes/helper/message_helper.php | 6 +- includes/pages/admin_active.php | 2 +- includes/pages/admin_arrive.php | 10 +- includes/pages/admin_free.php | 45 ++--- includes/pages/admin_log.php | 18 +- includes/pages/admin_news.php | 124 +++++--------- includes/pages/admin_questions.php | 90 +++++----- includes/pages/admin_rooms.php | 143 ++++++++-------- includes/pages/admin_shifts.php | 238 +++++++++++++------------- includes/pages/admin_user.php | 4 +- includes/pages/guest_login.php | 12 +- includes/pages/user_messages.php | 12 +- includes/pages/user_myshifts.php | 2 +- includes/pages/user_news.php | 205 ++++++++++------------ includes/pages/user_questions.php | 17 +- includes/pages/user_settings.php | 4 +- includes/pages/user_shifts.php | 55 +++--- includes/sys_menu.php | 22 +-- includes/sys_template.php | 87 ++++++++-- includes/view/AngelTypes_view.php | 24 +-- includes/view/Questions_view.php | 2 +- includes/view/ShiftEntry_view.php | 4 +- includes/view/UserAngelTypes_view.php | 14 +- includes/view/User_view.php | 11 +- 26 files changed, 632 insertions(+), 569 deletions(-) (limited to 'includes') diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index 59e55a2d..ba0d65d9 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -149,7 +149,7 @@ function angeltype_edit_controller() { } return array( - isset($angeltype) ? sprintf(_("Edit %s"), $name) : _("Add new angeltype"), + sprintf(_("Edit %s"), $name), AngelType_edit_view($name, $restricted, $description, $coordinator_mode) ); } diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php index bf83fa9e..f65f54e3 100644 --- a/includes/controller/users_controller.php +++ b/includes/controller/users_controller.php @@ -1,7 +1,53 @@ ' . $msg . '

'; + return '
' . $msg . '
'; } else { if (! isset($_SESSION['msg'])) $_SESSION['msg'] = ""; @@ -33,7 +33,7 @@ function error($msg, $immediatly = false) { if ($immediatly) { if ($msg == "") return ""; - return '

' . $msg . '

'; + return '
' . $msg . '
'; } else { if (! isset($_SESSION['msg'])) $_SESSION['msg'] = ""; @@ -48,7 +48,7 @@ function success($msg, $immediatly = false) { if ($immediatly) { if ($msg == "") return ""; - return '

' . $msg . '

'; + return '
' . $msg . '
'; } else { if (! isset($_SESSION['msg'])) $_SESSION['msg'] = ""; diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index 805c8357..24628d0e 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -137,7 +137,7 @@ function admin_active() { 'count' => '' . sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Tshirt`=1") . '' ); - return page(array( + return page_with_title(admin_active_title(), array( form(array( form_text('search', _("Search angel:"), $search), form_submit('submit', _("Search")) diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index 001da9ba..bec1ae56 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -15,18 +15,18 @@ function admin_arrive() { if ($user_source != null) { sql_query("UPDATE `User` SET `Gekommen`=0 WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); engelsystem_log("User set to not arrived: " . User_Nick_render($user_source)); - $msg = success("Reset done. Angel has not arrived.", true); + $msg = success(_("Reset done. Angel has not arrived."), true); } else - $msg = error("Angel not found.", true); + $msg = error(_("Angel not found."), true); } elseif (isset($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) { $id = $_REQUEST['arrived']; $user_source = User($id); if ($user_source != null) { sql_query("UPDATE `User` SET `Gekommen`=1 WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); engelsystem_log("User set has arrived: " . User_Nick_render($user_source)); - $msg = success("Angel has been marked as arrived.", true); + $msg = success(_("Angel has been marked as arrived."), true); } else - $msg = error("Angel not found.", true); + $msg = error(_("Angel not found."), true); } $users = sql_select("SELECT * FROM `User` ORDER BY `Nick`"); @@ -60,7 +60,7 @@ function admin_arrive() { $table .= ''; $users_matched[] = $usr; } - return page(array( + return page_with_title(admin_arrive_title(), array( msg(), form(array( form_text('search', _("Search"), $search), diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index 86bd38a1..19a4c99f 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -5,31 +5,33 @@ function admin_free_title() { function admin_free() { global $privileges; - + $search = ""; - if (isset ($_REQUEST['search'])) + if (isset($_REQUEST['search'])) $search = strip_request_item('search'); - + $angeltypesearch = ""; - if (empty ($_REQUEST['angeltype'])) + if (empty($_REQUEST['angeltype'])) $_REQUEST['angeltype'] = ''; else { $angeltypesearch = " INNER JOIN `UserAngelTypes` ON (`UserAngelTypes`.`angeltype_id` = '" . sql_escape($_REQUEST['angeltype']) . "' AND `UserAngelTypes`.`user_id` = `User`.`UID`"; - if (isset ($_REQUEST['confirmed_only'])) + if (isset($_REQUEST['confirmed_only'])) $angeltypesearch .= " AND `UserAngelTypes`.`confirm_user_id`"; $angeltypesearch .= ") "; } - + $angel_types_source = sql_select("SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`"); - $angel_types = array('' => 'alle Typen'); + $angel_types = array( + '' => 'alle Typen' + ); foreach ($angel_types_source as $angel_type) $angel_types[$angel_type['id']] = $angel_type['name']; - + $users = sql_select("SELECT `User`.* FROM `User` ${angeltypesearch} LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID` AND `Shifts`.`start` < " . sql_escape(time()) . " AND `Shifts`.`end` > " . sql_escape(time()) . ") WHERE `User`.`Gekommen` = 1 AND `Shifts`.`SID` IS NULL GROUP BY `User`.`UID` ORDER BY `Nick`"); - + $table = ""; if ($search == "") - $tokens = array (); + $tokens = array(); else $tokens = explode(" ", $search); foreach ($users as $usr) { @@ -38,10 +40,10 @@ function admin_free() { $index = join("", $usr); foreach ($tokens as $t) if (stristr($index, trim($t))) { - $match = true; - break; - } - if (!$match) + $match = true; + break; + } + if (! $match) continue; } $table .= ''; @@ -52,15 +54,16 @@ function admin_free() { $table .= 'edit'; else $table .= '' . User_Nick_render($usr) . ''; - + $table .= ''; } - return template_render('../templates/admin_free.html', array ( - 'search' => $search, - 'angeltypes' => html_select_key('angeltype', 'angeltype', $angel_types, $_REQUEST['angeltype']), - 'confirmed_only' => isset($_REQUEST['confirmed_only'])? 'checked' : '', - 'table' => $table, - 'link' => page_link_to('admin_free') + return template_render('../templates/admin_free.html', array( + 'title' => admin_free_title(), + 'search' => $search, + 'angeltypes' => html_select_key('angeltype', 'angeltype', $angel_types, $_REQUEST['angeltype']), + 'confirmed_only' => isset($_REQUEST['confirmed_only']) ? 'checked' : '', + 'table' => $table, + 'link' => page_link_to('admin_free') )); } ?> diff --git a/includes/pages/admin_log.php b/includes/pages/admin_log.php index 2dfc169a..b60a9fca 100644 --- a/includes/pages/admin_log.php +++ b/includes/pages/admin_log.php @@ -6,18 +6,18 @@ function admin_log_title() { function admin_log() { $log_entries_source = LogEntries(); $log_entries = array(); - foreach($log_entries_source as $log_entry) { + foreach ($log_entries_source as $log_entry) { $log_entry['date'] = date("H:i", $log_entry['timestamp']); $log_entries[] = $log_entry; } - - return page(array( - msg(), - table(array( - 'date' => "Time", - 'nick' => "Angel", - 'message' => "Log Entry" - ), $log_entries) + + return page_with_title(admin_log_title(), array( + msg(), + table(array( + 'date' => "Time", + 'nick' => "Angel", + 'message' => "Log Entry" + ), $log_entries) )); } ?> diff --git a/includes/pages/admin_news.php b/includes/pages/admin_news.php index 25807151..39b37068 100644 --- a/includes/pages/admin_news.php +++ b/includes/pages/admin_news.php @@ -1,93 +1,61 @@ 0) { - list ($news) = $news; - + $html = '

' . _("Edit news entry") . '

'; + if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + $id = $_REQUEST['id']; + else + return error("Incomplete call, missing News ID.", true); + + $news = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); + if (count($news) > 0) { + switch ($_REQUEST["action"]) { + default: + redirect(page_link_to('news')); + case 'edit': + list($news) = $news; + $user_source = User($news['UID']); - if($user_source === false) + if ($user_source === false) engelsystem_error("Unable to load user."); - - $html .= '« Back'; - - $html .= "
\n"; - - $html .= "\n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= "
Datum" . - date("Y-m-d H:i", $news['Datum']) . "
Betreff
Text
Engel" . - User_Nick_render($user_source) . "
Treffen" . html_select_key('eTreffen', 'eTreffen', array ( - '1' => "Ja", - '0' => "Nein" - ), $news['Treffen']) . "
"; - - $html .= "\n"; - $html .= "\n"; - $html .= "
"; - - $html .= "
\n"; - $html .= "\n"; - $html .= "\n"; - $html .= "
"; - } else - return error("No News found.", true); - break; - - case 'save' : - if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) - $id = $_REQUEST['id']; - else - return error("Incomplete call, missing News ID.", true); - - $news = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); - if (count($news) > 0) { - list ($news) = $news; - - sql_query("UPDATE `News` SET `Datum`='" . sql_escape(time()) . "', `Betreff`='" . sql_escape($_POST["eBetreff"]) . "', `Text`='" . sql_escape($_POST["eText"]) . "', `UID`='" . sql_escape($user['UID']) . - "', `Treffen`='" . sql_escape($_POST["eTreffen"]) . "' WHERE `ID`=".sql_escape($id)." LIMIT 1"); + + $html .= form(array( + form_info(_("Date"), date("Y-m-d H:i", $news['Datum'])), + form_info(_("Author"), User_Nick_render($user_source)), + form_text('eBetreff', _("Subject"), $news['Betreff']), + form_textarea('eText', _("Message"), $news['Text']), + form_checkbox('eTreffen', _("Meeting"), $news['Treffen'] == 1, 1), + form_submit('submit', _("Save")) + ), page_link_to('admin_news&action=save&id=' . $id)); + + $html .= ' ' . _("Delete") . ''; + break; + + case 'save': + list($news) = $news; + + sql_query("UPDATE `News` SET `Datum`='" . sql_escape(time()) . "', `Betreff`='" . sql_escape($_POST["eBetreff"]) . "', `Text`='" . sql_escape($_POST["eText"]) . "', `UID`='" . sql_escape($user['UID']) . "', `Treffen`='" . sql_escape($_POST["eTreffen"]) . "' WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); engelsystem_log("News updated: " . $_POST["eBetreff"]); + success(_("News entry updated.")); redirect(page_link_to("news")); - } else - return error("No News found.", 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 News ID.", true); - - $news = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); - if (count($news) > 0) { - list ($news) = $news; - + break; + + case 'delete': + list($news) = $news; + sql_query("DELETE FROM `News` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); engelsystem_log("News deleted: " . $news['Betreff']); + success(_("News entry deleted.")); redirect(page_link_to("news")); - } else - return error("No News found.", true); - break; - } + break; + } + } else + return error("No News found.", true); } - return $html; + return $html . '
'; } ?> \ No newline at end of file diff --git a/includes/pages/admin_questions.php b/includes/pages/admin_questions.php index b70495f6..5d4fbd61 100644 --- a/includes/pages/admin_questions.php +++ b/includes/pages/admin_questions.php @@ -5,77 +5,75 @@ function admin_questions_title() { function admin_new_questions() { global $user, $privileges; - + if (in_array("admin_questions", $privileges)) { - $new_messages = sql_num_query("SELECT * FROM `Questions` WHERE `AID`=0"); - + $new_messages = sql_num_query("SELECT * FROM `Questions` WHERE `AID` IS NULL"); + if ($new_messages > 0) - return '

Es gibt unbeantwortete Fragen!


'; + return info('Es gibt unbeantwortete Fragen!', true); } - + return ""; } function admin_questions() { global $user; - - if (!isset ($_REQUEST['action'])) { + + if (! isset($_REQUEST['action'])) { $open_questions = ""; - $questions = sql_select("SELECT * FROM `Questions` WHERE `AID`=0"); + $questions = sql_select("SELECT * FROM `Questions` WHERE `AID` IS NULL"); foreach ($questions as $question) { $user_source = User($question['UID']); - if($user_source === false) + if ($user_source === false) engelsystem_error("Unable to load user."); - - $open_questions .= template_render( - '../templates/admin_question_unanswered.html', array ( - 'question_nick' => User_Nick_render($user_source), - 'question_id' => $question['QID'], - 'link' => page_link_to("admin_questions"), - 'question' => str_replace("\n", '
', $question['Question']) - )); + + $open_questions .= template_render('../templates/admin_question_unanswered.html', array( + 'question_nick' => User_Nick_render($user_source), + 'question_id' => $question['QID'], + 'link' => page_link_to("admin_questions"), + 'question' => str_replace("\n", '
', $question['Question']) + )); } - + $answered_questions = ""; - $questions = sql_select("SELECT * FROM `Questions` WHERE `AID`>0"); - + $questions = sql_select("SELECT * FROM `Questions` WHERE NOT `AID` IS NULL"); + foreach ($questions as $question) { $user_source = User($question['UID']); - if($user_source === false) + if ($user_source === false) engelsystem_error("Unable to load user."); - + $answer_user_source = User($question['AID']); - if($answer_user_source === false) + if ($answer_user_source === false) engelsystem_error("Unable to load user."); - - $answered_questions .= template_render( - '../templates/admin_question_answered.html', array ( - 'question_id' => $question['QID'], - 'question_nick' => User_Nick_render($user_source), - 'question' => str_replace("\n", "
", $question['Question']), - 'answer_nick' => User_Nick_render($answer_user_source), - 'answer' => str_replace("\n", "
", $question['Answer']), - 'link' => page_link_to("admin_questions"), - )); + + $answered_questions .= template_render('../templates/admin_question_answered.html', array( + 'question_id' => $question['QID'], + 'question_nick' => User_Nick_render($user_source), + 'question' => str_replace("\n", "
", $question['Question']), + 'answer_nick' => User_Nick_render($answer_user_source), + 'answer' => str_replace("\n", "
", $question['Answer']), + 'link' => page_link_to("admin_questions") + )); } - - return template_render('../templates/admin_questions.html', array ( - 'link' => page_link_to("admin_questions"), - 'open_questions' => $open_questions, - 'answered_questions' => $answered_questions + + return template_render('../templates/admin_questions.html', array( + 'link' => page_link_to("admin_questions"), + 'open_questions' => $open_questions, + 'answered_questions' => $answered_questions )); } else { switch ($_REQUEST['action']) { - case 'answer' : - if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + case 'answer': + if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) $id = $_REQUEST['id']; else 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]['AID'] == "0") { + if (count($question) > 0 && $question[0]['AID'] == null) { $answer = trim(preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['answer']))); - + if ($answer != "") { sql_query("UPDATE `Questions` SET `AID`=" . sql_escape($user['UID']) . ", `Answer`='" . sql_escape($answer) . "' WHERE `QID`=" . sql_escape($id) . " LIMIT 1"); engelsystem_log("Question " . $question[0]['Question'] . " answered: " . $answer); @@ -85,12 +83,12 @@ function admin_questions() { } else return error("No question found.", 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); - + $question = sql_select("SELECT * FROM `Questions` WHERE `QID`=" . sql_escape($id) . " LIMIT 1"); if (count($question) > 0) { sql_query("DELETE FROM `Questions` WHERE `QID`=" . sql_escape($id) . " LIMIT 1"); diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php index 5e880adb..08d450b8 100644 --- a/includes/pages/admin_rooms.php +++ b/includes/pages/admin_rooms.php @@ -5,32 +5,32 @@ function admin_rooms_title() { function admin_rooms() { global $user; - + $rooms_source = sql_select("SELECT * FROM `Room` ORDER BY `Name`"); - $rooms = array (); + $rooms = array(); foreach ($rooms_source as $room) - $rooms[] = array ( - 'name' => $room['Name'], - 'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '✓' : '', - 'public' => $room['show'] == 'Y' ? '✓' : '', - 'actions' => 'edit delete' + $rooms[] = array( + 'name' => $room['Name'], + 'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '✓' : '', + 'public' => $room['show'] == 'Y' ? '✓' : '', + 'actions' => 'edit delete' ); - - if (isset ($_REQUEST['show'])) { + + if (isset($_REQUEST['show'])) { $msg = ""; $name = ""; $from_pentabarf = ""; $public = 'Y'; $number = ""; - + $angeltypes_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`"); - $angeltypes = array (); - $angeltypes_count = array (); + $angeltypes = array(); + $angeltypes_count = array(); foreach ($angeltypes_source as $angeltype) { $angeltypes[$angeltype['id']] = $angeltype['name']; $angeltypes_count[$angeltype['id']] = 0; } - + if (test_request_int('id')) { $room = sql_select("SELECT * FROM `Room` WHERE `RID`=" . sql_escape($_REQUEST['id'])); if (count($room) > 0) { @@ -44,120 +44,119 @@ function admin_rooms() { } else redirect(page_link_to('admin_rooms')); } - + if ($_REQUEST['show'] == 'edit') { - if (isset ($_REQUEST['submit'])) { + if (isset($_REQUEST['submit'])) { $ok = true; - - if (isset ($_REQUEST['name']) && strlen(strip_request_item('name')) > 0) + + if (isset($_REQUEST['name']) && strlen(strip_request_item('name')) > 0) $name = strip_request_item('name'); else { $ok = false; $msg .= error("Please enter a name.", true); } - - if (isset ($_REQUEST['from_pentabarf'])) + + if (isset($_REQUEST['from_pentabarf'])) $from_pentabarf = 'Y'; else $from_pentabarf = ''; - - if (isset ($_REQUEST['public'])) + + if (isset($_REQUEST['public'])) $public = 'Y'; else $public = ''; - - if (isset ($_REQUEST['number'])) + + if (isset($_REQUEST['number'])) $number = strip_request_item('number'); else $ok = false; - + foreach ($angeltypes as $angeltype_id => $angeltype) { - if (isset ($_REQUEST['angeltype_count_' . $angeltype_id]) && preg_match("/^[0-9]{1,4}$/", $_REQUEST['angeltype_count_' . $angeltype_id])) + if (isset($_REQUEST['angeltype_count_' . $angeltype_id]) && preg_match("/^[0-9]{1,4}$/", $_REQUEST['angeltype_count_' . $angeltype_id])) $angeltypes_count[$angeltype_id] = $_REQUEST['angeltype_count_' . $angeltype_id]; else { $ok = false; $msg .= error(sprintf("Please enter needed angels for type %s.", $angeltype), true); } } - + if ($ok) { - if(isset($id)) { + if (isset($id)) { sql_query("UPDATE `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "' WHERE `RID`=" . sql_escape($id) . " LIMIT 1"); engelsystem_log("Room updated: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number); } else { - sql_query("INSERT INTO `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "'"); + sql_query("INSERT INTO `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "'"); $id = sql_id(); engelsystem_log("Room created: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number); } - + sql_query("DELETE FROM `NeededAngelTypes` WHERE `room_id`=" . sql_escape($id)); $needed_angeltype_info = array(); foreach ($angeltypes_count as $angeltype_id => $angeltype_count) { $angeltype_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($angeltype_id) . " LIMIT 1"); - if(count($angeltype_source) > 0) { + if (count($angeltype_source) > 0) { sql_query("INSERT INTO `NeededAngelTypes` SET `room_id`=" . sql_escape($id) . ", `angel_type_id`=" . sql_escape($angeltype_id) . ", `count`=" . sql_escape($angeltype_count)); $needed_angeltype_info[] = $angeltypes_source[0]['name'] . ": " . $angeltype_count; } } - + engelsystem_log("Set needed angeltypes of room " . $name . " to: " . join(", ", $needed_angeltype_info)); success("Room saved."); redirect(page_link_to("admin_rooms")); } } - $angeltypes_count_form = array (); + $angeltypes_count_form = array(); foreach ($angeltypes as $angeltype_id => $angeltype) $angeltypes_count_form[] = form_text('angeltype_count_' . $angeltype_id, $angeltype, $angeltypes_count[$angeltype_id]); - - return page(array ( - buttons(array ( - button(page_link_to('admin_rooms'), "Back", 'back') - )), - $msg, - form(array ( - form_text('name', "Name", $name), - form_checkbox('from_pentabarf', "Pentabarf-Import", $from_pentabarf), - form_checkbox('public', "Public", $public), - form_text('number', "Number", $number), - form_info("Needed angels:", ""), - join($angeltypes_count_form), - form_submit('submit', 'Save') - )) + + return page_with_title(admin_rooms_title(), array( + buttons(array( + button(page_link_to('admin_rooms'), "Back", 'back') + )), + $msg, + form(array( + form_text('name', "Name", $name), + form_checkbox('from_pentabarf', "Pentabarf-Import", $from_pentabarf), + form_checkbox('public', "Public", $public), + form_text('number', "Number", $number), + form_info("Needed angels:", ""), + join($angeltypes_count_form), + form_submit('submit', 'Save') + )) )); - } - elseif ($_REQUEST['show'] == 'delete') { - if (isset ($_REQUEST['ack'])) { + } elseif ($_REQUEST['show'] == 'delete') { + if (isset($_REQUEST['ack'])) { sql_query("DELETE FROM `Room` WHERE `RID`=" . sql_escape($id) . " LIMIT 1"); sql_query("DELETE FROM `NeededAngelTypes` WHERE `room_id`=" . sql_escape($id) . " LIMIT 1"); - + engelsystem_log("Room deleted: " . $name); success(sprintf("Room %s deleted.", $name)); redirect(page_link_to('admin_rooms')); } - - return page(array ( - buttons(array ( - button(page_link_to('admin_rooms'), "Back", 'back') - )), - sprintf("Do you want to delete room %s?", $name), - buttons(array ( - button(page_link_to('admin_rooms') . '&show=delete&id=' . $id . '&ack', "Delete", 'delete') - )) + + return page_with_title(admin_rooms_title(), array( + buttons(array( + button(page_link_to('admin_rooms'), "Back", 'back') + )), + sprintf("Do you want to delete room %s?", $name), + buttons(array( + button(page_link_to('admin_rooms') . '&show=delete&id=' . $id . '&ack', "Delete", 'delete') + )) )); } } - - return page(array ( - buttons(array ( - button(page_link_to('admin_rooms') . '&show=edit', "Add", 'add') - )), - msg(), - table(array ( - 'name' => "Name", - 'from_pentabarf' => "Pentabarf-Import", - 'public' => "Public", - 'actions' => "" - ), $rooms) + + return page_with_title(admin_rooms_title(), array( + buttons(array( + button(page_link_to('admin_rooms') . '&show=edit', "Add", 'add') + )), + msg(), + table(array( + 'name' => "Name", + 'from_pentabarf' => "Pentabarf-Import", + 'public' => "Public", + 'actions' => "" + ), $rooms) )); } ?> diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 1f17cf6e..7e3cc3b3 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -7,74 +7,73 @@ function admin_shifts_title() { function admin_shifts() { $msg = ""; $ok = true; - + $rid = 0; - $start = DateTime :: createFromFormat("Y-m-d H:i", date("Y-m-d") . " 00:00")->getTimestamp(); - $end = $start +24 * 60 * 60; - $mode = ''; - $angelmode = ''; + $start = DateTime::createFromFormat("Y-m-d H:i", date("Y-m-d") . " 00:00")->getTimestamp(); + $end = $start + 24 * 60 * 60; + $mode = 'single'; + $angelmode = 'location'; $length = ''; $change_hours = array(); - + $name = ""; + // Locations laden (auch unsichtbare - fuer Erzengel ist das ok) $rooms = sql_select("SELECT * FROM `Room` ORDER BY `Name`"); - $room_array = array (); + $room_array = array(); foreach ($rooms as $room) $room_array[$room['RID']] = $room['Name']; - - // Engeltypen laden + + // Engeltypen laden $types = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`"); - $needed_angel_types = array (); + $needed_angel_types = array(); foreach ($types as $type) $needed_angel_types[$type['id']] = 0; - - if (isset ($_REQUEST['preview']) || isset ($_REQUEST['back'])) { + + if (isset($_REQUEST['preview']) || isset($_REQUEST['back'])) { // Name/Bezeichnung der Schicht, darf leer sein $name = strip_request_item('name'); - + // Auswahl der sichtbaren Locations für die Schichten - if (isset ($_REQUEST['rid']) && preg_match("/^[0-9]+$/", $_REQUEST['rid']) && isset ($room_array[$_REQUEST['rid']])) + if (isset($_REQUEST['rid']) && preg_match("/^[0-9]+$/", $_REQUEST['rid']) && isset($room_array[$_REQUEST['rid']])) $rid = $_REQUEST['rid']; else { $ok = false; $rid = $rooms[0]['RID']; $msg .= error("Wähle bitte einen Raum aus.", true); } - - if (isset ($_REQUEST['start']) && $tmp = DateTime :: createFromFormat("Y-m-d H:i", trim($_REQUEST['start']))) + + if (isset($_REQUEST['start']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['start']))) $start = $tmp->getTimestamp(); else { $ok = false; $msg .= error("Bitte gib einen Startzeitpunkt für die Schichten an.", true); } - - if (isset ($_REQUEST['end']) && $tmp = DateTime :: createFromFormat("Y-m-d H:i", trim($_REQUEST['end']))) + + if (isset($_REQUEST['end']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['end']))) $end = $tmp->getTimestamp(); else { $ok = false; $msg .= error("Bitte gib einen Endzeitpunkt für die Schichten an.", true); } - + if ($start >= $end) { $ok = false; $msg .= error("Das Ende muss nach dem Startzeitpunkt liegen!", true); } - - if (isset ($_REQUEST['mode'])) { + + if (isset($_REQUEST['mode'])) { if ($_REQUEST['mode'] == 'single') { $mode = 'single'; - } - elseif ($_REQUEST['mode'] == 'multi') { - if (isset ($_REQUEST['length']) && preg_match("/^[0-9]+$/", trim($_REQUEST['length']))) { + } elseif ($_REQUEST['mode'] == 'multi') { + if (isset($_REQUEST['length']) && preg_match("/^[0-9]+$/", trim($_REQUEST['length']))) { $mode = 'multi'; $length = trim($_REQUEST['length']); } else { $ok = false; $msg .= error("Bitte gib eine Schichtlänge in Minuten an.", true); } - } - elseif ($_REQUEST['mode'] == 'variable') { - if (isset ($_REQUEST['change_hours']) && preg_match("/^([0-9]{2}(,|$))/", trim(str_replace(" ", "", $_REQUEST['change_hours'])))) { + } elseif ($_REQUEST['mode'] == 'variable') { + if (isset($_REQUEST['change_hours']) && preg_match("/^([0-9]{2}(,|$))/", trim(str_replace(" ", "", $_REQUEST['change_hours'])))) { $mode = 'variable'; $change_hours = array_map('trim', explode(",", $_REQUEST['change_hours'])); } else { @@ -86,15 +85,14 @@ function admin_shifts() { $ok = false; $msg .= error("Bitte wähle einen Modus.", true); } - - if (isset ($_REQUEST['angelmode'])) { + + if (isset($_REQUEST['angelmode'])) { if ($_REQUEST['angelmode'] == 'location') { $angelmode = 'location'; - } - elseif ($_REQUEST['angelmode'] == 'manually') { + } elseif ($_REQUEST['angelmode'] == 'manually') { $angelmode = 'manually'; foreach ($types as $type) { - if (isset ($_REQUEST['type_' . $type['id']]) && preg_match("/^[0-9]+$/", trim($_REQUEST['type_' . $type['id']]))) { + if (isset($_REQUEST['type_' . $type['id']]) && preg_match("/^[0-9]+$/", trim($_REQUEST['type_' . $type['id']]))) { $needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]); } else { $ok = false; @@ -113,51 +111,49 @@ function admin_shifts() { $ok = false; $msg .= error("Bitte wähle benötigte Engel.", true); } - + // Beim Zurück-Knopf das Formular zeigen - if (isset ($_REQUEST['back'])) + if (isset($_REQUEST['back'])) $ok = false; - - // Alle Eingaben in Ordnung + + // Alle Eingaben in Ordnung if ($ok) { if ($angelmode == 'location') { - $needed_angel_types = array (); + $needed_angel_types = array(); $needed_angel_types_location = sql_select("SELECT * FROM `NeededAngelTypes` WHERE `room_id`=" . sql_escape($rid)); foreach ($needed_angel_types_location as $type) $needed_angel_types[$type['angel_type_id']] = $type['count']; } - $shifts = array (); + $shifts = array(); if ($mode == 'single') { - $shifts[] = array ( - 'start' => $start, - 'end' => $end, - 'RID' => $rid, - 'name' => $name + $shifts[] = array( + 'start' => $start, + 'end' => $end, + 'RID' => $rid, + 'name' => $name ); - } - elseif ($mode == 'multi') { + } elseif ($mode == 'multi') { $shift_start = $start; do { $shift_end = $shift_start + $length * 60; - + if ($shift_end > $end) $shift_end = $end; if ($shift_start >= $shift_end) break; - - $shifts[] = array ( - 'start' => $shift_start, - 'end' => $shift_end, - 'RID' => $rid, - 'name' => $name + + $shifts[] = array( + 'start' => $shift_start, + 'end' => $shift_end, + 'RID' => $rid, + 'name' => $name ); - + $shift_start = $shift_end; } while ($shift_end < $end); - } - elseif ($mode == 'variable') { + } elseif ($mode == 'variable') { rsort($change_hours); - $day = DateTime :: createFromFormat("Y-m-d H:i", date("Y-m-d", $start) . " 00:00")->getTimestamp(); + $day = DateTime::createFromFormat("Y-m-d H:i", date("Y-m-d", $start) . " 00:00")->getTimestamp(); $change_index = 0; // Ersten/nächsten passenden Schichtwechsel suchen foreach ($change_hours as $i => $change_hour) { @@ -165,71 +161,70 @@ function admin_shifts() { $change_index = $i; elseif ($start == $day + $change_hour * 60 * 60) { // Start trifft Schichtwechsel - $change_index = ($i +count($change_hours) - 1) % count($change_hours); + $change_index = ($i + count($change_hours) - 1) % count($change_hours); break; } else break; } - + $shift_start = $start; do { - $day = DateTime :: createFromFormat("Y-m-d H:i", date("Y-m-d", $shift_start) . " 00:00")->getTimestamp(); + $day = DateTime::createFromFormat("Y-m-d H:i", date("Y-m-d", $shift_start) . " 00:00")->getTimestamp(); $shift_end = $day + $change_hours[$change_index] * 60 * 60; - + if ($shift_end > $end) $shift_end = $end; if ($shift_start >= $shift_end) $shift_end += 24 * 60 * 60; - - $shifts[] = array ( - 'start' => $shift_start, - 'end' => $shift_end, - 'RID' => $rid, - 'name' => $name + + $shifts[] = array( + 'start' => $shift_start, + 'end' => $shift_end, + 'RID' => $rid, + 'name' => $name ); - + $shift_start = $shift_end; - $change_index = ($change_index +count($change_hours) - 1) % count($change_hours); + $change_index = ($change_index + count($change_hours) - 1) % count($change_hours); } while ($shift_end < $end); } - + $shifts_table = ""; foreach ($shifts as $shift) { - $shifts_table .= '' . date("Y-m-d H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']) . '
' . $room_array[$shift['RID']] . ''; + $shifts_table .= ' ' . date("Y-m-d H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']) . '
' . $room_array[$shift['RID']] . ''; $shifts_table .= '' . $shift['name']; foreach ($types as $type) { - if (isset ($needed_angel_types[$type['id']]) && $needed_angel_types[$type['id']] > 0) - $shifts_table .= '
' . $type['name'] . ': ' . $needed_angel_types[$type['id']] . ' missing'; + if (isset($needed_angel_types[$type['id']]) && $needed_angel_types[$type['id']] > 0) + $shifts_table .= '
' . $type['name'] . ': ' . $needed_angel_types[$type['id']] . ' missing'; } $shifts_table .= ''; } - + // Fürs Anlegen zwischenspeichern: $_SESSION['admin_shifts_shifts'] = $shifts; $_SESSION['admin_shifts_types'] = $needed_angel_types; - + $hidden_types = ""; foreach ($needed_angel_types as $type_id => $count) $hidden_types .= ''; - return template_render('../templates/admin_shift_preview.html', array ( - 'shifts_table' => $shifts_table, - 'name' => $name, - 'rid' => $rid, - 'start' => date("Y-m-d H:i", $start), - 'end' => date("Y-m-d H:i", $end), - 'mode' => $mode, - 'length' => $length, - 'change_hours' => implode(', ', $change_hours), - 'angelmode' => $angelmode, - 'needed_angel_types' => $hidden_types + return template_render('../templates/admin_shift_preview.html', array( + 'shifts_table' => $shifts_table, + 'name' => $name, + 'rid' => $rid, + 'start' => date("Y-m-d H:i", $start), + 'end' => date("Y-m-d H:i", $end), + 'mode' => $mode, + 'length' => $length, + 'change_hours' => implode(', ', $change_hours), + 'angelmode' => $angelmode, + 'needed_angel_types' => $hidden_types )); } - - } - elseif (isset ($_REQUEST['submit'])) { - if (!is_array($_SESSION['admin_shifts_shifts']) || !is_array($_SESSION['admin_shifts_types'])) + + } elseif (isset($_REQUEST['submit'])) { + if (! is_array($_SESSION['admin_shifts_shifts']) || ! is_array($_SESSION['admin_shifts_types'])) redirect(page_link_to('admin_shifts')); - + foreach ($_SESSION['admin_shifts_shifts'] as $shift) { sql_query("INSERT INTO `Shifts` SET `start`=" . sql_escape($shift['start']) . ", `end`=" . sql_escape($shift['end']) . ", `RID`=" . sql_escape($shift['RID']) . ", `name`='" . sql_escape($shift['name']) . "'"); $shift_id = sql_id(); @@ -237,43 +232,54 @@ function admin_shifts() { $needed_angel_types_info = array(); foreach ($_SESSION['admin_shifts_types'] as $type_id => $count) { $angel_type_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($type_id) . " LIMIT 1"); - if(count($angel_type_source) > 0) { + if (count($angel_type_source) > 0) { sql_query("INSERT INTO `NeededAngelTypes` SET `shift_id`=" . sql_escape($shift_id) . ", `angel_type_id`=" . sql_escape($type_id) . ", `count`=" . sql_escape($count)); $needed_angel_types_info[] = $angel_type_source[0]['name'] . ": " . $count; } } } - + engelsystem_log("Shift needs following angel types: " . join(", ", $needed_angel_types_info)); $msg = success("Schichten angelegt.", true); } else { - unset ($_SESSION['admin_shifts_shifts']); - unset ($_SESSION['admin_shifts_types']); + unset($_SESSION['admin_shifts_shifts']); + unset($_SESSION['admin_shifts_types']); } - + + if (! isset($_REQUEST['rid'])) + $_REQUEST['rid'] = null; $room_select = html_select_key('rid', 'rid', $room_array, $_REQUEST['rid']); $angel_types = ""; - foreach ($types as $type) { - $angel_types .= template_render('../templates/admin_shifts_angel_types.html', array ( - 'id' => $type['id'], - 'type' => $type['name'], - 'value' => $needed_angel_types[$type['id']] - )); - } - return template_render('../templates/admin_shifts.html', array ( - 'angel_types' => $angel_types, - 'room_select' => $room_select, - 'msg' => $msg, - 'name' => $name, - 'start' => date("Y-m-d H:i", $start), - 'end' => date("Y-m-d H:i", $end), - 'mode_single_selected' => $_REQUEST['mode'] == 'single' ? 'checked="checked"' : '', - 'mode_multi_selected' => $_REQUEST['mode'] == 'multi' ? 'checked="checked"' : '', - 'mode_multi_length' => !empty ($_REQUEST['length']) ? $_REQUEST['length'] : '120', - 'mode_variable_selected' => $_REQUEST['mode'] == 'variable' ? 'checked="checked"' : '', - 'mode_variable_hours' => !empty ($_REQUEST['change_hours']) ? $_REQUEST['change_hours'] : '00, 04, 08, 10, 12, 14, 16, 18, 20, 22', - 'angelmode_location_selected' => $_REQUEST['angelmode'] == 'location' ? 'checked="checked"' : '', - 'angelmode_manually_selected' => $_REQUEST['angelmode'] == 'manually' ? 'checked="checked"' : '' + foreach ($types as $type) + $angel_types .= form_spinner('type_' . $type['id'], $type['name'], $needed_angel_types[$type['id']]); + + return page_with_title(admin_shifts_title(), array( + msg(), + $msg, + form(array( + form_text('name', _("Name"), $name), + // TODO: form_textarea('description', _("Description"), ''), + form_select('rid', _("Room"), $room_array, $_REQUEST['rid']), + '
', + '
', + form_text('start', _("Start"), date("Y-m-d H:i", $start)), + form_text('end', _("End"), date("Y-m-d H:i", $end)), + form_info(_("Mode"), ''), + form_radio('mode', _("Create one shift"), $mode == 'single', 'single'), + form_radio('mode', _("Create multiple shifts"), $mode == 'multi', 'multi'), + form_text('length', _("Length"), ! empty($_REQUEST['length']) ? $_REQUEST['length'] : '120'), + form_radio('mode', _("Create multiple shifts with variable length"), $mode == 'variable', 'variable'), + form_text('change_hours', _("Shift change hours"), ! empty($_REQUEST['change_hours']) ? $_REQUEST['change_hours'] : '00, 04, 08, 10, 12, 14, 16, 18, 20, 22'), + '
', + '
', + form_info(_("Needed angels"), ''), + form_radio('angelmode', _("Take needed angels from room settings"), $angelmode == 'location', 'location'), + form_radio('angelmode', _("The following angels are needed"), $angelmode == 'manually', 'manually'), + $angel_types, + '
', + '
', + form_submit('preview', _("Preview")) + )) )); } ?> diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 67ec93f7..7df39d0d 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -6,7 +6,7 @@ function admin_user_title() { function admin_user() { global $user, $privileges, $tshirt_sizes, $privileges; - $html = ""; + $html = '
'; if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['id']) && sql_num_query("SELECT * FROM `User` WHERE `UID`=" . sql_escape($_REQUEST['id'])) > 0) { $id = $_REQUEST['id']; @@ -346,6 +346,6 @@ function admin_user() { 'edit' => '' ), $angels); } - return $html; + return $html . '
'; } ?> diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index e4188151..29487f99 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -135,7 +135,7 @@ function guest_register() { } } - return page(array( + return page_with_title(register_title(), array( _("By completing this form you're registering as a Chaos-Angel. This script will create you an account in the angel task sheduler."), $msg, msg(), @@ -208,17 +208,20 @@ function guest_login() { } } - return page(array( + return page_with_title(login_title(), array( msg(), + '
', form(array( form_text('nick', _("Nick"), $nick), form_password('password', _("Password")), + form_submit('submit', _("Login")), form_info("", buttons(array( button(page_link_to('user_password_recovery'), _("I forgot my password")) ))), - form_submit('submit', _("Login")), info(_("Please note: You have to activate cookies!"), true) )), + '
', + '
', '

' . register_title() . '

', '

' . _("Please sign up, if you want to help us!") . '

', buttons(array( @@ -228,7 +231,8 @@ function guest_login() { '

' . _("Please read about the jobs you can do to help us.") . '

', buttons(array( button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' »') - )) + )), + '
' )); } ?> diff --git a/includes/pages/user_messages.php b/includes/pages/user_messages.php index 7a05491c..a1b565ec 100644 --- a/includes/pages/user_messages.php +++ b/includes/pages/user_messages.php @@ -4,16 +4,13 @@ function messages_title() { } function user_unread_messages() { - global $user, $privileges; + global $user; - if (in_array("user_messages", $privileges)) { + if (isset($user)) { $new_messages = sql_num_query("SELECT * FROM `Messages` WHERE isRead='N' AND `RUID`=" . sql_escape($user['UID'])); - - if ($new_messages > 0) - return sprintf('

%s


', page_link_to("user_messages"), sprintf(ngettext("You have %s new message.", "You have %s new messages.", $new_messages), $new_messages)); + return '' . $new_messages . ''; } - - return ""; + return ''; } function user_messages() { @@ -54,6 +51,7 @@ function user_messages() { } return template_render('../templates/user_messages.html', array( + 'title' => messages_title(), 'link' => page_link_to("user_messages"), 'greeting' => sprintf(_("Hello %s, here can you leave messages for other angels"), User_Nick_render($user)) . '

', 'messages' => $messages_html, diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index 1395d3bf..12ba5562 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -143,7 +143,7 @@ function user_myshifts() { 'actions' => "" ); - return page(array( + return page_with_title(myshifts_title(), array( msg(), $id == $user['UID'] ? sprintf(_('These are your shifts.
Please try to appear 15 minutes before your shift begins!
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) : '', diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php index c85a6243..b8879e62 100644 --- a/includes/pages/user_news.php +++ b/includes/pages/user_news.php @@ -13,182 +13,153 @@ function meetings_title() { function user_meetings() { global $DISPLAY_NEWS, $privileges, $user; - - $html = ""; - - if (isset ($_REQUEST['page']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['page'])) + + $html = '

' . meetings_title() . '

'; + + if (isset($_REQUEST['page']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['page'])) $page = $_REQUEST['page']; else $page = 0; - + $news = sql_select("SELECT * FROM `News` WHERE `Treffen`=1 ORDER BY `ID` DESC LIMIT " . sql_escape($page * $DISPLAY_NEWS) . ", " . sql_escape($DISPLAY_NEWS)); foreach ($news as $entry) $html .= display_news($entry); - - $html .= "
\n\n"; - $dis_rows = ceil(sql_num_query("SELECT * FROM `News` WHERE `Treffen`=1") / $DISPLAY_NEWS); - - $html .= _("Page:"); - - for ($i = 0; $i < $dis_rows; $i++) { + + $dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $DISPLAY_NEWS); + $html .= '
' . '
    '; + for ($i = 0; $i < $dis_rows; $i ++) { if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) - $html .= ($i +1) . "  "; + $html .= '
  • '; + elseif (! isset($_REQUEST['page']) && $i == 0) + $html .= '
  • '; else - $html .= '' . ($i +1) . '  '; + $html .= '
  • '; + $html .= '' . ($i + 1) . '
  • '; } - $html .= '
'; + $html .= '
'; + return $html; } function display_news($news) { global $privileges, $p; - - $html = ""; - $html .= '
'; - $html .= '
'; - $html .= date("Y-m-d H:i", $news['Datum']) . ', '; - + + $html = ''; + $html .= '
'; + $html .= '
'; + $html .= '

' . ($news['Treffen'] == 1 ? '[Meeting] ' : '') . ReplaceSmilies($news['Betreff']) . '

'; + $html .= '
'; + $html .= '
' . ReplaceSmilies(nl2br($news['Text'])) . '
'; + + $html .= '
'; - $html .= '

' . ($news['Treffen'] == 1 ? '[Meeting] ' : '') . ReplaceSmilies($news['Betreff']) . '

'; - $html .= '

' . ReplaceSmilies(nl2br($news['Text'])) . '

'; - if (in_array("admin_news", $privileges)) - $html .= '
' . _("edit") . '
'; - - $html .= '
'; + $html .= '  ' . _("Comments") . ' » ' . sql_num_query("SELECT * FROM `NewsComments` WHERE `Refid`='" . sql_escape($news['ID']) . "'") . ''; + $html .= ''; + $html .= ''; return $html; } function user_news_comments() { global $user; - - $html = ""; - if (isset ($_REQUEST["nid"]) && preg_match("/^[0-9]{1,}$/", $_REQUEST['nid']) && sql_num_query("SELECT * FROM `News` WHERE `ID`=" . sql_escape($_REQUEST['nid']) . " LIMIT 1") > 0) { + + $html = '

' . user_news_comments_title() . '

'; + if (isset($_REQUEST["nid"]) && preg_match("/^[0-9]{1,}$/", $_REQUEST['nid']) && sql_num_query("SELECT * FROM `News` WHERE `ID`=" . sql_escape($_REQUEST['nid']) . " LIMIT 1") > 0) { $nid = $_REQUEST["nid"]; - list ($news) = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($nid) . " LIMIT 1"); - if (isset ($_REQUEST["text"])) { + list($news) = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($nid) . " LIMIT 1"); + if (isset($_REQUEST["text"])) { $text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['text'])); sql_query("INSERT INTO `NewsComments` (`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(_("Entry saved."), true); } - - $html .= '« ' . _("back") . ''; + $html .= display_news($news); - - $html .= '

' . _("Comments") . '

'; - + $comments = sql_select("SELECT * FROM `NewsComments` WHERE `Refid`='" . sql_escape($nid) . "' ORDER BY 'ID'"); foreach ($comments as $comment) { $user_source = User($comment['UID']); - if($user_source === false) + if ($user_source === false) engelsystem_error(_("Unable to load user.")); - - $html .= '
'; - $html .= User_Avatar_render($user_source); - $html .= '
'; - $html .= $comment['Datum'] . ', '; + + $html .= '
'; + $html .= '
' . nl2br($comment['Text']) . '
'; + $html .= '
'; - $html .= '

' . nl2br($comment['Text']) . '

'; - $html .= '
'; + $html .= '
'; + $html .= ''; } - - $html .= ""; - $html .= ' -
-
-

' . _("New Comment:") . '

-   - -
- - - - - - -
' . _("Message:") . '
-
- -
'; + + $html .= '

' . _("New Comment:") . '

'; + $html .= form(array( + form_textarea('text', _("Message"), ''), + form_submit('submit', _("Save")) + ), page_link_to('news_comments') . '&nid=' . $news['ID']); + } else { $html .= _("Invalid request."); } - - return $html; + + return $html . ''; } function user_news() { global $DISPLAY_NEWS, $privileges, $user; - - $html = msg(); - - if (isset ($_POST["text"]) && isset ($_POST["betreff"]) && in_array("admin_news", $privileges)) { - if (!isset ($_POST["treffen"]) || !in_array("admin_news", $privileges)) + + $html = '

' . news_title() . '

' . msg(); + + if (isset($_POST["text"]) && isset($_POST["betreff"]) && in_array("admin_news", $privileges)) { + if (! isset($_POST["treffen"]) || ! in_array("admin_news", $privileges)) $_POST["treffen"] = 0; - sql_query("INSERT INTO `News` (`Datum`, `Betreff`, `Text`, `UID`, `Treffen`) " . - "VALUES ('" . sql_escape(time()) . "', '" . sql_escape($_POST["betreff"]) . "', '" . sql_escape($_POST["text"]) . "', '" . sql_escape($user['UID']) . - "', '" . sql_escape($_POST["treffen"]) . "');"); + sql_query("INSERT INTO `News` (`Datum`, `Betreff`, `Text`, `UID`, `Treffen`) " . "VALUES ('" . sql_escape(time()) . "', '" . sql_escape($_POST["betreff"]) . "', '" . sql_escape($_POST["text"]) . "', '" . sql_escape($user['UID']) . "', '" . sql_escape($_POST["treffen"]) . "');"); engelsystem_log("Created news: " . $_POST["betreff"] . ", treffen: " . $_POST["treffen"]); success(_("Entry saved.")); redirect(page_link_to('news')); } - - if (isset ($_REQUEST['page']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['page'])) + + if (isset($_REQUEST['page']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['page'])) $page = $_REQUEST['page']; else $page = 0; - + $news = sql_select("SELECT * FROM `News` ORDER BY `ID` DESC LIMIT " . sql_escape($page * $DISPLAY_NEWS) . ", " . sql_escape($DISPLAY_NEWS)); foreach ($news as $entry) $html .= display_news($entry); - - $html .= "
\n\n"; + $dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $DISPLAY_NEWS); - - $html .= _("Page:"); - - for ($i = 0; $i < $dis_rows; $i++) { + $html .= '
' . '
    '; + for ($i = 0; $i < $dis_rows; $i ++) { if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) - $html .= ($i +1) . "  "; + $html .= '
  • '; + elseif (! isset($_REQUEST['page']) && $i == 0) + $html .= '
  • '; else - $html .= '' . ($i +1) . '  '; + $html .= '
  • '; + $html .= '' . ($i + 1) . '
  • '; } - $html .= '
'; + $html .= '
'; + if (in_array("admin_news", $privileges)) { - $html .= '

-

' . _("Create news:") . '

-   - -
- - - - - - - - - '; - if (in_array('admin_news', $privileges)) { - $html .= ' - - - '; - - } - $html .= '
' . _("Subject") . ':
' . _("Message") . ':
' . _("Meeting") . ':
-
- -
'; + $html .= '
'; + $html .= '

' . _("Create news:") . '

'; + + $html .= form(array( + form_text('betreff', _("Subject"), ''), + form_textarea('text', _("Message"), ''), + form_checkbox('treffen', _("Meeting"), false, 1), + form_submit('submit', _("Save")) + )); } - return $html; + return $html . '
'; } ?> \ No newline at end of file diff --git a/includes/pages/user_questions.php b/includes/pages/user_questions.php index 0ed1339c..be7f9930 100644 --- a/includes/pages/user_questions.php +++ b/includes/pages/user_questions.php @@ -7,9 +7,9 @@ function user_questions() { global $user; if (! isset($_REQUEST['action'])) { - $open_questions = sql_select("SELECT * FROM `Questions` WHERE `AID`=0 AND `UID`=" . sql_escape($user['UID'])); + $open_questions = sql_select("SELECT * FROM `Questions` WHERE `AID` IS NULL AND `UID`=" . sql_escape($user['UID'])); - $answered_questions = sql_select("SELECT * FROM `Questions` WHERE `AID`>0 AND `UID`=" . sql_escape($user['UID'])); + $answered_questions = sql_select("SELECT * FROM `Questions` WHERE NOT `AID` IS NULL AND `UID`=" . sql_escape($user['UID'])); foreach ($answered_questions as &$question) { $answer_user_source = User($question['AID']); if ($answer_user_source === false) @@ -23,10 +23,15 @@ function user_questions() { 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) . "'"); + $result = sql_query("INSERT INTO `Questions` SET `UID`=" . sql_escape($user['UID']) . ", `Question`='" . sql_escape($question) . "'"); + if ($result === false) + engelsystem_error(_("Unable to save question.")); + success(_("You question was saved.")); redirect(page_link_to("user_questions")); } else - return error(_("Please enter a question!"), true); + return page_with_title(questions_title(), array( + error(_("Please enter a question!"), true) + )); break; case 'delete': if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) @@ -39,7 +44,9 @@ function user_questions() { 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 page_with_title(questions_title(), array( + error(_("No question found."), true) + )); break; } } diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index 2a54a485..da671b0b 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -162,7 +162,7 @@ function user_settings() { } } - return page(array( + return page_with_title(settings_title(), array( sprintf(_("Hello %s, here you can change your personal settings i.e. password, color settings etc."), User_Nick_render($user)), $msg, msg(), @@ -180,7 +180,7 @@ function user_settings() { form_text('jabber', _("Jabber"), $jabber), form_text('hometown', _("Hometown"), $hometown), $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '', - form_checkboxes('angel_types', _("What do you want to do?") . sprintf("
(%s)", page_link_to('angeltypes') . '&action=about', _("Description of job types")), $angel_types, $selected_angel_types), + form_checkboxes('angel_types', _("What do you want to do?") . sprintf(" (%s)", page_link_to('angeltypes') . '&action=about', _("Description of job types")), $angel_types, $selected_angel_types), form_submit('submit', _("Save")) )), form(array( diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 1e94b99f..2adce0d5 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -138,15 +138,10 @@ function user_shifts() { $room_select = html_select_key('rid', 'rid', $room_array, $rid); $angel_types = ""; - foreach ($types as $type) { - $angel_types .= template_render('../templates/admin_shifts_angel_types.html', array( - 'id' => $type['id'], - 'type' => $type['name'], - 'value' => $needed_angel_types[$type['id']] - )); - } + foreach ($types as $type) + $angel_types .= form_spinner('type_' . $type['id'], $type['name'], $needed_angel_types[$type['id']]); - return page(array( + return page_with_title(shifts_title(), array( msg(), '', form(array( @@ -182,7 +177,7 @@ function user_shifts() { redirect(page_link_to('user_shifts')); } - return page(array( + return page_with_title(shifts_title(), array( error(sprintf(_("Do you want to delete the shift %s from %s to %s?"), $shift['name'], date("Y-m-d H:i", $shift['start']), date("H:i", $shift['end'])), true), '' . _("delete") . '' )); @@ -457,7 +452,7 @@ function view_user_shifts() { $shifts[$k]['own'] = in_array($shift['SID'], array_keys($ownshifts)); } - $shifts_table = ''; + $shifts_table = '
-
'; foreach ($myrooms as $key => $room) { $rid = $room["id"]; if (array_sum($block[$rid]) == 0) { @@ -734,19 +729,25 @@ function view_user_shifts() { if ($user['api_key'] == "") User_reset_api_key($user); - return msg() . template_render('../templates/user_shifts.html', array( - 'room_select' => make_select($rooms, $_SESSION['user_shifts']['rooms'], "rooms", _("Rooms")), - 'start_select' => html_select_key("start_day", "start_day", array_combine($days, $days), $_SESSION['user_shifts']['start_day']), - 'start_time' => $_SESSION['user_shifts']['start_time'], - 'end_select' => html_select_key("end_day", "end_day", array_combine($days, $days), $_SESSION['user_shifts']['end_day']), - 'end_time' => $_SESSION['user_shifts']['end_time'], - 'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", _("Tasks") . '1'), - 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")), - 'task_notice' => '1' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " " . _("Description of the jobs.") . "", - 'new_style_checkbox' => '', - 'shifts_table' => $shifts_table, - 'ical_text' => '

' . _("iCal export") . '

' . sprintf(_("Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key)."), 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") + return page(array( + '
', + msg(), + template_render('../templates/user_shifts.html', array( + 'title' => shifts_title(), + 'room_select' => make_select($rooms, $_SESSION['user_shifts']['rooms'], "rooms", _("Rooms")), + 'start_select' => html_select_key("start_day", "start_day", array_combine($days, $days), $_SESSION['user_shifts']['start_day']), + 'start_time' => $_SESSION['user_shifts']['start_time'], + 'end_select' => html_select_key("end_day", "end_day", array_combine($days, $days), $_SESSION['user_shifts']['end_day']), + 'end_time' => $_SESSION['user_shifts']['end_time'], + 'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", _("Tasks") . '1'), + 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")), + 'task_notice' => '1' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " " . _("Description of the jobs.") . "", + 'new_style_checkbox' => '', + 'shifts_table' => $shifts_table, + 'ical_text' => '

' . _("iCal export") . '

' . sprintf(_("Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key)."), 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") + )), + '
' )); } @@ -771,14 +772,12 @@ function get_ids_from_array($array) { function make_select($items, $selected, $name, $title = null) { $html_items = array(); if (isset($title)) - $html_items[] = '
  • ' . $title . '
  • ' . "\n"; + $html_items[] = '

    ' . $title . '

    ' . "\n"; foreach ($items as $i) - $html_items[] = '
  • ' . (! isset($i['enabled']) || $i['enabled'] ? '' : ' unconfirmed') . '
  • '; - $html = '
    ' . "\n"; - $html .= '' . "\n"; $html .= buttons(array( button("javascript: check_all('selection_" . $name . "')", _("All"), ""), button("javascript: uncheck_all('selection_" . $name . "')", _("None"), "") diff --git a/includes/sys_menu.php b/includes/sys_menu.php index f7cefdfa..781218f1 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -1,6 +1,8 @@ myshifts_title(), "user_shifts" => shifts_title(), "angeltypes" => angeltypes_title(), - "user_messages" => messages_title(), + "user_messages" => messages_title() . ' ' . user_unread_messages(), "user_questions" => questions_title(), "user_wakeup" => wakeup_title(), "admin_arrive" => admin_arrive_title(), @@ -57,19 +59,19 @@ function make_navigation() { "admin_rooms" => admin_rooms_title(), "admin_groups" => admin_groups_title(), "admin_import" => admin_import_title(), - "admin_log" => admin_log_title() + "admin_log" => admin_log_title() ); foreach ($pages as $page => $title) if (in_array($page, $privileges)) - $menu .= '' . $title . ''; + $menu .= '
  • ' . $title . '
  • '; - return ''; + return ''; } function make_navigation_for($name, $pages) { global $privileges, $p; - + $menu = ""; foreach ($pages as $page) if (in_array($page, $privileges)) diff --git a/includes/sys_template.php b/includes/sys_template.php index 409ecbe1..bb3d5731 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -4,7 +4,8 @@ * Liste der verfügbaren Themes */ $themes = array( - "1" => "Engelsystem default" + "0" => "Engelsystem light", + "1" => "Engelsystem dark" ); /** @@ -14,20 +15,47 @@ $themes = array( * @return string */ function toolbar($items = array()) { - return '
    ' . join("\n", $items) . '
    '; + return ''; } /** * Render a link for a toolbar. * * @param string $href - * @param string $class + * @param string $glyphicon * @param string $label * @param bool $selected * @return string */ -function toolbar_item_link($href, $class, $label, $selected = false) { - return '' . $label . ''; +function toolbar_item_link($href, $glyphicon, $label, $selected = false) { + return '
  • ' . ($glyphicon != '' ? ' ' : '') . $label . '
  • '; +} + +/** + * Rendert ein Zahlenfeld mit Buttons zum verstellen + */ +function form_spinner($name, $label, $value) { + return form_element($label, ' +
    + +
    + + +
    +
    + + '); } /** @@ -43,6 +71,12 @@ function toolbar_item_link($href, $class, $label, $selected = false) { * selected Array mit den Keys, die ausgewählt sind */ function form_checkboxes($name, $label, $items, $selected) { + $html = form_element($label, ''); + foreach ($items as $key => $item) + $html .= form_checkbox($name . '_' . $key, $item, array_search($key, $selected) !== false); + + return $html; + $html = "
      "; foreach ($items as $key => $item) { $id = $name . '_' . $key; @@ -91,21 +125,32 @@ function form_multi_checkboxes($names, $label, $items, $selected, $disabled = ar * Rendert eine Checkbox */ function form_checkbox($name, $label, $selected, $value = 'checked') { - return form_element("", ''); + return '
      '; +} + +/** + * Rendert einen Radio + */ +function form_radio($name, $label, $selected, $value) { + return '
      '; } /** * Rendert einen Infotext in das Formular */ function form_info($label, $text) { - return form_element($label, $text, ""); + if ($label == "") + return '' . $text . ''; + if ($text == "") + return '

      ' . $label . '

      '; + return form_element($label, '

      ' . $text . '

      ', ''); } /** * Rendert den Absenden-Button eines Formulars */ function form_submit($name, $label) { - return form_element('', ""); + return form_element('', ""); } /** @@ -113,7 +158,7 @@ function form_submit($name, $label) { */ function form_text($name, $label, $value, $disabled = false) { $disabled = $disabled ? ' disabled="disabled"' : ''; - return form_element($label, '', 'form_' . $name); + return form_element($label, '', 'form_' . $name); } /** @@ -128,7 +173,7 @@ function form_file($name, $label) { */ function form_password($name, $label, $disabled = false) { $disabled = $disabled ? ' disabled="disabled"' : ''; - return form_element($label, '', 'form_' . $name); + return form_element($label, '', 'form_' . $name); } /** @@ -136,7 +181,7 @@ function form_password($name, $label, $disabled = false) { */ function form_textarea($name, $label, $value, $disabled = false) { $disabled = $disabled ? ' disabled="disabled"' : ''; - return form_element($label, '', 'form_' . $name); + return form_element($label, '', 'form_' . $name); } /** @@ -150,14 +195,14 @@ function form_select($name, $label, $values, $selected) { * Rendert ein Formular-Element */ function form_element($label, $input, $for = "") { - return '
      ' . '
      ' . $input . '
      '; + return '
      ' . '' . $input . '
      '; } /** * Rendert ein Formular */ function form($elements, $action = "") { - return '
      ' . join($elements) . '
      '; + return '
      ' . join($elements) . ''; } /** @@ -168,6 +213,14 @@ function page($elements) { return join($elements); } +/** + * Generiert HTML Code für eine "Seite" mit zentraler Überschrift + * Fügt dazu die übergebenen Elemente zusammen. + */ +function page_with_title($title, $elements) { + return '

      ' . $title . '

      ' . join($elements) . '
      '; +} + /** * Rendert eine Datentabelle */ @@ -189,7 +242,7 @@ function table($columns, $rows_raw, $data = true) { if (count($rows) == 0) return info(_("No data found."), true); $html = ""; - $html .= ''; + $html .= '
    -
    '; $html .= ''; foreach ($columns as $key => $column) $html .= ''; @@ -213,14 +266,14 @@ function table($columns, $rows_raw, $data = true) { * Rendert einen Knopf */ function button($href, $label, $class = "") { - return '' . $label . ''; + return '' . $label . ''; } /** * Rendert eine Toolbar mit Knöpfen */ function buttons($buttons = array ()) { - return '
    ' . join(' ', $buttons) . '
    '; + return '
    ' . join(' ', $buttons) . '
    '; } // Load and render template @@ -267,7 +320,7 @@ function html_options($name, $options, $selected = "") { } function html_select_key($id, $name, $rows, $selected) { - $html = ''; foreach ($rows as $key => $row) { if (($key == $selected) || ($row == $selected)) { $html .= ''; diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index fd1ab6e8..2058ec0a 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -31,7 +31,7 @@ function AngelType_render_membership($user_angeltype) { } function AngelType_delete_view($angeltype) { - return page(array( + return page_with_title(sprintf(_("Delete angeltype %s"), $angeltype['name']), array( info(sprintf(_("Do you want to delete angeltype %s?"), $angeltype['name']), true), buttons(array( button(page_link_to('angeltypes'), _("cancel"), 'cancel'), @@ -41,7 +41,7 @@ function AngelType_delete_view($angeltype) { } function AngelType_edit_view($name, $restricted, $description, $coordinator_mode) { - return page(array( + return page_with_title(sprintf(_("Edit %s"), $name), array( buttons(array( button(page_link_to('angeltypes'), _("Angeltypes"), 'back') )), @@ -82,9 +82,10 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel $page[] = '

    ' . _("Description") . '

    '; $parsedown = new Parsedown(); - $page[] = $parsedown->parse($angeltype['description']); - - // Team-Coordinators list missing + if ($angeltype['description'] != "") + $page[] = '
    ' . $parsedown->parse($angeltype['description']) . '
    '; + + // Team-Coordinators list missing $coordinators = array(); $members_confirmed = array(); @@ -144,7 +145,7 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel ), $members_unconfirmed); } - return page($page); + return page_with_title(sprintf(_("Team %s"), $angeltype['name']), $page); } /** @@ -153,7 +154,7 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel * @param array $angeltypes */ function AngelTypes_list_view($angeltypes, $admin_angeltypes) { - return page(array( + return page_with_title(angeltypes_title(), array( msg(), buttons(array( $admin_angeltypes ? button(page_link_to('angeltypes') . '&action=edit', _("New angeltype"), 'add') : '', @@ -178,7 +179,8 @@ function AngelTypes_about_view($angeltypes, $user_logged_in) { $user_logged_in ? button(page_link_to('angeltypes'), angeltypes_title(), 'back') : '', button($faq_url, _("FAQ")) )), - '

    ' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '

    ' + '

    ' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '

    ', + '
    ' ); $parsedown = new Parsedown(); foreach ($angeltypes as $angeltype) { @@ -195,10 +197,12 @@ function AngelTypes_about_view($angeltypes, $user_logged_in) { if ($angeltype['restricted']) $content[] = info(_("This angeltype is restricted by double-opt-in by a team coordinator. Please show up at the according introduction meetings."), true); - $content[] = $parsedown->parse($angeltype['description']); + if ($angeltype['description'] != "") + $content[] = '
    ' . $parsedown->parse($angeltype['description']) . '
    '; + $content[] = '
    '; } - return page($content); + return page_with_title(_("Teams/Job description"), $content); } ?> \ No newline at end of file diff --git a/includes/view/Questions_view.php b/includes/view/Questions_view.php index be2375bb..c766125b 100644 --- a/includes/view/Questions_view.php +++ b/includes/view/Questions_view.php @@ -12,7 +12,7 @@ function Questions_view($open_questions, $answered_questions, $ask_action) { $question['actions'] = '' . _("delete") . ''; } - return page(array( + return page_with_title(questions_title(), array( msg(), '

    ' . _("Open questions") . '

    ', table(array( diff --git a/includes/view/ShiftEntry_view.php b/includes/view/ShiftEntry_view.php index b815ba73..c8690689 100644 --- a/includes/view/ShiftEntry_view.php +++ b/includes/view/ShiftEntry_view.php @@ -18,9 +18,9 @@ function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment) ); } else { - $freeload_form = $freeloaded ? "" : ""; + $freeload_form = ""; } - return page(array( + return page_with_title(_("Edit shift entry"), array( form(array( form_info(_("Angel:"), $angel), form_info(_("Date, Duration:"), $date), diff --git a/includes/view/UserAngelTypes_view.php b/includes/view/UserAngelTypes_view.php index 68bb1ec9..29bde3c4 100644 --- a/includes/view/UserAngelTypes_view.php +++ b/includes/view/UserAngelTypes_view.php @@ -1,6 +1,6 @@ ' . htmlspecialchars($user_source['Nick']) . ' ' . $user_name . '', array()); +} + /** * Available T-Shirt sizes */ @@ -23,7 +28,7 @@ $tshirt_sizes = array( * View for password recovery step 1: E-Mail */ function User_password_recovery_view() { - return page(array( + return page_with_title(user_password_recovery_title(), array( msg(), _("We will send you an e-mail with a password recovery link. Please use the email address you used for registration."), form(array( @@ -37,7 +42,7 @@ function User_password_recovery_view() { * View for password recovery step 2: New password */ function User_password_set_view() { - return page(array( + return page_with_title(user_password_recovery_title(), array( msg(), _("Please enter a new password."), form(array( @@ -67,7 +72,7 @@ function User_Avatar_render($user) { function User_Nick_render($user_source) { global $user, $privileges; if ($user['UID'] == $user_source['UID'] || in_array('user_shifts_admin', $privileges)) - return '' . htmlspecialchars($user_source['Nick']) . ''; + return ' ' . htmlspecialchars($user_source['Nick']) . ''; else return htmlspecialchars($user_source['Nick']); } -- cgit v1.2.3-54-g00ecf
    ' . $column . '