PageRenderTime 61ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/deprecatedlib.php

https://bitbucket.org/moodle/moodle
PHP | 3551 lines | 1708 code | 485 blank | 1358 comment | 100 complexity | 36333e44b8188f25a2cd459f489584ba MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1, BSD-3-Clause, MIT, GPL-3.0

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

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

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