From 2a44e130f5dfc3274bd2844c8085c8683d2f6b61 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 2 Jan 2025 16:48:51 +0100 Subject: [PATCH] =?UTF-8?q?Editeur=20et=20admins=20ont=20acc=C3=A8s=20aux?= =?UTF-8?q?=20stattistiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/layout.class.php | 37 ++++++++++++++++++++++++++++------- core/module/course/course.php | 3 +-- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/core/class/layout.class.php b/core/class/layout.class.php index 7cbebee..c46f1b5 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -522,18 +522,41 @@ class layout extends common /** * Affiche le bouton d'affichage des rapports individuels de consultation */ + if ( - $this->getUser('group') === self::GROUP_MEMBER - && $this->getData(['theme', 'menu', 'userReport']) === true + $this->getData(['theme', 'menu', 'userReport']) === true && self::$siteContent !== 'home' // Pas de statistiques pour les espaces ouverts && $this->getData(['course', self::$siteContent, 'enrolment']) >= 1 ) { - $itemsRight .= '
  • ' . template::ico('chart-line', [ - 'help' => 'Rapport des consultations', - 'margin' => 'all', - 'href' => helper::baseUrl() . 'course/userReport/' . self::$siteContent . '/' . $this->getUser('id') - ]) . '
  • '; + $href = ''; + switch ($this->getUser('group')) { + case self::GROUP_MEMBER: + $href = helper::baseUrl() . 'course/userReport/' . self::$siteContent . '/' . $this->getUser('id'); + break; + case self::GROUP_EDITOR: + if ( + $this->getData(['enrolment', self::$siteContent ]) && ($this->getUser('id') === $this->getData(['course', self::$siteContent , 'author'])) + // Permission d'accéder aux espaces dans lesquels le membre est inscrit + || + ($this->getData(['enrolment', self::$siteContent ]) + && $this->getUser('permission', __CLASS__, 'tutor') === true + && array_key_exists($this->getUser('id'), $this->getData(['enrolment', self::$siteContent ]))) + ) + { + $href = helper::baseUrl() . 'course/users/' . self::$siteContent; + } + break; + case self::GROUP_ADMIN: + $href = helper::baseUrl() . 'course/users/' . self::$siteContent; + } + if ($href) { + $itemsRight .= '
  • ' . template::ico('chart-line', [ + 'help' => 'Rapport des consultations', + 'margin' => 'all', + 'href' => $href + ]) . '
  • '; + } } /** diff --git a/core/module/course/course.php b/core/module/course/course.php index 2d25dff..6639dc4 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -623,7 +623,6 @@ class course extends common $courseId = $this->getUrl(2); // Accès limité au propriétaire, admin ou éditeurs isncrits - if ( $this->permissionControl(__FUNCTION__, $courseId) === false ) { @@ -2013,7 +2012,7 @@ class course extends common $this->getData(['enrolment', $courseId]) && ($this->getUser('id') === $this->getData(['course', $courseId, 'author'])) ) || - ( // Permission d'accéder aux espaces dans lesquels le membre est inscrits + ( // Permission d'accéder aux espaces dans lesquels le membre est inscrit $this->getData(['enrolment', $courseId]) && $this->getUser('permission', __CLASS__, 'tutor') === true && array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId]))