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]);
|
||||
@@ -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)
|
||||
}
|
||||
?>
|
||||
<div class="my-deadlines-widgets">
|
||||
<?php if ($__expiredCount > 0): ?>
|
||||
<a class="mdw mdw-red" href="trainings.php?status=expired">
|
||||
<span class="mdw-icon"><i class="fa-solid fa-graduation-cap"></i></span>
|
||||
<span class="mdw-body">
|
||||
<span class="mdw-count"><?= (int)$__expiredCount ?></span>
|
||||
<span class="mdw-label d-block">Formazion<?= $__expiredCount === 1 ? 'e scaduta' : 'i scadute' ?></span>
|
||||
</span>
|
||||
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($__dueSoonCount > 0): ?>
|
||||
<a class="mdw mdw-orange" href="trainings.php?status=due_soon">
|
||||
<span class="mdw-icon"><i class="fa-solid fa-hourglass-half"></i></span>
|
||||
<span class="mdw-body">
|
||||
<span class="mdw-count"><?= (int)$__dueSoonCount ?></span>
|
||||
<span class="mdw-label d-block">Formazion<?= $__dueSoonCount === 1 ? 'e da aggiornare' : 'i da aggiornare' ?></span>
|
||||
</span>
|
||||
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($__notPresentCount > 0): ?>
|
||||
<a class="mdw mdw-gray" href="trainings.php?status=not_present">
|
||||
<span class="mdw-icon"><i class="fa-solid fa-circle-question"></i></span>
|
||||
<span class="mdw-body">
|
||||
<span class="mdw-count"><?= (int)$__notPresentCount ?></span>
|
||||
<span class="mdw-label d-block">Obbligator<?= $__notPresentCount === 1 ? 'ia non presente' : 'ie non presenti' ?></span>
|
||||
</span>
|
||||
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($__expiredCount > 0): ?>
|
||||
<a class="mdw mdw-red" href="trainings.php?status=expired">
|
||||
<span class="mdw-icon"><i class="fa-solid fa-graduation-cap"></i></span>
|
||||
<span class="mdw-body">
|
||||
<span class="mdw-count"><?= (int)$__expiredCount ?></span>
|
||||
<span class="mdw-label d-block">Formazion<?= $__expiredCount === 1 ? 'e scaduta' : 'i scadute' ?></span>
|
||||
</span>
|
||||
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($__dueSoonCount > 0): ?>
|
||||
<a class="mdw mdw-orange" href="trainings.php?status=due_soon">
|
||||
<span class="mdw-icon"><i class="fa-solid fa-hourglass-half"></i></span>
|
||||
<span class="mdw-body">
|
||||
<span class="mdw-count"><?= (int)$__dueSoonCount ?></span>
|
||||
<span class="mdw-label d-block">Formazion<?= $__dueSoonCount === 1 ? 'e da aggiornare' : 'i da aggiornare' ?></span>
|
||||
</span>
|
||||
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($__notPresentCount > 0): ?>
|
||||
<a class="mdw mdw-gray" href="trainings.php?status=not_present">
|
||||
<span class="mdw-icon"><i class="fa-solid fa-circle-question"></i></span>
|
||||
<span class="mdw-body">
|
||||
<span class="mdw-count"><?= (int)$__notPresentCount ?></span>
|
||||
<span class="mdw-label d-block">Obbligator<?= $__notPresentCount === 1 ? 'ia non presente' : 'ie non presenti' ?></span>
|
||||
</span>
|
||||
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user