summaryrefslogtreecommitdiff
path: root/includes/pages
diff options
context:
space:
mode:
Diffstat (limited to 'includes/pages')
-rw-r--r--includes/pages/admin_arrive.php9
-rw-r--r--includes/pages/guest_login.php21
2 files changed, 26 insertions, 4 deletions
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php
index f51ef7ac..399cb335 100644
--- a/includes/pages/admin_arrive.php
+++ b/includes/pages/admin_arrive.php
@@ -1,4 +1,5 @@
<?php
+
function admin_arrive_title() {
return _("Arrived angels");
}
@@ -13,7 +14,7 @@ function admin_arrive() {
$id = $_REQUEST['reset'];
$user_source = User($id);
if ($user_source != null) {
- sql_query("UPDATE `User` SET `Gekommen`=0 WHERE `UID`='" . sql_escape($id) . "' LIMIT 1");
+ sql_query("UPDATE `User` SET `Gekommen`=0, `arrival_date` = NULL 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);
} else
@@ -22,7 +23,7 @@ function admin_arrive() {
$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");
+ sql_query("UPDATE `User` SET `Gekommen`=1, `arrival_date`='" . time() . "' 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);
} else
@@ -51,6 +52,8 @@ function admin_arrive() {
$table .= '<tr>';
$table .= '<td>' . User_Nick_render($usr) . '</td>';
$usr['nick'] = User_Nick_render($usr);
+ $usr['planned_arrival_date'] = date('Y-m-d', $usr['planned_arrival_date']);
+ $usr['arrival_date'] = $usr['arrival_date'] > 0 ? date('Y-m-d', $usr['arrival_date']) : "-";
$usr['arrived'] = $usr['Gekommen'] == 1 ? _("yes") : "";
$usr['actions'] = $usr['Gekommen'] == 1 ? '<a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">' . _("reset") . '</a>' : '<a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">' . _("arrived") . '</a>';
if ($usr['Gekommen'] == 1)
@@ -68,7 +71,9 @@ function admin_arrive() {
)),
table(array(
'nick' => _("Nickname"),
+ 'planned_arrival_date' => _("Planned date"),
'arrived' => _("Arrived?"),
+ 'arrival_date' => _("Arrival date"),
'actions' => ""
), $users_matched)
));
diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php
index 741fd826..64a97d70 100644
--- a/includes/pages/guest_login.php
+++ b/includes/pages/guest_login.php
@@ -32,6 +32,7 @@ function guest_register() {
$tshirt_size = '';
$password_hash = "";
$selected_angel_types = array();
+ $planned_arrival_date = null;
$angel_types_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
$angel_types = array();
@@ -96,6 +97,13 @@ function guest_register() {
$msg .= error(sprintf(_("Your password is too short (please use at least %s characters)."), MIN_PASSWORD_LENGTH), true);
}
+ if (isset($_REQUEST['planned_arrival_date']) && DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))) {
+ $planned_arrival_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))->getTimestamp();
+ } else {
+ $ok = false;
+ $msg .= error(_("Please enter your planned date of arrival."), true);
+ }
+
$selected_angel_types = array();
foreach ($angel_types as $angel_type_id => $angel_type_name)
if (isset($_REQUEST['angel_types_' . $angel_type_id]))
@@ -138,7 +146,9 @@ function guest_register() {
`kommentar`='" . sql_escape($comment) . "',
`Hometown`='" . sql_escape($hometown) . "',
`CreateDate`=NOW(),
- `Sprache`='" . sql_escape($_SESSION["locale"]) . "'");
+ `Sprache`='" . sql_escape($_SESSION["locale"]) . "',
+ `arrival_date`=NULL,
+ `planned_arrival_date`='" . sql_escape($planned_arrival_date) . "'");
// Assign user-group and set password
$user_id = sql_id();
@@ -174,7 +184,14 @@ function guest_register() {
form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $email_shiftinfo)
))
)),
- $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size") . ' ' . entry_required(), $tshirt_sizes, $tshirt_size) : '',
+ div('row', array(
+ div('col-sm-6', array(
+ form_date('planned_arrival_date', _("Planned date of arrival") . ' ' . entry_required(), $planned_arrival_date, time())
+ )),
+ div('col-sm-6', array(
+ $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size") . ' ' . entry_required(), $tshirt_sizes, $tshirt_size) : ''
+ ))
+ )),
div('row', array(
div('col-sm-6', array(
form_password('password', _("Password") . ' ' . entry_required())