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]))