Note: You are currently viewing documentation for Moodle 2.4. Up-to-date documentation for the latest stable version of Moodle may be available here: CSV user relationships block.

CSV user relationships block: Difference between revisions

From MoodleDocs
Line 13: Line 13:


==Manual upload==
==Manual upload==
The file is created, then a user with the block/tutorlink:use capability (by default, only admins) adds the block to a course (or the front page, other users will not be able to see the block) then just uploads the csv text file. (This file requires no heading, just Tutor,Tutee,Add or Tutor,Tutee,Del); a popup will appear with the results.
The file is created, then a user with the block/tutorlink:use capability (by default, only admins) adds the block to a course (or the front page, other users will not be able to see the block) then just uploads the csv text file; a popup will appear with the results.


==Automatic processing==
==Automatic processing==
The cronfile setting must be set to an absolute location on the server's filesystem, once this is done any file put into that location will be processed. It is recommended that a file is automatically produced my an MIS then automatically transferred to the moodle server via scp or similar- this results in relationships being kept up to date with no human intervention. Once a file has been processed, it is renamed to the current date to [originalfilename].yyyymmdd and the results are emailed to the primary administrator (the user with the r lowest id in the role_assignment table for their administrator assignment).
The cronfile setting must be set to an absolute location on the server's filesystem, once this is done any file put into that location will be processed. It is recommended that a file is automatically produced my an MIS then automatically transferred to the moodle server via scp or similar- this results in relationships being kept up to date with no human intervention. Once a file has been processed, it is renamed to the current date to [originalfilename].yyyymmdd and the results are emailed to the primary administrator (the user with the r lowest id in the role_assignment table for their administrator assignment).

Revision as of 15:42, 28 July 2009

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

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.

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.

Including relationships that already exist in moodle in the file will not cause problems, as this block will skip over those records.

Manual upload

The file is created, then a user with the block/tutorlink:use capability (by default, only admins) adds the block to a course (or the front page, other users will not be able to see the block) then just uploads the csv text file; a popup will appear with the results.

Automatic processing

The cronfile setting must be set to an absolute location on the server's filesystem, once this is done any file put into that location will be processed. It is recommended that a file is automatically produced my an MIS then automatically transferred to the moodle server via scp or similar- this results in relationships being kept up to date with no human intervention. Once a file has been processed, it is renamed to the current date to [originalfilename].yyyymmdd and the results are emailed to the primary administrator (the user with the r lowest id in the role_assignment table for their administrator assignment).