Skip to content
Snippets Groups Projects
Commit 5220c510 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Branchement de datatable sur les tableaux de sessions (via viewhelper)

parent aa13f7fa
No related branches found
No related tags found
No related merge requests found
......@@ -68,7 +68,7 @@ foreach ($dictionnaireDemande as $etatCode => $demandes) {
</div>
<?php if (count($sessions) > 0) : ?>
<div class="card-body">
<?php echo $this->formationInstanceArray($sessions, ['affichage' => ['gestionnaires' => false]]); ?>
<?php echo $this->formationInstanceArray($sessions, ['id' => $etatCode, 'affichage' => ['gestionnaires' => false]]); ?>
</div>
<?php endif; ?>
</div>
......
......@@ -6,10 +6,8 @@
* @var array $options
*/
/** Droits pour les actions */
use Formation\Entity\Db\Seance;
use Formation\Entity\Db\Session;
use Formation\Provider\Etat\SessionEtats;
use Formation\Provider\Privilege\FormationPrivileges;
......@@ -18,6 +16,8 @@ $displayGestionnaire = true;
if (isset($options['affichage']) and isset($options['affichage']['gestionnaires'])) {
$displayGestionnaire = $options['affichage']['gestionnaires'];
}
$id = (isset($options['id'])) ? $options['id'] : null;
$canAfficherInstance = false;
if (!isset($options['droits']) and !isset($options['droits']['afficher'])) {
......@@ -44,7 +44,7 @@ usort($sessions, function (Session $a, Session $b) {
$sessions = array_reverse($sessions);
?>
<table class="datatable table table-condensed" id="">
<table class="datatable table table-condensed" <?php if ($id) echo 'id="' . $id . '"'; ?>>
<thead>
<tr>
<th> Session</th>
......@@ -61,8 +61,8 @@ $sessions = array_reverse($sessions);
<?php if ($canSupprimerInstance or $instance->estNonHistorise()) : ?>
<tr class="<?php if ($instance->estHistorise()) echo " historise "; ?>"
style="<?php if (in_array($instance->getEtatActif()->getType()->getCode(), SessionEtats::ETATS_OUVERTS)
AND ($instance->getDateClotureInscription() === null
OR $instance->getDateClotureInscription() < (new DateTime()))) echo 'background: var(--unistrap-color-light)'; ?>"
and ($instance->getDateClotureInscription() === null
or $instance->getDateClotureInscription() < (new DateTime()))) echo 'background: var(--unistrap-color-light)'; ?>"
>
<td class="identification">
<span class="badge source <?php echo $instance->getSource(); ?>">
......@@ -169,6 +169,16 @@ $sessions = array_reverse($sessions);
</tbody>
</table>
<?php if ($id) : ?>
<script>
$(function () {
$('table#<?php echo $id; ?>').dataTable({
paging: false,
autoWidth: false,
"language": {
"url": "/js/datatables_fr.json",
},
});
});
</script>
<?php endif; ?>
......@@ -38,7 +38,7 @@ $canVoir = $this->isAllowed(FormationPrivileges::getResourceId(FormationPrivileg
<?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?>
<?php echo $this->formationInstanceArray($instances); ?>
<?php echo $this->formationInstanceArray($instances, ['id' => 'sessions']); ?>
<script>
$(function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment