Feature proposal: Modify dates from one page

Feature proposal: Modify dates from one page

by Brian Koontz -
Number of replies: 62
There appears to be no way to change module dates (opening/closing dates, due dates, etc.) from one unified page.  It is grossly inefficient to click through each module to change dates after copying a course, say from one semester to the next.  I am proposing two new Moodle features to resolve this problem.  I'm not one for reinventing perfectly round wheels, so if someone is already working on this, please let me know.  Otherwise, I'm going to work on implementing these features in my Moodle, and will submit the changes as a feature enhancement.

  • I propose an option be presented to the user when copying one course to another to specify an increment by which all dates associated with modules will be modified.  Usually, courses that are copied from semester to semester will have the same relative date intervals within and between modules; the only thing that differs is the starting date.  It is much easier to make minor adjustments to a few dates than to laboriously click one's way through every module. 
  • I propose a new admin page which will group all modules by date. Each module will have a user-editable date associated with it; each group of modules will have a "universal" user-editable date which, when modified, will update each module in a date group.  This will provide an admin with one page where all modifications to dates can be made.
Suggestions and comments appreciated!

--Brian
Average of ratings: -
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It does need cleaning up.

The first module with times (Journal) was originally designed with relative dates (to the weekly format), which means that you can move it anywhere and it adjusts automatically.

Later though, came the topics format, and then people wanted very specific control over times for things like quiz module and others, so it got a bit messy.

It would be great to unify it all consistently with an API, perhaps including relative times as standard. It should also tie into the plans for conditional activities, since this is just another form of timing.

It's late tonight so I'll try and think more about this tomorrow, but perhaps this sparks some thoughts.
In reply to Martin Dougiamas

I pledge $100 for this this feature

by Timothy Takemoto -

Martin,

When I start to become the course administrator for 26 classes to start in 3 months time, it is the lack of a non-unified date and time API that is causing me the most worry. If one of the teachers misses a class then the system of torture will be thrown out of sync. I have suggested

  1. The possibility of being able to move everying down a week by entering a sort of dummy week part way through a course. At the moment weeks can only be added at the end. And anyway, moving activities does not change their start and stop dates. 
  2. A teacher enrollment button, so that it is the teachers pressing of a button that signals the start of a particular week.

But thinking about, my dear colleagues are pleading such computer ignorance that I think that even logging into the system will be beyond many of them. So some way of changing the dates in one place for a course will be a tremendous boon.

The creation of this function would be accompanied by my gratitude and a minisculum of money were my mouth is.

Timothy

In reply to Timothy Takemoto

Re: I pledge $100 for this this feature

by Timothy Takemoto -

Perhaps I should be using groups. That way at least modifications to all the classes (dates, content or whatever) could be on one page. If a teacher were to miss a class, then he would be instructed to go on to the next chapter.  I have yet to use groups.
Timothy

In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Marc Dastous -

Brian;

Would the Admin page in your second bullet include a line item to make the minor date changes?  For example, using the existing Assignment list format and adding a Turn editing on button to change the data and times.

This would also simplify the editing process.

See the attached jpg of a suggested look.

Marc

Attachment edit_assignments.jpg
In reply to Marc Dastous

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Marc--

My plan was to create one page that would list all of the dated modules, probably in the format you suggest. I like the layout of that page, and didn't really want to create a drastically new layout. The only difference would be that instead of grouping assignments in the order they were created, they would be grouped by date, so it would be possible to change all of them (in a group) at once, or individually if necessary.

I will mull this over more while crusing through the rolling hills of Tennessee this week!

--Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Thomas Robb -
I like the idea of listing of all modules with dates appearing on one page so that they can be modified as a group.

There could be a check box next to each item and then a set of clickable commands at the top or bottom that say

Change all checked starting times to: month / day / year hour / minutes
Change all checked ending times to: month / day / year hour / minutes
Increment all checked starting times by: x days x hours x minutes
Increment all checked ending times by: x days x hours x minutes

This function would be useful at the course level as well as at the admin level.
In reply to Thomas Robb

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Here's my first cut at a course-level bulk date modification page. The two files go in the course/ subdir. I haven't modified the Admin menu, so you'll have to invoke it manually:

course/dates.php?id=2

It should be fairly intuitive. There are some things that are missing that I'll be implementing:

