Moodle

sorting of users within a role

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.7.2, 1.8, 1.9, 2.0.1
  • Fix Version/s: STABLE backlog
  • Component/s: Roles / Access
  • Labels:
  • Affected Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

This can be tricky because a role can literally consist of hundreds of users within a context, the interface could be very difficult. Apart from this, it is difficult to sort users, say students within a course solely based on a database fields because students can be assigned at course_cat level or system level as well.

Issue Links

Activity

Hide
Yu Zhang added a comment -

Hi Pablo,

Would it be sufficient if you are able to sort just the course managers? I.e. whatever role you define to be visible on the course description area.

Cheers,

Yu

Show
Yu Zhang added a comment - Hi Pablo, Would it be sufficient if you are able to sort just the course managers? I.e. whatever role you define to be visible on the course description area. Cheers, Yu
Hide
Pablo Etcheverry added a comment -

Yes, it would be sufficient. Just the features available in 1.5 and before. Just remember it is not "sorting within a role". It is "sorting within a course", no matter what roles we are talking about. I hope that simplifies things for the interface, since it is just at course_cat level...

Of course this doesn't include the "Student" role, but does include all the roles above that.

Cheers,
PAblo

Show
Pablo Etcheverry added a comment - Yes, it would be sufficient. Just the features available in 1.5 and before. Just remember it is not "sorting within a role". It is "sorting within a course", no matter what roles we are talking about. I hope that simplifies things for the interface, since it is just at course_cat level... Of course this doesn't include the "Student" role, but does include all the roles above that. Cheers, PAblo
Hide
Arnaud saint-Georges added a comment -

The plugin "List of Assignees" do something like that.
For example, list of the teachers in the context of a course.

Show
Arnaud saint-Georges added a comment - The plugin "List of Assignees" do something like that. For example, list of the teachers in the context of a course.
Hide
Martin Dougiamas added a comment -

See http://moodle.org/mod/forum/discuss.php?d=86864

We have a table (with a typo), but no code in CVS as yet relating to this.

Was any code written for this, Yu? (ie could it be in your private copy?)

Show
Martin Dougiamas added a comment - See http://moodle.org/mod/forum/discuss.php?d=86864 We have a table (with a typo), but no code in CVS as yet relating to this. Was any code written for this, Yu? (ie could it be in your private copy?)
Hide
Martín Langhoff added a comment -

Hi! Working on MDL-12452 I've implemented a function to handle the sorting separately from get_users_by_caoability(). The function is order_by_roleassignment_authority() and currently only uses role.sortorder.

To make role_sortorder.sortorder override role.sortorder once it's in use, you need to add a left outer join to role_sortorder on maching userid,roleid,contextid and change the order by line to coalesce(rso.sortorder, r.sortorder).

HTH.

Show
Martín Langhoff added a comment - Hi! Working on MDL-12452 I've implemented a function to handle the sorting separately from get_users_by_caoability(). The function is order_by_roleassignment_authority() and currently only uses role.sortorder. To make role_sortorder.sortorder override role.sortorder once it's in use, you need to add a left outer join to role_sortorder on maching userid,roleid,contextid and change the order by line to coalesce(rso.sortorder, r.sortorder). HTH.
Hide
Martin Dougiamas added a comment -

You look bored Petr. :-P

Show
Martin Dougiamas added a comment - You look bored Petr. :-P
Hide
Petr Škoda (skodak) added a comment -

sure, give me more!

Show
Petr Škoda (skodak) added a comment - sure, give me more!
Hide
Martín Langhoff added a comment -

The internals for this should be easy to "sort" out Have a look at sort_by_roleassignment_authority(), and see my comment above.

Show
Martín Langhoff added a comment - The internals for this should be easy to "sort" out Have a look at sort_by_roleassignment_authority(), and see my comment above.
Hide
Martin Dougiamas added a comment -

I really wanted to see this in 1.9 but we might have to bump it

Show
Martin Dougiamas added a comment - I really wanted to see this in 1.9 but we might have to bump it
Hide
Dan Poltawski added a comment -

(woken by the bumps) - can anyone explain exactly what this is about?

Show
Dan Poltawski added a comment - (woken by the bumps) - can anyone explain exactly what this is about?
Hide
Pablo Etcheverry added a comment -

Yes, Dan. Two years before, the feature to adjust the order in which users appear in "/course/category.php?id=xx" or in "Participants" disappeared. This ticket was raised to bring it back to 1.9.

Show
Pablo Etcheverry added a comment - Yes, Dan. Two years before, the feature to adjust the order in which users appear in "/course/category.php?id=xx" or in "Participants" disappeared. This ticket was raised to bring it back to 1.9.
Hide
Martin Dougiamas added a comment -

There are two parts for this:

1) Some GUI code to enable role_assignments to be orderable (could be a new page, could be up+down arrows on the main role assignment screen). Changing the order in the GUI should add/remove/edit entries in the role_sortorder table. This is not trivial.

2) All the points where course managers are displayed should use the data in the role_sortorder if there is any. This part is easier.

I can't see this change making it to 1.9.x unless someone else comes up with a really good patch without causing new problems on the role assignment pages ...

Show
Martin Dougiamas added a comment - There are two parts for this: 1) Some GUI code to enable role_assignments to be orderable (could be a new page, could be up+down arrows on the main role assignment screen). Changing the order in the GUI should add/remove/edit entries in the role_sortorder table. This is not trivial. 2) All the points where course managers are displayed should use the data in the role_sortorder if there is any. This part is easier. I can't see this change making it to 1.9.x unless someone else comes up with a really good patch without causing new problems on the role assignment pages ...

Dates

  • Created:
    Updated: