Moodle

user-determined order and number of courses on myMoodle

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.4, 1.9.5
  • Fix Version/s: None
  • Component/s: My Moodle
  • Labels:
    None
  • Environment:
    Vista SP2, Apache 2.2.11, PHP 5.2.8 , MySQL 5.1.30
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE

Description

The current myMoodle centre column lists up to 21 courses a user has access to, and if there are more there is no way to change which ones are listed. Courses are listed in the order in which they are retrieved from the database.

This patch will give users the option to:

  • choose the order in which courses are listed in the centre column of the myMoodle page,
  • set how many courses shall be displayed when loading myMoodle.
  1. hook-for-a-local-my-moodle-195.patch
    07/Aug/09 5:24 AM
    0.8 kB
    Mark Pearson
  2. MDL-19430 (20090904).zip
    06/Sep/09 12:45 PM
    13 kB
    Minh-Tam Nguyen
  3. mymoodle-styles-layout-css.patch
    07/Aug/09 6:02 AM
    1 kB
    Mark Pearson
  1. myMoodle (editing mode).jpg
    133 kB
    08/Jun/09 9:03 PM
  2. myMoodle (normal mode).jpg
    110 kB
    08/Jun/09 9:02 PM

Issue Links

Activity

Hide
Minh-Tam Nguyen added a comment -

parts of this sort-of go in the same direction as shown in the myMoodle-myCourses mockup in MDL-19124

Show
Minh-Tam Nguyen added a comment - parts of this sort-of go in the same direction as shown in the myMoodle-myCourses mockup in MDL-19124
Hide
Minh-Tam Nguyen added a comment -

only a certain number of courses is displayed in normal mode

Show
Minh-Tam Nguyen added a comment - only a certain number of courses is displayed in normal mode
Hide
Minh-Tam Nguyen added a comment -

all courses are displayed in editing mode. THe ser can move courses up and down and choose how many should be displayed when editing is turned off

Show
Minh-Tam Nguyen added a comment - all courses are displayed in editing mode. THe ser can move courses up and down and choose how many should be displayed when editing is turned off
Hide
Minh-Tam Nguyen added a comment -

Attached file contains the local hack code so far. Effects demonstrated in screen shots.
Mind you, it's still not done. The code is quite ugly and will need some cleaning up, and more importantly, some comments.

The code in the zip needs to go to /moodle/local/. in addition to this, my code relies on
http://tracker.moodle.org/browse/MDL-17446 ("LOCAL: my moodle centre column override") which Penny Leach wrote in December.

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.

If you risk installing this code as it is right now, 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.

Show
Minh-Tam Nguyen added a comment - Attached file contains the local hack code so far. Effects demonstrated in screen shots. Mind you, it's still not done. The code is quite ugly and will need some cleaning up, and more importantly, some comments. The code in the zip needs to go to /moodle/local/. in addition to this, my code relies on http://tracker.moodle.org/browse/MDL-17446 ("LOCAL: my moodle centre column override") which Penny Leach wrote in December. 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. If you risk installing this code as it is right now, 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.
Hide
Minh-Tam Nguyen added a comment -

as this is a local hack, it requires MDL-17446

Show
Minh-Tam Nguyen added a comment - as this is a local hack, it requires MDL-17446
Hide
Minh-Tam Nguyen added a comment -

the patch at the moment also needs an addition to styles_layout.css in your favourite (or standard) theme. THis will need to be moved to local as well, I suppose.

Show
Minh-Tam Nguyen added a comment - the patch at the moment also needs an addition to styles_layout.css in your favourite (or standard) theme. THis will need to be moved to local as well, I suppose.
Hide
Minh-Tam Nguyen added a comment -

discussion about this is here: http://moodle.org/mod/forum/discuss.php?d=122236

Show
Minh-Tam Nguyen added a comment - discussion about this is here: http://moodle.org/mod/forum/discuss.php?d=122236
Hide
Minh-Tam Nguyen added a comment -

I have uploaded a new package of files. The code has some better comments now and the style looks nicer.
This still requires manual creation of profile fields and an edit to the standard style sheet, unfortunately.

Show
Minh-Tam Nguyen added a comment - I have uploaded a new package of files. The code has some better comments now and the style looks nicer. This still requires manual creation of profile fields and an edit to the standard style sheet, unfortunately.
Hide
Minh-Tam Nguyen added a comment -

I reformulated the install.txt to be a little bit clearer and changed a few words and links.

Show
Minh-Tam Nguyen added a comment - I reformulated the install.txt to be a little bit clearer and changed a few words and links.
Hide
Mark Pearson added a comment -

