Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * deprecatedlib.php - Old functions retained only for backward compatibility 20 * 21 * Old functions retained only for backward compatibility. New code should not 22 * use any of these functions. 23 * 24 * @package core 25 * @subpackage deprecated 26 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} 27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 28 * @deprecated 29 */ 30 31 defined('MOODLE_INTERNAL') || die(); 32 33 /* === Functions that needs to be kept longer in deprecated lib than normal time period === */ 34 35 /** 36 * @deprecated since 2.7 use new events instead 37 */ 38 function add_to_log() { 39 throw new coding_exception('add_to_log() has been removed, please rewrite your code to the new events API'); 40 } 41 42 /** 43 * @deprecated since 2.6 44 */ 45 function events_trigger() { 46 throw new coding_exception('events_trigger() has been deprecated along with all Events 1 API in favour of Events 2 API.'); 47 } 48 49 /** 50 * List all core subsystems and their location 51 * 52 * This is a list of components that are part of the core and their 53 * language strings are defined in /lang/en/<<subsystem>>.php. If a given 54 * plugin is not listed here and it does not have proper plugintype prefix, 55 * then it is considered as course activity module. 56 * 57 * The location is optionally dirroot relative path. NULL means there is no special 58 * directory for this subsystem. If the location is set, the subsystem's 59 * renderer.php is expected to be there. 60 * 61 * @deprecated since 2.6, use core_component::get_core_subsystems() 62 * 63 * @param bool $fullpaths false means relative paths from dirroot, use true for performance reasons 64 * @return array of (string)name => (string|null)location 65 */ 66 function get_core_subsystems($fullpaths = false) { 67 global $CFG; 68 69 // NOTE: do not add any other debugging here, keep forever. 70 71 $subsystems = core_component::get_core_subsystems(); 72 73 if ($fullpaths) { 74 return $subsystems; 75 } 76 77 debugging('Short paths are deprecated when using get_core_subsystems(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER); 78 79 $dlength = strlen($CFG->dirroot); 80 81 foreach ($subsystems as $k => $v) { 82 if ($v === null) { 83 continue; 84 } 85 $subsystems[$k] = substr($v, $dlength+1); 86 } 87 88 return $subsystems; 89 } 90 91 /** 92 * Lists all plugin types. 93 * 94 * @deprecated since 2.6, use core_component::get_plugin_types() 95 * 96 * @param bool $fullpaths false means relative paths from dirroot 97 * @return array Array of strings - name=>location 98 */ 99 function get_plugin_types($fullpaths = true) { 100 global $CFG; 101 102 // NOTE: do not add any other debugging here, keep forever. 103 104 $types = core_component::get_plugin_types(); 105 106 if ($fullpaths) { 107 return $types; 108 } 109 110 debugging('Short paths are deprecated when using get_plugin_types(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER); 111 112 $dlength = strlen($CFG->dirroot); 113 114 foreach ($types as $k => $v) { 115 if ($k === 'theme') { 116 $types[$k] = 'theme'; 117 continue; 118 } 119 $types[$k] = substr($v, $dlength+1); 120 } 121 122 return $types; 123 } 124 125 /** 126 * Use when listing real plugins of one type. 127 * 128 * @deprecated since 2.6, use core_component::get_plugin_list() 129 * 130 * @param string $plugintype type of plugin 131 * @return array name=>fulllocation pairs of plugins of given type 132 */ 133 function get_plugin_list($plugintype) { 134 135 // NOTE: do not add any other debugging here, keep forever. 136 137 if ($plugintype === '') { 138 $plugintype = 'mod'; 139 } 140 141 return core_component::get_plugin_list($plugintype); 142 } 143 144 /** 145 * Get a list of all the plugins of a given type that define a certain class 146 * in a certain file. The plugin component names and class names are returned. 147 * 148 * @deprecated since 2.6, use core_component::get_plugin_list_with_class() 149 * 150 * @param string $plugintype the type of plugin, e.g. 'mod' or 'report'. 151 * @param string $class the part of the name of the class after the 152 * frankenstyle prefix. e.g 'thing' if you are looking for classes with 153 * names like report_courselist_thing. If you are looking for classes with 154 * the same name as the plugin name (e.g. qtype_multichoice) then pass ''. 155 * @param string $file the name of file within the plugin that defines the class. 156 * @return array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum') 157 * and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice'). 158 */ 159 function get_plugin_list_with_class($plugintype, $class, $file) { 160 161 // NOTE: do not add any other debugging here, keep forever. 162 163 return core_component::get_plugin_list_with_class($plugintype, $class, $file); 164 } 165 166 /** 167 * Returns the exact absolute path to plugin directory. 168 * 169 * @deprecated since 2.6, use core_component::get_plugin_directory() 170 * 171 * @param string $plugintype type of plugin 172 * @param string $name name of the plugin 173 * @return string full path to plugin directory; NULL if not found 174 */ 175 function get_plugin_directory($plugintype, $name) { 176 177 // NOTE: do not add any other debugging here, keep forever. 178 179 if ($plugintype === '') { 180 $plugintype = 'mod'; 181 } 182 183 return core_component::get_plugin_directory($plugintype, $name); 184 } 185 186 /** 187 * Normalize the component name using the "frankenstyle" names. 188 * 189 * @deprecated since 2.6, use core_component::normalize_component() 190 * 191 * @param string $component 192 * @return array two-items list of [(string)type, (string|null)name] 193 */ 194 function normalize_component($component) { 195 196 // NOTE: do not add any other debugging here, keep forever. 197 198 return core_component::normalize_component($component); 199 } 200 201 /** 202 * Return exact absolute path to a plugin directory. 203 * 204 * @deprecated since 2.6, use core_component::normalize_component() 205 * 206 * @param string $component name such as 'moodle', 'mod_forum' 207 * @return string full path to component directory; NULL if not found 208 */ 209 function get_component_directory($component) { 210 211 // NOTE: do not add any other debugging here, keep forever. 212 213 return core_component::get_component_directory($component); 214 } 215 216 /** 217 * Get the context instance as an object. This function will create the 218 * context instance if it does not exist yet. 219 * 220 * @deprecated since 2.2, use context_course::instance() or other relevant class instead 221 * @todo This will be deleted in Moodle 2.8, refer MDL-34472 222 * @param integer $contextlevel The context level, for example CONTEXT_COURSE, or CONTEXT_MODULE. 223 * @param integer $instance The instance id. For $level = CONTEXT_COURSE, this would be $course->id, 224 * for $level = CONTEXT_MODULE, this would be $cm->id. And so on. Defaults to 0 225 * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; 226 * MUST_EXIST means throw exception if no record or multiple records found 227 * @return context The context object. 228 */ 229 function get_context_instance($contextlevel, $instance = 0, $strictness = IGNORE_MISSING) { 230 231 debugging('get_context_instance() is deprecated, please use context_xxxx::instance() instead.', DEBUG_DEVELOPER); 232 233 $instances = (array)$instance; 234 $contexts = array(); 235 236 $classname = context_helper::get_class_for_level($contextlevel); 237 238 // we do not load multiple contexts any more, PAGE should be responsible for any preloading 239 foreach ($instances as $inst) { 240 $contexts[$inst] = $classname::instance($inst, $strictness); 241 } 242 243 if (is_array($instance)) { 244 return $contexts; 245 } else { 246 return $contexts[$instance]; 247 } 248 } 249 /* === End of long term deprecated api list === */ 250 251 /** 252 * @deprecated since 2.7 - use new file picker instead 253 */ 254 function clam_log_upload() { 255 throw new coding_exception('clam_log_upload() can not be used any more, please use file picker instead'); 256 } 257 258 /** 259 * @deprecated since 2.7 - use new file picker instead 260 */ 261 function clam_log_infected() { 262 throw new coding_exception('clam_log_infected() can not be used any more, please use file picker instead'); 263 } 264 265 /** 266 * @deprecated since 2.7 - use new file picker instead 267 */ 268 function clam_change_log() { 269 throw new coding_exception('clam_change_log() can not be used any more, please use file picker instead'); 270 } 271 272 /** 273 * @deprecated since 2.7 - infected files are now deleted in file picker 274 */ 275 function clam_replace_infected_file() { 276 throw new coding_exception('clam_replace_infected_file() can not be used any more, please use file picker instead'); 277 } 278 279 /** 280 * @deprecated since 2.7 281 */ 282 function clam_handle_infected_file() { 283 throw new coding_exception('clam_handle_infected_file() can not be used any more, please use file picker instead'); 284 } 285 286 /** 287 * @deprecated since 2.7 288 */ 289 function clam_scan_moodle_file() { 290 throw new coding_exception('clam_scan_moodle_file() can not be used any more, please use file picker instead'); 291 } 292 293 294 /** 295 * @deprecated since 2.7 PHP 5.4.x should be always compatible. 296 */ 297 function password_compat_not_supported() { 298 throw new coding_exception('Do not use password_compat_not_supported() - bcrypt is now always available'); 299 } 300 301 /** 302 * @deprecated since 2.6 303 */ 304 function session_get_instance() { 305 throw new coding_exception('session_get_instance() is removed, use \core\session\manager instead'); 306 } 307 308 /** 309 * @deprecated since 2.6 310 */ 311 function session_is_legacy() { 312 throw new coding_exception('session_is_legacy() is removed, do not use any more'); 313 } 314 315 /** 316 * @deprecated since 2.6 317 */ 318 function session_kill_all() { 319 throw new coding_exception('session_kill_all() is removed, use \core\session\manager::kill_all_sessions() instead'); 320 } 321 322 /** 323 * @deprecated since 2.6 324 */ 325 function session_touch() { 326 throw new coding_exception('session_touch() is removed, use \core\session\manager::touch_session() instead'); 327 } 328 329 /** 330 * @deprecated since 2.6 331 */ 332 function session_kill() { 333 throw new coding_exception('session_kill() is removed, use \core\session\manager::kill_session() instead'); 334 } 335 336 /** 337 * @deprecated since 2.6 338 */ 339 function session_kill_user() { 340 throw new coding_exception('session_kill_user() is removed, use \core\session\manager::kill_user_sessions() instead'); 341 } 342 343 /** 344 * @deprecated since 2.6 345 */ 346 function session_set_user() { 347 throw new coding_exception('session_set_user() is removed, use \core\session\manager::set_user() instead'); 348 } 349 350 /** 351 * @deprecated since 2.6 352 */ 353 function session_is_loggedinas() { 354 throw new coding_exception('session_is_loggedinas() is removed, use \core\session\manager::is_loggedinas() instead'); 355 } 356 357 /** 358 * @deprecated since 2.6 359 */ 360 function session_get_realuser() { 361 throw new coding_exception('session_get_realuser() is removed, use \core\session\manager::get_realuser() instead'); 362 } 363 364 /** 365 * @deprecated since 2.6 366 */ 367 function session_loginas() { 368 throw new coding_exception('session_loginas() is removed, use \core\session\manager::loginas() instead'); 369 } 370 371 /** 372 * @deprecated since 2.6 373 */ 374 function js_minify() { 375 throw new coding_exception('js_minify() is removed, use core_minify::js_files() or core_minify::js() instead.'); 376 } 377 378 /** 379 * @deprecated since 2.6 380 */ 381 function css_minify_css() { 382 throw new coding_exception('css_minify_css() is removed, use core_minify::css_files() or core_minify::css() instead.'); 383 } 384 385 // === Deprecated before 2.6.0 === 386 387 /** 388 * @deprecated 389 */ 390 function check_gd_version() { 391 throw new coding_exception('check_gd_version() is removed, GD extension is always available now'); 392 } 393 394 /** 395 * @deprecated 396 */ 397 function update_login_count() { 398 throw new coding_exception('update_login_count() is removed, all calls need to be removed'); 399 } 400 401 /** 402 * @deprecated 403 */ 404 function reset_login_count() { 405 throw new coding_exception('reset_login_count() is removed, all calls need to be removed'); 406 } 407 408 /** 409 * @deprecated 410 */ 411 function update_log_display_entry() { 412 413 throw new coding_exception('The update_log_display_entry() is removed, please use db/log.php description file instead.'); 414 } 415 416 /** 417 * @deprecated use the text formatting in a standard way instead (https://moodledev.io/docs/apis/subsystems/output#output-functions) 418 * this was abused mostly for embedding of attachments 419 */ 420 function filter_text() { 421 throw new coding_exception('filter_text() can not be used anymore, use format_text(), format_string() etc instead.'); 422 } 423 424 /** 425 * @deprecated Loginhttps is no longer supported 426 */ 427 function httpsrequired() { 428 throw new coding_exception('httpsrequired() can not be used any more. Loginhttps is no longer supported.'); 429 } 430 431 /** 432 * @deprecated since 3.1 - replacement legacy file API methods can be found on the moodle_url class, for example: 433 * The moodle_url::make_legacyfile_url() method can be used to generate a legacy course file url. To generate 434 * course module file.php url the moodle_url::make_file_url() should be used. 435 */ 436 function get_file_url() { 437 throw new coding_exception('get_file_url() can not be used anymore. Please use ' . 438 'moodle_url factory methods instead.'); 439 } 440 441 /** 442 * @deprecated use get_enrolled_users($context) instead. 443 */ 444 function get_course_participants() { 445 throw new coding_exception('get_course_participants() can not be used any more, use get_enrolled_users() instead.'); 446 } 447 448 /** 449 * @deprecated use is_enrolled($context, $userid) instead. 450 */ 451 function is_course_participant() { 452 throw new coding_exception('is_course_participant() can not be used any more, use is_enrolled() instead.'); 453 } 454 455 /** 456 * @deprecated 457 */ 458 function get_recent_enrolments() { 459 throw new coding_exception('get_recent_enrolments() is removed as it returned inaccurate results.'); 460 } 461 462 /** 463 * @deprecated use clean_param($string, PARAM_FILE) instead. 464 */ 465 function detect_munged_arguments() { 466 throw new coding_exception('detect_munged_arguments() can not be used any more, please use clean_param(,PARAM_FILE) instead.'); 467 } 468 469 470 /** 471 * @deprecated since 2.0 MDL-15919 472 */ 473 function unzip_file() { 474 throw new coding_exception(__FUNCTION__ . '() is deprecated. ' 475 . 'Please use the application/zip file_packer implementation instead.'); 476 } 477 478 /** 479 * @deprecated since 2.0 MDL-15919 480 */ 481 function zip_files() { 482 throw new coding_exception(__FUNCTION__ . '() is deprecated. ' 483 . 'Please use the application/zip file_packer implementation instead.'); 484 } 485 486 /** 487 * @deprecated use groups_get_all_groups() instead. 488 */ 489 function mygroupid() { 490 throw new coding_exception('mygroupid() can not be used any more, please use groups_get_all_groups() instead.'); 491 } 492 493 /** 494 * @deprecated since Moodle 2.0 MDL-14617 - please do not use this function any more. 495 */ 496 function groupmode() { 497 throw new coding_exception('groupmode() can not be used any more, please use groups_get_* instead.'); 498 } 499 500 /** 501 * @deprecated Since year 2006 - please do not use this function any more. 502 */ 503 function set_current_group() { 504 throw new coding_exception('set_current_group() can not be used anymore, please use $SESSION->currentgroup[$courseid] instead'); 505 } 506 507 /** 508 * @deprecated Since year 2006 - please do not use this function any more. 509 */ 510 function get_current_group() { 511 throw new coding_exception('get_current_group() can not be used any more, please use groups_get_* instead'); 512 } 513 514 /** 515 * @deprecated Since Moodle 2.8 516 */ 517 function groups_filter_users_by_course_module_visible() { 518 throw new coding_exception('groups_filter_users_by_course_module_visible() is removed. ' . 519 'Replace with a call to \core_availability\info_module::filter_user_list(), ' . 520 'which does basically the same thing but includes other restrictions such ' . 521 'as profile restrictions.'); 522 } 523 524 /** 525 * @deprecated Since Moodle 2.8 526 */ 527 function groups_course_module_visible() { 528 throw new coding_exception('groups_course_module_visible() is removed, use $cm->uservisible to decide whether the current 529 user can ' . 'access an activity.', DEBUG_DEVELOPER); 530 } 531 532 /** 533 * @deprecated since 2.0 534 */ 535 function error() { 536 throw new coding_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a removed, please call 537 throw new \moodle_exception() instead of error()'); 538 } 539 540 541 /** 542 * @deprecated use $PAGE->theme->name instead. 543 */ 544 function current_theme() { 545 throw new coding_exception('current_theme() can not be used any more, please use $PAGE->theme->name instead'); 546 } 547 548 /** 549 * @deprecated 550 */ 551 function formerr() { 552 throw new coding_exception('formerr() is removed. Please change your code to use $OUTPUT->error_text($string).'); 553 } 554 555 /** 556 * @deprecated use $OUTPUT->skip_link_target() in instead. 557 */ 558 function skip_main_destination() { 559 throw new coding_exception('skip_main_destination() can not be used any more, please use $OUTPUT->skip_link_target() instead.'); 560 } 561 562 /** 563 * @deprecated use $OUTPUT->container() instead. 564 */ 565 function print_container() { 566 throw new coding_exception('print_container() can not be used any more. Please use $OUTPUT->container() instead.'); 567 } 568 569 /** 570 * @deprecated use $OUTPUT->container_start() instead. 571 */ 572 function print_container_start() { 573 throw new coding_exception('print_container_start() can not be used any more. Please use $OUTPUT->container_start() instead.'); 574 } 575 576 /** 577 * @deprecated use $OUTPUT->container_end() instead. 578 */ 579 function print_container_end() { 580 throw new coding_exception('print_container_end() can not be used any more. Please use $OUTPUT->container_end() instead.'); 581 } 582 583 /** 584 * @deprecated since Moodle 2.0 MDL-19077 - use $OUTPUT->notification instead. 585 */ 586 function notify() { 587 throw new coding_exception('notify() is removed, please use $OUTPUT->notification() instead'); 588 } 589 590 /** 591 * @deprecated use $OUTPUT->continue_button() instead. 592 */ 593 function print_continue() { 594 throw new coding_exception('print_continue() can not be used any more. Please use $OUTPUT->continue_button() instead.'); 595 } 596 597 /** 598 * @deprecated use $PAGE methods instead. 599 */ 600 function print_header() { 601 602 throw new coding_exception('print_header() can not be used any more. Please use $PAGE methods instead.'); 603 } 604 605 /** 606 * @deprecated use $PAGE methods instead. 607 */ 608 function print_header_simple() { 609 610 throw new coding_exception('print_header_simple() can not be used any more. Please use $PAGE methods instead.'); 611 } 612 613 /** 614 * @deprecated use $OUTPUT->block() instead. 615 */ 616 function print_side_block() { 617 throw new coding_exception('print_side_block() can not be used any more, please use $OUTPUT->block() instead.'); 618 } 619 620 /** 621 * @deprecated since Moodle 3.6 622 */ 623 function print_textarea() { 624 throw new coding_exception( 625 'print_textarea() has been removed. Please use $OUTPUT->print_textarea() instead.' 626 ); 627 } 628 629 /** 630 * Returns an image of an up or down arrow, used for column sorting. To avoid unnecessary DB accesses, please 631 * provide this function with the language strings for sortasc and sortdesc. 632 * 633 * @deprecated use $OUTPUT->arrow() instead. 634 * @todo final deprecation of this function once MDL-45448 is resolved 635 * 636 * If no sort string is associated with the direction, an arrow with no alt text will be printed/returned. 637 * 638 * @global object 639 * @param string $direction 'up' or 'down' 640 * @param string $strsort The language string used for the alt attribute of this image 641 * @param bool $return Whether to print directly or return the html string 642 * @return string|void depending on $return 643 * 644 */ 645 function print_arrow($direction='up', $strsort=null, $return=false) { 646 global $OUTPUT; 647 648 debugging('print_arrow() is deprecated. Please use $OUTPUT->arrow() instead.', DEBUG_DEVELOPER); 649 650 if (!in_array($direction, array('up', 'down', 'right', 'left', 'move'))) { 651 return null; 652 } 653 654 $return = null; 655 656 switch ($direction) { 657 case 'up': 658 $sortdir = 'asc'; 659 break; 660 case 'down': 661 $sortdir = 'desc'; 662 break; 663 case 'move': 664 $sortdir = 'asc'; 665 break; 666 default: 667 $sortdir = null; 668 break; 669 } 670 671 // Prepare language string 672 $strsort = ''; 673 if (empty($strsort) && !empty($sortdir)) { 674 $strsort = get_string('sort' . $sortdir, 'grades'); 675 } 676 677 $return = ' ' . $OUTPUT->pix_icon('t/' . $direction, $strsort) . ' '; 678 679 if ($return) { 680 return $return; 681 } else { 682 echo $return; 683 } 684 } 685 686 /** 687 * @deprecated since Moodle 2.0 688 */ 689 function choose_from_menu() { 690 throw new coding_exception('choose_from_menu() is removed. Please change your code to use html_writer::select().'); 691 } 692 693 /** 694 * @deprecated use $OUTPUT->help_icon_scale($courseid, $scale) instead. 695 */ 696 function print_scale_menu_helpbutton() { 697 throw new coding_exception('print_scale_menu_helpbutton() can not be used any more. '. 698 'Please use $OUTPUT->help_icon_scale($courseid, $scale) instead.'); 699 } 700 701 /** 702 * @deprecated use html_writer::checkbox() instead. 703 */ 704 function print_checkbox() { 705 throw new coding_exception('print_checkbox() can not be used any more. Please use html_writer::checkbox() instead.'); 706 } 707 708 /** 709 * @deprecated since Moodle 3.2 710 */ 711 function update_module_button() { 712 throw new coding_exception('update_module_button() can not be used anymore. Activity modules should ' . 713 'not add the edit module button, the link is already available in the Administration block. Themes ' . 714 'can choose to display the link in the buttons row consistently for all module types.'); 715 } 716 717 /** 718 * @deprecated use $OUTPUT->navbar() instead 719 */ 720 function print_navigation () { 721 throw new coding_exception('print_navigation() can not be used any more, please update use $OUTPUT->navbar() instead.'); 722 } 723 724 /** 725 * @deprecated Please use $PAGE->navabar methods instead. 726 */ 727 function build_navigation() { 728 throw new coding_exception('build_navigation() can not be used any more, please use $PAGE->navbar methods instead.'); 729 } 730 731 /** 732 * @deprecated not relevant with global navigation in Moodle 2.x+ 733 */ 734 function navmenu() { 735 throw new coding_exception('navmenu() can not be used any more, it is no longer relevant with global navigation.'); 736 } 737 738 /// CALENDAR MANAGEMENT //////////////////////////////////////////////////////////////// 739 740 741 /** 742 * @deprecated please use calendar_event::create() instead. 743 */ 744 function add_event() { 745 throw new coding_exception('add_event() can not be used any more, please use calendar_event::create() instead.'); 746 } 747 748 /** 749 * @deprecated please calendar_event->update() instead. 750 */ 751 function update_event() { 752 throw new coding_exception('update_event() is removed, please use calendar_event->update() instead.'); 753 } 754 755 /** 756 * @deprecated please use calendar_event->delete() instead. 757 */ 758 function delete_event() { 759 throw new coding_exception('delete_event() can not be used any more, please use '. 760 'calendar_event->delete() instead.'); 761 } 762 763 /** 764 * @deprecated please use calendar_event->toggle_visibility(false) instead. 765 */ 766 function hide_event() { 767 throw new coding_exception('hide_event() can not be used any more, please use '. 768 'calendar_event->toggle_visibility(false) instead.'); 769 } 770 771 /** 772 * @deprecated please use calendar_event->toggle_visibility(true) instead. 773 */ 774 function show_event() { 775 throw new coding_exception('show_event() can not be used any more, please use '. 776 'calendar_event->toggle_visibility(true) instead.'); 777 } 778 779 /** 780 * @deprecated since Moodle 2.2 use core_text::xxxx() instead. 781 */ 782 function textlib_get_instance() { 783 throw new coding_exception('textlib_get_instance() can not be used any more, please use '. 784 'core_text::functioname() instead.'); 785 } 786 787 /** 788 * @deprecated since 2.4 789 */ 790 function get_generic_section_name() { 791 throw new coding_exception('get_generic_section_name() is deprecated. Please use appropriate functionality ' 792 .'from class core_courseformat\\base'); 793 } 794 795 /** 796 * @deprecated since 2.4 797 */ 798 function get_all_sections() { 799 throw new coding_exception('get_all_sections() is removed. See phpdocs for this function'); 800 } 801 802 /** 803 * @deprecated since 2.4 804 */ 805 function add_mod_to_section() { 806 throw new coding_exception('Function add_mod_to_section() is removed, please use course_add_cm_to_section()'); 807 } 808 809 /** 810 * @deprecated since 2.4 811 */ 812 function get_all_mods() { 813 throw new coding_exception('Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details'); 814 } 815 816 /** 817 * @deprecated since 2.4 818 */ 819 function get_course_section() { 820 throw new coding_exception('Function get_course_section() is removed. Please use course_create_sections_if_missing() and get_fast_modinfo() instead.'); 821 } 822 823 /** 824 * @deprecated since 2.4 825 */ 826 function format_weeks_get_section_dates() { 827 throw new coding_exception('Function format_weeks_get_section_dates() is removed. It is not recommended to'. 828 ' use it outside of format_weeks plugin'); 829 } 830 831 /** 832 * @deprecated since 2.5 833 */ 834 function get_print_section_cm_text() { 835 throw new coding_exception('Function get_print_section_cm_text() is removed. Please use '. 836 'cm_info::get_formatted_content() and cm_info::get_formatted_name()'); 837 } 838 839 /** 840 * @deprecated since 2.5 841 */ 842 function print_section_add_menus() { 843 throw new coding_exception('Function print_section_add_menus() is removed. Please use course renderer '. 844 'function course_section_add_cm_control()'); 845 } 846 847 /** 848 * @deprecated since 2.5. Please use: 849 * $courserenderer = $PAGE->get_renderer('core', 'course'); 850 * $actions = course_get_cm_edit_actions($mod, $indent, $section); 851 * return ' ' . $courserenderer->course_section_cm_edit_actions($actions); 852 */ 853 function make_editing_buttons() { 854 throw new coding_exception('Function make_editing_buttons() is removed, please see PHPdocs in '. 855 'lib/deprecatedlib.php on how to replace it'); 856 } 857 858 /** 859 * @deprecated since 2.5 860 */ 861 function print_section() { 862 throw new coding_exception( 863 'Function print_section() is removed.' . 864 ' Please use core_courseformat\\output\\local\\content\\section' . 865 ' to render a course section instead.' 866 ); 867 } 868 869 /** 870 * @deprecated since 2.5 871 */ 872 function print_overview() { 873 throw new coding_exception('Function print_overview() is removed. Use block course_overview to display this information'); 874 } 875 876 /** 877 * @deprecated since 2.5 878 */ 879 function print_recent_activity() { 880 throw new coding_exception('Function print_recent_activity() is removed. It is not recommended to'. 881 ' use it outside of block_recent_activity'); 882 } 883 884 /** 885 * @deprecated since 2.5 886 */ 887 function delete_course_module() { 888 throw new coding_exception('Function delete_course_module() is removed. Please use course_delete_module() instead.'); 889 } 890 891 /** 892 * @deprecated since 2.5 893 */ 894 function update_category_button() { 895 throw new coding_exception('Function update_category_button() is removed. Pages to view '. 896 'and edit courses are now separate and no longer depend on editing mode.'); 897 } 898 899 /** 900 * @deprecated since 2.5 901 */ 902 function make_categories_list() { 903 throw new coding_exception('Global function make_categories_list() is removed. Please use '. 904 'core_course_category::make_categories_list() and core_course_category::get_parents()'); 905 } 906 907 /** 908 * @deprecated since 2.5 909 */ 910 function category_delete_move() { 911 throw new coding_exception('Function category_delete_move() is removed. Please use ' . 912 'core_course_category::delete_move() instead.'); 913 } 914 915 /** 916 * @deprecated since 2.5 917 */ 918 function category_delete_full() { 919 throw new coding_exception('Function category_delete_full() is removed. Please use ' . 920 'core_course_category::delete_full() instead.'); 921 } 922 923 /** 924 * @deprecated since 2.5 925 */ 926 function move_category() { 927 throw new coding_exception('Function move_category() is removed. Please use core_course_category::change_parent() instead.'); 928 } 929 930 /** 931 * @deprecated since 2.5 932 */ 933 function course_category_hide() { 934 throw new coding_exception('Function course_category_hide() is removed. Please use core_course_category::hide() instead.'); 935 } 936 937 /** 938 * @deprecated since 2.5 939 */ 940 function course_category_show() { 941 throw new coding_exception('Function course_category_show() is removed. Please use core_course_category::show() instead.'); 942 } 943 944 /** 945 * @deprecated since 2.5. Please use core_course_category::get($catid, IGNORE_MISSING) or 946 * core_course_category::get($catid, MUST_EXIST). 947 */ 948 function get_course_category() { 949 throw new coding_exception('Function get_course_category() is removed. Please use core_course_category::get(), ' . 950 'see phpdocs for more details'); 951 } 952 953 /** 954 * @deprecated since 2.5 955 */ 956 function create_course_category() { 957 throw new coding_exception('Function create_course_category() is removed. Please use core_course_category::create(), ' . 958 'see phpdocs for more details'); 959 } 960 961 /** 962 * @deprecated since 2.5. Please use core_course_category::get() and core_course_category::get_children() 963 */ 964 function get_all_subcategories() { 965 throw new coding_exception('Function get_all_subcategories() is removed. Please use appropriate methods() '. 966 'of core_course_category class. See phpdocs for more details'); 967 } 968 969 /** 970 * @deprecated since 2.5. Please use core_course_category::get($parentid)->get_children(). 971 */ 972 function get_child_categories() { 973 throw new coding_exception('Function get_child_categories() is removed. Use core_course_category::get_children() or see ' . 974 'phpdocs for more details.'); 975 } 976 977 /** 978 * @deprecated since 2.5 979 */ 980 function get_categories() { 981 throw new coding_exception('Function get_categories() is removed. Please use ' . 982 'appropriate functions from class core_course_category'); 983 } 984 985 /** 986 * @deprecated since 2.5 987 */ 988 function print_course_search() { 989 throw new coding_exception('Function print_course_search() is removed, please use course renderer'); 990 } 991 992 /** 993 * @deprecated since 2.5 994 */ 995 function print_my_moodle() { 996 throw new coding_exception('Function print_my_moodle() is removed, please use course renderer ' . 997 'function frontpage_my_courses()'); 998 } 999 1000 /** 1001 * @deprecated since 2.5 1002 */ 1003 function print_remote_course() { 1004 throw new coding_exception('Function print_remote_course() is removed, please use course renderer'); 1005 } 1006 1007 /** 1008 * @deprecated since 2.5 1009 */ 1010 function print_remote_host() { 1011 throw new coding_exception('Function print_remote_host() is removed, please use course renderer'); 1012 } 1013 1014 /** 1015 * @deprecated since 2.5 1016 */ 1017 function print_whole_category_list() { 1018 throw new coding_exception('Function print_whole_category_list() is removed, please use course renderer'); 1019 } 1020 1021 /** 1022 * @deprecated since 2.5 1023 */ 1024 function print_category_info() { 1025 throw new coding_exception('Function print_category_info() is removed, please use course renderer'); 1026 } 1027 1028 /** 1029 * @deprecated since 2.5 1030 */ 1031 function get_course_category_tree() { 1032 throw new coding_exception('Function get_course_category_tree() is removed, please use course ' . 1033 'renderer or core_course_category class, see function phpdocs for more info'); 1034 } 1035 1036 /** 1037 * @deprecated since 2.5 1038 */ 1039 function print_courses() { 1040 throw new coding_exception('Function print_courses() is removed, please use course renderer'); 1041 } 1042 1043 /** 1044 * @deprecated since 2.5 1045 */ 1046 function print_course() { 1047 throw new coding_exception('Function print_course() is removed, please use course renderer'); 1048 } 1049 1050 /** 1051 * @deprecated since 2.5 1052 */ 1053 function get_category_courses_array() { 1054 throw new coding_exception('Function get_category_courses_array() is removed, please use methods of ' . 1055 'core_course_category class'); 1056 } 1057 1058 /** 1059 * @deprecated since 2.5 1060 */ 1061 function get_category_courses_array_recursively() { 1062 throw new coding_exception('Function get_category_courses_array_recursively() is removed, please use ' . 1063 'methods of core_course_category class', DEBUG_DEVELOPER); 1064 } 1065 1066 /** 1067 * @deprecated since Moodle 2.5 MDL-27814 - please do not use this function any more. 1068 */ 1069 function blog_get_context_url() { 1070 throw new coding_exception('Function blog_get_context_url() is removed, getting params from context is not reliable for blogs.'); 1071 } 1072 1073 /** 1074 * @deprecated since 2.5 1075 */ 1076 function get_courses_wmanagers() { 1077 throw new coding_exception('Function get_courses_wmanagers() is removed, please use ' . 1078 'core_course_category::get_courses()'); 1079 } 1080 1081 /** 1082 * @deprecated since 2.5 1083 */ 1084 function convert_tree_to_html() { 1085 throw new coding_exception('Function convert_tree_to_html() is removed. Consider using class tabtree and core_renderer::render_tabtree()'); 1086 } 1087 1088 /** 1089 * @deprecated since 2.5 1090 */ 1091 function convert_tabrows_to_tree() { 1092 throw new coding_exception('Function convert_tabrows_to_tree() is removed. Consider using class tabtree'); 1093 } 1094 1095 /** 1096 * @deprecated since 2.5 - do not use, the textrotate.js will work it out automatically 1097 */ 1098 function can_use_rotated_text() { 1099 debugging('can_use_rotated_text() is removed. JS feature detection is used automatically.'); 1100 } 1101 1102 /** 1103 * @deprecated since Moodle 2.2 MDL-35009 - please do not use this function any more. 1104 */ 1105 function get_context_instance_by_id() { 1106 throw new coding_exception('get_context_instance_by_id() is now removed, please use context::instance_by_id($id) instead.'); 1107 } 1108 1109 /** 1110 * Returns system context or null if can not be created yet. 1111 * 1112 * @see context_system::instance() 1113 * @deprecated since 2.2 1114 * @param bool $cache use caching 1115 * @return context system context (null if context table not created yet) 1116 */ 1117 function get_system_context($cache = true) { 1118 debugging('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER); 1119 return context_system::instance(0, IGNORE_MISSING, $cache); 1120 } 1121 1122 /** 1123 * @deprecated since 2.2, use $context->get_parent_context_ids() instead 1124 */ 1125 function get_parent_contexts() { 1126 throw new coding_exception('get_parent_contexts() is removed, please use $context->get_parent_context_ids() instead.'); 1127 } 1128 1129 /** 1130 * @deprecated since Moodle 2.2 1131 */ 1132 function get_parent_contextid() { 1133 throw new coding_exception('get_parent_contextid() is removed, please use $context->get_parent_context() instead.'); 1134 } 1135 1136 /** 1137 * @deprecated since 2.2 1138 */ 1139 function get_child_contexts() { 1140 throw new coding_exception('get_child_contexts() is removed, please use $context->get_child_contexts() instead.'); 1141 } 1142 1143 /** 1144 * @deprecated since 2.2 1145 */ 1146 function create_contexts() { 1147 throw new coding_exception('create_contexts() is removed, please use context_helper::create_instances() instead.'); 1148 } 1149 1150 /** 1151 * @deprecated since 2.2 1152 */ 1153 function cleanup_contexts() { 1154 throw new coding_exception('cleanup_contexts() is removed, please use context_helper::cleanup_instances() instead.'); 1155 } 1156 1157 /** 1158 * @deprecated since 2.2 1159 */ 1160 function build_context_path() { 1161 throw new coding_exception('build_context_path() is removed, please use context_helper::build_all_paths() instead.'); 1162 } 1163 1164 /** 1165 * @deprecated since 2.2 1166 */ 1167 function rebuild_contexts() { 1168 throw new coding_exception('rebuild_contexts() is removed, please use $context->reset_paths(true) instead.'); 1169 } 1170 1171 /** 1172 * @deprecated since Moodle 2.2 1173 */ 1174 function preload_course_contexts() { 1175 throw new coding_exception('preload_course_contexts() is removed, please use context_helper::preload_course() instead.'); 1176 } 1177 1178 /** 1179 * @deprecated since Moodle 2.2 1180 */ 1181 function context_moved() { 1182 throw new coding_exception('context_moved() is removed, please use context::update_moved() instead.'); 1183 } 1184 1185 /** 1186 * @deprecated since 2.2 1187 */ 1188 function fetch_context_capabilities() { 1189 throw new coding_exception('fetch_context_capabilities() is removed, please use $context->get_capabilities() instead.'); 1190 } 1191 1192 /** 1193 * @deprecated since 2.2 1194 */ 1195 function context_instance_preload() { 1196 throw new coding_exception('context_instance_preload() is removed, please use context_helper::preload_from_record() instead.'); 1197 } 1198 1199 /** 1200 * @deprecated since 2.2 1201 */ 1202 function get_contextlevel_name() { 1203 throw new coding_exception('get_contextlevel_name() is removed, please use context_helper::get_level_name() instead.'); 1204 } 1205 1206 /** 1207 * @deprecated since 2.2 1208 */ 1209 function print_context_name() { 1210 throw new coding_exception('print_context_name() is removed, please use $context->get_context_name() instead.'); 1211 } 1212 1213 /** 1214 * @deprecated since 2.2, use $context->mark_dirty() instead 1215 */ 1216 function mark_context_dirty() { 1217 throw new coding_exception('mark_context_dirty() is removed, please use $context->mark_dirty() instead.'); 1218 } 1219 1220 /** 1221 * @deprecated since Moodle 2.2 1222 */ 1223 function delete_context() { 1224 throw new coding_exception('delete_context() is removed, please use context_helper::delete_instance() ' . 1225 'or $context->delete_content() instead.'); 1226 } 1227 1228 /** 1229 * @deprecated since 2.2 1230 */ 1231 function get_context_url() { 1232 throw new coding_exception('get_context_url() is removed, please use $context->get_url() instead.'); 1233 } 1234 1235 /** 1236 * @deprecated since 2.2 1237 */ 1238 function get_course_context() { 1239 throw new coding_exception('get_course_context() is removed, please use $context->get_course_context(true) instead.'); 1240 } 1241 1242 /** 1243 * @deprecated since 2.2 1244 */ 1245 function get_user_courses_bycap() { 1246 throw new coding_exception('get_user_courses_bycap() is removed, please use enrol_get_users_courses() instead.'); 1247 } 1248 1249 /** 1250 * @deprecated since Moodle 2.2 1251 */ 1252 function get_role_context_caps() { 1253 throw new coding_exception('get_role_context_caps() is removed, it is really slow. Don\'t use it.'); 1254 } 1255 1256 /** 1257 * @deprecated since 2.2 1258 */ 1259 function get_courseid_from_context() { 1260 throw new coding_exception('get_courseid_from_context() is removed, please use $context->get_course_context(false) instead.'); 1261 } 1262 1263 /** 1264 * @deprecated since 2.2 1265 */ 1266 function context_instance_preload_sql() { 1267 throw new coding_exception('context_instance_preload_sql() is removed, please use context_helper::get_preload_record_columns_sql() instead.'); 1268 } 1269 1270 /** 1271 * @deprecated since 2.2 1272 */ 1273 function get_related_contexts_string() { 1274 throw new coding_exception('get_related_contexts_string() is removed, please use $context->get_parent_context_ids(true) instead.'); 1275 } 1276 1277 /** 1278 * @deprecated since 2.6 1279 */ 1280 function get_plugin_list_with_file() { 1281 throw new coding_exception('get_plugin_list_with_file() is removed, please use core_component::get_plugin_list_with_file() instead.'); 1282 } 1283 1284 /** 1285 * @deprecated since 2.6 1286 */ 1287 function check_browser_operating_system() { 1288 throw new coding_exception('check_browser_operating_system is removed, please update your code to use core_useragent instead.'); 1289 } 1290 1291 /** 1292 * @deprecated since 2.6 1293 */ 1294 function check_browser_version() { 1295 throw new coding_exception('check_browser_version is removed, please update your code to use core_useragent instead.'); 1296 } 1297 1298 /** 1299 * @deprecated since 2.6 1300 */ 1301 function get_device_type() { 1302 throw new coding_exception('get_device_type is removed, please update your code to use core_useragent instead.'); 1303 } 1304 1305 /** 1306 * @deprecated since 2.6 1307 */ 1308 function get_device_type_list() { 1309 throw new coding_exception('get_device_type_list is removed, please update your code to use core_useragent instead.'); 1310 } 1311 1312 /** 1313 * @deprecated since 2.6 1314 */ 1315 function get_selected_theme_for_device_type() { 1316 throw new coding_exception('get_selected_theme_for_device_type is removed, please update your code to use core_useragent instead.'); 1317 } 1318 1319 /** 1320 * @deprecated since 2.6 1321 */ 1322 function get_device_cfg_var_name() { 1323 throw new coding_exception('get_device_cfg_var_name is removed, please update your code to use core_useragent instead.'); 1324 } 1325 1326 /** 1327 * @deprecated since 2.6 1328 */ 1329 function set_user_device_type() { 1330 throw new coding_exception('set_user_device_type is removed, please update your code to use core_useragent instead.'); 1331 } 1332 1333 /** 1334 * @deprecated since 2.6 1335 */ 1336 function get_user_device_type() { 1337 throw new coding_exception('get_user_device_type is removed, please update your code to use core_useragent instead.'); 1338 } 1339 1340 /** 1341 * @deprecated since 2.6 1342 */ 1343 function get_browser_version_classes() { 1344 throw new coding_exception('get_browser_version_classes is removed, please update your code to use core_useragent instead.'); 1345 } 1346 1347 /** 1348 * @deprecated since Moodle 2.6 1349 */ 1350 function generate_email_supportuser() { 1351 throw new coding_exception('generate_email_supportuser is removed, please use core_user::get_support_user'); 1352 } 1353 1354 /** 1355 * @deprecated since Moodle 2.6 1356 */ 1357 function badges_get_issued_badge_info() { 1358 throw new coding_exception('Function badges_get_issued_badge_info() is removed. Please use core_badges_assertion class and methods to generate badge assertion.'); 1359 } 1360 1361 /** 1362 * @deprecated since 2.6 1363 */ 1364 function can_use_html_editor() { 1365 throw new coding_exception('can_use_html_editor is removed, please update your code to assume it returns true.'); 1366 } 1367 1368 1369 /** 1370 * @deprecated since Moodle 2.7, use {@link user_count_login_failures()} instead. 1371 */ 1372 function count_login_failures() { 1373 throw new coding_exception('count_login_failures() can not be used any more, please use user_count_login_failures().'); 1374 } 1375 1376 /** 1377 * @deprecated since 2.7 MDL-33099/MDL-44088 - please do not use this function any more. 1378 */ 1379 function ajaxenabled() { 1380 throw new coding_exception('ajaxenabled() can not be used anymore. Update your code to work with JS at all times.'); 1381 } 1382 1383 /** 1384 * @deprecated Since Moodle 2.7 MDL-44070 1385 */ 1386 function coursemodule_visible_for_user() { 1387 throw new coding_exception('coursemodule_visible_for_user() can not be used any more, 1388 please use \core_availability\info_module::is_user_visible()'); 1389 } 1390 1391 /** 1392 * @deprecated since Moodle 2.8 MDL-36014, MDL-35618 this functionality is removed 1393 */ 1394 function enrol_cohort_get_cohorts() { 1395 throw new coding_exception('Function enrol_cohort_get_cohorts() is removed, use '. 1396 'cohort_get_available_cohorts() instead'); 1397 } 1398 1399 /** 1400 * @deprecated since Moodle 2.8 MDL-36014 please use cohort_can_view_cohort() 1401 */ 1402 function enrol_cohort_can_view_cohort() { 1403 throw new coding_exception('Function enrol_cohort_can_view_cohort() is removed, use cohort_can_view_cohort() instead'); 1404 } 1405 1406 /** 1407 * @deprecated since Moodle 2.8 MDL-36014 use cohort_get_available_cohorts() instead 1408 */ 1409 function cohort_get_visible_list() { 1410 throw new coding_exception('Function cohort_get_visible_list() is removed. Please use function cohort_get_available_cohorts() ". 1411 "that correctly checks capabilities.'); 1412 } 1413 1414 /** 1415 * @deprecated since Moodle 2.8 MDL-35618 this functionality is removed 1416 */ 1417 function enrol_cohort_enrol_all_users() { 1418 throw new coding_exception('enrol_cohort_enrol_all_users() is removed. This functionality is moved to enrol_manual.'); 1419 } 1420 1421 /** 1422 * @deprecated since Moodle 2.8 MDL-35618 this functionality is removed 1423 */ 1424 function enrol_cohort_search_cohorts() { 1425 throw new coding_exception('enrol_cohort_search_cohorts() is removed. This functionality is moved to enrol_manual.'); 1426 } 1427 1428 /* === Apis deprecated in since Moodle 2.9 === */ 1429 1430 /** 1431 * @deprecated since Moodle 2.9 MDL-49371 - please do not use this function any more. 1432 */ 1433 function message_current_user_is_involved() { 1434 throw new coding_exception('message_current_user_is_involved() can not be used any more.'); 1435 } 1436 1437 /** 1438 * @deprecated since Moodle 2.9 MDL-45898 - please do not use this function any more. 1439 */ 1440 function profile_display_badges() { 1441 throw new coding_exception('profile_display_badges() can not be used any more.'); 1442 } 1443 1444 /** 1445 * @deprecated since Moodle 2.9 MDL-45774 - Please do not use this function any more. 1446 */ 1447 function useredit_shared_definition_preferences() { 1448 throw new coding_exception('useredit_shared_definition_preferences() can not be used any more.'); 1449 } 1450 1451 1452 /** 1453 * @deprecated since Moodle 2.9 1454 */ 1455 function calendar_normalize_tz() { 1456 throw new coding_exception('calendar_normalize_tz() can not be used any more, please use core_date::normalise_timezone() instead.'); 1457 } 1458 1459 /** 1460 * @deprecated since Moodle 2.9 1461 */ 1462 function get_user_timezone_offset() { 1463 throw new coding_exception('get_user_timezone_offset() can not be used any more, please use standard PHP DateTimeZone class instead'); 1464 1465 } 1466 1467 /** 1468 * @deprecated since Moodle 2.9 1469 */ 1470 function get_timezone_offset() { 1471 throw new coding_exception('get_timezone_offset() can not be used any more, please use standard PHP DateTimeZone class instead'); 1472 } 1473 1474 /** 1475 * @deprecated since Moodle 2.9 1476 */ 1477 function get_list_of_timezones() { 1478 throw new coding_exception('get_list_of_timezones() can not be used any more, please use core_date::get_list_of_timezones() instead'); 1479 } 1480 1481 /** 1482 * @deprecated since Moodle 2.9 1483 */ 1484 function update_timezone_records() { 1485 throw new coding_exception('update_timezone_records() can not be used any more, please use standard PHP DateTime class instead'); 1486 } 1487 1488 /** 1489 * @deprecated since Moodle 2.9 1490 */ 1491 function calculate_user_dst_table() { 1492 throw new coding_exception('calculate_user_dst_table() can not be used any more, please use standard PHP DateTime class instead'); 1493 } 1494 1495 /** 1496 * @deprecated since Moodle 2.9 1497 */ 1498 function dst_changes_for_year() { 1499 throw new coding_exception('dst_changes_for_year() can not be used any more, please use standard DateTime class instead'); 1500 } 1501 1502 /** 1503 * @deprecated since Moodle 2.9 1504 */ 1505 function get_timezone_record() { 1506 throw new coding_exception('get_timezone_record() can not be used any more, please use standard PHP DateTime class instead'); 1507 } 1508 1509 /* === Apis deprecated since Moodle 3.0 === */ 1510 /** 1511 * @deprecated since Moodle 3.0 MDL-49360 - please do not use this function any more. 1512 */ 1513 function get_referer() { 1514 throw new coding_exception('get_referer() can not be used any more. Please use get_local_referer() instead.'); 1515 } 1516 1517 /** 1518 * @deprecated since Moodle 3.0 use \core_useragent::is_web_crawler instead. 1519 */ 1520 function is_web_crawler() { 1521 throw new coding_exception('is_web_crawler() can not be used any more. Please use core_useragent::is_web_crawler() instead.'); 1522 } 1523 1524 /** 1525 * @deprecated since Moodle 3.0 MDL-50287 - please do not use this function any more. 1526 */ 1527 function completion_cron() { 1528 throw new coding_exception('completion_cron() can not be used any more. Functionality has been moved to scheduled tasks.'); 1529 } 1530 1531 /** 1532 * @deprecated since 3.0 1533 */ 1534 function coursetag_get_tags() { 1535 throw new coding_exception('Function coursetag_get_tags() can not be used any more. ' . 1536 'Userid is no longer used for tagging courses.'); 1537 } 1538 1539 /** 1540 * @deprecated since 3.0 1541 */ 1542 function coursetag_get_all_tags() { 1543 throw new coding_exception('Function coursetag_get_all_tags() can not be used any more. Userid is no ' . 1544 'longer used for tagging courses.'); 1545 } 1546 1547 /** 1548 * @deprecated since 3.0 1549 */ 1550 function coursetag_get_jscript() { 1551 throw new coding_exception('Function coursetag_get_jscript() can not be used any more and is obsolete.'); 1552 } 1553 1554 /** 1555 * @deprecated since 3.0 1556 */ 1557 function coursetag_get_jscript_links() { 1558 throw new coding_exception('Function coursetag_get_jscript_links() can not be used any more and is obsolete.'); 1559 } 1560 1561 /** 1562 * @deprecated since 3.0 1563 */ 1564 function coursetag_get_records() { 1565 throw new coding_exception('Function coursetag_get_records() can not be used any more. ' . 1566 'Userid is no longer used for tagging courses.'); 1567 } 1568 1569 /** 1570 * @deprecated since 3.0 1571 */ 1572 function coursetag_store_keywords() { 1573 throw new coding_exception('Function coursetag_store_keywords() can not be used any more. ' . 1574 'Userid is no longer used for tagging courses.'); 1575 } 1576 1577 /** 1578 * @deprecated since 3.0 1579 */ 1580 function coursetag_delete_keyword() { 1581 throw new coding_exception('Function coursetag_delete_keyword() can not be used any more. ' . 1582 'Userid is no longer used for tagging courses.'); 1583 } 1584 1585 /** 1586 * @deprecated since 3.0 1587 */ 1588 function coursetag_get_tagged_courses() { 1589 throw new coding_exception('Function coursetag_get_tagged_courses() can not be used any more. ' . 1590 'Userid is no longer used for tagging courses.'); 1591 } 1592 1593 /** 1594 * @deprecated since 3.0 1595 */ 1596 function coursetag_delete_course_tags() { 1597 throw new coding_exception('Function coursetag_delete_course_tags() is deprecated. ' . 1598 'Use core_tag_tag::remove_all_item_tags().'); 1599 } 1600 1601 /** 1602 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->update() instead 1603 */ 1604 function tag_type_set() { 1605 throw new coding_exception('tag_type_set() can not be used anymore. Please use ' . 1606 'core_tag_tag::get($tagid)->update().'); 1607 } 1608 1609 /** 1610 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->update() instead 1611 */ 1612 function tag_description_set() { 1613 throw new coding_exception('tag_description_set() can not be used anymore. Please use ' . 1614 'core_tag_tag::get($tagid)->update().'); 1615 } 1616 1617 /** 1618 * @deprecated since 3.1. Use core_tag_tag::get_item_tags() instead 1619 */ 1620 function tag_get_tags() { 1621 throw new coding_exception('tag_get_tags() can not be used anymore. Please use ' . 1622 'core_tag_tag::get_item_tags().'); 1623 } 1624 1625 /** 1626 * @deprecated since 3.1 1627 */ 1628 function tag_get_tags_array() { 1629 throw new coding_exception('tag_get_tags_array() can not be used anymore. Please use ' . 1630 'core_tag_tag::get_item_tags_array().'); 1631 } 1632 1633 /** 1634 * @deprecated since 3.1. Use core_tag_tag::get_item_tags_array() or $OUTPUT->tag_list(core_tag_tag::get_item_tags()) 1635 */ 1636 function tag_get_tags_csv() { 1637 throw new coding_exception('tag_get_tags_csv() can not be used anymore. Please use ' . 1638 'core_tag_tag::get_item_tags_array() or $OUTPUT->tag_list(core_tag_tag::get_item_tags()).'); 1639 } 1640 1641 /** 1642 * @deprecated since 3.1. Use core_tag_tag::get_item_tags() instead 1643 */ 1644 function tag_get_tags_ids() { 1645 throw new coding_exception('tag_get_tags_ids() can not be used anymore. Please consider using ' . 1646 'core_tag_tag::get_item_tags() or similar methods.'); 1647 } 1648 1649 /** 1650 * @deprecated since 3.1. Use core_tag_tag::get_by_name() or core_tag_tag::get_by_name_bulk() 1651 */ 1652 function tag_get_id() { 1653 throw new coding_exception('tag_get_id() can not be used anymore. Please use ' . 1654 'core_tag_tag::get_by_name() or core_tag_tag::get_by_name_bulk()'); 1655 } 1656 1657 /** 1658 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->update() instead 1659 */ 1660 function tag_rename() { 1661 throw new coding_exception('tag_rename() can not be used anymore. Please use ' . 1662 'core_tag_tag::get($tagid)->update()'); 1663 } 1664 1665 /** 1666 * @deprecated since 3.1. Use core_tag_tag::remove_item_tag() instead 1667 */ 1668 function tag_delete_instance() { 1669 throw new coding_exception('tag_delete_instance() can not be used anymore. Please use ' . 1670 'core_tag_tag::remove_item_tag()'); 1671 } 1672 1673 /** 1674 * @deprecated since 3.1. Use core_tag_tag::get_by_name()->get_tagged_items() instead 1675 */ 1676 function tag_find_records() { 1677 throw new coding_exception('tag_find_records() can not be used anymore. Please use ' . 1678 'core_tag_tag::get_by_name()->get_tagged_items()'); 1679 } 1680 1681 /** 1682 * @deprecated since 3.1 1683 */ 1684 function tag_add() { 1685 throw new coding_exception('tag_add() can not be used anymore. You can use ' . 1686 'core_tag_tag::create_if_missing(), however it should not be necessary since tags are ' . 1687 'created automatically when assigned to items'); 1688 } 1689 1690 /** 1691 * @deprecated since 3.1. Use core_tag_tag::set_item_tags() or core_tag_tag::add_item_tag() instead 1692 */ 1693 function tag_assign() { 1694 throw new coding_exception('tag_assign() can not be used anymore. Please use ' . 1695 'core_tag_tag::set_item_tags() or core_tag_tag::add_item_tag() instead. Tag instance ' . 1696 'ordering should not be set manually'); 1697 } 1698 1699 /** 1700 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->count_tagged_items() instead 1701 */ 1702 function tag_record_count() { 1703 throw new coding_exception('tag_record_count() can not be used anymore. Please use ' . 1704 'core_tag_tag::get($tagid)->count_tagged_items().'); 1705 } 1706 1707 /** 1708 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->is_item_tagged_with() instead 1709 */ 1710 function tag_record_tagged_with() { 1711 throw new coding_exception('tag_record_tagged_with() can not be used anymore. Please use ' . 1712 'core_tag_tag::get($tagid)->is_item_tagged_with().'); 1713 } 1714 1715 /** 1716 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->flag() instead 1717 */ 1718 function tag_set_flag() { 1719 throw new coding_exception('tag_set_flag() can not be used anymore. Please use ' . 1720 'core_tag_tag::get($tagid)->flag()'); 1721 } 1722 1723 /** 1724 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->reset_flag() instead 1725 */ 1726 function tag_unset_flag() { 1727 throw new coding_exception('tag_unset_flag() can not be used anymore. Please use ' . 1728 'core_tag_tag::get($tagid)->reset_flag()'); 1729 } 1730 1731 /** 1732 * @deprecated since 3.1 1733 */ 1734 function tag_print_cloud() { 1735 throw new coding_exception('tag_print_cloud() can not be used anymore. Please use ' . 1736 'core_tag_collection::get_tag_cloud(), templateable core_tag\output\tagcloud and ' . 1737 'template core_tag/tagcloud.'); 1738 } 1739 1740 /** 1741 * @deprecated since 3.0 1742 */ 1743 function tag_autocomplete() { 1744 throw new coding_exception('tag_autocomplete() can not be used anymore. New form ' . 1745 'element "tags" does proper autocomplete.'); 1746 } 1747 1748 /** 1749 * @deprecated since 3.1 1750 */ 1751 function tag_print_description_box() { 1752 throw new coding_exception('tag_print_description_box() can not be used anymore. ' . 1753 'See core_tag_renderer for similar code'); 1754 } 1755 1756 /** 1757 * @deprecated since 3.1 1758 */ 1759 function tag_print_management_box() { 1760 throw new coding_exception('tag_print_management_box() can not be used anymore. ' . 1761 'See core_tag_renderer for similar code'); 1762 } 1763 1764 /** 1765 * @deprecated since 3.1 1766 */ 1767 function tag_print_search_box() { 1768 throw new coding_exception('tag_print_search_box() can not be used anymore. ' . 1769 'See core_tag_renderer for similar code'); 1770 } 1771 1772 /** 1773 * @deprecated since 3.1 1774 */ 1775 function tag_print_search_results() { 1776 throw new coding_exception('tag_print_search_results() can not be used anymore. ' . 1777 'In /tag/search.php the search results are printed using the core_tag/tagcloud template.'); 1778 } 1779 1780 /** 1781 * @deprecated since 3.1 1782 */ 1783 function tag_print_tagged_users_table() { 1784 throw new coding_exception('tag_print_tagged_users_table() can not be used anymore. ' . 1785 'See core_user_renderer for similar code'); 1786 } 1787 1788 /** 1789 * @deprecated since 3.1 1790 */ 1791 function tag_print_user_box() { 1792 throw new coding_exception('tag_print_user_box() can not be used anymore. ' . 1793 'See core_user_renderer for similar code'); 1794 } 1795 1796 /** 1797 * @deprecated since 3.1 1798 */ 1799 function tag_print_user_list() { 1800 throw new coding_exception('tag_print_user_list() can not be used anymore. ' . 1801 'See core_user_renderer for similar code'); 1802 } 1803 1804 /** 1805 * @deprecated since 3.1 1806 */ 1807 function tag_display_name() { 1808 throw new coding_exception('tag_display_name() can not be used anymore. Please use ' . 1809 'core_tag_tag::make_display_name().'); 1810 1811 } 1812 1813 /** 1814 * @deprecated since 3.1 1815 */ 1816 function tag_normalize() { 1817 throw new coding_exception('tag_normalize() can not be used anymore. Please use ' . 1818 'core_tag_tag::normalize().'); 1819 } 1820 1821 /** 1822 * @deprecated since 3.1 1823 */ 1824 function tag_get_related_tags_csv() { 1825 throw new coding_exception('tag_get_related_tags_csv() can not be used anymore. Please ' . 1826 'consider looping through array or using $OUTPUT->tag_list(core_tag_tag::get_item_tags()).'); 1827 } 1828 1829 /** 1830 * @deprecated since 3.1 1831 */ 1832 function tag_set() { 1833 throw new coding_exception('tag_set() can not be used anymore. Please use ' . 1834 'core_tag_tag::set_item_tags().'); 1835 } 1836 1837 /** 1838 * @deprecated since 3.1 1839 */ 1840 function tag_set_add() { 1841 throw new coding_exception('tag_set_add() can not be used anymore. Please use ' . 1842 'core_tag_tag::add_item_tag().'); 1843 } 1844 1845 /** 1846 * @deprecated since 3.1 1847 */ 1848 function tag_set_delete() { 1849 throw new coding_exception('tag_set_delete() can not be used anymore. Please use ' . 1850 'core_tag_tag::remove_item_tag().'); 1851 } 1852 1853 /** 1854 * @deprecated since 3.1 1855 */ 1856 function tag_get() { 1857 throw new coding_exception('tag_get() can not be used anymore. Please use ' . 1858 'core_tag_tag::get() or core_tag_tag::get_by_name().'); 1859 } 1860 1861 /** 1862 * @deprecated since 3.1 1863 */ 1864 function tag_get_related_tags() { 1865 throw new coding_exception('tag_get_related_tags() can not be used anymore. Please use ' . 1866 'core_tag_tag::get_correlated_tags(), core_tag_tag::get_related_tags() or ' . 1867 'core_tag_tag::get_manual_related_tags().'); 1868 } 1869 1870 /** 1871 * @deprecated since 3.1 1872 */ 1873 function tag_delete() { 1874 throw new coding_exception('tag_delete() can not be used anymore. Please use ' . 1875 'core_tag_tag::delete_tags().'); 1876 } 1877 1878 /** 1879 * @deprecated since 3.1 1880 */ 1881 function tag_delete_instances() { 1882 throw new coding_exception('tag_delete_instances() can not be used anymore. Please use ' . 1883 'core_tag_tag::delete_instances().'); 1884 } 1885 1886 /** 1887 * @deprecated since 3.1 1888 */ 1889 function tag_cleanup() { 1890 throw new coding_exception('tag_cleanup() can not be used anymore. Please use ' . 1891 '\core\task\tag_cron_task::cleanup().'); 1892 } 1893 1894 /** 1895 * @deprecated since 3.1 1896 */ 1897 function tag_bulk_delete_instances() { 1898 throw new coding_exception('tag_bulk_delete_instances() can not be used anymore. Please use ' . 1899 '\core\task\tag_cron_task::bulk_delete_instances().'); 1900 1901 } 1902 1903 /** 1904 * @deprecated since 3.1 1905 */ 1906 function tag_compute_correlations() { 1907 throw new coding_exception('tag_compute_correlations() can not be used anymore. Please use ' . 1908 'use \core\task\tag_cron_task::compute_correlations().'); 1909 } 1910 1911 /** 1912 * @deprecated since 3.1 1913 */ 1914 function tag_process_computed_correlation() { 1915 throw new coding_exception('tag_process_computed_correlation() can not be used anymore. Please use ' . 1916 'use \core\task\tag_cron_task::process_computed_correlation().'); 1917 } 1918 1919 /** 1920 * @deprecated since 3.1 1921 */ 1922 function tag_cron() { 1923 throw new coding_exception('tag_cron() can not be used anymore. Please use ' . 1924 'use \core\task\tag_cron_task::execute().'); 1925 } 1926 1927 /** 1928 * @deprecated since 3.1 1929 */ 1930 function tag_find_tags() { 1931 throw new coding_exception('tag_find_tags() can not be used anymore.'); 1932 } 1933 1934 /** 1935 * @deprecated since 3.1 1936 */ 1937 function tag_get_name() { 1938 throw new coding_exception('tag_get_name() can not be used anymore.'); 1939 } 1940 1941 /** 1942 * @deprecated since 3.1 1943 */ 1944 function tag_get_correlated() { 1945 throw new coding_exception('tag_get_correlated() can not be used anymore. Please use ' . 1946 'use core_tag_tag::get_correlated_tags().'); 1947 1948 } 1949 1950 /** 1951 * @deprecated since 3.1 1952 */ 1953 function tag_cloud_sort() { 1954 throw new coding_exception('tag_cloud_sort() can not be used anymore. Similar method can ' . 1955 'be found in core_tag_collection::cloud_sort().'); 1956 } 1957 1958 /** 1959 * @deprecated since Moodle 3.1 1960 */ 1961 function events_load_def() { 1962 throw new coding_exception('events_load_def() has been deprecated along with all Events 1 API in favour of Events 2 API.'); 1963 1964 } 1965 1966 /** 1967 * @deprecated since Moodle 3.1 1968 */ 1969 function events_queue_handler() { 1970 throw new coding_exception('events_queue_handler() has been deprecated along with all Events 1 API in favour of Events 2 API.'); 1971 } 1972 1973 /** 1974 * @deprecated since Moodle 3.1 1975 */ 1976 function events_dispatch() { 1977 throw new coding_exception('events_dispatch() has been deprecated along with all Events 1 API in favour of Events 2 API.'); 1978 } 1979 1980 /** 1981 * @deprecated since Moodle 3.1 1982 */ 1983 function events_process_queued_handler() { 1984 throw new coding_exception( 1985 'events_process_queued_handler() has been deprecated along with all Events 1 API in favour of Events 2 API.' 1986 ); 1987 } 1988 1989 /** 1990 * @deprecated since Moodle 3.1 1991 */ 1992 function events_update_definition() { 1993 throw new coding_exception( 1994 'events_update_definition has been deprecated along with all Events 1 API in favour of Events 2 API.' 1995 ); 1996 } 1997 1998 /** 1999 * @deprecated since Moodle 3.1 2000 */ 2001 function events_cron() { 2002 throw new coding_exception('events_cron() has been deprecated along with all Events 1 API in favour of Events 2 API.'); 2003 } 2004 2005 /** 2006 * @deprecated since Moodle 3.1 2007 */ 2008 function events_trigger_legacy() { 2009 throw new coding_exception('events_trigger_legacy() has been deprecated along with all Events 1 API in favour of Events 2 API.'); 2010 } 2011 2012 /** 2013 * @deprecated since Moodle 3.1 2014 */ 2015 function events_is_registered() { 2016 throw new coding_exception('events_is_registered() has been deprecated along with all Events 1 API in favour of Events 2 API.'); 2017 } 2018 2019 /** 2020 * @deprecated since Moodle 3.1 2021 */ 2022 function events_pending_count() { 2023 throw new coding_exception('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2 API.'); 2024 } 2025 2026 /** 2027 * @deprecated since Moodle 3.0 - this is a part of clamav plugin now. 2028 */ 2029 function clam_message_admins() { 2030 throw new coding_exception('clam_message_admins() can not be used anymore. Please use ' . 2031 'message_admins() method of \antivirus_clamav\scanner class.'); 2032 } 2033 2034 /** 2035 * @deprecated since Moodle 3.0 - this is a part of clamav plugin now. 2036 */ 2037 function get_clam_error_code() { 2038 throw new coding_exception('get_clam_error_code() can not be used anymore. Please use ' . 2039 'get_clam_error_code() method of \antivirus_clamav\scanner class.'); 2040 } 2041 2042 /** 2043 * @deprecated since 3.1 2044 */ 2045 function course_get_cm_rename_action() { 2046 throw new coding_exception('course_get_cm_rename_action() can not be used anymore. Please use ' . 2047 'inplace_editable https://docs.moodle.org/dev/Inplace_editable.'); 2048 2049 } 2050 2051 /** 2052 * @deprecated since Moodle 3.1 2053 */ 2054 function course_scale_used() { 2055 throw new coding_exception('course_scale_used() can not be used anymore. Plugins can ' . 2056 'implement <modname>_scale_used_anywhere, all implementations of <modname>_scale_used are now ignored'); 2057 } 2058 2059 /** 2060 * @deprecated since Moodle 3.1 2061 */ 2062 function site_scale_used() { 2063 throw new coding_exception('site_scale_used() can not be used anymore. Plugins can implement ' . 2064 '<modname>_scale_used_anywhere, all implementations of <modname>_scale_used are now ignored'); 2065 } 2066 2067 /** 2068 * @deprecated since Moodle 3.1. Use external_api::external_function_info(). 2069 */ 2070 function external_function_info() { 2071 throw new coding_exception('external_function_info() can not be used any'. 2072 'more. Please use external_api::external_function_info() instead.'); 2073 } 2074 2075 /** 2076 * @deprecated since Moodle 3.2 2077 * @see csv_import_reader::load_csv_content() 2078 */ 2079 function get_records_csv() { 2080 throw new coding_exception('get_records_csv() can not be used anymore. Please use ' . 2081 'lib/csvlib.class.php csv_import_reader() instead.'); 2082 } 2083 2084 /** 2085 * @deprecated since Moodle 3.2 2086 * @see download_as_dataformat (lib/dataformatlib.php) 2087 */ 2088 function put_records_csv() { 2089 throw new coding_exception('put_records_csv() can not be used anymore. Please use ' . 2090 'lib/dataformatlib.php download_as_dataformat() instead.'); 2091 } 2092 2093 /** 2094 * @deprecated since Moodle 3.2 2095 */ 2096 function css_is_colour() { 2097 throw new coding_exception('css_is_colour() can not be used anymore.'); 2098 } 2099 2100 /** 2101 * @deprecated since Moodle 3.2 2102 */ 2103 function css_is_width() { 2104 throw new coding_exception('css_is_width() can not be used anymore.'); 2105 } 2106 2107 /** 2108 * @deprecated since Moodle 3.2 2109 */ 2110 function css_sort_by_count() { 2111 throw new coding_exception('css_sort_by_count() can not be used anymore.'); 2112 } 2113 2114 /** 2115 * @deprecated since Moodle 3.2 2116 */ 2117 function message_get_course_contexts() { 2118 throw new coding_exception('message_get_course_contexts() can not be used anymore.'); 2119 } 2120 2121 /** 2122 * @deprecated since Moodle 3.2 2123 */ 2124 function message_remove_url_params() { 2125 throw new coding_exception('message_remove_url_params() can not be used anymore.'); 2126 } 2127 2128 /** 2129 * @deprecated since Moodle 3.2 2130 */ 2131 function message_count_messages() { 2132 throw new coding_exception('message_count_messages() can not be used anymore.'); 2133 } 2134 2135 /** 2136 * @deprecated since Moodle 3.2 2137 */ 2138 function message_count_blocked_users() { 2139 throw new coding_exception('message_count_blocked_users() can not be used anymore. Please use ' . 2140 '\core_message\api::count_blocked_users() instead.'); 2141 } 2142 2143 /** 2144 * @deprecated since Moodle 3.2 2145 */ 2146 function message_contact_link() { 2147 throw new coding_exception('message_contact_link() can not be used anymore.'); 2148 } 2149 2150 /** 2151 * @deprecated since Moodle 3.2 2152 */ 2153 function message_get_recent_notifications() { 2154 throw new coding_exception('message_get_recent_notifications() can not be used anymore.'); 2155 } 2156 2157 /** 2158 * @deprecated since Moodle 3.2 2159 */ 2160 function message_history_link() { 2161 throw new coding_exception('message_history_link() can not be used anymore.'); 2162 } 2163 2164 /** 2165 * @deprecated since Moodle 3.2 2166 */ 2167 function message_search() { 2168 throw new coding_exception('message_search() can not be used anymore.'); 2169 } 2170 2171 /** 2172 * @deprecated since Moodle 3.2 2173 */ 2174 function message_shorten_message() { 2175 throw new coding_exception('message_shorten_message() can not be used anymore.'); 2176 } 2177 2178 /** 2179 * @deprecated since Moodle 3.2 2180 */ 2181 function message_get_fragment() { 2182 throw new coding_exception('message_get_fragment() can not be used anymore.'); 2183 } 2184 2185 /** 2186 * @deprecated since Moodle 3.2 2187 */ 2188 function message_get_history() { 2189 throw new coding_exception('message_get_history() can not be used anymore.'); 2190 } 2191 2192 /** 2193 * @deprecated since Moodle 3.2 2194 */ 2195 function message_get_contact_add_remove_link() { 2196 throw new coding_exception('message_get_contact_add_remove_link() can not be used anymore.'); 2197 } 2198 2199 /** 2200 * @deprecated since Moodle 3.2 2201 */ 2202 function message_get_contact_block_link() { 2203 throw new coding_exception('message_get_contact_block_link() can not be used anymore.'); 2204 } 2205 2206 /** 2207 * @deprecated since Moodle 3.2 2208 */ 2209 function message_mark_messages_read() { 2210 throw new coding_exception('message_mark_messages_read() can not be used anymore. Please use ' . 2211 '\core_message\api::mark_all_messages_as_read() instead.'); 2212 } 2213 2214 /** 2215 * @deprecated since Moodle 3.2 2216 */ 2217 function message_can_post_message() { 2218 throw new coding_exception('message_can_post_message() can not be used anymore. Please use ' . 2219 '\core_message\api::can_send_message() instead.'); 2220 } 2221 2222 /** 2223 * @deprecated since Moodle 3.2 2224 */ 2225 function message_is_user_non_contact_blocked() { 2226 throw new coding_exception('message_is_user_non_contact_blocked() can not be used anymore. Please use ' . 2227 '\core_message\api::is_user_non_contact_blocked() instead.'); 2228 } 2229 2230 /** 2231 * @deprecated since Moodle 3.2 2232 */ 2233 function message_is_user_blocked() { 2234 throw new coding_exception('message_is_user_blocked() can not be used anymore. Please use ' . 2235 '\core_message\api::is_user_blocked() instead.'); 2236 } 2237 2238 /** 2239 * @deprecated since Moodle 3.2 2240 */ 2241 function print_log() { 2242 throw new coding_exception('print_log() can not be used anymore. Please use the ' . 2243 'report_log framework instead.'); 2244 } 2245 2246 /** 2247 * @deprecated since Moodle 3.2 2248 */ 2249 function print_mnet_log() { 2250 throw new coding_exception('print_mnet_log() can not be used anymore. Please use the ' . 2251 'report_log framework instead.'); 2252 } 2253 2254 /** 2255 * @deprecated since Moodle 3.2 2256 */ 2257 function print_log_csv() { 2258 throw new coding_exception('print_log_csv() can not be used anymore. Please use the ' . 2259 'report_log framework instead.'); 2260 } 2261 2262 /** 2263 * @deprecated since Moodle 3.2 2264 */ 2265 function print_log_xls() { 2266 throw new coding_exception('print_log_xls() can not be used anymore. Please use the ' . 2267 'report_log framework instead.'); 2268 } 2269 2270 /** 2271 * @deprecated since Moodle 3.2 2272 */ 2273 function print_log_ods() { 2274 throw new coding_exception('print_log_ods() can not be used anymore. Please use the ' . 2275 'report_log framework instead.'); 2276 } 2277 2278 /** 2279 * @deprecated since Moodle 3.2 2280 */ 2281 function build_logs_array() { 2282 throw new coding_exception('build_logs_array() can not be used anymore. Please use the ' . 2283 'report_log framework instead.'); 2284 } 2285 2286 /** 2287 * @deprecated since Moodle 3.2 2288 */ 2289 function get_logs_usercourse() { 2290 throw new coding_exception('get_logs_usercourse() can not be used anymore. Please use the ' . 2291 'report_log framework instead.'); 2292 } 2293 2294 /** 2295 * @deprecated since Moodle 3.2 2296 */ 2297 function get_logs_userday() { 2298 throw new coding_exception('get_logs_userday() can not be used anymore. Please use the ' . 2299 'report_log framework instead.'); 2300 } 2301 2302 /** 2303 * @deprecated since Moodle 3.2 2304 */ 2305 function get_logs() { 2306 throw new coding_exception('get_logs() can not be used anymore. Please use the ' . 2307 'report_log framework instead.'); 2308 } 2309 2310 /** 2311 * @deprecated since Moodle 3.2 2312 */ 2313 function prevent_form_autofill_password() { 2314 throw new coding_exception('prevent_form_autofill_password() can not be used anymore.'); 2315 } 2316 2317 /** 2318 * @deprecated since Moodle 3.3 MDL-57370 2319 */ 2320 function message_get_recent_conversations($userorid, $limitfrom = 0, $limitto = 100) { 2321 throw new coding_exception('message_get_recent_conversations() can not be used any more. ' . 2322 'Please use \core_message\api::get_conversations() instead.', DEBUG_DEVELOPER); 2323 } 2324 2325 /** 2326 * @deprecated since Moodle 3.2 2327 */ 2328 function calendar_preferences_button() { 2329 throw new coding_exception('calendar_preferences_button() can not be used anymore. The calendar ' . 2330 'preferences are now linked to the user preferences page.'); 2331 } 2332 2333 /** 2334 * @deprecated since 3.3 2335 */ 2336 function calendar_wday_name() { 2337 throw new coding_exception('Function calendar_wday_name() is removed and no longer used in core.'); 2338 } 2339 2340 /** 2341 * @deprecated since 3.3 2342 */ 2343 function calendar_get_block_upcoming() { 2344 throw new coding_exception('Function calendar_get_block_upcoming() is removed,' . 2345 'Please see block_calendar_upcoming::get_content() for the correct API usage.'); 2346 } 2347 2348 /** 2349 * @deprecated since 3.3 2350 */ 2351 function calendar_print_month_selector() { 2352 throw new coding_exception('Function calendar_print_month_selector() is removed and can no longer used in core.'); 2353 } 2354 2355 /** 2356 * @deprecated since 3.3 2357 */ 2358 function calendar_cron() { 2359 throw new coding_exception('Function calendar_cron() is removed. Please use the core\task\calendar_cron_task instead.'); 2360 } 2361 2362 /** 2363 * @deprecated since Moodle 3.4 and removed immediately. MDL-49398. 2364 */ 2365 function load_course_context() { 2366 throw new coding_exception('load_course_context() is removed. Do not use private functions or data structures.'); 2367 } 2368 2369 /** 2370 * @deprecated since Moodle 3.4 and removed immediately. MDL-49398. 2371 */ 2372 function load_role_access_by_context() { 2373 throw new coding_exception('load_role_access_by_context() is removed. Do not use private functions or data structures.'); 2374 } 2375 2376 /** 2377 * @deprecated since Moodle 3.4 and removed immediately. MDL-49398. 2378 */ 2379 function dedupe_user_access() { 2380 throw new coding_exception('dedupe_user_access() is removed. Do not use private functions or data structures.'); 2381 } 2382 2383 /** 2384 * @deprecated since Moodle 3.4. MDL-49398. 2385 */ 2386 function get_user_access_sitewide() { 2387 throw new coding_exception('get_user_access_sitewide() is removed. Do not use private functions or data structures.'); 2388 } 2389 2390 /** 2391 * @deprecated since Moodle 3.4. MDL-59333 2392 */ 2393 function calendar_get_mini() { 2394 throw new coding_exception('calendar_get_mini() has been removed. Please update your code to use calendar_get_view.'); 2395 } 2396 2397 /** 2398 * @deprecated since Moodle 3.4. MDL-59333 2399 */ 2400 function calendar_get_upcoming() { 2401 throw new coding_exception('calendar_get_upcoming() has been removed. ' . 2402 'Please see block_calendar_upcoming::get_content() for the correct API usage.'); 2403 } 2404 2405 /** 2406 * @deprecated since Moodle 3.4. MDL-50666 2407 */ 2408 function allow_override() { 2409 throw new coding_exception('allow_override() has been removed. Please update your code to use core_role_set_override_allowed.'); 2410 } 2411 2412 /** 2413 * @deprecated since Moodle 3.4. MDL-50666 2414 */ 2415 function allow_assign() { 2416 throw new coding_exception('allow_assign() has been removed. Please update your code to use core_role_set_assign_allowed.'); 2417 } 2418 2419 /** 2420 * @deprecated since Moodle 3.4. MDL-50666 2421 */ 2422 function allow_switch() { 2423 throw new coding_exception('allow_switch() has been removed. Please update your code to use core_role_set_switch_allowed.'); 2424 } 2425 2426 /** 2427 * @deprecated since Moodle 3.5. MDL-61132 2428 */ 2429 function question_add_tops() { 2430 throw new coding_exception( 2431 'question_add_tops() has been removed. You may want to pass $top = true to get_categories_for_contexts().' 2432 ); 2433 } 2434 2435 /** 2436 * @deprecated since Moodle 3.5. MDL-61132 2437 */ 2438 function question_is_only_toplevel_category_in_context() { 2439 throw new coding_exception('question_is_only_toplevel_category_in_context() has been removed. ' 2440 . 'Please update your code to use question_is_only_child_of_top_category_in_context() instead.'); 2441 } 2442 2443 /** 2444 * @deprecated since Moodle 3.5 2445 */ 2446 function message_move_userfrom_unread2read() { 2447 throw new coding_exception('message_move_userfrom_unread2read() has been removed.'); 2448 } 2449 2450 /** 2451 * @deprecated since Moodle 3.5 2452 */ 2453 function message_get_blocked_users() { 2454 throw new coding_exception( 2455 'message_get_blocked_users() has been removed, please use \core_message\api::get_blocked_users() instead.' 2456 ); 2457 } 2458 2459 /** 2460 * @deprecated since Moodle 3.5 2461 */ 2462 function message_get_contacts() { 2463 throw new coding_exception('message_get_contacts() has been removed.'); 2464 } 2465 2466 /** 2467 * @deprecated since Moodle 3.5 2468 */ 2469 function message_mark_message_read() { 2470 throw new coding_exception('message_mark_message_read() has been removed, please use \core_message\api::mark_message_as_read() 2471 or \core_message\api::mark_notification_as_read().'); 2472 } 2473 2474 /** 2475 * @deprecated since Moodle 3.5 2476 */ 2477 function message_can_delete_message() { 2478 throw new coding_exception( 2479 'message_can_delete_message() has been removed, please use \core_message\api::can_delete_message() instead.' 2480 ); 2481 } 2482 2483 /** 2484 * @deprecated since Moodle 3.5 2485 */ 2486 function message_delete_message() { 2487 throw new coding_exception( 2488 'message_delete_message() has been removed, please use \core_message\api::delete_message() instead.' 2489 ); 2490 } 2491 2492 /** 2493 * @deprecated since 3.6 2494 */ 2495 function calendar_get_all_allowed_types() { 2496 throw new coding_exception( 2497 'calendar_get_all_allowed_types() has been removed. Please use calendar_get_allowed_types() instead.' 2498 ); 2499 2500 } 2501 2502 /** 2503 * @deprecated since Moodle 3.6. 2504 */ 2505 function groups_get_all_groups_for_courses() { 2506 throw new coding_exception( 2507 'groups_get_all_groups_for_courses() has been removed and can not be used anymore.' 2508 ); 2509 } 2510 2511 /** 2512 * @deprecated since Moodle 3.6. Please use the Events 2 API. 2513 */ 2514 function events_get_cached() { 2515 throw new coding_exception( 2516 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.' 2517 ); 2518 } 2519 2520 /** 2521 * @deprecated since Moodle 3.6. Please use the Events 2 API. 2522 */ 2523 function events_uninstall() { 2524 throw new coding_exception( 2525 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.' 2526 ); 2527 } 2528 2529 /** 2530 * @deprecated since Moodle 3.6. Please use the Events 2 API. 2531 */ 2532 function events_cleanup() { 2533 throw new coding_exception( 2534 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.' 2535 ); 2536 } 2537 2538 /** 2539 * @deprecated since Moodle 3.6. Please use the Events 2 API. 2540 */ 2541 function events_dequeue() { 2542 throw new coding_exception( 2543 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.' 2544 ); 2545 } 2546 2547 /** 2548 * @deprecated since Moodle 3.6. Please use the Events 2 API. 2549 */ 2550 function events_get_handlers() { 2551 throw new coding_exception( 2552 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.' 2553 ); 2554 } 2555 2556 /** 2557 * @deprecated since Moodle 3.6. Please use the get_roles_used_in_context(). 2558 */ 2559 function get_roles_on_exact_context() { 2560 throw new coding_exception( 2561 'get_roles_on_exact_context() has been removed, please use get_roles_used_in_context() instead.' 2562 ); 2563 } 2564 2565 /** 2566 * @deprecated since Moodle 3.6. Please use the get_roles_used_in_context(). 2567 */ 2568 function get_roles_with_assignment_on_context() { 2569 throw new coding_exception( 2570 'get_roles_with_assignment_on_context() has been removed, please use get_roles_used_in_context() instead.' 2571 ); 2572 } 2573 2574 /** 2575 * @deprecated since Moodle 3.6 2576 */ 2577 function message_add_contact() { 2578 throw new coding_exception( 2579 'message_add_contact() has been removed. Please use \core_message\api::create_contact_request() instead. ' . 2580 'If you wish to block or unblock a user please use \core_message\api::is_blocked() and ' . 2581 '\core_message\api::block_user() or \core_message\api::unblock_user() respectively.' 2582 ); 2583 } 2584 2585 /** 2586 * @deprecated since Moodle 3.6 2587 */ 2588 function message_remove_contact() { 2589 throw new coding_exception( 2590 'message_remove_contact() has been removed. Please use \core_message\api::remove_contact() instead.' 2591 ); 2592 } 2593 2594 /** 2595 * @deprecated since Moodle 3.6 2596 */ 2597 function message_unblock_contact() { 2598 throw new coding_exception( 2599 'message_unblock_contact() has been removed. Please use \core_message\api::unblock_user() instead.' 2600 ); 2601 } 2602 2603 /** 2604 * @deprecated since Moodle 3.6 2605 */ 2606 function message_block_contact() { 2607 throw new coding_exception( 2608 'message_block_contact() has been removed. Please use \core_message\api::is_blocked() and ' . 2609 '\core_message\api::block_user() instead.' 2610 ); 2611 } 2612 2613 /** 2614 * @deprecated since Moodle 3.6 2615 */ 2616 function message_get_contact() { 2617 throw new coding_exception( 2618 'message_get_contact() has been removed. Please use \core_message\api::get_contact() instead.' 2619 ); 2620 } 2621 2622 /** 2623 * @deprecated since Moodle 3.7 2624 */ 2625 function get_courses_page() { 2626 throw new coding_exception( 2627 'Function get_courses_page() has been removed. Please use core_course_category::get_courses() ' . 2628 'or core_course_category::search_courses()' 2629 ); 2630 } 2631 2632 /** 2633 * @deprecated since Moodle 3.8 2634 */ 2635 function report_insights_context_insights(\context $context) { 2636 throw new coding_exception( 2637 'Function report_insights_context_insights() ' . 2638 'has been removed. Please use \core_analytics\manager::cached_models_with_insights instead' 2639 ); 2640 } 2641 2642 /** 2643 * @deprecated since 3.9 2644 */ 2645 function get_module_metadata() { 2646 throw new coding_exception( 2647 'get_module_metadata() has been removed. Please use \core_course\local\service\content_item_service instead.'); 2648 } 2649 2650 /** 2651 * @deprecated since Moodle 3.9 MDL-63580. Please use the \core\task\manager::run_from_cli($task). 2652 */ 2653 function cron_run_single_task() { 2654 throw new coding_exception( 2655 'cron_run_single_task() has been removed. Please use \\core\task\manager::run_from_cli() instead.' 2656 ); 2657 } 2658 2659 /** 2660 * @deprecated since Moodle 3.9 MDL-52846. Please use new task API. 2661 */ 2662 function cron_execute_plugin_type() { 2663 throw new coding_exception( 2664 'cron_execute_plugin_type() has been removed. Please, use the Task API instead: ' . 2665 'https://moodledev.io/docs/apis/subsystems/task.' 2666 ); 2667 } 2668 2669 /** 2670 * @deprecated since Moodle 3.9 MDL-52846. Please use new task API. 2671 */ 2672 function cron_bc_hack_plugin_functions() { 2673 throw new coding_exception( 2674 'cron_bc_hack_plugin_functions() has been removed. Please, use the Task API instead: ' . 2675 'https://moodledev.io/docs/apis/subsystems/task.' 2676 ); 2677 } 2678 2679 /** 2680 * @deprecated since Moodle 3.9 MDL-68612 - See \core_user\table\participants_search for an improved way to fetch participants. 2681 */ 2682 function user_get_participants_sql() { 2683 $deprecatedtext = __FUNCTION__ . '() has been removed. ' . 2684 'Please use \core\table\participants_search::class with table filtersets instead.'; 2685 throw new coding_exception($deprecatedtext); 2686 } 2687 2688 /** 2689 * @deprecated since Moodle 3.9 MDL-68612 - See \core_user\table\participants_search for an improved way to fetch participants. 2690 */ 2691 function user_get_total_participants() { 2692 $deprecatedtext = __FUNCTION__ . '() has been removed. ' . 2693 'Please use \core\table\participants_search::class with table filtersets instead.'; 2694 throw new coding_exception($deprecatedtext); 2695 } 2696 2697 /** 2698 * @deprecated since Moodle 3.9 MDL-68612 - See \core_user\table\participants_search for an improved way to fetch participants. 2699 */ 2700 function user_get_participants() { 2701 $deprecatedtext = __FUNCTION__ . '() has been removed. ' . 2702 'Please use \core\table\participants_search::class with table filtersets instead.'; 2703 throw new coding_exception($deprecatedtext); 2704 } 2705 2706 /** 2707 * @deprecated Since Moodle 3.9. MDL-65835 2708 */ 2709 function plagiarism_save_form_elements() { 2710 throw new coding_exception( 2711 'Function plagiarism_save_form_elements() has been removed. ' . 2712 'Please use {plugin name}_coursemodule_edit_post_actions() instead.' 2713 ); 2714 } 2715 2716 /** 2717 * @deprecated Since Moodle 3.9. MDL-65835 2718 */ 2719 function plagiarism_get_form_elements_module() { 2720 throw new coding_exception( 2721 'Function plagiarism_get_form_elements_module() has been removed. ' . 2722 'Please use {plugin name}_coursemodule_standard_elements() instead.' 2723 ); 2724 } 2725 2726 2727 /** 2728 * @deprecated since Moodle 3.10 2729 */ 2730 function make_categories_options() { 2731 throw new coding_exception(__FUNCTION__ . '() has been removed. ' . 2732 'Please use \core_course_category::make_categories_list() instead.'); 2733 } 2734 2735 /** 2736 * @deprecated since 3.10 2737 */ 2738 function message_count_unread_messages() { 2739 throw new coding_exception('message_count_unread_messages has been removed.'); 2740 } 2741 2742 /** 2743 * @deprecated since 3.10 2744 */ 2745 function serialise_tool_proxy() { 2746 throw new coding_exception('serialise_tool_proxy has been removed.'); 2747 } 2748 2749 /** 2750 * @deprecated Since Moodle 3.11. 2751 */ 2752 function badges_check_backpack_accessibility() { 2753 throw new coding_exception('badges_check_backpack_accessibility() can not be used any more, it was only used for OBv1.0'); 2754 } 2755 2756 /** 2757 * @deprecated Since Moodle 3.11. 2758 */ 2759 function badges_setup_backpack_js() { 2760 throw new coding_exception('badges_setup_backpack_js() can not be used any more, it was only used for OBv1.0'); 2761 } 2762 2763 /** 2764 * @deprecated Since Moodle 3.11. 2765 */ 2766 function badges_local_backpack_js() { 2767 throw new coding_exception('badges_local_backpack_js() can not be used any more, it was only used for OBv1.0'); 2768 } 2769 2770 /** 2771 * @deprecated since Moodle 3.11 MDL-45242 2772 */ 2773 function get_extra_user_fields() { 2774 throw new coding_exception('get_extra_user_fields() has been removed. Please use the \core_user\fields API instead.'); 2775 } 2776 2777 /** 2778 * @deprecated since Moodle 3.11 MDL-45242 2779 */ 2780 function get_extra_user_fields_sql() { 2781 throw new coding_exception('get_extra_user_fields_sql() has been removed. Please use the \core_user\fields API instead.'); 2782 } 2783 2784 /** 2785 * @deprecated since Moodle 3.11 MDL-45242 2786 */ 2787 function get_user_field_name() { 2788 throw new coding_exception('get_user_field_name() has been removed. Please use \core_user\fields::get_display_name() instead'); 2789 } 2790 2791 /** 2792 * @deprecated since Moodle 3.11 MDL-45242 2793 */ 2794 function get_all_user_name_fields() { 2795 throw new coding_exception('get_all_user_name_fields() is deprecated. Please use the \core_user\fields API instead'); 2796 } 2797 2798 /** 2799 * @deprecated since Moodle 3.11 MDL-71051 2800 */ 2801 function profile_display_fields() { 2802 throw new coding_exception(__FUNCTION__ . '() has been removed.'); 2803 } 2804 2805 /** 2806 * @deprecated since Moodle 3.11 MDL-71051 2807 */ 2808 function profile_edit_category() { 2809 throw new coding_exception(__FUNCTION__ . '() has been removed.'); 2810 } 2811 2812 /** 2813 * @deprecated since Moodle 3.11 MDL-71051 2814 */ 2815 function profile_edit_field() { 2816 throw new coding_exception(__FUNCTION__ . '() has been removed.'); 2817 } 2818 2819 /** 2820 * Update a subscription from the form data in one of the rows in the existing subscriptions table. 2821 * 2822 * @param int $subscriptionid The ID of the subscription we are acting upon. 2823 * @param int $pollinterval The poll interval to use. 2824 * @param int $action The action to be performed. One of update or remove. 2825 * @throws dml_exception if invalid subscriptionid is provided 2826 * @return string A log of the import progress, including errors 2827 * @deprecated since Moodle 4.0 MDL-71953 2828 */ 2829 function calendar_process_subscription_row($subscriptionid, $pollinterval, $action) { 2830 debugging('calendar_process_subscription_row() is deprecated.', DEBUG_DEVELOPER); 2831 // Fetch the subscription from the database making sure it exists. 2832 $sub = calendar_get_subscription($subscriptionid); 2833 2834 // Update or remove the subscription, based on action. 2835 switch ($action) { 2836 case CALENDAR_SUBSCRIPTION_UPDATE: 2837 // Skip updating file subscriptions. 2838 if (empty($sub->url)) { 2839 break; 2840 } 2841 $sub->pollinterval = $pollinterval; 2842 calendar_update_subscription($sub); 2843 2844 // Update the events. 2845 return "<p>" . get_string('subscriptionupdated', 'calendar', $sub->name) . "</p>" . 2846 calendar_update_subscription_events($subscriptionid); 2847 case CALENDAR_SUBSCRIPTION_REMOVE: 2848 calendar_delete_subscription($subscriptionid); 2849 return get_string('subscriptionremoved', 'calendar', $sub->name); 2850 break; 2851 default: 2852 break; 2853 } 2854 return ''; 2855 } 2856 2857 /** 2858 * Import events from an iCalendar object into a course calendar. 2859 * 2860 * @param iCalendar $ical The iCalendar object. 2861 * @param int $unused Deprecated 2862 * @param int $subscriptionid The subscription ID. 2863 * @return string A log of the import progress, including errors. 2864 */ 2865 function calendar_import_icalendar_events($ical, $unused = null, $subscriptionid = null) { 2866 debugging('calendar_import_icalendar_events() is deprecated. Please use calendar_import_events_from_ical() instead.', 2867 DEBUG_DEVELOPER); 2868 global $DB; 2869 2870 $return = ''; 2871 $eventcount = 0; 2872 $updatecount = 0; 2873 $skippedcount = 0; 2874 2875 // Large calendars take a while... 2876 if (!CLI_SCRIPT) { 2877 \core_php_time_limit::raise(300); 2878 } 2879 2880 // Grab the timezone from the iCalendar file to be used later. 2881 if (isset($ical->properties['X-WR-TIMEZONE'][0]->value)) { 2882 $timezone = $ical->properties['X-WR-TIMEZONE'][0]->value; 2883 } else { 2884 $timezone = 'UTC'; 2885 } 2886 2887 $icaluuids = []; 2888 foreach ($ical->components['VEVENT'] as $event) { 2889 $icaluuids[] = $event->properties['UID'][0]->value; 2890 $res = calendar_add_icalendar_event($event, null, $subscriptionid, $timezone); 2891 switch ($res) { 2892 case CALENDAR_IMPORT_EVENT_UPDATED: 2893 $updatecount++; 2894 break; 2895 case CALENDAR_IMPORT_EVENT_INSERTED: 2896 $eventcount++; 2897 break; 2898 case CALENDAR_IMPORT_EVENT_SKIPPED: 2899 $skippedcount++; 2900 break; 2901 case 0: 2902 $return .= '<p>' . get_string('erroraddingevent', 'calendar') . ': '; 2903 if (empty($event->properties['SUMMARY'])) { 2904 $return .= '(' . get_string('notitle', 'calendar') . ')'; 2905 } else { 2906 $return .= $event->properties['SUMMARY'][0]->value; 2907 } 2908 $return .= "</p>\n"; 2909 break; 2910 } 2911 } 2912 2913 $return .= html_writer::start_tag('ul'); 2914 $existing = $DB->get_field('event_subscriptions', 'lastupdated', ['id' => $subscriptionid]); 2915 if (!empty($existing)) { 2916 $eventsuuids = $DB->get_records_menu('event', ['subscriptionid' => $subscriptionid], '', 'id, uuid'); 2917 2918 $icaleventscount = count($icaluuids); 2919 $tobedeleted = []; 2920 if (count($eventsuuids) > $icaleventscount) { 2921 foreach ($eventsuuids as $eventid => $eventuuid) { 2922 if (!in_array($eventuuid, $icaluuids)) { 2923 $tobedeleted[] = $eventid; 2924 } 2925 } 2926 if (!empty($tobedeleted)) { 2927 $DB->delete_records_list('event', 'id', $tobedeleted); 2928 $return .= html_writer::tag('li', get_string('eventsdeleted', 'calendar', count($tobedeleted))); 2929 } 2930 } 2931 } 2932 2933 $return .= html_writer::tag('li', get_string('eventsimported', 'calendar', $eventcount)); 2934 $return .= html_writer::tag('li', get_string('eventsskipped', 'calendar', $skippedcount)); 2935 $return .= html_writer::tag('li', get_string('eventsupdated', 'calendar', $updatecount)); 2936 $return .= html_writer::end_tag('ul'); 2937 return $return; 2938 } 2939 2940 /** 2941 * Print grading plugin selection tab-based navigation. 2942 * 2943 * @deprecated since Moodle 4.0. Tabs navigation has been replaced with tertiary navigation. 2944 * @param string $active_type type of plugin on current page - import, export, report or edit 2945 * @param string $active_plugin active plugin type - grader, user, cvs, ... 2946 * @param array $plugin_info Array of plugins 2947 * @param boolean $return return as string 2948 * 2949 * @return nothing or string if $return true 2950 */ 2951 function grade_print_tabs($active_type, $active_plugin, $plugin_info, $return=false) { 2952 global $CFG, $COURSE; 2953 2954 debugging('grade_print_tabs() has been deprecated. Tabs navigation has been replaced with tertiary navigation.', 2955 DEBUG_DEVELOPER); 2956 2957 if (!isset($currenttab)) { //TODO: this is weird 2958 $currenttab = ''; 2959 } 2960 2961 $tabs = array(); 2962 $top_row = array(); 2963 $bottom_row = array(); 2964 $inactive = array($active_plugin); 2965 $activated = array($active_type); 2966 2967 $count = 0; 2968 $active = ''; 2969 2970 foreach ($plugin_info as $plugin_type => $plugins) { 2971 if ($plugin_type == 'strings') { 2972 continue; 2973 } 2974 2975 // If $plugins is actually the definition of a child-less parent link: 2976 if (!empty($plugins->id)) { 2977 $string = $plugins->string; 2978 if (!empty($plugin_info[$active_type]->parent)) { 2979 $string = $plugin_info[$active_type]->parent->string; 2980 } 2981 2982 $top_row[] = new tabobject($plugin_type, $plugins->link, $string); 2983 continue; 2984 } 2985 2986 $first_plugin = reset($plugins); 2987 $url = $first_plugin->link; 2988 2989 if ($plugin_type == 'report') { 2990 $url = $CFG->wwwroot.'/grade/report/index.php?id='.$COURSE->id; 2991 } 2992 2993 $top_row[] = new tabobject($plugin_type, $url, $plugin_info['strings'][$plugin_type]); 2994 2995 if ($active_type == $plugin_type) { 2996 foreach ($plugins as $plugin) { 2997 $bottom_row[] = new tabobject($plugin->id, $plugin->link, $plugin->string); 2998 if ($plugin->id == $active_plugin) { 2999 $inactive = array($plugin->id); 3000 } 3001 } 3002 } 3003 } 3004 3005 // Do not display rows that contain only one item, they are not helpful. 3006 if (count($top_row) > 1) { 3007 $tabs[] = $top_row; 3008 } 3009 if (count($bottom_row) > 1) { 3010 $tabs[] = $bottom_row; 3011 } 3012 if (empty($tabs)) { 3013 return; 3014 } 3015 3016 $rv = html_writer::div(print_tabs($tabs, $active_plugin, $inactive, $activated, true), 'grade-navigation'); 3017 3018 if ($return) { 3019 return $rv; 3020 } else { 3021 echo $rv; 3022 } 3023 } 3024 3025 /** 3026 * Print grading plugin selection popup form. 3027 * 3028 * @deprecated since Moodle 4.0. Dropdown box navigation has been replaced with tertiary navigation. 3029 * @param array $plugin_info An array of plugins containing information for the selector 3030 * @param boolean $return return as string 3031 * 3032 * @return nothing or string if $return true 3033 */ 3034 function print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return=false) { 3035 global $CFG, $OUTPUT, $PAGE; 3036 3037 debugging('print_grade_plugin_selector() has been deprecated. Dropdown box navigation has been replaced ' . 3038 'with tertiary navigation.', DEBUG_DEVELOPER); 3039 3040 $menu = array(); 3041 $count = 0; 3042 $active = ''; 3043 3044 foreach ($plugin_info as $plugin_type => $plugins) { 3045 if ($plugin_type == 'strings') { 3046 continue; 3047 } 3048 3049 $first_plugin = reset($plugins); 3050 3051 $sectionname = $plugin_info['strings'][$plugin_type]; 3052 $section = array(); 3053 3054 foreach ($plugins as $plugin) { 3055 $link = $plugin->link->out(false); 3056 $section[$link] = $plugin->string; 3057 $count++; 3058 if ($plugin_type === $active_type and $plugin->id === $active_plugin) { 3059 $active = $link; 3060 } 3061 } 3062 3063 if ($section) { 3064 $menu[] = array($sectionname=>$section); 3065 } 3066 } 3067 3068 // finally print/return the popup form 3069 if ($count > 1) { 3070 $select = new url_select($menu, $active, null, 'choosepluginreport'); 3071 $select->set_label(get_string('gradereport', 'grades'), array('class' => 'accesshide')); 3072 if ($return) { 3073 return $OUTPUT->render($select); 3074 } else { 3075 echo $OUTPUT->render($select); 3076 } 3077 } else { 3078 // only one option - no plugin selector needed 3079 return ''; 3080 } 3081 3082 /** 3083 * Purge the cache of a course section. 3084 * 3085 * $sectioninfo must have following attributes: 3086 * - course: course id 3087 * - section: section number 3088 * 3089 * @param object $sectioninfo section info 3090 * @return void 3091 * @deprecated since Moodle 4.0. Please use {@link course_modinfo::purge_course_section_cache_by_id()} 3092 * or {@link course_modinfo::purge_course_section_cache_by_number()} instead. 3093 */ 3094 function course_purge_section_cache(object $sectioninfo): void { 3095 debugging(__FUNCTION__ . '() is deprecated. ' . 3096 'Please use course_modinfo::purge_course_section_cache_by_id() ' . 3097 'or course_modinfo::purge_course_section_cache_by_number() instead.', 3098 DEBUG_DEVELOPER); 3099 $sectionid = $sectioninfo->section; 3100 $courseid = $sectioninfo->course; 3101 course_modinfo::purge_course_section_cache_by_id($courseid, $sectionid); 3102 } 3103 3104 /** 3105 * Purge the cache of a course module. 3106 * 3107 * $cm must have following attributes: 3108 * - id: cmid 3109 * - course: course id 3110 * 3111 * @param cm_info|stdClass $cm course module 3112 * @return void 3113 * @deprecated since Moodle 4.0. Please use {@link course_modinfo::purge_course_module_cache()} instead. 3114 */ 3115 function course_purge_module_cache($cm): void { 3116 debugging(__FUNCTION__ . '() is deprecated. ' . 'Please use course_modinfo::purge_course_module_cache() instead.', 3117 DEBUG_DEVELOPER); 3118 $cmid = $cm->id; 3119 $courseid = $cm->course; 3120 course_modinfo::purge_course_module_cache($courseid, $cmid); 3121 } 3122 } 3123 3124 /** 3125 * For a given course, returns an array of course activity objects 3126 * Each item in the array contains he following properties: 3127 * 3128 * @param int $courseid course id 3129 * @param bool $usecache get activities from cache if modinfo exists when $usecache is true 3130 * @return array list of activities 3131 * @deprecated since Moodle 4.0. Please use {@link course_modinfo::get_array_of_activities()} instead. 3132 */ 3133 function get_array_of_activities(int $courseid, bool $usecache = false): array { 3134 debugging(__FUNCTION__ . '() is deprecated. ' . 'Please use course_modinfo::get_array_of_activities() instead.', 3135 DEBUG_DEVELOPER); 3136 return course_modinfo::get_array_of_activities(get_course($courseid), $usecache); 3137 } 3138 3139 /** 3140 * Abort execution by throwing of a general exception, 3141 * default exception handler displays the error message in most cases. 3142 * 3143 * @deprecated since Moodle 4.1 3144 * @todo MDL-74484 Final deprecation in Moodle 4.5. 3145 * @param string $errorcode The name of the language string containing the error message. 3146 * Normally this should be in the error.php lang file. 3147 * @param string $module The language file to get the error message from. 3148 * @param string $link The url where the user will be prompted to continue. 3149 * If no url is provided the user will be directed to the site index page. 3150 * @param object $a Extra words and phrases that might be required in the error string 3151 * @param string $debuginfo optional debugging information 3152 * @return void, always throws exception! 3153 */ 3154 function print_error($errorcode, $module = 'error', $link = '', $a = null, $debuginfo = null) { 3155 debugging("The function print_error() is deprecated. " . 3156 "Please throw a new moodle_exception instance instead.", DEBUG_DEVELOPER); 3157 throw new \moodle_exception($errorcode, $module, $link, $a, $debuginfo); 3158 } 3159 3160 /** 3161 * Execute cron tasks 3162 * 3163 * @param int|null $keepalive The keepalive time for this cron run. 3164 * @deprecated since 4.2 Use \core\cron::run_main_process() instead. 3165 */ 3166 function cron_run(?int $keepalive = null): void { 3167 debugging( 3168 'The cron_run() function is deprecated. Please use \core\cron::run_main_process() instead.', 3169 DEBUG_DEVELOPER 3170 ); 3171 \core\cron::run_main_process($keepalive); 3172 } 3173 3174 /** 3175 * Execute all queued scheduled tasks, applying necessary concurrency limits and time limits. 3176 * 3177 * @param int $timenow The time this process started. 3178 * @deprecated since 4.2 Use \core\cron::run_scheduled_tasks() instead. 3179 */ 3180 function cron_run_scheduled_tasks(int $timenow) { 3181 debugging( 3182 'The cron_run_scheduled_tasks() function is deprecated. Please use \core\cron::run_scheduled_tasks() instead.', 3183 DEBUG_DEVELOPER 3184 ); 3185 \core\cron::run_scheduled_tasks($timenow); 3186 } 3187 3188 /** 3189 * Execute all queued adhoc tasks, applying necessary concurrency limits and time limits. 3190 * 3191 * @param int $timenow The time this process started. 3192 * @param int $keepalive Keep this function alive for N seconds and poll for new adhoc tasks. 3193 * @param bool $checklimits Should we check limits? 3194 * @deprecated since 4.2 Use \core\cron::run_adhoc_tasks() instead. 3195 */ 3196 function cron_run_adhoc_tasks(int $timenow, $keepalive = 0, $checklimits = true) { 3197 debugging( 3198 'The cron_run_adhoc_tasks() function is deprecated. Please use \core\cron::run_adhoc_tasks() instead.', 3199 DEBUG_DEVELOPER 3200 ); 3201 \core\cron::run_adhoc_tasks($timenow, $keepalive, $checklimits); 3202 } 3203 3204 /** 3205 * Shared code that handles running of a single scheduled task within the cron. 3206 * 3207 * Not intended for calling directly outside of this library! 3208 * 3209 * @param \core\task\task_base $task 3210 * @deprecated since 4.2 Use \core\cron::run_inner_scheduled_task() instead. 3211 */ 3212 function cron_run_inner_scheduled_task(\core\task\task_base $task) { 3213 debugging( 3214 'The cron_run_inner_scheduled_task() function is deprecated. Please use \core\cron::run_inner_scheduled_task() instead.', 3215 DEBUG_DEVELOPER 3216 ); 3217 \core\cron::run_inner_scheduled_task($task); 3218 } 3219 3220 /** 3221 * Shared code that handles running of a single adhoc task within the cron. 3222 * 3223 * @param \core\task\adhoc_task $task 3224 * @deprecated since 4.2 Use \core\cron::run_inner_adhoc_task() instead. 3225 */ 3226 function cron_run_inner_adhoc_task(\core\task\adhoc_task $task) { 3227 debugging( 3228 'The cron_run_inner_adhoc_task() function is deprecated. Please use \core\cron::run_inner_adhoc_task() instead.', 3229 DEBUG_DEVELOPER 3230 ); 3231 \core\cron::run_inner_adhoc_task($task); 3232 } 3233 3234 /** 3235 * Sets the process title 3236 * 3237 * This makes it very easy for a sysadmin to immediately see what task 3238 * a cron process is running at any given moment. 3239 * 3240 * @param string $title process status title 3241 * @deprecated since 4.2 Use \core\cron::set_process_title() instead. 3242 */ 3243 function cron_set_process_title(string $title) { 3244 debugging( 3245 'The cron_set_process_title() function is deprecated. Please use \core\cron::set_process_title() instead.', 3246 DEBUG_DEVELOPER 3247 ); 3248 \core\cron::set_process_title($title); 3249 } 3250 3251 /** 3252 * Output some standard information during cron runs. Specifically current time 3253 * and memory usage. This method also does gc_collect_cycles() (before displaying 3254 * memory usage) to try to help PHP manage memory better. 3255 * 3256 * @deprecated since 4.2 Use \core\cron::trace_time_and_memory() instead. 3257 */ 3258 function cron_trace_time_and_memory() { 3259 debugging( 3260 'The cron_trace_time_and_memory() function is deprecated. Please use \core\cron::trace_time_and_memory() instead.', 3261 DEBUG_DEVELOPER 3262 ); 3263 \core\cron::trace_time_and_memory(); 3264 } 3265 3266 /** 3267 * Prepare the output renderer for the cron run. 3268 * 3269 * This involves creating a new $PAGE, and $OUTPUT fresh for each task and prevents any one task from influencing 3270 * any other. 3271 * 3272 * @param bool $restore Whether to restore the original PAGE and OUTPUT 3273 * @deprecated since 4.2 Use \core\cron::prepare_core_renderer() instead. 3274 */ 3275 function cron_prepare_core_renderer($restore = false) { 3276 debugging( 3277 'The cron_prepare_core_renderer() function is deprecated. Please use \core\cron::prepare_core_renderer() instead.', 3278 DEBUG_DEVELOPER 3279 ); 3280 \core\cron::prepare_core_renderer($restore); 3281 } 3282 3283 /** 3284 * Sets up current user and course environment (lang, etc.) in cron. 3285 * Do not use outside of cron script! 3286 * 3287 * @param stdClass $user full user object, null means default cron user (admin), 3288 * value 'reset' means reset internal static caches. 3289 * @param stdClass $course full course record, null means $SITE 3290 * @param bool $leavepagealone If specified, stops it messing with global page object 3291 * @deprecated since 4.2. Use \core\core::setup_user() instead. 3292 * @return void 3293 */ 3294 function cron_setup_user($user = null, $course = null, $leavepagealone = false) { 3295 debugging( 3296 'The cron_setup_user() function is deprecated. ' . 3297 'Please use \core\cron::setup_user() and reset_user_cache() as appropriate instead.', 3298 DEBUG_DEVELOPER 3299 ); 3300 3301 if ($user === 'reset') { 3302 \core\cron::reset_user_cache(); 3303 return; 3304 } 3305 3306 \core\cron::setup_user($user, $course, $leavepagealone); 3307 } 3308 3309 /** 3310 * Get OAuth2 services for the external backpack. 3311 * 3312 * @return array 3313 * @throws coding_exception 3314 * @deprecated since 4.3. 3315 */ 3316 function badges_get_oauth2_service_options() { 3317 debugging( 3318 'badges_get_oauth2_service_options() is deprecated. Don\'t use it.', 3319 DEBUG_DEVELOPER 3320 ); 3321 global $DB; 3322 3323 $issuers = core\oauth2\api::get_all_issuers(); 3324 $options = ['' => 'None']; 3325 foreach ($issuers as $issuer) { 3326 $options[$issuer->get('id')] = $issuer->get('name'); 3327 } 3328 3329 return $options; 3330 } 3331 3332 /** 3333 * Checks if the given device has a theme defined in config.php. 3334 * 3335 * @param string $device The device 3336 * @deprecated since 4.3. 3337 * @return bool 3338 */ 3339 function theme_is_device_locked($device) { 3340 debugging( 3341 __FUNCTION__ . '() is deprecated.' . 3342 'All functions associated with device specific themes are being removed.', 3343 DEBUG_DEVELOPER 3344 ); 3345 global $CFG; 3346 $themeconfigname = core_useragent::get_device_type_cfg_var_name($device); 3347 return isset($CFG->config_php_settings[$themeconfigname]); 3348 } 3349 3350 /** 3351 * Returns the theme named defined in config.php for the given device. 3352 * 3353 * @param string $device The device 3354 * @deprecated since 4.3. 3355 * @return string or null 3356 */ 3357 function theme_get_locked_theme_for_device($device) { 3358 debugging( 3359 __FUNCTION__ . '() is deprecated.' . 3360 'All functions associated with device specific themes are being removed.', 3361 DEBUG_DEVELOPER 3362 ); 3363 global $CFG; 3364 3365 if (!theme_is_device_locked($device)) { 3366 return null; 3367 } 3368 3369 $themeconfigname = core_useragent::get_device_type_cfg_var_name($device); 3370 return $CFG->config_php_settings[$themeconfigname]; 3371 } 3372 3373 /** 3374 * Try to generate cryptographically secure pseudo-random bytes. 3375 * 3376 * Note this is achieved by fallbacking between: 3377 * - PHP 7 random_bytes(). 3378 * - OpenSSL openssl_random_pseudo_bytes(). 3379 * - In house random generator getting its entropy from various, hard to guess, pseudo-random sources. 3380 * 3381 * @param int $length requested length in bytes 3382 * @deprecated since 4.3. 3383 * @return string binary data 3384 */ 3385 function random_bytes_emulate($length) { 3386 debugging( 3387 __FUNCTION__ . '() is deprecated.' . 3388 'Please use random_bytes instead.', 3389 DEBUG_DEVELOPER 3390 ); 3391 return random_bytes($length); 3392 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body