diff --git a/core/class/layout.class.php b/core/class/layout.class.php index e293cbc..fd7b7a1 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -499,10 +499,10 @@ class layout extends common $this->getUser('group') === self::GROUP_MEMBER && $this->getData(['theme', 'menu', 'selectSpace']) === true ) { - if ($this->getCoursesByUser()) { + if ($this->getCoursesByProfil()) { $itemsRight .= '
'; @@ -921,10 +921,10 @@ class layout extends common * Les enseignants les contenus dont ils sont auteurs */ if ($this->getUser('group') >= self::GROUP_EDITOR) { - if ($this->getCoursesByUser()) { + if ($this->getCoursesByProfil()) { $leftItems .= ''; diff --git a/core/core.php b/core/core.php index a1a5144..cbb7d7a 100644 --- a/core/core.php +++ b/core/core.php @@ -1422,7 +1422,7 @@ class common * CETTE FONCTION N'EST PAS UTILISEE * */ - public function getCoursesByUser() + public function getCoursesByProfil() { $courses = $this->getData([('course')]); $courses = helper::arraycolumn($courses, 'title', 'SORT_ASC'); @@ -1434,12 +1434,11 @@ class common return $courses; case self::GROUP_EDITOR: foreach ($courses as $courseId => $value) { - $students = $this->getData(['enrolment', $courseId]); // Affiche les espaces gérés par l'éditeur, les espaces où il participe et les espaces ouverts if ( - isset($students[$userId]) === true || - $this->getData(['course', $courseId, 'author']) === $userId || - $this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST + ( $this->getData(['enrolment', $courseId]) && array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId])) ) + || $this->getUser('id') === $this->getData(['course', $courseId, 'author']) + || $this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST ) { $filter[$courseId] = $courses[$courseId]; } @@ -1448,10 +1447,9 @@ class common case self::GROUP_MEMBER: foreach ($courses as $courseId => $value) { // Affiche les espaces du participant et les espaces anonymes - $students = $this->getData(['enrolment', $courseId]); if ( - isset($students[$userId]) === true || - $this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST + ($this->getData(['enrolment', $courseId]) && array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId])) ) + || $this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST ) { $filter[$courseId] = $courses[$courseId]; } diff --git a/core/module/course/course.php b/core/module/course/course.php index 3dd1da2..aec72ab 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -85,9 +85,9 @@ class course extends common if ( $this->getUser('id') && $this->getUser('group') - && $this->getCoursesByUser() + && $this->getCoursesByProfil() ) { - foreach ($this->getCoursesByUser() as $courseId => $courseValue) { + foreach ($this->getCoursesByProfil() as $courseId => $courseValue) { /** * Filtres : * Groupes acceptés : @@ -1761,9 +1761,9 @@ class course extends common case self::GROUP_EDITOR: return ( $this->getUser('group') === self::$actions[$funtion] - && $this->getData(['enrolment', $courseId]) - && ($this->getUser('id') === $this->getData(['course', $courseId, 'author']) - || array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId])) ) + && + ( $this->getData(['enrolment', $courseId]) && ($this->getUser('id') === $this->getData(['course', $courseId, 'author']) ) + || array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId])) ) ); default: return false;