Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of https://github.com/moodle/moodle

  • Loading branch information...
commit 3a2b8bb09d6034db94060229898f895e970a1ad8 2 parents 81a0be7 + 87e9331
pcharsle pcharsle authored

Showing 2,988 changed files with 988 additions and 22,998 deletions. Show diff stats Hide diff stats

  1. +114 0 admin/plagiarism.php
  2. +3 2 admin/roles/usersroles.php
  3. +1 1  admin/settings/grades.php
  4. +3 3 admin/settings/plugins.php
  5. +2 0  admin/tool/uploaduser/index.php
  6. +16 17 admin/user/user_bulk_download.php
  7. +41 26 auth/db/auth.php
  8. +1 1  auth/fc/auth.php
  9. +3 3 auth/ldap/auth.php
  10. +1 1  auth/ldap/ntlmsso_attempt.php
  11. +1 1  auth/ldap/ntlmsso_finish.php
  12. +1 1  auth/ldap/ntlmsso_magic.php
  13. +3 3 auth/mnet/auth.php
  14. +1 1  auth/shibboleth/index.php
  15. +2 0  auth/upgrade.txt
  16. +2 1  backup/converter/moodle1/lib.php
  17. +23 7 backup/moodle2/restore_activity_task.class.php
  18. +22 7 backup/moodle2/restore_section_task.class.php
  19. +12 8 backup/util/ui/base_moodleform.class.php
  20. +2 2 blocks/community/block_community.php
  21. +1 1  blocks/news_items/block_news_items.php
  22. +1 1  comment/index.php
  23. +13 6 comment/lib.php
  24. +2 2 completion/criteria/completion_criteria_course.php
  25. +18 18 course/format/renderer.php
  26. +15 15 course/format/topics/renderer.php
  27. +0 16 course/lib.php
  28. +3 2 course/rest.php
  29. +3 1 course/view.php
  30. +3 1 enrol/authorize/locallib.php
  31. +7 1 enrol/imsenterprise/lib.php
  32. +2 0  enrol/manual/lib.php
  33. +3 3 enrol/manual/manage.php
  34. +1 0  enrol/self/edit_form.php
  35. +6 0 enrol/self/lang/en/enrol_self.php
  36. +15 5 enrol/self/lib.php
  37. +1 1  file.php
  38. +2 1  filter/algebra/algebradebug.php
  39. +1 0  filter/algebra/lang/en/filter_algebra.php
  40. +4 1 filter/manage.php
  41. +1 1  grade/edit/outcome/edit.php
  42. +1 0  grade/edit/tree/calculation.php
  43. +1 1  grade/edit/tree/index.php
  44. +2 1  grade/edit/tree/lib.php
  45. +15 37 grade/export/txt/grade_export_txt.php
  46. +3 1 grade/grading/form/guide/lib.php
  47. +4 3 grade/grading/form/rubric/renderer.php
  48. +1 1  grade/lib.php
  49. +2 1  grade/report/grader/lib.php
  50. +1 1  group/assign.php
  51. +1 2  group/autogroup.php
  52. +1 1  group/autogroup_form.php
  53. +1 1  group/delete.php
  54. +7 7 group/externallib.php
  55. +1 1  group/group.php
  56. +1 1  group/grouping.php
  57. +1 1  group/groupings.php
  58. +2 2 group/import.php
  59. +1 1  group/index.php
  60. +11 11 group/lib.php
  61. +1 1  group/members.php
  62. +1 1  group/overview.php
  63. +1 1  help.php
  64. +3 3 index.php
  65. +3 0  install/lang/cs/install.php
  66. +7 0 install/lang/lt/admin.php
  67. +1 0  install/lang/nl/langconfig.php
  68. +2 2 iplookup/index.php
  69. +2 2 lang/en/admin.php
  70. +1 0  lang/en/message.php
  71. +1 0  lang/en/moodle.php
  72. +1 0  lang/en/notes.php
  73. +1 1  lang/en/plagiarism.php
  74. +1 1  lib/accesslib.php
  75. +0 89 lib/adminlib.php
  76. +12 0 lib/authlib.php
  77. +191 0 lib/csvlib.class.php
  78. +13 0 lib/db/upgrade.php
  79. +3 3 lib/filelib.php
  80. +6 1 lib/form/editor.php
  81. +19 19 lib/formslib.php
  82. +31 2 lib/javascript-static.js
  83. +10 17 lib/medialib.php
  84. +19 3 lib/moodlelib.php
  85. +2 4 lib/outputrequirementslib.php
  86. +1 1  lib/setup.php
  87. +15 14 lib/tablelib.php
  88. +75 0 lib/tests/csvclass_test.php
  89. +3 3 lib/tests/medialib_test.php
  90. +1 1  lib/thirdpartylibs.xml
  91. +148 31 lib/webdavlib.php
  92. +0 199 lib/yui/3.5.1/build/align-plugin/align-plugin-debug.js
  93. +0 7 lib/yui/3.5.1/build/align-plugin/align-plugin-min.js
  94. +0 199 lib/yui/3.5.1/build/align-plugin/align-plugin.js
  95. +0 682 lib/yui/3.5.1/build/anim-base/anim-base-debug.js
  96. +0 7 lib/yui/3.5.1/build/anim-base/anim-base-min.js
  97. +0 681 lib/yui/3.5.1/build/anim-base/anim-base.js
  98. +0 54 lib/yui/3.5.1/build/anim-color/anim-color-debug.js
  99. +0 7 lib/yui/3.5.1/build/anim-color/anim-color-min.js
  100. +0 54 lib/yui/3.5.1/build/anim-color/anim-color.js
  101. +0 63 lib/yui/3.5.1/build/anim-curve/anim-curve-debug.js
  102. +0 7 lib/yui/3.5.1/build/anim-curve/anim-curve-min.js
  103. +0 63 lib/yui/3.5.1/build/anim-curve/anim-curve.js
  104. +0 356 lib/yui/3.5.1/build/anim-easing/anim-easing-debug.js
  105. +0 7 lib/yui/3.5.1/build/anim-easing/anim-easing-min.js
  106. +0 356 lib/yui/3.5.1/build/anim-easing/anim-easing.js
  107. +0 32 lib/yui/3.5.1/build/anim-node-plugin/anim-node-plugin-debug.js
  108. +0 7 lib/yui/3.5.1/build/anim-node-plugin/anim-node-plugin-min.js
  109. +0 32 lib/yui/3.5.1/build/anim-node-plugin/anim-node-plugin.js
  110. +0 44 lib/yui/3.5.1/build/anim-scroll/anim-scroll-debug.js
  111. +0 7 lib/yui/3.5.1/build/anim-scroll/anim-scroll-min.js
  112. +0 44 lib/yui/3.5.1/build/anim-scroll/anim-scroll.js
  113. +0 112 lib/yui/3.5.1/build/anim-shape-transform/anim-shape-transform-debug.js
  114. +0 7 lib/yui/3.5.1/build/anim-shape-transform/anim-shape-transform-min.js
  115. +0 112 lib/yui/3.5.1/build/anim-shape-transform/anim-shape-transform.js
  116. +0 32 lib/yui/3.5.1/build/anim-xy/anim-xy-debug.js
  117. +0 7 lib/yui/3.5.1/build/anim-xy/anim-xy-min.js
  118. +0 32 lib/yui/3.5.1/build/anim-xy/anim-xy.js
  119. +0 1,142 lib/yui/3.5.1/build/app-base/app-base-debug.js
  120. +0 7 lib/yui/3.5.1/build/app-base/app-base-min.js
  121. +0 1,142 lib/yui/3.5.1/build/app-base/app-base.js
  122. +0 7 lib/yui/3.5.1/build/app-transitions-css/app-transitions-css-min.css
  123. +0 24 lib/yui/3.5.1/build/app-transitions-css/app-transitions-css.css
  124. +0 358 lib/yui/3.5.1/build/app-transitions-native/app-transitions-native-debug.js
  125. +0 7 lib/yui/3.5.1/build/app-transitions-native/app-transitions-native-min.js
  126. +0 358 lib/yui/3.5.1/build/app-transitions-native/app-transitions-native.js
  127. +0 257 lib/yui/3.5.1/build/app-transitions/app-transitions-debug.js
  128. +0 7 lib/yui/3.5.1/build/app-transitions/app-transitions-min.js
  129. +0 257 lib/yui/3.5.1/build/app-transitions/app-transitions.js
  130. +0 367 lib/yui/3.5.1/build/array-extras/array-extras-debug.js
  131. +0 7 lib/yui/3.5.1/build/array-extras/array-extras-min.js
  132. +0 366 lib/yui/3.5.1/build/array-extras/array-extras.js
  133. +0 46 lib/yui/3.5.1/build/array-invoke/array-invoke-debug.js
  134. +0 7 lib/yui/3.5.1/build/array-invoke/array-invoke-min.js
  135. +0 46 lib/yui/3.5.1/build/array-invoke/array-invoke.js
  136. +0 93 lib/yui/3.5.1/build/arraylist-add/arraylist-add-debug.js
  137. +0 7 lib/yui/3.5.1/build/arraylist-add/arraylist-add-min.js
  138. +0 93 lib/yui/3.5.1/build/arraylist-add/arraylist-add.js
  139. +0 51 lib/yui/3.5.1/build/arraylist-filter/arraylist-filter-debug.js
  140. +0 7 lib/yui/3.5.1/build/arraylist-filter/arraylist-filter-min.js
  141. +0 51 lib/yui/3.5.1/build/arraylist-filter/arraylist-filter.js
  142. +0 220 lib/yui/3.5.1/build/arraylist/arraylist-debug.js
  143. +0 7 lib/yui/3.5.1/build/arraylist/arraylist-min.js
  144. +0 220 lib/yui/3.5.1/build/arraylist/arraylist.js
  145. +0 71 lib/yui/3.5.1/build/arraysort/arraysort-debug.js
  146. +0 7 lib/yui/3.5.1/build/arraysort/arraysort-min.js
  147. +0 71 lib/yui/3.5.1/build/arraysort/arraysort.js
  148. +0 7 lib/yui/3.5.1/build/assets/skins/sam/autocomplete-list.css
  149. +0 7 lib/yui/3.5.1/build/assets/skins/sam/calendar-base.css
  150. +0 7 lib/yui/3.5.1/build/assets/skins/sam/calendar.css
  151. +0 7 lib/yui/3.5.1/build/assets/skins/sam/calendarnavigator.css
  152. +0 7 lib/yui/3.5.1/build/assets/skins/sam/console-filters.css
  153. +0 7 lib/yui/3.5.1/build/assets/skins/sam/console.css
  154. +0 8 lib/yui/3.5.1/build/assets/skins/sam/datatable-base-deprecated.css
  155. +0 7 lib/yui/3.5.1/build/assets/skins/sam/datatable-base.css
  156. +0 7 lib/yui/3.5.1/build/assets/skins/sam/datatable-message.css
  157. +0 7 lib/yui/3.5.1/build/assets/skins/sam/datatable-scroll.css
  158. +0 7 lib/yui/3.5.1/build/assets/skins/sam/datatable-sort.css
  159. +0 7 lib/yui/3.5.1/build/assets/skins/sam/dial.css
  160. +0 7 lib/yui/3.5.1/build/assets/skins/sam/node-flick.css
  161. +0 7 lib/yui/3.5.1/build/assets/skins/sam/node-menunav.css
  162. +0 7 lib/yui/3.5.1/build/assets/skins/sam/overlay.css
  163. +0 7 lib/yui/3.5.1/build/assets/skins/sam/panel.css
  164. +0 7 lib/yui/3.5.1/build/assets/skins/sam/resize-base.css
  165. +0 7 lib/yui/3.5.1/build/assets/skins/sam/scrollview-base.css
  166. +0 7 lib/yui/3.5.1/build/assets/skins/sam/scrollview-list.css
  167. +0 7 lib/yui/3.5.1/build/assets/skins/sam/scrollview-scrollbars.css
  168. +0 35 lib/yui/3.5.1/build/assets/skins/sam/skin.css
  169. +0 7 lib/yui/3.5.1/build/assets/skins/sam/slider-base.css
  170. +0 7 lib/yui/3.5.1/build/assets/skins/sam/tabview.css
  171. +0 7 lib/yui/3.5.1/build/assets/skins/sam/test-console.css
  172. +0 7 lib/yui/3.5.1/build/assets/skins/sam/test.css
  173. +0 7 lib/yui/3.5.1/build/assets/skins/sam/widget-base.css
  174. +0 7 lib/yui/3.5.1/build/assets/skins/sam/widget-buttons.css
  175. +0 7 lib/yui/3.5.1/build/assets/skins/sam/widget-modality.css
  176. +0 7 lib/yui/3.5.1/build/assets/skins/sam/widget-stack.css
  177. +0 528 lib/yui/3.5.1/build/async-queue/async-queue-debug.js
  178. +0 7 lib/yui/3.5.1/build/async-queue/async-queue-min.js
  179. +0 528 lib/yui/3.5.1/build/async-queue/async-queue.js
  180. +0 111 lib/yui/3.5.1/build/attribute-base/attribute-base-debug.js
  181. +0 7 lib/yui/3.5.1/build/attribute-base/attribute-base-min.js
  182. +0 111 lib/yui/3.5.1/build/attribute-base/attribute-base.js
  183. +0 132 lib/yui/3.5.1/build/attribute-complex/attribute-complex-debug.js
  184. +0 7 lib/yui/3.5.1/build/attribute-complex/attribute-complex-min.js
  185. +0 132 lib/yui/3.5.1/build/attribute-complex/attribute-complex.js
  186. +0 1,029 lib/yui/3.5.1/build/attribute-core/attribute-core-debug.js
  187. +0 7 lib/yui/3.5.1/build/attribute-core/attribute-core-min.js
  188. +0 1,017 lib/yui/3.5.1/build/attribute-core/attribute-core.js
  189. +0 180 lib/yui/3.5.1/build/attribute-events/attribute-events-debug.js
  190. +0 7 lib/yui/3.5.1/build/attribute-events/attribute-events-min.js
  191. +0 179 lib/yui/3.5.1/build/attribute-events/attribute-events.js
  192. +0 150 lib/yui/3.5.1/build/attribute-extras/attribute-extras-debug.js
  193. +0 7 lib/yui/3.5.1/build/attribute-extras/attribute-extras-min.js
  194. +0 149 lib/yui/3.5.1/build/attribute-extras/attribute-extras.js
  195. +0 1,552 lib/yui/3.5.1/build/autocomplete-base/autocomplete-base-debug.js
  196. +0 8 lib/yui/3.5.1/build/autocomplete-base/autocomplete-base-min.js
  197. +0 1,544 lib/yui/3.5.1/build/autocomplete-base/autocomplete-base.js
  198. +0 142 lib/yui/3.5.1/build/autocomplete-filters-accentfold/autocomplete-filters-accentfold-debug.js
  199. +0 7 lib/yui/3.5.1/build/autocomplete-filters-accentfold/autocomplete-filters-accentfold-min.js
  200. +0 142 lib/yui/3.5.1/build/autocomplete-filters-accentfold/autocomplete-filters-accentfold.js
  201. +0 245 lib/yui/3.5.1/build/autocomplete-filters/autocomplete-filters-debug.js
  202. +0 7 lib/yui/3.5.1/build/autocomplete-filters/autocomplete-filters-min.js
  203. +0 245 lib/yui/3.5.1/build/autocomplete-filters/autocomplete-filters.js
  204. +0 113 lib/yui/3.5.1/build/autocomplete-highlighters-accentfold/autocomplete-highlighters-accentfold-debug.js
  205. +0 7 lib/yui/3.5.1/build/autocomplete-highlighters-accentfold/autocomplete-highlighters-accentfold-min.js
  206. +0 113 lib/yui/3.5.1/build/autocomplete-highlighters-accentfold/autocomplete-highlighters-accentfold.js
  207. +0 205 lib/yui/3.5.1/build/autocomplete-highlighters/autocomplete-highlighters-debug.js
  208. +0 7 lib/yui/3.5.1/build/autocomplete-highlighters/autocomplete-highlighters-min.js
  209. +0 205 lib/yui/3.5.1/build/autocomplete-highlighters/autocomplete-highlighters.js
  210. +0 192 lib/yui/3.5.1/build/autocomplete-list-keys/autocomplete-list-keys-debug.js
  211. +0 7 lib/yui/3.5.1/build/autocomplete-list-keys/autocomplete-list-keys-min.js
  212. +0 192 lib/yui/3.5.1/build/autocomplete-list-keys/autocomplete-list-keys.js
  213. +0 33 lib/yui/3.5.1/build/autocomplete-list/assets/autocomplete-list-core.css
  214. +0 57 lib/yui/3.5.1/build/autocomplete-list/assets/skins/night/autocomplete-list-skin.css
  215. +0 7 lib/yui/3.5.1/build/autocomplete-list/assets/skins/night/autocomplete-list.css
  216. +0 23 lib/yui/3.5.1/build/autocomplete-list/assets/skins/sam/autocomplete-list-skin.css
  217. +0 7 lib/yui/3.5.1/build/autocomplete-list/assets/skins/sam/autocomplete-list.css
  218. +0 893 lib/yui/3.5.1/build/autocomplete-list/autocomplete-list-debug.js
  219. +0 8 lib/yui/3.5.1/build/autocomplete-list/autocomplete-list-min.js
  220. +0 893 lib/yui/3.5.1/build/autocomplete-list/autocomplete-list.js
  221. +0 7 lib/yui/3.5.1/build/autocomplete-list/lang/autocomplete-list.js
  222. +0 7 lib/yui/3.5.1/build/autocomplete-list/lang/autocomplete-list_en.js
  223. +0 54 lib/yui/3.5.1/build/autocomplete-plugin/autocomplete-plugin-debug.js
  224. +0 7 lib/yui/3.5.1/build/autocomplete-plugin/autocomplete-plugin-min.js
  225. +0 54 lib/yui/3.5.1/build/autocomplete-plugin/autocomplete-plugin.js
  226. +0 482 lib/yui/3.5.1/build/autocomplete-sources/autocomplete-sources-debug.js
  227. +0 7 lib/yui/3.5.1/build/autocomplete-sources/autocomplete-sources-min.js
  228. +0 482 lib/yui/3.5.1/build/autocomplete-sources/autocomplete-sources.js
  229. +0 354 lib/yui/3.5.1/build/base-base/base-base-debug.js
  230. +0 7 lib/yui/3.5.1/build/base-base/base-base-min.js
  231. +0 352 lib/yui/3.5.1/build/base-base/base-base.js
  232. +0 428 lib/yui/3.5.1/build/base-build/base-build-debug.js
  233. +0 7 lib/yui/3.5.1/build/base-build/base-build-min.js
  234. +0 428 lib/yui/3.5.1/build/base-build/base-build.js
