1.5.00 getCoursesByUser devient getCoursesByProfil

This commit is contained in:
Fred Tempez 2024-02-12 15:16:46 +01:00
parent e80564c106
commit 3ebb305cae
3 changed files with 15 additions and 17 deletions

View File

@ -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 .= '<li><select id="menuSelectCourse" >';
$itemsRight .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$siteContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
foreach ($this->getCoursesByUser() as $courseId => $value) {
foreach ($this->getCoursesByProfil() as $courseId => $value) {
$itemsRight .= '<option name="' . $this->getData(['course', $courseId, 'title']) . '" value="' . helper::baseUrl(true) . 'course/swap/' . $courseId . '" ' . ($courseId === self::$siteContent ? 'selected' : '') . '>' . $this->getData(['course', $courseId, 'title']) . '</option>';
}
$itemsRight .= '</select></li>';
@ -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 .= '<li><select id="barSelectCourse" >';
$leftItems .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$siteContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
foreach ($this->getCoursesByUser() as $courseId => $value) {
foreach ($this->getCoursesByProfil() as $courseId => $value) {
$leftItems .= '<option name="' . $this->getData(['course', $courseId, 'title']) . '" value="' . helper::baseUrl(true) . 'course/swap/' . $courseId . '" ' . ($courseId === self::$siteContent ? 'selected' : '') . '>' . $this->getData(['course', $courseId, 'title']) . '</option>';
}
$leftItems .= '</select></li>';

View File

@ -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];
}

View File

@ -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,8 +1761,8 @@ 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'])
&&
( $this->getData(['enrolment', $courseId]) && ($this->getUser('id') === $this->getData(['course', $courseId, 'author']) )
|| array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId])) )
);
default: