Permalink
Browse files

MDL-20636 Merge branch 'master' into qe2_wip

Conflicts:
	lib/questionlib.php
	question/type/calculated/lang/en/qtype_calculated.php
	question/type/questiontype.php
  • Loading branch information...
2 parents 0fafed0 + eef3578 commit 74c479f212894edc81ee49e34248c1cdbe1c229a @timhunt timhunt committed Feb 3, 2011
Showing with 3,569 additions and 48,663 deletions.
  1. +1 −1 admin/dbtransfer/lib.php
  2. +8 −3 admin/modules.php
  3. +26 −27 admin/multilangupgrade.php
  4. +2 −2 admin/settings/development.php
  5. +0 −4 admin/settings/subsystems.php
  6. +1 −1 admin/settings/users.php
  7. +10 −4 admin/uploaduser.php
  8. +5 −6 admin/user/lib.php
  9. +10 −11 admin/user/user_bulk_confirm.php
  10. +7 −8 admin/user/user_bulk_delete.php
  11. +8 −9 admin/user/user_bulk_forcepasswordchange.php
  12. +7 −8 admin/user/user_bulk_message.php
  13. +1 −1 admin/xmldb/index.php
  14. +8 −7 auth/shibboleth/logout.php
  15. +5 −3 backup/lib.php
  16. +2 −1 backup/restorelib.php
  17. +2 −1 blocks/activity_modules/block_activity_modules.php
  18. +1 −1 blocks/course_overview/block_course_overview.php
  19. +2 −0 blocks/course_summary/block_course_summary.php
  20. +4 −0 blocks/html/block_html.php
  21. +44 −94 blocks/myprofile/block_myprofile.php
  22. +4 −2 blocks/myprofile/edit_form.php
  23. +27 −3 blocks/myprofile/lang/en/block_myprofile.php
  24. +12 −1 blocks/myprofile/version.php
  25. +4 −6 blocks/online_users/block_online_users.php
  26. +15 −27 blocks/site_main_menu/block_site_main_menu.php
  27. +16 −27 blocks/social_activities/block_social_activities.php
  28. +2 −2 blog/lib.php
  29. +2 −0 blog/locallib.php
  30. +31 −0 brokenfile.php
  31. +1 −1 calendar/export_execute.php
  32. +4 −1 calendar/lib.php
  33. +8 −4 config-dist.php
  34. +200 −106 course/lib.php
  35. +1 −1 course/report/completion/index.php
  36. +1 −1 course/report/completion/mod.php
  37. +1 −1 course/report/outline/index.php
  38. +9 −1 course/report/participation/index.php
  39. +14 −14 course/report/progress/index.php
  40. +4 −0 course/resources.php
  41. +15 −9 course/togglecompletion.php
  42. +11 −4 course/user.php
  43. +4 −2 enrol/authorize/localfuncs.php
  44. +1 −0 enrol/category/locallib.php
  45. +16 −10 enrol/database/lib.php
  46. +78 −0 enrol/imsenterprise/db/install.php
  47. +87 −0 enrol/imsenterprise/db/upgrade.php
  48. +1 −1 enrol/imsenterprise/version.php
  49. +2 −2 enrol/self/lib.php
  50. +1 −1 filter/activitynames/lang/en/filter_activitynames.php
  51. +1 −1 filter/algebra/algebradebug.php
  52. +1 −1 filter/algebra/lang/en/filter_algebra.php
  53. +2 −2 filter/censor/lang/en/filter_censor.php
  54. +1 −1 filter/emailprotect/lang/en/filter_emailprotect.php
  55. +22 −0 filter/mediaplugin/filter.php
  56. +1 −1 filter/mediaplugin/lang/en/filter_mediaplugin.php
  57. +1 −1 filter/tex/lang/en/filter_tex.php
  58. +1 −1 filter/tex/texdebug.php
  59. +27 −17 grade/import/csv/index.php
  60. 0 grade/import/grade_import_form.php
  61. +23 −14 grade/import/lib.php
  62. +55 −28 grade/report/grader/lib.php
  63. +15 −4 grade/report/lib.php
  64. +1 −1 grade/report/user/index.php
  65. +421 −56 grade/report/user/lib.php
  66. +10 −2 grade/report/user/settings.php
  67. +4 −1 grade/report/user/styles.css
  68. +3 −0 group/assign.php
  69. +1 −0 group/members.php
  70. +18 −18 group/overview.php
  71. +7 −0 install/lang/ca/admin.php
  72. +3 −3 install/lang/da/error.php
  73. +1 −1 install/lang/da/install.php
  74. +17 −0 install/lang/he/install.php
  75. +4 −9 install/lang/lv/install.php
  76. +1 −0 install/lang/nn/langconfig.php
  77. +4 −0 install/lang/pl/admin.php
  78. +2 −0 install/lang/pl/install.php
  79. +1 −1 install/lang/pt/error.php
  80. +3 −0 install/lang/pt_br/install.php
  81. +10 −0 install/lang/sl/admin.php
  82. +1 −1 install/lang/ta_lk/install.php
  83. +1 −1 lang/en/admin.php
  84. +0 −2 lang/en/completion.php
  85. +16 −2 lang/en/grades.php
  86. +56 −49 lib/accesslib.php
  87. +5 −5 lib/ajax/getnavbranch.php
  88. +5 −7 lib/completion/completion_criteria_activity.php
  89. +5 −7 lib/completion/completion_criteria_course.php
  90. +5 −8 lib/completion/completion_criteria_date.php
  91. +9 −12 lib/completion/completion_criteria_duration.php
  92. +5 −8 lib/completion/completion_criteria_grade.php
  93. +11 −5 lib/completion/cron.php
  94. +3 −3 lib/completionlib.php
  95. +33 −37 lib/datalib.php
  96. +0 −1 lib/db/access.php
  97. +15 −7 lib/db/install.xml
  98. +530 −37 lib/db/upgrade.php
  99. +27 −25 lib/db/upgradelib.php
  100. +4 −6 lib/dml/moodle_database.php
  101. +8 −2 lib/dml/mysqli_native_moodle_database.php
  102. +6 −7 lib/dml/oci_native_moodle_database.php
  103. +6 −2 lib/dml/pdo_moodle_database.php
  104. +4 −1 lib/dml/pgsql_native_moodle_database.php
  105. +1 −1 lib/editor/tinymce/lib.php
  106. +2 −1 lib/environmentlib.php
  107. +16 −17 lib/eventslib.php
  108. +7 −1 lib/filelib.php
  109. +4 −1 lib/filestorage/file_storage.php
  110. +3 −2 lib/grade/grade_category.php
  111. +6 −7 lib/grade/grade_grade.php
  112. +3 −2 lib/grade/grade_item.php
  113. +3 −0 lib/grade/grade_outcome.php
  114. +3 −0 lib/grade/grade_scale.php
  115. +17 −20 lib/gradelib.php
  116. +4 −1 lib/grouplib.php
  117. +2 −2 lib/javascript-static.js
  118. +1,092 −0 lib/modinfolib.php
  119. +48 −259 lib/moodlelib.php
  120. +25 −15 lib/navigationlib.php
  121. +3 −3 lib/outputcomponents.php
  122. +3 −3 lib/outputrenderers.php
  123. +6 −0 lib/sessionlib.php
  124. +2 −1 lib/setup.php
  125. +4 −1 lib/setuplib.php
  126. +63 −0 lib/simpletest/testcomponentlib.php
  127. +6 −0 lib/simpletest/testfilelib.php
  128. +26 −0 lib/simpletest/testoutputcomponents.php
  129. +2 −0 lib/spikephpcoverage/readme_moodle.txt
  130. +1 −0 lib/spikephpcoverage/src/phpcoverage.remote.bottom.inc.php
  131. +1 −0 lib/spikephpcoverage/src/phpcoverage.remote.top.inc.php
  132. +53 −2 lib/upgradelib.php
  133. +21 −7 lib/weblib.php
  134. +0 −1,396 lib/yui/2.8.1/build/animation/animation-debug.js
  135. +0 −23 lib/yui/2.8.1/build/animation/animation-min.js
  136. +0 −1,392 lib/yui/2.8.1/build/animation/animation.js
  137. BIN lib/yui/2.8.1/build/assets/skins/sam/ajax-loader.gif
  138. BIN lib/yui/2.8.1/build/assets/skins/sam/asc.gif
  139. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/autocomplete.css
  140. BIN lib/yui/2.8.1/build/assets/skins/sam/back-h.png
  141. BIN lib/yui/2.8.1/build/assets/skins/sam/back-v.png
  142. BIN lib/yui/2.8.1/build/assets/skins/sam/bar-h.png
  143. BIN lib/yui/2.8.1/build/assets/skins/sam/bar-v.png
  144. BIN lib/yui/2.8.1/build/assets/skins/sam/bg-h.gif
  145. BIN lib/yui/2.8.1/build/assets/skins/sam/bg-v.gif
  146. BIN lib/yui/2.8.1/build/assets/skins/sam/blankimage.png
  147. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/button.css
  148. +0 −8 lib/yui/2.8.1/build/assets/skins/sam/calendar.css
  149. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/carousel.css
  150. BIN lib/yui/2.8.1/build/assets/skins/sam/check0.gif
  151. BIN lib/yui/2.8.1/build/assets/skins/sam/check1.gif
  152. BIN lib/yui/2.8.1/build/assets/skins/sam/check2.gif
  153. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/colorpicker.css
  154. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/container.css
  155. +0 −8 lib/yui/2.8.1/build/assets/skins/sam/datatable.css
  156. BIN lib/yui/2.8.1/build/assets/skins/sam/desc.gif
  157. BIN lib/yui/2.8.1/build/assets/skins/sam/dt-arrow-dn.png
  158. BIN lib/yui/2.8.1/build/assets/skins/sam/dt-arrow-up.png
  159. BIN lib/yui/2.8.1/build/assets/skins/sam/editor-knob.gif
  160. BIN lib/yui/2.8.1/build/assets/skins/sam/editor-sprite-active.gif
  161. BIN lib/yui/2.8.1/build/assets/skins/sam/editor-sprite.gif
  162. +0 −10 lib/yui/2.8.1/build/assets/skins/sam/editor.css
  163. BIN lib/yui/2.8.1/build/assets/skins/sam/header_background.png
  164. BIN lib/yui/2.8.1/build/assets/skins/sam/hue_bg.png
  165. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/imagecropper.css
  166. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/layout.css
  167. BIN lib/yui/2.8.1/build/assets/skins/sam/layout_sprite.png
  168. BIN lib/yui/2.8.1/build/assets/skins/sam/loading.gif
  169. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/logger.css
  170. BIN lib/yui/2.8.1/build/assets/skins/sam/menu-button-arrow-disabled.png
  171. BIN lib/yui/2.8.1/build/assets/skins/sam/menu-button-arrow.png
  172. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/menu.css
  173. BIN lib/yui/2.8.1/build/assets/skins/sam/menubaritem_submenuindicator.png
  174. BIN lib/yui/2.8.1/build/assets/skins/sam/menubaritem_submenuindicator_disabled.png
  175. BIN lib/yui/2.8.1/build/assets/skins/sam/menuitem_checkbox.png
  176. BIN lib/yui/2.8.1/build/assets/skins/sam/menuitem_checkbox_disabled.png
  177. BIN lib/yui/2.8.1/build/assets/skins/sam/menuitem_submenuindicator.png
  178. BIN lib/yui/2.8.1/build/assets/skins/sam/menuitem_submenuindicator_disabled.png
  179. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/paginator.css
  180. BIN lib/yui/2.8.1/build/assets/skins/sam/picker_mask.png
  181. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/profilerviewer.css
  182. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/progressbar.css
  183. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/resize.css
  184. +0 −10 lib/yui/2.8.1/build/assets/skins/sam/simpleeditor.css
  185. +0 −36 lib/yui/2.8.1/build/assets/skins/sam/skin.css
  186. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/slider.css
  187. BIN lib/yui/2.8.1/build/assets/skins/sam/split-button-arrow-active.png
  188. BIN lib/yui/2.8.1/build/assets/skins/sam/split-button-arrow-disabled.png
  189. BIN lib/yui/2.8.1/build/assets/skins/sam/split-button-arrow-focus.png
  190. BIN lib/yui/2.8.1/build/assets/skins/sam/split-button-arrow-hover.png
  191. BIN lib/yui/2.8.1/build/assets/skins/sam/split-button-arrow.png
  192. BIN lib/yui/2.8.1/build/assets/skins/sam/sprite.png
  193. BIN lib/yui/2.8.1/build/assets/skins/sam/sprite.psd
  194. +0 −8 lib/yui/2.8.1/build/assets/skins/sam/tabview.css
  195. BIN lib/yui/2.8.1/build/assets/skins/sam/treeview-loading.gif
  196. BIN lib/yui/2.8.1/build/assets/skins/sam/treeview-sprite.gif
  197. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/treeview.css
  198. BIN lib/yui/2.8.1/build/assets/skins/sam/wait.gif
  199. +0 −7 lib/yui/2.8.1/build/assets/skins/sam/yuitest.css
  200. +0 −7 lib/yui/2.8.1/build/autocomplete/assets/autocomplete-core.css
  201. +0 −57 lib/yui/2.8.1/build/autocomplete/assets/skins/sam/autocomplete-skin.css
  202. +0 −7 lib/yui/2.8.1/build/autocomplete/assets/skins/sam/autocomplete.css
  203. +0 −3,009 lib/yui/2.8.1/build/autocomplete/autocomplete-debug.js
  204. +0 −12 lib/yui/2.8.1/build/autocomplete/autocomplete-min.js
  205. +0 −2,966 lib/yui/2.8.1/build/autocomplete/autocomplete.js
  206. +0 −7 lib/yui/2.8.1/build/base/base-min.css
  207. +0 −131 lib/yui/2.8.1/build/base/base.css
  208. +0 −44 lib/yui/2.8.1/build/button/assets/button-core.css
  209. +0 −219 lib/yui/2.8.1/build/button/assets/skins/sam/button-skin.css
  210. +0 −7 lib/yui/2.8.1/build/button/assets/skins/sam/button.css
  211. BIN lib/yui/2.8.1/build/button/assets/skins/sam/menu-button-arrow-disabled.png
  212. BIN lib/yui/2.8.1/build/button/assets/skins/sam/menu-button-arrow.png
  213. BIN lib/yui/2.8.1/build/button/assets/skins/sam/split-button-arrow-active.png
  214. BIN lib/yui/2.8.1/build/button/assets/skins/sam/split-button-arrow-disabled.png
  215. BIN lib/yui/2.8.1/build/button/assets/skins/sam/split-button-arrow-focus.png
  216. BIN lib/yui/2.8.1/build/button/assets/skins/sam/split-button-arrow-hover.png
  217. BIN lib/yui/2.8.1/build/button/assets/skins/sam/split-button-arrow.png
  218. +0 −4,694 lib/yui/2.8.1/build/button/button-debug.js
  219. +0 −11 lib/yui/2.8.1/build/button/button-min.js
  220. +0 −4,633 lib/yui/2.8.1/build/button/button.js
  221. +0 −132 lib/yui/2.8.1/build/calendar/assets/calendar-core.css
  222. +0 −320 lib/yui/2.8.1/build/calendar/assets/calendar.css
  223. BIN lib/yui/2.8.1/build/calendar/assets/calgrad.png
  224. BIN lib/yui/2.8.1/build/calendar/assets/callt.gif
  225. BIN lib/yui/2.8.1/build/calendar/assets/calrt.gif
  226. BIN lib/yui/2.8.1/build/calendar/assets/calx.gif
  227. +0 −361 lib/yui/2.8.1/build/calendar/assets/skins/sam/calendar-skin.css
  228. +0 −8 lib/yui/2.8.1/build/calendar/assets/skins/sam/calendar.css
  229. +0 −7,324 lib/yui/2.8.1/build/calendar/calendar-debug.js
  230. +0 −18 lib/yui/2.8.1/build/calendar/calendar-min.js
  231. +0 −7,294 lib/yui/2.8.1/build/calendar/calendar.js
  232. BIN lib/yui/2.8.1/build/carousel/assets/ajax-loader.gif
  233. +0 −88 lib/yui/2.8.1/build/carousel/assets/carousel-core.css
  234. BIN lib/yui/2.8.1/build/carousel/assets/skins/sam/ajax-loader.gif
  235. +0 −142 lib/yui/2.8.1/build/carousel/assets/skins/sam/carousel-skin.css
  236. +0 −7 lib/yui/2.8.1/build/carousel/assets/skins/sam/carousel.css
  237. +0 −4,390 lib/yui/2.8.1/build/carousel/carousel-debug.js
  238. +0 −12 lib/yui/2.8.1/build/carousel/carousel-min.js
  239. +0 −4,349 lib/yui/2.8.1/build/carousel/carousel.js
  240. BIN lib/yui/2.8.1/build/charts/assets/charts.swf
  241. +0 −2,061 lib/yui/2.8.1/build/charts/charts-debug.js
  242. +0 −9 lib/yui/2.8.1/build/charts/charts-min.js
  243. +0 −2,060 lib/yui/2.8.1/build/charts/charts.js
  244. +0 −6 lib/yui/2.8.1/build/colorpicker/assets/colorpicker-core.css
  245. BIN lib/yui/2.8.1/build/colorpicker/assets/hue_thumb.png
  246. BIN lib/yui/2.8.1/build/colorpicker/assets/picker_mask.png
  247. BIN lib/yui/2.8.1/build/colorpicker/assets/picker_thumb.png
  248. +0 −105 lib/yui/2.8.1/build/colorpicker/assets/skins/sam/colorpicker-skin.css
  249. +0 −7 lib/yui/2.8.1/build/colorpicker/assets/skins/sam/colorpicker.css
  250. BIN lib/yui/2.8.1/build/colorpicker/assets/skins/sam/hue_bg.png
  251. BIN lib/yui/2.8.1/build/colorpicker/assets/skins/sam/picker_mask.png
Sorry, we could not display the entire diff because too many files (643) changed.
View
2 admin/dbtransfer/lib.php
@@ -26,7 +26,7 @@ function dbtransfer_export_xml_database($description, $mdb) {
session_get_instance()->write_close(); // release session
- header('Content-Type: application/xhtml+xml');
+ header('Content-Type: application/xhtml+xml; charset=utf-8');
header('Content-Disposition: attachment; filename=database.xml');
header('Expires: 0');
header('Cache-Control: must-revalidate,post-check=0,pre-check=0');
View
11 admin/modules.php
@@ -141,12 +141,17 @@
$settings = "";
}
- $count = $DB->count_records_select($module->name, "course<>0");
+ try {
+ $count = $DB->count_records_select($module->name, "course<>0");
+ } catch (dml_exception $e) {
+ $count = -1;
+ }
if ($count>0) {
$countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist=$module->name" .
"&amp;sesskey=".sesskey()."\" title=\"$strshowmodulecourse\">$count</a>";
- }
- else {
+ } else if ($count < 0) {
+ $countlink = get_string('error');
+ } else {
$countlink = "$count";
}
View
53 admin/multilangupgrade.php
@@ -56,35 +56,34 @@
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
// first find candidate records
$sql = "SELECT id, $column FROM $fulltable WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'";
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach ($rs as $data) {
- $text = $data->$column;
- $id = $data->id;
- if ($i % 600 == 0) {
- echo '<br />';
- }
- if ($i % 10 == 0) {
- echo '.';
- }
- $i++;
-
- if (empty($text) or is_numeric($text)) {
- continue; // nothing to do
- }
-
- $search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
- $newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
-
- if (is_null($newtext)) {
- continue; // regex error
- }
-
- if ($newtext != $text) {
- $DB->execute("UPDATE $fulltable SET $column=? WHERE id=?", array($newtext, $id));
- }
+ $rs = $DB->get_recordset_sql($sql);
+ foreach ($rs as $data) {
+ $text = $data->$column;
+ $id = $data->id;
+ if ($i % 600 == 0) {
+ echo '<br />';
+ }
+ if ($i % 10 == 0) {
+ echo '.';
+ }
+ $i++;
+
+ if (empty($text) or is_numeric($text)) {
+ continue; // nothing to do
+ }
+
+ $search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
+ $newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
+
+ if (is_null($newtext)) {
+ continue; // regex error
+ }
+
+ if ($newtext != $text) {
+ $DB->execute("UPDATE $fulltable SET $column=? WHERE id=?", array($newtext, $id));
}
- $rs->close();
}
+ $rs->close();
}
}
}
View
4 admin/settings/development.php
@@ -20,8 +20,8 @@
$ADMIN->add('experimental', $temp);
// DB transfer related pages
- $ADMIN->add('experimental', new admin_externalpage('dbtransfer', get_string('dbtransfer', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/index.php', 'moodle/site:config'));
- $ADMIN->add('experimental', new admin_externalpage('dbexport', get_string('dbexport', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/dbexport.php', 'moodle/site:config'));
+ $ADMIN->add('experimental', new admin_externalpage('dbtransfer', get_string('dbtransfer', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/index.php', 'moodle/site:config', true));
+ $ADMIN->add('experimental', new admin_externalpage('dbexport', get_string('dbexport', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/dbexport.php', 'moodle/site:config', true));
// "debugging" settingpage
$temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
View
4 admin/settings/subsystems.php
@@ -37,10 +37,6 @@
$optionalsubsystems->add(new admin_setting_configcheckbox('enablecompletion',
get_string('enablecompletion','completion'),
get_string('configenablecompletion','completion'), 0));
- $optionalsubsystems->add(new admin_setting_pickroles('progresstrackedroles',
- get_string('progresstrackedroles','completion'),
- get_string('configprogresstrackedroles', 'completion'),
- array('student')));
$optionalsubsystems->add(new admin_setting_configcheckbox('enableavailability',
get_string('enableavailability','condition'),
get_string('configenableavailability','condition'), 0));
View
2 admin/settings/users.php
@@ -107,7 +107,7 @@
if (!during_initial_install()) {
$temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
- get_string('configcreatornewroleid', 'admin'), $defaultteacherid, $creatornewroles));
+ get_string('creatornewroleid_help', 'admin'), $defaultteacherid, $creatornewroles));
}
$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
View
14 admin/uploaduser.php
@@ -668,10 +668,16 @@
$courseid = $ccache[$shortname]->id;
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
if (!isset($manualcache[$courseid])) {
- if ($instances = enrol_get_instances($courseid, false)) {
- $manualcache[$courseid] = reset($instances);
- } else {
- $manualcache[$courseid] = false;
+ $manualcache[$courseid] = false;
+ if ($manual) {
+ if ($instances = enrol_get_instances($courseid, false)) {
+ foreach ($instances as $instance) {
+ if ($instance->enrol === 'manual') {
+ $manualcache[$courseid] = $instance;
+ break;
+ }
+ }
+ }
}
}
View
11 admin/user/lib.php
@@ -11,14 +11,13 @@ function add_selection_all($ufiltering) {
list($sqlwhere, $params) = $ufiltering->get_sql_filter("id<>:exguest AND deleted <> 1", array('exguest'=>$CFG->siteguest));
- if ($rs = $DB->get_recordset_select('user', $sqlwhere, $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname')) {
- foreach ($rs as $user) {
- if (!isset($SESSION->bulk_users[$user->id])) {
- $SESSION->bulk_users[$user->id] = $user->id;
- }
+ $rs = $DB->get_recordset_select('user', $sqlwhere, $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
+ foreach ($rs as $user) {
+ if (!isset($SESSION->bulk_users[$user->id])) {
+ $SESSION->bulk_users[$user->id] = $user->id;
}
- $rs->close();
}
+ $rs->close();
}
function get_selection_data($ufiltering) {
View
21 admin/user/user_bulk_confirm.php
@@ -24,19 +24,18 @@
if ($confirm and confirm_sesskey()) {
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
- if ($rs = $DB->get_recordset_select('user', "id $in", $params, '', 'id, username, secret, confirmed, auth, firstname, lastname')) {
- foreach ($rs as $user) {
- if ($user->confirmed) {
- continue;
- }
- $auth = get_auth_plugin($user->auth);
- $result = $auth->user_confirm($user->username, $user->secret);
- if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
- echo $OUTPUT->notification(get_string('usernotconfirmed', '', fullname($user, true)));
- }
+ $rs = $DB->get_recordset_select('user', "id $in", $params, '', 'id, username, secret, confirmed, auth, firstname, lastname');
+ foreach ($rs as $user) {
+ if ($user->confirmed) {
+ continue;
+ }
+ $auth = get_auth_plugin($user->auth);
+ $result = $auth->user_confirm($user->username, $user->secret);
+ if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
+ echo $OUTPUT->notification(get_string('usernotconfirmed', '', fullname($user, true)));
}
- $rs->close();
}
+ $rs->close();
redirect($return, get_string('changessaved'));
} else {
View
15 admin/user/user_bulk_delete.php
@@ -25,16 +25,15 @@
if ($confirm and confirm_sesskey()) {
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
- if ($rs = $DB->get_recordset_select('user', "id $in", $params)) {
- foreach ($rs as $user) {
- if (!is_siteadmin($user) and $USER->id != $user->id and delete_user($user)) {
- unset($SESSION->bulk_users[$user->id]);
- } else {
- echo $OUTPUT->notification(get_string('deletednot', '', fullname($user, true)));
- }
+ $rs = $DB->get_recordset_select('user', "id $in", $params);
+ foreach ($rs as $user) {
+ if (!is_siteadmin($user) and $USER->id != $user->id and delete_user($user)) {
+ unset($SESSION->bulk_users[$user->id]);
+ } else {
+ echo $OUTPUT->notification(get_string('deletednot', '', fullname($user, true)));
}
- $rs->close();
}
+ $rs->close();
session_gc(); // remove stale sessions
redirect($return, get_string('changessaved'));
View
17 admin/user/user_bulk_forcepasswordchange.php
@@ -38,17 +38,16 @@
$parts = array_chunk($SESSION->bulk_users, 300);
foreach ($parts as $users) {
list($in, $params) = $DB->get_in_or_equal($users);
- if ($rs = $DB->get_recordset_select('user', "id $in", $params)) {
- foreach ($rs as $user) {
- if (!empty($changeable[$user->auth])) {
- set_user_preference('auth_forcepasswordchange', 1, $user->id);
- unset($SESSION->bulk_users[$user->id]);
- } else {
- echo $OUTPUT->notification(get_string('forcepasswordchangenot', '', fullname($user, true)));
- }
+ $rs = $DB->get_recordset_select('user', "id $in", $params);
+ foreach ($rs as $user) {
+ if (!empty($changeable[$user->auth])) {
+ set_user_preference('auth_forcepasswordchange', 1, $user->id);
+ unset($SESSION->bulk_users[$user->id]);
+ } else {
+ echo $OUTPUT->notification(get_string('forcepasswordchangenot', '', fullname($user, true)));
}
- $rs->close();
}
+ $rs->close();
}
echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
echo $OUTPUT->continue_button($return);
View
15 admin/user/user_bulk_message.php
@@ -25,15 +25,14 @@
if ($confirm and !empty($msg) and confirm_sesskey()) {
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
- if ($rs = $DB->get_recordset_select('user', "id $in", $params)) {
- foreach ($rs as $user) {
- //TODO we should probably support all text formats here or only FORMAT_MOODLE
- //For now bulk messaging is still using the html editor and its supplying html
- //so we have to use html format for it to be displayed correctly
- message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct');
- }
- $rs->close();
+ $rs = $DB->get_recordset_select('user', "id $in", $params);
+ foreach ($rs as $user) {
+ //TODO we should probably support all text formats here or only FORMAT_MOODLE
+ //For now bulk messaging is still using the html editor and its supplying html
+ //so we have to use html format for it to be displayed correctly
+ message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct');
}
+ $rs->close();
redirect($return);
}
View
2 admin/xmldb/index.php
@@ -103,7 +103,7 @@
echo $OUTPUT->footer();
break;
case ACTION_GENERATE_XML:
- header('Content-type: application/xhtml+xml');
+ header('Content-type: application/xhtml+xml; charset=utf-8');
echo $xmldb_action->getOutput();
break;
}
View
15 auth/shibboleth/logout.php
@@ -12,7 +12,7 @@
// Find out whether host supports https
$protocol = 'http://';
if ( isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){
- $protocol = 'https://';
+ $protocol = 'https://';
}
// Front channel logout
@@ -197,11 +197,12 @@ function LogoutNotification($SessionID){
/*****************************************************************************/
// Same function as in adodb, but cannot be used for file session for some reason...
-function unserializesession( $serialized_string ){
- $variables = array( );
- $a = preg_split( "/(\w+)\|/", $serialized_string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
- for( $i = 0; $i < count( $a ); $i = $i+2 ) {
- $variables[$a[$i]] = unserialize( $a[$i+1] );
+function unserializesession($serialized_string) {
+ $variables = array();
+ $a = preg_split("/(\w+)\|/", $serialized_string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
+ $counta = count($a);
+ for ($i = 0; $i < $counta; $i = $i+2) {
+ $variables[$a[$i]] = unserialize($a[$i+1]);
}
- return( $variables );
+ return $variables;
}
View
8 backup/lib.php
@@ -119,7 +119,7 @@ function delete_dir_contents ($dir,$excludeddir="") {
}
// Loop through all directory entries, and construct two temporary arrays containing files and sub directories
- while(false !== ($entry = readdir($handle))) {
+ while (false !== ($entry = readdir($handle))) {
if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) {
$dir_subdirs[] = $dir. $slash .$entry;
}
@@ -129,15 +129,17 @@ function delete_dir_contents ($dir,$excludeddir="") {
}
// Delete all files in the curent directory return false and halt if a file cannot be removed
- for($i=0; $i<count($dir_files); $i++) {
+ $countdirfiles = count($dir_files);
+ for ($i=0; $i<$countdirfiles; $i++) {
chmod($dir_files[$i], $CFG->directorypermissions);
if (((unlink($dir_files[$i]))) == FALSE) {
return false;
}
}
// Empty sub directories and then remove the directory
- for($i=0; $i<count($dir_subdirs); $i++) {
+ $countdirsubdirs = count($dir_subdirs);
+ for($i=0; $i<$countdirsubdirs; $i++) {
chmod($dir_subdirs[$i], $CFG->directorypermissions);
if (delete_dir_contents($dir_subdirs[$i]) == FALSE) {
return false;
View
3 backup/restorelib.php
@@ -377,7 +377,8 @@ function restore_create_blogs($restore,$xml_file) {
$tagsarr = $info['BLOG']['#']['BLOG_TAGS']['0']['#']['BLOG_TAG'];
//Iterate over tags
$tags = array();
- for($i = 0; $i < sizeof($tagsarr); $i++) {
+ $sizetagsarr = sizeof($tagsarr);
+ for ($i = 0; $i < $sizetagsarr; $i++) {
$tag_info = $tagsarr[$i];
///traverse_xmlize($tag_info); //Debug
///print_object ($GLOBALS['traverse_array']); //Debug
View
3 blocks/activity_modules/block_activity_modules.php
@@ -27,7 +27,8 @@ function get_content() {
$archetypes = array();
foreach($modinfo->cms as $cm) {
- if (!$cm->uservisible or $cm->modname === 'label') {
+ // Exclude activities which are not visible or have no link (=label)
+ if (!$cm->uservisible or !$cm->has_view()) {
continue;
}
if (array_key_exists($cm->modname, $modfullnames)) {
View
2 blocks/course_overview/block_course_overview.php
@@ -64,7 +64,7 @@ public function get_content() {
$courses_limit = $courses_limit + 1;
}
- $courses = enrol_get_my_courses('id, shortname', 'visible DESC,sortorder ASC', $courses_limit);
+ $courses = enrol_get_my_courses('id, shortname, modinfo', 'visible DESC,sortorder ASC', $courses_limit);
$site = get_site();
$course = $site; //just in case we need the old global $course hack
View
2 blocks/course_summary/block_course_summary.php
@@ -14,6 +14,8 @@ function specialization() {
function get_content() {
global $CFG, $OUTPUT;
+ require_once($CFG->libdir . '/filelib.php');
+
if($this->content !== NULL) {
return $this->content;
}
View
4 blocks/html/block_html.php
@@ -42,6 +42,10 @@ function instance_allow_multiple() {
}
function get_content() {
+ global $CFG;
+
+ require_once($CFG->libdir . '/filelib.php');
+
if ($this->content !== NULL) {
return $this->content;
}
View
138 blocks/myprofile/block_myprofile.php
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -16,16 +15,23 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Displays the user's profile information.
+ * Block displaying information about current logged-in user.
+ *
+ * This block can be used as anti cheating measure, you
+ * can easily check the logged-in user matches the person
+ * operating the computer.
*
- * @package blocks
+ * @package block
+ * @subpackage myprofile
* @copyright 2010 Remote-Learner.net
* @author Olav Jordan <olav.jordan@remote-learner.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
- * Displays the user's profile information.
+ * Displays the current user's profile information.
*
* @copyright 2010 Remote-Learner.net
* @author Olav Jordan <olav.jordan@remote-learner.ca>
@@ -51,178 +57,123 @@ public function get_content() {
return $this->content;
}
- if (!isloggedin()){
- return ''; // Never useful unless you are logged in
+ if (!isloggedin() or isguestuser()) {
+ return ''; // Never useful unless you are logged in as real users
}
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
$course = $this->page->course;
- if ($PAGE->context->contextlevel == CONTEXT_USER) {
- $user = $DB->get_record('user', array('id' => $PAGE->context->instanceid));
- } else {
- $user = $USER;
- }
-
- if ($course->id == SITEID) {
- $coursecontext = get_context_instance(CONTEXT_SYSTEM);
- } else {
- $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // Course context
- // Make sure they can view the course
- if (!is_viewing($coursecontext)) {
- return '';
- }
- }
-
-
- // TODO: clean up the following even more
if (!isset($this->config->display_picture) || $this->config->display_picture == 1) {
$this->content->text .= '<div class="myprofileitem picture">';
- $this->content->text .= $OUTPUT->user_picture($user, array('courseid'=>$course->id, 'size'=>'100', 'class'=>'profilepicture')); // The new class makes CSS easier
+ $this->content->text .= $OUTPUT->user_picture($USER, array('courseid'=>$course->id, 'size'=>'100', 'class'=>'profilepicture')); // The new class makes CSS easier
$this->content->text .= '</div>';
}
- $this->content->text .= '<div class="myprofileitem fullname">'.fullname($user).'</div>';
+ $this->content->text .= '<div class="myprofileitem fullname">'.fullname($USER).'</div>';
if(!isset($this->config->display_country) || $this->config->display_country == 1) {
$countries = get_string_manager()->get_list_of_countries();
- if (isset($countries[$user->country])) {
+ if (isset($countries[$USER->country])) {
$this->content->text .= '<div class="myprofileitem country">';
- $this->content->text .= get_string('country') . ': ' . $countries[$user->country];
+ $this->content->text .= get_string('country') . ': ' . $countries[$USER->country];
$this->content->text .= '</div>';
}
}
if(!isset($this->config->display_city) || $this->config->display_city == 1) {
$this->content->text .= '<div class="myprofileitem city">';
- $this->content->text .= get_string('city') . ': ' . $user->city;
+ $this->content->text .= get_string('city') . ': ' . format_string($USER->city);
$this->content->text .= '</div>';
}
if(!isset($this->config->display_email) || $this->config->display_email == 1) {
$this->content->text .= '<div class="myprofileitem email">';
- $this->content->text .= obfuscate_mailto($user->email, '');
+ $this->content->text .= obfuscate_mailto($USER->email, '');
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_icq) && !empty($user->icq)) {
+ if(!empty($this->config->display_icq) && !empty($USER->icq)) {
$this->content->text .= '<div class="myprofileitem icq">';
- $this->content->text .= 'ICQ: ' . $user->icq;
+ $this->content->text .= 'ICQ: ' . s($USER->icq);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_skype) && !empty($user->skype)) {
+ if(!empty($this->config->display_skype) && !empty($USER->skype)) {
$this->content->text .= '<div class="myprofileitem skype">';
- $this->content->text .= 'Skype: ' . $user->skype;
+ $this->content->text .= 'Skype: ' . s($USER->skype);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_yahoo) && !empty($user->yahoo)) {
+ if(!empty($this->config->display_yahoo) && !empty($USER->yahoo)) {
$this->content->text .= '<div class="myprofileitem yahoo">';
- $this->content->text .= 'Yahoo: ' . $user->yahoo;
+ $this->content->text .= 'Yahoo: ' . s($USER->yahoo);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_aim) && !empty($user->aim)) {
+ if(!empty($this->config->display_aim) && !empty($USER->aim)) {
$this->content->text .= '<div class="myprofileitem aim">';
- $this->content->text .= 'AIM: ' . $user->aim;
+ $this->content->text .= 'AIM: ' . s($USER->aim);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_msn) && !empty($user->msn)) {
+ if(!empty($this->config->display_msn) && !empty($USER->msn)) {
$this->content->text .= '<div class="myprofileitem msn">';
- $this->content->text .= 'MSN: ' . $user->msn;
+ $this->content->text .= 'MSN: ' . s($USER->msn);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_phone1) && !empty($user->phone1)) {
+ if(!empty($this->config->display_phone1) && !empty($USER->phone1)) {
$this->content->text .= '<div class="myprofileitem phone1">';
- $this->content->text .= get_string('phone').': ' . $user->phone1;
+ $this->content->text .= get_string('phone').': ' . s($USER->phone1);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_phone2) && !empty($user->phone2)) {
+ if(!empty($this->config->display_phone2) && !empty($USER->phone2)) {
$this->content->text .= '<div class="myprofileitem phone2">';
- $this->content->text .= get_string('phone').': ' . $user->phone2;
+ $this->content->text .= get_string('phone').': ' . s($USER->phone2);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_institution) && !empty($user->institution)) {
+ if(!empty($this->config->display_institution) && !empty($USER->institution)) {
$this->content->text .= '<div class="myprofileitem institution">';
- $this->content->text .= $user->institution;
+ $this->content->text .= format_string($USER->institution);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_address) && !empty($user->address)) {
+ if(!empty($this->config->display_address) && !empty($USER->address)) {
$this->content->text .= '<div class="myprofileitem address">';
- $this->content->text .= $user->address;
+ $this->content->text .= format_string($USER->address);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_firstaccess) && !empty($user->firstaccess)) {
+ if(!empty($this->config->display_firstaccess) && !empty($USER->firstaccess)) {
$this->content->text .= '<div class="myprofileitem firstaccess">';
- $this->content->text .= get_string('firstaccess').': ' . userdate($user->firstaccess);
+ $this->content->text .= get_string('firstaccess').': ' . userdate($USER->firstaccess);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_lastaccess) && !empty($user->lastaccess)) {
+ if(!empty($this->config->display_lastaccess) && !empty($USER->lastaccess)) {
$this->content->text .= '<div class="myprofileitem lastaccess">';
- $this->content->text .= get_string('lastaccess').': ' . userdate($user->lastaccess);
+ $this->content->text .= get_string('lastaccess').': ' . userdate($USER->lastaccess);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_currentlogin) && !empty($user->currentlogin)) {
+ if(!empty($this->config->display_currentlogin) && !empty($USER->currentlogin)) {
$this->content->text .= '<div class="myprofileitem currentlogin">';
- $this->content->text .= get_string('login').': ' . userdate($user->currentlogin);
+ $this->content->text .= get_string('login').': ' . userdate($USER->currentlogin);
$this->content->text .= '</div>';
}
- if(!empty($this->config->display_lastip) && !empty($user->lastip)) {
+ if(!empty($this->config->display_lastip) && !empty($USER->lastip)) {
$this->content->text .= '<div class="myprofileitem lastip">';
- $this->content->text .= 'IP: ' . $user->lastip;
- $this->content->text .= '</div>';
- }
-
- $editscript = NULL;
- if (isguestuser($user)) {
- // guest account can not be edited
-
- } else if (is_mnet_remote_user($user)) {
- // cannot edit remote users
-
- } else if (isguestuser() or !isloggedin()) {
- // guests and not logged in can not edit own profile
-
- } else if ($USER->id == $user->id) {
- $systemcontext = get_context_instance(CONTEXT_SYSTEM);
- if (has_capability('moodle/user:update', $systemcontext)) {
- $editscript = '/user/editadvanced.php';
- } else if (has_capability('moodle/user:editownprofile', $systemcontext)) {
- $editscript = '/user/edit.php';
- }
-
- } else {
- $systemcontext = get_context_instance(CONTEXT_SYSTEM);
- $personalcontext = get_context_instance(CONTEXT_USER, $user->id);
- if (has_capability('moodle/user:update', $systemcontext) and !is_primary_admin($user->id)){
- $editscript = '/user/editadvanced.php';
- } else if (has_capability('moodle/user:editprofile', $personalcontext) and !is_primary_admin($user->id)){
- //teachers, parents, etc.
- $editscript = '/user/edit.php';
- }
- }
-
-
- if ($editscript) {
- $this->content->text .= '<div class="myprofileitem edit">';
- $this->content->text .= '<a href="'.$CFG->wwwroot.$editscript.'?id='.$user->id.'&amp;course='.$course->id.'">'.get_string('editmyprofile').'</a>';
+ $this->content->text .= 'IP: ' . $USER->lastip;
$this->content->text .= '</div>';
}
-
return $this->content;
}
@@ -304,4 +255,3 @@ public function before_delete() {
}
}
-?>
View
6 blocks/myprofile/edit_form.php
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -15,10 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+defined('MOODLE_INTERNAL') || die();
+
/**
* Form for editing profile block settings
*
- * @package blocks
+ * @package block
+ * @subpackage myprofile
* @copyright 2010 Remote-Learner.net
* @author Olav Jordan <olav.jordan@remote-learner.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
View
30 blocks/myprofile/lang/en/block_myprofile.php
@@ -1,6 +1,31 @@
<?php
-$string['pluginname'] = 'Personal profile';
-$string['myprofile_settings'] = 'Personal profile settings';
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Strings for component 'block_myprofile', language 'en', branch 'MOODLE_20_STABLE'
+ *
+ * @package block
+ * @subpackage myprofile
+ * @copyright 2010 Remote-Learner.net
+ * @author Olav Jordan <olav.jordan@remote-learner.ca>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Logged in user';
+$string['myprofile_settings'] = 'Visible user information';
$string['contentsettings'] = 'Display settings for content region';
$string['display_picture'] = 'Display picture';
$string['display_country'] = 'Display country';
@@ -20,4 +45,3 @@
$string['display_lastaccess'] = 'Display last access';
$string['display_currentlogin'] = 'Display current login';
$string['display_lastip'] = 'Display last IP';
-?>
View
13 blocks/myprofile/version.php
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -15,4 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Current user info block.
+ *
+ * @package block
+ * @subpackage myprofile
+ * @copyright 2010 Remote-Learner.net
+ * @author Olav Jordan <olav.jordan@remote-learner.ca>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
$plugin->version = 2009123100;
View
10 blocks/online_users/block_online_users.php
@@ -43,8 +43,6 @@ function get_content() {
$groupmembers = "";
$groupselect = "";
- $rafrom = "";
- $rawhere = "";
$params = array();
//Add this to the SQL to show only group users
@@ -78,22 +76,22 @@ function get_content() {
$params = array_merge($params, $eparams);
$sql = "SELECT $userfields, MAX(ul.timeaccess) AS lastaccess
- FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
+ FROM {user_lastaccess} ul $groupmembers, {user} u
JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
- $groupselect $rawhere
+ $groupselect
GROUP BY $userfields
ORDER BY lastaccess DESC";
$csql = "SELECT u.id
- FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
+ FROM {user_lastaccess} ul $groupmembers, {user} u
JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
- $groupselect $rawhere
+ $groupselect
GROUP BY u.id";
$params['courseid'] = $this->page->course->id;
View
42 blocks/site_main_menu/block_site_main_menu.php
@@ -40,21 +40,19 @@ function get_content() {
if (!$cm->uservisible) {
continue;
}
- if ($cm->modname == 'label') {
- $this->content->items[] = format_text($cm->extra, FORMAT_HTML, $options);
+
+ list($content, $instancename) =
+ get_print_section_cm_text($cm, $course);
+
+ if (!($url = $cm->get_url())) {
+ $this->content->items[] = $content;
$this->content->icons[] = '';
} else {
$linkcss = $cm->visible ? '' : ' class="dimmed" ';
- $instancename = format_string($cm->name, true, $course->id);
//Accessibility: incidental image - should be empty Alt text
- if (!empty($cm->icon)) {
- $icon = $OUTPUT->pix_url($cm->icon);
- } else {
- $icon = $OUTPUT->pix_url('icon', $cm->modname);
- }
- $icon = '<img src="'.$icon.'" class="icon" alt="" />&nbsp;';
+ $icon = '<img src="' . $cm->get_icon_url() . '" class="icon" alt="" />&nbsp;';
$this->content->items[] = '<a title="'.$cm->modplural.'" '.$linkcss.' '.$cm->extra.
- ' href="'.$CFG->wwwroot.'/mod/'.$cm->modname.'/view.php?id='.$cm->id.'">'.$icon.$instancename.'</a>';
+ ' href="' . $url . '">' . $icon . $instancename . '</a>';
}
}
}
@@ -114,28 +112,18 @@ function get_content() {
'<img style="height:16px; width:80px; border:0px" src="'.$OUTPUT->pix_url('movehere') . '" alt="'.$strmovehere.'" /></a>';
$this->content->icons[] = '';
}
- $instancename = $modinfo->cms[$modnumber]->name;
- $instancename = format_string($instancename, true, $course->id);
+ list($content, $instancename) =
+ get_print_section_cm_text($modinfo->cms[$modnumber], $course);
$linkcss = $mod->visible ? '' : ' class="dimmed" ';
- if (!empty($modinfo->cms[$modnumber]->extra)) {
- $extra = $modinfo->cms[$modnumber]->extra;
- } else {
- $extra = '';
- }
- if (!empty($modinfo->cms[$modnumber]->icon)) {
- $icon = $OUTPUT->pix_url($modinfo->cms[$modnumber]->icon);
- } else {
- $icon = $OUTPUT->pix_url('icon', $mod->modname);
- }
- if ($mod->modname == 'label') {
- $this->content->items[] = format_text($extra, FORMAT_HTML,$options).$editbuttons;
+ if (!($url = $mod->get_url())) {
+ $this->content->items[] = $content . $editbuttons;
$this->content->icons[] = '';
} else {
//Accessibility: incidental image - should be empty Alt text
- $icon = '<img src="'.$icon.'" class="icon" alt="" />&nbsp;';
- $this->content->items[] = '<a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
- ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.$icon.$instancename.'</a>'.$editbuttons;
+ $icon = '<img src="' . $mod->get_icon_url() . '" class="icon" alt="" />&nbsp;';
+ $this->content->items[] = '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $mod->extra .
+ ' href="' . $url . '">' . $icon . $instancename . '</a>' . $editbuttons;
}
}
}
View
43 blocks/social_activities/block_social_activities.php
@@ -42,21 +42,19 @@ function get_content() {
if (!$cm->uservisible) {
continue;
}
- if ($cm->modname == 'label') {
- $this->content->items[] = format_text($cm->extra, FORMAT_HTML, $options);
+
+ list($content, $instancename) =
+ get_print_section_cm_text($cm, $course);
+
+ if (!($url = $cm->get_url())) {
+ $this->content->items[] = $content;
$this->content->icons[] = '';
} else {
$linkcss = $cm->visible ? '' : ' class="dimmed" ';
- $instancename = format_string($cm->name, true, $course->id);
//Accessibility: incidental image - should be empty Alt text
- if (!empty($cm->icon)) {
- $icon = $OUTPUT->pix_url($cm->icon);
- } else {
- $icon = $OUTPUT->pix_url('icon', $cm->modname);
- }
- $icon = '<img src="'.$icon.'" class="icon" alt="" />&nbsp;';
+ $icon = '<img src="' . $cm->get_icon_url() . '" class="icon" alt="" />&nbsp;';
$this->content->items[] = '<a title="'.$cm->modplural.'" '.$linkcss.' '.$cm->extra.
- ' href="'.$CFG->wwwroot.'/mod/'.$cm->modname.'/view.php?id='.$cm->id.'">'.$icon.$instancename.'</a>';
+ ' href="' . $url . '">' . $icon . $instancename . '</a>';
}
}
}
@@ -123,28 +121,19 @@ function get_content() {
'<img style="height:16px; width:80px; border:0px" src="'.$OUTPUT->pix_url('movehere') . '" alt="'.$strmovehere.'" /></a>';
$this->content->icons[] = '';
}
- $instancename = $modinfo->cms[$modnumber]->name;
- $instancename = format_string($instancename, true, $course->id);
+ list($content, $instancename) =
+ get_print_section_cm_text($modinfo->cms[$modnumber], $course);
+
$linkcss = $mod->visible ? '' : ' class="dimmed" ';
- if (!empty($modinfo->cms[$modnumber]->extra)) {
- $extra = $modinfo->cms[$modnumber]->extra;
- } else {
- $extra = '';
- }
- if (!empty($modinfo->cms[$modnumber]->icon)) {
- $icon = $OUTPUT->pix_url($modinfo->cms[$modnumber]->icon);
- } else {
- $icon = $OUTPUT->pix_url('icon', $mod->modname);
- }
- if ($mod->modname == 'label') {
- $this->content->items[] = format_text($extra, FORMAT_HTML, $options).$editbuttons;
+ if (!($url = $mod->get_url())) {
+ $this->content->items[] = $content . $editbuttons;
$this->content->icons[] = '';
} else {
//Accessibility: incidental image - should be empty Alt text
- $icon = '<img src="'.$icon.'" class="icon" alt="" />&nbsp;';
- $this->content->items[] = '<a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
- ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.$icon.$instancename.'</a>'.$editbuttons;
+ $icon = '<img src="' . $mod->get_icon_url() . '" class="icon" alt="" />&nbsp;';
+ $this->content->items[] = '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $mod->extra .
+ ' href="' . $url . '">' . $icon . $instancename . '</a>' . $editbuttons;
}
}
}
View
4 blog/lib.php
@@ -548,11 +548,11 @@ function blog_get_options_for_course(stdClass $course, stdClass $user=null) {
* Get the blog options relating to the given module for the given user
*
* @staticvar array $moduleoptions Cache
- * @param stdClass $module The module to get options for
+ * @param stdClass|cm_info $module The module to get options for
* @param stdClass $user The user to get options for null == currentuser
* @return array
*/
-function blog_get_options_for_module(stdClass $module, stdClass $user=null) {
+function blog_get_options_for_module($module, $user=null) {
global $CFG, $USER;
// Cache
static $moduleoptions = array();
View
2 blog/locallib.php
@@ -26,6 +26,8 @@
defined('MOODLE_INTERNAL') || die();
+require_once($CFG->libdir . '/filelib.php');
+
/**
* Blog_entry class. Represents an entry in a user's blog. Contains all methods for managing this entry.
* This class does not contain any HTML-generating code. See blog_listing sub-classes for such code.
View
31 brokenfile.php
@@ -0,0 +1,31 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * This is an empty file which is used in order to prevent
+ * error logs in the serverlog.
+ *
+ * Sometimes developer forgets to postprocess files when saving
+ * submitted form data or forget to replace the file placeholders
+ * with the current area information.
+ *
+ * @package core
+ * @subpackage file
+ * @copyright 2011 Petr Skoda (http://skodak.org)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+@header('HTTP/1.0 404 not found');
View
2 calendar/export_execute.php
@@ -165,6 +165,6 @@
header('Accept-Ranges: none'); // Comment out if PDFs do not work...
header('Content-disposition: attachment; filename='.$filename);
header('Content-length: '.strlen($serialized));
-header('Content-type: text/calendar');
+header('Content-type: text/calendar; charset=utf-8');
echo $serialized;
View
5 calendar/lib.php
@@ -1874,7 +1874,10 @@ protected function get_editoroptions() {
* @return string
*/
protected function get_description() {
- global $USER;
+ global $USER, $CFG;
+
+ require_once($CFG->libdir . '/filelib.php');
+
if ($this->_description === null) {
// Check if we have already resolved the context for this event
if ($this->editorcontext === null) {
View
12 config-dist.php
@@ -50,9 +50,12 @@
// used? set to 'false' for the most stable
// setting, 'true' can improve performance
// sometimes
- 'dbsocket' => false, // should connection via UNIX socket be
- // used? if you set it to 'true' here,
- // set dbhost to 'localhost'
+ 'dbsocket' => false, // should connection via UNIX socket be used?
+ // if you set it to 'true' or custom path
+ // here set dbhost to 'localhost',
+ // (please note mysql is always using socket
+ // if dbhost is 'localhost' - if you need
+ // local port connection use '127.0.0.1')
'dbport' => '', // the TCP port number to use when connecting
// to the server. keep empty string for the
// default port
@@ -376,7 +379,8 @@
// Prevent core_string_manager on-disk cache
// $CFG->langstringcache = false; // NOT FOR PRODUCTION SERVERS!
//
-// When working with production data on test servers, no emails should ever be send to real users
+// When working with production data on test servers, no emails or other messages
+// should ever be send to real users
// $CFG->noemailever = true; // NOT FOR PRODUCTION SERVERS!
//
// Divert all outgoing emails to this address to test and debug emailing features
View
306 course/lib.php
@@ -48,10 +48,6 @@
define('MOD_CLASS_ACTIVITY', 0);
define('MOD_CLASS_RESOURCE', 1);
-if (!defined('MAX_MODINFO_CACHE_SIZE')) {
- define('MAX_MODINFO_CACHE_SIZE', 10);
-}
-
function make_log_url($module, $url) {
switch ($module) {
case 'course':
@@ -351,7 +347,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
$table->head = array(
get_string('time'),
get_string('ip_address'),
- get_string('fullnamecourse'),
+ get_string('fullname'),
get_string('action'),
get_string('info')
);
@@ -959,6 +955,9 @@ function print_recent_activity($course) {
}
$info = explode(' ', $log->info);
+ // note: in most cases I replaced hardcoding of label with use of
+ // $cm->has_view() but it was not possible to do this here because
+ // we don't necessarily have the $cm for it
if ($info[0] == 'label') { // Labels are ignored in recent activity
continue;
}
@@ -1112,9 +1111,6 @@ function get_array_of_activities($courseid) {
if (function_exists($functionname)) {
if ($info = $functionname($rawmods[$seq])) {
- if (!empty($info->extra)) {
- $mod[$seq]->extra = $info->extra;
- }
if (!empty($info->icon)) {
$mod[$seq]->icon = $info->icon;
}
@@ -1124,11 +1120,45 @@ function get_array_of_activities($courseid) {
if (!empty($info->name)) {
$mod[$seq]->name = $info->name;
}
+ if ($info instanceof cached_cm_info) {
+ // When using cached_cm_info you can include three new fields
+ // that aren't available for legacy code
+ if (!empty($info->content)) {
+ $mod[$seq]->content = $info->content;
+ }
+ if (!empty($info->extraclasses)) {
+ $mod[$seq]->extraclasses = $info->extraclasses;
+ }
+ if (!empty($info->onclick)) {
+ $mod[$seq]->onclick = $info->onclick;
+ }
+ if (!empty($info->customdata)) {
+ $mod[$seq]->customdata = $info->customdata;
+ }
+ } else {
+ // When using a stdclass, the (horrible) deprecated ->extra field
+ // is available for BC
+ if (!empty($info->extra)) {
+ $mod[$seq]->extra = $info->extra;
+ }
+ }
}
}
if (!isset($mod[$seq]->name)) {
$mod[$seq]->name = $DB->get_field($rawmods[$seq]->modname, "name", array("id"=>$rawmods[$seq]->instance));
}
+
+ // Minimise the database size by unsetting default options when they are
+ // 'empty'. This list corresponds to code in the cm_info constructor.
+ foreach(array('idnumber', 'groupmode', 'groupingid', 'groupmembersonly',
+ 'indent', 'completion', 'extra', 'extraclasses', 'onclick', 'content',
+ 'icon', 'iconcomponent', 'customdata', 'availablefrom', 'availableuntil',
+ 'conditionscompletion', 'conditionsgrade') as $property) {
+ if (property_exists($mod[$seq], $property) &&
+ empty($mod[$seq]->{$property})) {
+ unset($mod[$seq]->{$property});
+ }
+ }
}
}
}
@@ -1251,6 +1281,44 @@ function set_section_visible($courseid, $sectionnumber, $visibility) {
}
/**
+ * Obtains shared data that is used in print_section when displaying a
+ * course-module entry.
+ *
+ * Calls format_text or format_string as appropriate, and obtains the correct icon.
+ *
+ * This data is also used in other areas of the code.
+ * @param cm_info $cm Course-module data (must come from get_fast_modinfo)
+ * @param object $course Moodle course object
+ * @return array An array with the following values in this order:
+ * $content (optional extra content for after link),
+ * $instancename (text of link)
+ */
+function get_print_section_cm_text(cm_info $cm, $course) {
+ global $OUTPUT;
+
+ // Get course context
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+
+ // Get content from modinfo if specified. Content displays either
+ // in addition to the standard link (below), or replaces it if
+ // the link is turned off by setting ->url to null.
+ if (($content = $cm->get_content()) !== '') {
+ $labelformatoptions = new stdClass();
+ $labelformatoptions->noclean = true;
+ $labelformatoptions->overflowdiv = true;
+ $labelformatoptions->context = $coursecontext;
+ $content = format_text($content, FORMAT_HTML, $labelformatoptions);
+ } else {
+ $content = '';
+ }
+
+ $stringoptions = new stdClass;
+ $stringoptions->context = $coursecontext;
+ $instancename = format_string($cm->name, true, $stringoptions);
+ return array($content, $instancename);
+}
+
+/**
* Prints a section full of activity modules
*/
function print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%", $hidecompletion=false) {
@@ -1265,8 +1333,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
static $strmovehere;
static $strmovefull;
static $strunreadpostsone;
- static $usetracking;
static $groupings;
+ static $modulenames;
if (!isset($initialised)) {
$groupbuttons = ($course->groupmode or (!$course->groupmodeforce));
@@ -1277,18 +1345,12 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$strmovehere = get_string("movehere");
$strmovefull = strip_tags(get_string("movefull", "", "'$USER->activitycopyname'"));
}
- include_once($CFG->dirroot.'/mod/forum/lib.php');
- if ($usetracking = forum_tp_can_track_forums()) {
- $strunreadpostsone = get_string('unreadpostsone', 'forum');
- }
+ $modulenames = array();
$initialised = true;
}
- $labelformatoptions = new stdClass();
- $labelformatoptions->noclean = true;
- $labelformatoptions->overflowdiv = true;
+ $tl = textlib_get_instance();
-/// Casting $course->modinfo to string prevents one notice when the field is null
$modinfo = get_fast_modinfo($course);
$completioninfo = new completion_info($course);
@@ -1304,6 +1366,9 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
continue;
}
+ /**
+ * @var cm_info
+ */
$mod = $mods[$modnumber];
if ($ismoving and $mod->id == $USER->activitycopy) {
@@ -1341,6 +1406,11 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
}
+ if (!isset($modulenames[$mod->modname])) {
+ $modulenames[$mod->modname] = get_string('modulename', $mod->modname);
+ }
+ $modulename = $modulenames[$mod->modname];
+
// In some cases the activity is visible to user, but it is
// dimmed. This is done if viewhiddenactivities is true and if:
// 1. the activity is not visible, or
@@ -1366,6 +1436,10 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$liclasses[] = 'activity';
$liclasses[] = $mod->modname;
$liclasses[] = 'modtype_'.$mod->modname;
+ $extraclasses = $mod->get_extra_classes();
+ if ($extraclasses) {
+ $liclasses = array_merge($liclasses, explode(' ', $extraclasses));
+ }
echo html_writer::start_tag('li', array('class'=>join(' ', $liclasses), 'id'=>'module-'.$modnumber));
if ($ismoving) {
echo '<a title="'.$strmovefull.'"'.
@@ -1384,105 +1458,122 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
echo html_writer::start_tag('div', array('class'=>join(' ', $classes)));
- $extra = '';
-