1410 liste tous dans les sélecteurs d'espaces

This commit is contained in:
Fred Tempez 2024-01-20 21:39:22 +01:00
parent 21c49d8e53
commit 8cfe76bdf6
2 changed files with 11 additions and 6 deletions

View File

@ -494,16 +494,18 @@ class layout extends common
/**
* Commandes pour les membres simples
* Affichage du sélecteur d'espaces
*/
*/
$courses = $this->getData([('course')]);
$courses = helper::arraycolumn($courses, 'title', 'SORT_ASC');
if (
//$this->getUser('group') === self::GROUP_MEMBER
// &&
$this->getData(['theme', 'menu', 'selectSpace']) === true
) {
if ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group'))) {
if ($courses) {
$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($this->getUser('id'), $this->getUser('group')) as $courseId => $value) {
foreach ($courses 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>';
@ -922,11 +924,13 @@ class layout extends common
* Les admins voient tousles contenus
* Les enseignants les contenus dont ils sont auteurs
*/
$courses = $this->getData([('course')]);
$courses = helper::arraycolumn($courses, 'title', 'SORT_ASC');
if ($this->getUser('group') >= self::GROUP_EDITOR) {
if ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group'))) {
if ($courses) {
$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($this->getUser('id'), $this->getUser('group')) as $courseId => $value) {
foreach ($courses 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

@ -1300,7 +1300,8 @@ class course extends common
]);
break;
case self::COURSE_ENROLMENT_SELF_KEY:
if ($this->getInput('courseSwapEnrolmentKey', helper::FILTER_PASSWORD, true) === $this->getData(['course', $courseId, 'enrolmentKey'])) {
if ($this->getInput('courseSwapEnrolmentKey', helper::FILTER_PASSWORD, true) === $this->getData(['course', $courseId, 'enrolmentKey']))
{
$this->courseEnrolUser($courseId, $userId);
// Stocker la sélection
$_SESSION['ZWII_SITE_CONTENT'] = $courseId;