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 made changes - 21/Apr/09 04:50 PM
Field Original Value New Value
Link This issue blocks CONTRIB-924 [ CONTRIB-924 ]
Mike Worth made changes - 21/Apr/09 04:51 PM
Link This issue blocks CONTRIB-924 [ CONTRIB-924 ]
Mike Worth made changes - 21/Apr/09 04:51 PM
Link This issue has a non-specific relationship to CONTRIB-924 [ CONTRIB-924 ]
Mike Worth made changes - 21/Apr/09 05:34 PM
Description 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.
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.
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 made changes - 21/Apr/09 05:49 PM
Attachment mrbsimportdiff.txt [ 16982 ]
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 made changes - 21/Apr/09 06:06 PM
Attachment mrbsimportdiff.txt [ 16983 ]
Anthony Borrow made changes - 23/Apr/09 01:57 AM
Assignee Anthony Borrow [ aborrow ] Mike Worth [ mike1989 ]
Mike Worth made changes - 01/Jun/09 07:30 PM
Link This issue has a non-specific relationship to CONTRIB-1191 [ CONTRIB-1191 ]
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 committed 9 files to 'Contrib CVS' - 01/Jun/09 11:01 PM
CONTRIB-1189 & CONTRIB-1191 mrbs block

Timetable CSV import feature plus display of simultaneous bookings. This functions in a similar way to flatfile enrolments whereby a file location is defined and any files found there will be automatically processed.
MODIFY plugins/blocks/mrbs/web/edit_entry.php   Rev. 1.12    (+10 -5 lines)
MODIFY plugins/blocks/mrbs/lang/en_utf8/block_mrbs.php   Rev. 1.15    (+15 -2 lines)
MODIFY plugins/blocks/mrbs/web/force_book.php   Rev. 1.2    (+15 -6 lines)
MODIFY plugins/blocks/mrbs/settings.php   Rev. 1.12    (+4 -1 lines)
ADD plugins/blocks/mrbs/import.php   Rev. 1.1    (+0 -0 lines)
MODIFY plugins/blocks/mrbs/web/config.inc.php   Rev. 1.16    (+8 -1 lines)
MODIFY plugins/blocks/mrbs/block_mrbs.php   Rev. 1.8    (+13 -2 lines)
MODIFY plugins/blocks/mrbs/web/day.php   Rev. 1.11    (+36 -10 lines)
MODIFY plugins/blocks/mrbs/web/mrbs.css   Rev. 1.3    (+3 -0 lines)
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)

Mike Worth made changes - 01/Jun/09 11:05 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
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

Mark Johnson made changes - 19/Jun/09 06:19 PM
Link This issue has been marked as being related by CONTRIB-1359 [ CONTRIB-1359 ]