## General help

### My Moodle: user-determined order of courses on myMoodle

My Moodle: user-determined order of courses on myMoodle

Currently the default order of courses on myMoodle is descending, by ID.
This can be changed by changing on line in print_overview() in course/lib.php.
However, other ways of sorting, such as alphabetically, or by last access date (all discussed in this forum somewhere) are not always that useful either.

Our teachers have asked if it would be possible to rearrange their courses on myMoodle, similar to the way topics can be rearranged in courses. That way they could determine their own order, and have the most frequently used course on top, or the most important one.

After a bit of experimenting I have now come to a mock-up which may do the trick (after some cleanup):
I have created a new user profile field to store a string with the order of course IDs. print_overview.php looks at this string when loading myMoodle and orders the courses accordingly. Any courses that are not mentioned in the string are moved to the top.

When in editing mode, little up and down arrows are displayed next to the course name. When clicked, they cause the string with the course order to be updated/rearranged, and my/index.php is reloaded with the new order. (No AJAX yet)

So far it appears to be working on my localhost, with 10 courses. I am yet to test it on anything larger.

Does anyone have some ideas about how this will scale?

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi Minh,

I think what you have suggested is a really good idea as there is no one default for sorting courses which will please everyone. I require the 'my courses' block to sort based on the order I have determined in the course settings area of Moodle.

I am using Moodle 1.94 and I have found that courses are sorted alphabetically, not descending by ID.

Our teachers have asked if it would be possible to rearrange their courses on myMoodle, similar to the way topics can be rearranged in courses. That way they could determine their own order, and have the most frequently used course on top, or the most important one.

I would totally agree that it would be best to allow teachers (or students) to have control over the sort order. Have you put your idea forward through the Tracker?

This issue is discussed here:

http://server3.moodle.com/browse/MDL-13436

~thomas

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi Thomas,
I hadn't seen that particular tracker issue yet, and was still working up the courage to create my own. Thank you for pointing me to it. I'll watch it.
I have been focussing on the centre column of myMoodle, not on the myCourses block, though, so I think it's a little different.

I have been working on the code behind my screen shots above a little more and am hoping to have something presentable in the next week or so.

Cheers,
Minh-Tam (with the "-Tam", if possible )

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Oh, I meant to add to this that in addition to being able to move courses up and down, the user can also choose how many courses should be shown.

I'm storing these settings in a custom profile field for the time being, but I may need to change that. Do you think it's ok to store the order in a comma separated list, or is it 'a bad idea'?

It's still a bit crude for the time being, but I'll try to clean up the stylesheets and post a screenshot here soon.

Cheers,
Minh-Tam

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hello again,
I made a short video about where I am up to at the moment. As I said, it's still a bit crude...

Comments of any kind are very welcome.

flash video

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi Minh-Tam,

Thanks for your work on this, looks good to me. Anything that makes Moodle more flexible by giving users control over the information that matters to them is a positive thing I feel.

Sorry I can't comment on any tech implementation issues as I am not a developer. XHTML & CSS is my limit ; )

I have been focussing on the centre column of myMoodle, not on the myCourses block, though, so I think it's a little different.

Sorry didn't realise that you were referring to the centre column of myMoodle.

For me the global navigation issue is where I am focussing as I am at the start of implementing our Moodle site. I know Tim Hunt is working on this, so maybe I will direct my comments towards him.

~thomas

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

the reason I am focussing on the centre column of myMoodle is that when we moved over from WebCT over Christmas, we decided to force myMoodle as its behaviour was similar to what WebCT did previously. It would be one less confusing thing for the students.
The columns on the side are for the users to play with, and they can add blocks there to their liking.

Navigation 2.0 is definitely an interesting discussion, is am following MDL-19124 closely as well.

Cheers,
Minh-Tam

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hello again all,
I've been quiet about this for a few weeks, but have now gotten to a point where I can share what I've got with anyone interested. I have also finally created a tracker item: MDL-19430 - "user-determined order and number of courses on myMoodle"
Mind you, it's still done yet! The code is quite ugly and will need some cleaning up, and more importantly, some comments.

The attached zip contains my code, which needs to go to /moodle/local/. in addition to this, my code relies on MDL-17446 ("LOCAL: my moodle centre column override") which Penny Leach wrote in December, almost as if to allow things like what I did here.

Another thing that's not quite ready for prime time yet, is that I haven't created a database xml file in /moodle/local/db/ yet. It will come, though.
As it is at the moment, the attached code requires the manual (by admin) creation of two new additional profile fields:
"myNumCourses"
"myorder"
both are straight text fields (not text input), and it's clearly visible that I need to fix the names to be firstly consistent, and secondly in agreement with the coding guidelines.
It also requires you to add some lines to /moodle/theme/standard/styles_layout.css. This is something I find annoying and will try to remedy as well...

Anyway, if you risk installing this code, users will get two and a half new features on myMoodle:
1: users have the option to change the order of courses on myMoodle by clicking up and down arrows while in editing mode.
2: user can choose how many courses are displayed on myMoodle by changing the number in the drop-down box while in editing mode.
2 1/2: course details such as due assignments are initially collapsed when the myMoodle page is loaded. they can be unfolded by clicking an icon.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hello Minh-Tam,

Thanks for your work on this. I definitely think that this is very useful functionality, particularly for reasons of usability. Showing users lots of information (including courses that are not current for them) creates an unneccessary cognitive overhead. So your change follows the well researched principle of progressive disclosure. Of course there is also an important aesthetic benefit too as the content area within the interface will look less cluttered : )

Allowing users to change the order is good as they can put courses into a sequence that is meaningful for them which is another usability benefit.

One usability question: Does clicking the + symbol show the course details? I guess it does but it might help to have a text label 'show course details' also. A significant number of people won't know what the + is for (or have to think about it). As Steve Krug's classic book on usability says 'Don't Make Me Think'!. If you look at interfaces such as Google who also use progressive disclosure they also use a + symbol but they reinforce with a text label, so that the functionality is immediately apparent:

~thomas

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

This looks fantastic and solves TWO problems we have with our instance. I really hope you get the time to develop this. It feels like something that any large scale Moodle instance should have. Thanks for your hard work and we hope we can try it out for you!

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Thank you Thomas for your encouragement. The 'plus' icon was inspired by the mockup on MDL-19124, but I'll see if we can somehow fit some words in as well, without making it look odd. For the time being there is alt text on the plus sign, but of course hovering over a picture isn't always intuitive either.

Pete, if you're adventurous you can have a look at MDL-19430, I have just uploaded new versions of the files.
The installation still isn't as easy as it could be, you'll have to make two profile fields and add some lines to the standard theme file. Unfortunately I don't know how to solve these two problems at the moment, but you'll only have to do it once.

Cheers,
Minh-Tam

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi

a frist german translation:

$string['more_details'] = '';$string['toggle_details'] = 'Detailansicht umschalten';
$string['hide_details'] = 'Details verstecken';$string['show_details'] = 'Details zeigen';

$string['welcome'] = 'Wilkommen$a
';
$string['you_have_messages'] = 'Sie haben$a ungelesene ';
$string['you_have_no_messages'] = 'Sie haben keine ungelesene ';$string['message'] = 'Nachricht';
$string['messages'] = 'Nachrichten';$string['display_all'] = 'Alle Ihre Kurse werden gezeigt. Sie können diese Seite bearbeiten um das zu ändern.';
$string['display_only1'] = 'Zeige$a';
$string['display_only2'] = ' (von$a) Ihrer Kurse. ';
$string['display_only3'] = 'Diese Seite bearbeiten';$string['display_only4'] = ' um die Einstellung zu ändern.';
$string['display_only_e'] = 'Anzahl der zu zeigenden Kurse: ';$string['dropdown_all'] = 'Alle';
$string['button_save'] = 'Speichern';$string['hide_below'] = 'Die $a Kurse unten werden nicht angezeigt werden sobald die Bearbeitung ausgeschaltet wird.';$string['show_more'] = 'Anzeigen Ihrer weiteren $a Kurse. Bearbeiten Sie diese Seite um die Zahl der Kurse die standardmäßig angezeigt werden zu ändern.';$string['more_courses1'] = '$a weitere Kurse werden nicht angezeigt. ';$string['more_courses2'] = 'Diese Seite bearbeiten';
$string['more_courses3'] = ' um die Einstellung zu ändern.';$string['more_courses_e1'] = 'Bearbeiten ausschalten';
$string['more_courses_e2'] = ' um die$a gedimmten Kurse auszublenden.';

$string['move_up'] = 'hoch';$string['move_down'] = 'runter';
$string['move_top'] = 'ganz nach oben';$string['move_bottom'] = 'ganz nach unten';

// errors:
$string['update_order_fail'] = 'Fehler bei der Aktualisierung der Kursreihenfolge!';$string['needfield'] = 'Kursreihenfolge kann nicht gespeichert werden, da das Datenbankfeld hierfür fehlt.';

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Great. Thanks for doing this. I had started with the German version but realised that I five years of not speaking any German kind of damaged my vocabulary. I'll stick it in the next version.

It's great to see that you'll be combining this with your categorised and coloured myMoodle. Will you also include the option to move courses and/or categories, or will you mainly make categories collapsible?

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi

yes, that's my plan.

I will be on vacation though for 3 weeks. Afterwards I hope to have enough time. I am sure there are better coders than me out there but I should be able to do it ... if you do not mind some spagetthi code maybe .

I was _not_ planning/thinking of making the categories collapsible.

I am thinking of the following options:
1. Show X courses (number)
2. Show category headlines (y/n -> changing this will reset the sort to ASC (as I have it now)
3. Move categories up/down
4. Move courses up/down IF categories are shown: only INSIDE of categories
5. quicksort (=temporary until page reload) of courses by ID, FULLNAME (IF categories are shown)
6. quicksort (=temporary until page reload) of categories by ID, FULLNAME (IF categories are shown)
(99. show X courses in a category)

PS: Error in german string. Correct it should be (double l):
$string['welcome'] = 'Willkommen$a
';

Olaf

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

I too have been on leave for a couple of weeks.
Since returning I have made a few small changes to my code, mainly affecting the placement of links and buttons.
I have uploaded the new code to MDL-19430, and it now includes both the German and English language files.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi Mihn-Tam, I like your My Page and use it on my official server.

The setting of the numbers and the sorting works fine on the my page and both are stored for the user.

I also show the two files in the profile

I have only one problem: the changes I make in my profile are stored in the database, until I go to my page, then they are overruled by some temporary file??

(Only if I change the fields in my profile, close the browser and reopen the browser, the changes are there in my profile.)

How to kill/refresh that temp file during a session?

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

MMM.. even my workaround is now only working for mynumber, because I changed the myorder textfield into an editbox?

I consider now to change the extra profile fields into hardcoded extra fields for the mdl_user table, to have more control in the presentation of the fields then I have now, so I can fight the screen overflow I have now in the automatic show field in the profile presentation.
(Or is there another way of control for that extra profile field, other then "do not show")

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi Ger,
I have set both fields to hidden and not editable, becasue I have been working on the assumption that users would 'turn editing on' on myMoodle to change order and number.
I'll think if there's something else that can be done. I'm getting a list of things that weren't in the plan earlier, and I am worried to get ahead of myself and later have to explain to our users why we'll lose functionality when we upgrade to M20...

How is it behaving itself on your server? What do your users think, and how many people are using it?

EIther way, I only saw this post now, so I didn't address it in the changes I made to the local hack today yesterday:

I uploaded a new package of files to MDL-19430, mainly implementing a number of changes to improve security, maintainability and performance, as suggested by Ashley Holman.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Thanks,
1. A user can now change the numbers of courses on his "my page" and sort the courses on his "my page"
2. the changes are now immediatly stored in the extra profile fields and are still there when you login again
3. The only flaw I see now, is that in the "view all courses" mode, the buttons on the top and the bottom are not reduced to two but still show all four (see bottom-left on screendump)
4. (I removed some of the style, to have the layout more in-line with our own theme, a modified round corners theme)

The reason that I am so eager to have the edit mode also on the profile page is that we are a "RED NUMBER MOODLE":
• We added the red archive number to the title instead of the short name (A.)
• In the category-list we also echo the red course-id (C.)
• we also added the red number to your my page (D.)
• our teachers remember their red numbers more and more..

(and we have lots of parallel-groups with copies of courses.. so with the same course->fullname, but always with a different red archive number: "Hello helpdesk, I have a problem with RED 4763")
• In the profile field you added, you see all your red numbers, you could sort them very quick. (The workaround - sort the course numbers in your profilescreen and logout - is now working fine.)
• change that sortorder textfield in an editbox would complete our fun party

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi Ger,
thanks for doing the testing for me

I like the idea of the red numbers. Maybe that' something we should do here, it may be easier than asking people to send us the URLs in their helpdesk requests/calls.

In your comments about the profile filed sorting and it being an editbox instead of a text field, are you referring to the user profile field for the order ("myorder") that has been created as part of this hack?
My initial thinking for this field was to hide it from the users and not let them edit it at all in the profile, as we won't have to deal with bad data that way.
The only way to edit the order would be to move the courses up and down when editing the myMoode page.
However, I can see your point. There are reasons people may want to type in the order directly, and an edit box would of course give them more room... I'll think about it ;)

To fix those arrows, apply the following patch:

edit: I deleted the inline code, becasue the Algebra filter was messing with the patch code. See attached patch to be applied on top of yesterday afternoon's version.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

MMM,

if I add your last patch, I get always four buttons while I was expecting to get that two buttons on top and bottom also in the "show all" view.

In the old code, "show all" triggers the wrong presentation of buttons, but "show the number that is exactly the same as all" works normal!

(If I only have two courses, the up and down buttons are obsolete, but that is refinement m)

Now I toy a little, I appreciate the dim effect for the courses outside the selection view very much! It is very intuitive. I only have the problem that courses which are already dimmed for students look the same.

>>>>>>>>>>> or is this because I killed some of your box style elements?

If it is NOT my fault, then I would prefer to see here another marker for "courses outside the view" like a warning symbol in the box, like the plus/minus.

(Maybe a warning button with the function "bring me back in the view" ? Add to the bottom in the view-part?)

Three questions:

• what is the function of the Flush box?
• I see that you do not close your code with ?> (I saw another Moodler referring to that, saying that is better: can you expalin that to a NOT programmer, a liitle?)

• I see code where you do a course sort: if I change this in "do never a course sort (the else condition)", would that help me in keeping the changes in the sortorder field?

I have it now up and running in my main server for seven schools, 500 teachers and 4000 students, thanks for the work.

the red number patches are not a big change to Moodle, but it is changing:
• /user/view (add red numbers to the my courses and a break after each course)
• course/category (for the courses in the course overview list)
• my/.. and now also the red number in the course list

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi Ger,
I'm not entirely sure what you see at the moment. COudl you maybe post some screenshots, please?
Is it anything like this? (sorry, it's on localhost, so it's a bit slow)

Good point on the 'dimmed' style. It is indeed the same style, I guess I should change that.

Thanks for letting me know this is going for you. Way to put on the pressure.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

NICE, this demo in Jing. I will compare my code with yours, I see that "show all" works fine for you. The problem with the dimmed view (see screen) is that the teacher cannot discriminate the courses outside the selection AND the courses he hides for his own students.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Can you replicate this: a teacher who inherits a course from another course does not see the course in my page, it is also not visibile in his personal page, so it is something in the my courses? (bug?)

When I visit this migrated course, it pops-up in the list, now ok (I saw this phenomena with other moodle lists for imported courses, like the categories ) .. so not a bug, false alarm?

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Ok, I cheated: I removed this line in /local/lib.php to solve the presentation error when I choose "All", because the highest number is also all:

//echo '<option value="0">'.get_string('dropdown_all', 'local').'</option>';

Mmm, I see now in your movie that the function is "always show all" (also when the number of courses changes..

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

If I add a course, I read the text view 6 (out of 7) so the ALL CHOICE is not necessary?

Average of ratings: -
Re: ok my first Jing

To give you an impression: my first Jing

The layout is overruled by my round corners theme, when I killed most of the boxes (not all)

after some trial & error in your css, I ended up with this button layout.

The problem is course test ger, that is dimmed and interferes with the dim mechanism here.

Average of ratings: -
Re: ok my first Jing

The option with value='0' which you removedis to always display all courses, no matter how many the user has access to. If the user gets access to new courses, it should still display them all.

On the other hand, the highest number on the list (for instance 7 out of 7) will always display 7 courses. It so happens to be all courses at the time, but if the user gets access to a new course, seven will be displayed and one will drop off the bottom of the list.

Regarding the 'dimmed' class:
Yes, you are absolutely right.
How about putting another one of the notification bars below the courses that get displayed?
I have also added a new style class, which should differentiate the dimmed and not-displayed...
What do you think?

oh, and I think I found another problem. I can't seem to write '0' (zero) to the user profile field with the number, so in your version when you select "Always all' it will actually write the default value in to the field. I didn't notice it before and I'm confused as to why this is happening. However, if you set the default value to be '0', it works fine (ie "Always All' actually is 0, because 0=∞)

Average of ratings: -
Re: ok my first Jing

I like the idea of the dimmed class

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

With any luck this will not require any more changes for a little while, so we can put this on production here.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

should be : MDL-19430

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Code works fine!

We have helping teachers on school level who want to be hidden teacher.
That makes them teacher in 700 courses or more
For the situation of the hidden teacher, I have to change the 200 limit into a higher number 999.
• in edit mode your code works slow but ok
• in view mode the code breaks: building of the view screen is not finished.
• ??

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Yes, we have a similar situation here. However, users such as these would never use myMoodle anyway, not even the traditional one, because the page would take forever to load.
I think it may work if the number is set to something small, like 10, and a myCourses block is used. But that's not ideal.

I think what needs to happen for users like these is to have them use the normal front page instead.
This has been requested in other places (myMoodle for certain users only, myMoodle role dependent, etc), and it the moment I don't think I can tackle that.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle
One other solution could be to display different bits of content on the My Moodle page depending on what type of user you are, or what role assignments you may have in courses.

For example, "hidden" teachers could be given a global role, then this could be checked for on the My Moodle page like this...

if (user_has_role_assignment($USER->id, 10, 0)) { //Display Stuff } Alternatively the above could be used to display the full course/category list to "hidden" teachers instead of the traditional "My" list of courses. Also maybe do this to see if the user is a teacher in any courses....$query_teacher = 'SELECT count(*) as count FROM '.$CFG->prefix.'role_assignments WHERE userid='.$USER->id.' AND roleid=3';
$result_teacher = mysql_query($query_teacher);
$isteacher = mysql_fetch_row($result_teacher);

if ($isteacher[0]){ // Display Stuff } Average of ratings: - Re: My Moodle: user-determined order of courses on myMoodle Yes, I do this now: in our case it are the coursecreators so I change in the patch on /my/index.php: //then use handle local...$iscoursecreatorG = record_exists('role_assignments', 'roleid', 2, 'userid',$USER->id); if (!$iscoursecreatorG) {
if (function_exists('local_my_moodle') ) {
local_my_moodle(); // go to this function in /local/lib.php
}
} else {
//no handle... then the old view..

but I wonder why the heavier page loads in edit mode? even 700 courses.. (is there a field in view mode that is overloaded (256 barrier?) which is NOT used in edit-mode?)

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Do you mean if someone gets access to a new course while they are logged in?
Yes, I noticed that if a user gets access to a course while they are logged in they won't see it on myMoodle until they log out and back in, even though they can go to their profile and see it there.
This is like this both in the unmodified myMoodle code and in my version, unfortunately.

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Hi

just for information:
I started work on combining your code with this http://moodle.org/mod/forum/discuss.php?d=121758#p555677

Olaf

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle

Combine this with local-my can be more interesting if:
• the user can create on his my page his own color-groups
(independent of the moodle categories)
• if the user can assign his courses to these self created color groups

Average of ratings: -
Re: My Moodle: user-determined order of courses on myMoodle
A way to get users choose the order and look of their courses would be awesome! I thought i read on a post somewhere a plugin or somewhere to vote on this idea...sorry I can't remember where I saw this..

Average of ratings: -