Course sort

This commit is contained in:
Fred Tempez 2024-01-13 22:35:57 +01:00
parent 98ee5d4afe
commit 104e3d408c
3 changed files with 8 additions and 7 deletions

View File

@ -902,8 +902,8 @@ class layout extends common
if ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group'))) {
$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 $key => $value) {
$leftItems .= '<option name="' . $value['title'] . '" value="' . helper::baseUrl(true) . 'course/swap/' . $key . '" ' . ($key === self::$siteContent ? 'selected' : '') . '>' . $value['title'] . '</option>';
foreach ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group')) 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>';
}
@ -1033,7 +1033,7 @@ class layout extends common
$rightItems = '';
if (
(
// ZwiiCampus ------
// ZwiiCampus ------
self::$siteContent !== 'home'
// ZwiiCampus ------
&& $this->getUser('group') >= self::GROUP_MEMBER

View File

@ -1424,6 +1424,7 @@ class common
public function getCoursesByUser($userId, $userStatus)
{
$c = $this->getData([('course')]);
$c = helper::arraycolumn($c, 'title', 'SORT_ASC');
switch ($userStatus) {
case self::GROUP_ADMIN:
return $c;

View File

@ -89,11 +89,11 @@ class course extends common
$author = isset($authorId)
? sprintf('%s %s', $this->getData(['user', $authorId, 'firstname']), $this->getData(['user', $authorId, 'lastname']))
: '';
$info = sprintf('<strong>%s<br /></strong>Auteur : %s<br />Id : <a href="%s" target="_blank">%s<br />', $courseValue['title'], $author, $categorieUrl, $courseId);
$categorieUrl = helper::baseUrl() . 'course/swap/' . $courseId;
$access = self::$courseAccess[$courseValue['access']];
$enrolment = self::$courseEnrolment[$courseValue['enrolment']];
$description = sprintf('<strong>%s</strong><br />Accès : %s<br />Inscription : %s<br />', $courseValue['description'], $access, $enrolment);
$info = sprintf('<strong>%s<br /></strong>Auteur : %s<br />Id : <a href="%s" target="_blank">%s<br />', $this->getData(['course', $courseId, 'title']), $author, $categorieUrl, $courseId);
$access = self::$courseAccess[$this->getData(['course', $courseId, 'access'])];
$enrolment = self::$courseEnrolment[$this->getData(['course', $courseId, 'enrolment'])];
$description = sprintf('<strong>%s</strong><br />Accès : %s<br />Inscription : %s<br />', $this->getData(['course', $courseId, 'description']), $access, $enrolment);
self::$courses[] = [
$info,
//$author,