-

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

Location: Difference between revisions

From MoodleDocs
No edit summary
 
(29 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{Admin tools}}
{{Managing a Moodle site}}
==Location settings==
==Location settings==
An administrator can change the following location settings in ''Administration > Site administration > Location > Location settings''.
An administrator can change the following location settings in ''Administration > Site administration > Location > Location settings''.


====Default timezone====
===Time zone settings===


This sets the default timezone for date display.
The time zone is used to help convert the raw timestamps in the database to human readable dates and times, for the user who is requesting the page.  


Be sure to first download and/or update the complete list of timezones from ''Site administration > Location > Update timezones''.  An out-of-the-box new installation of Moodle has only a few UTC time zone settings in this list. If you see only those, first update the list.
====Default time zone====
Use this to set the default time zone for your site. This should be the time zone that most users use, or if that is difficult, where you  When available, choose the Area/Location that is proper for you rather than use the UTC settings. These [http://en.wikipedia.org/wiki/Tz_database names are standardized by the IANA].  


Is it '''recommended''' that you select a named timezone specific to your region (e.g. America/New_York) instead of a UTC setting if one is available. These settings are aware of [[https://en.wikipedia.org/wiki/Daylight_saving_time local time zone shifts]] such as Summer Time or Daylight Savings Time while UTC is not.  
Note: As of Moodle 2.9, the older setting and button to allow you to update time zone codes from Moodle.org has been replaced with standard PHP date and time code. If your PHP version is over 6 months old, time zone data should be updated using the [http://pecl.php.net/package/timezonedb PECL timezonedb package].


"Server's local time" here will make Moodle default to the server timezone as defined by the “Default timezone” setting in PHP.
====Force timezone====
If a particular time zone is forced, users will see the name of the time zone on their edit profile page and will be not be able to change it. If you wish to allow individual users to choose their own time zone, leave this at the default "Users can choose their own time zone."


(When this term appears in the user profile it means something slightly different. See the next setting for more.)
====Show a warning when the user might have a different timezone====
* You can detect the timezone of the user in the browser (see https://stackoverflow.com/questions/6939685/get-client-time-zone-from-browser) using:


====Force default timezone====
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
Pull down menu to force the user to be in a specific timezone or allow users to individually select their timezone.
console.log(tz)


This is off by default because when new users are created they will inherit the system default anyway, but are allowed to change it to another location if the are in another time zone or traveling, for instance.
* Compare the result with the users setting and throw a warning that the user is in a different timezone and times could be wrong.


Note: It is important to understand that setting "Server's local time" in a '''User profile''' ''> Timezone'' means whatever is set in the Moodle default timezone. So if the Moodle site default timezone is set, for example, to America/Montreal, the user will not see that in their profile, but will see "Server's local time" instead, but it means America/Montreal.  
====Default country====
Select the country to appear by default on a new user account page form.  


If you do force a timezone for all users, then they will see an explicit timezone instead such as America/Montreal, and will not be able to change it.
==== Default city====
 
Enter a default city for new user profiles. This may be left blank.
====Default country====
Select the country to appear by default on a new user account page form.


===IP address lookup===
===IP address lookup===
====GeoIP City data file====
====GeoIP City data file====
Location of GeoIP City binary data file. This is a non-invasive way to determine geographical and other information about  Internet visitors in real-time. This file is not part of Moodle distribution and must be obtained separately from MaxMind.  There is a GeoIPLite version for free.
Location of GeoIP City binary data file. This is a non-invasive way to determine geographical and other information about  Internet visitors in real-time. This file is not part of Moodle distribution and must be obtained separately from MaxMind.  


====Google Maps API key====
Google Maps for IP address lookup visualization key. The Google Maps API lets you embed Google Maps with JavaScript.  This is free.


'''NOTE:''' There is no longer support for Google maps API V2 as it has been deprecated since 2010. V3 is now used. See here for details: https://developers.google.com/maps/documentation/javascript/tutorial#api_key
There is a GeoIPLite version for free at [https://dev.maxmind.com/geoip/geoip2/geolite2/ https://dev.maxmind.com/geoip/geoip2/geolite2/]. You do need to create a free account to download it. Download the GeoLite2 City GZIP file from the "Download files" area once you have been granted access from registering with dev.maxmind.com. Extract the GeoLiteCity.mmdb file from that GZIP file and upload it to /moodledata/geoip/GeoLiteCity.mmdb.


After updating the information in this section, IP's that are displayed as a link, such as in reports, when clicked will open new window with a Google Map indicating the location of the IP, if found and if not a private address.
Since Moodle 3.2 looking up IPv6 addresses using the [http://dev.maxmind.com/geoip/geoip2/geolite2/ GeoLite2] database from [http://www.maxmind.com/ Maxmind] is supported (more info [https://docs.moodle.org/32/en/Upgrading#IP_address_lookups here]). This replaces the existing GeoLite legacy database used in previous versions and the new GeoIP2 database will need to be installed to use this functionality. See [https://dev.maxmind.com/geoip/geoip2/geolite2/ maxmind.com page] for how to obtain the database.


==Update timezones==
You can check to see if the GeoIP data file is available to Moodle by going to: Administration > Site administration > Location > Location settings, under IP Address Lookup.


The update timezones page ''Site administration > Location > Update timezones'' provides administrators with the option to update their local database with new information about world timezones.  
====Google Maps API key====
Google Maps for IP address lookup visualization key. The Google Maps API lets you embed Google Maps with JavaScript.  This is free.


This is important because of [http://en.wikipedia.org/wiki/Daylight_saving_time daylight saving] changes that many countries  use. You should generally use these regional location settings in preference to UTC unless you have a very specific reason to use UTC instead.
'''NOTE:''' There is no longer support for Google maps API V2 as it has been deprecated since 2010. V3 is now used. See here for details: https://developers.google.com/maps/documentation/javascript/tutorial#api_key
 
If the update is completed with success, Moodle will inform you how many entries were updated and which location was used as a source.
 
This naming convention on the list of Area/Location is based on the IANA Time Zone standard: see [[https://en.wikipedia.org/wiki/Tz_database#Names_of_time_zones here for more details]].


Typically, there will be one major city or location chosen to represent the time zone. Countries are not used. So you will need to pick the representative city or location for the time zone you wish Moodle to use.
After updating the information in this section, IPs that are displayed as a link, such as in reports, when clicked will open new window with a Google Map indicating the location of the IP, if found and if not a private address.


For example, the following are the standard time zones in the continental U.S.:
====All country codes====
* America/New_York = Eastern Time
This is the list of countries that may be selected in various places, for example in a user's profile. If blank (the default) the list in countries.php in the standard English language pack is used. Otherwise, you can specify a comma-separated list of codes, for example 'GB,FR,ES' in [http://en.wikipedia.org/wiki/ISO_3166-1 ISO-3166-1 format].
* America/Chicago = Central Time
* America/Denver = Mountain Time
* America/Los_Angeles = Pacific Time


However, if you live in the state of Arizona, which does not observe Daylight Savings Time, you should choose America/Phoenix instead of America/Denver in order to properly observer the time change twice a year. Likewise for other exceptional areas in some states like Indiana, which have local time zone changes.
The list of countries is based on the ISO 3166 list of official country short names, but is not exactly the same. See the comment in MDL-56181 for more details.


==See also==
*[http://youtu.be/L-_2N9gIiLo Moodle 2 Administration - Location]  MoodleBites video on YouTube 


[[es:Localización]]
[[es:Localización]]
[[eu:Kokagunea]]
[[eu:Kokagunea]]
[[de:Lokales]]
[[fr:Localisation]]

Latest revision as of 11:10, 16 April 2021

Location settings

An administrator can change the following location settings in Administration > Site administration > Location > Location settings.

Time zone settings

The time zone is used to help convert the raw timestamps in the database to human readable dates and times, for the user who is requesting the page.

Default time zone

Use this to set the default time zone for your site. This should be the time zone that most users use, or if that is difficult, where you When available, choose the Area/Location that is proper for you rather than use the UTC settings. These names are standardized by the IANA.

Note: As of Moodle 2.9, the older setting and button to allow you to update time zone codes from Moodle.org has been replaced with standard PHP date and time code. If your PHP version is over 6 months old, time zone data should be updated using the PECL timezonedb package.

Force timezone

If a particular time zone is forced, users will see the name of the time zone on their edit profile page and will be not be able to change it. If you wish to allow individual users to choose their own time zone, leave this at the default "Users can choose their own time zone."

Show a warning when the user might have a different timezone

const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(tz)
  • Compare the result with the users setting and throw a warning that the user is in a different timezone and times could be wrong.

Default country

Select the country to appear by default on a new user account page form.

Default city

Enter a default city for new user profiles. This may be left blank.

IP address lookup

GeoIP City data file

Location of GeoIP City binary data file. This is a non-invasive way to determine geographical and other information about Internet visitors in real-time. This file is not part of Moodle distribution and must be obtained separately from MaxMind.


There is a GeoIPLite version for free at https://dev.maxmind.com/geoip/geoip2/geolite2/. You do need to create a free account to download it. Download the GeoLite2 City GZIP file from the "Download files" area once you have been granted access from registering with dev.maxmind.com. Extract the GeoLiteCity.mmdb file from that GZIP file and upload it to /moodledata/geoip/GeoLiteCity.mmdb.

Since Moodle 3.2 looking up IPv6 addresses using the GeoLite2 database from Maxmind is supported (more info here). This replaces the existing GeoLite legacy database used in previous versions and the new GeoIP2 database will need to be installed to use this functionality. See maxmind.com page for how to obtain the database.

You can check to see if the GeoIP data file is available to Moodle by going to: Administration > Site administration > Location > Location settings, under IP Address Lookup.

Google Maps API key

Google Maps for IP address lookup visualization key. The Google Maps API lets you embed Google Maps with JavaScript. This is free.

NOTE: There is no longer support for Google maps API V2 as it has been deprecated since 2010. V3 is now used. See here for details: https://developers.google.com/maps/documentation/javascript/tutorial#api_key

After updating the information in this section, IPs that are displayed as a link, such as in reports, when clicked will open new window with a Google Map indicating the location of the IP, if found and if not a private address.

All country codes

This is the list of countries that may be selected in various places, for example in a user's profile. If blank (the default) the list in countries.php in the standard English language pack is used. Otherwise, you can specify a comma-separated list of codes, for example 'GB,FR,ES' in ISO-3166-1 format.

The list of countries is based on the ISO 3166 list of official country short names, but is not exactly the same. See the comment in MDL-56181 for more details.