<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/310/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Taatparya</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/310/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Taatparya"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/Special:Contributions/Taatparya"/>
	<updated>2026-04-18T14:02:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Upload_users&amp;diff=133042</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Upload_users&amp;diff=133042"/>
		<updated>2019-01-21T18:07:36Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: corrected error which prevented upload with custom profile field&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Accounts}}&lt;br /&gt;
==Uploading users via text file==&lt;br /&gt;
&lt;br /&gt;
There are many options for uploading information (fields associated with a user) with this method: from enrolling users in multiple courses with course specific [[Roles|roles]] to updating user information in the [[User profile]] to deleting users from the site.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; It is usually not necessary to upload users in bulk with Upload users. To keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the users create their own accounts ([[Self enrolment]]). See [[Authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/_kNMOr7Tdw0 | desc = How to bulk upload users and add to courses}}&lt;br /&gt;
&lt;br /&gt;
==File formats for upload users file==&lt;br /&gt;
The upload users file has fields separated by a comma (or other delimiter) ONLY - no space.   The first line contains the valid field names.  The rest of the lines (records) contain information about each user.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; Avoid special characters in field information like quotes or other commas. Test a file with only one record before a large upload.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; You can use a spread sheet program to create the file with the required columns and fields. Then save the file as &amp;quot;CSV (comma delimited)&amp;quot;. These files can be opened with simple text editors (eg, [https://notepad-plus-plus.org/ Notepad++]) for verification. &lt;br /&gt;
&lt;br /&gt;
===Valid upload file for testing===&lt;br /&gt;
Here is an example of a simple valid upload file:&lt;br /&gt;
(Column headers on the first line of the file are only highlighted in bold in this example to distinguish it from the rest of the of the data/user details), assuming you have already created the course &#039;math102&#039; and the two cohorts of the proper names.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;username,password,firstname,lastname,email,course1,group1,cohort1&#039;&#039;&#039;&lt;br /&gt;
 jonest,verySecret3$,Tom,Jones,jonest@example.com,math102,Section 1,year 3&lt;br /&gt;
 reznort,someSecret4#,Trent,Reznor,reznort@example.com,math102,Section 3,year 4&lt;br /&gt;
&lt;br /&gt;
== User Fields that can be included==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; We strongly recommend that you test a file that contains fields you proposed to use with one user before attempting a file upload for the first time. &lt;br /&gt;
&lt;br /&gt;
===Required fields=== &lt;br /&gt;
&lt;br /&gt;
These are the required user identification fields:&lt;br /&gt;
&amp;lt;code&amp;gt;username,firstname,lastname,email&amp;lt;/code&amp;gt;&lt;br /&gt;
Validity checks are performed for:&lt;br /&gt;
* &#039;&#039;&#039;username&#039;&#039;&#039; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters , numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
* &#039;&#039;&#039;email&#039;&#039;&#039; is in the form: &#039;&#039;name@example.com&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Passwords===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;password&amp;quot; field is optional if the &#039;New user password&#039; setting on the upload screen is set to &amp;quot;Create password if needed and send via email&amp;quot;  but is required if the setting to &amp;quot;Field required in file&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If included, values should meet the requirements for the site&#039;s [[Site_policies#Password_policy|Password policy]]. &lt;br /&gt;
&lt;br /&gt;
To force password change for a particular user, set the password field to &#039;&#039;&#039;changeme&#039;&#039;&#039;. If omitted, a password will be generated for each user (during the next Cron job) and welcome e-mails sent out. The text for the welcome e-mail is in the language settings in &#039;&#039;Site administration &amp;gt; Language &amp;gt; Language customisation&#039;&#039;  with a String identifier of &#039;newusernewpasswordtext&#039;.&lt;br /&gt;
&lt;br /&gt;
===Optional user fields===&lt;br /&gt;
&lt;br /&gt;
Note: Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
Tip: For Boolean fields with only two values, use &#039;&#039;&#039;0&#039;&#039;&#039; for false and &#039;&#039;&#039;1&#039;&#039;&#039;for true. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To provide values other than the default you can include one or more of these optional user fields:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;institution,department,city,country,lang,auth,timezone,idnumber,icq,phone1,phone2,address,url,description,mailformat,maildisplay,maildigest,htmleditor,autosubscribe,interests&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the these are user profile fields or user preference fields that belong to the user profile and are the filled in the user or at manual creation. Some however require specific formats:&lt;br /&gt;
&lt;br /&gt;
See [[Additional name fields]] for more details. Key things to note are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;country&#039;&#039;&#039; - use the country TWO LETTER CODE, in upper case, eg AU,ES,GB,US. These are all UPPER CASE. Using &amp;quot;au&amp;quot; or &amp;quot;es&amp;quot; or &amp;quot;USA&amp;quot; as a country code will result in a database error. If you are having trouble working out the two-letter code for a country, you can consult the list of [https://www.iso.org/obp/ui/#search country names and code elements] available on the ISO Website. A common error is to use UK for United Kingdom; it should be GB.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;lang&#039;&#039;&#039; - use the two letter (or extended four lettter) code as defined in the Moodle language packs, e.g. en, es, en_us, de, in &#039;&#039;Site administration &amp;gt; Language &amp;gt; Language packs&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth&#039;&#039;&#039; - The auth field must be used if the site uses an alternative authentication method, such as LDAP, as otherwise the authentication method will default to manual and users using a different auth method won&#039;t be able to log in. &lt;br /&gt;
Use the shortname codes defined in Plugins &amp;gt; Authentication for the various types, e.g. manual, nlogin, ldap, cas, mnet, db, none. If you do not include an auth column, then newly created users will be created with the manual account type.&lt;br /&gt;
&lt;br /&gt;
You can set &amp;quot;auth&amp;quot; to &amp;quot;nologin&amp;quot; in your csv file which will mean that then created users cannot login.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;timezone&#039;&#039;&#039; - Should be in the format as found in the Location settings in terms of Zone/Region, eg. Australia/Sydney, Asia/Kathmandu, Europe/Madrid, etc. The entry is case sensitive so Europe/London will work but europe/london will not.&lt;br /&gt;
&lt;br /&gt;
NOTE: Needed: settings for &#039;&#039;&#039;mailformat&#039;&#039;&#039;,&#039;&#039;&#039;maildisplay&#039;&#039;&#039;,&#039;&#039;&#039;htmleditor&#039;&#039;&#039;,&#039;&#039;&#039;autosubscribe&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;maildigest&#039;&#039;&#039; To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
===Custom profile field names===&lt;br /&gt;
&lt;br /&gt;
These are optional and depend on whether you have created any custom profile fields in your site. The name of the header in file is of the form &#039;profile_field_xxxxx&#039; where xxxx is the unique shortname of custom user profile field name as you created it. &lt;br /&gt;
&lt;br /&gt;
The field name should match the case of the profile field shortname. So, for instance if the shortname of your custom profile field is all upper case, for example, &#039;&#039;DOB&#039;&#039;, then use a header of &#039;&#039;profile_field_DOB&#039;&#039; to match the case, not &#039;&#039;profile_field_dob&#039;&#039;, which will produce a &amp;quot;is not a valid field name&amp;quot; error. Likewise, a mixed case shortname such as &#039;&#039;Dob&#039;&#039; should have a header of &#039;&#039;profile_field_Dob&#039;&#039;. (The exception to this is if the shortname is all lower case, then any case will work in the field header, which is a historical quirk: but best practice is to match the case and you will avoid errors.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;profile_field_xxxxx&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For custom profile fields that are dates, use the ISO standard format YYYY-MM-DD, eg. 2014-06-19 which will then be properly localized in the interfaced. For example, a field called dohire for date of hire, the fields could be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,firstname,lastname,email,profile_field_dohire&lt;br /&gt;
blumbergh,Bill,Lumbergh,blumbergh@example.com,1990-02-19&lt;br /&gt;
pgibbons,Peter,BGibbons,pgibbons@example.com,1996-06-05&lt;br /&gt;
tsmykowski,Tom,Smykowski,tsmykowski@example.com,1970-01-01 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For custom profile fields that are a menu, use the corresponding value in the menu list from field as you defined it. For example: a custom field &#039;corporatedivision&#039; with one of three values &#039;Management&#039;, &#039;Development&#039; or &#039;Training&#039;. Just insert one of those three words (e.g. &#039;Training&#039;) as the value for that field. Eg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,firstname,lastname,email,profile_field_corporatedivision&lt;br /&gt;
blumbergh,Bill,Lumbergh,blumbergh@example.com,Management&lt;br /&gt;
pgibbons,Peter,BGibbons,pgibbons@example.com,Development&lt;br /&gt;
tsmykowski,Tom,Smykowski,tsmykowski@example.com,Training &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Special user change fields===&lt;br /&gt;
&lt;br /&gt;
Three special fields are used for managing user accounts, &#039;&#039;&#039;oldusername&#039;&#039;&#039;, &#039;&#039;&#039;deleted&#039;&#039;&#039; and &#039;&#039;&#039;suspended&#039;&#039;&#039;.  [[#Allow_renames|See below for details]].&lt;br /&gt;
&lt;br /&gt;
===Enrolment fields===&lt;br /&gt;
&lt;br /&gt;
You may optionally enrol users in already existing courses using manual enrolment. Only manual enrolment is done this way; if the manual enrolment method is disabled in a course, then no enrol is done.&lt;br /&gt;
&lt;br /&gt;
You use fields in the upload file of this type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;course1,type1,role1,group1,enrolperiod1,enrolstatus1,course2,type2,role2,group2,enrolperiod2,enrolstatus2&amp;lt;/pre&amp;gt; etc.&lt;br /&gt;
&lt;br /&gt;
Header fields &#039;&#039;&#039;must&#039;&#039;&#039; have a numeric suffix such that type1,role1,group1,enrolperiod1 and enrolstatus1 all apply to course1 for course&#039;&#039;&#039;1&#039;&#039;&#039; to course&#039;&#039;&#039;n&#039;&#039;&#039;. Even if you are just doing one course enrolment, you must still use the number 1 on the heading name, i.e. course1,role1, etc. Do not use the bare headings without numbers, e.g. course,role, etc as those will generate an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course#&#039;&#039;&#039; is the shortname of the course, if present the user will be enrolled in that course. Do not use the fullname of the course or it will generate an error. This field is the ONLY required field for a succesful enrolment. All the others are optional. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type#&#039;&#039;&#039; sets the role to be used for the enrolment. A value of 1 is default course role,  2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;role#&#039;&#039;&#039; may be used to specify roles directly, using either role short name or the role id (numeric names of roles are not supported). Usually you will use the role name that is the shortname of the role as defined in Users &amp;gt;  Permissions &amp;gt; Define roles, eg. student, editingteacher. If the role column is left out, the users will be enroled in the course with the default role, which is normally student.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;group#&#039;&#039;&#039; may be used to assign users to groups in course, using name or id (numeric group names are not supported). NOTE: if the group does not already exist, it will be created.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;enrolperiod#&#039;&#039;&#039; may be used to set the enrolment duration, in days, for each course. If not explicitly set here, all the users will get the duration as set in the Manual enrolment method of the course (which defaults to 0 meaning unlimited.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;enrolstatus#&#039;&#039;&#039; is optional as by default all newly enrolled users are set to active. If used a value of 1, it will suspend users in the course and if a user is previously set as inactive / suspended then a value of 0 will unsuspend them and make them active again.&lt;br /&gt;
&lt;br /&gt;
=== Cohort membership assignment===&lt;br /&gt;
&lt;br /&gt;
You can assign users to any already existing Cohort by using only the &amp;quot;username&amp;quot; and the &amp;quot;Cohort ID&amp;quot; with just two fields in the file. Note that this is an exception to the usual case where the firstname, lastname and email address of the user are required.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cohort#&#039;&#039;&#039; is the form to use and like enrolment in courses, you have to add a number to each header, so cohort1,cohort2, etc.&lt;br /&gt;
&lt;br /&gt;
Internal cohort id numbers or non-numeric Cohort IDs of existing cohorts must be used; do not use the full name are not allowed. (Note that cohort id is what is usually known elsewhere as the &amp;quot;shortname&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Here is a sample CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,cohort1,cohort2&lt;br /&gt;
student1,nursing,2016class&lt;br /&gt;
student2,nursing,2014class&lt;br /&gt;
student3,nursing,2014class&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MNet ===&lt;br /&gt;
&lt;br /&gt;
Existing [[MNet]]users can be added to courses, groups or cohorts as below by using the field header &#039;&#039;&#039;mnethostid&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
#enrolling to courses: username+mnethostid+course required&lt;br /&gt;
#adding to group: username+mnethostid+course+group required&lt;br /&gt;
#adding to cohort: username+mnethostid+cohort required&lt;br /&gt;
#suspending/reviving accounts: username+mnethostid+suspended required&lt;br /&gt;
&lt;br /&gt;
All other operations are ignored. You can not add users, delete them or update them (such as change names or email, profile fields, etc.)&lt;br /&gt;
&lt;br /&gt;
=== Set system roles ===&lt;br /&gt;
Users may also be assigned to already defined system roles, using the shortname of the system role as defined in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; for roles with a system context defined.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sysrole1,sysrole2,sysrole3&amp;lt;/code&amp;gt; etc&lt;br /&gt;
&lt;br /&gt;
Users may be uploaded to a system role (usually Manager or Course creator)  by entering the shortname of that role. Other roles can only be uploaded if they have already been assigned in the &#039;system&#039; context. See [[Creating custom roles]]. Multiple roles can be assigned using sysrole2, sysrole3, etc. fields. Note that the number suffix in no way relates to the number suffixes on the enrolment fields. The numbers must go up in sequence starting at 1.&lt;br /&gt;
&lt;br /&gt;
Unassigning system roles&lt;br /&gt;
Users can also be removed from a given system role by entering the shortname of that role prefixed with a minus symbol: &#039;-&#039;. If the user is currently assigned to that role, they are removed from it. If the user is not currently assigned to that system role, the field value is ignored. However, the field value must refer to a system role that does exist on the system, otherwise an error will occur.&lt;br /&gt;
[[File:GlobalRoles1.png|thumb|500px|center|Example of a file for uploading users with global/system roles]]&lt;br /&gt;
&lt;br /&gt;
==Upload user process==&lt;br /&gt;
&lt;br /&gt;
# Create file for uploading&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
# Add file to upload&lt;br /&gt;
# Upload users preview - check settings and default user profile settings&lt;br /&gt;
# Upload users preview - click &amp;quot;Upload users&amp;quot;&lt;br /&gt;
# Upload users results - shows list of users, exceptions made in upload and summary of number of users&lt;br /&gt;
# Upload users results - click &amp;quot;Continue&amp;quot;&lt;br /&gt;
# Returns to Upload users screen&lt;br /&gt;
&lt;br /&gt;
==Updating users preview==&lt;br /&gt;
There are various settings to better control the desired upload behaviour. These settings are found on the &amp;quot;Upload users preview&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: errors updating existing accounts can affect your users badly. &#039;&#039;&#039;&#039;&#039;Be careful&#039;&#039;&#039;&#039;&#039; when using the options to update.&lt;br /&gt;
&lt;br /&gt;
====Upload type====&lt;br /&gt;
The Upload type specifies how to handle existing accounts.&lt;br /&gt;
&lt;br /&gt;
;Add new only, skip existing users : is the default Moodle upload type. It creates a new user account for each new record in the uploaded file. If an existing username is found in the uploaded file matches an existing username, that record is &#039;&#039;&#039;skipped&#039;&#039;&#039;. By skipping the existing user account, the data in the existing record is not touched (in contrast to the &amp;quot;Add new and update existing users&amp;quot; option) and a second new user account is &#039;&#039;&#039;not&#039;&#039;&#039; created (in contrast to the &amp;quot;Add all, append number to usernames if needed&amp;quot; option). &lt;br /&gt;
&lt;br /&gt;
;Add all, append number to usernames if needed : creates a new user account for each record in the uploaded file. If an existing user account is found, a new account will be created with a number appended to the username. For example, if a user account for username &#039;jsmith&#039; already exists and a new record in the uploaded file contains a record forusername &#039;jsmith&#039; an additional user account is created with a 1 &#039;&#039;&#039;appended&#039;&#039;&#039; to the username to produce user &#039;jsmith1&#039;. &lt;br /&gt;
&lt;br /&gt;
;Add  new and update existing users : creates a new user account for each new user in the upload file. If an existing user account with the same username is found, the account information is &#039;&#039;&#039;updated&#039;&#039;&#039; by the data in the uploaded file. &lt;br /&gt;
;Update existing users only : ignores any new users found in the upload file and updates the user account if a matching username record is found in the uploaded file.&lt;br /&gt;
&lt;br /&gt;
====New user password====&lt;br /&gt;
When creating a new user account Moodle can create a new password (if one is not provided) or require a password in the uploaded file.&lt;br /&gt;
&lt;br /&gt;
;Create password if needed : creates a default password for the new user account if one is not provided in the uploaded file.&lt;br /&gt;
&lt;br /&gt;
;Field required in file : requires that a password be provided in the uploaded file in order. If a password is not provided, an error is generated and the user account is not created.&lt;br /&gt;
&lt;br /&gt;
====Existing user details====&lt;br /&gt;
The Existing user details options are only available when the Upload type allows existing user accounts to be updated. It specifies how Moodle should process user detail information for existing users.&lt;br /&gt;
&lt;br /&gt;
;No changes : ignores user detail data in the uploaded and leaves the existing user account data unchanged.&lt;br /&gt;
;Override with file : overwrites data in the existing user account with the data provided in the uploaded file.&lt;br /&gt;
;Override with file and defaults : overwrites data in the existing user account with data provided in the uploaded file and fills in the default values for existing user details when no data is provided in the uploaded file.&lt;br /&gt;
;Fill in missing from file and defaults : adds data in the existing user account with data provided in the uploaded file if the field is empty (does not already contain data) and fills in the default values for existing user details when no data is provided in the uploaded file.&lt;br /&gt;
&lt;br /&gt;
====Existing user password====&lt;br /&gt;
The Existing user password option specifies how to handle password data for existing user accounts when Existing user details is set to overwrite data.&lt;br /&gt;
;No changes : ignores password field in the uploaded user file and leaves the existing user account password untouched&lt;br /&gt;
;Update : overwrites the existing user account password with the password provided in the uploaded file&lt;br /&gt;
&lt;br /&gt;
====Force password change====&lt;br /&gt;
The Force password change option specifies when to tag a user account so that the next login attempt will require the user to change the user&#039;s password.&lt;br /&gt;
&lt;br /&gt;
;Users having a weak password : If the user account has a weak password as defined by the site&#039;s [[Password_policy#Password_policy|Password policy]] then the user will be forced to change the password during the next login attempt. This option is not shown if there the site does not have a [[Password_policy#Password_policy|Password policy]]. &lt;br /&gt;
;None : None of the users in the uploaded file will be forced to change the password during the user&#039;s next login attempt.&lt;br /&gt;
;All : All of the users in the uploaded file will be forced to change the password during the user&#039;s next login attempt.&lt;br /&gt;
&lt;br /&gt;
====Allow renames====&lt;br /&gt;
If the uploaded file contains the special &#039;&#039;&#039;oldusername&#039;&#039;&#039; field, it is possible to rename a user from the &#039;&#039;&#039;oldusername&#039;&#039;&#039; to a new &#039;&#039;&#039;username&#039;&#039;&#039;. The default setting is to &#039;&#039;&#039;not&#039;&#039;&#039; allow renames. Keep in mind that renaming a user will require the user to use the new username when logging in.&lt;br /&gt;
;No : ignores the &#039;&#039;&#039;oldusername&#039;&#039;&#039; field and leaves the existing user account&#039;s username field unchanged.&lt;br /&gt;
;Yes : allows the existing user account&#039;s username to be changed by the data provided in the uploaded file&#039;s username field. The &#039;&#039;&#039;oldusername&#039;&#039;&#039; will be searched for and then updated with the data provided in the username column.&lt;br /&gt;
&lt;br /&gt;
====Allow deletes====&lt;br /&gt;
If the uploaded file contains the &#039;&#039;&#039;deleted&#039;&#039;&#039; special field, it is possible to use the upload file to delete existing user accounts. The default setting is to &#039;&#039;&#039;not&#039;&#039;&#039; allow deletes. Keep in mind that deleting a user account will prevent that user from logging in. As a protection, site administrator user accounts cannot be deleted with this method. &lt;br /&gt;
;No : ignores the &#039;&#039;&#039;deleted&#039;&#039;&#039; special field in the uploaded file and leaves the existing user account unchanged&lt;br /&gt;
;Yes : allows the existing user account to be deleted when the value of the of the &#039;&#039;&#039;deleted&#039;&#039;&#039; field is 1. &lt;br /&gt;
&lt;br /&gt;
====Allow suspending and activating of accounts====&lt;br /&gt;
If the uploaded file contains the &#039;&#039;&#039;suspended&#039;&#039;&#039; special field, it is possible to use the upload file to either suspend or make active (unsuspend) existing user accounts. The default setting is to allow suspending/activating of existing user accounts. Keep in mind that suspending an existing user account will prevent that user from logging in. &lt;br /&gt;
;Yes : allows the existing user account to be suspended when the value of the of the &#039;&#039;&#039;suspended&#039;&#039;&#039; field is 1. &lt;br /&gt;
;No : ignores the &#039;&#039;&#039;suspended&#039;&#039;&#039; special field in the uploaded file and leaves the existing user account status unchanged.&lt;br /&gt;
&lt;br /&gt;
====Prevent email address duplicates====&lt;br /&gt;
It is possible, but &#039;&#039;&#039;not&#039;&#039;&#039; recommended to upload users with duplicate email addresses. By default, uploading users with duplicate email addresses is prevented. To allow duplicate email addresses, go to Site administration ► Plugins ► Authentication ► Manage authentication. You can tick &amp;quot;Allow accounts with same email&amp;quot;. Then on the upload users screen you will be allowed to change the &amp;quot;Prevent email address duplicates&amp;quot; setting. &lt;br /&gt;
&lt;br /&gt;
However, doing this is not recommended for file uploads. Test thoroughly any user uploads before implementing.&lt;br /&gt;
&lt;br /&gt;
For more info, see the [[Managing_authentication#Allow_accounts_with_same_email|Managing authentication]] docs page&lt;br /&gt;
;Yes : prevents user accounts from being created from the uploaded if an existing user account already has the same email address as found in the uploaded file&#039;s  &#039;&#039;&#039;email&#039;&#039;&#039; column.&lt;br /&gt;
;No : allows user accounts to be created if an existing user account already has the same email address found in the uploaded file&#039;s  &#039;&#039;&#039;email&#039;&#039;&#039; column.&lt;br /&gt;
&lt;br /&gt;
====Standardise usernames====&lt;br /&gt;
Standardise usernames is used by default to convert the username to all lower case and to strip out illegal characters. It is possible to not standardise the usernames; however, doing so is &#039;&#039;&#039;not&#039;&#039;&#039; recommended.&lt;br /&gt;
;Yes : standardises usernames found in the uploaded file before updating existing or creating new user accounts so that the username contains only lowercase letters and numbers.&lt;br /&gt;
;No : skips standardising usernames found in the uploaded file so that the newly created or updated usernames will be exactly as they are in the uploaded file (&#039;&#039;&#039;not recommended&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
For those seeking a more technical explanation, the process for standardising the usernames consists of ensuring the characters are all UTF-8 (fix_utf8) encoded, converting the username to lower case, and then stripping out non-letters/non-number characters (unless &#039;&#039;Site administration &amp;gt; Security &amp;gt; Site policies &amp;gt; Allow extended characters in usernames&#039;&#039; is set on) with something similar to: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$username = preg_replace(&#039;/[^-\.@_a-z0-9]/&#039;, &#039;&#039;, $username);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Select for bulk user actions====&lt;br /&gt;
After the uploaded file has finished being processed (all new accounts have been created and existing accounts updated as specified by the previous settings), there is an option to select some of those user accounts to perform additional [[admin/user/user_bulk|bulk user actions]] such as &lt;br /&gt;
*Confirm user accounts created through Email-based self-registration which are not yet confirmed by the user&lt;br /&gt;
*Send a message (requires Messaging to be enabled)&lt;br /&gt;
*Delete user accounts&lt;br /&gt;
*Display a list of users on a page&lt;br /&gt;
*Download user data in text, ODS or Excel file format&lt;br /&gt;
*Force users to change their passwords&lt;br /&gt;
*Add users to a cohort&lt;br /&gt;
&lt;br /&gt;
By default, no users are selected for [[admin/user/user_bulk|bulk user actions]].&lt;br /&gt;
&lt;br /&gt;
;No : No users are selected for [[admin/user/user_bulk|bulk user actions]]&lt;br /&gt;
;New users : Only newly created users are selected for [[admin/user/user_bulk|bulk user actions]]&lt;br /&gt;
;Updated users : Only updated user accounts are selected for [[admin/user/user_bulk|bulk user actions]]&lt;br /&gt;
;All users : All users found (existing updated users and newly created user accounts) in the uploaded file are selected for [[admin/user/user_bulk|bulk user actions]]&lt;br /&gt;
&lt;br /&gt;
===Default values===&lt;br /&gt;
&lt;br /&gt;
You can provide default user values for some fields not included in the uploaded file. Some fields include:&lt;br /&gt;
*Email display&lt;br /&gt;
*Forum auto-subscribe&lt;br /&gt;
*City/town&lt;br /&gt;
*ID number&lt;br /&gt;
*Institution&lt;br /&gt;
*Department&lt;br /&gt;
&lt;br /&gt;
==Upload user results ==&lt;br /&gt;
After accepting the preview settings by clicking on &amp;quot;Upload users&amp;quot;, you should see the the Upload users results screen.&lt;br /&gt;
[[File:Upload users results 2.0.JPG|thumb|center|The results screen; everything went well!]]&lt;br /&gt;
This screen will show you any exceptions or changes that were made to each user in the upload process.   For example if you were updating user information, the updated information will be shown.  Or if a user was not added that record will be highlighted.&lt;br /&gt;
&lt;br /&gt;
The screen will summarize how many users were uploaded or updated, indicate the number of weak passwords and the number of errors.&lt;br /&gt;
&lt;br /&gt;
==Advanced potentials of Upload user==&lt;br /&gt;
===Templates===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: This section needs checking and updating if necessary for Moodle 2.0. Please do so and remove this note when finished.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
*&amp;lt;nowiki&amp;gt; http://www.example.com/~%u/&amp;lt;/nowiki&amp;gt; results in  &amp;lt;nowiki&amp;gt;http://www.example.com/~jdoe/&amp;lt;/nowiki&amp;gt; (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3.&lt;br /&gt;
&lt;br /&gt;
===Deleting accounts===&lt;br /&gt;
&lt;br /&gt;
If the &#039;&#039;&#039;deleted&#039;&#039;&#039; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &#039;&#039;&#039;username&#039;&#039;&#039;. After uploading the file, be sure to change the &amp;quot;Upload type&amp;quot; to &amp;quot;Update existing users only&amp;quot; and the &amp;quot;Allow deletes&amp;quot; option to &amp;quot;Yes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039;  A similar field is available for &#039;&#039;&#039;suspended&#039;&#039;&#039;. This enables a user account to be temporarily disabled rather than completely removed.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username,firstname,lastname,deleted&lt;br /&gt;
 jonest,Tom,Jones,0&lt;br /&gt;
 reznort,,,1&lt;br /&gt;
&lt;br /&gt;
==Encoding file format==&lt;br /&gt;
On the initial Upload user screen, you may select the file encoding format from a pull down list.  These include UTF-8 (the default), ASCII,  ISO-8859-1 to ISO-8859-11 or any one of over 36 formats.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
The upload will also fail if you have trailing spaces at the end of your data fields. Often, this can not be removed with a simple Find &amp;quot; &amp;quot; and Replace with &amp;quot;&amp;quot;. If information has been copied from web sources than it is possible to include non-breaking spaces which will prevent your upload from being completed correctly. To find these invisible spaces, use the Find and Replace function in Excel. In the find field, hold alt and type 0160. Leave the replace field blank. &lt;br /&gt;
&lt;br /&gt;
===Field size limits===&lt;br /&gt;
Some fields have maximum character lengths, as defined in the database fields.  Typically the file will import to the preview list screen but not finish the process. Turn on debug to see the fields that are too long. The error will be &amp;quot;User not added - error&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The sizes of some common fields, in number of characters, are currently (3.2):&lt;br /&gt;
&lt;br /&gt;
*username - 100 	 &lt;br /&gt;
*password - 255 	 &lt;br /&gt;
*idnumber - 255 	 &lt;br /&gt;
*firstname - 100 	 &lt;br /&gt;
*lastname - 100 	 &lt;br /&gt;
*lastnamephonetic - 255 	 &lt;br /&gt;
*firstnamephonetic - 255 	 &lt;br /&gt;
*middlename - 255 	 &lt;br /&gt;
*alternatename - 255 &lt;br /&gt;
*institution -  255 	 &lt;br /&gt;
*department - 255 	 &lt;br /&gt;
*address - 255 	 &lt;br /&gt;
*city - 120 	 &lt;br /&gt;
*icq -15 	 &lt;br /&gt;
*skype - 50 	 &lt;br /&gt;
*yahoo - 50 	 &lt;br /&gt;
*aim - 50&lt;br /&gt;
*msn - 50 	 &lt;br /&gt;
*phone1 - 20 	 &lt;br /&gt;
*phone2  - 20&lt;br /&gt;
&lt;br /&gt;
===All user fields listed here===&lt;br /&gt;
:All the user fields that are valid in an upload file are listed below, except for any custom fields you may have created (for which see below.)&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;firstname,lastname,username,email,password,auth,idnumber,institution,department,city,country,timezone,lang,mailformat,maildisplay,maildigest,htmleditor,autosubscribe,skype,msn,aim,yahoo,icq,phone1,phone2,address,url,description,descriptionformat,interests,oldusername,deleted,suspended,alternatename,lastnamephonetic,firstnamephonetic,middlename&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The enrolments into courses information are &amp;lt;pre&amp;gt;course1,type1,role1,group1,enrolperiod1,enrolstatus1&amp;lt;/pre&amp;gt; &lt;br /&gt;
where each enrolment is grouped by number.&lt;br /&gt;
&lt;br /&gt;
===Capabilities===&lt;br /&gt;
&lt;br /&gt;
You may wish to create a limited role to allow some users access to this function. Create a role at the system/site level with the following capabilities allowed:&lt;br /&gt;
* moodle/site:uploadusers&lt;br /&gt;
* moodle/role:assign&lt;br /&gt;
&lt;br /&gt;
And &lt;br /&gt;
* In &#039;Allow role assignments&#039; tab of this new role, permit it to assign the required roles that it may be uploading, especially Student, but also Teacher, Non-editing Teacher, and any other custom roles you may have created, which will be used in the uploads to assign users to.&lt;br /&gt;
&lt;br /&gt;
In particular, don&#039;t forget the moodle/role:assign capability (even if these users have it in the courses they will be enrolling users in - it won&#039;t work).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Flat file]] enrolment&lt;br /&gt;
* [[User profile fields]] for details of how to include data about custom user profile fields in the upload users file&lt;br /&gt;
* [[Upload courses]]&lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[de:Nutzerliste hochladen]]&lt;br /&gt;
[[es:Subir usuarios]]&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development_talk:Setting_up_Netbeans&amp;diff=80372</id>
		<title>Development talk:Setting up Netbeans</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development_talk:Setting_up_Netbeans&amp;diff=80372"/>
		<updated>2011-01-16T02:48:16Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: /* simpletest support question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CVS instructions ==&lt;br /&gt;
&lt;br /&gt;
I copied the instructions from [[User:Gary_Anderson| Gary Anderson]]&#039;s &#039;&#039;NetBeans for Moodle Development course&#039;&#039; (http://moodle2.seattleacademy.org/wiki/index.php/Get_the_Moodle_Software, http://moodle2.seattleacademy.org/course/view.php?id=5). There might be some redundancies which still have to be amended. --[[User:Frank Ralf|Frank Ralf]] 09:43, 20 May 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
: I was in the Gary Andersson course and there was a prepared package there with both NetBeans and Moodle. But Right now I can&#039;t get to that course at all. I am setting up on another computer and would like to have the latest NetBeans 6.7, and set up Moodle preferably both 1.9.5+ and HEAD 2.0. &lt;br /&gt;
&lt;br /&gt;
: When I see the instructions here I don&#039;t see anything about getting the xamp server setup. &lt;br /&gt;
&lt;br /&gt;
: I also wonder about if one should maybe use a complete install package first than connect that to NetBeans and after that try doing CVS updating through NetBeans. (I maybe wrong, but I assume that doing a complete install via CVS would take much longer.)  I also assume that I must than create an extra Moodle database in MySQL and of course a separate folder if I want to install 2.0 also.  [[User:Jeff Forssell|Jeff Forssell]] 13:02, 9 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Hi Jeff, If you want to use CVS you should do a manual installation.&lt;br /&gt;
::* Setting up XAMPP is nothing more than downloading and unpacking it, really painless. The web server&#039;s directory will be \htdocs\.&lt;br /&gt;
::* Then you install NetBeans 6.7 and do separate CVS checkouts for HEAD (2.0) and 1.9.5 into separate directories (e.g. \htdocs\moodle19\ and \htdocs\moodle20\.&lt;br /&gt;
::* Then you can run Moodle 1.9.5 under &amp;quot;localhost/moodle19/&amp;quot; in your browser and Moodle &amp;quot;localhost/moodle20/&amp;quot;. &lt;br /&gt;
:: Further details for manually setting up Moodle you&#039;ll find under [[Windows installation using XAMPP]]. hth --[[User:Frank Ralf|Frank Ralf]] 13:42, 9 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::Thanx&lt;br /&gt;
&lt;br /&gt;
:::I&#039;ve done lots of xampp installs of the Moodle complete packages, but never just xampp alone. Should I interpret your answer as I have to install Moodle via CVS if I want to use CVS to keep it updated? And that it won&#039;t be ridiculously long time doing the original checkout? In the GA course we did a CVS update of the original install, but I don&#039;t know if he had done that package by doing a CVS checkout. (It just doesn&#039;t feel like that was what was going on!) &lt;br /&gt;
:::: The first checkout might take some time, but as far as I remember it&#039;s done in about 15 minutes. --[[User:Frank Ralf|Frank Ralf]] 16:02, 9 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: Oh well I suppose it&#039;s time to learn to create MySQL databases for Moodle without complete packages or Fantastico! [[User:Jeff Forssell|Jeff Forssell]] 15:04, 9 July 2009 (UTC)&lt;br /&gt;
:::: XAMPP comes with PHPMyAdmin for MySQL administration. That&#039;s a very useful tool and worth exploring. --[[User:Frank Ralf|Frank Ralf]] 16:02, 9 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: Just another thing: Moodle 2.0 requires quite recent versions of PHP and MySQL. So for using HEAD I had to install a new version of XAMPP (I have two versions installed on my development machine which is no problem, you only should not run them at the same time). --[[User:Frank Ralf|Frank Ralf]] 16:14, 9 July 2009 (UTC)&lt;br /&gt;
::::: I have now CVSed moodle 1.9 with NetBeans - it took less than 10 mins. Created a new project. Then it started &amp;quot;scanning projects&amp;quot; - I didn&#039;t know what it is doing and it wasn&#039;t finished after more than 10 minutes. I see now that it has stopped. Anyhow now I\ve also done the same with HEAD / moodle20.&lt;br /&gt;
&lt;br /&gt;
:::::I have some hesitation about trying to &amp;quot;run&amp;quot; them. Anything one should do before that other than creating the projects?  [[User:Jeff Forssell|Jeff Forssell]] 08:55, 10 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::: I see when trying to RUN that my moodle 2.0 is in http://localhost/moodle20/moodle/install.php while i thought it would be in http://localhost/moodle20/install.php. Maybe that&#039;s good because the NB proj files are in a folder there too. &lt;br /&gt;
&lt;br /&gt;
:::::When I get to the &amp;quot;web address&amp;quot; page that is greyed out. I was hoping to try out setting the computer name so I could access from others on my intranet. How can I change that (from &amp;quot;localhost&amp;quot;)?&lt;br /&gt;
&lt;br /&gt;
:::::: Hi Jeff, I would suggest moving this discussion to the appropriate forum to give more people the chance to join. This here is quite a private place and should preferably only be used for issues directly connected to this Moodle Docs page. Thanks in advance! --[[User:Frank Ralf|Frank Ralf]] 10:29, 10 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::::: Which is &amp;quot;the appropriate forum&amp;quot; for this subject? [[User:Jeff Forssell|Jeff Forssell]] 21:04, 15 August 2010 (UTC)&lt;br /&gt;
:::::::: I would try the [http://moodle.org/mod/forum/view.php?id=55 General Developer forum] --[[User:Frank Ralf|Frank Ralf]] 09:00, 16 August 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::::: &amp;quot;localhost&amp;quot; is always the local PC itself. You can access it from other computers by using the PC&#039;s IP address (use &amp;quot;ipconfig&amp;quot; in a DOS box) or by modifying the &amp;quot;hosts&amp;quot; file on your PC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== simpletest configuration in Netbeans ==&lt;br /&gt;
&lt;br /&gt;
I see PHPUnit support in Netbeans but none for simpletest. Has anybody set up unit testing with simpletest on Netbeans?&lt;br /&gt;
&lt;br /&gt;
[[User:vikram solia|vikram solia]] 02:48, 16 January 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=GIFT_format&amp;diff=56709</id>
		<title>GIFT format</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=GIFT_format&amp;diff=56709"/>
		<updated>2009-05-27T12:36:28Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: changed answers start and end symbol from ( and ) to { and } respectively&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GIFT format allows someone to use a text editor to write multiple-choice, true-false, short answer, matching  missing word and numerical questions in a simple format than cam be imported. The GIFT format is also an export file format available in Question bank.&lt;br /&gt;
&lt;br /&gt;
*When creating a large numbers of questions, GIFT is can provide a quick way of bulk loading questions either into a [[Question bank|question category]], or into a [[Adding_a_question_page#Importing_questions|Lesson]]. &lt;br /&gt;
*Sometimes it is easier proofing questions in a question category by viewing them in a GIFT file.&lt;br /&gt;
&lt;br /&gt;
==General instructions==&lt;br /&gt;
At least one blank line must be left between each question. &lt;br /&gt;
&lt;br /&gt;
In the simple form, the question comes first, then the answers are set in between brackets, with an equal sign indicating the correct answer(s) and tilde the wrong answers.  A Number sign will insert a response.  Questions can be weighted by placing percentage signs around the weight.  Comments are preceded by double slashes and are not imported.  &lt;br /&gt;
&lt;br /&gt;
Here are some useful [http://moodle.org/file.php/5/moddata/forum/121/236161/GIFT-examples.zip GIFT examples] than can be imported or used as rough template.  Many of the examples below used the questions in the file as a starting point.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; Any GIFT file &#039;&#039;&#039;must&#039;&#039;&#039; be correctly encoded in [[UTF8]]. Beware of some of Microsoft&#039;s &amp;quot;fake&amp;quot; Unicode implementation which is not compatible and may result in strange characters appearing in your quizzes.  When in doubt, save as a simple MS-DOS text file.&lt;br /&gt;
&lt;br /&gt;
===Format symbols===&lt;br /&gt;
Here are some common GIFT symbols and their use.&lt;br /&gt;
&lt;br /&gt;
{|  border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!width=&amp;quot;40&amp;quot; |Symbol&lt;br /&gt;
!width=&amp;quot;100&amp;quot;|Use&lt;br /&gt;
!width=&amp;quot;40&amp;quot;|Symbol&lt;br /&gt;
!width=&amp;quot;100&amp;quot;|Use&lt;br /&gt;
!width=&amp;quot;40&amp;quot;|Symbol&lt;br /&gt;
!width=&amp;quot;100&amp;quot;|Use&lt;br /&gt;
!width=&amp;quot;40&amp;quot;|Symbol&lt;br /&gt;
!width=&amp;quot;100&amp;quot;|Use&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;//&amp;lt;/b&amp;gt;|| Comment ||&amp;lt;b&amp;gt;::&amp;lt;/b&amp;gt;Title&amp;lt;b&amp;gt;::&amp;lt;/b&amp;gt;||Title || &amp;lt;b&amp;gt;{&amp;lt;/b&amp;gt; || Start answer||&amp;lt;b&amp;gt; }&amp;lt;/b&amp;gt; ||After last answer&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;b&amp;gt;= &amp;lt;/b&amp;gt;|| Correct answer || &amp;lt;b&amp;gt;#&amp;lt;/b&amp;gt; ||Answer feedback / comment|| &amp;lt;b&amp;gt;{#&amp;lt;/b&amp;gt; ||Numeric question start || &amp;lt;b&amp;gt;:&amp;lt;/b&amp;gt; || range in numeric question&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;b&amp;gt;~ &amp;lt;/b&amp;gt;  || Wrong answer  || &amp;lt;b&amp;gt;-&amp;gt;&amp;lt;/b&amp;gt;  || Match  ||&amp;lt;b&amp;gt;%&amp;lt;/b&amp;gt;50&amp;lt;b&amp;gt;%&amp;lt;/b&amp;gt; || Weight 50%  || || &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format symbols explained===&lt;br /&gt;
The multiple choice format below as a comment line // for the question, when Moodle exports it the question unique id number will appear here.  The first set of  :: precedes the question title. The second :: precedes the actual question. The first { indicates the start of the answers.  The correct answer is preceded by an = sign and wrong answers by a ~.  Teacher responses have a # in front of them.  The question ends with a } and then a blank line. NOTE it is { } not ( ) parenthesis! Usually these are gotten with help of the [AltGr] key.&lt;br /&gt;
&lt;br /&gt;
 //Comment line &lt;br /&gt;
 ::Question title &lt;br /&gt;
 :: Question {&lt;br /&gt;
 =A correct answer&lt;br /&gt;
 ~Wrong answer1&lt;br /&gt;
 #A response to wrong answer1&lt;br /&gt;
 ~Wrong answer2&lt;br /&gt;
 #A response to wrong answer2&lt;br /&gt;
 ~Wrong answer3&lt;br /&gt;
 #A response to wrong answer3&lt;br /&gt;
 ~Wrong answer4&lt;br /&gt;
 #A response to wrong answer4&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The shortest format for a multiple choice question is:&lt;br /&gt;
 Question{= A Correct Answer ~Wrong answer1 ~Wrong answer2 ~Wrong answer3 ~Wrong answer4 }&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039; If you don&#039;t specify a question title the WHOLE question will be used as the title at the time of import into Moodle. There are pros and cons to allowing this to happen. Cons: This can add a lot of unnecessary words. This can include characters which might confuse the export GIFT process.  Pros: On the other hand. if the start of each question is different, it can make finding a single question easier in a category list of questions. It will save you typing.  Having the same title for every question is a very bad idea.&lt;br /&gt;
&lt;br /&gt;
==Question format examples==&lt;br /&gt;
There are several ways to use a text editor to write a GIFT format.  We will try to show the simple version for example and in some formats we will introduce some more complex features that can be imported into many Moodle Question formats.  &lt;br /&gt;
&lt;br /&gt;
===Multiple choice===&lt;br /&gt;
Here is a simple acceptable GIFT multiple choice format:&lt;br /&gt;
 Who&#039;s buried in Grant&#039;s tomb?{=Grant ~no one ~Napoleon ~Churchill ~Mother Teresa }&lt;br /&gt;
&lt;br /&gt;
Here is a longer format that uses most of the GIFT elements:&lt;br /&gt;
&lt;br /&gt;
  // question: 1 name: Grants tomb&lt;br /&gt;
 ::Grants tomb::Who is buried in Grant&#039;s tomb in New York City? {&lt;br /&gt;
 =Grant&lt;br /&gt;
 ~No one&lt;br /&gt;
 #Was true for 12 years, but Grant&#039;s remains were buried in the tomb in 1897&lt;br /&gt;
 ~Napoleon&lt;br /&gt;
 #He was buried in France&lt;br /&gt;
 ~Churchill&lt;br /&gt;
 #He was buried in England&lt;br /&gt;
 ~Mother Teresa&lt;br /&gt;
 #She was buried in India&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===True-false===&lt;br /&gt;
&lt;br /&gt;
 // question: 0 name: TrueStatement&lt;br /&gt;
 ::TrueStatement about Grant::Grant was buried in a tomb in New York City.{T}&lt;br /&gt;
&lt;br /&gt;
===Short answer===&lt;br /&gt;
Here are two examples using the simple method showing possible right answers for credit.&lt;br /&gt;
 Who&#039;s buried in Grant&#039;s tomb?{=Grant =Ulysses S. Grant =Ulysses Grant}&lt;br /&gt;
&lt;br /&gt;
 Two plus two equals {=four =4}&lt;br /&gt;
&lt;br /&gt;
===Matching===&lt;br /&gt;
The matching uses the equal sign before the list item with a -&amp;gt; (dash and greater than) before the correct match.&lt;br /&gt;
 &lt;br /&gt;
 Match the following countries with their corresponding capitals. {&lt;br /&gt;
    =Canada -&amp;gt; Ottawa&lt;br /&gt;
    =Italy  -&amp;gt; Rome&lt;br /&gt;
    =Japan  -&amp;gt; Tokyo&lt;br /&gt;
    =India  -&amp;gt; New Delhi&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Missing word===&lt;br /&gt;
This is a simple missing word format&lt;br /&gt;
 Grant {~is not buried =is buried ~might be buried} in Grant&#039;s tomb.&lt;br /&gt;
&lt;br /&gt;
===Numerical questions===&lt;br /&gt;
Here is a simple numerical format question. It will accept a range of 5 years.&lt;br /&gt;
 When was Ulysses S. Grant born?{#1822:5}&lt;br /&gt;
&lt;br /&gt;
Here is a more complex numerical format with a ranged and partial credit given for 1 answer.&lt;br /&gt;
 //this comment will be ignored in the import process &lt;br /&gt;
 ::Numerical example::&lt;br /&gt;
 When was Ulysses S. Grant born? {#&lt;br /&gt;
     =1822:0      #Correct!  you will get full credit for this answer&lt;br /&gt;
     =%50%1822:2  #He was born in 1822.&lt;br /&gt;
                  You get 50% credit for being close.&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Hints and Tips==&lt;br /&gt;
&lt;br /&gt;
* Use the ::title:: at the beginning of every question to organize this for you (01 - testquestion), otherwise it would be difficult to find the right question for changes, moodle will take the beginning of every question as internal title.&lt;br /&gt;
* In the Lesson module, in a question page, correct answers jump by default to Next page and incorrect answers jump to This page (i.e. student has to &amp;quot;try again&amp;quot;). When importing from a GIFT format file, this is exactly the mechanism which is used.&lt;br /&gt;
* If you want a student to be taken directly from one question to the next irrespective of their answer being correct or incorrect: in the Lesson Settings, set Maximum number of attempts: to 1. &lt;br /&gt;
**Please note, however, that a message &amp;quot;correct / incorrect&amp;quot; will still be displayed to the student upon answering each question. If you do not want this (default) feedback message to be displayed then enter your own feedback message (i.e. &amp;quot;continue&amp;quot;, &amp;quot;---&amp;quot;, etc.) &lt;br /&gt;
**In case you want no visible message displayed then enter a non-breaking space as feedback. Moodle will not put it&#039;s automatic responce because it sees the blank space. To do this, put a # after the answer and write [[Image:Nbsp.png]] (without spaces between these characters). &lt;br /&gt;
* Need to use a special GIFT character in your question or answer?  Put a \ in front of the GIFT character.  &lt;br /&gt;
**For example if you want to use curly braces, { or }, or equal sign, =, or # or ~ in a GIFT file (in a math question including TeX expressions) you must &amp;quot;escape&amp;quot; them by preceding them with a \ directly in front of each { or } or =. It is possible to use a replace program/macro/editor filter to do this conversion before importing to Moodle.&lt;br /&gt;
* Want to change T/F type questions to multiple choice? Consider exporting the T/F questions as a GIFT file, then using a text editor to replace the (T) with (=True ~False). Perhaps change the title slightly so you will recognize the new questions.&lt;br /&gt;
&lt;br /&gt;
==Word processors and Spreadsheets tools that create GIFTs==&lt;br /&gt;
Several contributors have used macros to generate GIFT files from a more familiar popular programs.   &lt;br /&gt;
* There are Word macros available for easily creating GIFT files. See [http://www.soberit.hut.fi/sprg/resources/moodle/GiftConverter.html this non-Moodle site] for downloads and instructions for use.&lt;br /&gt;
* There are several Excel spreadsheets for generating GIFT files. Several people have built upon other contributors work.  &lt;br /&gt;
**The latest version was posted on 10 April 2007 and can be found in this thread with this file name: [http://moodle.org/mod/forum/discuss.php?d=66660 Excel2GIFTv1.1.zip by Timothy Takemoto].  There is also a set of instructions Excel2GIFTv1.1_Instructions.rtf by Jeff Shek on the same day in that thread.&lt;br /&gt;
**An earlier version of this Excel spreadsheet for generating multiple choice GIFT files [http://moodle.org/mod/forum/discuss.php?d=45245 initially created by Olga Forlani and improved by A. T. Wyatt].&lt;br /&gt;
*There are Open Office templates for generating GIFT files in Writer.  These are located in the Quiz forum in the[http://moodle.org/mod/forum/discuss.php?d=20705&amp;amp;parent=168385 OOo template to write exams and convert to GIFT format thread].&lt;br /&gt;
**The most recent for OO 2.x is &amp;quot;OOo2GIFT_Template_05.zip&amp;quot; postes 17 December 2005 by Enrique Castro.&lt;br /&gt;
**An earlier version is &amp;quot;GIFT_template_OOo.zip&amp;quot; posted 22 March 2005 by Enrique Castro.&lt;br /&gt;
*There is an easy to use on line multiple question generator at [http://a4esl.org/c/qw.html  a4esl.org]. Here you write your question(s) without formating marks, select Moodle and press the generate quiz button.  This creates GIFT formatted text that can be pasted into a file for importing into Moodle.&lt;br /&gt;
**The initial format requires fewer keystrokes (it uses line position and returns) than the GIFT format, so you should save time and be less likely to create invalid data.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Here is a 2-column [http://buypct.com/gift_reference.pdf GIFT Reference Sheet]&lt;br /&gt;
*[[Export questions]]&lt;br /&gt;
*[[Import questions]]&lt;br /&gt;
*[[Import and export FAQ]]&lt;br /&gt;
*[[Aiken Format]]&lt;br /&gt;
*[[Moodle XML format]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
&lt;br /&gt;
[[ja:GIFTフォーマット]]&lt;br /&gt;
[[de:GIFT]]&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development_talk:Course_completion&amp;diff=40288</id>
		<title>Development talk:Course completion</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development_talk:Course_completion&amp;diff=40288"/>
		<updated>2008-07-23T05:11:01Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: multiple course completions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Many of the users that ask about this also bring up wanting to be able to set resources viewed as a criteria for course completion. Can this be added as one of the features for course completion?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I think the same course should have multiple completions because that means that even a single course can be offered as a short course as well as a full course. One way of doing it could be having multiple grades for the same activity. This will allow activities / resources to be more usable&lt;br /&gt;
&lt;br /&gt;
--[[User:vikram solia|vikram solia]] 00:11, 23 July 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development_talk:Grades&amp;diff=33392</id>
		<title>Development talk:Grades</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development_talk:Grades&amp;diff=33392"/>
		<updated>2008-03-09T07:00:08Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Regarding course completion, there could be multiple course completions e.g. crash course, full-time course and so on, in the same course.&lt;br /&gt;
&lt;br /&gt;
This will allow using a single course area for better interaction among experts and novices without requiring reproducing the learning objects (activities and resources) in separate courses for the two.&lt;br /&gt;
&lt;br /&gt;
[[User:vikram solia|vikram solia]] 01:00, 9 March 2008 (CST)&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development_talk:Events_API&amp;diff=28229</id>
		<title>Development talk:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development_talk:Events_API&amp;diff=28229"/>
		<updated>2007-10-25T20:51:14Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Is Gradebook actually using events API?  If not, then is the example appropriate?  It tends to imply that events are being used in the Gradebook.&lt;br /&gt;
&lt;br /&gt;
[[User:vikram solia|vikram solia]] 15:50, 25 October 2007 (CDT)&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development_talk:Events_API&amp;diff=28228</id>
		<title>Development talk:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development_talk:Events_API&amp;diff=28228"/>
		<updated>2007-10-25T20:50:31Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: Appropriate Example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I Gradebook actually using events API.  If it is not, then is the example appropriate?  It tends to imply that events are being used in the Gradebook.&lt;br /&gt;
&lt;br /&gt;
[[User:vikram solia|vikram solia]] 15:50, 25 October 2007 (CDT)&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:Implementation_of_true_negative_marks_in_MC-type_questions&amp;diff=28226</id>
		<title>Development:Implementation of true negative marks in MC-type questions</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:Implementation_of_true_negative_marks_in_MC-type_questions&amp;diff=28226"/>
		<updated>2007-10-25T14:41:36Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: Modified raw score calculation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this development project is to implement true negative marks for multiple choice-type questions in quiz. Up to now (1.8+), negative marks for incorrect answers are offered in the configuration options of individual multiple choice questions but are not reflected in the calculation of final quiz scores. Instructors wishing to use negative marking in their quizzes cannot do so or must rely on a potentially harmful hack to achieve the desired result.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example:&#039;&#039;&#039; An instructor might wish to design a quiz consisting of 20 multiple choice questions with four options each (one correct, three incorrect, only one option selectable). An incorrect response on one question should, for example, lead to the subtraction of one full mark (-100%) from the final score so a student making five correct responses, two nonresponses and 13 incorrect responses should obtain a final raw score of 5x1 + 2x0 + 13x-1 = 5 + 0 -13 = -8 Marks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; True negative marks are conceptually different from penalties applied in &#039;&#039;&#039;adaptive mode&#039;&#039;&#039;. The latter allows a quiz taker to make multiple attempts on the same quiz, obtain feedback and change his/her answers. Penalties are the &amp;quot;price&amp;quot; quiz takers pay for obtaining additional information and changing their responses. &#039;&#039;&#039;Confidence Based Marking (CBM)&#039;&#039;&#039; is a didactically much more refined approach to obtaining valid quiz scores which encourages quiz takers to critically reflect on their abilities. However, CBM is not the object of the present proposal. This simpler form of negative marks is required if we are to reporduce various existing paper-based quizzes in Moodle.&lt;br /&gt;
&lt;br /&gt;
Please make suggestions &amp;amp; comments here: http://moodle.org/mod/forum/discuss.php?d=82402#p366487&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* full implementation of true negative marks in multiple choice questions,&lt;br /&gt;
* correct calculation of final quiz scores and scaling to percentages,&lt;br /&gt;
* appropriate representation of the negative marks in the various report formats,&lt;br /&gt;
* clean integration with multiple attempts and at least the option set &amp;quot;each attempt builds on the last&amp;quot; &amp;amp; &amp;quot;highest grade&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
This section is work in progress. Developers are cordially invited to make suggestions and bids.&lt;br /&gt;
&lt;br /&gt;
* separation and mutual exclusion of a &amp;quot;true&amp;quot; or &amp;quot;simple&amp;quot;, the adaptive and (potentially)a CBM mode,&lt;br /&gt;
* modification to the table structure to reflect this (input needed)&lt;br /&gt;
* code changes (branching, calculation modes)&lt;br /&gt;
* small changes to UI and documentation - Quiz Settings (addition of a quiz marking mode selector &amp;quot;simple/true&amp;quot;; &amp;quot;adaptive&amp;quot;; (confidence-based)); greying out of options incompatible with the chosen marking mode, e.g. penalty factors, to avoid confusion.&lt;br /&gt;
&lt;br /&gt;
== Terms &amp;amp; Conditions ==&lt;br /&gt;
&lt;br /&gt;
Limited funding is available to support the project. The exact status of the solutions (core, patch/hack, add-on) is immaterial as long as it is GPLd, designed for 1.9 and back-portable to 1.8+&lt;br /&gt;
&lt;br /&gt;
I am very much looking forward to estimates of the workload and bids.&lt;br /&gt;
&lt;br /&gt;
Pete&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:Calculated_question_improvements&amp;diff=20058</id>
		<title>Development:Calculated question improvements</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:Calculated_question_improvements&amp;diff=20058"/>
		<updated>2007-02-07T17:52:18Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Calculated question dev docs}}&lt;br /&gt;
I will use this page to describe the various improvements I will try to develop related to the calculated questions.&lt;br /&gt;
&lt;br /&gt;
==Creation and modification of calculated questions==&lt;br /&gt;
See the [[Development:Calculated question bugs and new features proposal]]&lt;br /&gt;
&lt;br /&gt;
See the [[Calculated question actual 1.7 interface summary]]&lt;br /&gt;
&lt;br /&gt;
See the [[Calculated question 1.7 bugs solving proposal]]&lt;br /&gt;
&lt;br /&gt;
==A more FOOL-PROOF code proposal == &lt;br /&gt;
The code can be improved&lt;br /&gt;
* by allowing user to do normal browser operations like a click on the BACK button to comeback at the first step and correct the question text&lt;br /&gt;
 If the HTML editor of the question text is activated, &#039;&#039;&#039;all&#039;&#039;&#039; the text already written will be lost.&lt;br /&gt;
 If the HTML editor is not activated (ex. on MACs with OS 9) and the simple HTML textarea is used, the text already written is not lost.&lt;br /&gt;
* by checking ALL the content of the first form elements (i.e. name, question text, answer formula etc.) when the user click the &#039;&#039;&#039;SAVE CHANGES&#039;&#039;&#039; button.&lt;br /&gt;
 If the javascript perform all the tests done in the PHP code before saving the calculated question parameters, we eliminate almost all the possibility of loosing the work when clicking the ADD button in the third form.&lt;br /&gt;
The editquestion.html being specific to each questiontype can perform tests specific to the calculated question which are known to the developers of the calculated question PHP code.&lt;br /&gt;
&lt;br /&gt;
==Full proof and clearer creation process==&lt;br /&gt;
Actually the creation or edition of calculated question is a three steps process ( 3 different pages) where the user can make errors that he cannot readily recuperate.&lt;br /&gt;
* Identify the steps and renaming the save changes or continue buttons.&lt;br /&gt;
* Using javascript to correct for errors or non valid values in each steps before going to the next step.[[Calculated question js validating forms]]&lt;br /&gt;
* Creating buttons to access the previous steps for corrections.&lt;br /&gt;
* Creating a table showing the variables used by the other calculated questions in the same category.&lt;br /&gt;
* Allowing to create or delete data items by 1, 10, 20 etc in one step.&lt;br /&gt;
&lt;br /&gt;
==Import and export of calculated question==&lt;br /&gt;
Actually there is no import or export mudle that works for calculated questions&lt;br /&gt;
====Import from webct====&lt;br /&gt;
At Uqam we are migrating to Moodle from Webct.&lt;br /&gt;
====Export and import in moodle format==== &lt;br /&gt;
==Moving calculated questions to another category==&lt;br /&gt;
Actually the code (Moodle 1.7) for moving questions to another category means simply to change the category field in the database question record.&lt;br /&gt;
Although this is correct for most questions types, this is not the right way to do it with calculated questions because the same category field is also used in the datasets records.&lt;br /&gt;
A dataset can be shared by questions of the same category. &lt;br /&gt;
To search if there is a already sharable dataset in a category, the parameters used are the dataset-&amp;gt;name and the dataset-&amp;gt;category.&lt;br /&gt;
The possibilities are&lt;br /&gt;
#All the dataset used by the question to be moved are reserved for this question (dataset-&amp;gt;category=0). The calculated question can be moved to another category &#039;&#039;&#039;without restriction&#039;&#039;&#039;.This is the actual implementation.&lt;br /&gt;
#At least one of the dataset used by the question to be moved is sharable (dataset-&amp;gt;category = actual question category)&lt;br /&gt;
## If &#039;&#039;&#039;all&#039;&#039;&#039; the sharable dataset are &#039;&#039;&#039;only&#039;&#039;&#039; used by the question to be moved, the calculated question can be selected to move to the other category .&lt;br /&gt;
## If &#039;&#039;&#039;all&#039;&#039;&#039; the questions that are selected to be moved, and &#039;&#039;&#039;all&#039;&#039;&#039; the sharable datasets are only used by these questions to be moved, this set of questions can be selected to move to the other category .&lt;br /&gt;
## In the case that there are questions not selected that could used a sharable dataset, this dataset cannot be moved in the another category.&lt;br /&gt;
###Notify the user that another questions in the initial category share a parameter with this category.&lt;br /&gt;
####The user can choose to cancel the move and select all the other questions (Case 2.2).&lt;br /&gt;
####The user can choose to keep the question in the selected questions to be moved. In this case, the dataset should be duplicated when moving the another category.&lt;br /&gt;
===Duplicate datasets?===&lt;br /&gt;
If a similar sharable dataset already exists in the moveto category ( identical dataset-&amp;gt;name and dataset-&amp;gt;category = movetocategory).&lt;br /&gt;
Notify the user and giving information on the&lt;br /&gt;
#sharable dataset in selected questions to be moved &lt;br /&gt;
#already existing sharable datasets in the move_to_category.&lt;br /&gt;
The user should be able to select which dataset will be used in move_to_category.&lt;br /&gt;
&lt;br /&gt;
To implement these choices we need to add new functions in default questiontype class.&lt;br /&gt;
===function movable_to_category(&amp;amp;$questions,$categoryid)===&lt;br /&gt;
 default return null &lt;br /&gt;
 $questions contain all the question records data for all the selected questions &lt;br /&gt;
 so that qtype implementation could test &amp;lt;br&amp;gt;if the selected questions satisfy option 2.2&lt;br /&gt;
 a $questions-&amp;gt;notify can be added to be used by showbank.php and move_to_category.&lt;br /&gt;
===function move_to_category($question,$tocategory)=== &lt;br /&gt;
the default implementation should something like the actual code&lt;br /&gt;
  {&lt;br /&gt;
           if (!set_field(&#039;question&#039;, &#039;category&#039;, $tocategory-&amp;gt;id, &#039;id&#039;, $question-&amp;gt;id)) {&lt;br /&gt;
                            error(&#039;Could not update category field&#039;);&lt;br /&gt;
                        }&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
the calculated question implementation should be able to duplicate the datasets in the new category&lt;br /&gt;
&lt;br /&gt;
==Improvements in general question editing interface==&lt;br /&gt;
*Showing the text of the questions&lt;br /&gt;
&lt;br /&gt;
==Creation of a short (simple) calculated question==&lt;br /&gt;
The actual calculated question allows for calculated params that can be shared by different problems.&lt;br /&gt;
This could lead to a somewhat cloze used of calculated questions.However the questions cannot migrate individually to another category.&lt;br /&gt;
A short calculated question that just allow for calculated parameters reserved for this question will allow use of this question in drag and drop cloze lesson.&lt;br /&gt;
==Manipulating data items==&lt;br /&gt;
Actual functions and propôsal for new ones for manipulating data items are discussed in [[Data_Item_Functions]]&lt;br /&gt;
==Side effects to other modules==&lt;br /&gt;
* Modification of the question type to allow moving of calculated question to another category.&lt;br /&gt;
* Creation of general functions to standardize the import or export process.&lt;br /&gt;
&lt;br /&gt;
  [[User:Pierre Pichet|Pierre Pichet]]  August 2006 (WST)&lt;br /&gt;
[[Developer_notes]]&lt;br /&gt;
[[Calculated question creation developper docs]]&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:Calculated_question_improvements&amp;diff=20057</id>
		<title>Development:Calculated question improvements</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:Calculated_question_improvements&amp;diff=20057"/>
		<updated>2007-02-07T17:52:03Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Calculated question dev docs}}&lt;br /&gt;
I will use this page to describe the various improvements I will try to develop related to the calculated questions.&lt;br /&gt;
&lt;br /&gt;
==Creation and modification of calculated questions==&lt;br /&gt;
See the [[Development:Calculated question bugs and new features proposal]]&lt;br /&gt;
&lt;br /&gt;
See the [[Calculated question actual 1.7 interface summary]]&lt;br /&gt;
&lt;br /&gt;
See the [[Calculated question 1.7 bugs solving proposal]]&lt;br /&gt;
&lt;br /&gt;
==A more FOOL-PROOF code proposal == &lt;br /&gt;
The code can be improved&lt;br /&gt;
* by allowing user to do normal browser operations like a click on the BACK button to comeback at the first step and correct the question text&lt;br /&gt;
 If the HTML editor of the question text is activated, &#039;&#039;&#039;all&#039;&#039;&#039; the text already written will be lost.&lt;br /&gt;
 If the HTML editor is not activated (ex. on MACs with OS 9) and the simple HTML textarea is used, the text already written is not lost.&lt;br /&gt;
* by checking ALL the content of the first form elements (i.e. name, question text, answer formula etc.) when the user click the &#039;&#039;&#039;SAVE CHANGES&#039;&#039;&#039; button.&lt;br /&gt;
 If the javascript perform all the tests done in the PHP code before saving the calculated question parameters, we eliminate almost all the possibility of loosing the work when clicking the ADD button in the third form.&lt;br /&gt;
The editquestion.html being specific to each questiontype can perform tests specific to the calculated question which are known to the developers of the calculated questiont PHP code.&lt;br /&gt;
&lt;br /&gt;
==Full proof and clearer creation process==&lt;br /&gt;
Actually the creation or edition of calculated question is a three steps process ( 3 different pages) where the user can make errors that he cannot readily recuperate.&lt;br /&gt;
* Identify the steps and renaming the save changes or continue buttons.&lt;br /&gt;
* Using javascript to correct for errors or non valid values in each steps before going to the next step.[[Calculated question js validating forms]]&lt;br /&gt;
* Creating buttons to access the previous steps for corrections.&lt;br /&gt;
* Creating a table showing the variables used by the other calculated questions in the same category.&lt;br /&gt;
* Allowing to create or delete data items by 1, 10, 20 etc in one step.&lt;br /&gt;
&lt;br /&gt;
==Import and export of calculated question==&lt;br /&gt;
Actually there is no import or export mudle that works for calculated questions&lt;br /&gt;
====Import from webct====&lt;br /&gt;
At Uqam we are migrating to Moodle from Webct.&lt;br /&gt;
====Export and import in moodle format==== &lt;br /&gt;
==Moving calculated questions to another category==&lt;br /&gt;
Actually the code (Moodle 1.7) for moving questions to another category means simply to change the category field in the database question record.&lt;br /&gt;
Although this is correct for most questions types, this is not the right way to do it with calculated questions because the same category field is also used in the datasets records.&lt;br /&gt;
A dataset can be shared by questions of the same category. &lt;br /&gt;
To search if there is a already sharable dataset in a category, the parameters used are the dataset-&amp;gt;name and the dataset-&amp;gt;category.&lt;br /&gt;
The possibilities are&lt;br /&gt;
#All the dataset used by the question to be moved are reserved for this question (dataset-&amp;gt;category=0). The calculated question can be moved to another category &#039;&#039;&#039;without restriction&#039;&#039;&#039;.This is the actual implementation.&lt;br /&gt;
#At least one of the dataset used by the question to be moved is sharable (dataset-&amp;gt;category = actual question category)&lt;br /&gt;
## If &#039;&#039;&#039;all&#039;&#039;&#039; the sharable dataset are &#039;&#039;&#039;only&#039;&#039;&#039; used by the question to be moved, the calculated question can be selected to move to the other category .&lt;br /&gt;
## If &#039;&#039;&#039;all&#039;&#039;&#039; the questions that are selected to be moved, and &#039;&#039;&#039;all&#039;&#039;&#039; the sharable datasets are only used by these questions to be moved, this set of questions can be selected to move to the other category .&lt;br /&gt;
## In the case that there are questions not selected that could used a sharable dataset, this dataset cannot be moved in the another category.&lt;br /&gt;
###Notify the user that another questions in the initial category share a parameter with this category.&lt;br /&gt;
####The user can choose to cancel the move and select all the other questions (Case 2.2).&lt;br /&gt;
####The user can choose to keep the question in the selected questions to be moved. In this case, the dataset should be duplicated when moving the another category.&lt;br /&gt;
===Duplicate datasets?===&lt;br /&gt;
If a similar sharable dataset already exists in the moveto category ( identical dataset-&amp;gt;name and dataset-&amp;gt;category = movetocategory).&lt;br /&gt;
Notify the user and giving information on the&lt;br /&gt;
#sharable dataset in selected questions to be moved &lt;br /&gt;
#already existing sharable datasets in the move_to_category.&lt;br /&gt;
The user should be able to select which dataset will be used in move_to_category.&lt;br /&gt;
&lt;br /&gt;
To implement these choices we need to add new functions in default questiontype class.&lt;br /&gt;
===function movable_to_category(&amp;amp;$questions,$categoryid)===&lt;br /&gt;
 default return null &lt;br /&gt;
 $questions contain all the question records data for all the selected questions &lt;br /&gt;
 so that qtype implementation could test &amp;lt;br&amp;gt;if the selected questions satisfy option 2.2&lt;br /&gt;
 a $questions-&amp;gt;notify can be added to be used by showbank.php and move_to_category.&lt;br /&gt;
===function move_to_category($question,$tocategory)=== &lt;br /&gt;
the default implementation should something like the actual code&lt;br /&gt;
  {&lt;br /&gt;
           if (!set_field(&#039;question&#039;, &#039;category&#039;, $tocategory-&amp;gt;id, &#039;id&#039;, $question-&amp;gt;id)) {&lt;br /&gt;
                            error(&#039;Could not update category field&#039;);&lt;br /&gt;
                        }&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
the calculated question implementation should be able to duplicate the datasets in the new category&lt;br /&gt;
&lt;br /&gt;
==Improvements in general question editing interface==&lt;br /&gt;
*Showing the text of the questions&lt;br /&gt;
&lt;br /&gt;
==Creation of a short (simple) calculated question==&lt;br /&gt;
The actual calculated question allows for calculated params that can be shared by different problems.&lt;br /&gt;
This could lead to a somewhat cloze used of calculated questions.However the questions cannot migrate individually to another category.&lt;br /&gt;
A short calculated question that just allow for calculated parameters reserved for this question will allow use of this question in drag and drop cloze lesson.&lt;br /&gt;
==Manipulating data items==&lt;br /&gt;
Actual functions and propôsal for new ones for manipulating data items are discussed in [[Data_Item_Functions]]&lt;br /&gt;
==Side effects to other modules==&lt;br /&gt;
* Modification of the question type to allow moving of calculated question to another category.&lt;br /&gt;
* Creation of general functions to standardize the import or export process.&lt;br /&gt;
&lt;br /&gt;
  [[User:Pierre Pichet|Pierre Pichet]]  August 2006 (WST)&lt;br /&gt;
[[Developer_notes]]&lt;br /&gt;
[[Calculated question creation developper docs]]&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development_talk:Quiz_rewrite&amp;diff=20021</id>
		<title>Development talk:Quiz rewrite</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development_talk:Quiz_rewrite&amp;diff=20021"/>
		<updated>2007-02-07T02:59:49Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Shouldn&#039;t the name of the article have a &amp;quot;Development:&amp;quot; prefix.  Took a lot of time to reach.  I see some of the articles in this category are prefixed with &amp;quot;Development:&amp;quot; while others are not.  Any special significance.&lt;br /&gt;
&lt;br /&gt;
[[User:vikram solia|vikram solia]] 20:59, 6 February 2007 (CST)&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:Quiz_rewrite&amp;diff=20019</id>
		<title>Development:Quiz rewrite</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:Quiz_rewrite&amp;diff=20019"/>
		<updated>2007-02-07T02:44:44Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: Restored in Development Category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below are some details of the rewrite that the quiz module code received in early 2005. These notes were written while the work was in progress and I intend to go through them soon and update them --[[User:Gustav|Gustav]] 19:34, 28 January 2006 (WST)&lt;br /&gt;
&lt;br /&gt;
===Question sessions and question states===&lt;br /&gt;
&lt;br /&gt;
The concept of a question session is made much more explicit. The question session runs from the moment the student first sees the question in a quiz attempt to the close of the attempt (or the close of the quiz in the case where further attempts at the quiz are allowed and are set to build upon previous attempts). Every interaction the student makes with the quiz can update the question sessions, creating a new question state. These question states are also saved in the database. The quiz_responses table has been renamed and adapted for this; it is now called quiz_states. It is possible to load a quiz attempt with the questions in any of the saved states.&lt;br /&gt;
&lt;br /&gt;
The question types are now asked to save any session information, including the most recent student responses, which may be specific to them via some new methods. The newly saved state is passed so that the question type may define its own tables to save this information in using the state id to reference which attempt and state the information is for. This deprecates the response answer field mechanism for response storage (although the field remains and can be used if desired).&lt;br /&gt;
&lt;br /&gt;
===Creating new question states===&lt;br /&gt;
&lt;br /&gt;
New states can be created without a question being graded. This occurs for example when a student navigates between pages (when the quiz is set to display a limited number of questions per page). Therefore another state object is loaded giving the most recent state for which grading occurred (or the initial state if grading has not occurred yet). Some parts of the rendered output for a question will depend on the current state while others will depend on the most recently graded state. For example the feedback (if any), grading details and correct answers (if any) will depend on the most recently graded state whereas the answer filled into any interactions will depend on the current state. The state object for the current state contains the most recently graded state.&lt;br /&gt;
&lt;br /&gt;
Note that grading always occurs and the raw grade (the grade for the individual submission ignoring any previous attempts at the question and any penalties incurred for them) and penalty are always saved. This information has been found to be useful in the past; eg. credit can be awarded when a student saves the correct answer but never submits it for grading and they have a good reason why they were unable to. Each state indicates the kind of event which occurred to create it. As well as the obvious events (creation of the question session, navigating between pages, saving the answers and grading the answers) we also provide support for question types which want to implement validation (where the syntax of an answer is checked and any syntax errors are displayed but the question is not graded and no feedback is displayed) with a validation event. Furthermore, the immediate resubmission of the same (or an equivalent) answer is checked for using a question type specific comparison method (which might ignore whitespace changes for example). In this case the submission is not graded (a new state is created as for a save but with a special event code) and a warning is printed (unless the question type overrides the print_question method). A quiz option has been added which causes the entire history of states for which marking was requested to be walked with the same behaviour if a match is found.&lt;br /&gt;
&lt;br /&gt;
===Question object and State object===&lt;br /&gt;
&lt;br /&gt;
We are attempting to keep the question information and the session (runtime) information clearly separated in the code. Many of the question type object methods have been changed to accept a question object and a state object (giving the most recent state of the session). These are passed by reference in most cases allowing any updates to the information to be made and retained between method calls. In particular the question type specific question information is loaded once for each page by a new get_options method (a counterpart to save_options) so that the database query need not be repeated in every method call. As part of the separation the responses are put in the state object rather than the question object.&lt;br /&gt;
&lt;br /&gt;
===Towards question type objects===&lt;br /&gt;
&lt;br /&gt;
We are attempting to make it easier to change the object model used to one where the question type objects are used directly. In other words the question object parameter could be removed and changed to to $this in the code. Then each question type would define the data elements it requires and would inherit standard ones from the default question type. PHP class support is probably not ready for this change yet though.&lt;br /&gt;
&lt;br /&gt;
===Towards dropping the quiz questions field===&lt;br /&gt;
&lt;br /&gt;
We will not be dropping the quiz questions field yet as this requires too much work to update the editing interface etc. However we will be making the code ready for this change by using the legacy field only for the order of the questions. The quiz_question_grades table (which really defines the question instances, i.e. which questions are used in each quiz) is used to load the question ids for the quiz and the maximum grades which have been assigned to them. The array is then ordered using the quiz questions field. In the future a field could be added to the quiz_question_grades table which we could order by in the database query and then the quiz questions field could be removed.&lt;br /&gt;
&lt;br /&gt;
===Towards sections and subquestions===&lt;br /&gt;
&lt;br /&gt;
The work towards allowing question types which wrap a number of others and display all of them (eg. to create sections) has been incorporated so that the methods to print a question / part of a question are now passed either an index to the wrapped question to print or two indices indicating the range of questions to be printed.&lt;br /&gt;
&lt;br /&gt;
The improved support for questions of different lengths will allow question types to be developed to provide sections (eg. to group a description and a question so that they are always displayed together and in the same order even when shuffling is enabled), subquestions (i.e. a question type with length one which wraps multiple questions and numbers them &amp;quot;1. a)&amp;quot;, &amp;quot;1. b)&amp;quot; etc.) and question types for using a sequence of questions from a content package (note that the quiz object containing all the settings is now passed to many of the question type methods so that they can adapt to the quiz settings - in this case the order could be shuffled if shuffling is enabled for the quiz with the order chosen saved as part of the question session). Note that we shall not actually implement any of these!&lt;br /&gt;
&lt;br /&gt;
The length of a question (i.e. how many question numbers are to be assigned to the question - this can be zero, eg. for the description type) has been made question specific (to allow for question types which wrap a variable number of questions into one unit) by adding a field to the quiz_questions table. The actual_number_of_questions method remains in the question types and is called by the default implementation of the save_question method to set the new field.&lt;br /&gt;
&lt;br /&gt;
===Quiz navigation===&lt;br /&gt;
&lt;br /&gt;
The code to display a limited number of questions on each page has also been improved. When each attempt is started the question order and page breaks are worked out (the questions are shuffled if this is turned on for the quiz). This information is saved when the attempt is created. Hence the same order is used when the student returns to the attempt and when the student or the teacher reviews the attempt (at present the review page order changes every time when the quiz is set to shuffle). Questions with length greater than one are allowed to span page breaks (using the new indices to the question type printing methods). In other words the &amp;quot;questionsperpage&amp;quot; property is taken to mean the number of question numbers per page and so questions with length zero do not count.&lt;br /&gt;
&lt;br /&gt;
Once the layout of every page has been calculated (or reloaded), only those questions which are required for the current page are loaded. Those question objects then have the question type specific information loaded into them and the question sessions are restored to the relevant state. The state objects are given the question number assigned and the name prefixes at this stage so there is no need to calculate them later. The maximum available grades are also loaded into the question object (actually the &amp;quot;instance&amp;quot; objects - i.e. rows from the quiz_question_grades table - are loaded first but the effect is the same). The currently obtained grades are already stored in the database for each state.&lt;br /&gt;
&lt;br /&gt;
Having restored the attempt and the question sessions, grading (if required) and printing can occur. Since all the required data is already loaded and made available the code in the question types to do this can be simplified slightly and the process is made more efficient (especially since only those questions which are used are considered).&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:Quiz_rewrite&amp;diff=20018</id>
		<title>Development:Quiz rewrite</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:Quiz_rewrite&amp;diff=20018"/>
		<updated>2007-02-07T02:40:47Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: Changed Category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below are some details of the rewrite that the quiz module code received in early 2005. These notes were written while the work was in progress and I intend to go through them soon and update them --[[User:Gustav|Gustav]] 19:34, 28 January 2006 (WST)&lt;br /&gt;
&lt;br /&gt;
===Question sessions and question states===&lt;br /&gt;
&lt;br /&gt;
The concept of a question session is made much more explicit. The question session runs from the moment the student first sees the question in a quiz attempt to the close of the attempt (or the close of the quiz in the case where further attempts at the quiz are allowed and are set to build upon previous attempts). Every interaction the student makes with the quiz can update the question sessions, creating a new question state. These question states are also saved in the database. The quiz_responses table has been renamed and adapted for this; it is now called quiz_states. It is possible to load a quiz attempt with the questions in any of the saved states.&lt;br /&gt;
&lt;br /&gt;
The question types are now asked to save any session information, including the most recent student responses, which may be specific to them via some new methods. The newly saved state is passed so that the question type may define its own tables to save this information in using the state id to reference which attempt and state the information is for. This deprecates the response answer field mechanism for response storage (although the field remains and can be used if desired).&lt;br /&gt;
&lt;br /&gt;
===Creating new question states===&lt;br /&gt;
&lt;br /&gt;
New states can be created without a question being graded. This occurs for example when a student navigates between pages (when the quiz is set to display a limited number of questions per page). Therefore another state object is loaded giving the most recent state for which grading occurred (or the initial state if grading has not occurred yet). Some parts of the rendered output for a question will depend on the current state while others will depend on the most recently graded state. For example the feedback (if any), grading details and correct answers (if any) will depend on the most recently graded state whereas the answer filled into any interactions will depend on the current state. The state object for the current state contains the most recently graded state.&lt;br /&gt;
&lt;br /&gt;
Note that grading always occurs and the raw grade (the grade for the individual submission ignoring any previous attempts at the question and any penalties incurred for them) and penalty are always saved. This information has been found to be useful in the past; eg. credit can be awarded when a student saves the correct answer but never submits it for grading and they have a good reason why they were unable to. Each state indicates the kind of event which occurred to create it. As well as the obvious events (creation of the question session, navigating between pages, saving the answers and grading the answers) we also provide support for question types which want to implement validation (where the syntax of an answer is checked and any syntax errors are displayed but the question is not graded and no feedback is displayed) with a validation event. Furthermore, the immediate resubmission of the same (or an equivalent) answer is checked for using a question type specific comparison method (which might ignore whitespace changes for example). In this case the submission is not graded (a new state is created as for a save but with a special event code) and a warning is printed (unless the question type overrides the print_question method). A quiz option has been added which causes the entire history of states for which marking was requested to be walked with the same behaviour if a match is found.&lt;br /&gt;
&lt;br /&gt;
===Question object and State object===&lt;br /&gt;
&lt;br /&gt;
We are attempting to keep the question information and the session (runtime) information clearly separated in the code. Many of the question type object methods have been changed to accept a question object and a state object (giving the most recent state of the session). These are passed by reference in most cases allowing any updates to the information to be made and retained between method calls. In particular the question type specific question information is loaded once for each page by a new get_options method (a counterpart to save_options) so that the database query need not be repeated in every method call. As part of the separation the responses are put in the state object rather than the question object.&lt;br /&gt;
&lt;br /&gt;
===Towards question type objects===&lt;br /&gt;
&lt;br /&gt;
We are attempting to make it easier to change the object model used to one where the question type objects are used directly. In other words the question object parameter could be removed and changed to to $this in the code. Then each question type would define the data elements it requires and would inherit standard ones from the default question type. PHP class support is probably not ready for this change yet though.&lt;br /&gt;
&lt;br /&gt;
===Towards dropping the quiz questions field===&lt;br /&gt;
&lt;br /&gt;
We will not be dropping the quiz questions field yet as this requires too much work to update the editing interface etc. However we will be making the code ready for this change by using the legacy field only for the order of the questions. The quiz_question_grades table (which really defines the question instances, i.e. which questions are used in each quiz) is used to load the question ids for the quiz and the maximum grades which have been assigned to them. The array is then ordered using the quiz questions field. In the future a field could be added to the quiz_question_grades table which we could order by in the database query and then the quiz questions field could be removed.&lt;br /&gt;
&lt;br /&gt;
===Towards sections and subquestions===&lt;br /&gt;
&lt;br /&gt;
The work towards allowing question types which wrap a number of others and display all of them (eg. to create sections) has been incorporated so that the methods to print a question / part of a question are now passed either an index to the wrapped question to print or two indices indicating the range of questions to be printed.&lt;br /&gt;
&lt;br /&gt;
The improved support for questions of different lengths will allow question types to be developed to provide sections (eg. to group a description and a question so that they are always displayed together and in the same order even when shuffling is enabled), subquestions (i.e. a question type with length one which wraps multiple questions and numbers them &amp;quot;1. a)&amp;quot;, &amp;quot;1. b)&amp;quot; etc.) and question types for using a sequence of questions from a content package (note that the quiz object containing all the settings is now passed to many of the question type methods so that they can adapt to the quiz settings - in this case the order could be shuffled if shuffling is enabled for the quiz with the order chosen saved as part of the question session). Note that we shall not actually implement any of these!&lt;br /&gt;
&lt;br /&gt;
The length of a question (i.e. how many question numbers are to be assigned to the question - this can be zero, eg. for the description type) has been made question specific (to allow for question types which wrap a variable number of questions into one unit) by adding a field to the quiz_questions table. The actual_number_of_questions method remains in the question types and is called by the default implementation of the save_question method to set the new field.&lt;br /&gt;
&lt;br /&gt;
===Quiz navigation===&lt;br /&gt;
&lt;br /&gt;
The code to display a limited number of questions on each page has also been improved. When each attempt is started the question order and page breaks are worked out (the questions are shuffled if this is turned on for the quiz). This information is saved when the attempt is created. Hence the same order is used when the student returns to the attempt and when the student or the teacher reviews the attempt (at present the review page order changes every time when the quiz is set to shuffle). Questions with length greater than one are allowed to span page breaks (using the new indices to the question type printing methods). In other words the &amp;quot;questionsperpage&amp;quot; property is taken to mean the number of question numbers per page and so questions with length zero do not count.&lt;br /&gt;
&lt;br /&gt;
Once the layout of every page has been calculated (or reloaded), only those questions which are required for the current page are loaded. Those question objects then have the question type specific information loaded into them and the question sessions are restored to the relevant state. The state objects are given the question number assigned and the name prefixes at this stage so there is no need to calculate them later. The maximum available grades are also loaded into the question object (actually the &amp;quot;instance&amp;quot; objects - i.e. rows from the quiz_question_grades table - are loaded first but the effect is the same). The currently obtained grades are already stored in the database for each state.&lt;br /&gt;
&lt;br /&gt;
Having restored the attempt and the question sessions, grading (if required) and printing can occur. Since all the required data is already loaded and made available the code in the question types to do this can be simplified slightly and the process is made more efficient (especially since only those questions which are used are considered).&lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Groups_FAQ&amp;diff=11566</id>
		<title>Groups FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Groups_FAQ&amp;diff=11566"/>
		<updated>2006-06-04T12:48:02Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: /* What is the &amp;#039;force&amp;#039; setting? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General==&lt;br /&gt;
===What is the &#039;groups mode&#039; setting?===&lt;br /&gt;
&lt;br /&gt;
There are three different groups mode – No groups, Separate Groups, Visible Groups. In ‘Separate groups’ mode, each group can only see their own group – other groups are invisible. In ‘Visible groups’ mode, each group works in their own group, but can also see other groups. &lt;br /&gt;
&lt;br /&gt;
===What is the &#039;force&#039; setting?===&lt;br /&gt;
&lt;br /&gt;
If force is set to yes, then all activities are group activities. This overrides any settings for individual activities.  If force is set to no, then activities are only group activities if they have been set to group mode.  In this case, each activity requires to be set to group mode individually.&lt;br /&gt;
&lt;br /&gt;
===How do I assign a teacher to a group? Can a teacher be in more than one group?===&lt;br /&gt;
&lt;br /&gt;
You can assign a teacher to a group in exactly the same way that you assign a student to a group. In 1.5, a teacher cannot be in more than one group. This will change in 1.6. &lt;br /&gt;
&lt;br /&gt;
===How do I restrict a teacher to view only information about the groups that they are in?===&lt;br /&gt;
&lt;br /&gt;
For Separate Groups mode, if a teacher has edit rights set to yes, then they can see all groups. If a teacher has edit rights set to no, then they can see only the groups of which they are a member. &lt;br /&gt;
&lt;br /&gt;
===What determines whether students can see a teacher&#039;s profile?===&lt;br /&gt;
&lt;br /&gt;
A student can see the profile of all teachers that are members of their group or that have edit rights. &lt;br /&gt;
&lt;br /&gt;
===I have two groups that meet on different days. Can I set up activities for different times for the two groups?===&lt;br /&gt;
&lt;br /&gt;
Not currently. You can create a separate course for each class using backup and restore, though you do then have to update both courses. &lt;br /&gt;
&lt;br /&gt;
===Can I use the same groups for more than one course?===&lt;br /&gt;
&lt;br /&gt;
Not currently. There are two possible workarounds for this. The first is to give the students group enrolment keys, so they enrol themselves into the right group for each course. The other alternative is to create a master course with all the students enrolled and in the correct groups, and then to make each of the courses a metacourse (link) based on that master course (although the metacourse documentation claims that metacourses do not preserve groups, this seems to have been used by some people). See the documentation on [[Metacourses]]. &lt;br /&gt;
&lt;br /&gt;
===Can a student be a member of more than one group? Is it possible to have students not in any group?===&lt;br /&gt;
&lt;br /&gt;
In 1.5, a student cannot be a member of more than one group. This will change in 1.6. A student does not need to be in a group. &lt;br /&gt;
&lt;br /&gt;
===If I have several groups, can I make a specific activity visible to just one of those groups?===&lt;br /&gt;
&lt;br /&gt;
Not currently. You can however make a forum post visible to just one group. &lt;br /&gt;
&lt;br /&gt;
===Can I have one set of groups for Activity A and another set of groups for Activity B?===&lt;br /&gt;
&lt;br /&gt;
Not currently. &lt;br /&gt;
&lt;br /&gt;
===Is it possible to view all the groups in a course as a list to print out?===&lt;br /&gt;
&lt;br /&gt;
Not currently. &lt;br /&gt;
&lt;br /&gt;
===When I try to add a student, they are always added to the first group, whichever group I select?===&lt;br /&gt;
&lt;br /&gt;
Make sure that the students name does not include any punctuation. There is also a workaround – give each group a temporary name at the start of the alphabet, put your students in the group and then rename the group. &lt;br /&gt;
&lt;br /&gt;
==Activity modules and groups==&lt;br /&gt;
&lt;br /&gt;
Different activity modules vary as to how they treat groups – some have better support for groups than others! In general if you have questions about how an activity supports groups, you’re advised to post in the forum for the activity module, and not the groups forum. &lt;br /&gt;
&lt;br /&gt;
===What happens if I switch an activity from being in non-groups mode to being in groups mode?===&lt;br /&gt;
&lt;br /&gt;
This depends on the activity module in question.&lt;br /&gt;
&lt;br /&gt;
For forums, posts made before the forum is put into groups mode are visible to all students after you have put the forum into group mode. However students cannot reply to these posts if they have no group (i.e. blank). &lt;br /&gt;
&lt;br /&gt;
===What happens if I change the groups for an activity in groups mode e.g. if I move a student from one group to another?===&lt;br /&gt;
&lt;br /&gt;
Again this depends on the activity module. You may find that grades or activity logs are lost, so check for the specific activity module first. &lt;br /&gt;
&lt;br /&gt;
===How do I post a message in a forum that only one group can see?===&lt;br /&gt;
&lt;br /&gt;
Before you click &#039;Add a new topic&#039;, you need to choose the group from the Separate groups drop-down menu at the top left. &lt;br /&gt;
&lt;br /&gt;
===As a teacher I want to put the same post in each group&#039;s forum with students able to reply to that post. How can I do this?===&lt;br /&gt;
&lt;br /&gt;
You need to post the same message into the forum for each group. There is currently no way to do this in one go if you want students to be able to reply to your post. If you don&#039;t mind students not being able to reply, then you can of course just post the message to all participants.&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=User:Vikram_solia&amp;diff=6221</id>
		<title>User:Vikram solia</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=User:Vikram_solia&amp;diff=6221"/>
		<updated>2006-02-22T08:41:39Z</updated>

		<summary type="html">&lt;p&gt;Taatparya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;co-Founder of vidyaweb.com&lt;/div&gt;</summary>
		<author><name>Taatparya</name></author>
	</entry>
</feed>