Tutor Link Block
Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Tutor Link Block.
This block allows user relationships (that is one user assigned a role in another user's context) to be created/kept up to date via CSV files. It was written for personal tutors, but would work equally well for parents.
It can be operated in two modes:
Manual Upload - any user with the block/tutorlink:use capability (by default, only admins) can upload a file to process on demand.
Automatic - a file location is configured, then the block automatically checks this location. If a file is found, it is processed and results emailed to the administrator.
The block has several configuration options, found in Site Administration/Plugins/Blocks/Upload Tutor Relationships.
- Tutor Role is the role that will be assigned by the block. As of 2.0, a role must be allowed to be assigned at the User context level before it can be selected here. This is configured on the role's Define Role page.
- Location of File for Automatic Processing is the location of the file on the server's local file system to be processed by the block's cron job, allowing periodic updates of role assignments. Leaving this blank will disable the cron job.
- Keep processed files allows files processed by cron jobs to be kept for future reference.
- Processed file location is the folder that processed files will be placed in, if Keep processed files is ticked.
- Days to keep processed files for is self-explanatory. After this many days, processed files will be deleted.
Correct File Format
The files to be processed should be in CSV format (hopefully no surprises there).
They may consist of any number of rows, each with three fields: tutor idnumber,tutee idnumber, action; it is important to note that the idnumbers are expected to be populated from an external database, they are not the id field in the user table. Action can be add or del, with add creating relationships and del deleting relationships. None of the fields should be delimited.
As of Moodle 2.0, the order of the fields changed slightly to make them more consistent with the Flatfile Enrolements plugin. The format for each row is now: action, tutor idnumber, tutee idnumber. For example, a file with this contents:
add, 1234, 4321 add, 1234, 4322 del, 2232, 3223
Will assign the user with the idnumber 1234 to users with idnumbers 4321 and 4321, then remove the user with idnumber 2232 from the user 3223.
Trying to add relationships that already exist in Moodle or remove those that dont will not cause problems, as this block will skip over those records.
After the CSV file is created, navigate to the page containing the block, and upload the file. It will be processed and a report will appear showing you the operations that were successful, along with any errors.
A file placed at the path specified in Location of file for automatic processing will be processed automatically when the block's cron job runs. A report will then be emailed to the Moodle Administrator.