Sorry, we could not display the entire diff because too many files (2,988) changed.
114 admin/plagiarism.php
... ... @@ -0,0 +1,114 @@
  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 +/**
  18 + * Provides an overview of installed plagiarism plugins
  19 + *
  20 + * Displays the list of found plagiarism plugins, their version (if found) and
  21 + * a link to delete the plagiarism plugin.
  22 + *
  23 + * @see http://docs.moodle.org/dev/Plagiarism_API
  24 + * @package admin
  25 + * @copyright 2012 Dan Marsden <dan@danmarsden.com>
  26 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  27 + */
  28 +
  29 +require_once(dirname(dirname(__FILE__)) . '/config.php');
  30 +require_once($CFG->libdir.'/adminlib.php');
  31 +require_once($CFG->libdir.'/tablelib.php');
  32 +
  33 +admin_externalpage_setup('manageplagiarismplugins');
  34 +
  35 +$delete = optional_param('delete', '', PARAM_PLUGIN);
  36 +$confirm = optional_param('confirm', false, PARAM_BOOL);
  37 +
  38 +if (!empty($delete) and confirm_sesskey()) { // If data submitted, then process and store.
  39 + echo $OUTPUT->header();
  40 + echo $OUTPUT->heading(get_string('manageplagiarism', 'plagiarism'));
  41 +
  42 + if (!$confirm) {
  43 + if (get_string_manager()->string_exists('pluginname', 'plagiarism_' . $delete)) {
  44 + $strpluginname = get_string('pluginname', 'plagiarism_' . $delete);
  45 + } else {
  46 + $strpluginname = $delete;
  47 + }
  48 + echo $OUTPUT->confirm(get_string('plagiarismplugindeleteconfirm', 'plagiarism', $strpluginname),
  49 + new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
  50 + $PAGE->url);
  51 + echo $OUTPUT->footer();
  52 + die();
  53 +
  54 + } else {
  55 + uninstall_plugin('plagiarism', $delete);
  56 + $a = new stdclass();
  57 + $a->name = $delete;
  58 + $pluginlocation = get_plugin_types();
  59 + $a->directory = $pluginlocation['plagiarism'] . '/' . $delete;
  60 + echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
  61 + echo $OUTPUT->continue_button($PAGE->url);
  62 + echo $OUTPUT->footer();
  63 + die();
  64 + }
  65 +}
  66 +
  67 +echo $OUTPUT->header();
  68 +
  69 +// Print the table of all installed plagiarism plugins.
  70 +
  71 +$txt = get_strings(array('settings', 'name', 'version', 'delete'));
  72 +
  73 +$plagiarismplugins = get_plugin_list('plagiarism');
  74 +if (empty($plagiarismplugins)) {
  75 + echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
  76 + echo $OUTPUT->footer();
  77 + exit;
  78 +}
  79 +
  80 +echo $OUTPUT->heading(get_string('availableplugins', 'plagiarism'), 3, 'main');
  81 +echo $OUTPUT->box_start('generalbox authsui');
  82 +
  83 +$table = new html_table();
  84 +$table->head = array($txt->name, $txt->version, $txt->delete, $txt->settings);
  85 +$table->colclasses = array('mdl-left', 'mdl-align', 'mdl-align', 'mdl-align');
  86 +$table->data = array();
  87 +$table->attributes['class'] = 'manageplagiarismtable generaltable';
  88 +
  89 +// Iterate through auth plugins and add to the display table.
  90 +$authcount = count($plagiarismplugins);
  91 +foreach ($plagiarismplugins as $plugin => $dir) {
  92 + if (file_exists($dir.'/settings.php')) {
  93 + $displayname = "<span>".get_string($plugin, 'plagiarism_'.$plugin)."</span>";
  94 + // Settings link.
  95 + $url = new moodle_url("/plagiarism/$plugin/settings.php");
  96 + $settings = html_writer::link($url, $txt->settings);
  97 + // Get version.
  98 + $version = get_config('plagiarism_' . $plugin);
  99 + if (!empty($version->version)) {
  100 + $version = $version->version;
  101 + } else {
  102 + $version = '?';
  103 + }
  104 + // Delete link.
  105 + $delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
  106 + $delete = html_writer::link($delete, get_string('delete'));
  107 + $table->data[] = array($displayname, $version, $delete, $settings);
  108 + }
  109 +}
  110 +echo html_writer::table($table);
  111 +echo get_string('configplagiarismplugins', 'plagiarism');
  112 +echo $OUTPUT->box_end();
  113 +
  114 +echo $OUTPUT->footer();
5 admin/roles/usersroles.php
@@ -165,7 +165,8 @@ function print_report_tree($contextid, $contexts, $systemcontext, $fullname, $al
165 165 $context = context::instance_by_id($contextid);
166 166
167 167 // Print the context name.
168   - echo $OUTPUT->heading($context->get_context_name(), 4, 'contextname');
  168 + echo $OUTPUT->heading(html_writer::link($context->get_url(), $context->get_context_name()),
  169 + 4, 'contextname');
169 170
170 171 // If there are any role assignments here, print them.
171 172 foreach ($contexts[$contextid]->roleassignments as $ra) {
@@ -186,7 +187,7 @@ function print_report_tree($contextid, $contexts, $systemcontext, $fullname, $al
186 187 }
187 188 $a = new stdClass;
188 189 $a->fullname = $fullname;
189   - $a->contextlevel = get_contextlevel_name($context->contextlevel);
  190 + $a->contextlevel = $context->get_level_name();
190 191 if ($context->contextlevel == CONTEXT_SYSTEM) {
191 192 $strgoto = get_string('gotoassignsystemroles', 'role');
192 193 $strcheck = get_string('checksystempermissionsfor', 'role', $a);
2  admin/settings/grades.php
@@ -60,7 +60,7 @@
60 60
61 61 $temp->add(new admin_setting_configtext('grade_export_userprofilefields', new lang_string('gradeexportuserprofilefields', 'grades'), new lang_string('gradeexportuserprofilefields_desc', 'grades'), 'firstname,lastname,idnumber,institution,department,email', PARAM_TEXT));
62 62
63   - $temp->add(new admin_setting_configtext('grade_export_customprofilefields', new lang_string('gradeexportcustomprofilefields', 'grades'), new lang_string('gradeexportcustomprofilefields_desc', 'grades'), null, PARAM_TEXT));
  63 + $temp->add(new admin_setting_configtext('grade_export_customprofilefields', new lang_string('gradeexportcustomprofilefields', 'grades'), new lang_string('gradeexportcustomprofilefields_desc', 'grades'), '', PARAM_TEXT));
64 64
65 65 $temp->add(new admin_setting_configcheckbox('recovergradesdefault', new lang_string('recovergradesdefault', 'grades'), new lang_string('recovergradesdefault_help', 'grades'), 0));
66 66
6 admin/settings/plugins.php
@@ -422,9 +422,9 @@
422 422 // Plagiarism plugin settings
423 423 if ($hassiteconfig && !empty($CFG->enableplagiarism)) {
424 424 $ADMIN->add('modules', new admin_category('plagiarism', new lang_string('plagiarism', 'plagiarism')));
425   - $temp = new admin_settingpage('plagiarismsettings', new lang_string('plagiarismsettings', 'plagiarism'));
426   - $temp->add(new admin_setting_manageplagiarism());
427   - $ADMIN->add('plagiarism', $temp);
  425 + $ADMIN->add('plagiarism', new admin_externalpage('manageplagiarismplugins', new lang_string('manageplagiarism', 'plagiarism'),
  426 + $CFG->wwwroot . '/' . $CFG->admin . '/plagiarism.php'));
  427 +
428 428 foreach (get_plugin_list('plagiarism') as $plugin => $plugindir) {
429 429 if (file_exists($plugindir.'/settings.php')) {
430 430 $ADMIN->add('plagiarism', new admin_externalpage('plagiarism'.$plugin, new lang_string($plugin, 'plagiarism_'.$plugin), "$CFG->wwwroot/plagiarism/$plugin/settings.php", 'moodle/site:config'));
2  admin/tool/uploaduser/index.php
@@ -857,6 +857,8 @@
857 857 if ($duration > 0) { // sanity check
858 858 $timeend = $today + $duration;
859 859 }
  860 + } else if ($manualcache[$courseid]->enrolperiod > 0) {
  861 + $timeend = $today + $manualcache[$courseid]->enrolperiod;
860 862 }
861 863
862 864 $manual->enrol_user($manualcache[$courseid], $user->id, $rid, $today, $timeend);
33 admin/user/user_bulk_download.php
@@ -148,23 +148,13 @@ function user_download_csv($fields) {
148 148 global $CFG, $SESSION, $DB;
149 149
150 150 require_once($CFG->dirroot.'/user/profile/lib.php');
  151 + require_once($CFG->libdir . '/csvlib.class.php');
151 152
152   - $filename = clean_filename(get_string('users').'.csv');
  153 + $filename = clean_filename(get_string('users'));
153 154
154   - header("Content-Type: application/download\n");
155   - header("Content-Disposition: attachment; filename=\"$filename\"");
156   - header("Expires: 0");
157   - header("Cache-Control: must-revalidate,post-check=0,pre-check=0");
158   - header("Pragma: public");
159   -
160   - $delimiter = get_string('listsep', 'langconfig');
161   - $encdelim = '&#'.ord($delimiter);
162   -
163   - $row = array();
164   - foreach ($fields as $fieldname) {
165   - $row[] = str_replace($delimiter, $encdelim, $fieldname);
166   - }
167   - echo implode($delimiter, $row)."\n";
  155 + $csvexport = new csv_export_writer();
  156 + $csvexport->set_filename($filename);
  157 + $csvexport->add_data($fields);
168 158
169 159 foreach ($SESSION->bulk_users as $userid) {
170 160 $row = array();
@@ -172,10 +162,19 @@ function user_download_csv($fields) {
172 162 continue;
173 163 }
174 164 profile_load_data($user);
  165 + $userprofiledata = array();
175 166 foreach ($fields as $field=>$unused) {
176   - $row[] = str_replace($delimiter, $encdelim, $user->$field);
  167 + // Custom user profile textarea fields come in an array
  168 + // The first element is the text and the second is the format.
  169 + // We only take the text.
  170 + if (is_array($user->$field)) {
  171 + $userprofiledata[] = reset($user->$field);
  172 + } else {
  173 + $userprofiledata[] = $user->$field;
  174 + }
177 175 }
178   - echo implode($delimiter, $row)."\n";
  176 + $csvexport->add_data($userprofiledata);
179 177 }
  178 + $csvexport->download_file();
180 179 die;
181 180 }
67 auth/db/auth.php
@@ -224,25 +224,31 @@ function sync_users($do_updates=false, $verbose=false) {
224 224 // delete obsolete internal users
225 225 if (!empty($this->config->removeuser)) {
226 226
  227 + $suspendselect = "";
  228 + if ($this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
  229 + $suspendselect = "AND u.suspended = 0";
  230 + }
  231 +
227 232 // find obsolete users
228 233 if (count($userlist)) {
229 234 list($notin_sql, $params) = $DB->get_in_or_equal($userlist, SQL_PARAMS_NAMED, 'u', false);
230 235 $params['authtype'] = $this->authtype;
231 236 $sql = "SELECT u.*
232 237 FROM {user} u
233   - WHERE u.auth=:authtype AND u.deleted=0 AND u.username $notin_sql";
  238 + WHERE u.auth=:authtype AND u.deleted=0 AND u.mnethostid=:mnethostid $suspendselect AND u.username $notin_sql";
234 239 } else {
235 240 $sql = "SELECT u.*
236 241 FROM {user} u
237   - WHERE u.auth=:authtype AND u.deleted=0";
  242 + WHERE u.auth=:authtype AND u.deleted=0 AND u.mnethostid=:mnethostid $suspendselect";
238 243 $params = array();
239 244 $params['authtype'] = $this->authtype;
240 245 }
  246 + $params['mnethostid'] = $CFG->mnet_localhost_id;
241 247 $remove_users = $DB->get_records_sql($sql, $params);
242 248
243 249 if (!empty($remove_users)) {
244 250 if ($verbose) {
245   - mtrace(print_string('auth_dbuserstoremove','auth_db', count($remove_users)));
  251 + mtrace(get_string('auth_dbuserstoremove','auth_db', count($remove_users)));
246 252 }
247 253
248 254 foreach ($remove_users as $user) {
@@ -254,7 +260,7 @@ function sync_users($do_updates=false, $verbose=false) {
254 260 } else if ($this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
255 261 $updateuser = new stdClass();
256 262 $updateuser->id = $user->id;
257   - $updateuser->auth = 'nologin';
  263 + $updateuser->suspended = 1;
258 264 $updateuser->timemodified = time();
259 265 $DB->update_record('user', $updateuser);
260 266 if ($verbose) {
@@ -324,11 +330,15 @@ function sync_users($do_updates=false, $verbose=false) {
324 330 ///
325 331 // NOTE: this is very memory intensive
326 332 // and generally inefficient
327   - $sql = 'SELECT u.id, u.username
328   - FROM {user} u
329   - WHERE u.auth=\'' . $this->authtype . '\' AND u.deleted=\'0\'';
  333 + $suspendselect = "";
  334 + if ($this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
  335 + $suspendselect = "AND u.suspended = 0";
  336 + }
  337 + $sql = "SELECT u.id, u.username
  338 + FROM {user} u
  339 + WHERE u.auth=:authtype AND u.deleted='0' AND mnethostid=:mnethostid $suspendselect";
330 340
331   - $users = $DB->get_records_sql($sql);
  341 + $users = $DB->get_records_sql($sql, array('authtype'=>$this->authtype, 'mnethostid'=>$CFG->mnet_localhost_id));
332 342
333 343 // simplify down to usernames
334 344 $usernames = array();
@@ -349,9 +359,20 @@ function sync_users($do_updates=false, $verbose=false) {
349 359 $transaction = $DB->start_delegated_transaction();
350 360 foreach($add_users as $user) {
351 361 $username = $user;
352   - $user = $this->get_userinfo_asobj($user);
  362 + if ($this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
  363 + if ($old_user = $DB->get_record('user', array('username'=>$username, 'deleted'=>0, 'suspended'=>1, 'mnethostid'=>$CFG->mnet_localhost_id, 'auth'=>$this->authtype))) {
  364 + $DB->set_field('user', 'suspended', 0, array('id'=>$old_user->id));
  365 + if ($verbose) {
  366 + mtrace("\t".get_string('auth_dbreviveduser', 'auth_db', array('name'=>$username, 'id'=>$old_user->id)));
  367 + }
  368 + continue;
  369 + }
  370 + }
  371 +
  372 + // Do not try to undelete users here, instead select suspending if you ever expect users will reappear.
353 373
354 374 // prep a few params
  375 + $user = $this->get_userinfo_asobj($user);
355 376 $user->username = $username;
356 377 $user->confirmed = 1;
357 378 $user->auth = $this->authtype;
@@ -359,29 +380,23 @@ function sync_users($do_updates=false, $verbose=false) {
359 380 if (empty($user->lang)) {
360 381 $user->lang = $CFG->lang;
361 382 }
362   -
363   - // maybe the user has been deleted before
364   - if ($old_user = $DB->get_record('user', array('username'=>$user->username, 'deleted'=>1, 'mnethostid'=>$user->mnethostid, 'auth'=>$user->auth))) {
365   - // note: this undeleting is deprecated and will be eliminated soon
366   - $DB->set_field('user', 'deleted', 0, array('id'=>$old_user->id));
367   - $DB->set_field('user', 'timemodified', time(), array('id'=>$old_user->id));
368   - if ($verbose) {
369   - mtrace("\t".get_string('auth_dbreviveduser', 'auth_db', array('name'=>$old_user->username, 'id'=>$old_user->id)));
370   - }
371   -
372   - } else {
373   - $user->timecreated = time();
374   - $user->timemodified = $user->timecreated;
  383 + $user->timecreated = time();
  384 + $user->timemodified = $user->timecreated;
  385 + try {
375 386 $id = $DB->insert_record ('user', $user); // it is truly a new user
376 387 if ($verbose) {
377 388 mtrace("\t".get_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)));
378 389 }
379   - // if relevant, tag for password generation
380   - if ($this->is_internal()) {
381   - set_user_preference('auth_forcepasswordchange', 1, $id);
382   - set_user_preference('create_password', 1, $id);
  390 + } catch (moodle_exception $e) {
  391 + if ($verbose) {
  392 + mtrace("\t".get_string('auth_dbinsertusererror', 'auth_db', $user->username));
383 393 }
384 394 }
  395 + // if relevant, tag for password generation
  396 + if ($this->is_internal()) {
  397 + set_user_preference('auth_forcepasswordchange', 1, $id);
  398 + set_user_preference('create_password', 1, $id);
  399 + }
385 400 }
386 401 $transaction->allow_commit();
387 402 unset($add_users); // free mem
2  auth/fc/auth.php
@@ -180,7 +180,7 @@ function sync_roles($user) {
180 180
181 181 if ($roles = get_archetype_roles('coursecreator')) {
182 182 $creatorrole = array_shift($roles); // We can only use one, let's use the first one
183   - $systemcontext = get_context_instance(CONTEXT_SYSTEM);
  183 + $systemcontext = context_system::instance();
184 184
185 185 if ($iscreator) { // Following calls will not create duplicates
186 186 role_assign($creatorrole->id, $user->id, $systemcontext->id, 'auth_fc');
6 auth/ldap/auth.php
@@ -771,7 +771,7 @@ function sync_users($do_updates=true) {
771 771 if (!empty($users)) {
772 772 print_string('userentriestoupdate', 'auth_ldap', count($users));
773 773
774   - $sitecontext = get_context_instance(CONTEXT_SYSTEM);
  774 + $sitecontext = context_system::instance();
775 775 if (!empty($this->config->creators) and !empty($this->config->memberattribute)
776 776 and $roles = get_archetype_roles('coursecreator')) {
777 777 $creatorrole = array_shift($roles); // We can only use one, let's use the first one
@@ -820,7 +820,7 @@ function sync_users($do_updates=true) {
820 820 if (!empty($add_users)) {
821 821 print_string('userentriestoadd', 'auth_ldap', count($add_users));
822 822
823   - $sitecontext = get_context_instance(CONTEXT_SYSTEM);
  823 + $sitecontext = context_system::instance();
824 824 if (!empty($this->config->creators) and !empty($this->config->memberattribute)
825 825 and $roles = get_archetype_roles('coursecreator')) {
826 826 $creatorrole = array_shift($roles); // We can only use one, let's use the first one
@@ -1649,7 +1649,7 @@ function sync_roles($user) {
1649 1649
1650 1650 if ($roles = get_archetype_roles('coursecreator')) {
1651 1651 $creatorrole = array_shift($roles); // We can only use one, let's use the first one
1652   - $systemcontext = get_context_instance(CONTEXT_SYSTEM);
  1652 + $systemcontext = context_system::instance();
1653 1653
1654 1654 if ($iscreator) { // Following calls will not create duplicates
1655 1655 role_assign($creatorrole->id, $user->id, $systemcontext->id, $this->roleauth);
2  auth/ldap/ntlmsso_attempt.php
@@ -6,7 +6,7 @@
6 6 $PAGE->https_required();
7 7
8 8 $PAGE->set_url('/auth/ldap/ntlmsso_attempt.php');
9   -$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
  9 +$PAGE->set_context(context_system::instance());
10 10
11 11 // Define variables used in page
12 12 $site = get_site();
2  auth/ldap/ntlmsso_finish.php
@@ -6,7 +6,7 @@
6 6 $PAGE->https_required();
7 7
8 8 $PAGE->set_url('/auth/ldap/ntlmsso_finish.php');
9   -$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
  9 +$PAGE->set_context(context_system::instance());
10 10
11 11 // Define variables used in page
12 12 $site = get_site();
2  auth/ldap/ntlmsso_magic.php
@@ -11,7 +11,7 @@
11 11 //HTTPS is required in this page when $CFG->loginhttps enabled
12 12 $PAGE->https_required();
13 13
14   -$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
  14 +$PAGE->set_context(context_system::instance());
15 15
16 16 $authsequence = get_enabled_auth_plugins(true); // auths, in sequence
17 17 if (!in_array('ldap', $authsequence, true)) {
6 auth/mnet/auth.php
@@ -81,7 +81,7 @@ function user_authorise($token, $useragent) {
81 81
82 82 if (array_key_exists('picture', $userdata) && !empty($user->picture)) {
83 83 $fs = get_file_storage();
84   - $usercontext = get_context_instance(CONTEXT_USER, $user->id, MUST_EXIST);
  84 + $usercontext = context_user::instance($user->id, MUST_EXIST);
85 85 if ($usericonfile = $fs->get_file($usercontext->id, 'user', 'icon', 0, '/', 'f1.png')) {
86 86 $userdata['_mnet_userpicture_timemodified'] = $usericonfile->get_timemodified();
87 87 $userdata['_mnet_userpicture_mimetype'] = $usericonfile->get_mimetype();
@@ -299,7 +299,7 @@ function confirm_mnet_session($token, $remotepeer) {
299 299
300 300 if ($key == '_mnet_userpicture_timemodified' and empty($CFG->disableuserimages) and isset($remoteuser->picture)) {
301 301 // update the user picture if there is a newer verion at the identity provider
302   - $usercontext = get_context_instance(CONTEXT_USER, $localuser->id, MUST_EXIST);
  302 + $usercontext = context_user::instance($localuser->id, MUST_EXIST);
303 303 if ($usericonfile = $fs->get_file($usercontext->id, 'user', 'icon', 0, '/', 'f1.png')) {
304 304 $localtimemodified = $usericonfile->get_timemodified();
305 305 } else if ($usericonfile = $fs->get_file($usercontext->id, 'user', 'icon', 0, '/', 'f1.jpg')) {
@@ -1136,7 +1136,7 @@ function fetch_user_image($username) {
1136 1136
1137 1137 if ($user = $DB->get_record('user', array('username' => $username, 'mnethostid' => $CFG->mnet_localhost_id))) {
1138 1138 $fs = get_file_storage();
1139   - $usercontext = get_context_instance(CONTEXT_USER, $user->id, MUST_EXIST);
  1139 + $usercontext = context_user::instance($user->id, MUST_EXIST);
1140 1140 $return = array();
1141 1141 if ($f1 = $fs->get_file($usercontext->id, 'user', 'icon', 0, '/', 'f1.png')) {
1142 1142 $return['f1'] = base64_encode($f1->get_content());
2  auth/shibboleth/index.php
@@ -72,7 +72,7 @@
72 72 }
73 73
74 74 /// Go to my-moodle page instead of homepage if defaulthomepage enabled
75   - if (!has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM)) and !empty($CFG->defaulthomepage) && $CFG->defaulthomepage == HOMEPAGE_MY and !isguestuser()) {
  75 + if (!has_capability('moodle/site:config',context_system::instance()) and !empty($CFG->defaulthomepage) && $CFG->defaulthomepage == HOMEPAGE_MY and !isguestuser()) {
76 76 if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
77 77 $urltogo = $CFG->wwwroot.'/my/';
78 78 }
2  auth/upgrade.txt
@@ -8,6 +8,8 @@ required changes in code:
8 8 * use role_get_name() or role_fix_names() if you need any role names, using role.name
9 9 directly from database is not correct any more
10 10
  11 +optional - no changes needed:
  12 +* add support for custom user signup form - see auth_plugin_base::signup_form() function
11 13
12 14 === 2.2 ===
13 15
3  backup/converter/moodle1/lib.php
@@ -528,7 +528,8 @@ public function get_stash_itemids($stashname) {
528 528 * CONTEXT_SYSTEM and CONTEXT_COURSE ignore the $instance as they represent a
529 529 * single system or the course being restored.
530 530 *
531   - * @see get_context_instance()
  531 + * @see context_system::instance()
  532 + * @see context_course::instance()
532 533 * @param int $level the context level, like CONTEXT_COURSE or CONTEXT_MODULE
533 534 * @param int $instance the instance id, for example $course->id for courses or $cm->id for activity modules
534 535 * @return int the context id
30 backup/moodle2/restore_activity_task.class.php
@@ -293,30 +293,46 @@ protected function define_settings() {
293 293 // Define activity_userinfo. Dependent of:
294 294 // - users root setting
295 295 // - section_userinfo setting (if exists)
296   - // - activity_included setting
  296 + // - activity_included setting.
297 297 $settingname = $settingprefix . 'userinfo';
298   - $selectvalues = array(0=>get_string('no')); // Safer options
299   - $defaultvalue = false; // Safer default
  298 + $defaultvalue = false;
300 299 if (isset($this->info->settings[$settingname]) && $this->info->settings[$settingname]) { // Only enabled when available
301   - $selectvalues = array(1=>get_string('yes'), 0=>get_string('no'));
302 300 $defaultvalue = true;
303 301 }
  302 +
304 303 $activity_userinfo = new restore_activity_userinfo_setting($settingname, base_setting::IS_BOOLEAN, $defaultvalue);
305   - $activity_userinfo->set_ui(new backup_setting_ui_select($activity_userinfo, get_string('includeuserinfo','backup'), $selectvalues));
  304 + if (!$defaultvalue) {
  305 + // This is a bit hacky, but if there is no user data to restore, then
  306 + // we replace the standard check-box with a select menu with the
  307 + // single choice 'No', and the select menu is clever enough that if
  308 + // there is only one choice, it just displays a static string.
  309 + //
  310 + // It would probably be better design to have a special UI class
  311 + // setting_ui_checkbox_or_no, rather than this hack, but I am not
  312 + // going to do that today.
  313 + $activity_userinfo->set_ui(new backup_setting_ui_select($activity_userinfo, '-',
  314 + array(0 => get_string('no'))));
  315 + } else {
  316 + $activity_userinfo->get_ui()->set_label('-');
  317 + }
  318 +
306 319 $this->add_setting($activity_userinfo);
  320 +
307 321 // Look for "users" root setting
308 322 $users = $this->plan->get_setting('users');
309 323 $users->add_dependency($activity_userinfo);
  324 +
310 325 // Look for "section_userinfo" section setting (if exists)
311 326 $settingname = 'section_' . $this->info->sectionid . '_userinfo';
312 327 if ($this->plan->setting_exists($settingname)) {
313 328 $section_userinfo = $this->plan->get_setting($settingname);
314 329 $section_userinfo->add_dependency($activity_userinfo);
315 330 }
316   - // Look for "activity_included" setting
  331 +
  332 + // Look for "activity_included" setting.
317 333 $activity_included->add_dependency($activity_userinfo);
318 334
319   - // End of common activity settings, let's add the particular ones
  335 + // End of common activity settings, let's add the particular ones.
320 336 $this->define_my_settings();
321 337 }
322 338
29 backup/moodle2/restore_section_task.class.php
@@ -169,21 +169,36 @@ protected function define_settings() {
169 169
170 170 // Define section_userinfo. Dependent of:
171 171 // - users root setting
172   - // - section_included setting
  172 + // - section_included setting.
173 173 $settingname = $settingprefix . 'userinfo';
174   - $selectvalues = array(0=>get_string('no')); // Safer options
175   - $defaultvalue = false; // Safer default
  174 + $defaultvalue = false;
176 175 if (isset($this->info->settings[$settingname]) && $this->info->settings[$settingname]) { // Only enabled when available
177   - $selectvalues = array(1=>get_string('yes'), 0=>get_string('no'));
178 176 $defaultvalue = true;
179 177 }
  178 +
180 179 $section_userinfo = new restore_section_userinfo_setting($settingname, base_setting::IS_BOOLEAN, $defaultvalue);
181   - $section_userinfo->set_ui(new backup_setting_ui_select($section_userinfo, get_string('includeuserinfo','backup'), $selectvalues));
  180 + if (!$defaultvalue) {
  181 + // This is a bit hacky, but if there is no user data to restore, then
  182 + // we replace the standard check-box with a select menu with the
  183 + // single choice 'No', and the select menu is clever enough that if
  184 + // there is only one choice, it just displays a static string.
  185 + //
  186 + // It would probably be better design to have a special UI class
  187 + // setting_ui_checkbox_or_no, rather than this hack, but I am not
  188 + // going to do that today.
  189 + $section_userinfo->set_ui(new backup_setting_ui_select($section_userinfo, get_string('includeuserinfo','backup'),
  190 + array(0 => get_string('no'))));
  191 + } else {
  192 + $section_userinfo->get_ui()->set_label(get_string('includeuserinfo','backup'));
  193 + }
  194 +
182 195 $this->add_setting($section_userinfo);
183   - // Look for "users" root setting
  196 +
  197 + // Look for "users" root setting.
184 198 $users = $this->plan->get_setting('users');
185 199 $users->add_dependency($section_userinfo);
186   - // Look for "section_included" section setting
  200 +
  201 + // Look for "section_included" section setting.
187 202 $section_included->add_dependency($section_userinfo);
188 203 }
189 204 }
20 backup/util/ui/base_moodleform.class.php
@@ -96,7 +96,6 @@ function definition() {
96 96 * @global moodle_page $PAGE
97 97 */
98 98 function definition_after_data() {
99   - global $PAGE;
100 99 $buttonarray=array();
101 100 $buttonarray[] = $this->_form->createElement('submit', 'submitbutton', get_string($this->uistage->get_ui()->get_name().'stage'.$this->uistage->get_stage().'action', 'backup'), array('class'=>'proceedbutton'));
102 101 if (!$this->uistage->is_first_stage()) {
@@ -106,13 +105,9 @@ function definition_after_data() {
106 105 $this->_form->addGroup($buttonarray, 'buttonar', '', array(' '), false);
107 106 $this->_form->closeHeaderBefore('buttonar');
108 107
109   - $config = new stdClass;
110   - $config->title = get_string('confirmcancel', 'backup');
111   - $config->question = get_string('confirmcancelquestion', 'backup');
112   - $config->yesLabel = get_string('confirmcancelyes', 'backup');
113   - $config->noLabel = get_string('confirmcancelno', 'backup');
114   - $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_cancel_buttons', array($config));
  108 + $this->_definition_finalized = true;
115 109 }
  110 +
116 111 /**
117 112 * Closes any open divs
118 113 */
@@ -318,7 +313,17 @@ public function get_element($elementname) {
318 313 * Displays the form
319 314 */
320 315 public function display() {
  316 + global $PAGE;
  317 +
321 318 $this->require_definition_after_data();
  319 +
  320 + $config = new stdClass;
  321 + $config->title = get_string('confirmcancel', 'backup');
  322 + $config->question = get_string('confirmcancelquestion', 'backup');
  323 + $config->yesLabel = get_string('confirmcancelyes', 'backup');
  324 + $config->noLabel = get_string('confirmcancelno', 'backup');
  325 + $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_cancel_buttons', array($config));
  326 +
322 327 parent::display();
323 328 }
324 329
@@ -327,7 +332,6 @@ public function display() {
327 332 */
328 333 public function require_definition_after_data() {
329 334 if (!$this->_definition_finalized) {
330   - $this->_definition_finalized = true;
331 335 $this->definition_after_data();
332 336 }
333 337 }
4 blocks/community/block_community.php
@@ -71,7 +71,7 @@ function get_content() {
71 71 $icon = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/group'),
72 72 'class' => 'icon', 'alt' => get_string('addcourse', 'block_community')));
73 73 $addcourseurl = new moodle_url('/blocks/community/communitycourse.php',
74   - array('add' => true, 'courseid' => $coursecontext->instanceid));
  74 + array('add' => true, 'courseid' => $this->page->course->id));
75 75 $searchlink = html_writer::tag('a', $icon . '&nbsp;' . get_string('addcourse', 'block_community'),
76 76 array('href' => $addcourseurl->out(false)));
77 77 $this->content->items[] = $searchlink;
@@ -91,7 +91,7 @@ function get_content() {
91 91 'alt' => get_string('removecommunitycourse', 'block_community')));
92 92 $deleteurl = new moodle_url('/blocks/community/communitycourse.php',
93 93 array('remove' => true,
94   - 'courseid' => $coursecontext->instanceid,
  94 + 'courseid' => $this->page->course->id,
95 95 'communityid' => $course->id, 'sesskey' => sesskey()));
96 96 $deleteatag = html_writer::tag('a', $deleteicon, array('href' => $deleteurl));
97 97
2  blocks/news_items/block_news_items.php
@@ -104,7 +104,7 @@ function get_content() {
104 104 $tooltiptext = get_string('rsssubscriberssposts','forum');
105 105 }
106 106 if (!isloggedin()) {
107   - $userid = 0;
  107 + $userid = $CFG->siteguest;
108 108 } else {
109 109 $userid = $USER->id;
110 110 }
2  comment/index.php
@@ -29,7 +29,7 @@
29 29 require_login();
30 30 admin_externalpage_setup('comments', '', null, '', array('pagelayout'=>'report'));
31 31
32   -$context = get_context_instance(CONTEXT_SYSTEM);
  32 +$context = context_system::instance();
33 33 require_capability('moodle/comment:delete', $context);
34 34
35 35 $PAGE->requires->js_init_call('M.core_comment.init_admin', null, true);
19 comment/lib.php
@@ -201,12 +201,19 @@ public function __construct(stdClass $options) {
201 201 $this->check_permissions();
202 202
203 203 // load template
204   - $this->template = html_writer::tag('div', '___picture___', array('class' => 'comment-userpicture'));
205   - $this->template .= html_writer::start_tag('div', array('class' => 'comment-content'));
206   - $this->template .= '___name___ - ';
207   - $this->template .= html_writer::tag('span', '___time___');
208   - $this->template .= html_writer::tag('div', '___content___');
209   - $this->template .= html_writer::end_tag('div'); // .comment-content
  204 + $this->template = html_writer::start_tag('div', array('class' => 'comment-message'));
  205 +
  206 + $this->template .= html_writer::start_tag('div', array('class' => 'comment-message-meta'));
  207 +
  208 + $this->template .= html_writer::tag('span', '___picture___', array('class' => 'picture'));
  209 + $this->template .= html_writer::tag('span', '___name___', array('class' => 'user')) . ' - ';
  210 + $this->template .= html_writer::tag('span', '___time___', array('class' => 'time'));
  211 +
  212 + $this->template .= html_writer::end_tag('div'); // .comment-message-meta
  213 + $this->template .= html_writer::tag('div', '___content___', array('class' => 'text'));
  214 +
  215 + $this->template .= html_writer::end_tag('div'); // .comment-message
  216 +
210 217 if (!empty($this->plugintype)) {
211 218 $this->template = plugin_callback($this->plugintype, $this->pluginname, 'comment', 'template', array($this->comment_param), $this->template);
212 219 }
4 completion/criteria/completion_criteria_course.php
@@ -135,7 +135,7 @@ public function get_title_detailed() {
135 135 global $DB;
136 136
137 137 $prereq = $DB->get_record('course', array('id' => $this->courseinstance));
138   - $coursecontext = get_context_instance(CONTEXT_COURSE, $prereq->id, MUST_EXIST);
  138 + $coursecontext = context_course::instance($prereq->id, MUST_EXIST);
139 139 $fullname = format_string($prereq->fullname, true, array('context' => $coursecontext));
140 140 return shorten_text(urldecode($fullname));
141 141 }
@@ -215,7 +215,7 @@ public function get_details($completion) {
215 215 $info = new completion_info($course);
216 216
217 217 $prereq = $DB->get_record('course', array('id' => $this->courseinstance));
218   - $coursecontext = get_context_instance(CONTEXT_COURSE, $prereq->id, MUST_EXIST);
  218 + $coursecontext = context_course::instance($prereq->id, MUST_EXIST);
219 219 $fullname = format_string($prereq->fullname, true, array('context' => $coursecontext));
220 220
221 221 $prereq_info = new completion_info($prereq);
36 course/format/renderer.php
@@ -205,9 +205,7 @@ protected function section_edit_controls($course, $section, $onsectionpage = fal
205 205 return array();
206 206 }
207 207
208   - if (!has_capability('moodle/course:update', context_course::instance($course->id))) {
209   - return array();
210   - }
  208 + $coursecontext = context_course::instance($course->id);
211 209
212 210 if ($onsectionpage) {
213 211 $baseurl = course_get_url($course, $section->section);
@@ -219,23 +217,25 @@ protected function section_edit_controls($course, $section, $onsectionpage = fal
219 217 $controls = array();
220 218
221 219 $url = clone($baseurl);
222   - if ($section->visible) { // Show the hide/show eye.
223   - $strhidefromothers = get_string('hidefromothers', 'format_'.$course->format);
224   - $url->param('hide', $section->section);
225   - $controls[] = html_writer::link($url,
226   - html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/hide'),
227   - 'class' => 'icon hide', 'alt' => $strhidefromothers)),
228   - array('title' => $strhidefromothers, 'class' => 'editing_showhide'));
229   - } else {
230   - $strshowfromothers = get_string('showfromothers', 'format_'.$course->format);
231   - $url->param('show', $section->section);
232   - $controls[] = html_writer::link($url,
233   - html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/show'),
234   - 'class' => 'icon hide', 'alt' => $strshowfromothers)),
235   - array('title' => $strshowfromothers, 'class' => 'editing_showhide'));
  220 + if (has_capability('moodle/course:sectionvisibility', $coursecontext)) {
  221 + if ($section->visible) { // Show the hide/show eye.
  222 + $strhidefromothers = get_string('hidefromothers', 'format_'.$course->format);
  223 + $url->param('hide', $section->section);
  224 + $controls[] = html_writer::link($url,
  225 + html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/hide'),
  226 + 'class' => 'icon hide', 'alt' => $strhidefromothers)),
  227 + array('title' => $strhidefromothers, 'class' => 'editing_showhide'));
  228 + } else {
  229 + $strshowfromothers = get_string('showfromothers', 'format_'.$course->format);
  230 + $url->param('show', $section->section);
  231 + $controls[] = html_writer::link($url,
  232 + html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/show'),
  233 + 'class' => 'icon hide', 'alt' => $strshowfromothers)),
  234 + array('title' => $strshowfromothers, 'class' => 'editing_showhide'));
  235 + }
236 236 }
237 237
238   - if (!$onsectionpage) {
  238 + if (!$onsectionpage && has_capability('moodle/course:update', $coursecontext)) {
239 239 $url = clone($baseurl);
240 240 if ($section->section > 1) { // Add a arrow to move section up.
241 241 $url->param('section', $section->section);
30 course/format/topics/renderer.php
@@ -74,9 +74,7 @@ protected function section_edit_controls($course, $section, $onsectionpage = fal
74 74 return array();
75 75 }
76 76
77   - if (!has_capability('moodle/course:update', context_course::instance($course->id))) {
78   - return array();
79   - }
  77 + $coursecontext = context_course::instance($course->id);
80 78
81 79 if ($onsectionpage) {
82 80 $url = course_get_url($course, $section->section);
@@ -86,18 +84,20 @@ protected function section_edit_controls($course, $section, $onsectionpage = fal
86 84 $url->param('sesskey', sesskey());
87 85
88 86 $controls = array();
89   - if ($course->marker == $section->section) { // Show the "light globe" on/off.
90   - $url->param('marker', 0);
91   - $controls[] = html_writer::link($url,
92   - html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marked'),
93   - 'class' => 'icon ', 'alt' => get_string('markedthistopic'))),
94   - array('title' => get_string('markedthistopic'), 'class' => 'editing_highlight'));
95   - } else {
96   - $url->param('marker', $section->section);
97   - $controls[] = html_writer::link($url,
98   - html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marker'),
99   - 'class' => 'icon', 'alt' => get_string('markthistopic'))),
100   - array('title' => get_string('markthistopic'), 'class' => 'editing_highlight'));
  87 + if (has_capability('moodle/course:setcurrentsection', $coursecontext)) {
  88 + if ($course->marker == $section->section) { // Show the "light globe" on/off.
  89 + $url->param('marker', 0);
  90 + $controls[] = html_writer::link($url,
  91 + html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marked'),
  92 + 'class' => 'icon ', 'alt' => get_string('markedthistopic'))),
  93 + array('title' => get_string('markedthistopic'), 'class' => 'editing_highlight'));
  94 + } else {
  95 + $url->param('marker', $section->section);
  96 + $controls[] = html_writer::link($url,
  97 + html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marker'),
  98 + 'class' => 'icon', 'alt' => get_string('markthistopic'))),
  99 + array('title' => get_string('markthistopic'), 'class' => 'editing_highlight'));
  100 + }
101 101 }
102 102
103 103 return array_merge($controls, parent::section_edit_controls($course, $section, $onsectionpage));
16 course/lib.php
@@ -2257,22 +2257,6 @@ function make_categories_options() {
2257 2257 }
2258 2258
2259 2259 /**
2260   - * Gets the name of a course to be displayed when showing a list of courses.
2261   - * By default this is just $course->fullname but user can configure it. The
2262   - * result of this function should be passed through print_string.
2263   - * @param object $course Moodle course object
2264   - * @return string Display name of course (either fullname or short + fullname)
2265   - */
2266   -function get_course_display_name_for_list($course) {
2267   - global $CFG;
2268   - if (!empty($CFG->courselistshortnames)) {
2269   - return $course->shortname . ' ' .$course->fullname;
2270   - } else {
2271   - return $course->fullname;
2272   - }
2273   -}
2274   -
2275   -/**
2276 2260 * Prints the category info in indented fashion
2277 2261 * This function is only used by print_whole_category_list() above
2278 2262 */
5 course/rest.php
@@ -75,7 +75,6 @@
75 75
76 76 switch ($class) {
77 77 case 'section':
78   - require_capability('moodle/course:update', $coursecontext);
79 78
80 79 if (!$DB->record_exists('course_sections', array('course'=>$course->id, 'section'=>$id))) {
81 80 throw new moodle_exception('AJAX commands.php: Bad Section ID '.$id);
@@ -83,11 +82,13 @@
83 82
84 83 switch ($field) {
85 84 case 'visible':
  85 + require_capability('moodle/course:sectionvisibility', $coursecontext);
86 86 $resourcestotoggle = set_section_visible($course->id, $id, $value);
87 87 echo json_encode(array('resourcestotoggle' => $resourcestotoggle));
88 88 break;
89 89
90 90 case 'move':
  91 + require_capability('moodle/course:update', $coursecontext);
91 92 move_section_to($course, $id, $value);
92 93 // See if format wants to do something about it
93 94 $libfile = $CFG->dirroot.'/course/format/'.$course->format.'/lib.php';
@@ -178,7 +179,7 @@
178 179 case 'course':
179 180 switch($field) {
180 181 case 'marker':
181   - require_capability('moodle/course:update', $coursecontext);
  182 + require_capability('moodle/course:setcurrentsection', $coursecontext);
182 183 course_set_marker($course->id, $value);
183 184 break;
184 185 }
4 course/view.php
@@ -162,7 +162,7 @@
162 162 set_user_preference('usemodchooser', $modchooser);
163 163 }
164 164
165   - if (has_capability('moodle/course:update', $context)) {
  165 + if (has_capability('moodle/course:sectionvisibility', $context)) {
166 166 if ($hide && confirm_sesskey()) {
167 167 set_section_visible($course->id, $hide, '0');
168 168 redirect($PAGE->url);
@@ -172,7 +172,9 @@
172 172 set_section_visible($course->id, $show, '1');
173 173 redirect($PAGE->url);
174 174 }
  175 + }
175 176
  177 + if (has_capability('moodle/course:update', $context)) {
176 178 if (!empty($section)) {
177 179 if (!empty($move) and confirm_sesskey()) {
178 180 $destsection = $section + $move;
4 enrol/authorize/locallib.php
@@ -58,8 +58,10 @@ function authorize_print_orders($courseid, $userid) {
58 58
59 59 $searchmenu = array('orderid' => $authstrs->orderid, 'transid' => $authstrs->transid, 'cclastfour' => $authstrs->cclastfour);
60 60 $buttons = "<form method='post' action='index.php' autocomplete='off'><div>";
  61 + $buttons .= html_writer::label(get_string('orderdetails', 'enrol_authorize'), 'menusearchtype', false, array('class' => 'accesshide'));
61 62 $buttons .= html_writer::select($searchmenu, 'searchtype', $searchtype, false);
62   - $buttons .= "<input type='text' size='16' name='searchquery' value='' />";
  63 + $buttons .= html_writer::label(get_string('search'), 'searchquery', false, array('class' => 'accesshide'));
  64 + $buttons .= "<input id='searchquery' type='text' size='16' name='searchquery' value='' />";
63 65 $buttons .= "<input type='submit' value='$strs->search' />";
64 66 $buttons .= "</div></form>";
65 67
8 enrol/imsenterprise/lib.php
@@ -321,6 +321,9 @@ function process_group_tag($tagcontents) {
321 321 if (preg_match('{<description>.*?<short>(.*?)</short>.*?</description>}is', $tagcontents, $matches)) {
322 322 $group->shortName = trim($matches[1]);
323 323 }
  324 + if (preg_match('{<description>.*?<full>(.*?)</full>.*?</description>}is', $tagcontents, $matches)) {
  325 + $group->fulldescription = trim($matches[1]);
  326 + }
324 327 if (preg_match('{<org>.*?<orgunit>(.*?)</orgunit>.*?</org>}is', $tagcontents, $matches)) {
325 328 $group->category = trim($matches[1]);
326 329 }
@@ -376,7 +379,10 @@ function process_group_tag($tagcontents) {
376 379 $courseconfig = get_config('moodlecourse'); // Load Moodle Course shell defaults
377 380 $course = new stdClass();
378 381 $course->fullname = $group->description;
379   - $course->shortname = $group->shortName;;
  382 + $course->shortname = $group->shortName;
  383 + if (!empty($group->fulldescription)) {
  384 + $course->summary = format_text($group->fulldescription, FORMAT_HTML);
  385 + }
380 386 $course->idnumber = $coursecode;
381 387 $course->format = $courseconfig->format;
382 388 $course->visible = $courseconfig->visible;
2  enrol/manual/lib.php
@@ -215,6 +215,7 @@ public function get_manual_enrol_button(course_enrolment_manager $manager) {
215 215 $today = time();
216 216 $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
217 217 $startdateoptions[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
  218 + $defaultduration = $instance->enrolperiod > 0 ? $instance->enrolperiod / 86400 : '';
218 219
219 220 $modules = array('moodle-enrol_manual-quickenrolment', 'moodle-enrol_manual-quickenrolment-skin');
220 221 $arguments = array(
@@ -224,6 +225,7 @@ public function get_manual_enrol_button(course_enrolment_manager $manager) {
224 225 'url' => $manager->get_moodlepage()->url->out(false),
225 226 'optionsStartDate' => $startdateoptions,
226 227 'defaultRole' => $instance->roleid,
  228 + 'defaultDuration' => $defaultduration,
227 229 'disableGradeHistory' => $CFG->disablegradehistory,
228 230 'recoverGradesDefault'=> ''
229 231 );
6 enrol/manual/manage.php