From 9e708fcd101d374be5ff9cdbd1ab7c90940ccef1 Mon Sep 17 00:00:00 2001 From: F TEMPEZ Date: Thu, 12 Oct 2023 15:38:58 +0200 Subject: [PATCH] Fix signature enrol popup move signature to core --- core/core.php | 23 +++++++++++++++++++++++ core/module/course/view/enrol/enrol.php | 2 +- module/blog/blog.php | 22 ---------------------- module/news/news.php | 22 ---------------------- 4 files changed, 24 insertions(+), 45 deletions(-) diff --git a/core/core.php b/core/core.php index 279bd23..b34a755 100644 --- a/core/core.php +++ b/core/core.php @@ -1469,4 +1469,27 @@ class common } } + /** + * Retourne la signature d'un utilisateur + */ + public function signature($userId) + { + switch ($this->getData(['user', $userId, 'signature'])) { + case 1: + return $userId; + break; + case 2: + return $this->getData(['user', $userId, 'pseudo']); + break; + case 3: + return $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']); + break; + case 4: + return $this->getData(['user', $userId, 'lastname']) . ' ' . $this->getData(['user', $userId, 'firstname']); + break; + default: + return $this->getData(['user', $userId, 'firstname']); + } + } + } \ No newline at end of file diff --git a/core/module/course/view/enrol/enrol.php b/core/module/course/view/enrol/enrol.php index b924814..874c0fc 100644 --- a/core/module/course/view/enrol/enrol.php +++ b/core/module/course/view/enrol/enrol.php @@ -1,7 +1,7 @@
- Auteur : " . $this->getData(['course', $this->getUrl(2), 'author']) . ""; ?> + Auteur : " . $this->signature($this->getData(['course', $this->getUrl(2), 'author'])). ""; ?> Description : " . $this->getData(['course', $this->getUrl(2), 'description']) . "

"; ?> Disponibilité : " . $module::$courseAccess[$this->getData(['course', $this->getUrl(2), 'access'])]; ?> getData(['course', $this->getUrl(2), 'access']) === $module::COURSE_ACCESS_DATE): ?> diff --git a/module/blog/blog.php b/module/blog/blog.php index 0e161d4..9894d5f 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -897,26 +897,4 @@ class blog extends common } } - /** - * Retourne la signature d'un utilisateur - */ - public function signature($userId) - { - switch ($this->getData(['user', $userId, 'signature'])) { - case 1: - return $userId; - break; - case 2: - return $this->getData(['user', $userId, 'pseudo']); - break; - case 3: - return $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']); - break; - case 4: - return $this->getData(['user', $userId, 'lastname']) . ' ' . $this->getData(['user', $userId, 'firstname']); - break; - default: - return $this->getData(['user', $userId, 'firstname']); - } - } } \ No newline at end of file diff --git a/module/news/news.php b/module/news/news.php index aec7186..67eace5 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -548,28 +548,6 @@ class news extends common } } - /** - * Retourne la signature d'un utilisateur - */ - private function signature($userId) - { - switch ($this->getData(['user', $userId, 'signature'])) { - case 1: - return $userId; - break; - case 2: - return $this->getData(['user', $userId, 'pseudo']); - break; - case 3: - return $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']); - break; - case 4: - return $this->getData(['user', $userId, 'lastname']) . ' ' . $this->getData(['user', $userId, 'firstname']); - break; - default: - return $this->getData(['user', $userId, 'firstname']); - } - } /** * Mise à jour du module