Minh-Tam,
I got rather confused attempting to apply this patch to a 1.9.5 installation. The 'Affected Branches:" field above indicates MOODLE_19_STABLE so I was surprised to find reference in the patch file to a root level directory called 'local' which is not in the current 1.9.5 distribution. Moreover, Penny Leach's patch at MDL-17446 implies MOODLE_20_STABLE and I'm assuming that this directory is present in 2.0. However, I am not going to attempt to bring up version 2.0 as a production server at this point in development, so I'm wondering how to proceed. Do you have this 'backported' (I think that's the phrase) to 1.9.5? Do you have a moodle/index.php and moodle/local/lib.php file which is 1.9.5 compatible to use with your patch? Thanks for any help.
Mark

Show
Mark Pearson added a comment - Minh-Tam, I got rather confused attempting to apply this patch to a 1.9.5 installation. The 'Affected Branches:" field above indicates MOODLE_19_STABLE so I was surprised to find reference in the patch file to a root level directory called 'local' which is not in the current 1.9.5 distribution. Moreover, Penny Leach's patch at MDL-17446 implies MOODLE_20_STABLE and I'm assuming that this directory is present in 2.0. However, I am not going to attempt to bring up version 2.0 as a production server at this point in development, so I'm wondering how to proceed. Do you have this 'backported' (I think that's the phrase) to 1.9.5? Do you have a moodle/index.php and moodle/local/lib.php file which is 1.9.5 compatible to use with your patch? Thanks for any help. Mark
Hide
Mark Pearson added a comment -

This is the patch file referenced below from Penny Leach which implements custom handler code for display by MyMoodle. It's fixed for 1.9.5

Show
Mark Pearson added a comment - This is the patch file referenced below from Penny Leach which implements custom handler code for display by MyMoodle. It's fixed for 1.9.5
Hide
Mark Pearson added a comment -

So, yes, I did get rather confused but I think I've sussed it out:
1. If you're on Moodle v1.9.5 (like what I am) use the patch file above like this:
a. get the file into your moodle system and move it into the moodle/my directory
b. apply with $ patch <hook-for-a-local-my-moodle-195.patch
2. Now download and unpack the above ZIP file and follow instructions in the install.txt. This will provide the handler referred to by the patch file above (which is what got me rather confused)
Hope this helps.

Show
Mark Pearson added a comment - So, yes, I did get rather confused but I think I've sussed it out: 1. If you're on Moodle v1.9.5 (like what I am) use the patch file above like this: a. get the file into your moodle system and move it into the moodle/my directory b. apply with $ patch <hook-for-a-local-my-moodle-195.patch 2. Now download and unpack the above ZIP file and follow instructions in the install.txt. This will provide the handler referred to by the patch file above (which is what got me rather confused) Hope this helps.
Hide
Mark Pearson added a comment -

To make life easier I've created a patch for the styles_layout.css. To apply:
Download to your moodle site with ftp or scp
$ cd moodle/theme/standard
$ mv ../../mymoodle-styles-layout-css.patch .
$ patch <mymoodle-styles-layout-css.patch
That should do it! Nice system Minh-Tam! I like it.

Show
Mark Pearson added a comment - To make life easier I've created a patch for the styles_layout.css. To apply: Download to your moodle site with ftp or scp $ cd moodle/theme/standard $ mv ../../mymoodle-styles-layout-css.patch . $ patch <mymoodle-styles-layout-css.patch That should do it! Nice system Minh-Tam! I like it.
Hide
Minh-Tam Nguyen added a comment -

I uploaded a new package of files: MDL-19430 (20090818).zip

I have made a number of changes to improve security, maintainability and performance, as suggested by Ashley Holman.

I have also made changes to the install.txt to hopefully avoid the confusion Mark went through.

This package is straight from of my installation of 1.9.5, and Penny's patch also works fine on 1.9.5, once you create the 'local' folder.

Show
Minh-Tam Nguyen added a comment - I uploaded a new package of files: MDL-19430 (20090818).zip I have made a number of changes to improve security, maintainability and performance, as suggested by Ashley Holman. I have also made changes to the install.txt to hopefully avoid the confusion Mark went through. This package is straight from of my installation of 1.9.5, and Penny's patch also works fine on 1.9.5, once you create the 'local' folder.
Hide
Mark Pearson added a comment -

I downloaded the MDL-19430 (20090818).zip and substituted it into a working 1.9.5 system where the previous version had worked fine. I found two errors:
1) The pulldown menu for number of courses always has "10" at the bottom (not there before)
2) Switch on debug in administration and get the following notices:

Notice: Undefined variable: site in /usr/home/markp/public_html/moo-195/local/lib.php on line 169
Notice: Trying to get property of non-object in /usr/home/markp/public_html/moo-195/local/lib.php on line 169

I thought you should know.

Show
Mark Pearson added a comment - I downloaded the MDL-19430 (20090818).zip and substituted it into a working 1.9.5 system where the previous version had worked fine. I found two errors: 1) The pulldown menu for number of courses always has "10" at the bottom (not there before) 2) Switch on debug in administration and get the following notices: Notice: Undefined variable: site in /usr/home/markp/public_html/moo-195/local/lib.php on line 169 Notice: Trying to get property of non-object in /usr/home/markp/public_html/moo-195/local/lib.php on line 169 I thought you should know.
Hide
Minh-Tam Nguyen added a comment -

Thank you Mark for those two points.
The extra 10 (if the user has access to less than 10 courses) was mainly to allow people to set a higher number than they currently have, in anticipation of soon getting more.
However your comment made me realise that this wasn't the right solution. Instead, I have now changed it to be "Always show all", 1, 2, 3, etc. up to the number of courses. THis shoudl allow users to set it to 'Always all' and know that new courses will show.
I have also changed the code to avoid that error message. I guess I was a little too keen in removing unused variables.
CHeers,
Minh-Tam

Show
Minh-Tam Nguyen added a comment - Thank you Mark for those two points. The extra 10 (if the user has access to less than 10 courses) was mainly to allow people to set a higher number than they currently have, in anticipation of soon getting more. However your comment made me realise that this wasn't the right solution. Instead, I have now changed it to be "Always show all", 1, 2, 3, etc. up to the number of courses. THis shoudl allow users to set it to 'Always all' and know that new courses will show. I have also changed the code to avoid that error message. I guess I was a little too keen in removing unused variables. CHeers, Minh-Tam
Hide
Mark Pearson added a comment -

Yep. That fixed it! This is a brilliant modification to the MyMoodle interface and changes the whole way that we use Moodle. No longer do I have to 'hide' courses from teachers – they can organise the display any way they want. I hope that this feature gets included in any MyMoodle improvements (certainly for 2.0).
Cheers!
Mark

Show
Mark Pearson added a comment - Yep. That fixed it! This is a brilliant modification to the MyMoodle interface and changes the whole way that we use Moodle. No longer do I have to 'hide' courses from teachers – they can organise the display any way they want. I hope that this feature gets included in any MyMoodle improvements (certainly for 2.0). Cheers! Mark
Hide
Minh-Tam Nguyen added a comment -

I have uploaded a new version of the files, with changes addressing most of the points raised in the discussion forum: http://moodle.org/mod/forum/discuss.php?d=122236
When in edit mode, there now is a greater delineation to show which courses will be shown and which ones won't, and the language files have been changed a little. The logic relating to the display of up and down arrows was changed a little, too.
Cheers,
Minh-Tam

Show
Minh-Tam Nguyen added a comment - I have uploaded a new version of the files, with changes addressing most of the points raised in the discussion forum: http://moodle.org/mod/forum/discuss.php?d=122236 When in edit mode, there now is a greater delineation to show which courses will be shown and which ones won't, and the language files have been changed a little. The logic relating to the display of up and down arrows was changed a little, too. Cheers, Minh-Tam
Hide
Minh-Tam Nguyen added a comment -

This is the version we have now running on production.
I also made a very quick video of how it works here: http://www.minhtam.info/a/screens/MDL-19430_%2820090904%29.swf

Show
Minh-Tam Nguyen added a comment - This is the version we have now running on production. I also made a very quick video of how it works here: http://www.minhtam.info/a/screens/MDL-19430_%2820090904%29.swf
Hide
Tim Lock added a comment -

I have found that if a student blocks a contact, the unread messages are still counted in the MyMoodle page when it should only counting non-blocked contact messages with something like this :-

select m.id,useridfrom,useridto,blocked from mdl_message m left join
mdl_message_contacts mc on m.useridfrom=mc.contactid where m.useridto=XXXX
and mc.userid=XXXX and mc.blocked=0;

Current query is only checking for unread messages by :-

if ($countmessages = count_records('message', 'useridto', $USER->id)) {

Show
Tim Lock added a comment - I have found that if a student blocks a contact, the unread messages are still counted in the MyMoodle page when it should only counting non-blocked contact messages with something like this :- select m.id,useridfrom,useridto,blocked from mdl_message m left join mdl_message_contacts mc on m.useridfrom=mc.contactid where m.useridto=XXXX and mc.userid=XXXX and mc.blocked=0; Current query is only checking for unread messages by :- if ($countmessages = count_records('message', 'useridto', $USER->id)) {

People

Vote (15)
Watch (7)

Dates

  • Created:
    Updated: