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'))) { if ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group'))) {
$leftItems .= '<li><select id="barSelectCourse" >'; $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>'; $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) { foreach ($this->getCoursesByUser($this->getUser('id'), $this->getUser('group')) as $courseId => $value) {
$leftItems .= '<option name="' . $value['title'] . '" value="' . helper::baseUrl(true) . 'course/swap/' . $key . '" ' . ($key === self::$siteContent ? 'selected' : '') . '>' . $value['title'] . '</option>'; $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>'; $leftItems .= '</select></li>';
} }

View File

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

View File

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