Limitation de date d'nscription

This commit is contained in:
Fred Tempez 2023-11-18 16:14:19 +01:00
parent a4d4f9cce4
commit 3c4e5f7d05
5 changed files with 58 additions and 13 deletions

View File

@ -50,7 +50,7 @@ class common
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '1.1.03';
const ZWII_VERSION = '1.1.04';
// URL autoupdate
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';

View File

@ -162,6 +162,8 @@ class course extends common
'closingDate' => $this->getInput('courseAddClosingDate', helper::FILTER_DATETIME),
'enrolment' => $this->getInput('courseAddEnrolment', helper::FILTER_INT),
'enrolmentKey' => $this->getInput('courseAddEnrolmentKey'),
'limitEnrolment' => $this->getInput('courseAddEnrolmentLimit', helper::FILTER_BOOLEAN),
'limitEnrolmentDate' => $this->getInput('courseAddEnrolmentLimitDate', helper::FILTER_DATETIME),
]
]);
@ -227,6 +229,8 @@ class course extends common
'closingDate' => $this->getInput('courseClosingDate', helper::FILTER_DATETIME),
'enrolment' => $this->getInput('courseEditEnrolment', helper::FILTER_INT),
'enrolmentKey' => $this->getInput('courseEditEnrolmentKey'),
'limitEnrolment' => $this->getInput('courseEditEnrolmentLimit', helper::FILTER_BOOLEAN),
'limitEnrolmentDate' => $this->getInput('courseEditEnrolmentLimitDate', helper::FILTER_DATETIME),
]
]);
@ -863,12 +867,15 @@ class course extends common
}
$file = fopen($filename, 'w');
foreach ($history['history'] as $pageId => $time) {
$data = array_map('html_entity_decode', array(
$data = array_map(
'html_entity_decode',
array(
$pageId,
$pages[$pageId]['title'],
$pages[$pageId]['number'],
helper::dateUTF8('%d %B %Y - %H:%M:%S', $time),
));
)
);
// Écrire la ligne dans le fichier CSV
fputcsv($file, $data, ';');

View File

@ -86,6 +86,19 @@
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::checkbox('courseAddEnrolmentLimit', true, 'Date de fin d\'inscription', [
'help' => 'Ne s\'applique pas à l\'inscription anonyme',
]); ?>
</div>
<div class="col4">
<?php echo template::date('courseAddEnrolmentLimitDate', [
'type' => 'datetime-local',
'label' => 'Fermeture',
]); ?>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -76,19 +76,34 @@
</div>
</div>
<div class="row">
<div class="col6">
<div class="col4">
<?php echo template::select('courseEditEnrolment', $module::$courseEnrolment, [
'label' => 'Inscription',
'selected' => $this->getdata(['course', $this->getUrl(2), 'enrolment'])
]); ?>
</div>
<div class="col6">
<div class="col4">
<?php echo template::text('courseEditEnrolmentKey', [
'label' => 'Clé',
'value' => $this->getdata(['course', $this->getUrl(2), 'enrolmentKey'])
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::checkbox('courseEditEnrolmentLimit', true, 'Date de fin d\'inscription', [
'checked' => $this->getdata(['course', $this->getUrl(2), 'limitEnrolment']),
'help' => 'Ne s\'applique pas à l\'inscription anonyme',
]); ?>
</div>
<div class="col4">
<?php echo template::date('courseEditEnrolmentLimitDate', [
'type' => 'datetime-local',
'label' => 'Fermeture',
'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60
]); ?>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -3,13 +3,21 @@
<div class="col12">
<?php echo "<h3>Auteur : " . $this->signature($this->getData(['course', $this->getUrl(2), 'author'])) . "</h3>"; ?>
<?php echo "<p>Description : " . $this->getData(['course', $this->getUrl(2), 'description']) . "</p>"; ?>
<!--Restriction de date limite d'ouverture-->
<?php echo "<p>Disponibilité : " . $module::$courseAccess[$this->getData(['course', $this->getUrl(2), 'access'])]; ?>
<?php if ($this->getData(['course', $this->getUrl(2), 'access']) === $module::COURSE_ACCESS_DATE): ?>
<?php $from = helper::dateUTF8('%d %B %Y', $this->getData(['course', $this->getUrl(2), 'openingDate']), self::$i18nUI) . helper::translate(' à ') . helper::dateUTF8('%H:%M', $this->getData(['course', $this->getUrl(2), 'openingDate']), self::$i18nUI); ?>
<?php $to = helper::dateUTF8('%d %B %Y', $this->getData(['course', $this->getUrl(2), 'closingDate']), self::$i18nUI) . helper::translate(' à ') . helper::dateUTF8('%H:%M', $this->getData(['course', $this->getUrl(2), 'closingDate']), self::$i18nUI); ?>
<?php echo sprintf(helper::translate(' du %s au %s'), $from, $to); ?>
<?php endif; ?>
<?php echo "</p><p>Inscription : " . $module::$courseEnrolment[$this->getData(['course', $this->getUrl(2), 'enrolment'])] . "</p>"; ?>
<?php echo '</p>'; ?>
<?php echo "<p>Inscription : " . $module::$courseEnrolment[$this->getData(['course', $this->getUrl(2), 'enrolment'])] . '.'; ?>
<!--Restriction de date limite d'insription-->
<?php if ($this->getData(['course', $this->getUrl(2), 'limitEnrolment']) === true && $this->getData(['course', $this->getUrl(2), 'limitEnrolmentDate']) <= time()):?>
<?php echo helper::translate(' Les inscriptions sont closes depuis le ') ?>
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['course', $this->getUrl(2), 'limitEnrolmentDate']), self::$i18nUI) . helper::translate(' à ') . helper::dateUTF8('%H:%M', $this->getData(['course', $this->getUrl(2), 'limitEnrolmentDate']), self::$i18nUI); ?>
<?php endif; ?>
<?php echo '</p>'; ?>
</div>
</div>
<div class="row">
@ -44,8 +52,10 @@
<div class="col3 offset7">
<?php echo template::submit('courseSwapSubmit', [
'value' => $module::$swapMessage['submitLabel'],
'disabled' => !$module->courseIsAvailable($this->getUrl(2)),
'ico' => ''
'disabled' => !($module->courseIsAvailable($this->getUrl(2))
&& !($this->getData(['course', $this->getUrl(2), 'limitEnrolment']) === true
&& $this->getData(['course', $this->getUrl(2), 'limitEnrolmentDate']) <= time())
),
]); ?>
</div>
<?php endif; ?>