Issue Details (XML | Word | Printable)

Key: CONTRIB-1189
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Mike Worth
Reporter: Mike Worth
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Non-core contributed modules

Timetable import script

Created: 21/Apr/09 04:29 PM   Updated: 19/Jun/09 06:19 PM
Return to search
Component/s: Block: Mrbs
Affects Version/s: 1.9.4
Fix Version/s: None

File Attachments: 1. File cron.php (9 kB)
2. Text File mrbsimportdiff.txt (12 kB)
3. Text File mrbsimportdiff.txt (11 kB)

Environment: Should be universal
Issue Links:
Relates

Participants: Anthony Borrow and Mike Worth
Security Level: None
Resolved date: 01/Jun/09
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
A script that, on cron, checks a configurable location for a csv file detailing room bookings and updates mrbs.

Currently has the period times for my college hardcoded, these need removing but I'm not entirely sure the best way to do this (maybe the conversion would be best done with a complicated query when they are got out of the MIS?)

This cron.php file is to go in blocks/mrbs.

Then by adding :
    " $this->cron=300;"
 to the blocks init() and the function:
     " function cron(){
            global $CFG;
            include($CFG->dirroot.'/blocks/mrbs/cron.php');
        }"
to the mrbs_block class it is run by moodle's cronjob.

I've also added:
    "$settings->add(new admin_setting_configtext('cronfile', get_string('cronfile', 'block_mrbs'),get_string('cronfiledesc', 'block_mrbs'), NULL, PARAM_TEXT));
    $settings->settings->cronfile->plugin='block/mrbs';"
to the bottom of mrbs/settings.php so that the location of the csv file can be specified.


 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Mike Worth added a comment - 21/Apr/09 05:40 PM
This doesn't seem to be updating the lastcron for some reason. Adding:
" $mrbsblock=get_record('block','name','mrbs');
$mrbsblock->lastcron=mktime();
update_record('block',$mrbsblock);"
to the function does the job but obviously isn't ideal

Mike Worth added a comment - 21/Apr/09 05:49 PM
This should be a diff that contains all the bits for this patch.

I've used -Naurw as I seem to have managed to get whitespace differences that cause all sorts of other things to be included, I hope this doesn't make any difference from submitting one with just -Naur


Mike Worth added a comment - 21/Apr/09 06:06 PM
Oops- last one was missing a few lang strings; I've now added these. Anyone able to translate to de or es?

Mike Worth added a comment - 01/Jun/09 07:30 PM
Without this, imported double bookings will not be able to be easily found

Mike Worth added a comment - 01/Jun/09 11:05 PM
I've just uploaded this to CVS along with CONTRIB-1191, it is not the same code as included in the patch- I've done a lot of cleaning up (using get_string, cleaning the input, creating proper types for imported bookings rather than relying on B and C, used proper moodle functions instead of PHP mysql ones, made it work if periods are disabled, plus other odds & sods)

Anthony Borrow added a comment - 02/Jun/09 12:02 AM
Excellent, thanks for your work on this! I have not had a chance to check it out but I trust your judgment. Peace - Anthony