Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Courses list: set a default order #1655

Open
ywarnier opened this issue Feb 8, 2017 · 8 comments
Open

Courses list: set a default order #1655

ywarnier opened this issue Feb 8, 2017 · 8 comments

Comments

@ywarnier
Copy link
Member

ywarnier commented Feb 8, 2017

Current behavior / Resultado actual / Résultat actuel

The list of courses for students and teachers appear with no particular logic. The issue with that is that a change in one of the course's settings can have the impact of changing the order, which makes it difficult to manage when you have 30-40 courses or so.

Expected behavior / Resultado esperado / Résultat attendu

Ordering by name would be just fine (first sessions by date then name (if no date), then courses by name).

Chamilo Version / Versión de Chamilo / Version de Chamilo

1.11.2

@p4pr8n for more info

@shabsshab
Copy link

Can we sort the course manually ?
Eg:- I do have subject name online class and it should in top as around 20 courses are there and sometimes teachers and students are in different live classes ,So keeping a subject online class and it should in first

@ywarnier
Copy link
Member Author

ywarnier commented Dec 4, 2020

The ordering by alphabetical order has been fixed in 1.11.14, as far as I know (and should be the same code in 2.0). Assigning to Carlos for confirmation...

@carlangas159
Copy link
Contributor

hi @ywarnier

Good morning, if there is a logic although it is not easy to observe, I explain, when you enter the section of my courses, user_portal.php is loaded, the section of the courses is loaded in the following line
https://github.com/chamilo/chamilo-lms/blob/1.11.x/user_portal.php#L191
calling the function $courseAndSessions = $controller->returnCoursesAndSessions($userId, true, null, true, $loadHistory);

If loadHistory is false, the course categories are called. For each category, the courses will be selected using the function (returnCoursesCategories) https://github.com/chamilo/chamilo-lms/blob/1.11.x/main/inc/lib/course.lib.php#L4063

It is here that the sql is structured to show the ordered courses that will be as follows

ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC

It is ordered first by category and then by the order established by the user, if this order is not modified by the user an incremental is used by date of addition

It will be revised properly for version 2

@nguyen-xuan-huan
Copy link

Hi... How to show All courses on Homepage in chamilo v 1.11.16 (By default only 6 courses show on the homepage). Thank!

@ywarnier
Copy link
Member Author

ywarnier commented Oct 6, 2021

Hi @nguyen-xuan-huan
This should be in a new issue, although it's not really a bug (only bugs or feature requests should be reported here - questions should go to forum.chamilo.org or on our Slack channel).
You can change it in your code here: https://github.com/chamilo/chamilo-lms/blob/1.11.x/main/inc/lib/userportal.lib.php#L1180 (second parameter)

@lonesomewalker
Copy link

Slack is only available for @beeznest addresses ;-)

@ywarnier
Copy link
Member Author

ywarnier commented Oct 7, 2021

@lonesomewalker Not at all, you just have to ask for an invitation if you have legitimate interest in contributing. It's not open because we don't want to deal with spam account. Several people who have contributed issues/patches/PRs in the past are on Slack, unrelated to BeezNest

@christianbeeznest
Copy link
Contributor

Courses are ordered alphabetically by title (c.title), followed by the custom sort field (sort) and the course category (userCourseCat). Sessions are ordered by start date (s.displayStartDate), then alphabetically by title (s.title), and finally by their defined position (s.position).

It is checked with this PR #6036

christianbeeznest added a commit to christianbeeznest/chamilo-lms that referenced this issue Feb 4, 2025
christianbeeznest added a commit that referenced this issue Feb 4, 2025
User: Add ordering logic for courses and sessions list - refs #1655
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

6 participants