summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/controller/angeltypes_controller.php2
-rw-r--r--includes/controller/users_controller.php48
-rw-r--r--includes/helper/message_helper.php6
-rw-r--r--includes/pages/admin_active.php2
-rw-r--r--includes/pages/admin_arrive.php10
-rw-r--r--includes/pages/admin_free.php45
-rw-r--r--includes/pages/admin_log.php18
-rw-r--r--includes/pages/admin_news.php124
-rw-r--r--includes/pages/admin_questions.php90
-rw-r--r--includes/pages/admin_rooms.php143
-rw-r--r--includes/pages/admin_shifts.php238
-rw-r--r--includes/pages/admin_user.php4
-rw-r--r--includes/pages/guest_login.php12
-rw-r--r--includes/pages/user_messages.php12
-rw-r--r--includes/pages/user_myshifts.php2
-rw-r--r--includes/pages/user_news.php205
-rw-r--r--includes/pages/user_questions.php17
-rw-r--r--includes/pages/user_settings.php4
-rw-r--r--includes/pages/user_shifts.php55
-rw-r--r--includes/sys_menu.php22
-rw-r--r--includes/sys_template.php87
-rw-r--r--includes/view/AngelTypes_view.php24
-rw-r--r--includes/view/Questions_view.php2
-rw-r--r--includes/view/ShiftEntry_view.php4
-rw-r--r--includes/view/UserAngelTypes_view.php14
-rw-r--r--includes/view/User_view.php11
26 files changed, 632 insertions, 569 deletions
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 @@
<?php
/**
- * User password recovery. (By email)
+ * Route user actions.
+ */
+function users_controller() {
+ global $privileges, $user;
+
+ if (! isset($user))
+ redirect(page_link_to(''));
+
+ if (! isset($_REQUEST['action']))
+ $_REQUEST['action'] = 'list';
+
+ switch ($_REQUEST['action']) {
+ default:
+ case 'list':
+ return users_list_controller();
+ case 'view':
+ return user_controller();
+ case 'edit':
+ return user_edit_controller();
+ case 'delete':
+ return user_delete_controller();
+ }
+}
+
+function user_controller() {
+ global $privileges, $user;
+
+ if (isset($_REQUEST['user_id'])) {
+ $user_source = User($_REQUEST['user_id']);
+ } else
+ $user_source = $user;
+
+ $admin_user_privilege = in_array('admin_user', $privileges);
+
+ return array(
+ $user_source['Nick'],
+ User_view($user_source)
+ );
+}
+
+function users_list_controller() {
+ redirect(page_link_to('admin_user'));
+}
+
+/**
+ * User password recovery.
+ * (By email)
*/
function user_password_recovery_controller() {
if (isset($_REQUEST['token'])) {
diff --git a/includes/helper/message_helper.php b/includes/helper/message_helper.php
index 9bb78a05..26bad871 100644
--- a/includes/helper/message_helper.php
+++ b/includes/helper/message_helper.php
@@ -18,7 +18,7 @@ function info($msg, $immediatly = false) {
if ($immediatly) {
if ($msg == "")
return "";
- return '<p class="info">' . $msg . '</p>';
+ return '<div class="alert alert-info">' . $msg . '</div>';
} else {
if (! isset($_SESSION['msg']))
$_SESSION['msg'] = "";
@@ -33,7 +33,7 @@ function error($msg, $immediatly = false) {
if ($immediatly) {
if ($msg == "")
return "";
- return '<p class="error">' . $msg . '</p>';
+ return '<div class="alert alert-danger">' . $msg . '</div>';
} else {
if (! isset($_SESSION['msg']))
$_SESSION['msg'] = "";
@@ -48,7 +48,7 @@ function success($msg, $immediatly = false) {
if ($immediatly) {
if ($msg == "")
return "";
- return '<p class="success">' . $msg . '</p>';
+ return '<div class="alert alert-success">' . $msg . '</div>';
} 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' => '<b>' . sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Tshirt`=1") . '</b>'
);
- 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 .= '</tr>';
$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 .= '<tr>';
@@ -52,15 +54,16 @@ function admin_free() {
$table .= '<td><a href="' . page_link_to('admin_user') . '&amp;id=' . $usr['UID'] . '">edit</a></td>';
else
$table .= '<td>' . User_Nick_render($usr) . '</td>';
-
+
$table .= '</tr>';
}
- 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 @@
<?php
function admin_news() {
global $user;
-
- if (!isset ($_GET["action"])) {
+
+ if (! isset($_GET["action"])) {
redirect(page_link_to("news"));
} else {
- $html = "";
- switch ($_GET["action"]) {
- case 'edit' :
- 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;
-
+ $html = '<div class="col-md-10"><h1>' . _("Edit news entry") . '</h1>';
+ 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 .= '<a href="' . page_link_to("news") . '">&laquo Back</a>';
-
- $html .= "<form action=\"" . page_link_to("admin_news") . "&action=save\" method=\"post\">\n";
-
- $html .= "<table>\n";
- $html .= " <tr><td>Datum</td><td>" .
- date("Y-m-d H:i", $news['Datum']) . "</td></tr>\n";
- $html .= " <tr><td>Betreff</td><td><input type=\"text\" size=\"40\" name=\"eBetreff\" value=\"" .
- $news["Betreff"] . "\"></td></tr>\n";
- $html .= " <tr><td>Text</td><td><textarea rows=\"10\" cols=\"80\" name=\"eText\">" .
- $news["Text"] . "</textarea></td></tr>\n";
- $html .= " <tr><td>Engel</td><td>" .
- User_Nick_render($user_source) . "</td></tr>\n";
- $html .= " <tr><td>Treffen</td><td>" . html_select_key('eTreffen', 'eTreffen', array (
- '1' => "Ja",
- '0' => "Nein"
- ), $news['Treffen']) . "</td></tr>\n";
- $html .= "</table>";
-
- $html .= "<input type=\"hidden\" name=\"id\" value=\"" . $id . "\">\n";
- $html .= "<input type=\"submit\" name=\"submit\" value=\"Speichern\">\n";
- $html .= "</form>";
-
- $html .= "<form action=\"" . page_link_to("admin_news") . "&action=delete\" method=\"POST\">\n";
- $html .= "<input type=\"hidden\" name=\"id\" value=\"" . $id . "\">\n";
- $html .= "<input type=\"submit\" name=\"submit\" value=\"Löschen\">\n";
- $html .= "</form>";
- } 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 .= '<a class="btn btn-danger" href="' . page_link_to('admin_news&action=delete&id=' . $id) . '"><span class="glyphicon glyphicon-trash"></span> ' . _("Delete") . '</a>';
+ 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 . '</div>';
}
?> \ 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 '<p class="info"><a href="' . page_link_to("admin_questions") . '">Es gibt unbeantwortete Fragen!</a></p><hr />';
+ return info('<a href="' . page_link_to("admin_questions") . '">Es gibt unbeantwortete Fragen!</a>', 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", '<br />', $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", '<br />', $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", "<br />", $question['Question']),
- 'answer_nick' => User_Nick_render($answer_user_source),
- 'answer' => str_replace("\n", "<br />", $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", "<br />", $question['Question']),
+ 'answer_nick' => User_Nick_render($answer_user_source),
+ 'answer' => str_replace("\n", "<br />", $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' ? '&#10003;' : '',
- 'public' => $room['show'] == 'Y' ? '&#10003;' : '',
- 'actions' => '<a class="ection edit" href="' . page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'] . '">edit</a> <a class="action delete" href="' . page_link_to('admin_rooms') . '&show=delete&id=' . $room['RID'] . '">delete</a>'
+ $rooms[] = array(
+ 'name' => $room['Name'],
+ 'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '&#10003;' : '',
+ 'public' => $room['show'] == 'Y' ? '&#10003;' : '',
+ 'actions' => '<a class="ection edit" href="' . page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'] . '">edit</a> <a class="action delete" href="' . page_link_to('admin_rooms') . '&show=delete&id=' . $room['RID'] . '">delete</a>'
);
-
- 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 .= '<tr><td>' . date("Y-m-d H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']) . '<br />' . $room_array[$shift['RID']] . '</td>';
+ $shifts_table .= '<tr><td><span class="glyphicon glyphicon-time"></span> ' . date("Y-m-d H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']) . '<br /><span class="glyphicon glyphicon-map-marker"></span> ' . $room_array[$shift['RID']] . '</td>';
$shifts_table .= '<td>' . $shift['name'];
foreach ($types as $type) {
- if (isset ($needed_angel_types[$type['id']]) && $needed_angel_types[$type['id']] > 0)
- $shifts_table .= '<br /><b>' . $type['name'] . ':</b> ' . $needed_angel_types[$type['id']] . ' missing';
+ if (isset($needed_angel_types[$type['id']]) && $needed_angel_types[$type['id']] > 0)
+ $shifts_table .= '<br /><span class="icon-icon_angel"></span> <b>' . $type['name'] . ':</b> ' . $needed_angel_types[$type['id']] . ' missing';
}
$shifts_table .= '</td></tr>';
}
-
+
// 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 .= '<input type="hidden" name="type_' . $type_id . '" value="' . $count . '" />';
- 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']),
+ '<div class="row">',
+ '<div class="col-md-6">',
+ 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'),
+ '</div>',
+ '<div class="col-md-6">',
+ 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,
+ '</div>',
+ '</div>',
+ 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 = '<div class="col-md-10">';
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 . '</div>';
}
?>
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(),
+ '<div class="container"><div class="col-md-6">',
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)
)),
+ '</div>',
+ '<div class="col-md-6">',
'<h2>' . register_title() . '</h2>',
'<p>' . _("Please sign up, if you want to help us!") . '</p>',
buttons(array(
@@ -228,7 +231,8 @@ function guest_login() {
'<p>' . _("Please read about the jobs you can do to help us.") . '</p>',
buttons(array(
button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' &raquo;')
- ))
+ )),
+ '</div></div>'
));
}
?>
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('<p class="info"><a href="%s">%s</a></p><hr />', page_link_to("user_messages"), sprintf(ngettext("You have %s new message.", "You have %s new messages.", $new_messages), $new_messages));
+ return '<span class="badge">' . $new_messages . '</span>';
}
-
- 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)) . '<br /><br />',
'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.<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) : '',
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 = '<div class="col-md-10"><h1>' . meetings_title() . '</h1>';
+
+ 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 .= "<div class=\"pagination\">\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 .= '<div class="text-center">' . '<ul class="pagination">';
+ for ($i = 0; $i < $dis_rows; $i ++) {
if (isset($_REQUEST['page']) && $i == $_REQUEST['page'])
- $html .= ($i +1) . "&nbsp; ";
+ $html .= '<li class="active">';
+ elseif (! isset($_REQUEST['page']) && $i == 0)
+ $html .= '<li class="active">';
else
- $html .= '<a href="' . page_link_to("news") . '&page=' . $i . '">' . ($i +1) . '</a>&nbsp; ';
+ $html .= '<li>';
+ $html .= '<a href="' . page_link_to("user_meetings") . '&page=' . $i . '">' . ($i + 1) . '</a></li>';
}
- $html .= '</div>';
+ $html .= '</ul></div></div>';
+
return $html;
}
function display_news($news) {
global $privileges, $p;
-
- $html = "";
- $html .= '<article class="news' . ($news['Treffen'] == 1 ? ' meeting' : '') . '">';
- $html .= '<details>';
- $html .= date("Y-m-d H:i", $news['Datum']) . ', ';
-
+
+ $html = '';
+ $html .= '<div class="panel' . ($news['Treffen'] == 1 ? ' panel-info' : ' panel-default') . '">';
+ $html .= '<div class="panel-heading">';
+ $html .= '<h3 class="panel-title">' . ($news['Treffen'] == 1 ? '[Meeting] ' : '') . ReplaceSmilies($news['Betreff']) . '</h3>';
+ $html .= '</div>';
+ $html .= '<div class="panel-body">' . ReplaceSmilies(nl2br($news['Text'])) . '</div>';
+
+ $html .= '<div class="panel-footer text-muted">';
+ if (in_array("admin_news", $privileges))
+ $html .= '<div class="pull-right"><a class="btn btn-xs btn-default" href="' . page_link_to("admin_news") . '&action=edit&id=' . $news['ID'] . '">' . _("edit") . '</a></div>';
+
+ $html .= '<span class="glyphicon glyphicon-time"></span> ' . date("Y-m-d H:i", $news['Datum']) . '&emsp;';
+
$user_source = User($news['UID']);
- if($user_source === false)
+ if ($user_source === false)
engelsystem_error(_("Unable to load user."));
-
+
$html .= User_Nick_render($user_source);
if ($p != "news_comments")
- $html .= ', <a href="' . page_link_to("news_comments") . '&nid=' . $news['ID'] . '">' . _("Comments") . ' (' . sql_num_query("SELECT * FROM `NewsComments` WHERE `Refid`='" . sql_escape($news['ID']) . "'") . ') &raquo;</a>';
- $html .= '</details>';
- $html .= '<h3>' . ($news['Treffen'] == 1 ? '[Meeting] ' : '') . ReplaceSmilies($news['Betreff']) . '</h3>';
- $html .= '<p>' . ReplaceSmilies(nl2br($news['Text'])) . '</p>';
- if (in_array("admin_news", $privileges))
- $html .= '<details><a href="' . page_link_to("admin_news") . '&action=edit&id=' . $news['ID'] . '">' . _("edit") . '</a></details>';
-
- $html .= '</article>';
+ $html .= '&emsp;<a href="' . page_link_to("news_comments") . '&nid=' . $news['ID'] . '"><span class="glyphicon glyphicon-comment"></span> ' . _("Comments") . ' &raquo;</a> <span class="badge">' . sql_num_query("SELECT * FROM `NewsComments` WHERE `Refid`='" . sql_escape($news['ID']) . "'") . '</span>';
+ $html .= '</div>';
+ $html .= '</div>';
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 = '<div class="col-md-10"><h1>' . user_news_comments_title() . '</h1>';
+ 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 .= '<a href="' . page_link_to("news") . '">&laquo; ' . _("back") . '</a>';
+
$html .= display_news($news);
-
- $html .= '<h2>' . _("Comments") . '</h2>';
-
+
$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 .= '<article class="news_comment">';
- $html .= User_Avatar_render($user_source);
- $html .= '<details>';
- $html .= $comment['Datum'] . ', ';
+
+ $html .= '<div class="panel panel-default">';
+ $html .= '<div class="panel-body">' . nl2br($comment['Text']) . '</div>';
+ $html .= '<div class="panel-footer text-muted">';
+ $html .= '<span class="glyphicon glyphicon-time"></span> ' . $comment['Datum'] . '&emsp;';
$html .= User_Nick_render($user_source);
- $html .= '</details>';
- $html .= '<p>' . nl2br($comment['Text']) . '</p>';
- $html .= '</article>';
+ $html .= '</div>';
+ $html .= '</div>';
}
-
- $html .= "</table>";
- $html .= '
- <br />
- <hr>
- <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">' . _("Message:") . '</td>
- <td><textarea name="text" cols="50" rows="10"></textarea></td>
- </tr>
- </table>
- <br />
- <input type="submit" value="' . _("Save") . '">
- </form>';
+
+ $html .= '<hr /><h2>' . _("New Comment:") . '</h2>';
+ $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 . '</div>';
}
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 = '<div class="col-md-10"><h1>' . news_title() . '</h1>' . 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 .= "<div class=\"pagination\">\n\n";
+
$dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $DISPLAY_NEWS);
-
- $html .= _("Page:");
-
- for ($i = 0; $i < $dis_rows; $i++) {
+ $html .= '<div class="text-center">' . '<ul class="pagination">';
+ for ($i = 0; $i < $dis_rows; $i ++) {
if (isset($_REQUEST['page']) && $i == $_REQUEST['page'])
- $html .= ($i +1) . "&nbsp; ";
+ $html .= '<li class="active">';
+ elseif (! isset($_REQUEST['page']) && $i == 0)
+ $html .= '<li class="active">';
else
- $html .= '<a href="' . page_link_to("news") . '&page=' . $i . '">' . ($i +1) . '</a>&nbsp; ';
+ $html .= '<li>';
+ $html .= '<a href="' . page_link_to("news") . '&page=' . $i . '">' . ($i + 1) . '</a></li>';
}
- $html .= '</div>';
+ $html .= '</ul></div>';
+
if (in_array("admin_news", $privileges)) {
- $html .= '<br /><hr />
- <h2>' . _("Create news:") . '</h2>
- <a name="Neu">&nbsp;</a>
-
- <form action="" method="post">
- <table>
- <tr>
- <td align="right">' . _("Subject") . ':</td>
- <td><input type="text" name="betreff" size="60"></td>
- </tr>
- <tr>
- <td align="right">' . _("Message") . ':</td>
- <td><textarea name="text" cols="50" rows="10"></textarea></td>
- </tr>';
- if (in_array('admin_news', $privileges)) {
- $html .= ' <tr>
- <td align="right">' . _("Meeting") . ':</td>
- <td><input type="checkbox" name="treffen" size="1" value="1"></td>
- </tr>';
-
- }
- $html .= '</table>
- <br />
- <input type="submit" value="' . _("Save") . '">
- </form>';
+ $html .= '<hr />';
+ $html .= '<h2>' . _("Create news:") . '</h2>';
+
+ $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 . '</div>';
}
?> \ 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("<br>(<a href=\"%s\">%s</a>)", 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(" (<a href=\"%s\">%s</a>)", 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(),
'<noscript>' . info(_("This page is much more comfortable with javascript."), true) . '</noscript>',
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),
'<a class="button" href="?p=user_shifts&delete_shift=' . $shift_id . '&delete">' . _("delete") . '</a>'
));
@@ -457,7 +452,7 @@ function view_user_shifts() {
$shifts[$k]['own'] = in_array($shift['SID'], array_keys($ownshifts));
}
- $shifts_table = '<table id="shifts" class="scrollable"><thead><tr><th>-</th>';
+ $shifts_table = '<table id="shifts" class="table scrollable"><thead><tr><th>-</th>';
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") . '<sup>1</sup>'),
- 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")),
- 'task_notice' => '<sup>1</sup>' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " <a href=\"" . page_link_to('angeltypes') . '&action=about' . "\">" . _("Description of the jobs.") . "</a>",
- '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' => '<h2>' . _("iCal export") . '</h2><p>' . 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') . '</p>',
- 'filter' => _("Filter")
+ return page(array(
+ '<div class="col-md-10">',
+ 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") . '<sup>1</sup>'),
+ 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")),
+ 'task_notice' => '<sup>1</sup>' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " <a href=\"" . page_link_to('angeltypes') . '&action=about' . "\">" . _("Description of the jobs.") . "</a>",
+ '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' => '<h2>' . _("iCal export") . '</h2><p>' . 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') . '</p>',
+ 'filter' => _("Filter")
+ )),
+ '</div>'
));
}
@@ -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[] = '<li class="heading">' . $title . '</li>' . "\n";
+ $html_items[] = '<h4>' . $title . '</h4>' . "\n";
foreach ($items as $i)
- $html_items[] = '<li><label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '"' . (in_array($i['id'], $selected) ? ' checked="checked"' : '') . '> ' . $i['name'] . '</label>' . (! isset($i['enabled']) || $i['enabled'] ? '' : ' <img src="pic/icons/lock.png" alt="unconfirmed" title="Du bist für diesen Engeltyp noch nicht freigeschaltet." />') . '</li>';
- $html = '<div class="selection ' . $name . '">' . "\n";
- $html .= '<ul id="selection_' . $name . '">' . "\n";
+ $html_items[] = '<div class="checkbox"><label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '"' . (in_array($i['id'], $selected) ? ' checked="checked"' : '') . '> ' . $i['name'] . '</label>' . (! isset($i['enabled']) || $i['enabled'] ? '' : ' <img src="pic/icons/lock.png" alt="unconfirmed" title="Du bist für diesen Engeltyp noch nicht freigeschaltet." />') . '</div><br />';
+ $html = '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
$html .= implode("\n", $html_items);
- $html .= '</ul>' . "\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 @@
<?php
function page_link_to($page) {
+ if ($page == "")
+ return '?';
return '?p=' . $page;
}
@@ -17,19 +19,19 @@ function header_toolbar() {
$toolbar_items = array();
if (in_array('register', $privileges))
- $toolbar_items[] = toolbar_item_link(page_link_to('register'), 'register', register_title(), $p == 'register');
+ $toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', 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');
+ $toolbar_items[] = toolbar_item_link(page_link_to('user_myshifts'), ' icon-icon_angel', $user['Nick'], $p == 'user_myshifts');
if (in_array('user_settings', $privileges))
- $toolbar_items[] = toolbar_item_link(page_link_to('user_settings'), 'settings', settings_title(), $p == 'user_settings');
+ $toolbar_items[] = toolbar_item_link(page_link_to('user_settings'), 'list-alt', settings_title(), $p == 'user_settings');
if (in_array('login', $privileges))
- $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'login', login_title(), $p == 'login');
+ $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login');
if (in_array('logout', $privileges))
- $toolbar_items[] = toolbar_item_link(page_link_to('logout'), 'logout', logout_title(), $p == 'logout');
+ $toolbar_items[] = toolbar_item_link(page_link_to('logout'), 'log-out', logout_title(), $p == 'logout');
return toolbar($toolbar_items);
}
@@ -45,7 +47,7 @@ function make_navigation() {
"user_myshifts" => 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 .= '<li' . ($page == $p ? ' class="selected"' : '') . '><a href="' . page_link_to($page) . '">' . $title . '</a></li>';
+ $menu .= '<li class="' . ($page == $p ? 'active' : '') . '"><a href="' . page_link_to($page) . '">' . $title . '</a></li>';
- return '<nav><ul>' . $menu . '</ul></nav>';
+ return '<ul class="nav nav-pills nav-stacked">' . $menu . '</ul>';
}
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 '<div class="toolbar">' . join("\n", $items) . '</div>';
+ return '<ul class="nav navbar-nav navbar-right">' . join("\n", $items) . '</ul>';
}
/**
* 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 '<a href="' . $href . '" class="' . ($selected ? 'selected ' : '') . '' . $class . '">' . $label . '</a>';
+function toolbar_item_link($href, $glyphicon, $label, $selected = false) {
+ return '<li class="' . ($selected ? 'active' : '') . '"><a href="' . $href . '">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . '</a></li>';
+}
+
+/**
+ * Rendert ein Zahlenfeld mit Buttons zum verstellen
+ */
+function form_spinner($name, $label, $value) {
+ return form_element($label, '
+ <div class="input-group">
+ <input id="spinner-' . $name . '" class="form-control" type="text" name="' . $name . '" value="' . $value . '" />
+ <div class="input-group-btn">
+ <button id="spinner-' . $name . '-down" class="btn btn-default" type="button">
+ <span class="glyphicon glyphicon-minus"></span>
+ </button>
+ <button id="spinner-' . $name . '-up" class="btn btn-default" type="button">
+ <span class="glyphicon glyphicon-plus"></span>
+ </button>
+ </div>
+ </div>
+ <script type="text/javascript">
+ $("#spinner-' . $name . '-down").click(function(e) {
+ $("#spinner-' . $name . '").val(parseInt($("#spinner-' . $name . '").val()) - 1);
+ });
+ $("#spinner-' . $name . '-up").click(function(e) {
+ $("#spinner-' . $name . '").val(parseInt($("#spinner-' . $name . '").val()) + 1);
+ });
+ </script>
+ ');
}
/**
@@ -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 = "<ul>";
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("", '<input type="checkbox" id="' . $name . '" name="' . $name . '" value="' . $value . '"' . ($selected ? ' checked="checked"' : '') . ' /><label for="' . $name . '">' . $label . '</label>');
+ return '<div class="checkbox"><label><input type="checkbox" id="' . $name . '" name="' . $name . '" value="' . $value . '"' . ($selected ? ' checked="checked"' : '') . ' /> ' . $label . '</label></div>';
+}
+
+/**
+ * Rendert einen Radio
+ */
+function form_radio($name, $label, $selected, $value) {
+ return '<div class="radio"><label><input type="radio" id="' . $name . '" name="' . $name . '" value="' . $value . '"' . ($selected ? ' checked="checked"' : '') . ' /> ' . $label . '</label></div>';
}
/**
* Rendert einen Infotext in das Formular
*/
function form_info($label, $text) {
- return form_element($label, $text, "");
+ if ($label == "")
+ return '<span class="help-block">' . $text . '</span>';
+ if ($text == "")
+ return '<h4>' . $label . '</h4>';
+ return form_element($label, '<p class="form-control-static">' . $text . '</p>', '');
}
/**
* Rendert den Absenden-Button eines Formulars
*/
function form_submit($name, $label) {
- return form_element('<input class="button save ' . $name . '" type="submit" name="' . $name . '" value="' . $label . '" />', "");
+ return form_element('<input class="btn btn-primary" type="submit" name="' . $name . '" value="' . $label . '" />', "");
}
/**
@@ -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, '<input id="form_' . $name . '" type="text" name="' . $name . '" value="' . htmlspecialchars($value) . '" ' . $disabled . '/>', 'form_' . $name);
+ return form_element($label, '<input class="form-control" id="form_' . $name . '" type="text" name="' . $name . '" value="' . htmlspecialchars($value) . '" ' . $disabled . '/>', '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, '<input id="form_' . $name . '" type="password" name="' . $name . '" value="" ' . $disabled . '/>', 'form_' . $name);
+ return form_element($label, '<input class="form-control" id="form_' . $name . '" type="password" name="' . $name . '" value="" ' . $disabled . '/>', '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, '<textarea id="form_' . $name . '" type="text" name="' . $name . '" ' . $disabled . '>' . $value . '</textarea>', 'form_' . $name);
+ return form_element($label, '<textarea rows="5" class="form-control" id="form_' . $name . '" type="text" name="' . $name . '" ' . $disabled . '>' . $value . '</textarea>', 'form_' . $name);
}
/**
@@ -150,14 +195,14 @@ function form_select($name, $label, $values, $selected) {
* Rendert ein Formular-Element
*/
function form_element($label, $input, $for = "") {
- return '<div class="form_element">' . '<label for="' . $for . '" class="form_label">' . $label . '</label><div class="form_input">' . $input . '</div></div>';
+ return '<div class="form-group">' . '<label for="' . $for . '">' . $label . '</label>' . $input . '</div>';
}
/**
* Rendert ein Formular
*/
function form($elements, $action = "") {
- return '<form action="' . $action . '" enctype="multipart/form-data" method="post"><div class="form">' . join($elements) . '</div></form>';
+ return '<form role="form" action="' . $action . '" enctype="multipart/form-data" method="post">' . join($elements) . '</form>';
}
/**
@@ -169,6 +214,14 @@ function page($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 '<div class="col-md-10"><h1>' . $title . '</h1>' . join($elements) . '</div>';
+}
+
+/**
* Rendert eine Datentabelle
*/
function table($columns, $rows_raw, $data = true) {
@@ -189,7 +242,7 @@ function table($columns, $rows_raw, $data = true) {
if (count($rows) == 0)
return info(_("No data found."), true);
$html = "";
- $html .= '<table' . ($data ? ' class="data"' : '') . '>';
+ $html .= '<table class="table ' . ($data ? ' data' : '') . '">';
$html .= '<thead><tr>';
foreach ($columns as $key => $column)
$html .= '<th class="' . $key . '">' . $column . '</th>';
@@ -213,14 +266,14 @@ function table($columns, $rows_raw, $data = true) {
* Rendert einen Knopf
*/
function button($href, $label, $class = "") {
- return '<a href="' . $href . '" class="button ' . $class . '">' . $label . '</a>';
+ return '<a href="' . $href . '" class="btn btn-default ' . $class . '">' . $label . '</a>';
}
/**
* Rendert eine Toolbar mit Knöpfen
*/
function buttons($buttons = array ()) {
- return '<div class="toolbar">' . join(' ', $buttons) . '</div>';
+ return '<div class="form-group">' . join(' ', $buttons) . '</div>';
}
// Load and render template
@@ -267,7 +320,7 @@ function html_options($name, $options, $selected = "") {
}
function html_select_key($id, $name, $rows, $selected) {
- $html = '<select id="' . $id . '" name="' . $name . '">';
+ $html = '<select class="form-control" id="' . $id . '" name="' . $name . '">';
foreach ($rows as $key => $row) {
if (($key == $selected) || ($row == $selected)) {
$html .= '<option value="' . $key . '" selected="selected">' . $row . '</option>';
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[] = '<h3>' . _("Description") . '</h3>';
$parsedown = new Parsedown();
- $page[] = $parsedown->parse($angeltype['description']);
-
- // Team-Coordinators list missing
+ if ($angeltype['description'] != "")
+ $page[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
+
+ // 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"))
)),
- '<p>' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '</p>'
+ '<p>' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '</p>',
+ '<hr />'
);
$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[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
+ $content[] = '<hr />';
}
- 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'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
}
- return page(array(
+ return page_with_title(questions_title(), array(
msg(),
'<h2>' . _("Open questions") . '</h2>',
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 @@
<?php
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $coordinator) {
- return page(array(
+ return page_with_title($coordinator ? _("Add coordinator rights") : _("Remove coordinator rights"), array(
msg(),
info(sprintf($coordinator ? _("Do you really want to add coordinator rights for %s to %s?") : _("Do you really want to remove coordinator rights for %s from %s?"), $angeltype['name'], User_Nick_render($user)), true),
buttons(array(
@@ -11,7 +11,7 @@ function UserAngelType_update_view($user_angeltype, $user, $angeltype, $coordina
}
function UserAngelTypes_delete_all_view($angeltype) {
- return page(array(
+ return page_with_title(_("Deny all users"), array(
msg(),
info(sprintf(_("Do you really want to deny all users for %s?"), $angeltype['name']), true),
buttons(array(
@@ -22,7 +22,7 @@ function UserAngelTypes_delete_all_view($angeltype) {
}
function UserAngelTypes_confirm_all_view($angeltype) {
- return page(array(
+ return page_with_title(_("Confirm all users"), array(
msg(),
info(sprintf(_("Do you really want to confirm all users for %s?"), $angeltype['name']), true),
buttons(array(
@@ -33,7 +33,7 @@ function UserAngelTypes_confirm_all_view($angeltype) {
}
function UserAngelType_confirm_view($user_angeltype, $user, $angeltype) {
- return page(array(
+ return page_with_title(_("Confirm angeltype for user"), array(
msg(),
info(sprintf(_("Do you really want to confirm %s for %s?"), User_Nick_render($user), $angeltype['name']), true),
buttons(array(
@@ -44,7 +44,7 @@ function UserAngelType_confirm_view($user_angeltype, $user, $angeltype) {
}
function UserAngelType_delete_view($user_angeltype, $user, $angeltype) {
- return page(array(
+ return page_with_title(_("Remove angeltype"), array(
msg(),
info(sprintf(_("Do you really want to delete %s from %s?"), User_Nick_render($user), $angeltype['name']), true),
buttons(array(
@@ -59,7 +59,7 @@ function UserAngelType_add_view($angeltype, $users_source, $user_id) {
foreach ($users_source as $user_source)
$users[$user_source['UID']] = User_Nick_render($user_source);
- return page(array(
+ return page_with_title(_("Add user to angeltype"), array(
msg(),
buttons(array(
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("back"), 'back')
@@ -73,7 +73,7 @@ function UserAngelType_add_view($angeltype, $users_source, $user_id) {
}
function UserAngelType_join_view($user, $angeltype) {
- return page(array(
+ return page_with_title(sprintf(_("Become a %s"), $angeltype['name']), array(
msg(),
info(sprintf(_("Do you really want to add %s to %s?"), User_Nick_render($user), $angeltype['name']), true),
buttons(array(
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index eda29d58..20a6de6e 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -1,5 +1,10 @@
<?php
+function User_view($user_source) {
+ $user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
+ return page_with_title('<span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . ' <small>' . $user_name . '</small>', 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 '<a href="' . page_link_to('user_myshifts') . '&amp;id=' . $user_source['UID'] . '">' . htmlspecialchars($user_source['Nick']) . '</a>';
+ return '<a href="' . page_link_to('user_myshifts') . '&amp;id=' . $user_source['UID'] . '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>';
else
return htmlspecialchars($user_source['Nick']);
}