/lib/deprecatedlib.php
PHP | 3551 lines | 1708 code | 485 blank | 1358 comment | 100 complexity | 36333e44b8188f25a2cd459f489584ba MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1, BSD-3-Clause, MIT, GPL-3.0
Large files files are truncated, but you can click here to view the full file
- <?php
- // This file is part of Moodle - http://moodle.org/
- //
- // Moodle is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // Moodle is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
- /**
- * 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.
- *
- * @package core
- * @subpackage deprecated
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- * @deprecated
- */
- defined('MOODLE_INTERNAL') || die();
- /* === Functions that needs to be kept longer in deprecated lib than normal time period === */
- /**
- * @deprecated since 2.7 use new events instead
- */
- function add_to_log() {
- throw new coding_exception('add_to_log() has been removed, please rewrite your code to the new events API');
- }
- /**
- * @deprecated since 2.6
- */
- function events_trigger() {
- throw new coding_exception('events_trigger() has been deprecated along with all Events 1 API in favour of Events 2 API.');
- }
- /**
- * List all core subsystems and their location
- *
- * This is a list 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.
- *
- * @deprecated since 2.6, use core_component::get_core_subsystems()
- *
- * @param bool $fullpaths false means relative paths from dirroot, use true for performance reasons
- * @return array of (string)name => (string|null)location
- */
- function get_core_subsystems($fullpaths = false) {
- global $CFG;
- // NOTE: do not add any other debugging here, keep forever.
- $subsystems = core_component::get_core_subsystems();
- if ($fullpaths) {
- return $subsystems;
- }
- debugging('Short paths are deprecated when using get_core_subsystems(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER);
- $dlength = strlen($CFG->dirroot);
- foreach ($subsystems as $k => $v) {
- if ($v === null) {
- continue;
- }
- $subsystems[$k] = substr($v, $dlength+1);
- }
- return $subsystems;
- }
- /**
- * Lists all plugin types.
- *
- * @deprecated since 2.6, use core_component::get_plugin_types()
- *
- * @param bool $fullpaths false means relative paths from dirroot
- * @return array Array of strings - name=>location
- */
- function get_plugin_types($fullpaths = true) {
- global $CFG;
- // NOTE: do not add any other debugging here, keep forever.
- $types = core_component::get_plugin_types();
- if ($fullpaths) {
- return $types;
- }
- debugging('Short paths are deprecated when using get_plugin_types(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER);
- $dlength = strlen($CFG->dirroot);
- foreach ($types as $k => $v) {
- if ($k === 'theme') {
- $types[$k] = 'theme';
- continue;
- }
- $types[$k] = substr($v, $dlength+1);
- }
- return $types;
- }
- /**
- * Use when listing real plugins of one type.
- *
- * @deprecated since 2.6, use core_component::get_plugin_list()
- *
- * @param string $plugintype type of plugin
- * @return array name=>fulllocation pairs of plugins of given type
- */
- function get_plugin_list($plugintype) {
- // NOTE: do not add any other debugging here, keep forever.
- if ($plugintype === '') {
- $plugintype = 'mod';
- }
- return core_component::get_plugin_list($plugintype);
- }
- /**
- * 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.
- *
- * @deprecated since 2.6, use core_component::get_plugin_list_with_class()
- *
- * @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
- * 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 ''.
- * @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')
- * and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice').
- */
- function get_plugin_list_with_class($plugintype, $class, $file) {
- // NOTE: do not add any other debugging here, keep forever.
- return core_component::get_plugin_list_with_class($plugintype, $class, $file);
- }
- /**
- * Returns the exact absolute path to plugin directory.
- *
- * @deprecated since 2.6, use core_component::get_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
- */
- function get_plugin_directory($plugintype, $name) {
- // NOTE: do not add any other debugging here, keep forever.
- if ($plugintype === '') {
- $plugintype = 'mod';
- }
- return core_component::get_plugin_directory($plugintype, $name);
- }
- /**
- * Normalize the component name using the "frankenstyle" names.
- *
- * @deprecated since 2.6, use core_component::normalize_component()
- *
- * @param string $component
- * @return array two-items list of [(string)type, (string|null)name]
- */
- function normalize_component($component) {
- // NOTE: do not add any other debugging here, keep forever.
- return core_component::normalize_component($component);
- }
- /**
- * Return exact absolute path to a plugin directory.
- *
- * @deprecated since 2.6, use core_component::normalize_component()
- *
- * @param string $component name such as 'moodle', 'mod_forum'
- * @return string full path to component directory; NULL if not found
- */
- function get_component_directory($component) {
- // NOTE: do not add any other debugging here, keep forever.
- return core_component::get_component_directory($component);
- }
- /**
- * Get the context instance as an object. This function will create the
- * context instance if it does not exist yet.
- *
- * @deprecated since 2.2, use context_course::instance() or other relevant class instead
- * @todo This will be deleted in Moodle 2.8, refer MDL-34472
- * @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,
- * for $level = CONTEXT_MODULE, this would be $cm->id. And so on. Defaults to 0
- * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
- * MUST_EXIST means throw exception if no record or multiple records found
- * @return context The context object.
- */
- function get_context_instance($contextlevel, $instance = 0, $strictness = IGNORE_MISSING) {
- debugging('get_context_instance() is deprecated, please use context_xxxx::instance() instead.', DEBUG_DEVELOPER);
- $instances = (array)$instance;
- $contexts = array();
- $classname = context_helper::get_class_for_level($contextlevel);
- // we do not load multiple contexts any more, PAGE should be responsible for any preloading
- foreach ($instances as $inst) {
- $contexts[$inst] = $classname::instance($inst, $strictness);
- }
- if (is_array($instance)) {
- return $contexts;
- } else {
- return $contexts[$instance];
- }
- }
- /* === End of long term deprecated api list === */
- /**
- * @deprecated since 2.7 - use new file picker instead
- */
- function clam_log_upload() {
- throw new coding_exception('clam_log_upload() can not be used any more, please use file picker instead');
- }
- /**
- * @deprecated since 2.7 - use new file picker instead
- */
- function clam_log_infected() {
- throw new coding_exception('clam_log_infected() can not be used any more, please use file picker instead');
- }
- /**
- * @deprecated since 2.7 - use new file picker instead
- */
- function clam_change_log() {
- throw new coding_exception('clam_change_log() can not be used any more, please use file picker instead');
- }
- /**
- * @deprecated since 2.7 - infected files are now deleted in file picker
- */
- function clam_replace_infected_file() {
- throw new coding_exception('clam_replace_infected_file() can not be used any more, please use file picker instead');
- }
- /**
- * @deprecated since 2.7
- */
- function clam_handle_infected_file() {
- throw new coding_exception('clam_handle_infected_file() can not be used any more, please use file picker instead');
- }
- /**
- * @deprecated since 2.7
- */
- function clam_scan_moodle_file() {
- throw new coding_exception('clam_scan_moodle_file() can not be used any more, please use file picker instead');
- }
- /**
- * @deprecated since 2.7 PHP 5.4.x should be always compatible.
- */
- function password_compat_not_supported() {
- throw new coding_exception('Do not use password_compat_not_supported() - bcrypt is now always available');
- }
- /**
- * @deprecated since 2.6
- */
- function session_get_instance() {
- throw new coding_exception('session_get_instance() is removed, use \core\session\manager instead');
- }
- /**
- * @deprecated since 2.6
- */
- function session_is_legacy() {
- throw new coding_exception('session_is_legacy() is removed, do not use any more');
- }
- /**
- * @deprecated since 2.6
- */
- function session_kill_all() {
- throw new coding_exception('session_kill_all() is removed, use \core\session\manager::kill_all_sessions() instead');
- }
- /**
- * @deprecated since 2.6
- */
- function session_touch() {
- throw new coding_exception('session_touch() is removed, use \core\session\manager::touch_session() instead');
- }
- /**
- * @deprecated since 2.6
- */
- function session_kill() {
- throw new coding_exception('session_kill() is removed, use \core\session\manager::kill_session() instead');
- }
- /**
- * @deprecated since 2.6
- */
- function session_kill_user() {
- throw new coding_exception('session_kill_user() is removed, use \core\session\manager::kill_user_sessions() instead');
- }
- /**
- * @deprecated since 2.6
- */
- function session_set_user() {
- throw new coding_exception('session_set_user() is removed, use \core\session\manager::set_user() instead');
- }
- /**
- * @deprecated since 2.6
- */
- function session_is_loggedinas() {
- throw new coding_exception('session_is_loggedinas() is removed, use \core\session\manager::is_loggedinas() instead');
- }
- /**
- * @deprecated since 2.6
- */
- function session_get_realuser() {
- throw new coding_exception('session_get_realuser() is removed, use \core\session\manager::get_realuser() instead');
- }
- /**
- * @deprecated since 2.6
- */
- function session_loginas() {
- throw new coding_exception('session_loginas() is removed, use \core\session\manager::loginas() instead');
- }
- /**
- * @deprecated since 2.6
- */
- function js_minify() {
- throw new coding_exception('js_minify() is removed, use core_minify::js_files() or core_minify::js() instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function css_minify_css() {
- throw new coding_exception('css_minify_css() is removed, use core_minify::css_files() or core_minify::css() instead.');
- }
- // === Deprecated before 2.6.0 ===
- /**
- * @deprecated
- */
- function check_gd_version() {
- throw new coding_exception('check_gd_version() is removed, GD extension is always available now');
- }
- /**
- * @deprecated
- */
- function update_login_count() {
- throw new coding_exception('update_login_count() is removed, all calls need to be removed');
- }
- /**
- * @deprecated
- */
- function reset_login_count() {
- throw new coding_exception('reset_login_count() is removed, all calls need to be removed');
- }
- /**
- * @deprecated
- */
- function update_log_display_entry() {
- throw new coding_exception('The update_log_display_entry() is removed, please use db/log.php description file instead.');
- }
- /**
- * @deprecated use the text formatting in a standard way instead (http://docs.moodle.org/dev/Output_functions)
- * this was abused mostly for embedding of attachments
- */
- function filter_text() {
- throw new coding_exception('filter_text() can not be used anymore, use format_text(), format_string() etc instead.');
- }
- /**
- * @deprecated Loginhttps is no longer supported
- */
- function httpsrequired() {
- throw new coding_exception('httpsrequired() can not be used any more. Loginhttps is no longer supported.');
- }
- /**
- * @deprecated since 3.1 - replacement legacy file API methods can be found on the moodle_url class, for example:
- * The moodle_url::make_legacyfile_url() method can be used to generate a legacy course file url. To generate
- * course module file.php url the moodle_url::make_file_url() should be used.
- */
- function get_file_url() {
- throw new coding_exception('get_file_url() can not be used anymore. Please use ' .
- 'moodle_url factory methods instead.');
- }
- /**
- * @deprecated use get_enrolled_users($context) instead.
- */
- function get_course_participants() {
- throw new coding_exception('get_course_participants() can not be used any more, use get_enrolled_users() instead.');
- }
- /**
- * @deprecated use is_enrolled($context, $userid) instead.
- */
- function is_course_participant() {
- throw new coding_exception('is_course_participant() can not be used any more, use is_enrolled() instead.');
- }
- /**
- * @deprecated
- */
- function get_recent_enrolments() {
- throw new coding_exception('get_recent_enrolments() is removed as it returned inaccurate results.');
- }
- /**
- * @deprecated use clean_param($string, PARAM_FILE) instead.
- */
- function detect_munged_arguments() {
- throw new coding_exception('detect_munged_arguments() can not be used any more, please use clean_param(,PARAM_FILE) instead.');
- }
- /**
- * 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.
- *
- * @global object
- * @param string $zipfile The zip file to unzip
- * @param string $destination The location to unzip to
- * @param bool $showstatus_ignored Unused
- * @deprecated since 2.0 MDL-15919
- */
- function unzip_file($zipfile, $destination = '', $showstatus_ignored = true) {
- debugging(__FUNCTION__ . '() is deprecated. '
- . 'Please use the application/zip file_packer implementation instead.', DEBUG_DEVELOPER);
- // Extract everything from zipfile.
- $path_parts = pathinfo(cleardoubleslashes($zipfile));
- $zippath = $path_parts["dirname"]; //The path of the zip file
- $zipfilename = $path_parts["basename"]; //The name of the zip file
- $extension = $path_parts["extension"]; //The extension of the file
- //If no file, error
- if (empty($zipfilename)) {
- return false;
- }
- //If no extension, error
- if (empty($extension)) {
- return false;
- }
- //Clear $zipfile
- $zipfile = cleardoubleslashes($zipfile);
- //Check zipfile exists
- if (!file_exists($zipfile)) {
- return false;
- }
- //If no destination, passed let's go with the same directory
- if (empty($destination)) {
- $destination = $zippath;
- }
- //Clear $destination
- $destpath = rtrim(cleardoubleslashes($destination), "/");
- //Check destination path exists
- if (!is_dir($destpath)) {
- return false;
- }
- $packer = get_file_packer('application/zip');
- $result = $packer->extract_to_pathname($zipfile, $destpath);
- if ($result === false) {
- return false;
- }
- foreach ($result as $status) {
- if ($status !== true) {
- return false;
- }
- }
- return true;
- }
- /**
- * Zip an array of files/dirs to a destination zip file
- * Both parameters must be FULL paths to the files/dirs
- *
- * @global object
- * @param array $originalfiles Files to zip
- * @param string $destination The destination path
- * @return bool Outcome
- *
- * @deprecated since 2.0 MDL-15919
- */
- function zip_files($originalfiles, $destination) {
- debugging(__FUNCTION__ . '() is deprecated. '
- . 'Please use the application/zip file_packer implementation instead.', DEBUG_DEVELOPER);
- // Extract everything from destination.
- $path_parts = pathinfo(cleardoubleslashes($destination));
- $destpath = $path_parts["dirname"]; //The path of the zip file
- $destfilename = $path_parts["basename"]; //The name of the zip file
- $extension = $path_parts["extension"]; //The extension of the file
- //If no file, error
- if (empty($destfilename)) {
- return false;
- }
- //If no extension, add it
- if (empty($extension)) {
- $extension = 'zip';
- $destfilename = $destfilename.'.'.$extension;
- }
- //Check destination path exists
- if (!is_dir($destpath)) {
- return false;
- }
- //Check destination path is writable. TODO!!
- //Clean destination filename
- $destfilename = clean_filename($destfilename);
- //Now check and prepare every file
- $files = array();
- $origpath = NULL;
- foreach ($originalfiles as $file) { //Iterate over each file
- //Check for every file
- $tempfile = cleardoubleslashes($file); // no doubleslashes!
- //Calculate the base path for all files if it isn't set
- if ($origpath === NULL) {
- $origpath = rtrim(cleardoubleslashes(dirname($tempfile)), "/");
- }
- //See if the file is readable
- if (!is_readable($tempfile)) { //Is readable
- continue;
- }
- //See if the file/dir is in the same directory than the rest
- if (rtrim(cleardoubleslashes(dirname($tempfile)), "/") != $origpath) {
- continue;
- }
- //Add the file to the array
- $files[] = $tempfile;
- }
- $zipfiles = array();
- $start = strlen($origpath)+1;
- foreach($files as $file) {
- $zipfiles[substr($file, $start)] = $file;
- }
- $packer = get_file_packer('application/zip');
- return $packer->archive_to_pathname($zipfiles, $destpath . '/' . $destfilename);
- }
- /**
- * @deprecated use groups_get_all_groups() instead.
- */
- function mygroupid() {
- throw new coding_exception('mygroupid() can not be used any more, please use groups_get_all_groups() instead.');
- }
- /**
- * @deprecated since Moodle 2.0 MDL-14617 - please do not use this function any more.
- */
- function groupmode() {
- throw new coding_exception('groupmode() can not be used any more, please use groups_get_* instead.');
- }
- /**
- * @deprecated Since year 2006 - please do not use this function any more.
- */
- function set_current_group() {
- throw new coding_exception('set_current_group() can not be used anymore, please use $SESSION->currentgroup[$courseid] instead');
- }
- /**
- * @deprecated Since year 2006 - please do not use this function any more.
- */
- function get_current_group() {
- throw new coding_exception('get_current_group() can not be used any more, please use groups_get_* instead');
- }
- /**
- * @deprecated Since Moodle 2.8
- */
- function groups_filter_users_by_course_module_visible() {
- throw new coding_exception('groups_filter_users_by_course_module_visible() is removed. ' .
- 'Replace with a call to \core_availability\info_module::filter_user_list(), ' .
- 'which does basically the same thing but includes other restrictions such ' .
- 'as profile restrictions.');
- }
- /**
- * @deprecated Since Moodle 2.8
- */
- function groups_course_module_visible() {
- throw new coding_exception('groups_course_module_visible() is removed, use $cm->uservisible to decide whether the current
- user can ' . 'access an activity.', DEBUG_DEVELOPER);
- }
- /**
- * @deprecated since 2.0
- */
- function error() {
- throw new coding_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a removed, please call
- print_error() instead of error()');
- }
- /**
- * @deprecated use $PAGE->theme->name instead.
- */
- function current_theme() {
- throw new coding_exception('current_theme() can not be used any more, please use $PAGE->theme->name instead');
- }
- /**
- * @deprecated
- */
- function formerr() {
- throw new coding_exception('formerr() is removed. Please change your code to use $OUTPUT->error_text($string).');
- }
- /**
- * @deprecated use $OUTPUT->skip_link_target() in instead.
- */
- function skip_main_destination() {
- throw new coding_exception('skip_main_destination() can not be used any more, please use $OUTPUT->skip_link_target() instead.');
- }
- /**
- * @deprecated use $OUTPUT->container() instead.
- */
- function print_container() {
- throw new coding_exception('print_container() can not be used any more. Please use $OUTPUT->container() instead.');
- }
- /**
- * @deprecated use $OUTPUT->container_start() instead.
- */
- function print_container_start() {
- throw new coding_exception('print_container_start() can not be used any more. Please use $OUTPUT->container_start() instead.');
- }
- /**
- * @deprecated use $OUTPUT->container_end() instead.
- */
- function print_container_end() {
- throw new coding_exception('print_container_end() can not be used any more. Please use $OUTPUT->container_end() instead.');
- }
- /**
- * @deprecated since Moodle 2.0 MDL-19077 - use $OUTPUT->notification instead.
- */
- function notify() {
- throw new coding_exception('notify() is removed, please use $OUTPUT->notification() instead');
- }
- /**
- * @deprecated use $OUTPUT->continue_button() instead.
- */
- function print_continue() {
- throw new coding_exception('print_continue() can not be used any more. Please use $OUTPUT->continue_button() instead.');
- }
- /**
- * @deprecated use $PAGE methods instead.
- */
- function print_header() {
- throw new coding_exception('print_header() can not be used any more. Please use $PAGE methods instead.');
- }
- /**
- * @deprecated use $PAGE methods instead.
- */
- function print_header_simple() {
- throw new coding_exception('print_header_simple() can not be used any more. Please use $PAGE methods instead.');
- }
- /**
- * @deprecated use $OUTPUT->block() instead.
- */
- function print_side_block() {
- throw new coding_exception('print_side_block() can not be used any more, please use $OUTPUT->block() instead.');
- }
- /**
- * @deprecated since Moodle 3.6
- */
- function print_textarea() {
- throw new coding_exception(
- 'print_textarea() has been removed. Please use $OUTPUT->print_textarea() instead.'
- );
- }
- /**
- * 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.
- *
- * @deprecated use $OUTPUT->arrow() instead.
- * @todo final deprecation of this function once MDL-45448 is resolved
- *
- * If no sort string is associated with the direction, an arrow with no alt text will be printed/returned.
- *
- * @global object
- * @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
- *
- */
- function print_arrow($direction='up', $strsort=null, $return=false) {
- global $OUTPUT;
- debugging('print_arrow() is deprecated. Please use $OUTPUT->arrow() instead.', DEBUG_DEVELOPER);
- if (!in_array($direction, array('up', 'down', 'right', 'left', 'move'))) {
- return null;
- }
- $return = null;
- switch ($direction) {
- case 'up':
- $sortdir = 'asc';
- break;
- case 'down':
- $sortdir = 'desc';
- break;
- case 'move':
- $sortdir = 'asc';
- break;
- default:
- $sortdir = null;
- break;
- }
- // Prepare language string
- $strsort = '';
- if (empty($strsort) && !empty($sortdir)) {
- $strsort = get_string('sort' . $sortdir, 'grades');
- }
- $return = ' ' . $OUTPUT->pix_icon('t/' . $direction, $strsort) . ' ';
- if ($return) {
- return $return;
- } else {
- echo $return;
- }
- }
- /**
- * @deprecated since Moodle 2.0
- */
- function choose_from_menu() {
- throw new coding_exception('choose_from_menu() is removed. Please change your code to use html_writer::select().');
- }
- /**
- * @deprecated use $OUTPUT->help_icon_scale($courseid, $scale) instead.
- */
- function print_scale_menu_helpbutton() {
- throw new coding_exception('print_scale_menu_helpbutton() can not be used any more. '.
- 'Please use $OUTPUT->help_icon_scale($courseid, $scale) instead.');
- }
- /**
- * @deprecated use html_writer::checkbox() instead.
- */
- function print_checkbox() {
- throw new coding_exception('print_checkbox() can not be used any more. Please use html_writer::checkbox() instead.');
- }
- /**
- * @deprecated since Moodle 3.2
- */
- function update_module_button() {
- throw new coding_exception('update_module_button() can not be used anymore. Activity modules should ' .
- 'not add the edit module button, the link is already available in the Administration block. Themes ' .
- 'can choose to display the link in the buttons row consistently for all module types.');
- }
- /**
- * @deprecated use $OUTPUT->navbar() instead
- */
- function print_navigation () {
- throw new coding_exception('print_navigation() can not be used any more, please update use $OUTPUT->navbar() instead.');
- }
- /**
- * @deprecated Please use $PAGE->navabar methods instead.
- */
- function build_navigation() {
- throw new coding_exception('build_navigation() can not be used any more, please use $PAGE->navbar methods instead.');
- }
- /**
- * @deprecated not relevant with global navigation in Moodle 2.x+
- */
- function navmenu() {
- throw new coding_exception('navmenu() can not be used any more, it is no longer relevant with global navigation.');
- }
- /// CALENDAR MANAGEMENT ////////////////////////////////////////////////////////////////
- /**
- * @deprecated please use calendar_event::create() instead.
- */
- function add_event() {
- throw new coding_exception('add_event() can not be used any more, please use calendar_event::create() instead.');
- }
- /**
- * @deprecated please calendar_event->update() instead.
- */
- function update_event() {
- throw new coding_exception('update_event() is removed, please use calendar_event->update() instead.');
- }
- /**
- * @deprecated please use calendar_event->delete() instead.
- */
- function delete_event() {
- throw new coding_exception('delete_event() can not be used any more, please use '.
- 'calendar_event->delete() instead.');
- }
- /**
- * @deprecated please use calendar_event->toggle_visibility(false) instead.
- */
- function hide_event() {
- throw new coding_exception('hide_event() can not be used any more, please use '.
- 'calendar_event->toggle_visibility(false) instead.');
- }
- /**
- * @deprecated please use calendar_event->toggle_visibility(true) instead.
- */
- function show_event() {
- throw new coding_exception('show_event() can not be used any more, please use '.
- 'calendar_event->toggle_visibility(true) instead.');
- }
- /**
- * @deprecated since Moodle 2.2 use core_text::xxxx() instead.
- */
- function textlib_get_instance() {
- throw new coding_exception('textlib_get_instance() can not be used any more, please use '.
- 'core_text::functioname() instead.');
- }
- /**
- * @deprecated since 2.4
- */
- function get_generic_section_name() {
- throw new coding_exception('get_generic_section_name() is deprecated. Please use appropriate functionality '
- .'from class core_courseformat\\base');
- }
- /**
- * @deprecated since 2.4
- */
- function get_all_sections() {
- throw new coding_exception('get_all_sections() is removed. See phpdocs for this function');
- }
- /**
- * @deprecated since 2.4
- */
- function add_mod_to_section() {
- throw new coding_exception('Function add_mod_to_section() is removed, please use course_add_cm_to_section()');
- }
- /**
- * @deprecated since 2.4
- */
- function get_all_mods() {
- throw new coding_exception('Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details');
- }
- /**
- * @deprecated since 2.4
- */
- function get_course_section() {
- throw new coding_exception('Function get_course_section() is removed. Please use course_create_sections_if_missing() and get_fast_modinfo() instead.');
- }
- /**
- * @deprecated since 2.4
- */
- function format_weeks_get_section_dates() {
- throw new coding_exception('Function format_weeks_get_section_dates() is removed. It is not recommended to'.
- ' use it outside of format_weeks plugin');
- }
- /**
- * @deprecated since 2.5
- */
- function get_print_section_cm_text() {
- throw new coding_exception('Function get_print_section_cm_text() is removed. Please use '.
- 'cm_info::get_formatted_content() and cm_info::get_formatted_name()');
- }
- /**
- * @deprecated since 2.5
- */
- function print_section_add_menus() {
- throw new coding_exception('Function print_section_add_menus() is removed. Please use course renderer '.
- 'function course_section_add_cm_control()');
- }
- /**
- * @deprecated since 2.5. 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);
- */
- function make_editing_buttons() {
- throw new coding_exception('Function make_editing_buttons() is removed, please see PHPdocs in '.
- 'lib/deprecatedlib.php on how to replace it');
- }
- /**
- * @deprecated since 2.5
- */
- function print_section() {
- throw new coding_exception('Function print_section() is removed. Please use core_course\output\section_format '.
- ' to render a course section instead.');
- }
- /**
- * @deprecated since 2.5
- */
- function print_overview() {
- throw new coding_exception('Function print_overview() is removed. Use block course_overview to display this information');
- }
- /**
- * @deprecated since 2.5
- */
- function print_recent_activity() {
- throw new coding_exception('Function print_recent_activity() is removed. It is not recommended to'.
- ' use it outside of block_recent_activity');
- }
- /**
- * @deprecated since 2.5
- */
- function delete_course_module() {
- throw new coding_exception('Function delete_course_module() is removed. Please use course_delete_module() instead.');
- }
- /**
- * @deprecated since 2.5
- */
- function update_category_button() {
- throw new coding_exception('Function update_category_button() is removed. Pages to view '.
- 'and edit courses are now separate and no longer depend on editing mode.');
- }
- /**
- * @deprecated since 2.5
- */
- function make_categories_list() {
- throw new coding_exception('Global function make_categories_list() is removed. Please use '.
- 'core_course_category::make_categories_list() and core_course_category::get_parents()');
- }
- /**
- * @deprecated since 2.5
- */
- function category_delete_move() {
- throw new coding_exception('Function category_delete_move() is removed. Please use ' .
- 'core_course_category::delete_move() instead.');
- }
- /**
- * @deprecated since 2.5
- */
- function category_delete_full() {
- throw new coding_exception('Function category_delete_full() is removed. Please use ' .
- 'core_course_category::delete_full() instead.');
- }
- /**
- * @deprecated since 2.5
- */
- function move_category() {
- throw new coding_exception('Function move_category() is removed. Please use core_course_category::change_parent() instead.');
- }
- /**
- * @deprecated since 2.5
- */
- function course_category_hide() {
- throw new coding_exception('Function course_category_hide() is removed. Please use core_course_category::hide() instead.');
- }
- /**
- * @deprecated since 2.5
- */
- function course_category_show() {
- throw new coding_exception('Function course_category_show() is removed. Please use core_course_category::show() instead.');
- }
- /**
- * @deprecated since 2.5. Please use core_course_category::get($catid, IGNORE_MISSING) or
- * core_course_category::get($catid, MUST_EXIST).
- */
- function get_course_category() {
- throw new coding_exception('Function get_course_category() is removed. Please use core_course_category::get(), ' .
- 'see phpdocs for more details');
- }
- /**
- * @deprecated since 2.5
- */
- function create_course_category() {
- throw new coding_exception('Function create_course_category() is removed. Please use core_course_category::create(), ' .
- 'see phpdocs for more details');
- }
- /**
- * @deprecated since 2.5. Please use core_course_category::get() and core_course_category::get_children()
- */
- function get_all_subcategories() {
- throw new coding_exception('Function get_all_subcategories() is removed. Please use appropriate methods() '.
- 'of core_course_category class. See phpdocs for more details');
- }
- /**
- * @deprecated since 2.5. Please use core_course_category::get($parentid)->get_children().
- */
- function get_child_categories() {
- throw new coding_exception('Function get_child_categories() is removed. Use core_course_category::get_children() or see ' .
- 'phpdocs for more details.');
- }
- /**
- * @deprecated since 2.5
- */
- function get_categories() {
- throw new coding_exception('Function get_categories() is removed. Please use ' .
- 'appropriate functions from class core_course_category');
- }
- /**
- * @deprecated since 2.5
- */
- function print_course_search() {
- throw new coding_exception('Function print_course_search() is removed, please use course renderer');
- }
- /**
- * @deprecated since 2.5
- */
- function print_my_moodle() {
- throw new coding_exception('Function print_my_moodle() is removed, please use course renderer ' .
- 'function frontpage_my_courses()');
- }
- /**
- * @deprecated since 2.5
- */
- function print_remote_course() {
- throw new coding_exception('Function print_remote_course() is removed, please use course renderer');
- }
- /**
- * @deprecated since 2.5
- */
- function print_remote_host() {
- throw new coding_exception('Function print_remote_host() is removed, please use course renderer');
- }
- /**
- * @deprecated since 2.5
- */
- function print_whole_category_list() {
- throw new coding_exception('Function print_whole_category_list() is removed, please use course renderer');
- }
- /**
- * @deprecated since 2.5
- */
- function print_category_info() {
- throw new coding_exception('Function print_category_info() is removed, please use course renderer');
- }
- /**
- * @deprecated since 2.5
- */
- function get_course_category_tree() {
- throw new coding_exception('Function get_course_category_tree() is removed, please use course ' .
- 'renderer or core_course_category class, see function phpdocs for more info');
- }
- /**
- * @deprecated since 2.5
- */
- function print_courses() {
- throw new coding_exception('Function print_courses() is removed, please use course renderer');
- }
- /**
- * @deprecated since 2.5
- */
- function print_course() {
- throw new coding_exception('Function print_course() is removed, please use course renderer');
- }
- /**
- * @deprecated since 2.5
- */
- function get_category_courses_array() {
- throw new coding_exception('Function get_category_courses_array() is removed, please use methods of ' .
- 'core_course_category class');
- }
- /**
- * @deprecated since 2.5
- */
- function get_category_courses_array_recursively() {
- throw new coding_exception('Function get_category_courses_array_recursively() is removed, please use ' .
- 'methods of core_course_category class', DEBUG_DEVELOPER);
- }
- /**
- * @deprecated since Moodle 2.5 MDL-27814 - please do not use this function any more.
- */
- function blog_get_context_url() {
- throw new coding_exception('Function blog_get_context_url() is removed, getting params from context is not reliable for blogs.');
- }
- /**
- * @deprecated since 2.5
- */
- function get_courses_wmanagers() {
- throw new coding_exception('Function get_courses_wmanagers() is removed, please use ' .
- 'core_course_category::get_courses()');
- }
- /**
- * @deprecated since 2.5
- */
- function convert_tree_to_html() {
- throw new coding_exception('Function convert_tree_to_html() is removed. Consider using class tabtree and core_renderer::render_tabtree()');
- }
- /**
- * @deprecated since 2.5
- */
- function convert_tabrows_to_tree() {
- throw new coding_exception('Function convert_tabrows_to_tree() is removed. Consider using class tabtree');
- }
- /**
- * @deprecated since 2.5 - do not use, the textrotate.js will work it out automatically
- */
- function can_use_rotated_text() {
- debugging('can_use_rotated_text() is removed. JS feature detection is used automatically.');
- }
- /**
- * @deprecated since Moodle 2.2 MDL-35009 - please do not use this function any more.
- */
- function get_context_instance_by_id() {
- throw new coding_exception('get_context_instance_by_id() is now removed, please use context::instance_by_id($id) instead.');
- }
- /**
- * Returns system context or null if can not be created yet.
- *
- * @see context_system::instance()
- * @deprecated since 2.2
- * @param bool $cache use caching
- * @return context system context (null if context table not created yet)
- */
- function get_system_context($cache = true) {
- debugging('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER);
- return context_system::instance(0, IGNORE_MISSING, $cache);
- }
- /**
- * @deprecated since 2.2, use $context->get_parent_context_ids() instead
- */
- function get_parent_contexts() {
- throw new coding_exception('get_parent_contexts() is removed, please use $context->get_parent_context_ids() instead.');
- }
- /**
- * @deprecated since Moodle 2.2
- */
- function get_parent_contextid() {
- throw new coding_exception('get_parent_contextid() is removed, please use $context->get_parent_context() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function get_child_contexts() {
- throw new coding_exception('get_child_contexts() is removed, please use $context->get_child_contexts() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function create_contexts() {
- throw new coding_exception('create_contexts() is removed, please use context_helper::create_instances() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function cleanup_contexts() {
- throw new coding_exception('cleanup_contexts() is removed, please use context_helper::cleanup_instances() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function build_context_path() {
- throw new coding_exception('build_context_path() is removed, please use context_helper::build_all_paths() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function rebuild_contexts() {
- throw new coding_exception('rebuild_contexts() is removed, please use $context->reset_paths(true) instead.');
- }
- /**
- * @deprecated since Moodle 2.2
- */
- function preload_course_contexts() {
- throw new coding_exception('preload_course_contexts() is removed, please use context_helper::preload_course() instead.');
- }
- /**
- * @deprecated since Moodle 2.2
- */
- function context_moved() {
- throw new coding_exception('context_moved() is removed, please use context::update_moved() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function fetch_context_capabilities() {
- throw new coding_exception('fetch_context_capabilities() is removed, please use $context->get_capabilities() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function context_instance_preload() {
- throw new coding_exception('context_instance_preload() is removed, please use context_helper::preload_from_record() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function get_contextlevel_name() {
- throw new coding_exception('get_contextlevel_name() is removed, please use context_helper::get_level_name() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function print_context_name() {
- throw new coding_exception('print_context_name() is removed, please use $context->get_context_name() instead.');
- }
- /**
- * @deprecated since 2.2, use $context->mark_dirty() instead
- */
- function mark_context_dirty() {
- throw new coding_exception('mark_context_dirty() is removed, please use $context->mark_dirty() instead.');
- }
- /**
- * @deprecated since Moodle 2.2
- */
- function delete_context() {
- throw new coding_exception('delete_context() is removed, please use context_helper::delete_instance() ' .
- 'or $context->delete_content() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function get_context_url() {
- throw new coding_exception('get_context_url() is removed, please use $context->get_url() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function get_course_context() {
- throw new coding_exception('get_course_context() is removed, please use $context->get_course_context(true) instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function get_user_courses_bycap() {
- throw new coding_exception('get_user_courses_bycap() is removed, please use enrol_get_users_courses() instead.');
- }
- /**
- * @deprecated since Moodle 2.2
- */
- function get_role_context_caps() {
- throw new coding_exception('get_role_context_caps() is removed, it is really slow. Don\'t use it.');
- }
- /**
- * @deprecated since 2.2
- */
- function get_courseid_from_context() {
- throw new coding_exception('get_courseid_from_context() is removed, please use $context->get_course_context(false) instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function context_instance_preload_sql() {
- throw new coding_exception('context_instance_preload_sql() is removed, please use context_helper::get_preload_record_columns_sql() instead.');
- }
- /**
- * @deprecated since 2.2
- */
- function get_related_contexts_string() {
- throw new coding_exception('get_related_contexts_string() is removed, please use $context->get_parent_context_ids(true) instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function get_plugin_list_with_file() {
- throw new coding_exception('get_plugin_list_with_file() is removed, please use core_component::get_plugin_list_with_file() instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function check_browser_operating_system() {
- throw new coding_exception('check_browser_operating_system is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function check_browser_version() {
- throw new coding_exception('check_browser_version is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function get_device_type() {
- throw new coding_exception('get_device_type is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function get_device_type_list() {
- throw new coding_exception('get_device_type_list is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function get_selected_theme_for_device_type() {
- throw new coding_exception('get_selected_theme_for_device_type is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function get_device_cfg_var_name() {
- throw new coding_exception('get_device_cfg_var_name is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function set_user_device_type() {
- throw new coding_exception('set_user_device_type is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function get_user_device_type() {
- throw new coding_exception('get_user_device_type is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since 2.6
- */
- function get_browser_version_classes() {
- throw new coding_exception('get_browser_version_classes is removed, please update your code to use core_useragent instead.');
- }
- /**
- * @deprecated since Moodle 2.6
- */
- function generate_email_supportuser() {
- throw new coding_exception('generate_email_supportuser is removed, please use core_user::get_support_user');
- }
- /**
- * @deprecated since Moodle 2.6
- */
- function badges_get_issued_badge_info() {
- throw new coding_exception('Function badges_get_issued_badge_info() is removed. Please use core_badges_assertion class and methods to generate badge assertion.');
- }
- /**
- * @deprecated since 2.6
- */
- function can_use_html_editor() {
- throw new coding_exception('can_use_html_editor is removed, please update your code to assume it returns true.');
- }
- /**
- * @deprecated since Moodle 2.7, use {@link user_count_login_failures()} instead.
- */
- function count_login_failures() {
- throw new coding_exception('count_login_failures() can not be used any more, please use user_count_login_failures().');
- }
- /**
- * @deprecated since 2.7 MDL-33099/MDL-44088 - please do not use this function any more.
- */
- function ajaxenabled() {
- throw new coding_exception('ajaxenabled() can not be used anymore. Update your code to work with JS at all times.');
- }
- /**
- * @deprecated Since Moodle 2.7 MDL-44070
- */
- function coursemodule_visible_for_user() {
- throw new coding_exception('coursemodule_visible_for_user() can not be used any more,
- please use \core_availability\info_module::is_user_visible()');
- }
- /**
- * @deprecated since Moodle 2.8 MDL-36014, MDL-35618 this functionality is removed
- */
- function enrol_cohort_get_cohorts() {
- throw new coding_exception('Function enrol_cohort_get_cohorts() is removed, use '.
- 'cohort_get_available_cohorts() instead');
- }
- /**
- * @deprecated since Moodle 2.8 MDL-36014 please use cohort_can_view_cohort()
- */
- function enrol_cohort_can_view_cohort() {
- throw new coding_exception('Function enrol_cohort_can_view_cohort() is removed, use cohort_can_view_cohort() instead');
- }
- /**
- * @deprecated since Moodle 2.8 MDL-36014 use cohort_get_available_cohorts() instead
- */
- function cohort_get_visible_list() {
- throw new coding_exception('Function cohort_get_visible_list() is removed. Please use function cohort_get_available_cohorts() ".
- "that correctly checks capabilities.');
- }
- /**
- * @deprecated since Moodle 2.8 MDL-35618 this functionality is removed
- */
- function enrol_cohort_enrol_all_users() {
- throw new coding_exception('enrol_cohort_enrol_all_users() is removed. This functionality is moved to enrol_manual.');
- }
- /**
- * @deprecated since Moodle 2.8 MDL-35618 this functionality is removed
- */
- function enrol_cohort_search_cohorts() {
- throw new coding_exception('enrol_cohort_search_cohorts() is removed. This functionality is moved to enrol_manual.');
- }
- /* === Apis deprecated in since Moodle 2.9 === */
- /**
- * @deprecated since Moodle 2.9 MDL-49371 - please do not use this function any more.
- */
- function message_current_user_is_involved() {
- throw new coding_exception('message_current_user_is_involved() can not be used any more.');
- }
- /**
- * @deprecated since Moodle 2.9 MDL-45898 - please do not use this function any more.
- */
- function profile_display_badges() {
- throw new coding_exception('profile_display_badges() can not be used any more.');
- }
- /**
- * @deprecated since Moodle 2.9 MDL-45774 - Please do not use this function any more.
- */
- function useredit_shared_definition_preferences() {
- throw new coding_exception('useredit_shared_definition_preferences() can not be used any more.');
- }
- /**
- * @deprecated since Moodle 2.9
- */
- function calendar_normalize_tz() {
- throw new coding_exception('calendar_normalize_tz() can not be used any more, please use core_date::normalise_timezone() instead.');
- }
- /**
- * @deprecated since Moodle 2.9
- */
- function get_user_timezone_offset() {
- throw new coding_exception('get_user_timezone_offset() can not be used any more, please use standard PHP DateTimeZone class instead');
- }
- /**
- * @deprecated since Moodle 2.9
- */
- function get_timezone_offset() {
- throw new coding_exception('get_timezone_offset() can not be used any more, please use standard PHP DateTimeZone class instead');
- }
- /**
- * @deprecated since Moodle 2.9
- */
- function get_list_of_timezones() {
- throw new coding_exception('get_list_of_timezones() can not be used any more, please use core_date::get_list_of_timezones() instead');
- }
- /**
- * @deprecated since Moodle 2.9
- */
- function update_timezone_records() {
- throw new coding_exception('update_timezone_records() can not be used any more, please use standard PHP DateTime class instead');
- }
- /**
- * @deprecated since Moodle 2.9
- */
- function calculate_user_dst_table() {
- throw new coding_exception('calculate_user_dst_table() can not be used any more, please use standard PHP DateTime class instead');
- }
- /**
- * @deprecated since Moodle 2.9
- */
- function dst_changes_for_year() {
- throw new coding_exception('dst_changes_for_year() can not be used any more, please use standard DateTime class instead');
- }
- /**
- * @deprecated since Moodle 2.9
- */
- function get_timezone_record() {
- throw new coding_exception('get_timezone_record() can not be used any more, please use standard PHP DateTime class instead');
- }
- /* === Apis deprecated since Moodle 3.0 === */
- /**
- * @deprecated since Moodle 3.0 MDL-49360 - please do not use this function any more.
- */
- function get_referer() {
- throw new coding_exception('get_referer() can not be used any more. Please use get_local_referer() instead.');
- }
- /**
- * @deprecated since Moodle 3.0 use \core_useragent::is_web_…
Large files files are truncated, but you can click here to view the full file