aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/account.php17
-rw-r--r--include/security.php10
2 files changed, 16 insertions, 11 deletions
diff --git a/include/account.php b/include/account.php
index a6067a802..c3c7d26b7 100644
--- a/include/account.php
+++ b/include/account.php
@@ -1238,18 +1238,23 @@ function zar_register_dutystate( $now=NULL, $day=NULL ) {
$dutyis = $isduty ? t('open') : t('closed');
$atform = $isduty ? '' : 'disabled';
+ $utc_now = datetime_convert(date_default_timezone_get(), 'UTC', $now, 'c');
$nowfmt = t('Registration is currently')
- . ' ('.substr($now,0,2) . ':' . substr($now,-2) . ') '
- . ' ' . $dutyis;
+ . ' (<span data-utc="' . $utc_now . '" class="register_date">' . $utc_now . '</span>) '
+ . $dutyis . '.<br>';
+
if (!$isduty) {
$pernext = zarIsDuty($day, $now, 'nextOpen');
+ $week_days = ['','monday','tuesday','wednesday','thursday','friday','saturday','sunday'];
+ $utc_next_open = datetime_convert(date_default_timezone_get(), 'UTC', $week_days[$pernext[0]] . ' ' . $pernext[1], 'c');
+
+ if (is_array($pernext)) {
+ $nowfmt .= t('Next opens') . ' '
+ . '<span data-utc="' . $utc_next_open . '" class="register_date">' . $utc_next_open . '</span>.';
- if (is_array($pernext))
- $nowfmt .= '. ' . t('Next opens') . ' '
- . ucfirst( array('','mo','tu','we','th','fr','sa','so')[$pernext[0]]) . ' '
- . substr($pernext[1],0,2) . ':' . substr($pernext[1],-2);
+ }
}
return array( 'isduty' => $isduty, 'nowfmt' => $nowfmt, 'atform' => $atform);
diff --git a/include/security.php b/include/security.php
index 18107d5cb..4643de105 100644
--- a/include/security.php
+++ b/include/security.php
@@ -850,7 +850,7 @@ function zarIsDuty($wd=NULL, $hhmm=NULL, $op='isOpen') {
$isduty = get_config('system', 'register_duty_jso');
- if (!$isduty)
+ if (!$isduty)
return (bool)false;
is_null($wd) ? $wd = date('N') : '';
@@ -863,7 +863,7 @@ function zarIsDuty($wd=NULL, $hhmm=NULL, $op='isOpen') {
$wd === 0 ? $wd = 7 : '';
$duty = json_decode($isduty, true);
- if (!$duty)
+ if (!$duty)
return (bool)false;
switch ($op) {
@@ -883,7 +883,7 @@ function zarIsDuty($wd=NULL, $hhmm=NULL, $op='isOpen') {
}
return $dutyis;
break;
-
+
case 'nextOpen':
/**
* Look for next period opens
@@ -923,7 +923,7 @@ function zarIsDuty($wd=NULL, $hhmm=NULL, $op='isOpen') {
if ($dd >= $myd && $dh >= $myh && !$tf)
return array($dd, $dh);
else
- continue;
+ continue;
}
}
return $is1; // false or array
@@ -933,7 +933,7 @@ function zarIsDuty($wd=NULL, $hhmm=NULL, $op='isOpen') {
//
break;
}
-
+
}