Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/moodlelib.php File Reference

Go to the source code of this file.

Data Structures

interface  string_manager
class  core_string_manager
class  install_string_manager
class  emoticon_manager

Namespaces

namespace  core
namespace  moodlecore

Enumerations

enum  YEARSECS
 CONSTANTS (Encased in phpdoc proper comments)/////////////////////////. More...
enum  WEEKSECS
enum  DAYSECS
enum  HOURSECS
enum  MINSECS
enum  DAYMINS
enum  HOURMINS
enum  PARAM_ALPHA
enum  PARAM_ALPHAEXT
enum  PARAM_ALPHANUM
enum  PARAM_ALPHANUMEXT
enum  PARAM_AUTH
enum  PARAM_BASE64
enum  PARAM_BOOL
enum  PARAM_CAPABILITY
enum  PARAM_CLEANHTML
enum  PARAM_EMAIL
enum  PARAM_FILE
enum  PARAM_FLOAT
enum  PARAM_HOST
enum  PARAM_INT
enum  PARAM_LANG
enum  PARAM_LOCALURL
enum  PARAM_NOTAGS
enum  PARAM_PATH
enum  PARAM_PEM
enum  PARAM_PERMISSION
enum  PARAM_RAW
enum  PARAM_RAW_TRIMMED
enum  PARAM_SAFEDIR
enum  PARAM_SAFEPATH
enum  PARAM_SEQUENCE
enum  PARAM_TAG
enum  PARAM_TAGLIST
enum  PARAM_TEXT
enum  PARAM_THEME
enum  PARAM_URL
enum  PARAM_USERNAME
enum  PARAM_STRINGID
enum  PARAM_CLEAN
enum  PARAM_INTEGER
enum  PARAM_NUMBER
enum  PARAM_ACTION
enum  PARAM_FORMAT
enum  PARAM_MULTILANG
enum  PARAM_TIMEZONE
enum  PARAM_CLEANFILE
enum  PARAM_COMPONENT
enum  PARAM_AREA
enum  PARAM_PLUGIN
enum  VALUE_REQUIRED
 Web Services ///. More...
enum  VALUE_OPTIONAL
enum  VALUE_DEFAULT
enum  NULL_NOT_ALLOWED
enum  NULL_ALLOWED
enum  PAGE_COURSE_VIEW
 Page types ///. More...
enum  GETREMOTEADDR_SKIP_HTTP_CLIENT_IP
enum  GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR
enum  BLOG_USER_LEVEL
 Blog access level constant declaration ///. More...
enum  BLOG_GROUP_LEVEL
enum  BLOG_COURSE_LEVEL
enum  BLOG_SITE_LEVEL
enum  BLOG_GLOBAL_LEVEL
enum  TAG_MAX_LENGTH
 Tag constants///. More...
enum  PASSWORD_LOWER
 Password policy constants ///. More...
enum  PASSWORD_UPPER
enum  PASSWORD_DIGITS
enum  PASSWORD_NONALPHANUM
enum  FEATURE_GRADE_HAS_GRADE
 Feature constants ///. More...
enum  FEATURE_GRADE_OUTCOMES
enum  FEATURE_ADVANCED_GRADING
enum  FEATURE_COMPLETION_TRACKS_VIEWS
enum  FEATURE_COMPLETION_HAS_RULES
enum  FEATURE_NO_VIEW_LINK
enum  FEATURE_IDNUMBER
enum  FEATURE_GROUPS
enum  FEATURE_GROUPINGS
enum  FEATURE_GROUPMEMBERSONLY
enum  FEATURE_MOD_ARCHETYPE
enum  FEATURE_MOD_INTRO
enum  FEATURE_MODEDIT_DEFAULT_COMPLETION
enum  FEATURE_COMMENT
enum  FEATURE_RATE
enum  FEATURE_BACKUP_MOODLE2
enum  FEATURE_SHOW_DESCRIPTION
enum  MOD_ARCHETYPE_OTHER
enum  MOD_ARCHETYPE_RESOURCE
enum  MOD_ARCHETYPE_ASSIGNMENT
enum  EXTERNAL_TOKEN_PERMANENT
enum  EXTERNAL_TOKEN_EMBEDDED
enum  HOMEPAGE_SITE
enum  HOMEPAGE_MY
enum  HOMEPAGE_USER
enum  HUB_HUBDIRECTORYURL
enum  HUB_MOODLEORGHUBURL
enum  MOODLE_OFFICIAL_MOBILE_SERVICE

Functions

 required_param ($parname, $type)
 PARAMETER HANDLING ////////////////////////////////////////////////////.
 required_param_array ($parname, $type)
 optional_param ($parname, $default, $type)
 optional_param_array ($parname, $default, $type)
 validate_param ($param, $type, $allownull=NULL_NOT_ALLOWED, $debuginfo='')
 clean_param_array (array $param=null, $type, $recursive=false)
 clean_param ($param, $type)
 fix_utf8 ($value)
 is_number ($value)
 get_host_from_url ($url)
 html_is_blank ($string)
 set_config ($name, $value, $plugin=NULL)
 get_config ($plugin, $name=NULL)
 unset_config ($name, $plugin=NULL)
 unset_all_config_for_plugin ($plugin)
 get_users_from_config ($value, $capability, $includeadmins=true)
 purge_all_caches ()
 get_cache_flags ($type, $changedsince=NULL)
 get_cache_flag ($type, $name, $changedsince=NULL)
 set_cache_flag ($type, $name, $value, $expiry=NULL)
 unset_cache_flag ($type, $name)
 gc_cache_flags ()
 check_user_preferences_loaded (stdClass $user, $cachelifetime=120)
 FUNCTIONS FOR HANDLING USER PREFERENCES ////////////////////////////////////.
 mark_user_preferences_changed ($userid)
 set_user_preference ($name, $value, $user=null)
 set_user_preferences (array $prefarray, $user=null)
 unset_user_preference ($name, $user=null)
 get_user_preferences ($name=null, $default=null, $user=null)
 make_timestamp ($year, $month=1, $day=1, $hour=0, $minute=0, $second=0, $timezone=99, $applydst=true)
 FUNCTIONS FOR HANDLING TIME ////////////////////////////////////////////.
 format_time ($totalsecs, $str=NULL)
 userdate ($date, $format= '', $timezone=99, $fixday=true)
 usergetdate ($time, $timezone=99)
 usertime ($date, $timezone=99)
 usergetmidnight ($date, $timezone=99)
 usertimezone ($timezone=99)
 get_user_timezone_offset ($tz=99)
 get_timezone_offset ($tz)
 get_user_timezone ($tz=99)
 get_timezone_record ($timezonename)
 calculate_user_dst_table ($from_year=NULL, $to_year=NULL, $strtimezone=NULL)
 dst_changes_for_year ($year, $timezone)
 dst_offset_on ($time, $strtimezone=NULL)
 find_day_in_month ($startday, $weekday, $month, $year)
 days_in_month ($month, $year)
 dayofweek ($day, $month, $year)
 get_login_url ()
 USER AUTHENTICATION AND LOGIN ////////////////////////////////////////.
 require_login ($courseorid=NULL, $autologinguest=true, $cm=NULL, $setwantsurltome=true, $preventredirect=false)
 require_logout ()
 require_course_login ($courseorid, $autologinguest=true, $cm=NULL, $setwantsurltome=true, $preventredirect=false)
 require_user_key_login ($script, $instance=null)
 create_user_key ($script, $userid, $instance=null, $iprestriction=null, $validuntil=null)
 delete_user_key ($script, $userid)
 get_user_key ($script, $userid, $instance=null, $iprestriction=null, $validuntil=null)
 update_user_login_times ()
 user_not_fully_set_up ($user)
 over_bounce_threshold ($user)
 set_send_count ($user, $reset=false)
 set_bounce_count ($user, $reset=false)
 update_login_count ()
 reset_login_count ()
 isediting ()
 ismoving ($courseid)
 fullname ($user, $override=false)
 get_extra_user_fields ($context, $already=array())
 get_extra_user_fields_sql ($context, $alias='', $prefix='', $already=array())
 get_user_field_name ($field)
 exists_auth_plugin ($auth)
 is_enabled_auth ($auth)
 get_auth_plugin ($auth)
 get_enabled_auth_plugins ($fix=false)
 is_internal_auth ($auth)
 is_restored_user ($username)
 get_user_fieldnames ()
 create_user_record ($username, $password, $auth= 'manual')
 update_user_record ($username)
 truncate_userinfo ($info)
 delete_user ($user)
 guest_user ()
 authenticate_user_login ($username, $password)
 complete_user_login ($user)
 validate_internal_user_password ($user, $password)
 hash_internal_user_password ($password)
 update_internal_user_password ($user, $password)
 get_complete_user_data ($field, $value, $mnethostid=null)
 check_password_policy ($password, &$errmsg)
 set_login_session_preferences ()
 delete_course ($courseorid, $showfeedback=true)
 remove_course_contents ($courseid, $showfeedback=true, array $options=null)
 shift_course_mod_dates ($modname, $fields, $timeshift, $courseid)
 reset_course_userdata ($data)
 generate_email_processing_address ($modid, $modargs)
 moodle_process_email ($modargs, $body)
 get_mailer ($action='get')
 CORRESPONDENCE ////////////////////////////////////////////////.
 email_to_user ($user, $from, $subject, $messagetext, $messagehtml='', $attachment='', $attachname='', $usetrueaddress=true, $replyto='', $replytoname='', $wordwrapwidth=79)
 generate_email_signoff ()
 generate_email_supportuser ()
 setnew_password_and_mail ($user)
 reset_password_and_mail ($user)
 send_confirmation_email ($user)
 send_password_change_confirmation_email ($user)
 send_password_change_info ($user)
 email_is_not_allowed ($email)
 get_file_storage ()
 FILE HANDLING /////////////////////////////////////////////.
 get_file_browser ()
 get_file_packer ($mimetype='application/zip')
 valid_uploaded_file ($newfile)
 get_max_upload_file_size ($sitebytes=0, $coursebytes=0, $modulebytes=0)
 get_max_upload_sizes ($sitebytes=0, $coursebytes=0, $modulebytes=0)
 get_directory_list ($rootdir, $excludefiles='', $descend=true, $getdirs=false, $getfiles=true)
 get_directory_size ($rootdir, $excludefile='')
 display_size ($size)
 clean_filename ($string)
 current_language ()
 STRING TRANSLATION ////////////////////////////////////////.
 get_parent_language ($lang=null)
 get_string_manager ($forcereload=false)
 get_string ($identifier, $component= '', $a=NULL)
 get_strings ($array, $component= '')
 print_string ($identifier, $component= '', $a=NULL)
 get_list_of_charsets ()
 get_list_of_themes ()
 get_list_of_timezones ()
 get_emoticon_manager ()
 rc4encrypt ($data)
 ENCRYPTION ////////////////////////////////////////////////.
 rc4decrypt ($data)
 endecrypt ($pwd, $data, $case)
 get_plugin_directory ($plugintype, $name)
 ENVIRONMENT CHECKING ////////////////////////////////////////////////////////////.
 get_component_directory ($component)
 normalize_component ($component)
 get_core_subsystems ()
 get_plugin_types ($fullpaths=true)
 get_plugin_list ($plugintype)
 get_plugin_list_with_file ($plugintype, $file, $include=false)
 get_plugin_list_with_function ($plugintype, $function, $file= 'lib.php')
 get_plugin_list_with_class ($plugintype, $class, $file)
 get_list_of_plugins ($directory='mod', $exclude='', $basedir='')
 plugin_callback ($type, $name, $feature, $action, $params=null, $default=null)
 component_callback ($component, $function, array $params=array(), $default=null)
 plugin_supports ($type, $name, $feature, $default=NULL)
 check_php_version ($version='5.2.4')
 check_browser_operating_system ($brand)
 check_browser_version ($brand, $version=null)
 get_device_type ()
 get_device_type_list ($incusertypes=true)
 get_selected_theme_for_device_type ($devicetype=null)
 get_device_cfg_var_name ($devicetype=null)
 set_user_device_type ($newdevice)
 get_user_device_type ()
 get_browser_version_classes ()
 can_use_rotated_text ()
 check_gd_version ()
 moodle_needs_upgrading ()
 upgrade_set_timeout ($max_execution_time=300)
 moodle_setlocale ($locale='')
 MISCELLANEOUS ////////////////////////////////////////////////////////////////////.
 moodle_strtolower ($string, $encoding='')
 count_words ($string)
 count_letters ($string)
 random_string ($length=15)
 complex_random_string ($length=null)
 shorten_text ($text, $ideal=30, $exact=false, $ending='...')
 getweek ($startdate, $thedate)
 generate_password ($maxlen=10)
 format_float ($float, $decimalpoints=1, $localized=true)
 unformat_float ($locale_float)
 swapshuffle ($array)
 swapshuffle_assoc ($array)
 draw_rand_array ($array, $draws)
 microtime_diff ($a, $b)
 make_menu_from_list ($list, $separator=',')
 make_grades_menu ($gradingtype)
 course_scale_used ($courseid, $scaleid)
 site_scale_used ($scaleid, &$courses)
 make_unique_id_code ($extra='')
 address_in_subnet ($addr, $subnetstr)
 mtrace ($string, $eol="\n", $sleep=0)
 cleardoubleslashes ($path)
 remoteip_in_list ($list)
 getremoteaddr ($default='0.0.0.0')
 cleanremoteaddr ($addr, $compress=false)
 fullclone ($thing)
 moodle_request_shutdown ()
 message_popup_window ()
 bounded_number ($min, $value, $max)
 array_is_nested ($array)
 get_performance_info ()
 apd_get_profiling ()
 remove_dir ($dir, $content_only=false)
 object_property_exists ($obj, $property)
 custom_script_path ()
 is_mnet_remote_user ($user)
 setup_lang_from_browser ()
 is_proxybypass ($url)
 is_newnav ($navigation)
 in_object_vars ($var, $object)
 object_array_unique ($array, $keep_key_assoc=true)
 is_primary_admin ($userid)
 get_site_identifier ()
 check_consecutive_identical_characters ($password, $maxchars)
 partial ()
 get_mnet_environment ()
 get_mnet_remote_client ()
 set_mnet_remote_client ($client)
 mnet_get_idp_jump_url ($user)
 get_home_page ()

Enumeration Type Documentation

Definition at line 351 of file moodlelib.php.

Definition at line 353 of file moodlelib.php.

Definition at line 350 of file moodlelib.php.

Definition at line 352 of file moodlelib.php.

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.

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.

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.

True if module supports groups

Definition at line 392 of file moodlelib.php.

True if module supports outcomes

Definition at line 390 of file moodlelib.php.

Type of module

Definition at line 399 of file moodlelib.php.

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.

True if module has no 'view' page (like label)

Definition at line 388 of file moodlelib.php.

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.

The home page should be the users my page

Definition at line 445 of file moodlelib.php.

The home page should be the site home

Definition at line 441 of file moodlelib.php.

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.

Hub directory url (should be moodle.org)

Definition at line 454 of file moodlelib.php.

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.

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.

NULL_ALLOWED - the parameter can be set to null in the database

Definition at line 335 of file moodlelib.php.

NULL_NOT_ALLOWED - the parameter can not be set to null in the database

Definition at line 330 of file moodlelib.php.

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.

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.

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.

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.

PARAM_ALPHANUM - expected numbers and letters only.

Definition at line 91 of file moodlelib.php.

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.

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.

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.

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 ;-)

Deprecated:
since 2.0

Definition at line 246 of file moodlelib.php.

PARAM_CLEANFILE - deprecated alias of PARAM_FILE; originally was removing regional chars too

Definition at line 285 of file moodlelib.php.

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.

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.

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.

PARAM_FLOAT - a real/floating point number.

Definition at line 137 of file moodlelib.php.

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.

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.

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.

PARAM_MULTILANG - deprecated alias of PARAM_TEXT.

Definition at line 273 of file moodlelib.php.

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.

PARAM_PERMISSION - A permission, one of CAP_INHERIT, CAP_ALLOW, CAP_PREVENT or CAP_PROHIBIT.

Definition at line 178 of file moodlelib.php.

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.

PARAM_RAW_TRIMMED like PARAM_RAW but leading and trailing whitespace is stripped.

Definition at line 188 of file moodlelib.php.

PARAM_SAFEDIR - safe directory name, suitable for include() and require()

Definition at line 193 of file moodlelib.php.

PARAM_SAFEPATH - several PARAM_SAFEDIR joined by "/", suitable for include() and require(), plugin paths, etc.

Definition at line 198 of file moodlelib.php.

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.

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.

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.

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.

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.

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.

Definition at line 369 of file moodlelib.php.

Password policy constants ///.

Definition at line 367 of file moodlelib.php.

Definition at line 370 of file moodlelib.php.

Definition at line 368 of file moodlelib.php.

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 ;-)

Todo:
define(TAG_MAX_LENGTH) this is not correct, varchar(255) are 255 unicode chars ;-)

Definition at line 364 of file moodlelib.php.

VALUE_DEFAULT - if the parameter is not supplied, then the default value is used

Definition at line 325 of file moodlelib.php.

VALUE_OPTIONAL - if the parameter is not supplied, then the param has no value

Definition at line 320 of file moodlelib.php.

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.


Function Documentation

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

Parameters:
string$addrThe address you are checking
string$subnetstrThe string of subnet addresses
Returns:
bool

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.

Here is the call graph for this function:

Here is the caller graph for this function:

Todo:
Document this function linux people

Definition at line 9989 of file moodlelib.php.

array_is_nested ( array)

Check if there is a nested array within the passed array

Parameters:
array$array
Returns:
bool true if there is a nested array false otherwise

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!

Parameters:
string$usernameUser's username
string$passwordUser's password
Returns:
user|flase A $USER object or false if error

Definition at line 3864 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

bounded_number ( min,
value,
max 
)

Used to make sure that $min <= $value <= $max

Make sure that value is between min, and max

Parameters:
int$minThe minimum value
int$valueThe value to check
int$maxThe maximum value

Definition at line 9813 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
mixed$from_yearStart year for the table, defaults to 1971
mixed$to_yearEnd year for the table, defaults to 2035
mixed$strtimezone,ifnull or 99 then user's default timezone is used
Returns:
bool

Definition at line 2231 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Can handle rotated text. Whether it is safe to use the trickery in textrotate.js.

Returns:
bool True for yes, false for no

Definition at line 8363 of file moodlelib.php.

Here is the call graph for this function:

Checks to see if is the browser operating system matches the specified brand.

Known brand: 'Windows','Linux','Macintosh','SGI','SunOS','HP-UX'

$_SERVER

Parameters:
string$brandThe operating system identifier being tested
Returns:
bool true if the given brand below to the detected operating system

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

Parameters:
string$brandThe browser identifier being tested
int$versionThe version of the browser, if not specified any version (except 5.5 for IE for BC reasons)
Returns:
bool true if the given version is below that of the detected browser

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.

Here is the caller graph for this function:

check_consecutive_identical_characters ( password,
maxchars 
)

Check whether the given password has no more than the specified number of consecutive identical characters.

Parameters:
string$passwordpassword to be checked against the password policy
integer$maxcharsmaximum number of consecutive identical characters

Definition at line 10293 of file moodlelib.php.

Here is the caller graph for this function:

Hack to find out the GD version by parsing phpinfo output

Returns:
int GD version (1, 2, or 0)

Definition at line 8373 of file moodlelib.php.

check_password_policy ( password,
&$  errmsg 
)

Validate a password against the configured password policy

object

Parameters:
string$passwordthe password to be checked against the password policy
string$errmsgthe error message to display when the password doesn't comply with the policy.
Returns:
bool true if the password is valid according to the policy. false otherwise.

Definition at line 4205 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

check_php_version ( version = '5.2.4')

Returns true if the current version of PHP is greater that the specified one.

Todo:
Check PHP version being required here is it too low?
Parameters:
string$versionThe version of php being tested.
Returns:
bool

Definition at line 7950 of file moodlelib.php.

Here is the caller graph for this function:

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.

Parameters:
stdClass$useruser object, preferences are preloaded into ->preference property
int$cachelifetimecache life time on the current page (ins seconds)
Returns:
void

Definition at line 1571 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

clean_filename ( string)

Cleans a given filename by removing suspicious or troublesome characters

See also:
clean_param()

PARAM_FILE

Parameters:
string$stringfile name
Returns:
string cleaned file name

Definition at line 5854 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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);

Parameters:
mixed$paramthe variable we are cleaning
string$typeexpected format of param after cleaning.
Returns:
mixed

Definition at line 712 of file moodlelib.php.

Here is the call graph for this function:

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);

Parameters:
array$paramthe variable array we are cleaning
string$typeexpected format of param after cleaning.
bool$recursiveclean recursive arrays
Returns:
array

Definition at line 683 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

cleanremoteaddr ( addr,
compress = false 
)

Cleans an ip address. Internal addresses are now allowed. (Originally local addresses were not allowed.)

Parameters:
string$addrIPv4 or IPv6 address
bool$compressuse IPv6 address compression
Returns:
string normalised ip address string, null if error

Definition at line 9531 of file moodlelib.php.

Here is the caller graph for this function:

cleardoubleslashes ( path)

Replace 1 or more slashes or backslashes to 1 slash

Parameters:
string$pathThe path to strip
Returns:
string the path with double slashes removed

Definition at line 9456 of file moodlelib.php.

Here is the caller graph for this function:

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:

  • It will NOT log anything -- up to the caller to decide what to log.
  • this function does not set any cookies any more!
Parameters:
object$user
Returns:
object A $USER object - BC only, do not use

Select password change url

check whether the user should be changing password

Definition at line 3970 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
int$lengthOptional if set generates a string to exactly this length
Returns:
string

Definition at line 8683 of file moodlelib.php.

Here is the caller graph for this function:

component_callback ( component,
function,
array params = array(),
default = null 
)

Invoke component's callback functions

Parameters:
string$componentfrankenstyle component name, e.g. 'mod_quiz'
string$functionthe rest of the function name, e.g. 'cron' will end up calling 'mod_quiz_cron'
array$paramsparameters of callback function
mixed$defaultdefault value if callback function hasn't been defined, or if it retursn null.
Returns:
mixed

Definition at line 7834 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

count_letters ( string)

Count letters in a string.

Letters are defined as chars not in tags and different from whitespace.

Parameters:
string$stringThe text to be searched for letters.
Returns:
int The count of letters in the specified text.

Loading the textlib singleton instance. We are going to need it.

Definition at line 8645 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

count_words ( string)

Count words in a string.

Words are defined as things between whitespace.

Parameters:
string$stringThe text to be searched for words.
Returns:
int The count of words in the specified string

Definition at line 8633 of file moodlelib.php.

Here is the caller graph for this function:

course_scale_used ( courseid,
scaleid 
)

This function returns the number of activities using scaleid in a courseid

Todo:
Finish documenting this function

object object

Parameters:
int$courseid?
int$scaleid?
Returns:
int

Definition at line 9106 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

create_user_key ( script,
userid,
instance = null,
iprestriction = null,
validuntil = null 
)

Creates a new private user access key.

object

Parameters:
string$scriptunique target identifier
int$userid
int$instanceoptional instance id
string$iprestrictionoptional ip restricted access
timestamp$validuntilkey valid only until given data
Returns:
string access key value

Definition at line 3054 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

create_user_record ( username,
password,
auth = 'manual' 
)

Creates a bare-bones user record

Todo:
Outline auth types and provide code example
Parameters:
string$usernameNew user's username to add to record
string$passwordNew user's password to add to record
string$authForm of authentication required
Returns:
stdClass A complete user object

Definition at line 3577 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

STRING TRANSLATION ////////////////////////////////////////.

Returns the code for the current language

Returns:
string

Definition at line 5866 of file moodlelib.php.

Here is the caller graph for this function:

Detect a custom script replacement in the data directory that will replace an existing moodle script

Returns:
string|bool full path name if a custom script exists, false if no custom script exists

Definition at line 10051 of file moodlelib.php.

dayofweek ( day,
month,
year 
)

Calculate the position in the week of a specific calendar day

Parameters:
int$dayThe day of the date whose position in the week is sought
int$monthThe month of the date whose position in the week is sought
int$yearThe year of the date whose position in the week is sought
Returns:
int

Definition at line 2523 of file moodlelib.php.

Here is the caller graph for this function:

days_in_month ( month,
year 
)

Calculate the number of days in a given month

Parameters:
int$monthThe month whose day count is sought
int$yearThe year of the month whose day count is sought
Returns:
int

Definition at line 2511 of file moodlelib.php.

Here is the caller graph for this function:

delete_course ( courseorid,
showfeedback = true 
)

Delete a course, including all related data from the database, and any associated files.

object object

Parameters:
mixed$courseoridThe id of the course or course object to delete.
bool$showfeedbackWhether to display notifications of each action the function performs.
Returns:
bool true if all the removals succeeded. false if there were any failures. If this method returns false, some of the removals will probably have succeeded, and others failed, but you have no way of knowing which.

Definition at line 4273 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
stdClass$userfull user object before delete
Returns:
boolean always true

Definition at line 3738 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

delete_user_key ( script,
userid 
)

Delete the user's new private user access keys for a particular script.

object

Parameters:
string$scriptunique target identifier
int$userid
Returns:
void

Definition at line 3082 of file moodlelib.php.

Here is the caller graph for this function:

display_size ( size)

Converts bytes into display form

Todo:
Finish documenting this function. Verify return type.

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

Parameters:
int$sizeThe size to convert to human readable form
Returns:
string

Definition at line 5823 of file moodlelib.php.

Here is the caller graph for this function:

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.

Todo:
Finish documenting this function
Parameters:
array$array
int$draws
Returns:
array

Definition at line 9008 of file moodlelib.php.

Here is the caller graph for this function:

dst_changes_for_year ( year,
timezone 
)

Calculates the required DST change and returns a Timestamp Array

HOURSECS MINSECS

Parameters:
mixed$yearInt or String Year to focus on
object$timezoneInstatiated Timezone object
Returns:
mixed Null, or Array dst=>xx, 0=>xx, std=>yy, 1=>yy

Definition at line 2362 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

dst_offset_on ( time,
strtimezone = NULL 
)

Calculates the Daylight Saving Offset for a given date/time (timestamp)

  • Note: Daylight saving only works for string timezones and not for float.

object

Parameters:
int$timemust NOT be compensated at all, it has to be a pure timestamp
mixed$strtimezonetimezone for which offset is expected, if 99 or null then user's default timezone is used.
Returns:
int

Definition at line 2397 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

email_is_not_allowed ( email)

Check that an email is allowed. It returns an error message if there was a problem.

object

Parameters:
string$emailContent of email
Returns:
string|false

Definition at line 5448 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
stdClass$userA $USER object
stdClass$fromA $USER object
string$subjectplain text subject line of the email
string$messagetextplain text version of the message
string$messagehtmlcomplete html version of the message (optional)
string$attachmenta file on the filesystem, relative to $CFG->dataroot
string$attachnamethe name of the file (extension indicates MIME)
bool$usetrueaddressdetermines whether $from email address should be sent out. Will be overruled by user profile setting for maildisplay
string$replytoEmail address to reply to
string$replytonameName of reply to recipient
int$wordwrapwidthcustom word wrap width, default 79
Returns:
bool Returns true if mail was sent OK and false if there was an error.

Definition at line 5005 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

endecrypt ( pwd,
data,
case 
)

Based on a class by Mukul Sabharwal [mukulsabharwal @ yahoo.com]

Todo:
Finish documenting this function
Parameters:
string$pwdThe password to use when encrypting or decrypting
string$dataThe data to be decrypted/encrypted
string$caseEither 'de' for decrypt or '' for encrypt
Returns:
string

Definition at line 7283 of file moodlelib.php.

Here is the caller graph for this function:

exists_auth_plugin ( auth)

Returns whether a given authentication plugin exists.

object

Parameters:
string$authForm of authentication to check for. Defaults to the global setting in $CFG.
Returns:
boolean Whether the plugin is available.

Definition at line 3444 of file moodlelib.php.

Here is the caller graph for this function:

find_day_in_month ( startday,
weekday,
month,
year 
)

?

Todo:
Document what this function does
Parameters:
int$startday
int$weekday
int$month
int$year
Returns:
int

Definition at line 2448 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
mixed$value
Returns:
mixed with proper utf-8 encoding

Definition at line 1121 of file moodlelib.php.

Here is the caller graph for this function:

format_float ( float,
decimalpoints = 1,
localized = true 
)

Given a float, prints it nicely. Localized floats must not be used in calculations!

Parameters:
float$floatThe float to print
int$placesThe number of decimal places to print.
bool$localizeduse localized decimal separator
Returns:
string locale float

Definition at line 8930 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
int$totalsecsTime in seconds
object$strShould be a time object
Returns:
string A nicely formatted date/time string

Definition at line 1865 of file moodlelib.php.

Here is the caller graph for this function:

fullclone ( thing)

This function will make a complete copy of anything it's given, regardless of whether it's an object or not.

Parameters:
mixed$thingSomething you want cloned
Returns:
mixed What ever it is you passed it

Definition at line 9635 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
object$userA $USER object to get full name of
bool$overrideIf true then the name will be first name followed by last name rather than adhering to fullnamedisplay setting.
Returns:
string

Definition at line 3317 of file moodlelib.php.

Garbage-collect volatile flags

Returns:
bool Always returns true

Definition at line 1553 of file moodlelib.php.

Here is the caller graph for this function:

generate_email_processing_address ( modid,
modargs 
)

Generate an email processing address

Parameters:
int$modid
string$modargs
Returns:
string Returns email processing address

Definition at line 4819 of file moodlelib.php.

Here is the caller graph for this function:

Generate a signoff for emails based on support settings

object

Returns:
string

Definition at line 5210 of file moodlelib.php.

Here is the caller graph for this function:

Generate a fake user for emails based on support settings object

Returns:
object user info

Definition at line 5231 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
int$maxlenThe maximum size of the password being generated.
Returns:
string

Definition at line 8865 of file moodlelib.php.

Here is the caller graph for this function:

get_auth_plugin ( auth)

Returns an authentication plugin instance.

object

Parameters:
string$authname of authentication plugin
Returns:
auth_plugin_base An instance of the required authentication plugin.

Definition at line 3476 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Returns:
array An array of browser version classes

Definition at line 8320 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_cache_flag ( type,
name,
changedsince = NULL 
)

Get volatile flags

Parameters:
string$type
string$name
int$changedsincedefault null
Returns:
records array

Definition at line 1476 of file moodlelib.php.

Here is the caller graph for this function:

get_cache_flags ( type,
changedsince = NULL 
)

Get volatile flags

Parameters:
string$type
int$changedsincedefault null
Returns:
records array

Definition at line 1449 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
string$fieldThe user field to be checked for a given value.
string$valueThe value to match for $field.
int$mnethostid
Returns:
mixed False, or A $USER object.

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.

Here is the call graph for this function:

Here is the caller graph for this function:

get_component_directory ( component)

Return exact absolute path to a plugin directory, this method support "simpletest_" prefix designed for unit testing.

Parameters:
string$componentname such as 'moodle', 'mod_forum' or special simpletest value
Returns:
string full path to component directory; NULL if not found

Definition at line 7378 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
string$pluginfull component name
string$namedefault NULL
Returns:
mixed hash-like object or single value, return false no config found

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.

Returns:
array of (string)name => (string|null)location

Definition at line 7456 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
string$devicetype
Returns:
string The config variable to use to determine the theme

Definition at line 8271 of file moodlelib.php.

Here is the caller graph for this function:

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

Returns:
string device type

Definition at line 8183 of file moodlelib.php.

Here is the caller graph for this function:

get_device_type_list ( incusertypes = true)

Returns a list of the device types supporting by Moodle

Parameters:
boolean$incusertypesincludes types specified using the devicedetectregex admin setting
Returns:
array $types

Definition at line 8228 of file moodlelib.php.

Here is the caller graph for this function:

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!)

Todo:
Finish documenting this function. Add examples of $excludefile usage.
Parameters:
string$rootdirA given root directory to start from
string | array$excludefileIf defined then the specified file/directory is ignored
bool$descendIf true then subdirectories are recursed as well
bool$getdirsIf true then (sub)directories are included in the output
bool$getfilesIf true then files are included in the output
Returns:
array An array with all the filenames in all subdirectories, relative to the given rootdir

Definition at line 5713 of file moodlelib.php.

Here is the caller graph for this function:

get_directory_size ( rootdir,
excludefile = '' 
)

Adds up all the files in a directory and works out the size.

Todo:
Finish documenting this function
Parameters:
string$rootdirThe directory to start from
string$excludefileA file to exclude when summing directory size
Returns:
int The summed size of all files and subfiles within the root directory

Definition at line 5770 of file moodlelib.php.

Here is the call graph for this function:

Factory function for emoticon_manager

Returns:
emoticon_manager singleton

Definition at line 7096 of file moodlelib.php.

Here is the caller graph for this function:

get_enabled_auth_plugins ( fix = false)

Returns array of active auth plugins.

Parameters:
bool$fixfix $CFG->auth if needed
Returns:
array

Definition at line 3496 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_extra_user_fields ( context,
already = array() 
)

Checks if current user is shown any extra fields when listing users.

Parameters:
object$contextContext
array$alreadyArray of fields that we're going to show anyway so don't bother listing them
Returns:
array Array of field names from user table, not including anything listed in $already

Definition at line 3362 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
object$contextContext
string$aliasAlias of user table, e.g. 'u' (default none)
string$prefixPrefix for field names using AS, e.g. 'u_' (default none)
array$alreadyArray of fields that we're going to include anyway so don't list them (default none)
Returns:
string Partial SQL select clause, beginning with comma, for example ',u.idnumber,u.department' unless it is blank

Definition at line 3404 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns local file storage instance

Returns:
file_browser

Definition at line 5532 of file moodlelib.php.

Here is the caller graph for this function:

get_file_packer ( mimetype = 'application/zip')

Returns file packer

Parameters:
string$mimetypedefault application/zip
Returns:
file_packer

Definition at line 5554 of file moodlelib.php.

Here is the caller graph for this function:

FILE HANDLING /////////////////////////////////////////////.

Returns local file storage instance

Returns:
file_storage

Definition at line 5499 of file moodlelib.php.

Gets the homepage to use for the current user

Returns:
int One of HOMEPAGE_*

Definition at line 10436 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_host_from_url ( url)

Returns host part from url

Parameters:
string$urlfull url
Returns:
string host, null if not found

Definition at line 1172 of file moodlelib.php.

Here is the caller graph for this function:

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!)

Returns:
array And associative array with contents in the form of charset => charset

Definition at line 7000 of file moodlelib.php.

Here is the caller graph for this function:

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.

Parameters:
string$directoryrelative directory from root
string$excludedir name to exclude from the list (defaults to none)
string$basedirfull path to the base dir where $plugin resides (defaults to $CFG->dirroot)
Returns:
array Sorted array of directory names found under the requested parameters

Definition at line 7776 of file moodlelib.php.

Here is the caller graph for this function:

Returns a list of valid and compatible themes

Returns:
array

Definition at line 7021 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a list of timezones in the current language

object object

Returns:
array

Definition at line 7049 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

USER AUTHENTICATION AND LOGIN ////////////////////////////////////////.

Returns full login url.

Returns:
string login url

Definition at line 2536 of file moodlelib.php.

Here is the caller graph for this function:

get_mailer ( action = 'get')

CORRESPONDENCE ////////////////////////////////////////////////.

Get mailer instance, enable buffering, flush buffer or disable buffering.

object

Parameters:
string$action'get', 'buffer', 'close' or 'flush'
Returns:
object|null mailer instance if 'get' used or nothing

Definition at line 4865 of file moodlelib.php.

Here is the caller graph for this function:

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.

Todo:
Finish documenting this function
Parameters:
int$sizebytesSet maximum size
int$coursebytesCurrent course $course->maxbytes (in bytes)
int$modulebytesCurrent module ->maxbytes (in bytes)
Returns:
int The maximum size for uploading files.

Definition at line 5621 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Todo:
Finish documenting this function

object SORT_NUMERIC

Parameters:
int$sizebytesSet maximum size
int$coursebytesCurrent course $course->maxbytes (in bytes)
int$modulebytesCurrent module ->maxbytes (in bytes)
Returns:
array

Definition at line 5666 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

helper function to load up and initialise the mnet environment this must be called before you use mnet functions.

Returns:
mnet_environment the equivalent of old $MNET global

Definition at line 10370 of file moodlelib.php.

Here is the caller graph for this function:

during xmlrpc server code execution, any code wishing to access information about the remote peer must use this to get it.

Returns:
mnet_remote_client the equivalent of old $MNET_REMOTE_CLIENT global

Definition at line 10387 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_parent_language ( lang = null)

Returns parent language of current active language if defined

COURSE SESSION

Parameters:
string$langnull means current language
Returns:
string

Definition at line 5898 of file moodlelib.php.

Here is the caller graph for this function:

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

Returns:
array

Definition at line 9849 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_plugin_directory ( plugintype,
name 
)

ENVIRONMENT CHECKING ////////////////////////////////////////////////////////////.

Returns the exact absolute path to plugin directory.

Parameters:
string$plugintypetype of plugin
string$namename of the plugin
Returns:
string full path to plugin directory; NULL if not found

Definition at line 7348 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_plugin_list ( plugintype)

Simplified version of get_list_of_plugins()

Parameters:
string$plugintypetype of plugin
Returns:
array name=>fulllocation pairs of plugins of given type

Definition at line 7598 of file moodlelib.php.

Here is the call graph for this function:

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.

Parameters:
string$plugintypethe type of plugin, e.g. 'mod' or 'report'.
string$classthe 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$filethe name of file within the plugin that defines the class.
Returns:
array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum') and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice').

Definition at line 7745 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
string$plugintypethe type of plugin, e.g. 'mod' or 'report'.
string$filethe name of file that must be present in the plugin. (e.g. 'view.php', 'db/install.xml').
bool$includeif true (default false), the file will be include_once-ed if found.
Returns:
array with plugin name as keys (e.g. 'forum', 'courselist') and the path to the file relative to dirroot as value (e.g. "$CFG->dirroot/mod/forum/view.php").

Definition at line 7679 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
string$plugintypethe type of plugin, e.g. 'mod' or 'report'.
string$functionthe 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$filethe name of file within the plugin that defines the function. Defaults to lib.php.
Returns:
array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum') and the function names as values (e.g. 'report_courselist_hook', 'forum_hook').

Definition at line 7710 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_plugin_types ( fullpaths = true)

Lists all plugin types

Parameters:
bool$fullpathsfalse means relative paths from dirroot
Returns:
array Array of strings - name=>location

Definition at line 7536 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_selected_theme_for_device_type ( devicetype = null)

Returns the theme selected for a particular device or false if none selected.

Parameters:
string$devicetype
Returns:
string|false The name of the theme to use for the device or the false if not set

Definition at line 8250 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the site identifier

object

Returns:
string $CFG->siteidentifier, first making sure it is properly initialised.

Definition at line 10276 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

'. get_string('typecourse', 'calendar') .'

';

As a last resort, should the identifier fail to map to a string the returned string will be [[ $identifier ]]

Parameters:
string$identifierThe key identifier for the localized string
string$componentThe 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$aAn object, string or number that can be used within translation strings
Returns:
string The localized string.

Definition at line 6904 of file moodlelib.php.

Here is the call graph for this function:

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.

Parameters:
bool$forcereloadshall the singleton be released and new instance created instead?
Returns:
string_manager

Definition at line 5932 of file moodlelib.php.

get_strings ( array,
component = '' 
)

Converts an array of strings to their localized value.

Parameters:
array$arrayAn array of strings
string$moduleThe language module that these strings can be found in.
Returns:
array and array of translated strings.

Definition at line 6957 of file moodlelib.php.

Here is the caller graph for this function:

Returns an int which represents the systems's timezone difference from GMT in seconds

object

Parameters:
mixed$tztimezone
Returns:
int if found, false is timezone 99 or error

Definition at line 2149 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_timezone_record ( timezonename)

Returns cached timezone record for given $timezonename

object object

Parameters:
string$timezonename
Returns:
mixed timezonerecord object or false

Definition at line 2204 of file moodlelib.php.

Here is the caller graph for this function:

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.

Returns:
string The device the user is currently using or wishes to use

Definition at line 8305 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
string$fieldField name, e.g. 'phone1'
Returns:
string Text description taken from language file, e.g. 'Phone number'

Definition at line 3427 of file moodlelib.php.

Here is the caller graph for this function:

Returns an array of user fields

Returns:
array User field/column names

Definition at line 3557 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
string$scriptunique target identifier
int$userid
int$instanceoptional instance id
string$iprestrictionoptional ip restricted access
timestamp$validuntilkey valid only until given data
Returns:
string access key value

Definition at line 3098 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
string$nameName of the key to use in finding a preference value
mixed$defaultValue to be returned if the $name key is not set in the user preferences
stdClass | int$userA moodle user object or id, null means current user
Returns:
mixed string value or default

Definition at line 1781 of file moodlelib.php.

Here is the call graph for this function:

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

Parameters:
mixed$tzIf this value is provided and not equal to 99, it will be returned as is and no other settings will be checked
Returns:
mixed

Definition at line 2177 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
float$tzIf this value is provided and not equal to 99, it will be returned as is and no other settings will be checked
Returns:
float

Definition at line 2125 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
string$valuethe value of the config setting.
string$capabilitythe capability - must match the one passed to the admin_setting_users_with_capability constructor.
bool$includeadmins, include administrators
Returns:
array of user objects.

Definition at line 1384 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

getremoteaddr ( default = '0.0.0.0')

Returns most reliable client address

object

Parameters:
string$defaultIf an address can't be determined, then return this
Returns:
string The remote IP address

Definition at line 9493 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

getweek ( startdate,
thedate 
)

Given dates in seconds, how many weeks is the date from startdate The first week is 1, the second 2 etc ...

Todo:
Finish documenting this function

WEEKSECS

Parameters:
int$startdateTimestamp for the start date
int$thedateTimestamp for the end date
Returns:
string

Definition at line 8847 of file moodlelib.php.

Retrieve the guest user object

object object

Returns:
user A $USER object

Definition at line 3832 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

hash_internal_user_password ( password)

Calculate hashed value from password using current hash mechanism.

Parameters:
string$password
Returns:
string password hash

Definition at line 4070 of file moodlelib.php.

Here is the caller graph for this function:

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.

Parameters:
string$stringa string containing HTML.
Returns:
boolean does the string contain any actual content - that is text, images, objects, etc.

Definition at line 1191 of file moodlelib.php.

Here is the caller graph for this function:

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.

Parameters:
string$varThe variable name
object$objectThe object to check
Returns:
boolean

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.

Parameters:
string$authAuthentication plugin.
Returns:
boolean Whether the plugin is enabled.

Definition at line 3459 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

is_internal_auth ( auth)

Returns true if an internal authentication method is being used. if method not specified then, global default is assumed

Parameters:
string$authForm of authentication required
Returns:
bool

Definition at line 3530 of file moodlelib.php.

Here is the call graph for this function:

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

Parameters:
object$userA valid user object
Returns:
bool True if the user is from a remote Moodle.

Definition at line 10077 of file moodlelib.php.

Here is the caller graph for this function:

is_newnav ( navigation)

Check if the passed navigation is of the new style

Parameters:
mixed$navigation
Returns:
bool true for yes false for no

Definition at line 10199 of file moodlelib.php.

is_number ( value)

Return true if given value is integer or string with integer value

Parameters:
mixed$valueString or Int
Returns:
bool true if number, false if not

Definition at line 1157 of file moodlelib.php.

Here is the caller graph for this function:

is_primary_admin ( userid)

Is a userid the primary administrator?

Parameters:
int$useridint id of user to check
Returns:
boolean

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

Parameters:
string$urlurl to check
Returns:
boolean true if we should bypass the proxy

Definition at line 10150 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
string$usernameusername to be checked
Returns:
bool

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

Deprecated:
since Moodle 2.0 - use $PAGE->user_is_editing() instead.
Todo:
Deprecated function remove when ready

object DEBUG_DEVELOPER

Returns:
bool

Definition at line 3279 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

ismoving ( courseid)

Determines if the logged in user is currently moving an activity

object

Parameters:
int$courseidThe id of the course being tested
Returns:
bool

Definition at line 3292 of file moodlelib.php.

Here is the caller graph for this function:

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.

Todo:
Finish documenting this function or better deprecated this completely!
Parameters:
int$gradingtype
Returns:
array

Definition at line 9077 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
string$listThe string to explode into array bits
string$separatorThe separator used within the list string
Returns:
array The now assembled array

Definition at line 9055 of file moodlelib.php.

Here is the caller graph for this function:

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.

Todo:
Finish documenting this function
Parameters:
int$yearThe year part to create timestamp of
int$monthThe month part to create timestamp of
int$dayThe day part to create timestamp of
int$hourThe hour part to create timestamp of
int$minuteThe minute part to create timestamp of
int$secondThe second part to create timestamp of
mixed$timezoneTimezone modifier, if 99 then use default user's timezone
bool$applydstToggle Daylight Saving Time, default true, will be applied only if timezone is 99 or string.
Returns:
int timestamp

Definition at line 1828 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

make_unique_id_code ( extra = '')

make_unique_id_code

Todo:
Finish documenting this function

$_SERVER

Parameters:
string$extraExtra string to append to the end of the code
Returns:
string

Definition at line 9175 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
integer$useridthe user whose prefs were changed.
Returns:
void

Definition at line 1617 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

If new messages are waiting for the current user, then insert JavaScript to pop up the messaging window into the page

moodle_page $PAGE

Returns:
void

Definition at line 9700 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

microtime_diff ( a,
b 
)

Calculate the difference between two microtimes

Parameters:
string$aThe first Microtime
string$bThe second Microtime
Returns:
string

Definition at line 9041 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
stdclass$userthe user to get the idp url for

Definition at line 10419 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Determine if moodle installation requires update

Checks version numbers of main code and all modules to see if there are any mismatches

object object

Returns:
bool

Definition at line 8420 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

moodle_process_email ( modargs,
body 
)

?

Todo:
Finish documenting this function

object

Parameters:
string$modargs
string$bodyCurrently unused

Definition at line 4835 of file moodlelib.php.

Here is the call graph for this function:

This function expects to called during shutdown should be set via register_shutdown_function() in lib/setup.php .

Returns:
void

Definition at line 9647 of file moodlelib.php.

Here is the call graph for this function:

moodle_setlocale ( locale = '')

MISCELLANEOUS ////////////////////////////////////////////////////////////////////.

Sets the system locale

Todo:
Finish documenting this function

object

Parameters:
string$localeCan 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.

Here is the caller graph for this function:

moodle_strtolower ( string,
encoding = '' 
)

Converts string to lowercase using most compatible function available.

Todo:
Remove this function when no longer in use
Deprecated:
Use textlib->strtolower($text) instead.
Parameters:
string$stringThe string to convert to all lowercase characters.
string$encodingThe encoding on the string.
Returns:
string

Definition at line 8613 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

mtrace ( string,
eol = "\n",
sleep = 0 
)

For outputting debugging info

STDOUT

Parameters:
string$stringThe string to write
string$eolThe end of line char(s) to use
string$sleepPeriod to make the application sleep This ensures any messages have time to display before redirect

Definition at line 9434 of file moodlelib.php.

Here is the caller graph for this function:

normalize_component ( component)

Normalize the component name using the "frankenstyle" names.

Parameters:
string$component
Returns:
array $type+$plugin elements

Definition at line 7414 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
array$array
bool$keep_key_assoc
Returns:
array

Definition at line 10230 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
mix$objName of class or real object to test
string$propertyname of property to find
Returns:
bool true if property exists

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.

Parameters:
string$parnamethe name of the page parameter we want
mixed$defaultthe default value to return if nothing is found
string$typeexpected type of parameter
Returns:
mixed

Definition at line 566 of file moodlelib.php.

Here is the call graph for this function:

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

Parameters:
string$parnamethe name of the page parameter we want
mixed$defaultthe default value to return if nothing is found
string$typeexpected type of parameter
Returns:
array

Definition at line 608 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

over_bounce_threshold ( user)

Check whether the user has exceeded the bounce threshold

object object

Parameters:
user$userA $USER object
Returns:
bool true=>User has exceeded bounce threshold

No real (DB) user, nothing to do here.

Definition at line 3153 of file moodlelib.php.

Here is the caller graph for this function:

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.

Parameters:
mixed$functiona php callback $param mixed $arg1.. $argv arguments to partially bind with
Returns:
callback

Definition at line 10341 of file moodlelib.php.

Here is the caller graph for this function:

plugin_callback ( type,
name,
feature,
action,
params = null,
default = null 
)

Invoke plugin's callback functions

Parameters:
string$typeplugin type e.g. 'mod'
string$nameplugin name
string$featurefeature name
string$actionfeature's action
array$paramsparameters of callback function, should be an array
mixed$defaultdefault value if callback function hasn't been defined, or if it retursn null.
Returns:
mixed
Todo:
Decide about to deprecate and drop plugin_callback() - MDL-30743

Definition at line 7821 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

plugin_supports ( type,
name,
feature,
default = NULL 
)

Checks whether a plugin supports a specified feature.

Parameters:
string$typePlugin type e.g. 'mod'
string$namePlugin name e.g. 'forum'
string$featureFeature code (FEATURE_xx constant)
mixed$defaultdefault value if feature support unknown
Returns:
mixed Feature result (false if not supported, null if feature is unknown, otherwise usually true but may have other feature-specific value such as array)

Definition at line 7888 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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 '

'; print_string('typecourse', 'calendar'); echo '

';

Parameters:
string$identifierThe key identifier for the localized string
string$componentThe module where the key identifier is stored. If none is specified then moodle.php is used.
mixed$aAn object, string or number that can be used within translation strings

Definition at line 6988 of file moodlelib.php.

Here is the caller graph for this function:

Invalidates browser caches and cached data in temp

Returns:
void

Definition at line 1423 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

random_string ( length = 15)

Generate and return a random string of the specified length.

Parameters:
int$lengthThe length of the string to be created.
Returns:
string

Definition at line 8661 of file moodlelib.php.

Here is the caller graph for this function:

rc4decrypt ( data)

rc4decrypt

Todo:
Finish documenting this function
Parameters:
string$dataData to decrypt
Returns:
string The now decrypted data

Definition at line 7268 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

rc4encrypt ( data)

ENCRYPTION ////////////////////////////////////////////////.

rc4encrypt

Todo:
Finish documenting this function
Parameters:
string$dataData to encrypt
Returns:
string The now encrypted data

Definition at line 7255 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

remoteip_in_list ( list)

Is current ip in give list?

Parameters:
string$list
Returns:
bool

Definition at line 9466 of file moodlelib.php.

Here is the call graph for this function:

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:

  • 'keep_roles_and_enrolments' - false by default
  • 'keep_groups_and_groupings' - false by default
Parameters:
int$courseidThe id of the course that is being deleted
bool$showfeedbackWhether to display notifications of each action the function performs.
array$optionsextra options
Returns:
bool true if all the removals succeeded. false if there were any failures. If this method returns false, some of the removals will probably have succeeded, and others failed, but you have no way of knowing which.

Delete activity context questions and question categories

Definition at line 4330 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

remove_dir ( dir,
content_only = false 
)

Delete directory or only it's content

Parameters:
string$dirdirectory path
bool$content_only
Returns:
bool success, true also if dir does not exist

Definition at line 10000 of file moodlelib.php.

Here is the caller graph for this function:

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.

See also:
require_login()

object

Parameters:
mixed$courseoridThe course object or id in question
bool$autologinguestAllow autologin guests if that is wanted
object$cmCourse activity module if known
bool$setwantsurltomeDefine 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$preventredirectset to true in scripts that can not redirect (CLI, rss feeds, etc.), throws exceptions
Returns:
void

Definition at line 2920 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
mixed$courseoridid of the course or course object
bool$autologinguestdefault true
object$cmcourse module object
bool$setwantsurltomeDefine 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$preventredirectset to true in scripts that can not redirect (CLI, rss feeds, etc.), throws exceptions
Returns:
mixed Void, exit, and die depending on path

Definition at line 2575 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

This function just makes sure a user is logged out.

object

Definition at line 2882 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
string$scriptunique script identifier
int$instanceoptional instance id
Returns:
int 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.

Here is the call graph for this function:

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.

Parameters:
string$parnamethe name of the page parameter we want
string$typeexpected type of parameter
Returns:
mixed

Definition at line 485 of file moodlelib.php.

Here is the call graph for this function:

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

Parameters:
string$parnamethe name of the page parameter we want
string$typeexpected type of parameter
Returns:
array

Definition at line 523 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

reset_course_userdata ( data)

This function will empty a course of user data. It will retain the activities and the structure of the course.

Parameters:
object$dataan object containing all the settings including courseid (without magic quotes)
Returns:
array status array of array component, item, error

Definition at line 4601 of file moodlelib.php.

Here is the call graph for this function:

Resets login attempts

object

Definition at line 3262 of file moodlelib.php.

Here is the caller graph for this function:

Resets specified user's password and send the new password to the user via email.

Parameters:
stdClass$userA $USER object
Returns:
bool Returns true if mail was sent OK and false if there was an error.

Definition at line 5292 of file moodlelib.php.

Here is the call graph for this function:

Send email to specified user with confirmation text and activation link.

object

Parameters:
user$userA $USER object
Returns:
bool Returns true if mail was sent OK and false if there was an error.

Definition at line 5337 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

send_password_change_confirmation_email.

object

Parameters:
user$userA $USER object
Returns:
bool Returns true if mail was sent OK and false if there was an error.

Definition at line 5368 of file moodlelib.php.

Here is the call graph for this function:

send_password_change_info.

object

Parameters:
user$userA $USER object
Returns:
bool Returns true if mail was sent OK and false if there was an error.

Definition at line 5396 of file moodlelib.php.

Here is the call graph for this function:

set_bounce_count ( user,
reset = false 
)

Increment or reset user's email bounce count

object

Parameters:
user$userobject containing an id
bool$resetwill reset the count to 0

Definition at line 3218 of file moodlelib.php.

Here is the caller graph for this function:

set_cache_flag ( type,
name,
value,
expiry = NULL 
)

Set a volatile flag

Parameters:
string$typethe "type" namespace for the key
string$namethe key to set
string$valuethe value to set (without magic quotes) - NULL will remove the flag
int$expiry(optional) epoch indicating expiry - defaults to now()+ 24hs
Returns:
bool Always returns true

Definition at line 1499 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
string$namethe key to set
string$valuethe value to set (without magic quotes)
string$plugin(optional) the plugin scope, default NULL
Returns:
bool true or exception

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.

Here is the caller graph for this function:

set_mnet_remote_client ( client)

during the xmlrpc server code execution, this will be called to setup the object returned by {

See also:
get_mnet_remote_client}
Parameters:
mnet_remote_client$clientthe 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

Parameters:
user$userobject containing an id
bool$resetwill reset the count to 0
Returns:
void

No real (DB) user, nothing to do here.

Definition at line 3190 of file moodlelib.php.

Here is the caller graph for this function:

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.

Parameters:
string$newdeviceThe device the user is currently using.
Returns:
string The device the user has switched to

Definition at line 8286 of file moodlelib.php.

Here is the call graph for this function:

set_user_preference ( name,
value,
user = null 
)

Sets a preference for the specified user.

If user object submitted, 'preference' property contains the preferences cache.

Parameters:
string$nameThe key to set as preference for the specified user
string$valueThe value to set for the $name key in the specified user's record, null means delete current value
stdClass | int$userA moodle user object or id, null means current user
Returns:
bool always true or exception

Definition at line 1639 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
array$prefarrayAn array of key/value pairs to be set
stdClass | int$userA moodle user object or id, null means current user
Returns:
bool always true or exception

Definition at line 1710 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Sets specified user's password and send the new password to the user via email.

object object

Parameters:
user$userA $USER object
Returns:
boolean|string Returns "true" if mail was sent OK and "false" if there was an error

Definition at line 5258 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

shift_course_mod_dates ( modname,
fields,
timeshift,
courseid 
)

Change dates in module - used from course reset.

object object

Parameters:
string$modnameforum, assignment, etc
array$fieldsarray of date fields from mod table
int$timeshifttime difference
int$courseid
Returns:
bool success

Definition at line 4574 of file moodlelib.php.

Here is the caller graph for this function:

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

Parameters:
string$text- text to be shortened
int$ideal- ideal string length
boolean$exactif false, $text will not be cut mid-word
string$endingThe string to append if the passed string is truncated
Returns:
string $truncate - shortened string

Definition at line 8709 of file moodlelib.php.

Here is the caller graph for this function:

site_scale_used ( scaleid,
&$  courses 
)

This function returns the number of activities using scaleid in the entire site

Parameters:
int$scaleid
array$courses
Returns:
int

Definition at line 9149 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

swapshuffle ( array)

Given a simple array, this shuffles it up just like shuffle() Unlike PHP's shuffle() this function works on any machine.

Parameters:
array$arrayThe array to be rearranged
Returns:
array

Definition at line 8967 of file moodlelib.php.

Here is the caller graph for this function:

swapshuffle_assoc ( array)

Like swapshuffle(), but works on associative arrays

Parameters:
array$arrayThe associative array to be rearranged
Returns:
array

Definition at line 8986 of file moodlelib.php.

Here is the call graph for this function:

truncate_userinfo ( info)

Will truncate userinfo as it comes from auth_get_userinfo (from external auth) which may have large fields

Todo:
Add vartype handling to ensure $info is an array
Parameters:
array$infoArray of user properties to truncate if needed
Returns:
array The now truncated information that was passed in

Definition at line 3699 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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!

Parameters:
string$locale_floatlocale aware float representation
Returns:
float

Definition at line 8948 of file moodlelib.php.

Here is the caller graph for this function:

Remove all the config variables for a given plugin.

Parameters:
string$plugina plugin, for example 'quiz' or 'qtype_multichoice';
Returns:
boolean whether the operation succeeded.

Definition at line 1365 of file moodlelib.php.

Here is the caller graph for this function:

unset_cache_flag ( type,
name 
)

Removes a single volatile flag

object

Parameters:
string$typethe "type" namespace for the key
string$namethe key to set
Returns:
bool

Definition at line 1542 of file moodlelib.php.

Here is the caller graph for this function:

unset_config ( name,
plugin = NULL 
)

Removes a key from global configuration

Parameters:
string$namethe key to set
string$plugin(optional) the plugin scope object
Returns:
boolean whether the operation succeeded.

Definition at line 1346 of file moodlelib.php.

Here is the caller graph for this function:

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.

Parameters:
string$nameThe key to unset as preference for the specified user
stdClass | int$userA moodle user object or id, null means current user
Returns:
bool always true or exception

Definition at line 1726 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

update_internal_user_password ( user,
password 
)

Update password hash in user object.

Parameters:
stdClass$user(password property may be updated)
string$passwordplain text password
Returns:
bool always returns true

Definition at line 4087 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Keeps track of login attempts

object

Definition at line 3240 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Modify the user table by setting the currently logged in user's last login to now.

object object

Returns:
bool Always returns true

Definition at line 3119 of file moodlelib.php.

Here is the caller graph for this function:

update_user_record ( username)

Will update a local user record from an external source. (MNET users can not be updated using this method!)

Parameters:
string$usernameuser's username to update the record
Returns:
stdClass A complete user object

just in case check text case

Definition at line 3640 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
int$max_execution_timein seconds (can not be less than 60 s)

Definition at line 8510 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

user_not_fully_set_up ( user)

Determines if a user has completed setting up their account.

Parameters:
user$userA $USER object to test for the existence of a valid name and email
Returns:
bool

Definition at line 3138 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

userdate ( date,
format = '',
timezone = 99,
fixday = true 
)

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.

Parameters:
int$datethe timestamp in UTC, as obtained from the database.
string$formatstrftime format. You should probably get this using get_string('strftime...', 'langconfig');
mixed$timezoneby default, uses the user's time zone. if numeric and not 99 then daylight saving will not be added.
bool$fixdayIf true (default) then the leading zero from d is removed. If false then the leading zero is maintained.
Returns:
string the formatted date/time.

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.

Here is the call graph for this function:

usergetdate ( time,
timezone = 99 
)

Given a $time timestamp in GMT (seconds since epoch), returns an array that represents the date in user time

Todo:
Finish documenting this function HOURSECS
Parameters:
int$timeTimestamp in GMT
mixed$timezoneoffset time with timezone, if float and not 99, then no dst offset is applyed
Returns:
array An array that represents the date in user time

Definition at line 2007 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

usergetmidnight ( date,
timezone = 99 
)

Given a time, return the GMT timestamp of the most recent midnight for the current user.

Parameters:
int$dateTimestamp in GMT
float$timezoneDefaults to user's timezone
Returns:
int Returns a GMT timestamp

Definition at line 2072 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
int$dateTimestamp in GMT
float$timezone
Returns:
int

Definition at line 2054 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

usertimezone ( timezone = 99)

Returns a string that prints the user's timezone

Parameters:
float$timezoneThe user's timezone
Returns:
string

Definition at line 2087 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

valid_uploaded_file ( newfile)

Returns current name of file on disk if it exists.

Parameters:
string$newfileFile to be verified
Returns:
string Current name of file on disk if true

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.

Parameters:
stdClass$user(password property may be updated)
string$passwordplain text password
Returns:
bool is password valid?

Definition at line 4024 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
mixed$param
string$typePARAM_ constant
bool$allownullare nulls valid value?
string$debuginfooptional debug information
Returns:
mixed the $param value converted to PHP type or invalid_parameter_exception

Definition at line 650 of file moodlelib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations