Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Functions | Variables
datalib.php File Reference

Library of functions for database manipulation. More...

Functions

object _fix_course_cats ($children, &$sortorder, $parent, $depth, $path, &$fixcontexts)
 Internal recursive category verification function, do not use directly! More...
 
moodle_database add_to_config_log ($name, $oldvalue, $value, $plugin)
 
 decompose_update_into_safe_changes (array $newvalues, $unusedvalue)
 Helper used by update_field_with_unique_index(). More...
 
object fix_course_sortorder ()
 Fixes course category and course sortorder, also verifies category and course parents and paths. More...
 
if(!defined('LASTACCESS_UPDATE_SECS')) get_admin ()
 Number of seconds to wait before updating lastaccess information in DB. More...
 
 get_admins ()
 Returns list of all admins, using 1 DB query. More...
 
 get_all_instances_in_course ($modulename, $course, $userid=NULL, $includeinvisible=false)
 Returns an array of all the active instances of a particular module in a given course, sorted in the order they are defined. More...
 
object get_all_instances_in_courses ($modulename, $courses, $userid=NULL, $includeinvisible=false)
 Returns an array of all the active instances of a particular module in given courses, sorted in the order they are defined. More...
 
 get_course ($courseid, $clone=true)
 Gets a course object from database. More...
 
object get_course_mods ($courseid)
 MODULE FUNCTIONS /////////////////////////////////////////////////. More...
 
object get_coursemodule_from_id ($modulename, $cmid, $courseid=0, $sectionnum=false, $strictness=IGNORE_MISSING)
 Given an id of a course module, finds the coursemodule description. More...
 
object get_coursemodule_from_instance ($modulename, $instance, $courseid=0, $sectionnum=false, $strictness=IGNORE_MISSING)
 Given an instance number of a module, finds the coursemodule description. More...
 
 get_coursemodules_in_course ($modulename, $courseid, $extrafields='')
 Returns all course modules of given activity in course. More...
 
object get_courses ($categoryid="all", $sort="c.sortorder ASC", $fields="c.*")
 Returns list of courses, for whole site, or category. More...
 
object get_courses_search ($searchterms, $sort, $page, $recordsperpage, &$totalcount, $requiredcapabilities=array(), $searchcond=[], $params=[])
 A list of courses that match a search. More...
 
 get_log_manager ($forcereload=false)
 LOG FUNCTIONS /////////////////////////////////////////////////////. More...
 
object get_my_remotecourses ($userid=0)
 List of remote courses that a user has access to via MNET. More...
 
object get_my_remotehosts ()
 List of remote hosts that a user has access to via MNET. More...
 
object get_scales_menu ($courseid=0)
 Returns a menu of all available scales from the site as well as the given course. More...
 
 get_site ()
 OTHER SITE AND COURSE FUNCTIONS /////////////////////////////////////////////. More...
 
object get_users ($get=true, $search='', $confirmed=false, array $exceptions=null, $sort='firstname ASC', $firstinitial='', $lastinitial='', $page='', $recordsperpage='', $fields=' *', $extraselect='', array $extraparams=null)
 Returns a subset of users. More...
 
object get_users_confirmed ()
 Full list of users that have confirmed their accounts. More...
 
 get_users_listing ($sort='lastaccess', $dir='ASC', $page=0, $recordsperpage=0, $search='', $firstinitial='', $lastinitial='', $extraselect='', array $extraparams=null, $extracontext=null)
 Return filtered (if provided) list of users in site, except guest and deleted users. More...
 
 increment_revision_number ($table, $field, $select, array $params=null)
 Increment standard revision field. More...
 
object instance_is_visible ($moduletype, $module)
 Determine whether a module instance is visible within a course. More...
 
 print_object ($object)
 GENERAL HELPFUL THINGS ///////////////////////////////////. More...
 
object search_users ($courseid, $groupid, $searchtext, $sort='', array $exceptions=null)
 Search through course users. More...
 
 update_field_with_unique_index ($table, $field, array $newvalues, array $otherconditions, $unusedvalue=-1)
 This method can update the values in mulitple database rows for a colum with a unique index, without violating that constraint. More...
 
stdClass user_accesstime_log ($courseid=0)
 
object user_can_create_courses ()
 @uses CONTEXT_COURSECAT More...
 
 users_order_by_sql ($usertablealias='', $search=null, context $context=null)
 This function generates the standard ORDER BY clause for use when generating lists of users. More...
 
 users_search_sql ($search, $u='u', $searchanywhere=true, array $extrafields=array(), array $exclude=null, array $includeonly=null)
 Returns SQL used to search through user table to find users (in a query which may also join and apply other conditions). More...
 
 xmldb_debug ($message, $object)
 This function is the official hook inside XMLDB stuff to delegate its debug to one external function. More...
 

Variables

const MAX_COURSE_CATEGORIES 10000
 The maximum number of course categories MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer!
 
const MAX_COURSES_IN_CATEGORY 10000
 The maximum courses in a category MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer!
 

Detailed Description

Library of functions for database manipulation.

Other main libraries:

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later