Issue Details (XML | Word | Printable)

Key: CONTRIB-924
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Won't Fix
Priority: Minor Minor
Assignee: Mike Worth
Reporter: Mike Worth
Votes: 0
Watchers: 2
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

A script that does 3 main things: Creates tutor/tutee links, Creates metacourse links and imports attendance data

Created: 19/Aug/08 04:34 PM   Updated: 11/Jun/09 09:37 PM
Return to search
Component/s: Add a project here
Affects Version/s: 1.9.1
Fix Version/s: None

File Attachments: 1. File cron.php (8 kB)
2. File cron.php (12 kB)

Environment: Currently only works with MySQL
Issue Links:
Relates

Database: MySQL
Participants: Anthony Borrow, Mike Worth and Tim Hunt
Security Level: None
Resolved date: 11/Jun/09
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
This is a script designed to be run in addition to the built in cron.php (athough there is no reason it cannot be appended to the existing one), once a day should be plenty.

It takes 3 csv files (currently need to be called /home/moodledata/mikecsv/attendance.txt meta.txt and tutor.txt) which are in the following format without header rows:

=metacourse links=

coursecode of course,classcode of class

=Tutor/student links=

idnumber of tutor,idnumber of student

=Attendance=

coursecode of course,idnumber of student,YYYY MM DD HH MM,mark


It then:

Makes the tutor the mentor of each student as listed in tutor.txt
Links the courses (moodle metacourses) with the classes (moodle courses) and deletes courses for which there is only a single class
Imports the attendance data, creating attendanceactivities and sessions where required.


It requires a tutor role and an attendance user (with permission to take attendance) to be created before running the script

There are a few issues with it that need addressing though- the DB credentials are currently stored in this file rather than being pulled in from config.php, configuration for user details and translating the attendance codes are hardcoded and difficult to find if not familiar with the code, and it directly uses MySQL rather than going through moodle are the 3 main ones I know of

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Mike Worth added a comment - 19/Aug/08 04:38 PM
Oops- I've just realised this was supposed to go in the CONTRIB section but I've mistakenly put it here. Sorry

Mike Worth added a comment - 19/Aug/08 09:18 PM
Fixed the credentials issue- I now have a copy that imports them from config.php (as long as it can be found at /usr/share/moodle/config.php) I'll wait until this has been put in contrib before I start plastering code everywhere though

Mike


Tim Hunt added a comment - 03/Dec/08 04:20 PM
Moving to contrib, as per comment.

Mike Worth added a comment - 07/Jan/09 12:04 AM
I've started work on separating these 3 scripts and integrating them into moodle.

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 - 11/Feb/09 12:29 AM
CONTRIB-1025 is a re-write of the tutor link functionality of this script. It has to have the csv manually uploaded, but adding a cronjob to that to check for files and process them is both fairly easy and a lot cleaner than this script.

Anthony Borrow added a comment - 12/Mar/09 04:28 PM
Mike - I think I like the block approach better. What would you like me to do with this cron.php file? Peace - Anthony

Mike Worth added a comment - 12/Mar/09 05:49 PM
Re-doing the other functions of this script into nicer blocks is on my todo list; at a guess if it's left open then once I re-do it it can be marked as resolved by that. I don't have much experience with trackers so feel free to do something else if I've misunderstood how this whole thing works.

Anthony Borrow added a comment - 12/Mar/09 11:56 PM
There are several options, you can create a couple sub-tasks and work on those until this is resolvable, or you can just consider that work part of resolving it. In either case, I'm just going to assign this issue to you to work on and then when you have code that is ready you can let me know and we will handle it from there. I'm trying to work through the issues that have been assigned to me. Peace - Anthony

Anthony Borrow added a comment - 13/Mar/09 12:00 AM
as for not having much experience with tracker issues feel free to play around with this one. Let me know if you have any questions. Peace - Anthony

Anthony Borrow added a comment - 13/Mar/09 12:00 AM
re-assigning to you

Mike Worth added a comment - 02/Jun/09 10:36 PM
Metacourse linking feature (although not removal of redundant metacourses) has been re-written into a separate block

Mike Worth added a comment - 11/Jun/09 09:36 PM - edited
I've written the mrbs, tutor link and metalink functionality into other blocks. The attendance needs redoing to work with the new attendance module anyway. I won't have time to do that before my contract finishes; Mark Johnson, my replacement, will probably do that this summer.