[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Source view] [Print] [Project Stats]
deprecatedlib.php - Old functions retained only for backward compatibility Old functions retained only for backward compatibility. New code should not use any of these functions.
Copyright: | 1999 onwards Martin Dougiamas {@link http://moodle.com} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 4632 lines (170 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user=0) X-Ref |
Add an entry to the legacy log table. param: int $courseid The course id param: string $module The module name e.g. forum, journal, resource, course, user etc param: string $action 'view', 'update', 'add' or 'delete', possibly followed by another word to clarify. param: string $url The file and parameters used to see the results of the action param: string $info Additional description information param: int $cm The course_module->id if there is one param: int|stdClass $user If log regards $user other than $USER return: void |
clam_log_upload($newfilepath, $course=null, $nourl=false) X-Ref |
Adds a file upload to the log table so that clam can resolve the filename to the user later if necessary param: string $newfilepath param: stdClass $course param: bool $nourl |
clam_log_infected($oldfilepath='', $newfilepath='', $userid=0) X-Ref |
This function logs to error_log and to the log table that an infected file has been found and what's happened to it. param: string $oldfilepath param: string $newfilepath param: int $userid The user |
clam_change_log($oldpath, $newpath, $update=true) X-Ref |
Some of the modules allow moving attachments (glossary), in which case we need to hunt down an original log and change the path. param: string $oldpath param: string $newpath param: boolean $update |
clam_replace_infected_file($file) X-Ref |
Replaces the given file with a string. param: string $file return: boolean |
password_compat_not_supported() X-Ref |
Checks whether the password compatibility library will work with the current version of PHP. This cannot be done using PHP version numbers since the fix has been backported to earlier versions in some distributions. See https://github.com/ircmaxell/password_compat/issues/10 for more details. return: bool always returns false |
session_get_instance() X-Ref |
Factory method that was returning moodle_session object. return: \core\session\manager |
session_is_legacy() X-Ref |
Returns true if legacy session used. return: bool |
session_kill_all() X-Ref |
Terminates all sessions, auth hooks are not executed. Useful in upgrade scripts. |
session_touch($sid) X-Ref |
Mark session as accessed, prevents timeouts. param: string $sid |
session_kill($sid) X-Ref |
Terminates one sessions, auth hooks are not executed. param: string $sid session id |
session_kill_user($userid) X-Ref |
Terminates all sessions of one user, auth hooks are not executed. NOTE: This can not work for file based sessions! param: int $userid user id |
session_set_user($user) X-Ref |
Setup $USER object - called during login, loginas, etc. Call sync_user_enrolments() manually after log-in, or log-in-as. param: stdClass $user full user record object return: void |
session_is_loggedinas() X-Ref |
Is current $USER logged-in-as somebody else? return: bool |
session_get_realuser() X-Ref |
Returns the $USER object ignoring current login-as session return: stdClass user object |
session_loginas($userid, $context) X-Ref |
Login as another user - no security checks here. param: int $userid param: stdClass $context return: void |
js_minify($files) X-Ref |
Minify JavaScript files. param: array $files return: string |
css_minify_css($files) X-Ref |
Minify CSS files. param: array $files return: string |
events_trigger($eventname, $eventdata) X-Ref |
Function to call all event handlers when triggering an event param: string $eventname name of the event param: mixed $eventdata event data object return: int number of failed events |
get_core_subsystems($fullpaths = false) X-Ref |
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 optionally 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. param: bool $fullpaths false means relative paths from dirroot, use true for performance reasons return: array of (string)name => (string|null)location |
get_plugin_types($fullpaths = true) X-Ref |
Lists all plugin types. param: bool $fullpaths false means relative paths from dirroot return: array Array of strings - name=>location |
get_plugin_list($plugintype) X-Ref |
Use when listing real plugins of one type. param: string $plugintype type of plugin return: array name=>fulllocation pairs of plugins of given type |
get_plugin_list_with_class($plugintype, $class, $file) X-Ref |
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. param: string $plugintype the type of plugin, e.g. 'mod' or 'report'. param: string $class the part of the name of the class after the param: string $file the name of file within the plugin that defines the class. return: array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum') |
get_plugin_directory($plugintype, $name) X-Ref |
Returns the exact absolute path to plugin directory. param: string $plugintype type of plugin param: string $name name of the plugin return: string full path to plugin directory; NULL if not found |
normalize_component($component) X-Ref |
Normalize the component name using the "frankenstyle" names. param: string $component return: array as (string)$type => (string)$plugin |
get_component_directory($component) X-Ref |
Return exact absolute path to a plugin directory. param: string $component name such as 'moodle', 'mod_forum' return: string full path to component directory; NULL if not found |
check_gd_version() X-Ref |
Hack to find out the GD version by parsing phpinfo output return: int GD version (1, 2, or 0) |
update_login_count() X-Ref |
Not used any more, the account lockout handling is now part of authenticate_user_login(). |
reset_login_count() X-Ref |
Not used any more, replaced by proper account lockout. |
update_log_display_entry($module, $action, $mtable, $field) X-Ref |
Insert or update log display entry. Entry may already exist. $module, $action must be unique param: string $module param: string $action param: string $mtable param: string $field return: void |
filter_text($text, $courseid = NULL) X-Ref |
Given some text in HTML format, this function will pass it through any filters that have been configured for this context. param: string $text The text to be passed through format filters param: int $courseid The current course. return: string the filtered string. |
httpsrequired() X-Ref |
This function indicates that current page requires the https when $CFG->loginhttps enabled. By using this function properly, we can ensure 100% https-ized pages at our entire discretion (login, forgot_password, change_password) |
get_file_url($path, $options=null, $type='coursefile') X-Ref |
Given a physical path to a file, returns the URL through which it can be reached in Moodle. param: string $path Physical path to a file param: array $options associative array of GET variables to append to the URL param: string $type (questionfile|rssfile|httpscoursefile|coursefile) return: string URL to file |
get_course_participants($courseid) X-Ref |
Return all course participant for a given course param: integer $courseid return: array of user |
is_course_participant($userid, $courseid) X-Ref |
Return true if the user is a participant for a given course param: integer $userid param: integer $courseid return: boolean |
get_recent_enrolments($courseid, $timestart) X-Ref |
Searches logs to find all enrolments since a certain date used to print recent activity param: int $courseid The course in question. param: int $timestart The date to check forward of return: object|false {@link $USER} records or false if error. |
detect_munged_arguments($string, $allowdots=1) X-Ref |
param: string $string ? param: int $allowdots ? return: bool |
unzip_file($zipfile, $destination = '', $showstatus_ignored = true) X-Ref |
Unzip one zip file to a destination dir Both parameters must be FULL paths If destination isn't specified, it will be the SAME directory where the zip file resides. param: string $zipfile The zip file to unzip param: string $destination The location to unzip to param: bool $showstatus_ignored Unused |
zip_files($originalfiles, $destination) X-Ref |
Zip an array of files/dirs to a destination zip file Both parameters must be FULL paths to the files/dirs param: array $originalfiles Files to zip param: string $destination The destination path return: bool Outcome |
mygroupid($courseid) X-Ref |
Get the IDs for the user's groups in the given course. param: int $courseid The course being examined - the 'course' table id field. return: array|bool An _array_ of groupids, or false |
groupmode($course, $cm=null) X-Ref |
Returns the current group mode for a given course or activity module Could be false, SEPARATEGROUPS or VISIBLEGROUPS (<-- Martin) param: object $course Course Object param: object $cm Course Manager Object return: mixed $course->groupmode |
set_current_group($courseid, $groupid) X-Ref |
Sets the current group in the session variable When $SESSION->currentgroup[$courseid] is set to 0 it means, show all groups. Sets currentgroup[$courseid] in the session variable appropriately. Does not do any permission checking. param: int $courseid The course being examined - relates to id field in param: int $groupid The group being examined. return: int Current group id which was set by this function |
get_current_group($courseid, $full = false) X-Ref |
Gets the current group - either from the session variable or from the database. param: int $courseid The course being examined - relates to id field in param: bool $full If true, the return value is a full record object. return: int|bool |
groups_filter_users_by_course_module_visible($cm, $users) X-Ref |
Filter a user list and return only the users that can see the course module based on groups/permissions etc. It is assumed that the users are pre-filtered to those who are enrolled in the course. param: stdClass|cm_info $cm The course module param: array $users An array of users, indexed by userid return: array A filtered list of users that can see the module, indexed by userid. |
groups_course_module_visible($cm, $userid=null) X-Ref |
Determine if a course module is currently visible to a user Deprecated (it was never very useful as it only took into account the groupmembersonly option and no other way of hiding activities). Always returns true. param: stdClass|cm_info $cm The course module param: int $userid The user to check against the group. return: bool True |
error($message, $link='') X-Ref |
Inndicates fatal error. This function was originally printing the error message directly, since 2.0 it is throwing exception instead. The error printing is handled in default exception handler. Old method, don't call directly in new code - use print_error instead. param: string $message The message to display to the user about the error. param: string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page. return: void, always throws moodle_exception |
current_theme() X-Ref |
return: string the name of the current theme. |
formerr($error) X-Ref |
Prints some red text using echo param: string $error The text to be displayed in red |
skip_main_destination() X-Ref |
Return the markup for the destination of the 'Skip to main content' links. Accessibility improvement for keyboard-only users. Used in course formats, /index.php and /course/index.php return: string HTML element. |
print_container($message, $clearfix=false, $classes='', $idbase='', $return=false) X-Ref |
Print a message in a standard themed container. param: string $message, the content of the container param: boolean $clearfix clear both sides param: string $classes, space-separated class names. param: string $idbase param: boolean $return, return as string or just print it return: string|void Depending on value of $return |
print_container_start($clearfix=false, $classes='', $idbase='', $return=false) X-Ref |
Starts a container using divs param: boolean $clearfix clear both sides param: string $classes, space-separated class names. param: string $idbase param: boolean $return, return as string or just print it return: string|void Based on value of $return |
print_container_end($return=false) X-Ref |
Simple function to end a container (see above) param: boolean $return, return as string or just print it return: string|void Based on $return |
notify($message, $classes = 'notifyproblem', $align = 'center', $return = false) X-Ref |
Print a bold message in an optional color. param: string $message The message to print out param: string $style Optional style to display message text in param: string $align Alignment option param: bool $return whether to return an output string or echo now return: string|bool Depending on $result |
print_continue($link, $return = false) X-Ref |
Print a continue button that goes to a particular URL. param: string $link The url to create a link to. param: bool $return If set to true output is returned rather than echoed, default false return: string|void HTML String if return=true nothing otherwise |
print_header($title='', $heading='', $navigation='', $focus='',$meta='', $cache=true, $button=' ', $menu=null,$usexml=false, $bodytags='', $return=false) X-Ref |
Print a standard header param: string $title Appears at the top of the window param: string $heading Appears at the top of the page param: string $navigation Array of $navlinks arrays (keys: name, link, type) for use as breadcrumbs links param: string $focus Indicates form element to get cursor focus on load eg inputform.password param: string $meta Meta tags to be added to the header param: boolean $cache Should this page be cacheable? param: string $button HTML code for a button (usually for module editing) param: string $menu HTML code for a popup menu param: boolean $usexml use XML for this page param: string $bodytags This text will be included verbatim in the <body> tag (useful for onload() etc) param: bool $return If true, return the visible elements of the header instead of echoing them. return: string|void If return=true then string else void |
print_header_simple($title='', $heading='', $navigation='', $focus='', $meta='',$cache=true, $button=' ', $menu='', $usexml=false, $bodytags='', $return=false) X-Ref |
This version of print_header is simpler because the course name does not have to be provided explicitly in the strings. It can be used on the site page as in courses Eventually all print_header could be replaced by print_header_simple param: string $title Appears at the top of the window param: string $heading Appears at the top of the page param: string $navigation Premade navigation string (for use as breadcrumbs links) param: string $focus Indicates form element to get cursor focus on load eg inputform.password param: string $meta Meta tags to be added to the header param: boolean $cache Should this page be cacheable? param: string $button HTML code for a button (usually for module editing) param: string $menu HTML code for a popup menu param: boolean $usexml use XML for this page param: string $bodytags This text will be included verbatim in the <body> tag (useful for onload() etc) param: bool $return If true, return the visible elements of the header instead of echoing them. return: string|void If $return=true the return string else nothing |
print_side_block($heading='', $content='', $list=NULL, $icons=NULL, $footer='', $attributes = array() X-Ref |
Prints a nice side block with an optional header. The content can either be a block of HTML or a list of text with optional icons. param: string $heading HTML for the heading. Can include full HTML or just param: string $content HTML for the content param: array $list an alternative to $content, it you want a list of things with optional icons. param: array $icons optional icons for the things in $list. param: string $footer Extra HTML content that gets output at the end, inside a <div class="footer"> param: array $attributes an array of attribute => value pairs that are put on the param: string $title Plain text title, as embedded in the $heading. |
print_textarea($unused, $rows, $cols, $width, $height, $name, $value='', $obsolete=0, $return=false, $id='') X-Ref |
Prints a basic textarea field. param: bool $unused No longer used. param: int $rows Number of rows to display (minimum of 10 when $height is non-null) param: int $cols Number of columns to display (minimum of 65 when $width is non-null) param: null $width (Deprecated) Width of the element; if a value is passed, the minimum value for $cols will be 65. Value is otherwise ignored. param: null $height (Deprecated) Height of the element; if a value is passe, the minimum value for $rows will be 10. Value is otherwise ignored. param: string $name Name to use for the textarea element. param: string $value Initial content to display in the textarea. param: int $obsolete deprecated param: bool $return If false, will output string. If true, will return string value. param: string $id CSS ID to add to the textarea element. return: string|void depending on the value of $return |
editorhelpbutton() X-Ref |
Returns a string of html with an image of a help icon linked to a help page on a number of help topics. Should be used only with htmleditor or textarea. param: mixed $helptopics variable amount of params accepted. Each param may be a string or an array of arguments for return: string Link to help button |
editorshortcutshelpbutton() X-Ref |
Print a help button. Prints a special help button for html editors (htmlarea in this case) return: string Only returns an empty string at the moment |
print_arrow($direction='up', $strsort=null, $return=false) X-Ref |
Returns an image of an up or down arrow, used for column sorting. To avoid unnecessary DB accesses, please provide this function with the language strings for sortasc and sortdesc. param: string $direction 'up' or 'down' param: string $strsort The language string used for the alt attribute of this image param: bool $return Whether to print directly or return the html string return: string|void depending on $return |
choose_from_menu($options, $name, $selected='', $nothing='choose', $script='',$nothingvalue='0', $return=false, $disabled=false, $tabindex=0,$id='', $listbox=false, $multiple=false, $class='') X-Ref |
Given an array of values, output the HTML for a select element with those options. param: array $options The options to offer. An array of the form param: string $name the name of this form control, as in <select name="..." ... param: string $selected the option to select initially, default none. param: string $nothing The label for the 'nothing is selected' option. Defaults to get_string('choose'). param: string $script if not '', then this is added to the <select> element as an onchange handler. param: string $nothingvalue The value corresponding to the $nothing option. Defaults to 0. param: boolean $return if false (the default) the the output is printed directly, If true, the param: boolean $disabled if true, the select is generated in a disabled state. Default, false. param: int $tabindex if give, sets the tabindex attribute on the <select> element. Default none. param: string $id value to use for the id attribute of the <select> element. If none is given, param: mixed $listbox if false, display as a dropdown menu. If true, display as a list box. param: boolean $multiple if true, enable multiple selections, else only 1 item can be selected. Used param: string $class value to use for the class attribute of the <select> element. If none is given, return: string|void If $return=true returns string, else echo's and returns void |
print_scale_menu_helpbutton($courseid, $scale, $return=false) X-Ref |
Prints a help button about a scale param: id $courseid param: object $scale param: boolean $return If set to true returns rather than echo's return: string|bool Depending on value of $return |
print_checkbox($name, $value, $checked = true, $label = '', $alt = '', $script='', $return=false) X-Ref |
Display an standard html checkbox with an optional label param: string $name The name of the checkbox param: string $value The valus that the checkbox will pass when checked param: bool $checked The flag to tell the checkbox initial state param: string $label The label to be showed near the checkbox param: string $alt The info to be inserted in the alt tag param: string $script If not '', then this is added to the checkbox element param: bool $return Whether this function should return a string or output return: string|void If $return=true returns string, else echo's and returns void |
update_module_button($cmid, $ignored, $string) X-Ref |
Prints the 'update this xxx' button that appears on module pages. param: string $cmid the course_module id. param: string $ignored not used any more. (Used to be courseid.) param: string $string the module name - get_string('modulename', 'xxx') return: string the HTML for the button, if this user has permission to edit it, else an empty string. |
print_navigation($navigation, $separator=0, $return=false) X-Ref |
Prints breadcrumb trail of links, called in theme/-/header.html This function has now been deprecated please use output's navbar method instead as shown below <code php> echo $OUTPUT->navbar(); </code> param: mixed $navigation deprecated param: string $separator OBSOLETE, and now deprecated param: boolean $return False to echo the breadcrumb string (default), true to return it. return: string|void String or null, depending on $return. |
build_navigation($extranavlinks, $cm = null) X-Ref |
This function will build the navigation string to be used by print_header and others. It automatically generates the site and course level (if appropriate) links. If you pass in a $cm object, the method will also generate the activity (e.g. 'Forums') and activityinstances (e.g. 'General Developer Forum') navigation levels. If you want to add any further navigation links after the ones this function generates, the pass an array of extra link arrays like this: array( array('name' => $linktext1, 'link' => $url1, 'type' => $linktype1), array('name' => $linktext2, 'link' => $url2, 'type' => $linktype2) ) The normal case is to just add one further link, for example 'Editing forum' after 'General Developer Forum', with no link. To do that, you need to pass array(array('name' => $linktext, 'link' => '', 'type' => 'title')) However, becuase this is a very common case, you can use a shortcut syntax, and just pass the string 'Editing forum', instead of an array as $extranavlinks. At the moment, the link types only have limited significance. Type 'activity' is recognised in order to implement the $CFG->hideactivitytypenavlink feature. Types that are known to appear are 'home', 'course', 'activity', 'activityinstance' and 'title'. This really needs to be documented better. In the mean time, try to be consistent, it will enable people to customise the navigation more in future. When passing a $cm object, the fields used are $cm->modname, $cm->name and $cm->course. If you get the $cm object using the function get_coursemodule_from_instance or get_coursemodule_from_id (as recommended) then this will be done for you automatically. If you don't have $cm->modname or $cm->name, this fuction will attempt to find them using the $cm->module and $cm->instance fields, but this takes extra database queries, so a warning is printed in developer debug mode. param: mixed $extranavlinks - Normally an array of arrays, keys: name, link, type. If you param: mixed $cm deprecated return: array Navigation array |
navmenu($course, $cm=NULL, $targetwindow='self') X-Ref |
add_event($event) X-Ref |
Call this function to add an event to the calendar table and to call any calendar plugins param: object $event An object representing an event from the calendar table. return: int|false The id number of the resulting record or false if failed |
update_event($event) X-Ref |
Call this function to update an event in the calendar table the event will be identified by the id field of the $event object. param: object $event An object representing an event from the calendar table. The event will be identified by the id field. return: bool Success |
delete_event($id) X-Ref |
Call this function to delete the event with id $id from calendar table. param: int $id The id of an event from the 'event' table. return: bool |
hide_event($event) X-Ref |
Call this function to hide an event in the calendar table the event will be identified by the id field of the $event object. param: object $event An object representing an event from the calendar table. The event will be identified by the id field. return: true |
show_event($event) X-Ref |
Call this function to unhide an event in the calendar table the event will be identified by the id field of the $event object. param: object $event An object representing an event from the calendar table. The event will be identified by the id field. return: true |
textlib_get_instance() X-Ref |
Original singleton helper function, please use static methods instead, ex: core_text::convert() return: textlib instance |
get_generic_section_name($format, stdClass $section) X-Ref |
Gets the generic section name for a courses section The global function is deprecated. Each course format can define their own generic section name param: string $format Course format ID e.g. 'weeks' $course->format param: stdClass $section Section object from database return: Display name that the course format prefers, e.g. "Week 2" |
get_all_sections($courseid) X-Ref |
Returns an array of sections for the requested course id It is usually not recommended to display the list of sections used in course because the course format may have it's own way to do it. If you need to just display the name of the section please call: get_section_name($course, $section) {@link get_section_name()} from 2.4 $section may also be just the field course_sections.section If you need the list of all sections it is more efficient to get this data by calling $modinfo = get_fast_modinfo($courseorid); $sections = $modinfo->get_section_info_all() {@link get_fast_modinfo()} {@link course_modinfo::get_section_info_all()} Information about one section (instance of section_info): get_fast_modinfo($courseorid)->get_sections_info($section) {@link course_modinfo::get_section_info()} param: int $courseid return: array Array of section_info objects |
add_mod_to_section($mod, $beforemod = null) X-Ref |
Given a full mod object with section and course already defined, adds this module to that section. This function is deprecated, please use {@link course_add_cm_to_section()} Note that course_add_cm_to_section() also updates field course_modules.section and calls rebuild_course_cache() param: object $mod param: int $beforemod An existing ID which we will insert the new module before return: int The course_sections ID where the mod is inserted |
get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modnamesused) X-Ref |
Returns a number of useful structures for course displays Function get_all_mods() is deprecated in 2.4 Instead of: <code> get_all_mods($courseid, $mods, $modnames, $modnamesplural, $modnamesused); </code> please use: <code> $mods = get_fast_modinfo($courseorid)->get_cms(); $modnames = get_module_types_names(); $modnamesplural = get_module_types_names(true); $modnamesused = get_fast_modinfo($courseorid)->get_used_module_names(); </code> param: int $courseid id of the course to get info about param: array $mods (return) list of course modules param: array $modnames (return) list of names of all module types installed and available param: array $modnamesplural (return) list of names of all module types installed and available in the plural form param: array $modnamesused (return) list of names of all module types used in the course |
get_course_section($section, $courseid) X-Ref |
Returns course section - creates new if does not exist yet This function is deprecated. To create a course section call: course_create_sections_if_missing($courseorid, $sections); to get the section call: get_fast_modinfo($courseorid)->get_section_info($sectionnum); param: int $section relative section number (field course_sections.section) param: int $courseid return: stdClass record from table {course_sections} |
format_weeks_get_section_dates($section, $course) X-Ref |
Return the start and end date of the week in Weekly course format It is not recommended to use this function outside of format_weeks plugin param: stdClass $section The course_section entry from the DB param: stdClass $course The course entry from DB return: stdClass property start for startdate, property end for enddate |
get_print_section_cm_text(cm_info $cm, $course) X-Ref |
Obtains shared data that is used in print_section when displaying a course-module entry. Deprecated. Instead of: list($content, $name) = get_print_section_cm_text($cm, $course); use: $content = $cm->get_formatted_content(array('overflowdiv' => true, 'noclean' => true)); $name = $cm->get_formatted_name(); param: cm_info $cm Course-module data (must come from get_fast_modinfo) param: object $course (argument not used) return: array An array with the following values in this order: |
print_section_add_menus($course, $section, $modnames = null, $vertical=false, $return=false, $sectionreturn=null) X-Ref |
Prints the menus to add activities and resources. Deprecated. Please use: $courserenderer = $PAGE->get_renderer('core', 'course'); $output = $courserenderer->course_section_add_cm_control($course, $section, $sectionreturn, array('inblock' => $vertical)); echo $output; // if $return argument in print_section_add_menus() set to false param: stdClass $course course object, must be the same as set on the page param: int $section relative section number (field course_sections.section) param: null|array $modnames (argument ignored) get_module_types_names() is used instead of argument param: bool $vertical Vertical orientation param: bool $return Return the menus or send them to output param: int $sectionreturn The section to link back to return: void|string depending on $return |
make_editing_buttons(stdClass $mod, $absolute_ignored = true, $moveselect = true, $indent=-1, $section=null) X-Ref |
Produces the editing buttons for a module Deprecated. Please use: $courserenderer = $PAGE->get_renderer('core', 'course'); $actions = course_get_cm_edit_actions($mod, $indent, $section); return ' ' . $courserenderer->course_section_cm_edit_actions($actions); param: stdClass $mod The module to produce editing buttons for param: bool $absolute_ignored (argument ignored) - all links are absolute param: bool $moveselect (argument ignored) param: int $indent The current indenting param: int $section The section to link back to return: string XHTML for the editing buttons |
print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%", $hidecompletion=false, $sectionreturn=null) X-Ref |
Prints a section full of activity modules Deprecated. Please use: $courserenderer = $PAGE->get_renderer('core', 'course'); echo $courserenderer->course_section_cm_list($course, $section, $sectionreturn, array('hidecompletion' => $hidecompletion)); param: stdClass $course The course param: stdClass|section_info $section The section object containing properties id and section param: array $mods (argument not used) param: array $modnamesused (argument not used) param: bool $absolute (argument not used) param: string $width (argument not used) param: bool $hidecompletion Hide completion status param: int $sectionreturn The section to return to return: void |
print_overview($courses, array $remote_courses=array() X-Ref |
Displays the list of courses with user notes This function is not used in core. It was replaced by block course_overview param: array $courses param: array $remote_courses |
print_recent_activity($course) X-Ref |
This function trawls through the logs looking for anything new since the user's last login This function was only used to print the content of block recent_activity All functionality is moved into class {@link block_recent_activity} and renderer {@link block_recent_activity_renderer} param: stdClass $course |
delete_course_module($id) X-Ref |
Delete a course module and any associated data at the course level (events) Until 1.5 this function simply marked a deleted flag ... now it deletes it completely. param: int $id the course module id return: boolean true on success, false on failure |
update_category_button($categoryid = 0) X-Ref |
Prints the turn editing on/off button on course/index.php or course/category.php. param: integer $categoryid The id of the category we are showing, or 0 for system context. return: string HTML of the editing button, or empty string, if this user is not allowed |
make_categories_list(&$list, &$parents, $requiredcapability = '',$excludeid = 0, $category = NULL, $path = "") X-Ref |
This function recursively travels the categories, building up a nice list for display. It also makes an array that list all the parents for each category. For example, if you have a tree of categories like: Miscellaneous (id = 1) Subcategory (id = 2) Sub-subcategory (id = 4) Other category (id = 3) Then after calling this function you will have $list = array(1 => 'Miscellaneous', 2 => 'Miscellaneous / Subcategory', 4 => 'Miscellaneous / Subcategory / Sub-subcategory', 3 => 'Other category'); $parents = array(2 => array(1), 4 => array(1, 2)); If you specify $requiredcapability, then only categories where the current user has that capability will be added to $list, although all categories will still be added to $parents, and if you only have $requiredcapability in a child category, not the parent, then the child catgegory will still be included. If you specify the option $excluded, then that category, and all its children, are omitted from the tree. This is useful when you are doing something like moving categories, where you do not want to allow people to move a category to be the child of itself. This function is deprecated! For list of categories use coursecat::make_all_categories($requiredcapability, $excludeid, $separator) For parents of one particular category use coursecat::get($id)->get_parents() param: array $list For output, accumulates an array categoryid => full category path name param: array $parents For output, accumulates an array categoryid => list of parent category ids. param: string/array $requiredcapability if given, only categories where the current param: integer $excludeid Omit this category and its children from the lists built. param: object $category Not used param: string $path Not used |
category_delete_move($category, $newparentid, $showfeedback=true) X-Ref |
Delete category, but move contents to another category. This function is deprecated. Please use coursecat::get($category->id)->delete_move($newparentid, $showfeedback); param: object $category param: int $newparentid category id return: bool status |
category_delete_full($category, $showfeedback=true) X-Ref |
Recursively delete category including all subcategories and courses. This function is deprecated. Please use coursecat::get($category->id)->delete_full($showfeedback); param: stdClass $category param: boolean $showfeedback display some notices return: array return deleted courses |
move_category($category, $newparentcat) X-Ref |
Efficiently moves a category - NOTE that this can have a huge impact access-control-wise... This function is deprecated. Please use $coursecat = coursecat::get($category->id); if ($coursecat->can_change_parent($newparentcat->id)) { $coursecat->change_parent($newparentcat->id); } Alternatively you can use $coursecat->update(array('parent' => $newparentcat->id)); Function update() also updates field course_categories.timemodified param: stdClass|coursecat $category param: stdClass|coursecat $newparentcat |
course_category_hide($category) X-Ref |
Hide course category and child course and subcategories This function is deprecated. Please use coursecat::get($category->id)->hide(); param: stdClass $category return: void |
course_category_show($category) X-Ref |
Show course category and child course and subcategories This function is deprecated. Please use coursecat::get($category->id)->show(); param: stdClass $category return: void |
get_course_category($catid=0) X-Ref |
Return specified category, default if given does not exist This function is deprecated. To get the category with the specified it please use: coursecat::get($catid, IGNORE_MISSING); or coursecat::get($catid, MUST_EXIST); To get the first available category please use coursecat::get_default(); class coursecat will also make sure that at least one category exists in DB param: int $catid course category id return: object caregory |
create_course_category($category) X-Ref |
Create a new course category and marks the context as dirty This function does not set the sortorder for the new category and {@link fix_course_sortorder()} should be called after creating a new course category Please note that this function does not verify access control. This function is deprecated. It is replaced with the method create() in class coursecat. {@link coursecat::create()} also verifies the data, fixes sortorder and logs the action param: object $category All of the data required for an entry in the course_categories table return: object new course category |
get_all_subcategories($catid) X-Ref |
Returns an array of category ids of all the subcategories for a given category. This function is deprecated. To get visible children categories of the given category use: coursecat::get($categoryid)->get_children(); This function will return the array or coursecat objects, on each of them you can call get_children() again param: int $catid - The id of the category whose subcategories we want to find. return: array of category ids. |
get_child_categories($parentid) X-Ref |
Gets the child categories of a given courses category This function is deprecated. Please use functions in class coursecat: - coursecat::get($parentid)->has_children() tells if the category has children (visible or not to the current user) - coursecat::get($parentid)->get_children() returns an array of coursecat objects, each of them represents a children category visible to the current user (i.e. visible=1 or user has capability to view hidden categories) - coursecat::get($parentid)->get_children_count() returns number of children categories visible to the current user - coursecat::count_all() returns total count of all categories in the system (both visible and not) - coursecat::get_default() returns the first category (usually to be used if count_all() == 1) param: int $parentid the id of a course category. return: array all the child course categories. |
get_categories($parent='none', $sort=NULL, $shallow=true) X-Ref |
Returns a sorted list of categories. When asking for $parent='none' it will return all the categories, regardless of depth. Wheen asking for a specific parent, the default is to return a "shallow" resultset. Pass false to $shallow and it will return all the child categories as well. param: string $parent The parent category if any param: string $sort the sortorder param: bool $shallow - set to false to get the children too return: array of categories |
print_course_search($value="", $return=false, $format="plain") X-Ref |
Displays a course search form This function is deprecated, please use course renderer: $renderer = $PAGE->get_renderer('core', 'course'); echo $renderer->course_search_form($value, $format); param: string $value default value to populate the search field param: bool $return if true returns the value, if false - outputs param: string $format display format - 'plain' (default), 'short' or 'navbar' return: null|string |
print_my_moodle() X-Ref |
Prints custom user information on the home page This function is deprecated, please use: $renderer = $PAGE->get_renderer('core', 'course'); echo $renderer->frontpage_my_courses() |
print_remote_course($course, $width="100%") X-Ref |
Prints information about one remote course This function is deprecated, it is replaced with protected function {@link core_course_renderer::frontpage_remote_course()} It is only used from function {@link core_course_renderer::frontpage_my_courses()} |
print_remote_host($host, $width="100%") X-Ref |
Prints information about one remote host This function is deprecated, it is replaced with protected function {@link core_course_renderer::frontpage_remote_host()} It is only used from function {@link core_course_renderer::frontpage_my_courses()} |
print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1, $showcourses = true, $categorycourses=NULL) X-Ref |
Recursive function to print out all the categories in a nice format with or without courses included |
print_category_info($category, $depth = 0, $showcourses = false, array $courses = null) X-Ref |
Prints the category information. param: stdClass $category param: int $depth The depth of the category. param: bool $showcourses If set to true course information will also be printed. param: array|null $courses An array of courses belonging to the category, or null if you don't have it yet. |
get_course_category_tree($id = 0, $depth = 0) X-Ref |
This function generates a structured array of courses and categories. param: int $id param: int $depth |
print_courses($category) X-Ref |
Print courses in category. If category is 0 then all courses are printed. param: int|stdClass $category category object or id. return: bool true if courses found and printed, else false. |
print_course($course, $highlightterms = '') X-Ref |
Print a description of a course, suitable for browsing in a list. param: object $course the course object. param: string $highlightterms Ignored in this deprecated function! |
get_category_courses_array($categoryid = 0) X-Ref |
Gets an array whose keys are category ids and whose values are arrays of courses in the corresponding category. param: int $categoryid return: array |
get_category_courses_array_recursively(array &$flattened, $category) X-Ref |
Recursive function to help flatten the course category tree. param: array &$flattened An array passed by reference in which to store courses for each category. param: stdClass $category The category to get courses for. |
blog_get_context_url($context=null) X-Ref |
Returns a URL based on the context of the current page. This URL points to blog/index.php and includes filter parameters appropriate for the current page. param: stdclass $context return: string |
get_courses_wmanagers($categoryid=0, $sort="c.sortorder ASC", $fields=array() X-Ref |
Retrieve course records with the course managers and other related records that we need for print_course(). This allows print_courses() to do its job in a constant number of DB queries, regardless of the number of courses, role assignments, etc. The returned array is indexed on c.id, and each course will have - $course->managers - array containing RA objects that include a $user obj with the minimal fields needed for fullname() param: int|string $categoryid Either the categoryid for the courses or 'all' param: string $sort A SQL sort field and direction param: array $fields An array of additional fields to fetch return: array |
convert_tree_to_html($tree, $row=0) X-Ref |
Converts a nested array tree into HTML ul:li [recursive] param: array $tree A tree array to convert param: int $row Used in identifying the iteration level and in ul classes return: string HTML structure |
convert_tabrows_to_tree($tabrows, $selected, $inactive, $activated) X-Ref |
Convert nested tabrows to a nested array param: array $tabrows A [nested] array of tab row objects param: string $selected The tabrow to select (by id) param: array $inactive An array of tabrow id's to make inactive param: array $activated An array of tabrow id's to make active return: array The nested array |
can_use_rotated_text() X-Ref |
Can handle rotated text. Whether it is safe to use the trickery in textrotate.js. return: bool True for yes, false for no |
get_context_instance($contextlevel, $instance = 0, $strictness = IGNORE_MISSING) X-Ref |
Get the context instance as an object. This function will create the context instance if it does not exist yet. param: integer $contextlevel The context level, for example CONTEXT_COURSE, or CONTEXT_MODULE. param: integer $instance The instance id. For $level = CONTEXT_COURSE, this would be $course->id, param: int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; return: context The context object. |
get_context_instance_by_id($id, $strictness = IGNORE_MISSING) X-Ref |
Get a context instance as an object, from a given context id. param: int $id context id param: int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; return: context|bool the context object or false if not found. |
get_system_context($cache = true) X-Ref |
Returns system context or null if can not be created yet. param: bool $cache use caching return: context system context (null if context table not created yet) |
get_parent_contexts(context $context, $includeself = false) X-Ref |
Recursive function which, given a context, find all parent context ids, and return the array in reverse order, i.e. parent first, then grand parent, etc. param: context $context param: bool $includeself optional, defaults to false return: array |
get_parent_contextid(context $context) X-Ref |
Return the id of the parent of this context, or false if there is no parent (only happens if this is the site context.) param: context $context return: integer the id of the parent context. |
get_child_contexts(context $context) X-Ref |
Recursive function which, given a context, find all its children contexts. For course category contexts it will return immediate children only categories and courses. It will NOT recurse into courses or child categories. If you want to do that, call it on the returned courses/categories. When called for a course context, it will return the modules and blocks displayed in the course page. If called on a user/course/module context it _will_ populate the cache with the appropriate contexts ;-) param: context $context return: array Array of child records |
create_contexts($contextlevel = null, $buildpaths = true) X-Ref |
Precreates all contexts including all parents. param: int $contextlevel empty means all param: bool $buildpaths update paths and depths return: void |
cleanup_contexts() X-Ref |
Remove stale context records. return: bool |
build_context_path($force = false) X-Ref |
Populate context.path and context.depth where missing. param: bool $force force a complete rebuild of the path and depth fields, defaults to false return: void |
rebuild_contexts(array $fixcontexts) X-Ref |
Rebuild all related context depth and path caches. param: array $fixcontexts array of contexts, strongtyped return: void |
preload_course_contexts($courseid) X-Ref |
Preloads all contexts relating to a course: course, modules. Block contexts are no longer loaded here. The contexts for all the blocks on the current page are now efficiently loaded by {@link block_manager::load_blocks()}. param: int $courseid Course ID return: void |
context_moved(context $context, context $newparent) X-Ref |
Update the path field of the context and all dep. subcontexts that follow Update the path field of the context and all the dependent subcontexts that follow the move. The most important thing here is to be as DB efficient as possible. This op can have a massive impact in the DB. param: context $context context obj param: context $newparent new parent obj return: void |
fetch_context_capabilities(context $context) X-Ref |
Extracts the relevant capabilities given a contextid. All case based, example an instance of forum context. Will fetch all forum related capabilities, while course contexts Will fetch all capabilities capabilities `name` varchar(150) NOT NULL, `captype` varchar(50) NOT NULL, `contextlevel` int(10) NOT NULL, `component` varchar(100) NOT NULL, param: context $context return: array |
context_instance_preload(stdClass $rec) X-Ref |
Preloads context information from db record and strips the cached info. The db request has to contain both the $join and $select from context_instance_preload_sql() param: stdClass $rec return: void (modifies $rec) |
get_contextlevel_name($contextlevel) X-Ref |
Returns context level name param: integer $contextlevel $context->context level. One of the CONTEXT_... constants. return: string the name for this type of context. |
print_context_name(context $context, $withprefix = true, $short = false) X-Ref |
Prints human readable context identifier. param: context $context the context. param: boolean $withprefix whether to prefix the name of the context with the param: boolean $short whether to user the short name of the thing. Only applies return: string the human readable context name. |
mark_context_dirty($path) X-Ref |
Mark a context as dirty (with timestamp) so as to force reloading of the context. param: string $path context path |
delete_context($contextlevel, $instanceid, $deleterecord = true) X-Ref |
Remove a context record and any dependent entries, removes context from static context cache too param: int $contextlevel param: int $instanceid param: bool $deleterecord false means keep record for now return: bool returns true or throws an exception |
get_context_url(context $context) X-Ref |
Get a URL for a context, if there is a natural one. For example, for CONTEXT_COURSE, this is the course page. For CONTEXT_USER it is the user profile page. param: context $context the context return: moodle_url |
get_course_context(context $context) X-Ref |
Is this context part of any course? if yes return course context, if not return null or throw exception. param: context $context return: context_course context of the enclosing course, null if not found or exception |
get_user_courses_bycap($userid, $cap, $accessdata_ignored, $doanything_ignored, $sort = 'c.sortorder ASC', $fields = null, $limit_ignored = 0) X-Ref |
Get an array of courses where cap requested is available and user is enrolled, this can be relatively slow. param: int $userid A user id. By default (null) checks the permissions of the current user. param: string $cap - name of the capability param: array $accessdata_ignored param: bool $doanything_ignored param: string $sort - sorting fields - prefix each fieldname with "c." param: array $fields - additional fields you are interested in... param: int $limit_ignored return: array $courses - ordered array of course objects - see notes above |
get_role_context_caps($roleid, context $context) X-Ref |
This is really slow!!! do not use above course context level param: int $roleid param: context $context return: array |
get_courseid_from_context(context $context) X-Ref |
Returns current course id or false if outside of course based on context parameter. param: context $context return: int|bool related course id or false |
context_instance_preload_sql($joinon, $contextlevel, $tablealias) X-Ref |
Preloads context information together with instances. Use context_instance_preload() to strip the context info from the record and cache the context instance. If you are using this methid, you should have something like this: list($ctxselect, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx'); To prevent the use of this deprecated function, replace the line above with something similar to this: $ctxselect = ', ' . context_helper::get_preload_record_columns_sql('ctx'); ^ $ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)"; ^ ^ ^ ^ $params = array('contextlevel' => CONTEXT_COURSE); ^ param: string $joinon for example 'u.id' param: string $contextlevel context level of instance in $joinon param: string $tablealias context table alias return: array with two values - select and join part |
get_related_contexts_string(context $context) X-Ref |
Gets a string for sql calls, searching for stuff in this context or above. param: context $context return: string |
get_plugin_list_with_file($plugintype, $file, $include = false) X-Ref |
Get a list of all the plugins of a given type that contain a particular file. param: string $plugintype the type of plugin, e.g. 'mod' or 'report'. param: string $file the name of file that must be present in the plugin. param: bool $include if true (default false), the file will be include_once-ed if found. return: array with plugin name as keys (e.g. 'forum', 'courselist') and the path |
check_browser_operating_system($brand) X-Ref |
Checks to see if is the browser operating system matches the specified brand. Known brand: 'Windows','Linux','Macintosh','SGI','SunOS','HP-UX' param: string $brand The operating system identifier being tested return: bool true if the given brand below to the detected operating system |
check_browser_version($brand, $version = null) X-Ref |
Checks to see if is a browser matches the specified brand and is equal or better version. param: string $brand The browser identifier being tested param: int $version The version of the browser, if not specified any version (except 5.5 for IE for BC reasons) return: bool true if the given version is below that of the detected browser |
get_device_type() X-Ref |
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 return: string device type |
get_device_type_list($incusertypes = true) X-Ref |
Returns a list of the device types supporting by Moodle param: boolean $incusertypes includes types specified using the devicedetectregex admin setting return: array $types |
get_selected_theme_for_device_type($devicetype = null) X-Ref |
Returns the theme selected for a particular device or false if none selected. param: string $devicetype return: string|false The name of the theme to use for the device or the false if not set |
get_device_cfg_var_name($devicetype = null) X-Ref |
Returns the name of the device type theme var in $CFG because there is not a convention to allow backwards compatibility. param: string $devicetype return: string The config variable to use to determine the theme |
set_user_device_type($newdevice) X-Ref |
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. param: string $newdevice The device the user is currently using. return: string The device the user has switched to |
get_user_device_type() X-Ref |
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. return: string The device the user is currently using or wishes to use |
get_browser_version_classes() X-Ref |
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 return: array An array of browser version classes |
generate_email_supportuser() X-Ref |
Generate a fake user for emails based on support settings return: stdClass user info |
badges_get_issued_badge_info($hash) X-Ref |
Get issued badge details for assertion URL param: string $hash Unique hash of a badge return: array Information about issued badge. |
can_use_html_editor() X-Ref |
Does the user want and can edit using rich text html editor? This function does not make sense anymore because a user can directly choose their preferred editor. return: bool |
count_login_failures($mode, $username, $lastlogin) X-Ref |
Returns an object with counts of failed login attempts Returns information about failed login attempts. If the current user is an admin, then two numbers are returned: the number of attempts and the number of accounts. For non-admins, only the attempts on the given user are shown. param: string $mode Either 'admin' or 'everybody' param: string $username The username we are searching for param: string $lastlogin The date from which we are searching return: int |
ajaxenabled(array $browsers = null) X-Ref |
Returns whether ajax is enabled/allowed or not. This function is deprecated and always returns true. param: array $unused - not used any more. return: bool |
coursemodule_visible_for_user($cm, $userid=0) X-Ref |
Determine whether a course module is visible within a course, this is different from instance_is_visible() - faster and visibility for user param: object $cm object param: int $userid empty means current user return: bool Success |
enrol_cohort_get_cohorts(course_enrolment_manager $manager) X-Ref |
Gets all the cohorts the user is able to view. param: course_enrolment_manager $manager return: array |
enrol_cohort_can_view_cohort($cohortid) X-Ref |
Check if cohort exists and user is allowed to enrol it. This function is deprecated, use {@link cohort_can_view_cohort()} instead since it also takes into account current context param: int $cohortid Cohort ID return: boolean |
cohort_get_visible_list($course, $onlyenrolled=true) X-Ref |
Returns list of cohorts from course parent contexts. Note: this function does not implement any capability checks, it means it may disclose existence of cohorts, make sure it is displayed to users with appropriate rights only. It is advisable to use {@link cohort_get_available_cohorts()} instead. param: stdClass $course param: bool $onlyenrolled true means include only cohorts with enrolled users return: array of cohort names with number of enrolled users |
enrol_cohort_enrol_all_users(course_enrolment_manager $manager, $cohortid, $roleid) X-Ref |
Enrols all of the users in a cohort through a manual plugin instance. In order for this to succeed the course must contain a valid manual enrolment plugin instance that the user has permission to enrol users through. param: course_enrolment_manager $manager param: int $cohortid param: int $roleid return: int |
enrol_cohort_search_cohorts(course_enrolment_manager $manager, $offset = 0, $limit = 25, $search = '') X-Ref |
Gets cohorts the user is able to view. param: course_enrolment_manager $manager param: int $offset limit output from param: int $limit items to output per load param: string $search search string return: array Array(more => bool, offset => int, cohorts => array) |
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |