Nouvelle focntionnalité pour activer ou désactiver l'enregistrement des rapports individuels.
This commit is contained in:
Fred Tempez 2024-12-06 18:58:49 +01:00
parent 124aeeeb98
commit 9dba1b8e79
6 changed files with 42 additions and 22 deletions

View File

@ -435,15 +435,17 @@ class core extends common
$course = new course(); $course = new course();
// Met à jour la progression de l'utisateur et obtient le nombre de pages vues // Met à jour la progression de l'utisateur et obtient le nombre de pages vues
$userProgress = $course->setUserProgress(self::$siteContent, $this->getUser('id')); $userProgress = $course->setUserProgress(self::$siteContent, $this->getUser('id'));
// Stockage dans les données d'inscription du membre // Stockage dans les données d'inscription du membre
$this->setData(['enrolment', self::$siteContent, $this->getUser('id'), 'progress', $userProgress], false); $this->setData(['enrolment', self::$siteContent, $this->getUser('id'), 'progress', $userProgress], false);
// Les rapports sont activés
// Stocke la dernière page vue et sa date de consultation // Stocke la dernière page vue et sa date de consultation
$this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'lastPageView', $this->getUrl(0)], false); if ($this->getdata(['course', common::$siteContent, 'report']) === true) {
$this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'datePageView', time()]); $this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'lastPageView', $this->getUrl(0)], false);
$this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'datePageView', time()]);
}
} }
// Journalisation // Journalisation

View File

@ -289,6 +289,7 @@ class course extends common
'enrolmentKey' => $this->getInput('courseEditEnrolmentKey'), 'enrolmentKey' => $this->getInput('courseEditEnrolmentKey'),
'limitEnrolment' => $this->getInput('courseEditEnrolmentLimit', helper::FILTER_BOOLEAN), 'limitEnrolment' => $this->getInput('courseEditEnrolmentLimit', helper::FILTER_BOOLEAN),
'limitEnrolmentDate' => $this->getInput('courseEditEnrolmentLimitDate', helper::FILTER_DATETIME), 'limitEnrolmentDate' => $this->getInput('courseEditEnrolmentLimitDate', helper::FILTER_DATETIME),
'report' => $this->getInput('courseEditEnrolmentReport', helper::FILTER_BOOLEAN),
] ]
]); ]);
@ -719,6 +720,22 @@ class course extends common
0; 0;
// Construction du tableau // Construction du tableau
if ($this->getdata(['course', $courseId, 'report']) === true) {
$reportButton = template::button('userReport' . $userId, [
'href' => helper::baseUrl() . 'course/userReport/' . $courseId . '/' . $userId,
'value' => (array_key_exists('progress', $userValue) && is_int($userValue['progress']))
? number_format($userValue['progress']) . ' %'
: ($viewPages ? min(round(($viewPages * 100) / $sumPages, 1), 100) . ' %' : '0%'),
'disable' => empty($userValue['datePageView']),
]);
} else {
$reportButton = template::button('userReport' . $userId, [
'value' =>'-',
'disable' => true,
'help' => 'Rapport désactivé',
]);
}
self::$courseUsers[] = [ self::$courseUsers[] = [
//$userId, //$userId,
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']), $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
@ -732,19 +749,7 @@ class course extends common
? helper::dateUTF8('%H:%M', $userValue['datePageView']) ? helper::dateUTF8('%H:%M', $userValue['datePageView'])
: '', : '',
$this->getData(['user', $userId, 'tags']), $this->getData(['user', $userId, 'tags']),
template::button('userReport' . $userId, [ $reportButton,
'href' => helper::baseUrl() . 'course/userReport/' . $courseId . '/' . $userId,
/** La lecture de la progression s'effectue selon la nouvelle méthode (progression dans la base des enrolements)
* Soit avec l'ancienne méthode qui consiste à recalculer la progression.
*
* Le pourcentage de progression est-il renseigné au format INT sinon il est recalculé
*
**/
'value' => (array_key_exists('progress', $userValue) and is_int($userValue['progress']))
? number_format($userValue['progress']) . ' %'
: ($viewPages ? min(round(($viewPages * 100) / $sumPages, 1), 100) . ' %' : '0%'),
'disable' => empty($userValue['datePageView']),
]),
template::button('userDelete' . $userId, [ template::button('userDelete' . $userId, [
'class' => 'userDelete buttonRed', 'class' => 'userDelete buttonRed',
'href' => helper::baseUrl() . 'course/userDelete/' . $courseId . '/' . $userId, 'href' => helper::baseUrl() . 'course/userDelete/' . $courseId . '/' . $userId,

View File

@ -90,6 +90,12 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col4">
<?php echo template::checkbox('courseEditEnrolmentReport', true, 'Rapport des vues', [
'checked' => $this->getdata(['course', $this->getUrl(2), 'report']),
'help' => 'Ne s\'applique pas à l\'inscription anonyme',
]); ?>
</div>
<div class="col4"> <div class="col4">
<?php echo template::checkbox('courseEditEnrolmentLimit', true, 'Date de fin d\'inscription', [ <?php echo template::checkbox('courseEditEnrolmentLimit', true, 'Date de fin d\'inscription', [
'checked' => $this->getdata(['course', $this->getUrl(2), 'limitEnrolment']), 'checked' => $this->getdata(['course', $this->getUrl(2), 'limitEnrolment']),
@ -99,7 +105,7 @@
<div class="col4"> <div class="col4">
<?php echo template::date('courseEditEnrolmentLimitDate', [ <?php echo template::date('courseEditEnrolmentLimitDate', [
'type' => 'datetime-local', 'type' => 'datetime-local',
'label' => 'Fermeture', 'label' => 'Fin d\'inscription',
'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60 'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60
]); ?> ]); ?>
</div> </div>

View File

@ -161,6 +161,13 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col4">
<?php echo template::checkbox('courseManageEnrolmentReport', true, 'Rapport des vues', [
'checked' => $this->getdata(['course', $this->getUrl(2), 'report']),
'help' => 'Ne s\'applique pas à l\'inscription anonyme',
'disabled' => true,
]); ?>
</div>
<div class="col4"> <div class="col4">
<?php echo template::checkbox('courseManageEnrolmentLimit', true, 'Date de fin d\'inscription', [ <?php echo template::checkbox('courseManageEnrolmentLimit', true, 'Date de fin d\'inscription', [
'checked' => $this->getdata(['course', $this->getUrl(2), 'limitEnrolment']), 'checked' => $this->getdata(['course', $this->getUrl(2), 'limitEnrolment']),
@ -171,7 +178,7 @@
<div class="col4"> <div class="col4">
<?php echo template::date('courseManageEnrolmentLimitDate', [ <?php echo template::date('courseManageEnrolmentLimitDate', [
'type' => 'datetime-local', 'type' => 'datetime-local',
'label' => 'Fermeture', 'label' => 'Fin d\'inscription',
'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60, 'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60,
'readonly' => true, 'readonly' => true,
]); ?> ]); ?>

View File

@ -10,7 +10,7 @@
<?php echo template::button('userDeleteAll', [ <?php echo template::button('userDeleteAll', [
'href' => helper::baseUrl() . 'course/userReportExport/' . $this->getUrl(2) . '/' . $this->getUrl(3), 'href' => helper::baseUrl() . 'course/userReportExport/' . $this->getUrl(2) . '/' . $this->getUrl(3),
'value' => template::ico('download'), 'value' => template::ico('download'),
'help' => 'Exporter', 'help' => 'Exporter rapport',
]) ?> ]) ?>
</div> </div>
</div> </div>

View File

@ -10,7 +10,7 @@
<?php echo template::button('userDeleteAll', [ <?php echo template::button('userDeleteAll', [
'href' => helper::baseUrl() . 'course/usersReportExport/' . $this->getUrl(2), 'href' => helper::baseUrl() . 'course/usersReportExport/' . $this->getUrl(2),
'value' => template::ico('download'), 'value' => template::ico('download'),
'help' => 'Exporter', 'help' => 'Exporter rapports',
]) ?> ]) ?>
</div> </div>
<div class="col1"> <div class="col1">