From 5a4a39fb3c5703730c2aa388725f355e2d73fbff Mon Sep 17 00:00:00 2001 From: solocla Date: Fri, 14 Aug 2026 08:05:24 +0200 Subject: [PATCH] fixe widget --- public/userarea/include/training_widget.php | 78 ++++++++++----------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/public/userarea/include/training_widget.php b/public/userarea/include/training_widget.php index cff51d8..e4fc0b5 100644 --- a/public/userarea/include/training_widget.php +++ b/public/userarea/include/training_widget.php @@ -1,4 +1,5 @@ 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]); @@ -21,9 +18,7 @@ if ((int)$__notifyStmt->fetchColumn() !== 1) { } $__trWidgetHr = isset($user) - -$__trWidgetHr = isset($user) - && ( $user->hasRole('Admin') + && ($user->hasRole('Admin') || $user->hasRole('Superuser') || $user->hasRole('employee-hr') || $user->hasRole('manager')); @@ -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) */ @@ -81,34 +79,34 @@ if ($__expiredCount === 0 && $__dueSoonCount === 0 && $__notPresentCount === 0) } ?>
- 0): ?> - - - - - Formazion - - - - - 0): ?> - - - - - Formazion - - - - - 0): ?> - - - - - Obbligator - - - - -
+ 0): ?> + + + + + Formazion + + + + + 0): ?> + + + + + Formazion + + + + + 0): ?> + + + + + Obbligator + + + + + \ No newline at end of file