program calendar - open two first months
This commit is contained in:
parent
09a7d48a31
commit
ee2d1c66cd
3 changed files with 28 additions and 3 deletions
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
function getMonthNumber($month) {
|
||||
$array = [
|
||||
'janvier' => 1,
|
||||
'février' => 2,
|
||||
'mars' => 3,
|
||||
'avril' => 4,
|
||||
'mai' => 5,
|
||||
'juin' => 6,
|
||||
'juillet' => 7,
|
||||
'août' => 8,
|
||||
'septembre' => 9,
|
||||
'octobre' => 10,
|
||||
'novembre' => 11,
|
||||
'décembre' => 12,
|
||||
];
|
||||
|
||||
return $array[$month];
|
||||
}
|
||||
|
||||
function filterFutureEvents($events) {
|
||||
$futureEvents = new Pages();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
$open = $open ?? false;
|
||||
?>
|
||||
<section class="collapsable" x-data="{
|
||||
open: false,
|
||||
open: <?= var_export($open) ?>,
|
||||
openSection(event) {
|
||||
const section = event.target.closest('.collapsable')
|
||||
section.querySelectorAll('[tabindex]').forEach(item => {
|
||||
|
|
|
|||
|
|
@ -77,10 +77,13 @@
|
|||
<div class="program-content__events">
|
||||
<section class="collapsable-sections">
|
||||
<?php
|
||||
|
||||
$currentMonth = date('n');
|
||||
foreach($currentSeasonSessions as $month => $sessions): ?>
|
||||
<?php
|
||||
$open = getMonthNumber($month) == $currentMonth || getMonthNumber($month) == $currentMonth + 1;
|
||||
?>
|
||||
<?php if (count($sessions) > 0): ?>
|
||||
<?php snippet('collapsable-section', ['title' => $month, 'padding' => false], slots: true) ?>
|
||||
<?php snippet('collapsable-section', ['title' => $month, 'padding' => false, 'open' => $open], slots: true) ?>
|
||||
<?php slot('content') ?>
|
||||
<ul class="sessions sessions--detailed">
|
||||
<?php
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue