From 56af790d82925af324f4f495fd9f6e7a5ebf55a3 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Mon, 25 Sep 2023 20:36:54 +0200 Subject: [PATCH] courseUserEnrolment change de nom --- core/core.php | 3 ++- core/module/course/course.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/core.php b/core/core.php index bfaf479..842d4d6 100644 --- a/core/core.php +++ b/core/core.php @@ -1455,8 +1455,9 @@ class common * @param string $userId identifiant de l'utilisateur * @param string $courseId identifiant du cours sollicité */ - public function courseUserEnrolment($courseId, $userId = null) + public function courseIsUserEnroled($courseId) { + $userId = $this->getUser('id'); $group = $userId ? $this->getData(['user', $userId, 'group']) : false; switch ($group) { case self::GROUP_ADMIN: diff --git a/core/module/course/course.php b/core/module/course/course.php index 1177c05..50e1258 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -316,7 +316,7 @@ class course extends common self::$swapMessage['submitLabel'] = 'Se connecter'; self::$swapMessage['enrolmentMessage'] = ''; self::$swapMessage['enrolmentKey'] = ''; - if ($this->courseUserEnrolment($courseId, $userId) === false) { + if ($this->courseIsUserEnroled($courseId) === false) { switch ($this->getData(['course', $courseId, 'enrolment'])) { case self::COURSE_ENROLMENT_GUEST: case self::COURSE_ENROLMENT_SELF: @@ -335,7 +335,7 @@ class course extends common break; } } - + // Valeurs en sortie $this->addOutput([ 'title' => sprintf(helper::translate('Accéder au cours %s'), $this->getData(['course', $this->getUrl(2), 'shortTitle'])),