--Ability to make modifications using absolute dates
--A "days between dates" calculator (maybe using the Cal block)
--Internationalization
--Integration with course Admin menu

Comments would be appreciated.

--Brian

In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by W Page -
Hi Brian!

I think this is something I asked for a long time ago.

  • Do you mean the ability to upload a text file into the calander with dates already on it instead of putting them in one by one?
  • Something that would allow for an entire year of dates to be uploaded at one time?


WP1
In reply to W Page

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Here's a screenshot that might make it a bit clearer...let's say you have a course for the Fall semester, and you copy it over for the Spring. It's very tedious to go through every module activity and modify the date for each. So what I've done is simply pulled up the module activities in one page, sorted by date (since it's very likely things that are together date-wise will be kept together in the future). You can select everything and increment it a certain number of days, then go through and fine-tune the ones that don't fall on the right days. The cool thing here is that everything is done on one page, instead of having to click through every activity to change dates.

After re-reading your post, I see what you're asking for...personally, I don't mind setting up the date the first time around, that's all part of creating the course. But it doesn't make a lot of sense to have to go through each activity again just because you copied a course. So in a way, this indirectly accomplishes what you're trying to do: You could set activities up with default dates, and then simply set them on one page. There's probably not a great leap of logic required at this point to allow a user to download a text-formatted page of dates, which could be modified manually or by a script, and then uploaded in lieu of checking the boxes. That's actually an interesting idea...
Attachment dates.jpg
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
OK, here's cut # 2 that adds specific date functionality as well as relative date adjustments.  Screenshot follows...
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Here's a screenshot of the dates page...by default, the "specific date" is used unless a value is entered in one of the "adjustment" fields.


Attachment dates.jpg
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Przemyslaw Stencel -

A wonderful feature - thanks Brian!

Can I just suggest one thing? I think it should be immediately obvious to the teacher which option (specific date or adjustment) is used (to avoid confusion). How about using radio buttons (see attached screenshot)? By default, "specific date" radio button could be selected, but if a teacher starts typing something in any of the "Adjustment" fields, the selection would switch to the second radio button. What do you think?

Attachment Image3.gif
In reply to Przemyslaw Stencel

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Done!  I've cleaned things up and have added it to the bug tracker as feature request #2262.  The contents of the dates.tar.gz file are:

-rw-r--r-- brian/admin     928 2004-12-08 00:23:56 pix/i/clock.gif
-rw-r--r-- brian/admin    9768 2004-12-07 23:35:23 course/dates.php
-rw-r--r-- brian/admin    2054 2004-12-07 23:13:42 course/dates.html
-rw-r--r-- brian/admin    6641 2004-12-08 00:42:42 ./dates.patch

The dates.patch file updates lang/en/moodle.php and blocks/admin/block_admin.php.  Enjoy!
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
So what's the word?  Did anyone else find this feature useful besides P.S.?  Looks like there have been requests for this feature on the forums, and since it's pretty much standalone, it looks like a good addition for 1.5.
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Darren Smith -
I haven't tried it yet but can see it being invaluable in sept when I have to alter around 35+ courses! Not to mention all of the other members of staff using Moodle now. If it doesn't alter anything else then it should certainly be included IMHO.

Along the same lines, what I would find extremely useful is mass method of moving resources / activities to different weeks. Imagine all of the resources etc with numbered drop down boxes next to them to represent the weeks / topics. This would be very useful now as the speed a course is delivered can (should?) vary depending upon pupil progress (or lack of it wink). This interface would also allow for weeks to be inserted in a specific place rather than and the bottom then laboriously moving it up and then moving all of the resources around, one at a time.

Just a thought smile
In reply to Darren Smith

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Along the same lines, what I would find extremely useful is mass method of moving resources / activities to different weeks.

I like the idea! I, too, find course setup a very laborious procedure. Some time ago I floated the idea of starting a new forum group called "Usability," but it wasn't met with a lot of enthusiasm. I believe Moodle is full-featured enough that a big push in terms of usability would put it over the top when compared to its commercial competition.

But I digress...I can see how you could create a list of resources and assign them via drop-down menus to weeks/topics, but how did you envision getting around the "new resources at the bottom of the week/topic" design? Right now, you either have to plan ahead, or suffer through the agony of moving links and labels around through multiple screen refreshes.

Maybe when "turn editing on" is invoked, the display could show available areas for input in each week/topic, by number or some other means. Creating a new resource would then be a one-click process -- specify the resource or module, and the position it needs to be created in.


In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Darren Smith -
Hello. Firstly, I love the idea of a useability forum so people like me can feel like we are actually contributing rather than feel like we are telling people who provide things for free what to do !!!

I have often wondered if the turn editting on view should be the same as the standard view for a course. For example, do you need all of the course formatting and blocks in edit mode or would you prefer a more powerful and simplistic interface?

Anyway, back to the idea of a 'mass move' page. How about something like this to start the discussion:

moodle_001.jpg

Oooh - The default in the drop down box for the move after column should obviously be 'No Change'. I will think about the new resources bit when I get a chance but I see this generally as less of an issue than a 'mass move' page as when you add a new resource or activity then you tend to have to provide more information after that IYSWIM.

In reply to Darren Smith

Re: Feature proposal: Modify dates from one page

by Darren Smith -
Just had a thought - pretty obvious really.

i think this was covered above but I get frustrated adding a new resource / activity and then having to select it to move and then click a box to tell it where to go not to mention all of the refreshes - just to place 1 activity sad

How about an addition to the above concept:

moodle_002.jpg

Oooops. I missed the GO Button from the top right. I don't like drop down boxes that take you somewhere straight away - I make to many selection errors blush

Thoughts?
In reply to Darren Smith

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
I hate to pull BlackBoard into the discussion, but they offer several opportunities to order things "after the fact" by using dropdowns numbered 1 to N, much as in your example. The key here is that the page doesn't refresh after each action -- instead, you're given the opportunity to move things around, and then submit them all at one time. I would be content with not having to break my creative momentum when creating course content by having the opportunity to order everything at one time.

As an extension to your idea, why not display the dropdowns on the view edit page? That way, everything would be in context, rather than a separate page which would probably require opening another tab on your browser so you could get the visual layout as you modified positions.

Something like this:


Attachment screen.jpg
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Darren Smith -

Thanks for your reply. I don't think I explained myself clearly enough blush

The key here is that the page doesn't refresh after each action -- instead, you're given the opportunity to move things around, and then submit them all at one time.

Yes - this is the main issue. With my mock-up you could insert a week, move resources and activities and add new content into a specific postition with one click.

As an extension to your idea, why not display the dropdowns on the view edit page?

This would be OK and a step forward from where we are although I do like the idea of a 'power' view. I would imagine users would want to do this kind of editting ocasionally (when they have restored a course for a new class).

That way, everything would be in context, rather than a separate page which would probably require opening another tab on your browser so you could get the visual layout as you modified positions.

I can see your point but my example was in context thoughtful I just didn't colour it in moodle yellow smile. I guess I was trying to display more of a shorthand view as this type of hacking about with the course structure would usually be performed by someone who is familiar with the course content and therefore would not necessarily be interested in a full desciption for each label in each week IYSWIM. Ie in your example, assuming they are seperate labels, you would see:

Getting Started
The easiest way to ....
Tip o' the day

rather than the full text.

Also, with my suggested numbering system you can work out where your resources are going without lots of scrolling. For example, If I want to, among other things, move a resource to the end of week 7 then I could just select the last 7 value available, eg 7c, whereas in your example you would have to scroll down to week 7, make a mental note of the final value of the resource / activity in that week, say 26 and then scroll up to the resource you are moving and then tell it go after 26 - for every resource you wish to move.

My other concern about performing this task on the normal course edit page in the lack of 'screen estate' but if blocks where moved / hidden to allow the whole width to be used then this would help.

In reply to Darren Smith

Re: Feature proposal: Modify dates from one page

by Timothy Takemoto -
I agree that a block-less power editing mode, making the most of screen real estate is the way to go.
Tim
In reply to Darren Smith

Re: Feature proposal: Modify dates from one page

by Audun Hauge -
I've made a block that lets you do most of the stuff you describe here. The only drawback is that it's rather heavy on javascript.
If you can live with javascript - it will allow you to drag any resource from its current location and drop it where you wish. Items that are clicked upon while dragging a calendar-ikon will have their dates set. You can also drag a whole section and move it to a new destination. The sections between start and end for this move will be shifted accordingly, thus you can move empty weeks to the front of the course to shift everything down.
Deleting resources can be done by dumping them onto a trash-ikon.
Resources/mods from other courses where you are a teacher can be copied in (links to uploaded files don't work yet).
In reply to Audun Hauge

Re: Feature proposal: Modify dates from one page

by Chris Byrnes -
This sounds great,

is there anywhere where we can see a demo?

c
In reply to Audun Hauge

Re: Feature proposal: Modify dates from one page

by Timothy Takemoto -
Audun Hauge
Yes this sounds very cooI. I personally can live with anything that Moodle can live with, but I think that I will enevitably go with the version that is chosen for release.
Tim
In reply to Audun Hauge

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Cool...so there's not a page refresh after every move?  That's really where things get painful!
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Audun Hauge -
Everything you do on the layout page is just pushing colored labels about and dropping them where you wish. When you'r satisfied with your changes, click Save Changes and then everything is written to the tables. To see the effect on the real course page you'll have to do a reload. So in all you talk to the server 4 times;
1- fetch initial layout,
2- save everything to db
3- redisplay new layout
4- reload course-page to see effect

I expect to have a 'working' version ready before xmas ...
I'm rewriting the code & cleaning up a bit before posting.
I've used optional_param in my scripts, this function seems to be missing in version 1.3.x. Works on 1.5, haven't tested on 1.4.
In reply to Brian Koontz

Modified dates don't show up in calendar?

by Michael Penney -
Hi Brian, I've been trying your modify dates code, thanks for a greate feature!

But I have two problems with it.

The main one is that the new dates don't show up in the calendar? I'm using 1.4.2+, is there some way we can get the new dates to show up in calendar when modified?

Second is that we use a module here called 'outside events', which is based on assignment, but just a way to quickly add grades, without comments (which makes it much faster for large courses).

But I can't seem to get you code to recoginize it, I added it's name to the $modulessupported array, and what should be the correct code lifted from assignment with the names changed:

else if(!strcmp($lcmodnameused, "outside") &&
($due = $instance->timedue) ) {
$table->data[] =
new Instance("", $due, $instance->name." (Event date)",
$lcmodnameused, $instance->id, "outsidedate");

But if I use an OE in the course, I get "There are no Outside event modules" error.

I seemed to me that if the module was not in $modulessupported, your code should ignore it, but I still get the error if I take it out of the array (and the elseif).

So is there any way to get this code either to work with the module(and/or other custom graded modules) or to ignore it?

Thanks!
In reply to Michael Penney

Re: Modified dates don't show up in calendar?

by Brian Koontz -
Michael, glad it's working for you (somewhat!).

Re the calendar, it seems to work on 1.4.3+.  I wonder if there's a DB field that needs to be updated that I'm not updating?  I'll try to check as soon as beginning semester stuff dies down...

I get the modules list from the get_all_mods method, but I discovered that what's returned by that method doesn't necessarily work with get_all_instances_in_course, so I force all module names to lower case first.  The array is a little misleading; I'm not using it for anything right now (I had planned to, but you know how that goes).  Put an echo statement inside the loop starting at line 78 and see what $lcmodnameused is being set to for your module.  There might be a disconnect between what get_all_mods is returning and what get_all_instances_in_course is expecting.

  --Brian
In reply to Brian Koontz

Re: Modified dates don't show up in calendar?

by Ken Brock -

Brian,

Excellent work. We have to put up 11 courses, each with 50 assignments. The fix for the calendar modifications is to put:

   if (!assignment_refresh_events()) {
     error( "Could not assign refrest events" );
    }

After line 51 (your latest version) to update all the mdl_event tables correctly in the calendar. You also need to add:

    require_once("../mod/assignment/lib.php");

after line 4 so it can find this nugget.

Also, to save hours of debugging for others, I had to set secureforms in the site variables to no. I got real strange behavior in data_submitted with referer matching issues when it was set to yes.

Thanks,

Ken Brock

In reply to Ken Brock

Re: Modified dates don't show up in calendar?

by Brian Koontz -
Thanks for tracking down the calendar issue.  I'll add that to the tarball and update the entry in the bug tracker. 

Yes, I discovered the secureforms issue as well after quite a bit of time!  If you've got a workaround for this, I'd love to hear about it.

  --Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Sigurdur Jonsson -
How can I add this feature to the admin menu or invoke it manually?

regards,
S.Fjalar
In reply to Sigurdur Jonsson

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Which version?  It looks like there are two course-wide date change proposals being discussed here:  Mine (date page only) and Audun's (JS-based date changes + additional functionality)...

  --Brian
In reply to Sigurdur Jonsson

Re: Feature proposal: Modify dates from one page

by Sigurdur Jonsson -
Hi again,

Ooops, found out myself. big grin

regards,
S.Fjalar
In reply to Marc Dastous

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Marc--

I tried this first, but there is a tremedous overhead of data for each date drop-down control. My browser really bogged down when I tried to display date drop-downs for every activity in my test course (about 30 of them)!

--Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Timothy Takemoto -

Wow. So so a all on one page date changer exists arleady.
But I have about 120 activities = 240 dates per course.
please see also
http://moodle.org/mod/forum/discuss.php?d=16215
Tim

tkmt

In reply to Timothy Takemoto

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
120 activities = 240 dates per course

And you have 240 distinct dates per course?  Or do they fall into logical groupings of some sort (start/end of weeks/topics, etc.)?  The idea when I designed this was that you would modify dates on a per-group basis.  You increment everything by a set number of days, then adjust individual groups if necessary.
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Timothy Takemoto -

Dear Brian Koontz

Your addition is sounding better and better. 

My dates fall into logical groupings. Each week of a 14 week course has or will have at least 8 quizes and about one forum every other week with start and end dates, (14 * 8  * 2) + (7*2) = 238. I then have about 25 courses per term.

I have long wanted to be able to modify dates on a per user group basis. That way I would have only one class homepage and 25 groups, whose start and stop dates could be changed, since some classes start on different days.

I had better try your code soon. I am still not using groups, just backing up restoring and then using SQL to change dates.

Tim
tkmt

In reply to Timothy Takemoto

Re: Super Edit Mode Course page with no side columns

by Timothy Takemoto -

Dear Brian,

I see now that when you say "groups" you mean logical groups of deadlines, not student "groups" as in the Moodle term. Sorry I misunderstood. But this will be very helpful in any event. If it becomes group aware then it would be even dreamier.

I just uploaded it and got
Fatal error: Call to undefined function: mb_convert_case() in /var/www/html/moodle/course/dates.php on line 80

Do I need to use a newer/older version of moodle. I tried it on a moodle 1.4.1

By the way, since I think there is no real need for either of the side columns in the "super editing" mode, it would be really nice to have something like this below, with the start and stop dates of the activities that have them, displayed on the "super edit mode" course page.

Movable Type has something like this. 

Also I am very sorry, I missed the development going on on this thread. Where would you like me to pay my $100?

Tim

Attachment screen2.jpg
In reply to Timothy Takemoto

Re: Super Edit Mode Course page with no side columns

by Darren Smith -
I also got the same error message on my 1.4 stable and 1.5 dev test installs on my local machine

Fatal error: Call to undefined function: mb_convert_case() in c:\program files\easyphp1-7\www\dev\course\dates.php on line 80


In reply to Darren Smith

Re: Super Edit Mode Course page with no side columns

by Brian Koontz -
Apparently, mb_convert_case() isn't implemented in all versions of PHP.  So, replace the following line in course/dates.php:

$lcmodnameused = mb_convert_case($modnameused,MB_CASE_LOWER);

with

$lcmodnameused = moodle_strtolower($modnameused);

Please let me know if this fixes the problem!

  --Brian
In reply to Brian Koontz

Re: Super Edit Mode Course page with no side columns

by Sigurdur Jonsson -
Hi,

This fixed the problem for me. But the problem I'm having now is that this handy feature only works when setting english as the language for the course. I've updated the language file I'm using (Icelandic) according to the dates.patch, but when I switch to Icelandic no modules can be found!

The error I'm getting is "There are no Orðalisti modules", Orðalisti being the icelandic term I'm using for Glossary.

Any thoughts?

regards,
S.Fjalar
In reply to Sigurdur Jonsson

Re: Super Edit Mode Course page with no side columns

by Timothy Takemoto -

Dear Sigdur,

I still have not patched as Brian suggested (I am waiting till the end of term in another 2 weeks). But my system is in Japanese so that may be a bit of a neck too.

Tim

In reply to Sigurdur Jonsson

Re: Super Edit Mode Course page with no side columns

by Timothy Takemoto -
Dear Sigurdur Jonsson
Brian's dates hack only works in English. If you set your usersetting to english temporarily then it works fine.
In reply to Timothy Takemoto

Re: Super Edit Mode Course page with no side columns

by Brian Koontz -
Tim--

Sorry about the misuse of the word "groups."  Now that you mention it, that was a poor choice of terminology.  Maybe "date groupings" might have been a better way to describe it...

My initial design was to put a date drop-down by each activity, but the amount of overhead was tremendous -- it really slowed down page loads, because each activity needed its own select options.  At over 100 select options per activity, you can see where a page of 30 or 40 activities would generate quite a bottleneck.

The mb_convert_case is a PHP function...it simply worked on my system.  I wanted to make sure I used a function that was i8n-compatible.  I'll search around to see if there is a more appropriate function...maybe i8n compatibility isn't even necessary?

  --Brian
In reply to Timothy Takemoto

Re: Super Edit Mode Course page with no side columns

by Sigurdur Jonsson -
Hi Timothy,

I'm getting this error as well after uploading and patching. Did you find a solution?

regards,
S.Fjalar
In reply to Sigurdur Jonsson

Re: Super Edit Mode Course page with no side columns

by Timothy Takemoto -

Dear Fjalar

No, Brian's super edit still does not work where I am. I am sorry that I did not respond to Brian's response above. I am afraid that I do not know what i8n means. I am googling it now. 

A manual Googlism for: i8n

i8n is a pain.
i8n is a fascinating field!
i8n is basicly the most important thing in the scheme
i8n is about letting the underlying OS handle the problem of building displayed characters and rendering them
i8n is important

I guess it is something to do with internationlisation. My Moodle is in Japanese. I wonder if that made a difference.

Sorry, I did not see the fix further up. I will try the patch and report back. Thank You!

And I have not uploaded Audjun's super edit block.

Timothy

In reply to Brian Koontz

Warnings with no items

by Michael Penney -
Hi Brian I'm getting this in courses with no graded items:

Warning: Invalid argument supplied for foreach() in /home/lms/public_html/course/dates.php on line 183

Warning: array_multisort(): Argument #6 is expected to be an array or a sort flag in /home/lms/public_html/course/dates.php on line 189

Moodle 1.4.2.
In reply to Michael Penney

Re: Warnings with no items

by Brian Koontz -
Michael, your line numbers don't seem to be in sync with mine.  Diff yours  with the one attached and see if there's a difference.  

  --Brian
In reply to Brian Koontz

Re: Warnings with no items

by Rodney Holloman -

Can someone check and see if the bugs page archive is alright. Everytime I try and download it, my zip program say it is corrupt.

Love the work Brian, it is fantastic!

Thanks for the help guys.

Rodney H

In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
I've updated this feature for 1.5beta. Thanks to Ken Brock for the suggestion that now allows this mod to update the calendar correctly.

To install under Unix:

Copy dates.tgz to your moodle/ directory
tar -xvzf dates.tgz
patch -b -p0 < dates.patch

--Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Timothy Takemoto -

Dear Brian

Thanks very much indeed for this. I have only just got it working. It is very useful. I am still using 1.4.4+ so I am not using the latest version but it seems to do what i need.

I find that I need to set the language to English else it does not work and tells me there are no modues since one or other of the arrays is in Japanese.

If I change line 78
    foreach($modnamesused as $modnameused) {
to be
    foreach($modnamesused as $modulessupported) {

(in a sense, I presume you intended this) then again it tells me there are no modules, even if I use Japanese in the modulessupported list. I think that there is some problem with the encoding. Oh, and of course if the names where in Japanese they would not like being put into lowercase.

But in English it works well.

Minor points

In the version I am using it does not seem to update the display after a "submit" so it looks like nothing has changed until I back out of the dates and return. No that does not seem to be the case now. Er...?

Even though there are only 30 days in June, I can select upto 31st, which comes out as 1st July. Does Moodle allow that too?

(I donated $100 a while back as promised above)

Timothy

In reply to Timothy Takemoto

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Thanks very much indeed for this. I have only just got it working. It is very useful. I am still using 1.4.4+ so I am not using the latest version but it seems to do what i need.

The 1.5 version takes care of syncing the calendar up with the changes. I'm not running 1.4.4+, but if you take a look at the 1.5 changes, and grep for "Brock," you'll see what's necessary to get the calendar to sync up.

Even though there are only 30 days in June, I can select upto 31st, which comes out as 1st July. Does Moodle allow that too?

I hope it doesn't smile I need to fix that...

(I donated $100 a while back as promised above)

I'm sure whoever received it will put it to good use!

BTW, I'm not too sure how the language features are supposed to work. It was my understanding that if I used the Moodle version of get_string, that the language lookup is automatic as long as there are strings translated in the appropriate library. But from reading back a few posts, this doesn't appear to be the case. So if anyone has any suggestions on what I'm doing wrong, please let me know and I'll post a new version here.

--Brian


In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Timothy Takemoto -

I don't use the calendar much anyway so I will look forward to that when I upgrade to 1.5.

i am the only person using "dates" so the 31 days issue is pretty trivial.

Rahther than that, I think it would be a better idea to create this as an independent block so that people could just put it in the blocks folder rather than have to hack their system. I guess that a lot of people are scared to make changes to moodle files. A block would mean that many more people are using your work.

The donation went to the moodle trust.

Part of the language problem is perhaps that one cannot use change to lower case on japanese. Japanese does not have upper and lower case.  But I think that there may be other issues.  I am an anglophone (if increasingly stilted) so using english is not much of a problem for me.

Tim

In reply to Timothy Takemoto

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Setting this up as a block sounds like a good idea...I'll do some research and figure out how to do it.

Many of my usability fixes are done in the raw code, and really aren't extensive enough (IMO) to warrant their own blocks. 

  --Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Ken Brock -

Brian,

I am moving to 1.5 for my fall classes. Many great new features including the gradebook. Thanks for updating dates. Two things:

You can greatly improve the speed of the calendar fix by refining line 62 to:

$status = $function_name($id);

The function assignment_refresh_events updates the calendar for all of the assignments in all of the courses on your site if no course id argument is given.

The 1.5 assignment module now has a timeavailable feature that hides the assignment until a specific date--great for the midterm and final (my usual assignments are open book).

These can also be updated by adding after line 107/108:

if ($available = $instance->timeavailable) {
        $table->data[] =  new Instance("", $available, $instance->name." (".get_string("available","course_dates").")", $lcmodnameused, $instance->id, "timeavailable");

        }

Thanks again. You have saved us much work.

Sincerely,

Ken

PS: I have only tested this on assignment module.

In reply to Ken Brock

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Ken, thanks for the performance tip!  Much snappier now...

  --Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Martin Mueller -

Brian,

If you modify Line 94 (or so) from

foreach($modnamesused as $modnameused) {
to
foreach(array_keys($modnamesused) as $modnameused) {

it will work with Moodle instances in other languages than English, too.

But I'v got an other problem: If there are lessons, it reports me that it "Could not refresh lesson events". The function lesson_refresh_events() is missing, according to the function catalogue found on http://moodle.org/xref/_functions/

And I'm thinking that workshops will not update correctly since there are other dates than "deadline".

It seems that there has been a little bit of work left wink

Greetings - Martin

In reply to Martin Mueller

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Martin--

Thanks for the array_keys tip...it's been implemented.

All of the <module>_refresh_events functions are automagically generated, so there's no obvious reason why lessons would be excluded.  I'll see what's up.

  --Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Martin--

There doesn't appear to be a lesson_refresh_events function in lesson/lib.php.  I don't know if this was by design, or whether it's simply not required.  I would imagine this would be a question for the lesson developers.

I'll disable this for now for lessons...

  --Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by John Papaioannou -
Just saw this by chance--

Most <module>_ functions aren't "required" to exist, and when writing code that will be distributed far and wide it's best to be safe rather than sorry. Wrap everything with if(function_exists()) to avoid surprises.
In reply to John Papaioannou

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Jon--

Actually, I did have it wrapped in function_exists(), but I didn't know what to do if it didn't, so I was generating an error.   Obviously not the right choice...so I 've just removed the error, and simply move on if the function doesn't exist.

BTW, great work on the blocks HOWTO!  The appendices were well-written (sorry, didn't work through the first part, but it looked solid too) and told me exactly what I needed to know. 

  --Brian
In reply to Brian Koontz

Re: Feature proposal: Modify dates from one page

by Brian Koontz -
Since I've converted this to a block, it's probably more appropriate to discuss this in the Blocks forum.  I've started a new thread there, with a file attachment containing my first cut at using blocks.

  --Brian