Caricare corsi

Da MoodleDocs.
Attenzione: Pagina in costruzione


Nota: Questa pagina riguarda la creazione di corsi con file .CSV. Se si desidera caricare il backup di un corso nel formato .mbz o .tgz, consultare Ripristinare corsi.


Caricare corsi

Oltre a creare nuovi corsi, la funzionalità Caricamento corsi, in Amministrazione del sito > Corsi, può essere utilizzata anche per aggiornare o eliminare i corsi o importare contenuti da un altro corso. Per maggiori informazioni su come utilizzare questa funzionalità per creare modelli dei corsi, consultare Modelli di corso.

Per caricare uno o più corsi:

  1. Andare su Amministrazione del sito > Corsi > Caricamento corsi.
  2. Trascinare e rilasciare il file .CSV o cliccare sul pulsante Scegli un file... e selezionare il file nel File picker.
  3. Selezionare attentamente le Opzioni di importazione appropriate, poi cliccare sul pulsante Anteprima.
File:26uploadcourses.png
Schermata di amministrazione Caricamento corsi
File:uploadcoursesresults.png
Corsi caricati con successo


Nota: È possibile utilizzare anche la riga di comando admin/tool/uploadcourse/cli/uploadcourse.php.

Se si sta utilizzando l’interfaccia web, l’opzione Anteprima mostra eventuali errori rilevati nelle righe visualizzate in anteprima. Se si procede con il caricamento e si rileva qualcosa di sbagliato in un corso, verrà ignorato.

Breve esempio di file .CSV

corsidacaricare.csv :

Nota: Il titolo abbreviato, il titolo del corso e la categoria sono obbligatori

Il campo category prende l'ID della categoria, con la categoria predefinita Miscellaneous che ha ID 1. Le categorie devono già esistere. Se si inserisce un ID di categoria che non esiste, durante l'anteprima del caricamento si visualizzerà l’errore "Non è stato possibile individuare la categoria tramite l'ID" e i corsi in quella categoria non verranno creati.

shortname,fullname,category,summary,enrolment_1,enrolment_1_role,enrolment_1_enrolperiod,role_student courserestored,Course restored,1,a summary,manual,student,1 month, courserestored2,Course restored 2,1,a summary,,,, courserestored3,Course restored 3,1,a summary,,,,padawan courserestored4,Course restored 4,1,"a summary, with comma",manual,student,1 month,padawan Si noti che non ci sono spazi tra gli elementi.

Creare il file .CSV

È un semplice file di testo con estensione .CSV. It accepts the following columns which are divided in two categories, the course information, and the course actions.

Il file di testo da utilizzare per caricare i corsi deve essere un file .CSV, ovvero un file di testo con estensione .csv. Accetta le seguenti colonne suddivise in due categorie, le informazioni sul corso e le azioni del corso.

Campi di informazione sul corso

Molte di queste impostazioni sono disponibili nella pagina delle impostazioni di un corso. Consultare Impostazioni Corso per maggiori informazioni. I nomi dei campi devono essere in minuscolo.

shortname
Il titolo abbreviato
fullname
Il titolo del corso
idnumber
Il codice identificativo (ID)
category
Il codice identificativo della categoria in cui collocare il corso. Ha la precedenza rispetto a category_idnumber e category_path.
category_idnumber
Il codice identificativo della categoria in cui collocare il corso. Ha la precedenza rispetto a category_path.
category_path
Il percorso della categoria in cui collocare il corso. Se si vuole inserire il corso in una categoria chiamata 'Science-Fiction' che è situata sotto la categoria 'Movies', il valore da fornire è: Movies / Science-Fiction. Si noti che il separatore deve essere:[spazio]/[spazio]. Si noti inoltre che la categoria DEVE esistere e non sarà creata. Se si desidera collocare il corso nella categoria di primo livello, 'Movies', il valore da fornire è: Movies
visible
1 se il corso è visibile, 0 se è nascosto
startdate
La data di inizio del corso. Si prega di notare che questo valore viene trasferito alla funzione PHP (EN) strtotime per generare un timestamp. Esempio: 16.12.2018 (16 Dicembre 2018)
enddate
The time at which the course ends. Please note as with startdate that this value is passed to the PHP function strtotime to generate a timestamp. Example 01.12.2014 (1st December 2014)
summary
The summary of the course
format
The course format to use, this must be a valid course format plugin name. E.g. weeks, topics.
theme
The theme to use
lang
The language to use
newsitems
The number of news items
showgrades
1 to show the gradebook to students, 0 to hide it.
showreports
1 to show the activity reports, 0 to hide it.
legacyfiles
1 to enable the legacy course files, 0 not to.
maxbytes
The maximum upload size of the course in bytes. Use 0 for the site limit.
groupmode
0 for No groups, 1 for Separate groups and 2 for Visible groups.
groupmodeforce
1 to force the group mode, otherwise enter 0.
enablecompletion
1 to enable the activity completion, 0 not to.
tags
A comma-separated list of tags to add to the course. Existing tags will be deleted. Enclose multiple tags in quotes.

Enrolment fields

Some fields can be constructed to enable and configure enrolment methods. The fields must be named enrolment_[number] for the enrolment method name, and enrolment_[number]_property for its properties.

enrolment_[number]
The name of the enrolment method (eg, manual, guest, self)
enrolment_[number]_delete
1 to delete this enrolment method from the course, if set to 1 all the other properties will be ignored.
enrolment_[number]_disable
1 to disable this enrolment method from the course, if set to 1 all the other properties will be ignored.
enrolment_[number]_startdate
The enrolment start date. This value is passed to the PHP function strtotime().
enrolment_[number]_enddate
The enrolment end date. This value is passed to the PHP function strtotime().
enrolment_[number]_enrolperiod
Number of seconds, or if not a value understood by strtotime() such as "4 days".
enrolment_[number]_role
The role short name
enrolment_[number]_[property]
Where property is understood by the specified enrolment method
enrolment_[number]_password
The course enrolment key

Note: Upload courses is not yet compatible with all enrolment methods (MDL-43127).

Example

enrolment_1: manual
enrolment_1_role: student
enrolment_1_enrolperiod: 1 month

enrolment_2: self
enrolment_2_startdate: 2013-01-30

Role renaming

To rename some roles, using the following pattern:

role_[shortname]
The new name of the role [shortname].

Example

role_student: Apprentice
role_teacher: Master
role_mycustomrole: Jedi

It is worth noting that the short name for the teacher role is editingteacher and the short name for the non-editing teacher is teacher.

Course action fields

Those settings take precedence over the Course process parameters.

delete
1 to delete the course
rename
The shortname to rename the course to
backupfile
An absolute path to a backup file (.mbz) to import in the course.

(This means the full path to your course, for example /home/yourmoodle/public_html/moodle27/transfert/backup.mbz . If you are unsure of this, look at include_path in Site administration>Server>PHP info.)

templatecourse
The short name of a course to import the content from
reset
1 to reset the course

Mandatory fields

shortname
This field is mandatory for every operation, with the only exception of creating new courses. See details on the course process parameter Shortname template for more information.
fullname
Required when creating a new course.
category, category_idnumber, category_path
One of these is required when creating a course.

Import options

To prevent unexpected behaviour, you have to specify what you want the tool to be able to do.

Upload mode
This allows you to specify if courses can be created and/or updated.
Update mode
If you allow courses to be updated, you also have to tell the tool what to update the courses with.
Allow deletes
Whether the delete field is accepted or not
Allow renames
Whether the rename field is accepted or not
Allow resets
Whether the reset field is accepted or not

Course process

This allows you to specify actions to be taken for every course uploaded.

Shortname template
If you are creating courses without a shortname, you can use this field to automatically generate a shortname. This field accepts two placeholders: %i for the ID number, %f for the summary.
Restore file
A backup file (.mbz) to import in the course after create/update.
Restore from course
The shortname of a course to import content from after create/update.
Reset after upload
Whether to reset the course after creating/updating it.

Default course values

Those are values that can be set in the web interface for all the fields that are not specified in the CSV file. Note that they are always used when creating a course, but only when specified during update (see Update mode).

Increasing speed

When importing the content of a backup file, or another course, you are advised to enable the setting keeptempdirectoriesonbackup. This will considerably speed up the process of the upload if you are importing multiple times from the same source.

Vedere anche