Note: You are currently viewing documentation for Moodle 2.9. Up-to-date documentation for the latest stable version of Moodle may be available here: Flat file.

Flat file: Difference between revisions

From MoodleDocs
m (user ID number is used and not userid)
 
(8 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Location: Flat file edit settings link in ''Site administration > Plugins > Enrolments > Manage enrol plugins'' in 2.0 onwards or ''Administration > Courses > Enrolments'' pre-2.0
{{Enrolment}}
Location: Flat file edit settings link in ''Site administration > Plugins > Enrolments > Manage enrol plugins''




Line 6: Line 7:
==Options==
==Options==
The site administrator should edit the settings for a flat file if it is enabled.  
The site administrator should edit the settings for a flat file if it is enabled.  
[[Image:Enrolment Flat file options.png|thumb|center|Options for flat file enrolment]]


Version 2.0
[[Image:enrolsettingsflatfile.jpg|thumb|center|500px|Settings Flat file]]


[[Image:EnrolSettngsFlatFile 2.0.png]]
'''File location'''


You should specify an absolute path for the upload file (eg /var/moodledata/enrolments.txt) where it can be read and modified by the webserver process. The file is automatically deleted after processing.
:You should specify an absolute path for the upload file (eg /var/moodledata/enrolments.txt) where it can be read and modified by the webserver process.
 
'''File encoding'''
 
Make sure, you save the file (for example in a text editor) with the same encoding.
 
'''Notification'''


You can choose to have an email sent to notify the Administrator, Teachers and/or students when the file has been processed.
You can choose to have an email sent to notify the Administrator, Teachers and/or students when the file has been processed.
'''Unenrolment action'''
*"Unenrol user from course" When the user disappears from the external source, the enrolment is completely removed and all the roles removed. This means some user data and settings are purged from course during course unenrolment (that usually include grades, activity attempts, etc.)
*"Keep user enrolled" When the user disappears from the external source, the enrolment is kept as is, and the user is still able to enter the course and perform activities, access resources, etc. It's a "do nothing" option.
*"Disable course enrolment and remove roles" When the user disappears from the external source, the enrolment is suspended and roles assigned by enrol instance are removed. Please note that user may "disappear" from gradebook and other areas.


==Flat file structure==
==Flat file structure==
The file should be structured with the action, role, user id, and course ID number.  Optionally a start time and end time can be added as additional fields.
The file should be structured with the action, role, user ID number, and course ID number.  Optionally a start time and end time can be added as additional fields.


The edit field link will give details on how to format the flat file on the Administration > Courses > Enrolments'' page.
Example file:
 
add, student, 5, CF101
add, teacher, 6, CF101
add, teacheredit, 7, CF101
del, student, 8, CF101
del, student, 17, CF101
add, student, 21, CF101, 1091115000, 1091215000


[[Image:Enrolment Flat file data.png|thumb|center|Flat file instructions for fields and records]]
==See also==
==See also==
*[[Upload users]]
*[[Upload users]]
*[[Bulk user actions]] how to download site user information (including userIDs)
*[[Bulk user actions]] how to download site user information (including userIDs)
Using Moodle forum discussions:
Using Moodle forum discussions:
*[http://moodle.org/mod/forum/discuss.php?d=13289 How does flat file work?]
*[http://moodle.org/mod/forum/discuss.php?d=45514 un-enroll a user from a course]
*[http://moodle.org/mod/forum/discuss.php?d=144997 Flat file enrolments - how is this typically used by organisations?]
*[http://moodle.org/mod/forum/discuss.php?d=144997 Flat file enrolments - how is this typically used by organisations?]
[[Category:Enrolment]]


[[fr:Inscription par fichier plat]]
[[fr:Inscription par fichier plat]]
[[de:Einschreibung über CSV-Datei]]
[[es:Archivo plano]]

Latest revision as of 03:18, 16 September 2015

Location: Flat file edit settings link in Site administration > Plugins > Enrolments > Manage enrol plugins


A flat file allows bulk enrolment management (enrol or unenrol) of existing users in existing course. The file is read one time by Moodle then erased. The file is located in the moodle file structure as a text file and Cron provides the timing when it is read.

Options

The site administrator should edit the settings for a flat file if it is enabled.

Settings Flat file

File location

You should specify an absolute path for the upload file (eg /var/moodledata/enrolments.txt) where it can be read and modified by the webserver process. The file is automatically deleted after processing.

File encoding

Make sure, you save the file (for example in a text editor) with the same encoding.

Notification

You can choose to have an email sent to notify the Administrator, Teachers and/or students when the file has been processed.

Unenrolment action

  • "Unenrol user from course" When the user disappears from the external source, the enrolment is completely removed and all the roles removed. This means some user data and settings are purged from course during course unenrolment (that usually include grades, activity attempts, etc.)
  • "Keep user enrolled" When the user disappears from the external source, the enrolment is kept as is, and the user is still able to enter the course and perform activities, access resources, etc. It's a "do nothing" option.
  • "Disable course enrolment and remove roles" When the user disappears from the external source, the enrolment is suspended and roles assigned by enrol instance are removed. Please note that user may "disappear" from gradebook and other areas.

Flat file structure

The file should be structured with the action, role, user ID number, and course ID number. Optionally a start time and end time can be added as additional fields.

Example file:

add, student, 5, CF101
add, teacher, 6, CF101
add, teacheredit, 7, CF101
del, student, 8, CF101
del, student, 17, CF101
add, student, 21, CF101, 1091115000, 1091215000

See also

Using Moodle forum discussions: