|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
| enum BLOG_COURSE_LEVEL |
Definition at line 351 of file moodlelib.php.
| enum BLOG_GLOBAL_LEVEL |
Definition at line 353 of file moodlelib.php.
| enum BLOG_GROUP_LEVEL |
Definition at line 350 of file moodlelib.php.
| enum BLOG_SITE_LEVEL |
Definition at line 352 of file moodlelib.php.
| enum BLOG_USER_LEVEL |
Blog access level constant declaration ///.
Definition at line 349 of file moodlelib.php.
| enum DAYMINS |
Time constant - the number of minutes in a day
Definition at line 65 of file moodlelib.php.
| enum DAYSECS |
Time constant - the number of seconds in a day
Definition at line 50 of file moodlelib.php.
Security token used for allowing access of embedded applications, the code is executed in the active user session. Token is invalidated after user logs out. Scripts are executed serially - normal session locking is used.
Definition at line 436 of file moodlelib.php.
Security token used for allowing access from external application such as web services. Scripts do not use any session, performance is relatively low because we need to load access info in each request. Scripts are executed in parallel.
Definition at line 428 of file moodlelib.php.
True if module supports advanced grading methods
Definition at line 380 of file moodlelib.php.
True if module supports backup/restore of moodle2 format
Definition at line 409 of file moodlelib.php.
| enum FEATURE_COMMENT |
Definition at line 405 of file moodlelib.php.
True if module has custom completion rules
Definition at line 385 of file moodlelib.php.
True if module has code to track whether somebody viewed it
Definition at line 383 of file moodlelib.php.
Feature constants ///.
True if module can provide a grade
Definition at line 376 of file moodlelib.php.
True if module supports outcomes
Definition at line 378 of file moodlelib.php.
| enum FEATURE_GROUPINGS |
True if module supports groupings
Definition at line 394 of file moodlelib.php.
True if module supports groupmembersonly
Definition at line 396 of file moodlelib.php.
| enum FEATURE_GROUPS |
True if module supports groups
Definition at line 392 of file moodlelib.php.
| enum FEATURE_IDNUMBER |
True if module supports outcomes
Definition at line 390 of file moodlelib.php.
Type of module
Definition at line 399 of file moodlelib.php.
| enum FEATURE_MOD_INTRO |
True if module supports intro editor
Definition at line 401 of file moodlelib.php.
True if module has default completion
Definition at line 403 of file moodlelib.php.
| enum FEATURE_NO_VIEW_LINK |
True if module has no 'view' page (like label)
Definition at line 388 of file moodlelib.php.
| enum FEATURE_RATE |
Definition at line 407 of file moodlelib.php.
True if module can show description on course main page
Definition at line 412 of file moodlelib.php.
Get remote addr constant
Definition at line 344 of file moodlelib.php.
Get remote addr constant
Definition at line 346 of file moodlelib.php.
| enum HOMEPAGE_MY |
The home page should be the users my page
Definition at line 445 of file moodlelib.php.
| enum HOMEPAGE_SITE |
The home page should be the site home
Definition at line 441 of file moodlelib.php.
| enum HOMEPAGE_USER |
The home page can be chosen by the user
Definition at line 449 of file moodlelib.php.
| enum HOURMINS |
Time constant - the number of minutes in an hour
Definition at line 70 of file moodlelib.php.
| enum HOURSECS |
Time constant - the number of seconds in an hour
Definition at line 55 of file moodlelib.php.
| enum HUB_HUBDIRECTORYURL |
Hub directory url (should be moodle.org)
Definition at line 454 of file moodlelib.php.
| enum HUB_MOODLEORGHUBURL |
Moodle.org url (should be moodle.org)
Definition at line 460 of file moodlelib.php.
| enum MINSECS |
Time constant - the number of seconds in a minute
Definition at line 60 of file moodlelib.php.
Assignment module archetype
Definition at line 419 of file moodlelib.php.
| enum MOD_ARCHETYPE_OTHER |
Unspecified module archetype
Definition at line 415 of file moodlelib.php.
Resource-like type module
Definition at line 417 of file moodlelib.php.
Moodle mobile app service name
Definition at line 465 of file moodlelib.php.
| enum NULL_ALLOWED |
NULL_ALLOWED - the parameter can be set to null in the database
Definition at line 335 of file moodlelib.php.
| enum NULL_NOT_ALLOWED |
NULL_NOT_ALLOWED - the parameter can not be set to null in the database
Definition at line 330 of file moodlelib.php.
| enum PAGE_COURSE_VIEW |
Page types ///.
PAGE_COURSE_VIEW is a definition of a page type. For more information on the page class see moodle/lib/pagelib.php.
Definition at line 341 of file moodlelib.php.
| enum PARAM_ACTION |
PARAM_ACTION - deprecated alias for PARAM_ALPHANUMEXT, use for various actions in forms and urls NOTE: originally alias for PARAM_APLHA
Definition at line 262 of file moodlelib.php.
| enum PARAM_ALPHA |
Parameter constants - every call to optional_param(), required_param() /// or clean_param() should have a specified type of parameter. ////////////// PARAM_ALPHA - contains only english ascii letters a-zA-Z.
Definition at line 80 of file moodlelib.php.
| enum PARAM_ALPHAEXT |
PARAM_ALPHAEXT the same contents as PARAM_ALPHA plus the chars in quotes: "_-" allowed NOTE: originally this allowed "/" too, please use PARAM_SAFEPATH if "/" needed
Definition at line 86 of file moodlelib.php.
| enum PARAM_ALPHANUM |
PARAM_ALPHANUM - expected numbers and letters only.
Definition at line 91 of file moodlelib.php.
| enum PARAM_ALPHANUMEXT |
PARAM_ALPHANUMEXT - expected numbers, letters only and _-.
Definition at line 96 of file moodlelib.php.
| enum PARAM_AREA |
PARAM_AREA is a name of area used when addressing files, comments, ratings, etc. It is usually used together with context id and component. Only lowercase ascii letters, numbers and underscores are allowed, it has to start with a letter.
Definition at line 300 of file moodlelib.php.
| enum PARAM_AUTH |
PARAM_AUTH - actually checks to make sure the string is a valid auth plugin
Definition at line 101 of file moodlelib.php.
| enum PARAM_BASE64 |
PARAM_BASE64 - Base 64 encoded format
Definition at line 106 of file moodlelib.php.
| enum PARAM_BOOL |
PARAM_BOOL - converts input into 0 or 1, use for switches in forms and urls.
Definition at line 111 of file moodlelib.php.
| enum PARAM_CAPABILITY |
PARAM_CAPABILITY - A capability name, like 'moodle/role:manage'. Actually checked against the list of capabilities in the database.
Definition at line 117 of file moodlelib.php.
| enum PARAM_CLEAN |
PARAM_CLEAN - obsoleted, please use a more specific type of parameter. It was one of the first types, that is why it is abused so much ;-)
Definition at line 246 of file moodlelib.php.
| enum PARAM_CLEANFILE |
PARAM_CLEANFILE - deprecated alias of PARAM_FILE; originally was removing regional chars too
Definition at line 285 of file moodlelib.php.
| enum PARAM_CLEANHTML |
PARAM_CLEANHTML - cleans submitted HTML code. use only for text in HTML format. This cleaning may fix xhtml strictness too.
Definition at line 122 of file moodlelib.php.
| enum PARAM_COMPONENT |
PARAM_COMPONENT is used for full component names (aka frankenstyle) such as 'mod_forum', 'core_rating', 'auth_ldap'. Short legacy subsystem names and module names are accepted too ex: 'forum', 'rating', 'user'. Only lowercase ascii letters, numbers and underscores are allowed, it has to start with a letter. NOTE: numbers and underscores are strongly discouraged in plugin names!
Definition at line 293 of file moodlelib.php.
| enum PARAM_EMAIL |
PARAM_EMAIL - an email address following the RFC
Definition at line 127 of file moodlelib.php.
| enum PARAM_FILE |
PARAM_FILE - safe file name, all dangerous chars are stripped, protects against XSS, SQL injections and directory traversals
Definition at line 132 of file moodlelib.php.
| enum PARAM_FLOAT |
PARAM_FLOAT - a real/floating point number.
Definition at line 137 of file moodlelib.php.
| enum PARAM_FORMAT |
PARAM_FORMAT - deprecated alias for PARAM_ALPHANUMEXT, use for names of plugins, formats, etc. NOTE: originally alias for PARAM_APLHA
Definition at line 268 of file moodlelib.php.
| enum PARAM_HOST |
PARAM_HOST - expected fully qualified domain name (FQDN) or an IPv4 dotted quad (IP address)
Definition at line 142 of file moodlelib.php.
| enum PARAM_INT |
PARAM_INT - integers only, use when expecting only numbers.
Definition at line 147 of file moodlelib.php.
| enum PARAM_INTEGER |
PARAM_INTEGER - deprecated alias for PARAM_INT
Definition at line 251 of file moodlelib.php.
| enum PARAM_LANG |
PARAM_LANG - checks to see if the string is a valid installed language in the current site.
Definition at line 152 of file moodlelib.php.
| enum PARAM_LOCALURL |
PARAM_LOCALURL - expected properly formatted URL as well as one that refers to the local server itself. (NOT orthogonal to the others! Implies PARAM_URL!)
Definition at line 157 of file moodlelib.php.
| enum PARAM_MULTILANG |
PARAM_MULTILANG - deprecated alias of PARAM_TEXT.
Definition at line 273 of file moodlelib.php.
| enum PARAM_NOTAGS |
PARAM_NOTAGS - all html tags are stripped from the text. Do not abuse this type.
Definition at line 162 of file moodlelib.php.
| enum string special value used by manual grading because link PARAM_NUMBER |
PARAM_NUMBER - deprecated alias of PARAM_FLOAT
converts '' to 0.
Definition at line 256 of file moodlelib.php.
| enum PARAM_PATH |
PARAM_PATH - safe relative path name, all dangerous chars are stripped, protects against XSS, SQL injections and directory traversals note: the leading slash is not removed, window drive letter is not allowed
Definition at line 168 of file moodlelib.php.
| enum PARAM_PEM |
PARAM_PEM - Privacy Enhanced Mail format
Definition at line 173 of file moodlelib.php.
| enum PARAM_PERMISSION |
PARAM_PERMISSION - A permission, one of CAP_INHERIT, CAP_ALLOW, CAP_PREVENT or CAP_PROHIBIT.
Definition at line 178 of file moodlelib.php.
| enum PARAM_PLUGIN |
PARAM_PLUGIN is used for plugin names such as 'forum', 'glossary', 'ldap', 'radius', 'paypal', 'completionstatus'. Only lowercase ascii letters, numbers and underscores are allowed, it has to start with a letter. NOTE: numbers and underscores are strongly discouraged in plugin names! Underscores are forbidden in module names.
Definition at line 307 of file moodlelib.php.
| enum PARAM_RAW |
PARAM_RAW specifies a parameter that is not cleaned/processed in any way except the discarding of the invalid utf-8 characters
Definition at line 183 of file moodlelib.php.
| enum PARAM_RAW_TRIMMED |
PARAM_RAW_TRIMMED like PARAM_RAW but leading and trailing whitespace is stripped.
Definition at line 188 of file moodlelib.php.
| enum PARAM_SAFEDIR |
PARAM_SAFEDIR - safe directory name, suitable for include() and require()
Definition at line 193 of file moodlelib.php.
| enum PARAM_SAFEPATH |
PARAM_SAFEPATH - several PARAM_SAFEDIR joined by "/", suitable for include() and require(), plugin paths, etc.
Definition at line 198 of file moodlelib.php.
| enum PARAM_SEQUENCE |
PARAM_SEQUENCE - expects a sequence of numbers like 8 to 1,5,6,4,6,8,9. Numbers and comma only.
Definition at line 203 of file moodlelib.php.
| enum PARAM_STRINGID |
PARAM_STRINGID - used to check if the given string is valid string identifier for get_string()
Definition at line 238 of file moodlelib.php.
| enum PARAM_TAG |
PARAM_TAG - one tag (interests, blogs, etc.) - mostly international characters and space, <> not supported
Definition at line 208 of file moodlelib.php.
| enum PARAM_TAGLIST |
PARAM_TAGLIST - list of tags separated by commas (interests, blogs, etc.)
Definition at line 213 of file moodlelib.php.
| enum PARAM_TEXT |
PARAM_TEXT - general plain text compatible with multilang filter, no other html tags. Please note '<', or '>' are allowed here.
Definition at line 218 of file moodlelib.php.
| enum PARAM_THEME |
PARAM_THEME - Checks to see if the string is a valid theme name in the current site
Definition at line 223 of file moodlelib.php.
| enum PARAM_TIMEZONE |
PARAM_TIMEZONE - expected timezone. Timezone can be int +-(0-13) or float +-(0.5-12.5) or string seperated by '/' and can have '-' &/ '_' (eg. America/North_Dakota/New_Salem America/Port-au-Prince)
Definition at line 280 of file moodlelib.php.
| enum PARAM_URL |
PARAM_URL - expected properly formatted URL. Please note that domain part is required, http://localhost/ is not accepted but http://localhost.localdomain/ is ok.
Definition at line 228 of file moodlelib.php.
| enum PARAM_USERNAME |
PARAM_USERNAME - Clean username to only contains allowed characters. This is to be used ONLY when manually creating user accounts, do NOT use when syncing with external systems!!
Definition at line 233 of file moodlelib.php.
| enum PASSWORD_DIGITS |
Definition at line 369 of file moodlelib.php.
| enum PASSWORD_LOWER |
Password policy constants ///.
Definition at line 367 of file moodlelib.php.
| enum PASSWORD_NONALPHANUM |
Definition at line 370 of file moodlelib.php.
| enum PASSWORD_UPPER |
Definition at line 368 of file moodlelib.php.
| enum TAG_MAX_LENGTH |
Tag constants///.
To prevent problems with multibytes strings,Flag updating in nav not working on the review page. this should not exceed the length of "varchar(255) / 3 (bytes / utf-8 character) = 85". TODO: this is not correct, varchar(255) are 255 unicode chars ;-)
Definition at line 364 of file moodlelib.php.
| enum VALUE_DEFAULT |
VALUE_DEFAULT - if the parameter is not supplied, then the default value is used
Definition at line 325 of file moodlelib.php.
| enum VALUE_OPTIONAL |
VALUE_OPTIONAL - if the parameter is not supplied, then the param has no value
Definition at line 320 of file moodlelib.php.
| enum VALUE_REQUIRED |
Web Services ///.
VALUE_REQUIRED - if the parameter is not supplied, there is an error
Definition at line 315 of file moodlelib.php.
| enum WEEKSECS |
Time constant - the number of seconds in a week
Definition at line 45 of file moodlelib.php.
| enum YEARSECS |
CONSTANTS (Encased in phpdoc proper comments)/////////////////////////.
Date and time constants /// Time constant - the number of seconds in a year
Definition at line 40 of file moodlelib.php.
| address_in_subnet | ( | $ | addr, |
| $ | subnetstr | ||
| ) |
Function to check the passed address is within the passed subnet
The parameter is a comma separated string of subnet definitions. Subnet strings can be in one of three formats: 1: xxx.xxx.xxx.xxx/nn or xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/nnn (number of bits in net mask) 2: xxx.xxx.xxx.xxx-yyy or xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx::xxxx-yyyy (a range of IP addresses in the last group) 3: xxx.xxx or xxx.xxx. or xxx:xxx:xxxx or xxx:xxx:xxxx. (incomplete address, a bit non-technical ;-) Code for type 1 modified from user posted comments by mediator at http://au.php.net/manual/en/function.ip2long.php
| string | $addr | The address you are checking |
| string | $subnetstr | The string of subnet addresses |
1: xxx.xxx.xxx.xxx/nn or xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/nnn
2: xxx.xxx.xxx.xxx-yyy or xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx::xxxx-yyyy ...a range of IP addresses in the last group.
3: xxx.xxx or xxx.xxx. or xxx:xxx:xxxx or xxx:xxx:xxxx.
Definition at line 9215 of file moodlelib.php.


Definition at line 9989 of file moodlelib.php.
| array_is_nested | ( | $ | array | ) |
Check if there is a nested array within the passed array
| array | $array |
Definition at line 9829 of file moodlelib.php.
| authenticate_user_login | ( | $ | username, |
| $ | password | ||
| ) |
Authenticates a user against the chosen authentication mechanism
Given a username and password, this function looks them up using the currently selected authentication mechanism, and if the authentication is successful, it returns a valid $user object from the 'user' table.
Uses auth_ functions from the currently active auth module
After authenticate_user_login() returns success, you will need to log that the user has logged in, and call complete_user_login() to set the session up.
Note: this function works only with non-mnet accounts!
| string | $username | User's username |
| string | $password | User's password |
Definition at line 3864 of file moodlelib.php.


| bounded_number | ( | $ | min, |
| $ | value, | ||
| $ | max | ||
| ) |
Used to make sure that $min <= $value <= $max
Make sure that value is between min, and max
| int | $min | The minimum value |
| int | $value | The value to check |
| int | $max | The maximum value |
Definition at line 9813 of file moodlelib.php.

| calculate_user_dst_table | ( | $ | from_year = NULL, |
| $ | to_year = NULL, |
||
| $ | strtimezone = NULL |
||
| ) |
Build and store the users Daylight Saving Time (DST) table
object object object
| mixed | $from_year | Start year for the table, defaults to 1971 |
| mixed | $to_year | End year for the table, defaults to 2035 |
| mixed | $strtimezone,if | null or 99 then user's default timezone is used |
Definition at line 2231 of file moodlelib.php.


Can handle rotated text. Whether it is safe to use the trickery in textrotate.js.
Definition at line 8363 of file moodlelib.php.

| check_browser_operating_system | ( | $ | brand | ) |
Checks to see if is the browser operating system matches the specified brand.
Known brand: 'Windows','Linux','Macintosh','SGI','SunOS','HP-UX'
$_SERVER
| string | $brand | The operating system identifier being tested |
Definition at line 7964 of file moodlelib.php.
| check_browser_version | ( | $ | brand, |
| $ | version = null |
||
| ) |
Checks to see if is a browser matches the specified brand and is equal or better version.
$_SERVER
| string | $brand | The browser identifier being tested |
| int | $version | The version of the browser, if not specified any version (except 5.5 for IE for BC reasons) |
OSX browser using Gecke engine
Mozilla Firefox browsers
Gecko based browsers
Internet Explorer
Opera
WebKit based browser - everything derived from it (Safari, Chrome, iOS, Android and other mobiles)
Desktop version of Apple Safari browser - no mobile or touch devices
Safari on iPhone, iPad and iPod touch
WebKit browser on Android
Definition at line 7985 of file moodlelib.php.

| check_consecutive_identical_characters | ( | $ | password, |
| $ | maxchars | ||
| ) |
Check whether the given password has no more than the specified number of consecutive identical characters.
| string | $password | password to be checked against the password policy |
| integer | $maxchars | maximum number of consecutive identical characters |
Definition at line 10293 of file moodlelib.php.

| check_gd_version | ( | ) |
Hack to find out the GD version by parsing phpinfo output
Definition at line 8373 of file moodlelib.php.
| check_password_policy | ( | $ | password, |
| &$ | errmsg | ||
| ) |
Validate a password against the configured password policy
object
| string | $password | the password to be checked against the password policy |
| string | $errmsg | the error message to display when the password doesn't comply with the policy. |
Definition at line 4205 of file moodlelib.php.


| check_php_version | ( | $ | version = '5.2.4' | ) |
Returns true if the current version of PHP is greater that the specified one.
| string | $version | The version of php being tested. |
Definition at line 7950 of file moodlelib.php.

| check_user_preferences_loaded | ( | stdClass $ | user, |
| $ | cachelifetime = 120 |
||
| ) |
FUNCTIONS FOR HANDLING USER PREFERENCES ////////////////////////////////////.
Refresh user preference cache. This is used most often for $USER object that is stored in session, but it also helps with performance in cron script.
Preferences for each user are loaded on first use on every page, then again after the timeout expires.
| stdClass | $user | user object, preferences are preloaded into ->preference property |
| int | $cachelifetime | cache life time on the current page (ins seconds) |
Definition at line 1571 of file moodlelib.php.


| clean_filename | ( | $ | string | ) |
Cleans a given filename by removing suspicious or troublesome characters
PARAM_FILE
| string | $string | file name |
Definition at line 5854 of file moodlelib.php.


| clean_param | ( | $ | param, |
| $ | type | ||
| ) |
Used by optional_param() and required_param() to clean the variables and/or cast to specific types, based on an options field. $course->format = clean_param($course->format, PARAM_ALPHA); $selectedgrade_item = clean_param($selectedgrade_item, PARAM_INT);
| mixed | $param | the variable we are cleaning |
| string | $type | expected format of param after cleaning. |
Definition at line 712 of file moodlelib.php.

| clean_param_array | ( | array $ | param = null, |
| $ | type, | ||
| $ | recursive = false |
||
| ) |
Makes sure array contains only the allowed types, this function does not validate array key names! $options = clean_param($options, PARAM_INT);
| array | $param | the variable array we are cleaning |
| string | $type | expected format of param after cleaning. |
| bool | $recursive | clean recursive arrays |
Definition at line 683 of file moodlelib.php.


| cleanremoteaddr | ( | $ | addr, |
| $ | compress = false |
||
| ) |
Cleans an ip address. Internal addresses are now allowed. (Originally local addresses were not allowed.)
| string | $addr | IPv4 or IPv6 address |
| bool | $compress | use IPv6 address compression |
Definition at line 9531 of file moodlelib.php.

| cleardoubleslashes | ( | $ | path | ) |
Replace 1 or more slashes or backslashes to 1 slash
| string | $path | The path to strip |
Definition at line 9456 of file moodlelib.php.

| complete_user_login | ( | $ | user | ) |
Call to complete the user login process after authenticate_user_login() has succeeded. It will setup the $USER variable and other required bits and pieces.
NOTE:
| object | $user |
Select password change url
check whether the user should be changing password
Definition at line 3970 of file moodlelib.php.


| complex_random_string | ( | $ | length = null | ) |
Generate a complex random string (useful for md5 salts)
This function is based on the above random_string() however it uses a larger pool of characters and generates a string between 24 and 32 characters
| int | $length | Optional if set generates a string to exactly this length |
Definition at line 8683 of file moodlelib.php.

| component_callback | ( | $ | component, |
| $ | function, | ||
| array $ | params = array(), |
||
| $ | default = null |
||
| ) |
Invoke component's callback functions
| string | $component | frankenstyle component name, e.g. 'mod_quiz' |
| string | $function | the rest of the function name, e.g. 'cron' will end up calling 'mod_quiz_cron' |
| array | $params | parameters of callback function |
| mixed | $default | default value if callback function hasn't been defined, or if it retursn null. |
Definition at line 7834 of file moodlelib.php.


| count_letters | ( | $ | string | ) |
Count letters in a string.
Letters are defined as chars not in tags and different from whitespace.
| string | $string | The text to be searched for letters. |
Loading the textlib singleton instance. We are going to need it.
Definition at line 8645 of file moodlelib.php.


| count_words | ( | $ | string | ) |
Count words in a string.
Words are defined as things between whitespace.
| string | $string | The text to be searched for words. |
Definition at line 8633 of file moodlelib.php.

| course_scale_used | ( | $ | courseid, |
| $ | scaleid | ||
| ) |
This function returns the number of activities using scaleid in a courseid
object object
| int | $courseid | ? |
| int | $scaleid | ? |
Definition at line 9106 of file moodlelib.php.


| create_user_key | ( | $ | script, |
| $ | userid, | ||
| $ | instance = null, |
||
| $ | iprestriction = null, |
||
| $ | validuntil = null |
||
| ) |
Creates a new private user access key.
object
| string | $script | unique target identifier |
| int | $userid | |
| int | $instance | optional instance id |
| string | $iprestriction | optional ip restricted access |
| timestamp | $validuntil | key valid only until given data |
Definition at line 3054 of file moodlelib.php.


| create_user_record | ( | $ | username, |
| $ | password, | ||
| $ | auth = 'manual' |
||
| ) |
Creates a bare-bones user record
| string | $username | New user's username to add to record |
| string | $password | New user's password to add to record |
| string | $auth | Form of authentication required |
Definition at line 3577 of file moodlelib.php.


| current_language | ( | ) |
STRING TRANSLATION ////////////////////////////////////////.
Returns the code for the current language
Definition at line 5866 of file moodlelib.php.

Detect a custom script replacement in the data directory that will replace an existing moodle script
Definition at line 10051 of file moodlelib.php.
| dayofweek | ( | $ | day, |
| $ | month, | ||
| $ | year | ||
| ) |
Calculate the position in the week of a specific calendar day
| int | $day | The day of the date whose position in the week is sought |
| int | $month | The month of the date whose position in the week is sought |
| int | $year | The year of the date whose position in the week is sought |
Definition at line 2523 of file moodlelib.php.

| days_in_month | ( | $ | month, |
| $ | year | ||
| ) |
Calculate the number of days in a given month
| int | $month | The month whose day count is sought |
| int | $year | The year of the month whose day count is sought |
Definition at line 2511 of file moodlelib.php.

| delete_course | ( | $ | courseorid, |
| $ | showfeedback = true |
||
| ) |
Delete a course, including all related data from the database, and any associated files.
object object
| mixed | $courseorid | The id of the course or course object to delete. |
| bool | $showfeedback | Whether to display notifications of each action the function performs. |
Definition at line 4273 of file moodlelib.php.


| delete_user | ( | $ | user | ) |
Marks user deleted in internal user database and notifies the auth plugin. Also unenrols user from all roles and does other cleanup.
Any plugin that needs to purge user data should register the 'user_deleted' event.
| stdClass | $user | full user object before delete |
Definition at line 3738 of file moodlelib.php.


| delete_user_key | ( | $ | script, |
| $ | userid | ||
| ) |
Delete the user's new private user access keys for a particular script.
object
| string | $script | unique target identifier |
| int | $userid |
Definition at line 3082 of file moodlelib.php.

| display_size | ( | $ | size | ) |
Converts bytes into display form
string $gb Localized string for size in gigabytes string $mb Localized string for size in megabytes string $kb Localized string for size in kilobytes string $b Localized string for size in bytes
| int | $size | The size to convert to human readable form |
Definition at line 5823 of file moodlelib.php.

| draw_rand_array | ( | $ | array, |
| $ | draws | ||
| ) |
Given an arbitrary array, and a number of draws, this function returns an array with that amount of items. The indexes are retained.
| array | $array | |
| int | $draws |
Definition at line 9008 of file moodlelib.php.

| dst_changes_for_year | ( | $ | year, |
| $ | timezone | ||
| ) |
Calculates the required DST change and returns a Timestamp Array
HOURSECS MINSECS
| mixed | $year | Int or String Year to focus on |
| object | $timezone | Instatiated Timezone object |
Definition at line 2362 of file moodlelib.php.


| dst_offset_on | ( | $ | time, |
| $ | strtimezone = NULL |
||
| ) |
Calculates the Daylight Saving Offset for a given date/time (timestamp)
object
| int | $time | must NOT be compensated at all, it has to be a pure timestamp |
| mixed | $strtimezone | timezone for which offset is expected, if 99 or null then user's default timezone is used. |
Definition at line 2397 of file moodlelib.php.


| email_is_not_allowed | ( | $ | ) |
Check that an email is allowed. It returns an error message if there was a problem.
object
| string | Content of email |
Definition at line 5448 of file moodlelib.php.

| email_to_user | ( | $ | user, |
| $ | from, | ||
| $ | subject, | ||
| $ | messagetext, | ||
| $ | messagehtml = '', |
||
| $ | attachment = '', |
||
| $ | attachname = '', |
||
| $ | usetrueaddress = true, |
||
| $ | replyto = '', |
||
| $ | replytoname = '', |
||
| $ | wordwrapwidth = 79 |
||
| ) |
Send an email to a specified user
object string string IdentityProvider(IDP) URL user hits to jump to mnet peer. SITEID
| stdClass | $user | A $USER object |
| stdClass | $from | A $USER object |
| string | $subject | plain text subject line of the email |
| string | $messagetext | plain text version of the message |
| string | $messagehtml | complete html version of the message (optional) |
| string | $attachment | a file on the filesystem, relative to $CFG->dataroot |
| string | $attachname | the name of the file (extension indicates MIME) |
| bool | $usetrueaddress | determines whether $from email address should be sent out. Will be overruled by user profile setting for maildisplay |
| string | $replyto | Email address to reply to |
| string | $replytoname | Name of reply to recipient |
| int | $wordwrapwidth | custom word wrap width, default 79 |
Definition at line 5005 of file moodlelib.php.


| endecrypt | ( | $ | pwd, |
| $ | data, | ||
| $ | case | ||
| ) |
Based on a class by Mukul Sabharwal [mukulsabharwal @ yahoo.com]
| string | $pwd | The password to use when encrypting or decrypting |
| string | $data | The data to be decrypted/encrypted |
| string | $case | Either 'de' for decrypt or '' for encrypt |
Definition at line 7283 of file moodlelib.php.

| exists_auth_plugin | ( | $ | auth | ) |
Returns whether a given authentication plugin exists.
object
| string | $auth | Form of authentication to check for. Defaults to the global setting in $CFG. |
Definition at line 3444 of file moodlelib.php.

| find_day_in_month | ( | $ | startday, |
| $ | weekday, | ||
| $ | month, | ||
| $ | year | ||
| ) |
?
| int | $startday | |
| int | $weekday | |
| int | $month | |
| int | $year |
Definition at line 2448 of file moodlelib.php.


| fix_utf8 | ( | $ | value | ) |
Makes sure the data is using valid utf8, invalid characters are discarded.
Note: this function is not intended for full objects with methods and private properties.
| mixed | $value |
Definition at line 1121 of file moodlelib.php.

| format_float | ( | $ | float, |
| $ | decimalpoints = 1, |
||
| $ | localized = true |
||
| ) |
Given a float, prints it nicely. Localized floats must not be used in calculations!
| float | $float | The float to print |
| int | $places | The number of decimal places to print. |
| bool | $localized | use localized decimal separator |
Definition at line 8930 of file moodlelib.php.

| format_time | ( | $ | totalsecs, |
| $ | str = NULL |
||
| ) |
Format a date/time (seconds) as weeks, days, hours etc as needed
Given an amount of time in seconds, returns string formatted nicely as weeks, days, hours etc as needed
MINSECS HOURSECS DAYSECS YEARSECS
| int | $totalsecs | Time in seconds |
| object | $str | Should be a time object |
Definition at line 1865 of file moodlelib.php.

| fullclone | ( | $ | thing | ) |
This function will make a complete copy of anything it's given, regardless of whether it's an object or not.
| mixed | $thing | Something you want cloned |
Definition at line 9635 of file moodlelib.php.

| fullname | ( | $ | user, |
| $ | override = false |
||
| ) |
Returns a persons full name
Given an object containing firstname and lastname values, this function returns a string with the full name of the person. The result may depend on system settings or language. 'override' will force both names to be used even if system settings specify one.
object object
| object | $user | A $USER object to get full name of |
| bool | $override | If true then the name will be first name followed by last name rather than adhering to fullnamedisplay setting. |
Definition at line 3317 of file moodlelib.php.
| gc_cache_flags | ( | ) |
Garbage-collect volatile flags
Definition at line 1553 of file moodlelib.php.

| generate_email_processing_address | ( | $ | modid, |
| $ | modargs | ||
| ) |
Generate an email processing address
| int | $modid | |
| string | $modargs |
Definition at line 4819 of file moodlelib.php.

Generate a signoff for emails based on support settings
object
Definition at line 5210 of file moodlelib.php.

Generate a fake user for emails based on support settings object
Definition at line 5231 of file moodlelib.php.

| generate_password | ( | $ | maxlen = 10 | ) |
returns a randomly generated password of length $maxlen. inspired by
http://www.phpbuilder.com/columns/jesus19990502.php3 and http://es2.php.net/manual/en/function.str-shuffle.php#73254
object
| int | $maxlen | The maximum size of the password being generated. |
Definition at line 8865 of file moodlelib.php.

| get_auth_plugin | ( | $ | auth | ) |
Returns an authentication plugin instance.
object
| string | $auth | name of authentication plugin |
Definition at line 3476 of file moodlelib.php.


Returns one or several CSS class names that match the user's browser. These can be put in the body tag of the page to apply browser-specific rules without relying on CSS hacks
Definition at line 8320 of file moodlelib.php.


| get_cache_flag | ( | $ | type, |
| $ | name, | ||
| $ | changedsince = NULL |
||
| ) |
Get volatile flags
| string | $type | |
| string | $name | |
| int | $changedsince | default null |
Definition at line 1476 of file moodlelib.php.

| get_cache_flags | ( | $ | type, |
| $ | changedsince = NULL |
||
| ) |
Get volatile flags
| string | $type | |
| int | $changedsince | default null |
Definition at line 1449 of file moodlelib.php.

| get_complete_user_data | ( | $ | field, |
| $ | value, | ||
| $ | mnethostid = null |
||
| ) |
Get a complete user record, which includes all the info in the user record.
Intended for setting as $USER session variable
| string | $field | The user field to be checked for a given value. |
| string | $value | The value to match for $field. |
| int | $mnethostid |
Build the WHERE clause for an SQL query
Get all the basic user data
Get various settings and preferences
Add the custom profile fields to the user record
Rewrite some variables if necessary
Definition at line 4116 of file moodlelib.php.


| get_component_directory | ( | $ | component | ) |
Return exact absolute path to a plugin directory, this method support "simpletest_" prefix designed for unit testing.
| string | $component | name such as 'moodle', 'mod_forum' or special simpletest value |
Definition at line 7378 of file moodlelib.php.


| get_config | ( | $ | plugin, |
| $ | name = NULL |
||
| ) |
Get configuration values from the global config table or the config_plugins table.
If called with one parameter, it will load all the config variables for one plugin, and return them as an object.
If called with 2 parameters it will return a string single value or false if the value is not found.
| string | $plugin | full component name |
| string | $name | default NULL |
Definition at line 1276 of file moodlelib.php.
List all core subsystems and their location
This is a whitelist of components that are part of the core and their language strings are defined in /lang/en/<<subsystem>>.php. If a given plugin is not listed here and it does not have proper plugintype prefix, then it is considered as course activity module.
The location is dirroot relative path. NULL means there is no special directory for this subsystem. If the location is set, the subsystem's renderer.php is expected to be there.
Definition at line 7456 of file moodlelib.php.

| get_device_cfg_var_name | ( | $ | devicetype = null | ) |
Returns the name of the device type theme var in $CFG (because there is not a standard convention to allow backwards compatability
| string | $devicetype |
Definition at line 8271 of file moodlelib.php.

| get_device_type | ( | ) |
Returns whether a device/browser combination is mobile, tablet, legacy, default or the result of an optional admin specified regular expression. If enabledevicedetection is set to no or not set it returns default
Definition at line 8183 of file moodlelib.php.

| get_device_type_list | ( | $ | incusertypes = true | ) |
Returns a list of the device types supporting by Moodle
| boolean | $incusertypes | includes types specified using the devicedetectregex admin setting |
Definition at line 8228 of file moodlelib.php.

| get_directory_list | ( | $ | rootdir, |
| $ | excludefiles = '', |
||
| $ | descend = true, |
||
| $ | getdirs = false, |
||
| $ | getfiles = true |
||
| ) |
Returns an array with all the filenames in all subdirectories, relative to the given rootdir.
If excludefiles is defined, then that file/directory is ignored If getdirs is true, then (sub)directories are included in the output If getfiles is true, then files are included in the output (at least one of these must be true!)
| string | $rootdir | A given root directory to start from |
| string | array | $excludefile | If defined then the specified file/directory is ignored |
| bool | $descend | If true then subdirectories are recursed as well |
| bool | $getdirs | If true then (sub)directories are included in the output |
| bool | $getfiles | If true then files are included in the output |
Definition at line 5713 of file moodlelib.php.

| get_directory_size | ( | $ | rootdir, |
| $ | excludefile = '' |
||
| ) |
Adds up all the files in a directory and works out the size.
| string | $rootdir | The directory to start from |
| string | $excludefile | A file to exclude when summing directory size |
Definition at line 5770 of file moodlelib.php.

Factory function for emoticon_manager
Definition at line 7096 of file moodlelib.php.

| get_enabled_auth_plugins | ( | $ | fix = false | ) |
Returns array of active auth plugins.
| bool | $fix | fix $CFG->auth if needed |
Definition at line 3496 of file moodlelib.php.


| get_extra_user_fields | ( | $ | context, |
| $ | already = array() |
||
| ) |
Checks if current user is shown any extra fields when listing users.
| object | $context | Context |
| array | $already | Array of fields that we're going to show anyway so don't bother listing them |
Definition at line 3362 of file moodlelib.php.


| get_extra_user_fields_sql | ( | $ | context, |
| $ | alias = '', |
||
| $ | prefix = '', |
||
| $ | already = array() |
||
| ) |
If the current user is to be shown extra user fields when listing or selecting users, returns a string suitable for including in an SQL select clause to retrieve those fields.
| object | $context | Context |
| string | $alias | Alias of user table, e.g. 'u' (default none) |
| string | $prefix | Prefix for field names using AS, e.g. 'u_' (default none) |
| array | $already | Array of fields that we're going to include anyway so don't list them (default none) |
Definition at line 3404 of file moodlelib.php.


| get_file_browser | ( | ) |
Returns local file storage instance
Definition at line 5532 of file moodlelib.php.

| get_file_packer | ( | $ | mimetype = 'application/zip' | ) |
Returns file packer
| string | $mimetype | default application/zip |
Definition at line 5554 of file moodlelib.php.

| get_file_storage | ( | ) |
FILE HANDLING /////////////////////////////////////////////.
Returns local file storage instance
Definition at line 5499 of file moodlelib.php.
| get_home_page | ( | ) |
Gets the homepage to use for the current user
Definition at line 10436 of file moodlelib.php.


| get_host_from_url | ( | $ | url | ) |
Returns host part from url
| string | $url | full url |
Definition at line 1172 of file moodlelib.php.

Returns a list of charset codes
Returns a list of charset codes. It's hardcoded, so they should be added manually (checking that such charset is supported by the texlib library!)
Definition at line 7000 of file moodlelib.php.

| get_list_of_plugins | ( | $ | directory = 'mod', |
| $ | exclude = '', |
||
| $ | basedir = '' |
||
| ) |
Lists plugin-like directories within specified directory
This function was originally used for standard Moodle plugins, please use new get_plugin_list() now.
This function is used for general directory listing and backwards compatility.
| string | $directory | relative directory from root |
| string | $exclude | dir name to exclude from the list (defaults to none) |
| string | $basedir | full path to the base dir where $plugin resides (defaults to $CFG->dirroot) |
Definition at line 7776 of file moodlelib.php.

Returns a list of valid and compatible themes
Definition at line 7021 of file moodlelib.php.


Returns a list of timezones in the current language
object object
Definition at line 7049 of file moodlelib.php.


| get_login_url | ( | ) |
USER AUTHENTICATION AND LOGIN ////////////////////////////////////////.
Returns full login url.
Definition at line 2536 of file moodlelib.php.

| get_mailer | ( | $ | action = 'get' | ) |
CORRESPONDENCE ////////////////////////////////////////////////.
Get mailer instance, enable buffering, flush buffer or disable buffering.
object
| string | $action | 'get', 'buffer', 'close' or 'flush' |
Definition at line 4865 of file moodlelib.php.

| get_max_upload_file_size | ( | $ | sitebytes = 0, |
| $ | coursebytes = 0, |
||
| $ | modulebytes = 0 |
||
| ) |
Returns the maximum size for uploading files.
There are seven possible upload limits: 1. in Apache using LimitRequestBody (no way of checking or changing this) 2. in php.ini for 'upload_max_filesize' (can not be changed inside PHP) 3. in .htaccess for 'upload_max_filesize' (can not be changed inside PHP) 4. in php.ini for 'post_max_size' (can not be changed inside PHP) 5. by the Moodle admin in $CFG->maxbytes 6. by the teacher in the current course $course->maxbytes 7. by the teacher for the current module, eg $assignment->maxbytes
These last two are passed to this function as arguments (in bytes). Anything defined as 0 is ignored. The smallest of all the non-zero numbers is returned.
| int | $sizebytes | Set maximum size |
| int | $coursebytes | Current course $course->maxbytes (in bytes) |
| int | $modulebytes | Current module ->maxbytes (in bytes) |
Definition at line 5621 of file moodlelib.php.


| get_max_upload_sizes | ( | $ | sitebytes = 0, |
| $ | coursebytes = 0, |
||
| $ | modulebytes = 0 |
||
| ) |
Returns an array of possible sizes in local language
Related to get_max_upload_file_size() - this function returns an array of possible sizes in an array, translated to the local language.
object SORT_NUMERIC
| int | $sizebytes | Set maximum size |
| int | $coursebytes | Current course $course->maxbytes (in bytes) |
| int | $modulebytes | Current module ->maxbytes (in bytes) |
Definition at line 5666 of file moodlelib.php.


helper function to load up and initialise the mnet environment this must be called before you use mnet functions.
Definition at line 10370 of file moodlelib.php.

during xmlrpc server code execution, any code wishing to access information about the remote peer must use this to get it.
Definition at line 10387 of file moodlelib.php.


| get_parent_language | ( | $ | lang = null | ) |
Returns parent language of current active language if defined
COURSE SESSION
| string | $lang | null means current language |
Definition at line 5898 of file moodlelib.php.

get_performance_info() pairs up with init_performance_info() loaded in setup.php. Returns an array with 'html' and 'txt' values ready for use, and each of the individual stats provided separately as well.
object object object
Definition at line 9849 of file moodlelib.php.


| get_plugin_directory | ( | $ | plugintype, |
| $ | name | ||
| ) |
ENVIRONMENT CHECKING ////////////////////////////////////////////////////////////.
Returns the exact absolute path to plugin directory.
| string | $plugintype | type of plugin |
| string | $name | name of the plugin |
Definition at line 7348 of file moodlelib.php.


| get_plugin_list | ( | $ | plugintype | ) |
Simplified version of get_list_of_plugins()
| string | $plugintype | type of plugin |
Definition at line 7598 of file moodlelib.php.

| get_plugin_list_with_class | ( | $ | plugintype, |
| $ | class, | ||
| $ | file | ||
| ) |
Get a list of all the plugins of a given type that define a certain class in a certain file. The plugin component names and class names are returned.
| string | $plugintype | the type of plugin, e.g. 'mod' or 'report'. |
| string | $class | the part of the name of the class after the frankenstyle prefix. e.g 'thing' if you are looking for classes with names like report_courselist_thing. If you are looking for classes with the same name as the plugin name (e.g. qtype_multichoice) then pass ''. |
| string | $file | the name of file within the plugin that defines the class. |
Definition at line 7745 of file moodlelib.php.


| get_plugin_list_with_file | ( | $ | plugintype, |
| $ | file, | ||
| $ | include = false |
||
| ) |
Get a list of all the plugins of a given type that contain a particular file.
| string | $plugintype | the type of plugin, e.g. 'mod' or 'report'. |
| string | $file | the name of file that must be present in the plugin. (e.g. 'view.php', 'db/install.xml'). |
| bool | $include | if true (default false), the file will be include_once-ed if found. |
Definition at line 7679 of file moodlelib.php.


| get_plugin_list_with_function | ( | $ | plugintype, |
| $ | function, | ||
| $ | file = 'lib.php' |
||
| ) |
Get a list of all the plugins of a given type that define a certain API function in a certain file. The plugin component names and function names are returned.
| string | $plugintype | the type of plugin, e.g. 'mod' or 'report'. |
| string | $function | the part of the name of the function after the frankenstyle prefix. e.g 'hook' if you are looking for functions with names like report_courselist_hook. |
| string | $file | the name of file within the plugin that defines the function. Defaults to lib.php. |
Definition at line 7710 of file moodlelib.php.


| get_plugin_types | ( | $ | fullpaths = true | ) |
Lists all plugin types
| bool | $fullpaths | false means relative paths from dirroot |
Definition at line 7536 of file moodlelib.php.


| get_selected_theme_for_device_type | ( | $ | devicetype = null | ) |
Returns the theme selected for a particular device or false if none selected.
| string | $devicetype |
Definition at line 8250 of file moodlelib.php.


Returns the site identifier
object
Definition at line 10276 of file moodlelib.php.


| get_string | ( | $ | identifier, |
| $ | component = '', |
||
| $ | a = NULL |
||
| ) |
Returns a localized string.
Returns the translated string specified by $identifier as for $module. Uses the same format files as STphp. $a is an object, string or number that can be used within translation strings
eg 'hello {$a->firstname} {$a->lastname}' or 'hello {$a}'
If you would like to directly echo the localized string use the function print_string()
Example usage of this function involves finding the string you would like a local equivalent of and using its identifier and module information to retrieve it.
If you open moodle/lang/en/moodle.php and look near line 278 you will find a string to prompt a user for their word for 'course' $string['course'] = 'Course'; So if you want to display the string 'Course' in any language that supports it on your site you just need to use the identifier 'course' $mystring = ''. get_string('course') .''; or If the string you want is in another file you'd take a slightly different approach. Looking in moodle/lang/en/calendar.php you find around line 75: $string['typecourse'] = 'Course event'; If you want to display the string "Course event" in any language supported you would use the identifier 'typecourse' and the module 'calendar' (because it is in the file calendar.php): $mystring = '
';
As a last resort, should the identifier fail to map to a string the returned string will be [[ $identifier ]]
| string | $identifier | The key identifier for the localized string |
| string | $component | The module where the key identifier is stored, usually expressed as the filename in the language pack without the .php on the end but can also be written as mod/forum or grade/export/xls. If none is specified then moodle.php is used. |
| string | object | array | $a | An object, string or number that can be used within translation strings |
Definition at line 6904 of file moodlelib.php.

| get_string_manager | ( | $ | forcereload = false | ) |
Returns current string_manager instance.
The param $forcereload is needed for CLI installer only where the string_manager instance must be replaced during the install.php script life time.
| bool | $forcereload | shall the singleton be released and new instance created instead? |
Definition at line 5932 of file moodlelib.php.
| get_strings | ( | $ | array, |
| $ | component = '' |
||
| ) |
Converts an array of strings to their localized value.
| array | $array | An array of strings |
| string | $module | The language module that these strings can be found in. |
Definition at line 6957 of file moodlelib.php.

| get_timezone_offset | ( | $ | tz | ) |
Returns an int which represents the systems's timezone difference from GMT in seconds
object
| mixed | $tz | timezone |
Definition at line 2149 of file moodlelib.php.


| get_timezone_record | ( | $ | timezonename | ) |
Returns cached timezone record for given $timezonename
object object
| string | $timezonename |
Definition at line 2204 of file moodlelib.php.

Returns the device the user is currently using, or if the user has chosen to switch devices for the current device type the type they have switched to.
Definition at line 8305 of file moodlelib.php.


| get_user_field_name | ( | $ | field | ) |
Returns the display name of a field in the user table. Works for most fields that are commonly displayed to users.
| string | $field | Field name, e.g. 'phone1' |
Definition at line 3427 of file moodlelib.php.

Returns an array of user fields
Definition at line 3557 of file moodlelib.php.

| get_user_key | ( | $ | script, |
| $ | userid, | ||
| $ | instance = null, |
||
| $ | iprestriction = null, |
||
| $ | validuntil = null |
||
| ) |
Gets a private user access key (and creates one if one doesn't exist).
object
| string | $script | unique target identifier |
| int | $userid | |
| int | $instance | optional instance id |
| string | $iprestriction | optional ip restricted access |
| timestamp | $validuntil | key valid only until given data |
Definition at line 3098 of file moodlelib.php.


| get_user_preferences | ( | $ | name = null, |
| $ | default = null, |
||
| $ | user = null |
||
| ) |
Used to fetch user preference(s)
If no arguments are supplied this function will return all of the current user preferences as an array.
If a name is specified then this function attempts to return that particular preference value. If none is found, then the optional value $default is returned, otherwise NULL.
If user object submitted, 'preference' property contains the preferences cache.
| string | $name | Name of the key to use in finding a preference value |
| mixed | $default | Value to be returned if the $name key is not set in the user preferences |
| stdClass | int | $user | A moodle user object or id, null means current user |
Definition at line 1781 of file moodlelib.php.

| get_user_timezone | ( | $ | tz = 99 | ) |
Returns a float or a string which denotes the user's timezone A float value means that a simple offset from GMT is used, while a string (it will be the name of a timezone in the database) means that for this timezone there are also DST rules to be taken into account Checks various settings and picks the most dominant of those which have a value
object object
| mixed | $tz | If this value is provided and not equal to 99, it will be returned as is and no other settings will be checked |
Definition at line 2177 of file moodlelib.php.

| get_user_timezone_offset | ( | $ | tz = 99 | ) |
Returns a float which represents the user's timezone difference from GMT in hours Checks various settings and picks the most dominant of those which have a value
object object
| float | $tz | If this value is provided and not equal to 99, it will be returned as is and no other settings will be checked |
Definition at line 2125 of file moodlelib.php.


| get_users_from_config | ( | $ | value, |
| $ | capability, | ||
| $ | includeadmins = true |
||
| ) |
Use this function to get a list of users from a config setting of type admin_setting_users_with_capability.
All users are verified if they still have the necessary capability.
| string | $value | the value of the config setting. |
| string | $capability | the capability - must match the one passed to the admin_setting_users_with_capability constructor. |
| bool | $include | admins, include administrators |
Definition at line 1384 of file moodlelib.php.


| getremoteaddr | ( | $ | default = '0.0.0.0' | ) |
Returns most reliable client address
object
| string | $default | If an address can't be determined, then return this |
Definition at line 9493 of file moodlelib.php.


| getweek | ( | $ | startdate, |
| $ | thedate | ||
| ) |
Given dates in seconds, how many weeks is the date from startdate The first week is 1, the second 2 etc ...
WEEKSECS
| int | $startdate | Timestamp for the start date |
| int | $thedate | Timestamp for the end date |
Definition at line 8847 of file moodlelib.php.
| guest_user | ( | ) |
Retrieve the guest user object
object object
Definition at line 3832 of file moodlelib.php.


| hash_internal_user_password | ( | $ | password | ) |
Calculate hashed value from password using current hash mechanism.
| string | $password |
Definition at line 4070 of file moodlelib.php.

| html_is_blank | ( | $ | string | ) |
Tests whether anything was returned by text editor
This function is useful for testing whether something you got back from the HTML editor actually contains anything. Sometimes the HTML editor appear to be empty, but actually you get back a
tag or something.
| string | $string | a string containing HTML. |
Definition at line 1191 of file moodlelib.php.

| in_object_vars | ( | $ | var, |
| $ | object | ||
| ) |
Checks whether the given variable name is defined as a variable within the given object.
This will NOT work with stdClass objects, which have no class variables.
| string | $var | The variable name |
| object | $object | The object to check |
Definition at line 10216 of file moodlelib.php.
| is_enabled_auth | ( | $ | auth | ) |
Checks if a given plugin is in the list of enabled authentication plugins.
| string | $auth | Authentication plugin. |
Definition at line 3459 of file moodlelib.php.


| is_internal_auth | ( | $ | auth | ) |
Returns true if an internal authentication method is being used. if method not specified then, global default is assumed
| string | $auth | Form of authentication required |
Definition at line 3530 of file moodlelib.php.

| is_mnet_remote_user | ( | $ | user | ) |
Returns whether or not the user object is a remote MNET user. This function is in moodlelib because it does not rely on loading any of the MNET code.
object
| object | $user | A valid user object |
Definition at line 10077 of file moodlelib.php.

| is_newnav | ( | $ | navigation | ) |
Check if the passed navigation is of the new style
| mixed | $navigation |
Definition at line 10199 of file moodlelib.php.
| is_number | ( | $ | value | ) |
Return true if given value is integer or string with integer value
| mixed | $value | String or Int |
Definition at line 1157 of file moodlelib.php.

| is_primary_admin | ( | $ | userid | ) |
Is a userid the primary administrator?
| int | $userid | int id of user to check |
Definition at line 10260 of file moodlelib.php.
| is_proxybypass | ( | $ | url | ) |
check if $url matches anything in proxybypass list
any errors just result in the proxy being used (least bad)
object
| string | $url | url to check |
Definition at line 10150 of file moodlelib.php.

| is_restored_user | ( | $ | username | ) |
Returns true if the user is a 'restored' one
Used in the login process to inform the user and allow him/her to reset the password
$CFG $DB
| string | $username | username to be checked |
Definition at line 3546 of file moodlelib.php.
| isediting | ( | ) |
Determines if the currently logged in user is in editing mode. Note: originally this function had $userid parameter - it was not usable anyway
object DEBUG_DEVELOPER
Definition at line 3279 of file moodlelib.php.


| ismoving | ( | $ | courseid | ) |
Determines if the logged in user is currently moving an activity
object
| int | $courseid | The id of the course being tested |
Definition at line 3292 of file moodlelib.php.

| make_grades_menu | ( | $ | gradingtype | ) |
Creates an array that represents all the current grades that can be chosen using the given grading type.
Negative numbers are scales, zero is no grade, and positive numbers are maximum grades.
| int | $gradingtype |
Definition at line 9077 of file moodlelib.php.


| make_menu_from_list | ( | $ | list, |
| $ | separator = ',' |
||
| ) |
Given a list (eg a,b,c,d,e) this function returns an array of 1->a, 2->b, 3->c etc
| string | $list | The string to explode into array bits |
| string | $separator | The separator used within the list string |
Definition at line 9055 of file moodlelib.php.

| make_timestamp | ( | $ | year, |
| $ | month = 1, |
||
| $ | day = 1, |
||
| $ | hour = 0, |
||
| $ | minute = 0, |
||
| $ | second = 0, |
||
| $ | timezone = 99, |
||
| $ | applydst = true |
||
| ) |
FUNCTIONS FOR HANDLING TIME ////////////////////////////////////////////.
Given date parts in user time produce a GMT timestamp.
| int | $year | The year part to create timestamp of |
| int | $month | The month part to create timestamp of |
| int | $day | The day part to create timestamp of |
| int | $hour | The hour part to create timestamp of |
| int | $minute | The minute part to create timestamp of |
| int | $second | The second part to create timestamp of |
| mixed | $timezone | Timezone modifier, if 99 then use default user's timezone |
| bool | $applydst | Toggle Daylight Saving Time, default true, will be applied only if timezone is 99 or string. |
Definition at line 1828 of file moodlelib.php.


| make_unique_id_code | ( | $ | extra = '' | ) |
make_unique_id_code
$_SERVER
| string | $extra | Extra string to append to the end of the code |
Definition at line 9175 of file moodlelib.php.


| mark_user_preferences_changed | ( | $ | userid | ) |
Called from set/delete_user_preferences, so that the prefs can be correctly reloaded in different sessions.
NOTE: internal function, do not call from other code.
| integer | $userid | the user whose prefs were changed. |
Definition at line 1617 of file moodlelib.php.


If new messages are waiting for the current user, then insert JavaScript to pop up the messaging window into the page
moodle_page $PAGE
Definition at line 9700 of file moodlelib.php.


| microtime_diff | ( | $ | a, |
| $ | b | ||
| ) |
Calculate the difference between two microtimes
| string | $a | The first Microtime |
| string | $b | The second Microtime |
Definition at line 9041 of file moodlelib.php.

| mnet_get_idp_jump_url | ( | $ | user | ) |
return the jump url for a given remote user this is used for rewriting forum post links in emails, etc
| stdclass | $user | the user to get the idp url for |
Definition at line 10419 of file moodlelib.php.


Determine if moodle installation requires update
Checks version numbers of main code and all modules to see if there are any mismatches
object object
Definition at line 8420 of file moodlelib.php.


| moodle_process_email | ( | $ | modargs, |
| $ | body | ||
| ) |
?
object
| string | $modargs | |
| string | $body | Currently unused |
Definition at line 4835 of file moodlelib.php.

This function expects to called during shutdown should be set via register_shutdown_function() in lib/setup.php .
Definition at line 9647 of file moodlelib.php.

| moodle_setlocale | ( | $ | locale = '' | ) |
MISCELLANEOUS ////////////////////////////////////////////////////////////////////.
Sets the system locale
object
| string | $locale | Can be used to force a locale |
Fetch the correct locale based on ostype
the priority is the same as in get_string() - parameter, config, course, session, user, global language
do nothing if locale already set up
Due to some strange BUG we cannot set the LC_TIME directly, so we fetch current values, set LC_ALL and then set values again. Just wondering why we cannot set LC_ALL only??? - stronk7 Some day, numeric, monetary and other categories should be set too, I think. :-/
Get current values
Set locale to all
Set old values
Definition at line 8551 of file moodlelib.php.

| moodle_strtolower | ( | $ | string, |
| $ | encoding = '' |
||
| ) |
Converts string to lowercase using most compatible function available.
| string | $string | The string to convert to all lowercase characters. |
| string | $encoding | The encoding on the string. |
Definition at line 8613 of file moodlelib.php.


| mtrace | ( | $ | string, |
| $ | eol = "\n", |
||
| $ | sleep = 0 |
||
| ) |
For outputting debugging info
STDOUT
| string | $string | The string to write |
| string | $eol | The end of line char(s) to use |
| string | $sleep | Period to make the application sleep This ensures any messages have time to display before redirect |
Definition at line 9434 of file moodlelib.php.

| normalize_component | ( | $ | component | ) |
Normalize the component name using the "frankenstyle" names.
| string | $component |
Definition at line 7414 of file moodlelib.php.


| object_array_unique | ( | $ | array, |
| $ | keep_key_assoc = true |
||
| ) |
Returns an array without repeated objects. This function is similar to array_unique, but for arrays that have objects as values
| array | $array | |
| bool | $keep_key_assoc |
Definition at line 10230 of file moodlelib.php.

| object_property_exists | ( | $ | obj, |
| $ | property | ||
| ) |
Detect if an object or a class contains a given property will take an actual object or the name of a class
| mix | $obj | Name of class or real object to test |
| string | $property | name of property to find |
Definition at line 10034 of file moodlelib.php.
| optional_param | ( | $ | parname, |
| $ | default, | ||
| $ | type | ||
| ) |
Returns a particular value for the named variable, taken from POST or GET, otherwise returning a given default.
This function should be used to initialise all optional values in a script that are based on parameters. Usually it will be used like this: $name = optional_param('name', 'Fred', PARAM_TEXT);
Please note the $type parameter is now required and the value can not be array.
| string | $parname | the name of the page parameter we want |
| mixed | $default | the default value to return if nothing is found |
| string | $type | expected type of parameter |
Definition at line 566 of file moodlelib.php.

| optional_param_array | ( | $ | parname, |
| $ | default, | ||
| $ | type | ||
| ) |
Returns a particular array value for the named variable, taken from POST or GET, otherwise returning a given default.
This function should be used to initialise all optional values in a script that are based on parameters. Usually it will be used like this: $ids = optional_param('id', array(), PARAM_INT);
Note: arrays of arrays are not supported, only alphanumeric keys with _ and - are supported
| string | $parname | the name of the page parameter we want |
| mixed | $default | the default value to return if nothing is found |
| string | $type | expected type of parameter |
Definition at line 608 of file moodlelib.php.


| over_bounce_threshold | ( | $ | user | ) |
Check whether the user has exceeded the bounce threshold
object object
| user | $user | A $USER object |
No real (DB) user, nothing to do here.
Definition at line 3153 of file moodlelib.php.

| partial | ( | ) |
helper function to do partial function binding so we can use it for preg_replace_callback, for example this works with php functions, user functions, static methods and class methods it returns you a callback that you can pass on like so:
$callback = partial('somefunction', $arg1, $arg2); or $callback = partial(array('someclass', 'somestaticmethod'), $arg1, $arg2); or even $obj = new someclass(); $callback = partial(array($obj, 'somemethod'), $arg1, $arg2);
and then the arguments that are passed through at calltime are appended to the argument list.
| mixed | $function | a php callback $param mixed $arg1.. $argv arguments to partially bind with |
Definition at line 10341 of file moodlelib.php.

| plugin_callback | ( | $ | type, |
| $ | name, | ||
| $ | feature, | ||
| $ | action, | ||
| $ | params = null, |
||
| $ | default = null |
||
| ) |
Invoke plugin's callback functions
| string | $type | plugin type e.g. 'mod' |
| string | $name | plugin name |
| string | $feature | feature name |
| string | $action | feature's action |
| array | $params | parameters of callback function, should be an array |
| mixed | $default | default value if callback function hasn't been defined, or if it retursn null. |
Definition at line 7821 of file moodlelib.php.


| plugin_supports | ( | $ | type, |
| $ | name, | ||
| $ | feature, | ||
| $ | default = NULL |
||
| ) |
Checks whether a plugin supports a specified feature.
| string | $type | Plugin type e.g. 'mod' |
| string | $name | Plugin name e.g. 'forum' |
| string | $feature | Feature code (FEATURE_xx constant) |
| mixed | $default | default value if feature support unknown |
Definition at line 7888 of file moodlelib.php.


| print_string | ( | $ | identifier, |
| $ | component = '', |
||
| $ | a = NULL |
||
| ) |
Prints out a translated string.
Prints out a translated string using the return value from the get_string() function.
Example usage of this function when the string is in the moodle.php file:
echo ''; print_string('course'); echo '';
Example usage of this function when the string is not in the moodle.php file:
echo '
';
| string | $identifier | The key identifier for the localized string |
| string | $component | The module where the key identifier is stored. If none is specified then moodle.php is used. |
| mixed | $a | An object, string or number that can be used within translation strings |
Definition at line 6988 of file moodlelib.php.

| purge_all_caches | ( | ) |
Invalidates browser caches and cached data in temp
Definition at line 1423 of file moodlelib.php.


| random_string | ( | $ | length = 15 | ) |
Generate and return a random string of the specified length.
| int | $length | The length of the string to be created. |
Definition at line 8661 of file moodlelib.php.

| rc4decrypt | ( | $ | data | ) |
rc4decrypt
| string | $data | Data to decrypt |
Definition at line 7268 of file moodlelib.php.


| rc4encrypt | ( | $ | data | ) |
ENCRYPTION ////////////////////////////////////////////////.
rc4encrypt
| string | $data | Data to encrypt |
Definition at line 7255 of file moodlelib.php.


| remoteip_in_list | ( | $ | list | ) |
Is current ip in give list?
| string | $list |
Definition at line 9466 of file moodlelib.php.

| remove_course_contents | ( | $ | courseid, |
| $ | showfeedback = true, |
||
| array $ | options = null |
||
| ) |
Clear a course out completely, deleting all content but don't delete the course itself. This function does not verify any permissions.
Please note this function also deletes all user enrolments, enrolment instances and role assignments by default.
$options:
| int | $courseid | The id of the course that is being deleted |
| bool | $showfeedback | Whether to display notifications of each action the function performs. |
| array | $options | extra options |
Delete activity context questions and question categories
Definition at line 4330 of file moodlelib.php.


| remove_dir | ( | $ | dir, |
| $ | content_only = false |
||
| ) |
Delete directory or only it's content
| string | $dir | directory path |
| bool | $content_only |
Definition at line 10000 of file moodlelib.php.

| require_course_login | ( | $ | courseorid, |
| $ | autologinguest = true, |
||
| $ | cm = NULL, |
||
| $ | setwantsurltome = true, |
||
| $ | preventredirect = false |
||
| ) |
Weaker version of require_login()
This is a weaker version of require_login() which only requires login when called from within a course rather than the site page, unless the forcelogin option is turned on.
object
| mixed | $courseorid | The course object or id in question |
| bool | $autologinguest | Allow autologin guests if that is wanted |
| object | $cm | Course activity module if known |
| bool | $setwantsurltome | Define if we want to set $SESSION->wantsurl, defaults to true. Used to avoid (=false) some scripts (file.php...) to set that variable, in order to keep redirects working properly. MDL-14495 |
| bool | $preventredirect | set to true in scripts that can not redirect (CLI, rss feeds, etc.), throws exceptions |
Definition at line 2920 of file moodlelib.php.


| require_login | ( | $ | courseorid = NULL, |
| $ | autologinguest = true, |
||
| $ | cm = NULL, |
||
| $ | setwantsurltome = true, |
||
| $ | preventredirect = false |
||
| ) |
This function checks that the current user is logged in and has the required privileges
This function checks that the current user is logged in, and optionally whether they are allowed to be in a particular course and view a particular course module. If they are not logged in, then it redirects them to the site login unless $autologinguest is set and $CFG->autologinguests is set to 1 in which case they are automatically logged in as guests. If $courseid is given and the user is not enrolled in that course then the user is redirected to the course enrolment page. If $cm is given and the course module is hidden and the user is not a teacher in the course then the user is redirected to the course home page.
When $cm parameter specified, this function sets page layout to 'module'. You need to change it manually later if some other layout needed.
| mixed | $courseorid | id of the course or course object |
| bool | $autologinguest | default true |
| object | $cm | course module object |
| bool | $setwantsurltome | Define if we want to set $SESSION->wantsurl, defaults to true. Used to avoid (=false) some scripts (file.php...) to set that variable, in order to keep redirects working properly. MDL-14495 |
| bool | $preventredirect | set to true in scripts that can not redirect (CLI, rss feeds, etc.), throws exceptions |
Definition at line 2575 of file moodlelib.php.


| require_logout | ( | ) |
This function just makes sure a user is logged out.
object
Definition at line 2882 of file moodlelib.php.


| require_user_key_login | ( | $ | script, |
| $ | instance = null |
||
| ) |
Require key login. Function terminates with error if key not found or incorrect.
object object object object NO_MOODLE_COOKIES PARAM_ALPHANUM
| string | $script | unique script identifier |
| int | $instance | optional instance id |
extra safety
emulate normal session
note we are not using normal login
return instance id - it might be empty
Definition at line 2999 of file moodlelib.php.

| required_param | ( | $ | parname, |
| $ | type | ||
| ) |
PARAMETER HANDLING ////////////////////////////////////////////////////.
Returns a particular value for the named variable, taken from POST or GET. If the parameter doesn't exist then an error is thrown because we require this variable.
This function should be used to initialise all required values in a script that are based on parameters. Usually it will be used like this: $id = required_param('id', PARAM_INT);
Please note the $type parameter is now required and the value can not be array.
| string | $parname | the name of the page parameter we want |
| string | $type | expected type of parameter |
Definition at line 485 of file moodlelib.php.

| required_param_array | ( | $ | parname, |
| $ | type | ||
| ) |
Returns a particular array value for the named variable, taken from POST or GET. If the parameter doesn't exist then an error is thrown because we require this variable.
This function should be used to initialise all required values in a script that are based on parameters. Usually it will be used like this: $ids = required_param_array('ids', PARAM_INT);
Note: arrays of arrays are not supported, only alphanumeric keys with _ and - are supported
| string | $parname | the name of the page parameter we want |
| string | $type | expected type of parameter |
Definition at line 523 of file moodlelib.php.


| reset_course_userdata | ( | $ | data | ) |
This function will empty a course of user data. It will retain the activities and the structure of the course.
| object | $data | an object containing all the settings including courseid (without magic quotes) |
Definition at line 4601 of file moodlelib.php.

Resets login attempts
object
Definition at line 3262 of file moodlelib.php.

| reset_password_and_mail | ( | $ | user | ) |
Resets specified user's password and send the new password to the user via email.
| stdClass | $user | A $USER object |
Definition at line 5292 of file moodlelib.php.

| send_confirmation_email | ( | $ | user | ) |
Send email to specified user with confirmation text and activation link.
object
| user | $user | A $USER object |
Definition at line 5337 of file moodlelib.php.


| send_password_change_confirmation_email | ( | $ | user | ) |
send_password_change_confirmation_email.
object
| user | $user | A $USER object |
Definition at line 5368 of file moodlelib.php.

| send_password_change_info | ( | $ | user | ) |
send_password_change_info.
object
| user | $user | A $USER object |
Definition at line 5396 of file moodlelib.php.

| set_bounce_count | ( | $ | user, |
| $ | reset = false |
||
| ) |
Increment or reset user's email bounce count
object
| user | $user | object containing an id |
| bool | $reset | will reset the count to 0 |
Definition at line 3218 of file moodlelib.php.

| set_cache_flag | ( | $ | type, |
| $ | name, | ||
| $ | value, | ||
| $ | expiry = NULL |
||
| ) |
Set a volatile flag
| string | $type | the "type" namespace for the key |
| string | $name | the key to set |
| string | $value | the value to set (without magic quotes) - NULL will remove the flag |
| int | $expiry | (optional) epoch indicating expiry - defaults to now()+ 24hs |
Definition at line 1499 of file moodlelib.php.


| set_config | ( | $ | name, |
| $ | value, | ||
| $ | plugin = NULL |
||
| ) |
Set a key in global configuration
Set a key/value pair in both this session's $CFG global variable and in the 'config' database table for future sessions.
Can also be used to update keys for plugin-scoped configs in config_plugin table. In that case it doesn't affect $CFG.
A NULL value will delete the entry.
object object
| string | $name | the key to set |
| string | $value | the value to set (without magic quotes) |
| string | $plugin | (optional) the plugin scope, default NULL |
Definition at line 1213 of file moodlelib.php.
When logging in, this function is run to set certain preferences for the current SESSION
object object
Definition at line 4252 of file moodlelib.php.

| set_mnet_remote_client | ( | $ | client | ) |
during the xmlrpc server code execution, this will be called to setup the object returned by {
| mnet_remote_client | $client | the client to set up |
Definition at line 10405 of file moodlelib.php.
| set_send_count | ( | $ | user, |
| $ | reset = false |
||
| ) |
Used to increment or reset email sent count
object
| user | $user | object containing an id |
| bool | $reset | will reset the count to 0 |
No real (DB) user, nothing to do here.
Definition at line 3190 of file moodlelib.php.

| set_user_device_type | ( | $ | newdevice | ) |
Allows the user to switch the device they are seeing the theme for. This allows mobile users to switch back to the default theme, or theme for any other device.
| string | $newdevice | The device the user is currently using. |
Definition at line 8286 of file moodlelib.php.

| set_user_preference | ( | $ | name, |
| $ | value, | ||
| $ | user = null |
||
| ) |
Sets a preference for the specified user.
If user object submitted, 'preference' property contains the preferences cache.
| string | $name | The key to set as preference for the specified user |
| string | $value | The value to set for the $name key in the specified user's record, null means delete current value |
| stdClass | int | $user | A moodle user object or id, null means current user |
Definition at line 1639 of file moodlelib.php.


| set_user_preferences | ( | array $ | prefarray, |
| $ | user = null |
||
| ) |
Sets a whole array of preferences for the current user
If user object submitted, 'preference' property contains the preferences cache.
| array | $prefarray | An array of key/value pairs to be set |
| stdClass | int | $user | A moodle user object or id, null means current user |
Definition at line 1710 of file moodlelib.php.


| setnew_password_and_mail | ( | $ | user | ) |
Sets specified user's password and send the new password to the user via email.
object object
| user | $user | A $USER object |
Definition at line 5258 of file moodlelib.php.


This function will search for browser prefereed languages, setting Moodle to use the best one available if $SESSION->lang is undefined
object object object
Extract and clean langs from headers
Look for such langs under standard locations
Lang exists, set it in session
We have finished. Go out
Definition at line 10098 of file moodlelib.php.

| shift_course_mod_dates | ( | $ | modname, |
| $ | fields, | ||
| $ | timeshift, | ||
| $ | courseid | ||
| ) |
Change dates in module - used from course reset.
object object
| string | $modname | forum, assignment, etc |
| array | $fields | array of date fields from mod table |
| int | $timeshift | time difference |
| int | $courseid |
Definition at line 4574 of file moodlelib.php.

| shorten_text | ( | $ | text, |
| $ | ideal = 30, |
||
| $ | exact = false, |
||
| $ | ending = '...' |
||
| ) |
Given some text (which may contain HTML) and an ideal length, this function truncates the text neatly on a word boundary if possible
object
| string | $text | - text to be shortened |
| int | $ideal | - ideal string length |
| boolean | $exact | if false, $text will not be cut mid-word |
| string | $ending | The string to append if the passed string is truncated |
Definition at line 8709 of file moodlelib.php.

| site_scale_used | ( | $ | scaleid, |
| &$ | courses | ||
| ) |
This function returns the number of activities using scaleid in the entire site
| int | $scaleid | |
| array | $courses |
Definition at line 9149 of file moodlelib.php.


| swapshuffle | ( | $ | array | ) |
Given a simple array, this shuffles it up just like shuffle() Unlike PHP's shuffle() this function works on any machine.
| array | $array | The array to be rearranged |
Definition at line 8967 of file moodlelib.php.

| swapshuffle_assoc | ( | $ | array | ) |
Like swapshuffle(), but works on associative arrays
| array | $array | The associative array to be rearranged |
Definition at line 8986 of file moodlelib.php.

| truncate_userinfo | ( | $ | info | ) |
Will truncate userinfo as it comes from auth_get_userinfo (from external auth) which may have large fields
| array | $info | Array of user properties to truncate if needed |
Definition at line 3699 of file moodlelib.php.


| unformat_float | ( | $ | locale_float | ) |
Converts locale specific floating point/comma number back to standard PHP float value Do NOT try to do any math operations before this conversion on any user submitted floats!
| string | $locale_float | locale aware float representation |
Definition at line 8948 of file moodlelib.php.

| unset_all_config_for_plugin | ( | $ | plugin | ) |
Remove all the config variables for a given plugin.
| string | $plugin | a plugin, for example 'quiz' or 'qtype_multichoice'; |
Definition at line 1365 of file moodlelib.php.

| unset_cache_flag | ( | $ | type, |
| $ | name | ||
| ) |
Removes a single volatile flag
object
| string | $type | the "type" namespace for the key |
| string | $name | the key to set |
Definition at line 1542 of file moodlelib.php.

| unset_config | ( | $ | name, |
| $ | plugin = NULL |
||
| ) |
Removes a key from global configuration
| string | $name | the key to set |
| string | $plugin | (optional) the plugin scope object |
Definition at line 1346 of file moodlelib.php.

| unset_user_preference | ( | $ | name, |
| $ | user = null |
||
| ) |
Unsets a preference completely by deleting it from the database
If user object submitted, 'preference' property contains the preferences cache.
| string | $name | The key to unset as preference for the specified user |
| stdClass | int | $user | A moodle user object or id, null means current user |
Definition at line 1726 of file moodlelib.php.


| update_internal_user_password | ( | $ | user, |
| $ | password | ||
| ) |
Update password hash in user object.
| stdClass | $user | (password property may be updated) |
| string | $password | plain text password |
Definition at line 4087 of file moodlelib.php.


Keeps track of login attempts
object
Definition at line 3240 of file moodlelib.php.


Modify the user table by setting the currently logged in user's last login to now.
object object
Definition at line 3119 of file moodlelib.php.

| update_user_record | ( | $ | username | ) |
Will update a local user record from an external source. (MNET users can not be updated using this method!)
| string | $username | user's username to update the record |
just in case check text case
Definition at line 3640 of file moodlelib.php.


| upgrade_set_timeout | ( | $ | max_execution_time = 300 | ) |
Sets maximum expected time needed for upgrade task. Please always make sure that upgrade will not run longer!
The script may be automatically aborted if upgrade times out.
object
| int | $max_execution_time | in seconds (can not be less than 60 s) |
Definition at line 8510 of file moodlelib.php.


| user_not_fully_set_up | ( | $ | user | ) |
Determines if a user has completed setting up their account.
| user | $user | A $USER object to test for the existence of a valid name and email |
Definition at line 3138 of file moodlelib.php.


Returns a formatted string that represents a date in user time
Returns a formatted string that represents a date in user time WARNING: note that the format is for strftime(), not date(). Because of a bug in most Windows time libraries, we can't use the nicer e, so we have to use d which has leading zeroes. A lot of the fuss in the function is just getting rid of these leading zeroes as efficiently as possible.
If parameter fixday = true (default), then take off leading zero from d, else maintain it.
| int | $date | the timestamp in UTC, as obtained from the database. |
| string | $format | strftime format. You should probably get this using get_string('strftime...', 'langconfig'); |
| mixed | $timezone | by default, uses the user's time zone. if numeric and not 99 then daylight saving will not be added. |
| bool | $fixday | If true (default) then the leading zero from d is removed. If false then the leading zero is maintained. |
Server time
If we are running under Windows convert from windows encoding to UTF-8 (because it's impossible to specify UTF-8 to fetch locale info in Win32)
Definition at line 1941 of file moodlelib.php.

| usergetdate | ( | $ | time, |
| $ | timezone = 99 |
||
| ) |
Given a $time timestamp in GMT (seconds since epoch), returns an array that represents the date in user time
| int | $time | Timestamp in GMT |
| mixed | $timezone | offset time with timezone, if float and not 99, then no dst offset is applyed |
Definition at line 2007 of file moodlelib.php.


| usergetmidnight | ( | $ | date, |
| $ | timezone = 99 |
||
| ) |
Given a time, return the GMT timestamp of the most recent midnight for the current user.
| int | $date | Timestamp in GMT |
| float | $timezone | Defaults to user's timezone |
Definition at line 2072 of file moodlelib.php.


| usertime | ( | $ | date, |
| $ | timezone = 99 |
||
| ) |
Given a GMT timestamp (seconds since epoch), offsets it by the timezone. eg 3pm in India is 3pm GMT - 7 * 3600 seconds
HOURSECS
| int | $date | Timestamp in GMT |
| float | $timezone |
Definition at line 2054 of file moodlelib.php.


| usertimezone | ( | $ | timezone = 99 | ) |
Returns a string that prints the user's timezone
| float | $timezone | The user's timezone |
Definition at line 2087 of file moodlelib.php.


| valid_uploaded_file | ( | $ | newfile | ) |
Returns current name of file on disk if it exists.
| string | $newfile | File to be verified |
Definition at line 5587 of file moodlelib.php.
| validate_internal_user_password | ( | $ | user, |
| $ | password | ||
| ) |
Compare password against hash stored in internal user table. If necessary it also updates the stored hash to new format.
| stdClass | $user | (password property may be updated) |
| string | $password | plain text password |
Definition at line 4024 of file moodlelib.php.


| validate_param | ( | $ | param, |
| $ | type, | ||
| $ | allownull = NULL_NOT_ALLOWED, |
||
| $ | debuginfo = '' |
||
| ) |
Strict validation of parameter values, the values are only converted to requested PHP type. Internally it is using clean_param, the values before and after cleaning must be equal - otherwise an invalid_parameter_exception is thrown. Objects and classes are not accepted.
| mixed | $param | |
| string | $type | PARAM_ constant |
| bool | $allownull | are nulls valid value? |
| string | $debuginfo | optional debug information |
Definition at line 650 of file moodlelib.php.

