fixe widget
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Training reminders widget for the production dashboard.
|
||||
* Visible to HR / manager / Admin / User / Superuser.
|
||||
@@ -9,10 +10,6 @@ if (!isset($pdo)) {
|
||||
$pdo = DBHandlerSelect::getInstance()->getConnection();
|
||||
}
|
||||
|
||||
if (!isset($pdo)) {
|
||||
$pdo = DBHandlerSelect::getInstance()->getConnection();
|
||||
}
|
||||
|
||||
/* Check user webapp notification preference */
|
||||
$__notifyStmt = $pdo->prepare("SELECT notify_webapp FROM auth_users WHERE id = ? LIMIT 1");
|
||||
$__notifyStmt->execute([(int)$iduserlogin]);
|
||||
@@ -20,8 +17,6 @@ if ((int)$__notifyStmt->fetchColumn() !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$__trWidgetHr = isset($user)
|
||||
|
||||
$__trWidgetHr = isset($user)
|
||||
&& ($user->hasRole('Admin')
|
||||
|| $user->hasRole('Superuser')
|
||||
@@ -60,8 +55,11 @@ foreach ($__trRows as $__r) {
|
||||
$__due = DateTime::createFromFormat('Y-m-d', $__r['next_due_date']);
|
||||
if (!$__due) continue;
|
||||
$__days = (int)$__today->diff($__due)->format('%r%a');
|
||||
if ($__days < 0) { $__expiredCount++; }
|
||||
elseif ($__days <= $__rem) { $__dueSoonCount++; }
|
||||
if ($__days < 0) {
|
||||
$__expiredCount++;
|
||||
} elseif ($__days <= $__rem) {
|
||||
$__dueSoonCount++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Missing mandatory trainings (status = not_present) */
|
||||
|
||||
Reference in New Issue
Block a user