PageRenderTime 78ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/deprecatedlib.php

http://github.com/moodle/moodle
PHP | 3408 lines | 1577 code | 488 blank | 1343 comment | 94 complexity | 4cc5bb0b4f96e72bfc6058437921ddf1 MD5 | raw file
Possible License(s): MIT, AGPL-3.0, MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, Apache-2.0, LGPL-2.1, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. // This file is part of Moodle - http://moodle.org/
  3. //
  4. // Moodle is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // Moodle is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * deprecatedlib.php - Old functions retained only for backward compatibility
  18. *
  19. * Old functions retained only for backward compatibility. New code should not
  20. * use any of these functions.
  21. *
  22. * @package core
  23. * @subpackage deprecated
  24. * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
  25. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  26. * @deprecated
  27. */
  28. defined('MOODLE_INTERNAL') || die();
  29. /* === Functions that needs to be kept longer in deprecated lib than normal time period === */
  30. /**
  31. * Add an entry to the legacy log table.
  32. *
  33. * @deprecated since 2.7 use new events instead
  34. *
  35. * @param int $courseid The course id
  36. * @param string $module The module name e.g. forum, journal, resource, course, user etc
  37. * @param string $action 'view', 'update', 'add' or 'delete', possibly followed by another word to clarify.
  38. * @param string $url The file and parameters used to see the results of the action
  39. * @param string $info Additional description information
  40. * @param int $cm The course_module->id if there is one
  41. * @param int|stdClass $user If log regards $user other than $USER
  42. * @return void
  43. */
  44. function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user=0) {
  45. debugging('add_to_log() has been deprecated, please rewrite your code to the new events API', DEBUG_DEVELOPER);
  46. // This is a nasty hack that allows us to put all the legacy stuff into legacy storage,
  47. // this way we may move all the legacy settings there too.
  48. $manager = get_log_manager();
  49. if (method_exists($manager, 'legacy_add_to_log')) {
  50. $manager->legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user);
  51. }
  52. }
  53. /**
  54. * @deprecated since 2.6
  55. */
  56. function events_trigger() {
  57. throw new coding_exception('events_trigger() has been deprecated along with all Events 1 API in favour of Events 2 API.');
  58. }
  59. /**
  60. * List all core subsystems and their location
  61. *
  62. * This is a whitelist of components that are part of the core and their
  63. * language strings are defined in /lang/en/<<subsystem>>.php. If a given
  64. * plugin is not listed here and it does not have proper plugintype prefix,
  65. * then it is considered as course activity module.
  66. *
  67. * The location is optionally dirroot relative path. NULL means there is no special
  68. * directory for this subsystem. If the location is set, the subsystem's
  69. * renderer.php is expected to be there.
  70. *
  71. * @deprecated since 2.6, use core_component::get_core_subsystems()
  72. *
  73. * @param bool $fullpaths false means relative paths from dirroot, use true for performance reasons
  74. * @return array of (string)name => (string|null)location
  75. */
  76. function get_core_subsystems($fullpaths = false) {
  77. global $CFG;
  78. // NOTE: do not add any other debugging here, keep forever.
  79. $subsystems = core_component::get_core_subsystems();
  80. if ($fullpaths) {
  81. return $subsystems;
  82. }
  83. debugging('Short paths are deprecated when using get_core_subsystems(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER);
  84. $dlength = strlen($CFG->dirroot);
  85. foreach ($subsystems as $k => $v) {
  86. if ($v === null) {
  87. continue;
  88. }
  89. $subsystems[$k] = substr($v, $dlength+1);
  90. }
  91. return $subsystems;
  92. }
  93. /**
  94. * Lists all plugin types.
  95. *
  96. * @deprecated since 2.6, use core_component::get_plugin_types()
  97. *
  98. * @param bool $fullpaths false means relative paths from dirroot
  99. * @return array Array of strings - name=>location
  100. */
  101. function get_plugin_types($fullpaths = true) {
  102. global $CFG;
  103. // NOTE: do not add any other debugging here, keep forever.
  104. $types = core_component::get_plugin_types();
  105. if ($fullpaths) {
  106. return $types;
  107. }
  108. debugging('Short paths are deprecated when using get_plugin_types(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER);
  109. $dlength = strlen($CFG->dirroot);
  110. foreach ($types as $k => $v) {
  111. if ($k === 'theme') {
  112. $types[$k] = 'theme';
  113. continue;
  114. }
  115. $types[$k] = substr($v, $dlength+1);
  116. }
  117. return $types;
  118. }
  119. /**
  120. * Use when listing real plugins of one type.
  121. *
  122. * @deprecated since 2.6, use core_component::get_plugin_list()
  123. *
  124. * @param string $plugintype type of plugin
  125. * @return array name=>fulllocation pairs of plugins of given type
  126. */
  127. function get_plugin_list($plugintype) {
  128. // NOTE: do not add any other debugging here, keep forever.
  129. if ($plugintype === '') {
  130. $plugintype = 'mod';
  131. }
  132. return core_component::get_plugin_list($plugintype);
  133. }
  134. /**
  135. * Get a list of all the plugins of a given type that define a certain class
  136. * in a certain file. The plugin component names and class names are returned.
  137. *
  138. * @deprecated since 2.6, use core_component::get_plugin_list_with_class()
  139. *
  140. * @param string $plugintype the type of plugin, e.g. 'mod' or 'report'.
  141. * @param string $class the part of the name of the class after the
  142. * frankenstyle prefix. e.g 'thing' if you are looking for classes with
  143. * names like report_courselist_thing. If you are looking for classes with
  144. * the same name as the plugin name (e.g. qtype_multichoice) then pass ''.
  145. * @param string $file the name of file within the plugin that defines the class.
  146. * @return array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum')
  147. * and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice').
  148. */
  149. function get_plugin_list_with_class($plugintype, $class, $file) {
  150. // NOTE: do not add any other debugging here, keep forever.
  151. return core_component::get_plugin_list_with_class($plugintype, $class, $file);
  152. }
  153. /**
  154. * Returns the exact absolute path to plugin directory.
  155. *
  156. * @deprecated since 2.6, use core_component::get_plugin_directory()
  157. *
  158. * @param string $plugintype type of plugin
  159. * @param string $name name of the plugin
  160. * @return string full path to plugin directory; NULL if not found
  161. */
  162. function get_plugin_directory($plugintype, $name) {
  163. // NOTE: do not add any other debugging here, keep forever.
  164. if ($plugintype === '') {
  165. $plugintype = 'mod';
  166. }
  167. return core_component::get_plugin_directory($plugintype, $name);
  168. }
  169. /**
  170. * Normalize the component name using the "frankenstyle" names.
  171. *
  172. * @deprecated since 2.6, use core_component::normalize_component()
  173. *
  174. * @param string $component
  175. * @return array two-items list of [(string)type, (string|null)name]
  176. */
  177. function normalize_component($component) {
  178. // NOTE: do not add any other debugging here, keep forever.
  179. return core_component::normalize_component($component);
  180. }
  181. /**
  182. * Return exact absolute path to a plugin directory.
  183. *
  184. * @deprecated since 2.6, use core_component::normalize_component()
  185. *
  186. * @param string $component name such as 'moodle', 'mod_forum'
  187. * @return string full path to component directory; NULL if not found
  188. */
  189. function get_component_directory($component) {
  190. // NOTE: do not add any other debugging here, keep forever.
  191. return core_component::get_component_directory($component);
  192. }
  193. /**
  194. * Get the context instance as an object. This function will create the
  195. * context instance if it does not exist yet.
  196. *
  197. * @deprecated since 2.2, use context_course::instance() or other relevant class instead
  198. * @todo This will be deleted in Moodle 2.8, refer MDL-34472
  199. * @param integer $contextlevel The context level, for example CONTEXT_COURSE, or CONTEXT_MODULE.
  200. * @param integer $instance The instance id. For $level = CONTEXT_COURSE, this would be $course->id,
  201. * for $level = CONTEXT_MODULE, this would be $cm->id. And so on. Defaults to 0
  202. * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
  203. * MUST_EXIST means throw exception if no record or multiple records found
  204. * @return context The context object.
  205. */
  206. function get_context_instance($contextlevel, $instance = 0, $strictness = IGNORE_MISSING) {
  207. debugging('get_context_instance() is deprecated, please use context_xxxx::instance() instead.', DEBUG_DEVELOPER);
  208. $instances = (array)$instance;
  209. $contexts = array();
  210. $classname = context_helper::get_class_for_level($contextlevel);
  211. // we do not load multiple contexts any more, PAGE should be responsible for any preloading
  212. foreach ($instances as $inst) {
  213. $contexts[$inst] = $classname::instance($inst, $strictness);
  214. }
  215. if (is_array($instance)) {
  216. return $contexts;
  217. } else {
  218. return $contexts[$instance];
  219. }
  220. }
  221. /* === End of long term deprecated api list === */
  222. /**
  223. * @deprecated since 2.7 - use new file picker instead
  224. */
  225. function clam_log_upload() {
  226. throw new coding_exception('clam_log_upload() can not be used any more, please use file picker instead');
  227. }
  228. /**
  229. * @deprecated since 2.7 - use new file picker instead
  230. */
  231. function clam_log_infected() {
  232. throw new coding_exception('clam_log_infected() can not be used any more, please use file picker instead');
  233. }
  234. /**
  235. * @deprecated since 2.7 - use new file picker instead
  236. */
  237. function clam_change_log() {
  238. throw new coding_exception('clam_change_log() can not be used any more, please use file picker instead');
  239. }
  240. /**
  241. * @deprecated since 2.7 - infected files are now deleted in file picker
  242. */
  243. function clam_replace_infected_file() {
  244. throw new coding_exception('clam_replace_infected_file() can not be used any more, please use file picker instead');
  245. }
  246. /**
  247. * @deprecated since 2.7
  248. */
  249. function clam_handle_infected_file() {
  250. throw new coding_exception('clam_handle_infected_file() can not be used any more, please use file picker instead');
  251. }
  252. /**
  253. * @deprecated since 2.7
  254. */
  255. function clam_scan_moodle_file() {
  256. throw new coding_exception('clam_scan_moodle_file() can not be used any more, please use file picker instead');
  257. }
  258. /**
  259. * @deprecated since 2.7 PHP 5.4.x should be always compatible.
  260. */
  261. function password_compat_not_supported() {
  262. throw new coding_exception('Do not use password_compat_not_supported() - bcrypt is now always available');
  263. }
  264. /**
  265. * @deprecated since 2.6
  266. */
  267. function session_get_instance() {
  268. throw new coding_exception('session_get_instance() is removed, use \core\session\manager instead');
  269. }
  270. /**
  271. * @deprecated since 2.6
  272. */
  273. function session_is_legacy() {
  274. throw new coding_exception('session_is_legacy() is removed, do not use any more');
  275. }
  276. /**
  277. * @deprecated since 2.6
  278. */
  279. function session_kill_all() {
  280. throw new coding_exception('session_kill_all() is removed, use \core\session\manager::kill_all_sessions() instead');
  281. }
  282. /**
  283. * @deprecated since 2.6
  284. */
  285. function session_touch() {
  286. throw new coding_exception('session_touch() is removed, use \core\session\manager::touch_session() instead');
  287. }
  288. /**
  289. * @deprecated since 2.6
  290. */
  291. function session_kill() {
  292. throw new coding_exception('session_kill() is removed, use \core\session\manager::kill_session() instead');
  293. }
  294. /**
  295. * @deprecated since 2.6
  296. */
  297. function session_kill_user() {
  298. throw new coding_exception('session_kill_user() is removed, use \core\session\manager::kill_user_sessions() instead');
  299. }
  300. /**
  301. * @deprecated since 2.6
  302. */
  303. function session_set_user() {
  304. throw new coding_exception('session_set_user() is removed, use \core\session\manager::set_user() instead');
  305. }
  306. /**
  307. * @deprecated since 2.6
  308. */
  309. function session_is_loggedinas() {
  310. throw new coding_exception('session_is_loggedinas() is removed, use \core\session\manager::is_loggedinas() instead');
  311. }
  312. /**
  313. * @deprecated since 2.6
  314. */
  315. function session_get_realuser() {
  316. throw new coding_exception('session_get_realuser() is removed, use \core\session\manager::get_realuser() instead');
  317. }
  318. /**
  319. * @deprecated since 2.6
  320. */
  321. function session_loginas() {
  322. throw new coding_exception('session_loginas() is removed, use \core\session\manager::loginas() instead');
  323. }
  324. /**
  325. * @deprecated since 2.6
  326. */
  327. function js_minify() {
  328. throw new coding_exception('js_minify() is removed, use core_minify::js_files() or core_minify::js() instead.');
  329. }
  330. /**
  331. * @deprecated since 2.6
  332. */
  333. function css_minify_css() {
  334. throw new coding_exception('css_minify_css() is removed, use core_minify::css_files() or core_minify::css() instead.');
  335. }
  336. // === Deprecated before 2.6.0 ===
  337. /**
  338. * @deprecated
  339. */
  340. function check_gd_version() {
  341. throw new coding_exception('check_gd_version() is removed, GD extension is always available now');
  342. }
  343. /**
  344. * @deprecated
  345. */
  346. function update_login_count() {
  347. throw new coding_exception('update_login_count() is removed, all calls need to be removed');
  348. }
  349. /**
  350. * @deprecated
  351. */
  352. function reset_login_count() {
  353. throw new coding_exception('reset_login_count() is removed, all calls need to be removed');
  354. }
  355. /**
  356. * @deprecated
  357. */
  358. function update_log_display_entry() {
  359. throw new coding_exception('The update_log_display_entry() is removed, please use db/log.php description file instead.');
  360. }
  361. /**
  362. * @deprecated use the text formatting in a standard way instead (http://docs.moodle.org/dev/Output_functions)
  363. * this was abused mostly for embedding of attachments
  364. */
  365. function filter_text() {
  366. throw new coding_exception('filter_text() can not be used anymore, use format_text(), format_string() etc instead.');
  367. }
  368. /**
  369. * @deprecated Loginhttps is no longer supported
  370. */
  371. function httpsrequired() {
  372. throw new coding_exception('httpsrequired() can not be used any more. Loginhttps is no longer supported.');
  373. }
  374. /**
  375. * @deprecated since 3.1 - replacement legacy file API methods can be found on the moodle_url class, for example:
  376. * The moodle_url::make_legacyfile_url() method can be used to generate a legacy course file url. To generate
  377. * course module file.php url the moodle_url::make_file_url() should be used.
  378. */
  379. function get_file_url() {
  380. throw new coding_exception('get_file_url() can not be used anymore. Please use ' .
  381. 'moodle_url factory methods instead.');
  382. }
  383. /**
  384. * @deprecated use get_enrolled_users($context) instead.
  385. */
  386. function get_course_participants() {
  387. throw new coding_exception('get_course_participants() can not be used any more, use get_enrolled_users() instead.');
  388. }
  389. /**
  390. * @deprecated use is_enrolled($context, $userid) instead.
  391. */
  392. function is_course_participant() {
  393. throw new coding_exception('is_course_participant() can not be used any more, use is_enrolled() instead.');
  394. }
  395. /**
  396. * @deprecated
  397. */
  398. function get_recent_enrolments() {
  399. throw new coding_exception('get_recent_enrolments() is removed as it returned inaccurate results.');
  400. }
  401. /**
  402. * @deprecated use clean_param($string, PARAM_FILE) instead.
  403. */
  404. function detect_munged_arguments() {
  405. throw new coding_exception('detect_munged_arguments() can not be used any more, please use clean_param(,PARAM_FILE) instead.');
  406. }
  407. /**
  408. * Unzip one zip file to a destination dir
  409. * Both parameters must be FULL paths
  410. * If destination isn't specified, it will be the
  411. * SAME directory where the zip file resides.
  412. *
  413. * @global object
  414. * @param string $zipfile The zip file to unzip
  415. * @param string $destination The location to unzip to
  416. * @param bool $showstatus_ignored Unused
  417. * @deprecated since 2.0 MDL-15919
  418. */
  419. function unzip_file($zipfile, $destination = '', $showstatus_ignored = true) {
  420. debugging(__FUNCTION__ . '() is deprecated. '
  421. . 'Please use the application/zip file_packer implementation instead.', DEBUG_DEVELOPER);
  422. // Extract everything from zipfile.
  423. $path_parts = pathinfo(cleardoubleslashes($zipfile));
  424. $zippath = $path_parts["dirname"]; //The path of the zip file
  425. $zipfilename = $path_parts["basename"]; //The name of the zip file
  426. $extension = $path_parts["extension"]; //The extension of the file
  427. //If no file, error
  428. if (empty($zipfilename)) {
  429. return false;
  430. }
  431. //If no extension, error
  432. if (empty($extension)) {
  433. return false;
  434. }
  435. //Clear $zipfile
  436. $zipfile = cleardoubleslashes($zipfile);
  437. //Check zipfile exists
  438. if (!file_exists($zipfile)) {
  439. return false;
  440. }
  441. //If no destination, passed let's go with the same directory
  442. if (empty($destination)) {
  443. $destination = $zippath;
  444. }
  445. //Clear $destination
  446. $destpath = rtrim(cleardoubleslashes($destination), "/");
  447. //Check destination path exists
  448. if (!is_dir($destpath)) {
  449. return false;
  450. }
  451. $packer = get_file_packer('application/zip');
  452. $result = $packer->extract_to_pathname($zipfile, $destpath);
  453. if ($result === false) {
  454. return false;
  455. }
  456. foreach ($result as $status) {
  457. if ($status !== true) {
  458. return false;
  459. }
  460. }
  461. return true;
  462. }
  463. /**
  464. * Zip an array of files/dirs to a destination zip file
  465. * Both parameters must be FULL paths to the files/dirs
  466. *
  467. * @global object
  468. * @param array $originalfiles Files to zip
  469. * @param string $destination The destination path
  470. * @return bool Outcome
  471. *
  472. * @deprecated since 2.0 MDL-15919
  473. */
  474. function zip_files($originalfiles, $destination) {
  475. debugging(__FUNCTION__ . '() is deprecated. '
  476. . 'Please use the application/zip file_packer implementation instead.', DEBUG_DEVELOPER);
  477. // Extract everything from destination.
  478. $path_parts = pathinfo(cleardoubleslashes($destination));
  479. $destpath = $path_parts["dirname"]; //The path of the zip file
  480. $destfilename = $path_parts["basename"]; //The name of the zip file
  481. $extension = $path_parts["extension"]; //The extension of the file
  482. //If no file, error
  483. if (empty($destfilename)) {
  484. return false;
  485. }
  486. //If no extension, add it
  487. if (empty($extension)) {
  488. $extension = 'zip';
  489. $destfilename = $destfilename.'.'.$extension;
  490. }
  491. //Check destination path exists
  492. if (!is_dir($destpath)) {
  493. return false;
  494. }
  495. //Check destination path is writable. TODO!!
  496. //Clean destination filename
  497. $destfilename = clean_filename($destfilename);
  498. //Now check and prepare every file
  499. $files = array();
  500. $origpath = NULL;
  501. foreach ($originalfiles as $file) { //Iterate over each file
  502. //Check for every file
  503. $tempfile = cleardoubleslashes($file); // no doubleslashes!
  504. //Calculate the base path for all files if it isn't set
  505. if ($origpath === NULL) {
  506. $origpath = rtrim(cleardoubleslashes(dirname($tempfile)), "/");
  507. }
  508. //See if the file is readable
  509. if (!is_readable($tempfile)) { //Is readable
  510. continue;
  511. }
  512. //See if the file/dir is in the same directory than the rest
  513. if (rtrim(cleardoubleslashes(dirname($tempfile)), "/") != $origpath) {
  514. continue;
  515. }
  516. //Add the file to the array
  517. $files[] = $tempfile;
  518. }
  519. $zipfiles = array();
  520. $start = strlen($origpath)+1;
  521. foreach($files as $file) {
  522. $zipfiles[substr($file, $start)] = $file;
  523. }
  524. $packer = get_file_packer('application/zip');
  525. return $packer->archive_to_pathname($zipfiles, $destpath . '/' . $destfilename);
  526. }
  527. /**
  528. * @deprecated use groups_get_all_groups() instead.
  529. */
  530. function mygroupid() {
  531. throw new coding_exception('mygroupid() can not be used any more, please use groups_get_all_groups() instead.');
  532. }
  533. /**
  534. * @deprecated since Moodle 2.0 MDL-14617 - please do not use this function any more.
  535. */
  536. function groupmode() {
  537. throw new coding_exception('groupmode() can not be used any more, please use groups_get_* instead.');
  538. }
  539. /**
  540. * @deprecated Since year 2006 - please do not use this function any more.
  541. */
  542. function set_current_group() {
  543. throw new coding_exception('set_current_group() can not be used anymore, please use $SESSION->currentgroup[$courseid] instead');
  544. }
  545. /**
  546. * @deprecated Since year 2006 - please do not use this function any more.
  547. */
  548. function get_current_group() {
  549. throw new coding_exception('get_current_group() can not be used any more, please use groups_get_* instead');
  550. }
  551. /**
  552. * @deprecated Since Moodle 2.8
  553. */
  554. function groups_filter_users_by_course_module_visible() {
  555. throw new coding_exception('groups_filter_users_by_course_module_visible() is removed. ' .
  556. 'Replace with a call to \core_availability\info_module::filter_user_list(), ' .
  557. 'which does basically the same thing but includes other restrictions such ' .
  558. 'as profile restrictions.');
  559. }
  560. /**
  561. * @deprecated Since Moodle 2.8
  562. */
  563. function groups_course_module_visible() {
  564. throw new coding_exception('groups_course_module_visible() is removed, use $cm->uservisible to decide whether the current
  565. user can ' . 'access an activity.', DEBUG_DEVELOPER);
  566. }
  567. /**
  568. * @deprecated since 2.0
  569. */
  570. function error() {
  571. throw new coding_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a removed, please call
  572. print_error() instead of error()');
  573. }
  574. /**
  575. * @deprecated use $PAGE->theme->name instead.
  576. */
  577. function current_theme() {
  578. throw new coding_exception('current_theme() can not be used any more, please use $PAGE->theme->name instead');
  579. }
  580. /**
  581. * @deprecated
  582. */
  583. function formerr() {
  584. throw new coding_exception('formerr() is removed. Please change your code to use $OUTPUT->error_text($string).');
  585. }
  586. /**
  587. * @deprecated use $OUTPUT->skip_link_target() in instead.
  588. */
  589. function skip_main_destination() {
  590. throw new coding_exception('skip_main_destination() can not be used any more, please use $OUTPUT->skip_link_target() instead.');
  591. }
  592. /**
  593. * @deprecated use $OUTPUT->container() instead.
  594. */
  595. function print_container() {
  596. throw new coding_exception('print_container() can not be used any more. Please use $OUTPUT->container() instead.');
  597. }
  598. /**
  599. * @deprecated use $OUTPUT->container_start() instead.
  600. */
  601. function print_container_start() {
  602. throw new coding_exception('print_container_start() can not be used any more. Please use $OUTPUT->container_start() instead.');
  603. }
  604. /**
  605. * @deprecated use $OUTPUT->container_end() instead.
  606. */
  607. function print_container_end() {
  608. throw new coding_exception('print_container_end() can not be used any more. Please use $OUTPUT->container_end() instead.');
  609. }
  610. /**
  611. * @deprecated since Moodle 2.0 MDL-19077 - use $OUTPUT->notification instead.
  612. */
  613. function notify() {
  614. throw new coding_exception('notify() is removed, please use $OUTPUT->notification() instead');
  615. }
  616. /**
  617. * @deprecated use $OUTPUT->continue_button() instead.
  618. */
  619. function print_continue() {
  620. throw new coding_exception('print_continue() can not be used any more. Please use $OUTPUT->continue_button() instead.');
  621. }
  622. /**
  623. * @deprecated use $PAGE methods instead.
  624. */
  625. function print_header() {
  626. throw new coding_exception('print_header() can not be used any more. Please use $PAGE methods instead.');
  627. }
  628. /**
  629. * @deprecated use $PAGE methods instead.
  630. */
  631. function print_header_simple() {
  632. throw new coding_exception('print_header_simple() can not be used any more. Please use $PAGE methods instead.');
  633. }
  634. /**
  635. * @deprecated use $OUTPUT->block() instead.
  636. */
  637. function print_side_block() {
  638. throw new coding_exception('print_side_block() can not be used any more, please use $OUTPUT->block() instead.');
  639. }
  640. /**
  641. * Prints a basic textarea field.
  642. *
  643. * This was 'deprecated' in 2.0, but not properly (there was no alternative) so the
  644. * debugging message was commented out.
  645. *
  646. * @deprecated since Moodle 3.6
  647. *
  648. * When using this function, you should
  649. *
  650. * @global object
  651. * @param bool $unused No longer used.
  652. * @param int $rows Number of rows to display (minimum of 10 when $height is non-null)
  653. * @param int $cols Number of columns to display (minimum of 65 when $width is non-null)
  654. * @param null $width (Deprecated) Width of the element; if a value is passed, the minimum value for $cols will be 65. Value is otherwise ignored.
  655. * @param null $height (Deprecated) Height of the element; if a value is passe, the minimum value for $rows will be 10. Value is otherwise ignored.
  656. * @param string $name Name to use for the textarea element.
  657. * @param string $value Initial content to display in the textarea.
  658. * @param int $obsolete deprecated
  659. * @param bool $return If false, will output string. If true, will return string value.
  660. * @param string $id CSS ID to add to the textarea element.
  661. * @return string|void depending on the value of $return
  662. */
  663. function print_textarea($unused, $rows, $cols, $width, $height, $name, $value='', $obsolete=0, $return=false, $id='') {
  664. /// $width and height are legacy fields and no longer used as pixels like they used to be.
  665. /// However, you can set them to zero to override the mincols and minrows values below.
  666. // Disabling because there is not yet a viable $OUTPUT option for cases when mforms can't be used
  667. debugging('print_textarea() is deprecated. Please use $OUTPUT->print_textarea() instead.', DEBUG_DEVELOPER);
  668. global $OUTPUT;
  669. $mincols = 65;
  670. $minrows = 10;
  671. if ($id === '') {
  672. $id = 'edit-'.$name;
  673. }
  674. if ($height && ($rows < $minrows)) {
  675. $rows = $minrows;
  676. }
  677. if ($width && ($cols < $mincols)) {
  678. $cols = $mincols;
  679. }
  680. $textarea = $OUTPUT->print_textarea($name, $id, $value, $rows, $cols);
  681. if ($return) {
  682. return $textarea;
  683. }
  684. echo $textarea;
  685. }
  686. /**
  687. * Returns an image of an up or down arrow, used for column sorting. To avoid unnecessary DB accesses, please
  688. * provide this function with the language strings for sortasc and sortdesc.
  689. *
  690. * @deprecated use $OUTPUT->arrow() instead.
  691. * @todo final deprecation of this function once MDL-45448 is resolved
  692. *
  693. * If no sort string is associated with the direction, an arrow with no alt text will be printed/returned.
  694. *
  695. * @global object
  696. * @param string $direction 'up' or 'down'
  697. * @param string $strsort The language string used for the alt attribute of this image
  698. * @param bool $return Whether to print directly or return the html string
  699. * @return string|void depending on $return
  700. *
  701. */
  702. function print_arrow($direction='up', $strsort=null, $return=false) {
  703. global $OUTPUT;
  704. debugging('print_arrow() is deprecated. Please use $OUTPUT->arrow() instead.', DEBUG_DEVELOPER);
  705. if (!in_array($direction, array('up', 'down', 'right', 'left', 'move'))) {
  706. return null;
  707. }
  708. $return = null;
  709. switch ($direction) {
  710. case 'up':
  711. $sortdir = 'asc';
  712. break;
  713. case 'down':
  714. $sortdir = 'desc';
  715. break;
  716. case 'move':
  717. $sortdir = 'asc';
  718. break;
  719. default:
  720. $sortdir = null;
  721. break;
  722. }
  723. // Prepare language string
  724. $strsort = '';
  725. if (empty($strsort) && !empty($sortdir)) {
  726. $strsort = get_string('sort' . $sortdir, 'grades');
  727. }
  728. $return = ' ' . $OUTPUT->pix_icon('t/' . $direction, $strsort) . ' ';
  729. if ($return) {
  730. return $return;
  731. } else {
  732. echo $return;
  733. }
  734. }
  735. /**
  736. * @deprecated since Moodle 2.0
  737. */
  738. function choose_from_menu() {
  739. throw new coding_exception('choose_from_menu() is removed. Please change your code to use html_writer::select().');
  740. }
  741. /**
  742. * @deprecated use $OUTPUT->help_icon_scale($courseid, $scale) instead.
  743. */
  744. function print_scale_menu_helpbutton() {
  745. throw new coding_exception('print_scale_menu_helpbutton() can not be used any more. '.
  746. 'Please use $OUTPUT->help_icon_scale($courseid, $scale) instead.');
  747. }
  748. /**
  749. * @deprecated use html_writer::checkbox() instead.
  750. */
  751. function print_checkbox() {
  752. throw new coding_exception('print_checkbox() can not be used any more. Please use html_writer::checkbox() instead.');
  753. }
  754. /**
  755. * @deprecated since Moodle 3.2
  756. */
  757. function update_module_button() {
  758. throw new coding_exception('update_module_button() can not be used anymore. Activity modules should ' .
  759. 'not add the edit module button, the link is already available in the Administration block. Themes ' .
  760. 'can choose to display the link in the buttons row consistently for all module types.');
  761. }
  762. /**
  763. * @deprecated use $OUTPUT->navbar() instead
  764. */
  765. function print_navigation () {
  766. throw new coding_exception('print_navigation() can not be used any more, please update use $OUTPUT->navbar() instead.');
  767. }
  768. /**
  769. * @deprecated Please use $PAGE->navabar methods instead.
  770. */
  771. function build_navigation() {
  772. throw new coding_exception('build_navigation() can not be used any more, please use $PAGE->navbar methods instead.');
  773. }
  774. /**
  775. * @deprecated not relevant with global navigation in Moodle 2.x+
  776. */
  777. function navmenu() {
  778. throw new coding_exception('navmenu() can not be used any more, it is no longer relevant with global navigation.');
  779. }
  780. /// CALENDAR MANAGEMENT ////////////////////////////////////////////////////////////////
  781. /**
  782. * @deprecated please use calendar_event::create() instead.
  783. */
  784. function add_event() {
  785. throw new coding_exception('add_event() can not be used any more, please use calendar_event::create() instead.');
  786. }
  787. /**
  788. * @deprecated please calendar_event->update() instead.
  789. */
  790. function update_event() {
  791. throw new coding_exception('update_event() is removed, please use calendar_event->update() instead.');
  792. }
  793. /**
  794. * @deprecated please use calendar_event->delete() instead.
  795. */
  796. function delete_event() {
  797. throw new coding_exception('delete_event() can not be used any more, please use '.
  798. 'calendar_event->delete() instead.');
  799. }
  800. /**
  801. * @deprecated please use calendar_event->toggle_visibility(false) instead.
  802. */
  803. function hide_event() {
  804. throw new coding_exception('hide_event() can not be used any more, please use '.
  805. 'calendar_event->toggle_visibility(false) instead.');
  806. }
  807. /**
  808. * @deprecated please use calendar_event->toggle_visibility(true) instead.
  809. */
  810. function show_event() {
  811. throw new coding_exception('show_event() can not be used any more, please use '.
  812. 'calendar_event->toggle_visibility(true) instead.');
  813. }
  814. /**
  815. * @deprecated since Moodle 2.2 use core_text::xxxx() instead.
  816. */
  817. function textlib_get_instance() {
  818. throw new coding_exception('textlib_get_instance() can not be used any more, please use '.
  819. 'core_text::functioname() instead.');
  820. }
  821. /**
  822. * @deprecated since 2.4
  823. */
  824. function get_generic_section_name() {
  825. throw new coding_exception('get_generic_section_name() is deprecated. Please use appropriate functionality from class format_base');
  826. }
  827. /**
  828. * @deprecated since 2.4
  829. */
  830. function get_all_sections() {
  831. throw new coding_exception('get_all_sections() is removed. See phpdocs for this function');
  832. }
  833. /**
  834. * @deprecated since 2.4
  835. */
  836. function add_mod_to_section() {
  837. throw new coding_exception('Function add_mod_to_section() is removed, please use course_add_cm_to_section()');
  838. }
  839. /**
  840. * @deprecated since 2.4
  841. */
  842. function get_all_mods() {
  843. throw new coding_exception('Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details');
  844. }
  845. /**
  846. * @deprecated since 2.4
  847. */
  848. function get_course_section() {
  849. throw new coding_exception('Function get_course_section() is removed. Please use course_create_sections_if_missing() and get_fast_modinfo() instead.');
  850. }
  851. /**
  852. * @deprecated since 2.4
  853. */
  854. function format_weeks_get_section_dates() {
  855. throw new coding_exception('Function format_weeks_get_section_dates() is removed. It is not recommended to'.
  856. ' use it outside of format_weeks plugin');
  857. }
  858. /**
  859. * @deprecated since 2.5
  860. */
  861. function get_print_section_cm_text() {
  862. throw new coding_exception('Function get_print_section_cm_text() is removed. Please use '.
  863. 'cm_info::get_formatted_content() and cm_info::get_formatted_name()');
  864. }
  865. /**
  866. * @deprecated since 2.5
  867. */
  868. function print_section_add_menus() {
  869. throw new coding_exception('Function print_section_add_menus() is removed. Please use course renderer '.
  870. 'function course_section_add_cm_control()');
  871. }
  872. /**
  873. * @deprecated since 2.5. Please use:
  874. * $courserenderer = $PAGE->get_renderer('core', 'course');
  875. * $actions = course_get_cm_edit_actions($mod, $indent, $section);
  876. * return ' ' . $courserenderer->course_section_cm_edit_actions($actions);
  877. */
  878. function make_editing_buttons() {
  879. throw new coding_exception('Function make_editing_buttons() is removed, please see PHPdocs in '.
  880. 'lib/deprecatedlib.php on how to replace it');
  881. }
  882. /**
  883. * @deprecated since 2.5
  884. */
  885. function print_section() {
  886. throw new coding_exception('Function print_section() is removed. Please use course renderer function '.
  887. 'course_section_cm_list() instead.');
  888. }
  889. /**
  890. * @deprecated since 2.5
  891. */
  892. function print_overview() {
  893. throw new coding_exception('Function print_overview() is removed. Use block course_overview to display this information');
  894. }
  895. /**
  896. * @deprecated since 2.5
  897. */
  898. function print_recent_activity() {
  899. throw new coding_exception('Function print_recent_activity() is removed. It is not recommended to'.
  900. ' use it outside of block_recent_activity');
  901. }
  902. /**
  903. * @deprecated since 2.5
  904. */
  905. function delete_course_module() {
  906. throw new coding_exception('Function delete_course_module() is removed. Please use course_delete_module() instead.');
  907. }
  908. /**
  909. * @deprecated since 2.5
  910. */
  911. function update_category_button() {
  912. throw new coding_exception('Function update_category_button() is removed. Pages to view '.
  913. 'and edit courses are now separate and no longer depend on editing mode.');
  914. }
  915. /**
  916. * @deprecated since 2.5
  917. */
  918. function make_categories_list() {
  919. throw new coding_exception('Global function make_categories_list() is removed. Please use '.
  920. 'core_course_category::make_categories_list() and core_course_category::get_parents()');
  921. }
  922. /**
  923. * @deprecated since 2.5
  924. */
  925. function category_delete_move() {
  926. throw new coding_exception('Function category_delete_move() is removed. Please use ' .
  927. 'core_course_category::delete_move() instead.');
  928. }
  929. /**
  930. * @deprecated since 2.5
  931. */
  932. function category_delete_full() {
  933. throw new coding_exception('Function category_delete_full() is removed. Please use ' .
  934. 'core_course_category::delete_full() instead.');
  935. }
  936. /**
  937. * @deprecated since 2.5
  938. */
  939. function move_category() {
  940. throw new coding_exception('Function move_category() is removed. Please use core_course_category::change_parent() instead.');
  941. }
  942. /**
  943. * @deprecated since 2.5
  944. */
  945. function course_category_hide() {
  946. throw new coding_exception('Function course_category_hide() is removed. Please use core_course_category::hide() instead.');
  947. }
  948. /**
  949. * @deprecated since 2.5
  950. */
  951. function course_category_show() {
  952. throw new coding_exception('Function course_category_show() is removed. Please use core_course_category::show() instead.');
  953. }
  954. /**
  955. * @deprecated since 2.5. Please use core_course_category::get($catid, IGNORE_MISSING) or
  956. * core_course_category::get($catid, MUST_EXIST).
  957. */
  958. function get_course_category() {
  959. throw new coding_exception('Function get_course_category() is removed. Please use core_course_category::get(), ' .
  960. 'see phpdocs for more details');
  961. }
  962. /**
  963. * @deprecated since 2.5
  964. */
  965. function create_course_category() {
  966. throw new coding_exception('Function create_course_category() is removed. Please use core_course_category::create(), ' .
  967. 'see phpdocs for more details');
  968. }
  969. /**
  970. * @deprecated since 2.5. Please use core_course_category::get() and core_course_category::get_children()
  971. */
  972. function get_all_subcategories() {
  973. throw new coding_exception('Function get_all_subcategories() is removed. Please use appropriate methods() '.
  974. 'of core_course_category class. See phpdocs for more details');
  975. }
  976. /**
  977. * @deprecated since 2.5. Please use core_course_category::get($parentid)->get_children().
  978. */
  979. function get_child_categories() {
  980. throw new coding_exception('Function get_child_categories() is removed. Use core_course_category::get_children() or see ' .
  981. 'phpdocs for more details.');
  982. }
  983. /**
  984. * @deprecated since 2.5
  985. */
  986. function get_categories() {
  987. throw new coding_exception('Function get_categories() is removed. Please use ' .
  988. 'appropriate functions from class core_course_category');
  989. }
  990. /**
  991. * @deprecated since 2.5
  992. */
  993. function print_course_search() {
  994. throw new coding_exception('Function print_course_search() is removed, please use course renderer');
  995. }
  996. /**
  997. * @deprecated since 2.5
  998. */
  999. function print_my_moodle() {
  1000. throw new coding_exception('Function print_my_moodle() is removed, please use course renderer ' .
  1001. 'function frontpage_my_courses()');
  1002. }
  1003. /**
  1004. * @deprecated since 2.5
  1005. */
  1006. function print_remote_course() {
  1007. throw new coding_exception('Function print_remote_course() is removed, please use course renderer');
  1008. }
  1009. /**
  1010. * @deprecated since 2.5
  1011. */
  1012. function print_remote_host() {
  1013. throw new coding_exception('Function print_remote_host() is removed, please use course renderer');
  1014. }
  1015. /**
  1016. * @deprecated since 2.5
  1017. */
  1018. function print_whole_category_list() {
  1019. throw new coding_exception('Function print_whole_category_list() is removed, please use course renderer');
  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. * @deprecated since 2.5
  1029. */
  1030. function get_course_category_tree() {
  1031. throw new coding_exception('Function get_course_category_tree() is removed, please use course ' .
  1032. 'renderer or core_course_category class, see function phpdocs for more info');
  1033. }
  1034. /**
  1035. * @deprecated since 2.5
  1036. */
  1037. function print_courses() {
  1038. throw new coding_exception('Function print_courses() is removed, please use course renderer');
  1039. }
  1040. /**
  1041. * @deprecated since 2.5
  1042. */
  1043. function print_course() {
  1044. throw new coding_exception('Function print_course() is removed, please use course renderer');
  1045. }
  1046. /**
  1047. * @deprecated since 2.5
  1048. */
  1049. function get_category_courses_array() {
  1050. throw new coding_exception('Function get_category_courses_array() is removed, please use methods of ' .
  1051. 'core_course_category class');
  1052. }
  1053. /**
  1054. * @deprecated since 2.5
  1055. */
  1056. function get_category_courses_array_recursively() {
  1057. throw new coding_exception('Function get_category_courses_array_recursively() is removed, please use ' .
  1058. 'methods of core_course_category class', DEBUG_DEVELOPER);
  1059. }
  1060. /**
  1061. * @deprecated since Moodle 2.5 MDL-27814 - please do not use this function any more.
  1062. */
  1063. function blog_get_context_url() {
  1064. throw new coding_exception('Function blog_get_context_url() is removed, getting params from context is not reliable for blogs.');
  1065. }
  1066. /**
  1067. * @deprecated since 2.5
  1068. */
  1069. function get_courses_wmanagers() {
  1070. throw new coding_exception('Function get_courses_wmanagers() is removed, please use ' .
  1071. 'core_course_category::get_courses()');
  1072. }
  1073. /**
  1074. * @deprecated since 2.5
  1075. */
  1076. function convert_tree_to_html() {
  1077. throw new coding_exception('Function convert_tree_to_html() is removed. Consider using class tabtree and core_renderer::render_tabtree()');
  1078. }
  1079. /**
  1080. * @deprecated since 2.5
  1081. */
  1082. function convert_tabrows_to_tree() {
  1083. throw new coding_exception('Function convert_tabrows_to_tree() is removed. Consider using class tabtree');
  1084. }
  1085. /**
  1086. * @deprecated since 2.5 - do not use, the textrotate.js will work it out automatically
  1087. */
  1088. function can_use_rotated_text() {
  1089. debugging('can_use_rotated_text() is removed. JS feature detection is used automatically.');
  1090. }
  1091. /**
  1092. * @deprecated since Moodle 2.2 MDL-35009 - please do not use this function any more.
  1093. */
  1094. function get_context_instance_by_id() {
  1095. throw new coding_exception('get_context_instance_by_id() is now removed, please use context::instance_by_id($id) instead.');
  1096. }
  1097. /**
  1098. * Returns system context or null if can not be created yet.
  1099. *
  1100. * @see context_system::instance()
  1101. * @deprecated since 2.2
  1102. * @param bool $cache use caching
  1103. * @return context system context (null if context table not created yet)
  1104. */
  1105. function get_system_context($cache = true) {
  1106. debugging('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER);
  1107. return context_system::instance(0, IGNORE_MISSING, $cache);
  1108. }
  1109. /**
  1110. * @deprecated since 2.2, use $context->get_parent_context_ids() instead
  1111. */
  1112. function get_parent_contexts() {
  1113. throw new coding_exception('get_parent_contexts() is removed, please use $context->get_parent_context_ids() instead.');
  1114. }
  1115. /**
  1116. * @deprecated since Moodle 2.2
  1117. */
  1118. function get_parent_contextid() {
  1119. throw new coding_exception('get_parent_contextid() is removed, please use $context->get_parent_context() instead.');
  1120. }
  1121. /**
  1122. * @deprecated since 2.2
  1123. */
  1124. function get_child_contexts() {
  1125. throw new coding_exception('get_child_contexts() is removed, please use $context->get_child_contexts() instead.');
  1126. }
  1127. /**
  1128. * @deprecated since 2.2
  1129. */
  1130. function create_contexts() {
  1131. throw new coding_exception('create_contexts() is removed, please use context_helper::create_instances() instead.');
  1132. }
  1133. /**
  1134. * @deprecated since 2.2
  1135. */
  1136. function cleanup_contexts() {
  1137. throw new coding_exception('cleanup_contexts() is removed, please use context_helper::cleanup_instances() instead.');
  1138. }
  1139. /**
  1140. * @deprecated since 2.2
  1141. */
  1142. function build_context_path() {
  1143. throw new coding_exception('build_context_path() is removed, please use context_helper::build_all_paths() instead.');
  1144. }
  1145. /**
  1146. * @deprecated since 2.2
  1147. */
  1148. function rebuild_contexts() {
  1149. throw new coding_exception('rebuild_contexts() is removed, please use $context->reset_paths(true) instead.');
  1150. }
  1151. /**
  1152. * @deprecated since Moodle 2.2
  1153. */
  1154. function preload_course_contexts() {
  1155. throw new coding_exception('preload_course_contexts() is removed, please use context_helper::preload_course() instead.');
  1156. }
  1157. /**
  1158. * @deprecated since Moodle 2.2
  1159. */
  1160. function context_moved() {
  1161. throw new coding_exception('context_moved() is removed, please use context::update_moved() instead.');
  1162. }
  1163. /**
  1164. * @deprecated since 2.2
  1165. */
  1166. function fetch_context_capabilities() {
  1167. throw new coding_exception('fetch_context_capabilities() is removed, please use $context->get_capabilities() instead.');
  1168. }
  1169. /**
  1170. * @deprecated since 2.2
  1171. */
  1172. function context_instance_preload() {
  1173. throw new coding_exception('context_instance_preload() is removed, please use context_helper::preload_from_record() instead.');
  1174. }
  1175. /**
  1176. * @deprecated since 2.2
  1177. */
  1178. function get_contextlevel_name() {
  1179. throw new coding_exception('get_contextlevel_name() is removed, please use context_helper::get_level_name() instead.');
  1180. }
  1181. /**
  1182. * @deprecated since 2.2
  1183. */
  1184. function print_context_name() {
  1185. throw new coding_exception('print_context_name() is removed, please use $context->get_context_name() instead.');
  1186. }
  1187. /**
  1188. * @deprecated since 2.2, use $context->mark_dirty() instead
  1189. */
  1190. function mark_context_dirty() {
  1191. throw new coding_exception('mark_context_dirty() is removed, please use $context->mark_dirty() instead.');
  1192. }
  1193. /**
  1194. * @deprecated since Moodle 2.2
  1195. */
  1196. function delete_context() {
  1197. throw new coding_exception('delete_context() is removed, please use context_helper::delete_instance() ' .
  1198. 'or $context->delete_content() instead.');
  1199. }
  1200. /**
  1201. * @deprecated since 2.2
  1202. */
  1203. function get_context_url() {
  1204. throw new coding_exception('get_context_url() is removed, please use $context->get_url() instead.');
  1205. }
  1206. /**
  1207. * @deprecated since 2.2
  1208. */
  1209. function get_course_context() {
  1210. throw new coding_exception('get_course_context() is removed, please use $context->get_course_context(true) instead.');
  1211. }
  1212. /**
  1213. * @deprecated since 2.2
  1214. */
  1215. function get_user_courses_bycap() {
  1216. throw new coding_exception('get_user_courses_bycap() is removed, please use enrol_get_users_courses() instead.');
  1217. }
  1218. /**
  1219. * @deprecated since Moodle 2.2
  1220. */
  1221. function get_role_context_caps() {
  1222. throw new coding_exception('get_role_context_caps() is removed, it is really slow. Don\'t use it.');
  1223. }
  1224. /**
  1225. * @deprecated since 2.2
  1226. */
  1227. function get_courseid_from_context() {
  1228. throw new coding_exception('get_courseid_from_context() is removed, please use $context->get_course_context(false) instead.');
  1229. }
  1230. /**
  1231. * @deprecated since 2.2
  1232. */
  1233. function context_instance_preload_sql() {
  1234. throw new coding_exception('context_instance_preload_sql() is removed, please use context_helper::get_preload_record_columns_sql() instead.');
  1235. }
  1236. /**
  1237. * @deprecated since 2.2
  1238. */
  1239. function get_related_contexts_string() {
  1240. throw new coding_exception('get_related_contexts_string() is removed, please use $context->get_parent_context_ids(true) instead.');
  1241. }
  1242. /**
  1243. * @deprecated since 2.6
  1244. */
  1245. function get_plugin_list_with_file() {
  1246. throw new coding_exception('get_plugin_list_with_file() is removed, please use core_component::get_plugin_list_with_file() instead.');
  1247. }
  1248. /**
  1249. * @deprecated since 2.6
  1250. */
  1251. function check_browser_operating_system() {
  1252. throw new coding_exception('check_browser_operating_system is removed, please update your code to use core_useragent instead.');
  1253. }
  1254. /**
  1255. * @deprecated since 2.6
  1256. */
  1257. function check_browser_version() {
  1258. throw new coding_exception('check_browser_version is removed, please update your code to use core_useragent instead.');
  1259. }
  1260. /**
  1261. * @deprecated since 2.6
  1262. */
  1263. function get_device_type() {
  1264. throw new coding_exception('get_device_type is removed, please update your code to use core_useragent instead.');
  1265. }
  1266. /**
  1267. * @deprecated since 2.6
  1268. */
  1269. function get_device_type_list() {
  1270. throw new coding_exception('get_device_type_list is removed, please update your code to use core_useragent instead.');
  1271. }
  1272. /**
  1273. * @deprecated since 2.6
  1274. */
  1275. function get_selected_theme_for_device_type() {
  1276. throw new coding_exception('get_selected_theme_for_device_type is removed, please update your code to use core_useragent instead.');
  1277. }
  1278. /**
  1279. * @deprecated since 2.6
  1280. */
  1281. function get_device_cfg_var_name() {
  1282. throw new coding_exception('get_device_cfg_var_name is removed, please update your code to use core_useragent instead.');
  1283. }
  1284. /**
  1285. * @deprecated since 2.6
  1286. */
  1287. function set_user_device_type() {
  1288. throw new coding_exception('set_user_device_type is removed, please update your code to use core_useragent instead.');
  1289. }
  1290. /**
  1291. * @deprecated since 2.6
  1292. */
  1293. function get_user_device_type() {
  1294. throw new coding_exception('get_user_device_type is removed, please update your code to use core_useragent instead.');
  1295. }
  1296. /**
  1297. * @deprecated since 2.6
  1298. */
  1299. function get_browser_version_classes() {
  1300. throw new coding_exception('get_browser_version_classes is removed, please update your code to use core_useragent instead.');
  1301. }
  1302. /**
  1303. * @deprecated since Moodle 2.6
  1304. */
  1305. function generate_email_supportuser() {
  1306. throw new coding_exception('generate_email_supportuser is removed, please use core_user::get_support_user');
  1307. }
  1308. /**
  1309. * @deprecated since Moodle 2.6
  1310. */
  1311. function badges_get_issued_badge_info() {
  1312. throw new coding_exception('Function badges_get_issued_badge_info() is removed. Please use core_badges_assertion class and methods to generate badge assertion.');
  1313. }
  1314. /**
  1315. * @deprecated since 2.6
  1316. */
  1317. function can_use_html_editor() {
  1318. throw new coding_exception('can_use_html_editor is removed, please update your code to assume it returns true.');
  1319. }
  1320. /**
  1321. * @deprecated since Moodle 2.7, use {@link user_count_login_failures()} instead.
  1322. */
  1323. function count_login_failures() {
  1324. throw new coding_exception('count_login_failures() can not be used any more, please use user_count_login_failures().');
  1325. }
  1326. /**
  1327. * @deprecated since 2.7 MDL-33099/MDL-44088 - please do not use this function any more.
  1328. */
  1329. function ajaxenabled() {
  1330. throw new coding_exception('ajaxenabled() can not be used anymore. Update your code to work with JS at all times.');
  1331. }
  1332. /**
  1333. * @deprecated Since Moodle 2.7 MDL-44070
  1334. */
  1335. function coursemodule_visible_for_user() {
  1336. throw new coding_exception('coursemodule_visible_for_user() can not be used any more,
  1337. please use \core_availability\info_module::is_user_visible()');
  1338. }
  1339. /**
  1340. * @deprecated since Moodle 2.8 MDL-36014, MDL-35618 this functionality is removed
  1341. */
  1342. function enrol_cohort_get_cohorts() {
  1343. throw new coding_exception('Function enrol_cohort_get_cohorts() is removed, use '.
  1344. 'cohort_get_available_cohorts() instead');
  1345. }
  1346. /**
  1347. * @deprecated since Moodle 2.8 MDL-36014 please use cohort_can_view_cohort()
  1348. */
  1349. function enrol_cohort_can_view_cohort() {
  1350. throw new coding_exception('Function enrol_cohort_can_view_cohort() is removed, use cohort_can_view_cohort() instead');
  1351. }
  1352. /**
  1353. * @deprecated since Moodle 2.8 MDL-36014 use cohort_get_available_cohorts() instead
  1354. */
  1355. function cohort_get_visible_list() {
  1356. throw new coding_exception('Function cohort_get_visible_list() is removed. Please use function cohort_get_available_cohorts() ".
  1357. "that correctly checks capabilities.');
  1358. }
  1359. /**
  1360. * @deprecated since Moodle 2.8 MDL-35618 this functionality is removed
  1361. */
  1362. function enrol_cohort_enrol_all_users() {
  1363. throw new coding_exception('enrol_cohort_enrol_all_users() is removed. This functionality is moved to enrol_manual.');
  1364. }
  1365. /**
  1366. * @deprecated since Moodle 2.8 MDL-35618 this functionality is removed
  1367. */
  1368. function enrol_cohort_search_cohorts() {
  1369. throw new coding_exception('enrol_cohort_search_cohorts() is re…

Large files files are truncated, but you can click here to view the full file