-

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

Flat file: Difference between revisions

From MoodleDocs
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Enrolment}}
{{Enrolment}}
Location: Flat file edit settings link in ''Site administration > Plugins > Enrolments > Manage enrol plugins''
__NOTOC__The flat file enrolment plugin allows bulk enrolment management (enrol or unenrol) of existing users in existing course via a CSV file.


The file is processed by the Flat file enrolment sync [[Scheduled tasks|scheduled task]] and then deleted.


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.
The file should include action, role, user ID number, and course ID number; start time and end time are optional fields. Details of the file format are shown on the flat file settings page ''Site administration > Plugins > Enrolments > Flat file (CSV)''.


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


[[Image:enrolsettingsflatfile.jpg|thumb|center|500px|Settings Flat file]]
An administrator can enable flat file enrolment as follows:


'''File location'''
# Go to ''Site administration > Plugins > Enrolments > Manage enrol plugins'' and click the eye icon opposite Flat file (CSV). When enabled, it will no longer be greyed out.
# Click the settings link, configure as required (see details of settings below), then click the 'Save changes' button.


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 location===


'''File encoding'''
You should specify an absolute path for the upload file (eg /var/moodledata/enrolments.txt) where it can be read and modified by the web server 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.
Make sure, you save the file (for example in a text editor) with the same encoding.


'''Notification'''
===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'''
===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.)
*"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.
*"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.
*"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==
==Any questions?==
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.
 
Example file:


add, student, 5, CF101
Please post in the [http://moodle.org/mod/forum/view.php?id=2981 Enrolment forum] on moodle.org.
add, teacher, 6, CF101
add, teacheredit, 7, CF101
del, student, 8, CF101
del, student, 17, CF101
add, student, 21, CF101, 1091115000, 1091215000


==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 user IDs)
Using Moodle forum discussions:
*[http://moodle.org/mod/forum/discuss.php?d=144997 Flat file enrolments - how is this typically used by organisations?] forum discussion
*[http://moodle.org/mod/forum/discuss.php?d=144997 Flat file enrolments - how is this typically used by organisations?]


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

Latest revision as of 08:59, 24 April 2019

The flat file enrolment plugin allows bulk enrolment management (enrol or unenrol) of existing users in existing course via a CSV file.

The file is processed by the Flat file enrolment sync scheduled task and then deleted.

The file should include action, role, user ID number, and course ID number; start time and end time are optional fields. Details of the file format are shown on the flat file settings page Site administration > Plugins > Enrolments > Flat file (CSV).

Enabling flat file enrolment

An administrator can enable flat file enrolment as follows:

  1. Go to Site administration > Plugins > Enrolments > Manage enrol plugins and click the eye icon opposite Flat file (CSV). When enabled, it will no longer be greyed out.
  2. Click the settings link, configure as required (see details of settings below), then click the 'Save changes' button.

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 web server 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.

Any questions?

Please post in the Enrolment forum on moodle.org.

See also