Permalink
Browse files

Merge branch 'master' into install_master

  • Loading branch information...
2 parents e36a9fe + 935c3d5 commit 259211556ee770d95d67565ed8ede0b16ffffeee AMOS bot committed Sep 8, 2012
Showing with 4,793 additions and 2,493 deletions.
  1. +117 −1 admin/environment.xml
  2. +7 −2 backup/moodle2/backup_custom_fields.php
  3. +17 −0 backup/upgrade.txt
  4. +9 −5 backup/util/dbops/backup_plan_dbops.class.php
  5. +11 −1 backup/util/dbops/restore_dbops.class.php
  6. +44 −24 backup/util/helper/backup_cron_helper.class.php
  7. +11 −0 backup/util/plan/backup_structure_step.class.php
  8. +8 −2 backup/util/plan/restore_structure_step.class.php
  9. +73 −0 backup/util/structure/backup_nested_element.class.php
  10. +3 −0 backup/util/ui/backup_ui_stage.class.php
  11. +3 −0 backup/util/ui/restore_ui_stage.class.php
  12. +16 −13 blocks/completionstatus/block_completionstatus.php
  13. +127 −112 blocks/completionstatus/details.php
  14. +1 −0 blocks/completionstatus/lang/en/block_completionstatus.php
  15. +9 −0 blog/external_blogs.php
  16. +2 −3 blog/locallib.php
  17. +1 −1 enrol/manual/yui/quickenrolment/quickenrolment.js
  18. +11 −11 enrol/paypal/ipn.php
  19. +3 −0 filter/mediaplugin/tests/filter_test.php
  20. +2 −1 grade/edit/tree/category_form.php
  21. +1 −1 lang/en/admin.php
  22. +2 −0 lang/en/backup.php
  23. +2 −0 lang/en/block.php
  24. +1 −0 lang/en/moodle.php
  25. +1 −1 lib/accesslib.php
  26. +1 −1 lib/adodb/adodb-active-record.inc.php
  27. +1 −1 lib/adodb/adodb-csvlib.inc.php
  28. +1 −1 lib/adodb/adodb-datadict.inc.php
  29. +1 −1 lib/adodb/adodb-error.inc.php
  30. +1 −1 lib/adodb/adodb-errorhandler.inc.php
  31. +1 −1 lib/adodb/adodb-errorpear.inc.php
  32. +1 −1 lib/adodb/adodb-exceptions.inc.php
  33. +1 −1 lib/adodb/adodb-iterator.inc.php
  34. +1 −1 lib/adodb/adodb-lib.inc.php
  35. +1 −1 lib/adodb/adodb-memcache.lib.inc.php
  36. +1 −1 lib/adodb/adodb-pager.inc.php
  37. +1 −1 lib/adodb/adodb-pear.inc.php
  38. +1 −1 lib/adodb/adodb-perf.inc.php
  39. +1 −1 lib/adodb/adodb-php4.inc.php
  40. +9 −10 lib/adodb/adodb.inc.php
  41. +1 −1 lib/adodb/drivers/adodb-access.inc.php
  42. +1 −1 lib/adodb/drivers/adodb-ado.inc.php
  43. +1 −1 lib/adodb/drivers/adodb-ado5.inc.php
  44. +1 −1 lib/adodb/drivers/adodb-ado_access.inc.php
  45. +1 −1 lib/adodb/drivers/adodb-ado_mssql.inc.php
  46. +1 −1 lib/adodb/drivers/adodb-borland_ibase.inc.php
  47. +1 −1 lib/adodb/drivers/adodb-csv.inc.php
  48. +1 −1 lib/adodb/drivers/adodb-db2.inc.php
  49. +1 −1 lib/adodb/drivers/adodb-db2oci.inc.php
  50. +1 −1 lib/adodb/drivers/adodb-db2ora.inc.php
  51. +1 −1 lib/adodb/drivers/adodb-fbsql.inc.php
  52. +1 −1 lib/adodb/drivers/adodb-firebird.inc.php
  53. +1 −1 lib/adodb/drivers/adodb-ibase.inc.php
  54. +1 −1 lib/adodb/drivers/adodb-informix.inc.php
  55. +1 −1 lib/adodb/drivers/adodb-informix72.inc.php
  56. +1 −1 lib/adodb/drivers/adodb-ldap.inc.php
  57. +1 −1 lib/adodb/drivers/adodb-mssql.inc.php
  58. +6 −2 lib/adodb/drivers/adodb-mssqlnative.inc.php
  59. +1 −1 lib/adodb/drivers/adodb-mssqlpo.inc.php
  60. +21 −2 lib/adodb/drivers/adodb-mysql.inc.php
  61. +1 −1 lib/adodb/drivers/adodb-mysqli.inc.php
  62. +1 −1 lib/adodb/drivers/adodb-mysqlpo.inc.php
  63. +1 −1 lib/adodb/drivers/adodb-mysqlt.inc.php
  64. +1 −1 lib/adodb/drivers/adodb-netezza.inc.php
  65. +91 −84 lib/adodb/drivers/adodb-oci8.inc.php
  66. +1 −1 lib/adodb/drivers/adodb-oci805.inc.php
  67. +1 −1 lib/adodb/drivers/adodb-oci8po.inc.php
  68. +7 −3 lib/adodb/drivers/adodb-odbc.inc.php
  69. +1 −1 lib/adodb/drivers/adodb-odbc_db2.inc.php
  70. +1 −1 lib/adodb/drivers/adodb-odbc_mssql.inc.php
  71. +1 −1 lib/adodb/drivers/adodb-odbc_oracle.inc.php
  72. +1 −1 lib/adodb/drivers/adodb-odbtp.inc.php
  73. +1 −1 lib/adodb/drivers/adodb-odbtp_unicode.inc.php
  74. +1 −1 lib/adodb/drivers/adodb-oracle.inc.php
  75. +1 −1 lib/adodb/drivers/adodb-pdo.inc.php
  76. +1 −1 lib/adodb/drivers/adodb-pdo_mssql.inc.php
  77. +1 −1 lib/adodb/drivers/adodb-pdo_mysql.inc.php
  78. +1 −1 lib/adodb/drivers/adodb-pdo_oci.inc.php
  79. +1 −1 lib/adodb/drivers/adodb-pdo_pgsql.inc.php
  80. +1 −1 lib/adodb/drivers/adodb-pdo_sqlite.inc.php
  81. +1 −1 lib/adodb/drivers/adodb-postgres.inc.php
  82. +1 −1 lib/adodb/drivers/adodb-postgres64.inc.php
  83. +1 −1 lib/adodb/drivers/adodb-postgres7.inc.php
  84. +1 −1 lib/adodb/drivers/adodb-postgres8.inc.php
  85. +1 −1 lib/adodb/drivers/adodb-proxy.inc.php
  86. +1 −1 lib/adodb/drivers/adodb-sapdb.inc.php
  87. +1 −1 lib/adodb/drivers/adodb-sqlanywhere.inc.php
  88. +1 −1 lib/adodb/drivers/adodb-sqlite.inc.php
  89. +1 −1 lib/adodb/drivers/adodb-sqlite3.inc.php
  90. +1 −1 lib/adodb/drivers/adodb-sqlitepo.inc.php
  91. +1 −1 lib/adodb/drivers/adodb-sybase.inc.php
  92. +1 −1 lib/adodb/drivers/adodb-sybase_ase.inc.php
  93. +1 −1 lib/adodb/drivers/adodb-vfp.inc.php
  94. +0 −33 lib/adodb/lang/adodb-ar.inc.php
  95. +0 −37 lib/adodb/lang/adodb-bg.inc.php
  96. +0 −37 lib/adodb/lang/adodb-bgutf8.inc.php
  97. +0 −34 lib/adodb/lang/adodb-ca.inc.php
  98. +0 −35 lib/adodb/lang/adodb-cn.inc.php
  99. +0 −40 lib/adodb/lang/adodb-cz.inc.php
  100. +0 −33 lib/adodb/lang/adodb-da.inc.php
  101. +0 −33 lib/adodb/lang/adodb-de.inc.php
  102. +0 −33 lib/adodb/lang/adodb-es.inc.php
  103. +0 −35 lib/adodb/lang/adodb-esperanto.inc.php
  104. +0 −35 lib/adodb/lang/adodb-fa.inc.php
  105. +0 −33 lib/adodb/lang/adodb-fr.inc.php
  106. +0 −34 lib/adodb/lang/adodb-hu.inc.php
  107. +0 −34 lib/adodb/lang/adodb-it.inc.php
  108. +0 −33 lib/adodb/lang/adodb-nl.inc.php
  109. +0 −35 lib/adodb/lang/adodb-pl.inc.php
  110. +0 −35 lib/adodb/lang/adodb-pt-br.inc.php
  111. +0 −35 lib/adodb/lang/adodb-ro.inc.php
  112. +0 −35 lib/adodb/lang/adodb-ru1251.inc.php
  113. +0 −33 lib/adodb/lang/adodb-sv.inc.php
  114. +0 −35 lib/adodb/lang/adodb-uk1251.inc.php
  115. +0 −33 lib/adodb/lang/adodb_th.inc.php
  116. +1 −1 lib/adodb/perf/perf-db2.inc.php
  117. +1 −1 lib/adodb/perf/perf-informix.inc.php
  118. +1 −1 lib/adodb/perf/perf-mssql.inc.php
  119. +1 −1 lib/adodb/perf/perf-mssqlnative.inc.php
  120. +1 −1 lib/adodb/perf/perf-mysql.inc.php
  121. +1 −1 lib/adodb/perf/perf-oci8.inc.php
  122. +1 −1 lib/adodb/perf/perf-postgres.inc.php
  123. +2 −2 lib/adodb/readme_moodle.txt
  124. +47 −7 lib/blocklib.php
  125. +2 −2 lib/conditionlib.php
  126. +10 −0 lib/db/upgrade.php
  127. +47 −2 lib/db/upgradelib.php
  128. +8 −1 lib/editor/tinymce/adminlib.php
  129. +50 −9 lib/editor/tinymce/classes/plugin.php
  130. +41 −0 lib/editor/tinymce/db/upgrade.php
  131. +2 −2 lib/editor/tinymce/lang/en/editor_tinymce.php
  132. +21 −23 lib/editor/tinymce/lib.php
  133. BIN lib/editor/tinymce/plugins/dragmath/pix/icon.png
  134. BIN lib/editor/tinymce/plugins/moodleemoticon/pix/icon.png
  135. BIN lib/editor/tinymce/plugins/moodleimage/pix/icon.png
  136. BIN lib/editor/tinymce/plugins/moodlemedia/pix/icon.png
  137. BIN lib/editor/tinymce/plugins/moodlenolink/pix/icon.png
  138. BIN lib/editor/tinymce/plugins/spellchecker/pix/icon.png
  139. +6 −1 lib/editor/tinymce/settings.php
  140. +3 −0 lib/editor/tinymce/tests/editor_test.php
  141. +2 −2 lib/editor/tinymce/version.php
  142. +28 −0 lib/flowplayer/README.txt
  143. +13 −0 lib/flowplayer/README_audio.txt
  144. +16 −15 lib/flowplayer/{flowplayer-3.2.8.js → flowplayer-3.2.11.js}
  145. +24 −0 lib/flowplayer/flowplayer-3.2.11.min.js
  146. BIN lib/flowplayer/flowplayer-3.2.14.swf
  147. +0 −26 lib/flowplayer/flowplayer-3.2.8.min.js
  148. BIN lib/flowplayer/flowplayer-3.2.9.swf
  149. BIN lib/flowplayer/flowplayer.audio-3.2.10.swf
  150. BIN lib/flowplayer/flowplayer.audio-3.2.8.swf
  151. BIN lib/flowplayer/flowplayer.controls-3.2.13.swf
  152. BIN lib/flowplayer/flowplayer.controls-3.2.9.swf
  153. +11 −13 lib/googleapi.php
  154. +7 −7 lib/javascript-static.js
  155. +11 −7 lib/medialib.php
  156. +33 −3 lib/moodlelib.php
  157. +33 −12 lib/outputrenderers.php
  158. +11 −4 lib/phpmailer/README
  159. +1 −1 lib/phpmailer/README_MOODLE.txt
  160. +13 −0 lib/phpmailer/changelog.txt
  161. +427 −215 lib/phpmailer/class.phpmailer.php
  162. +17 −13 lib/phpmailer/class.smtp.php
  163. +18 −19 lib/phpmailer/moodle_phpmailer.php
  164. +1 −1 lib/pluginlib.php
  165. +7 −5 lib/questionlib.php
  166. +9 −2 lib/sessionlib.php
  167. +6 −6 lib/tcpdf/2dbarcodes.php
  168. +96 −1 lib/tcpdf/CHANGELOG.TXT
  169. +3 −3 lib/tcpdf/README.TXT
  170. +6 −6 lib/tcpdf/barcodes.php
  171. +38 −0 lib/tcpdf/composer.json
  172. +11 −11 lib/tcpdf/qrcode.php
  173. +2 −2 lib/tcpdf/readme_moodle.txt
  174. +562 −172 lib/tcpdf/tcpdf.php
  175. +22 −13 lib/tcpdf/tcpdf_parser.php
  176. +60 −0 lib/tests/moodlelib_test.php
  177. +38 −9 lib/tests/pluginlib_test.php
  178. +5 −5 lib/thirdpartylibs.xml
  179. +29 −19 lib/typo3/class.t3lib_cs.php
  180. +96 −215 lib/typo3/class.t3lib_div.php
  181. +4 −3 lib/typo3/class.t3lib_l10n_locales.php
  182. +3 −1 lib/typo3/readme_moodle.txt
  183. +15 −27 message/lib.php
  184. +1 −1 mod/assign/assignmentplugin.php
  185. +14 −4 mod/assign/backup/moodle2/backup_assign_stepslib.php
  186. +20 −1 mod/assign/backup/moodle2/restore_assign_stepslib.php
  187. +22 −0 mod/assign/db/access.php
  188. +29 −9 mod/assign/db/install.xml
  189. +1 −0 mod/assign/db/log.php
  190. +125 −8 mod/assign/db/upgrade.php
  191. +102 −0 mod/assign/extensionform.php
  192. +1 −0 mod/assign/feedback/file/lang/en/assignfeedback_file.php
  193. +3 −0 mod/assign/gradingbatchoperationsform.php
  194. +181 −24 mod/assign/gradingtable.php
  195. +43 −3 mod/assign/lang/en/assign.php
  196. +27 −4 mod/assign/lib.php
  197. +926 −122 mod/assign/locallib.php
  198. +41 −3 mod/assign/mod_form.php
  199. +66 −8 mod/assign/renderable.php
  200. +158 −39 mod/assign/renderer.php
  201. +4 −0 mod/assign/styles.css
  202. +13 −0 mod/assign/submission/comments/locallib.php
  203. +12 −1 mod/assign/submission/onlinetext/locallib.php
  204. +5 −1 mod/assign/upgradelib.php
  205. +1 −1 mod/assign/version.php
  206. +1 −1 mod/data/field/checkbox/mod.html
  207. +5 −4 mod/data/field/latlong/field.class.php
  208. +1 −1 mod/data/field/menu/mod.html
  209. +1 −1 mod/data/field/multimenu/mod.html
  210. +2 −2 mod/data/field/picture/field.class.php
  211. +4 −4 mod/data/field/picture/mod.html
  212. +1 −1 mod/data/field/radiobutton/mod.html
  213. +2 −2 mod/data/field/textarea/mod.html
  214. +11 −17 mod/data/lib.php
  215. +32 −0 mod/data/styles.css
  216. +7 −7 mod/data/templates.php
  217. +17 −38 mod/lesson/format.php
  218. +1 −1 mod/lesson/pagetypes/multichoice.php
  219. +0 −4 mod/page/lib.php
  220. +3 −0 mod/quiz/accessrule/safebrowser/rule.php
  221. +1 −1 mod/quiz/accessrule/securewindow/rule.php
  222. +17 −1 mod/quiz/lib.php
  223. +1 −0 mod/quiz/styles.css
  224. +6 −1 mod/workshop/form/comments/backup/moodle1/lib.php
  225. +4 −1 mod/workshop/form/numerrors/backup/moodle1/lib.php
  226. +4 −1 mod/workshop/form/rubric/backup/moodle1/lib.php
  227. +5 −2 question/category_class.php
  228. +0 −23 question/format.php
  229. +1 −1 question/format/aiken/format.php
  230. +15 −15 question/format/examview/format.php
  231. +4 −4 question/format/gift/examples.txt
  232. +25 −25 question/format/gift/format.php
  233. +1 −1 question/format/learnwise/format.php
  234. +2 −2 question/format/missingword/format.php
  235. +17 −17 question/format/webct/format.php
  236. +7 −7 question/format/xhtml/format.php
  237. +8 −8 question/format/xml/format.php
  238. +3 −0 question/type/multichoice/styles.css
  239. +10 −3 report/backups/index.php
  240. +2 −2 report/stats/lib.php
  241. +1 −1 report/stats/settings.php
  242. +33 −9 repository/flickr/lib.php
  243. +44 −25 repository/flickr_public/lib.php
  244. +3 −1 repository/googledocs/lib.php
  245. +6 −0 repository/lib.php
  246. +10 −6 repository/manage_instances.php
  247. +9 −2 theme/afterburner/config.php
  248. +4 −0 theme/afterburner/style/afterburner_styles.css
  249. +1 −2 theme/anomaly/style/general.css
  250. +8 −1 theme/base/config.php
  251. +1 −0 theme/base/style/admin.css
  252. +8 −1 theme/canvas/config.php
  253. +1 −1 theme/mymobile/renderers.php
  254. +3 −3 theme/overlay/layout/general.php
  255. +6 −1 theme/upgrade.txt
  256. +2 −1 theme/yui_combo.php
  257. +30 −13 user/profile.php
  258. +2 −1 user/selector/module.js
  259. +2 −2 version.php
View
118 admin/environment.xml
@@ -659,5 +659,121 @@
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
-</MOODLE>
+ </MOODLE>
+ <MOODLE version="2.4" requires="2.2">
+ <UNICODE level="required">
+ <FEEDBACK>
+ <ON_ERROR message="unicoderequired" />
+ </FEEDBACK>
+ </UNICODE>
+ <DATABASE level="required">
+ <VENDOR name="mysql" version="5.1.33" />
+ <VENDOR name="postgres" version="8.3" />
+ <VENDOR name="mssql" version="9.0" />
+ <VENDOR name="odbc_mssql" version="9.0" />
+ <VENDOR name="mssql_n" version="9.0" />
+ <VENDOR name="oracle" version="10.2" />
+ <VENDOR name="sqlite" version="2.0" />
+ </DATABASE>
+ <PHP version="5.3.2" level="required">
+ </PHP>
+ <PCREUNICODE level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="pcreunicodewarning" />
+ </FEEDBACK>
+ </PCREUNICODE>
+ <PHP_EXTENSIONS>
+ <PHP_EXTENSION name="iconv" level="required">
+ <FEEDBACK>
+ <ON_CHECK message="iconvrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="mbstring" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="mbstringrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="curl" level="required">
+ <FEEDBACK>
+ <ON_CHECK message="curlrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="openssl" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="opensslrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="tokenizer" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="tokenizerrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="xmlrpc" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="xmlrpcrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="soap" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="soaprecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="ctype" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="ctyperequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="zip" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="ziprequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="gd" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="gdrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="simplexml" level="required">
+ <FEEDBACK>
+ <ON_CHECK message="simplexmlrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="spl" level="required">
+ <FEEDBACK>
+ <ON_CHECK message="splrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="pcre" level="required">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="dom" level="required">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="xml" level="required">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="intl" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="intlrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="json" level="required">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="hash" level="required"/>
+ </PHP_EXTENSIONS>
+ <PHP_SETTINGS>
+ <PHP_SETTING name="memory_limit" value="40M" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="settingmemorylimit" />
+ </FEEDBACK>
+ </PHP_SETTING>
+ <PHP_SETTING name="safe_mode" value="0" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="settingsafemode" />
+ </FEEDBACK>
+ </PHP_SETTING>
+ <PHP_SETTING name="file_uploads" value="1" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="settingfileuploads" />
+ </FEEDBACK>
+ </PHP_SETTING>
+ </PHP_SETTINGS>
+ </MOODLE>
</COMPATIBILITY_MATRIX>
View
9 backup/moodle2/backup_custom_fields.php
@@ -96,14 +96,19 @@ public function process($processor) {
if (is_null($this->backupid)) {
$this->backupid = $processor->get_var(backup::VAR_BACKUPID);
}
- parent::process($processor);
+ return parent::process($processor);
}
public function fill_values($values) {
// Fill values
parent::fill_values($values);
// Do our own tasks (copy file from moodle to backup)
- backup_file_manager::copy_file_moodle2backup($this->backupid, $values);
+ try {
+ backup_file_manager::copy_file_moodle2backup($this->backupid, $values);
+ } catch (file_exception $e) {
+ $this->add_result(array('missing_files_in_pool' => true));
+ $this->add_log('missing file in pool: ' . $e->debuginfo, backup::LOG_WARNING);
+ }
}
}
View
17 backup/upgrade.txt
@@ -0,0 +1,17 @@
+This files describes API changes in /backup/*,
+information provided here is intended especially for developers.
+
+=== 2.4 ===
+
+* Since 2.3.1+ the backup file name schema has changed. The ID of the course will always be part of
+ the filename regardless of the setting 'backup_shortname'. See MDL-33812.
+
+=== 2.3 ===
+
+* Since 2.3.1+ the backup file name schema has changed. The ID of the course will always be part of
+ the filename regardless of the setting 'backup_shortname'. See MDL-33812.
+
+=== 2.2 ===
+
+* Since 2.2.4+ the backup file name schema has changed. The ID of the course will always be part of
+ the filename regardless of the setting 'backup_shortname'. See MDL-33812.
View
14 backup/util/dbops/backup_plan_dbops.class.php
@@ -197,19 +197,19 @@ public static function get_mnet_localhost_wwwroot() {
* @param int $courseid/$sectionid/$cmid
* @param bool $users Should be true is users were included in the backup
* @param bool $anonymised Should be true is user information was anonymized.
- * @param bool $useidasname true to use id, false to use strings (default)
+ * @param bool $useidonly only use the ID in the file name
* @return string The filename to use
*/
- public static function get_default_backup_filename($format, $type, $id, $users, $anonymised, $useidasname = false) {
+ public static function get_default_backup_filename($format, $type, $id, $users, $anonymised, $useidonly = false) {
global $DB;
// Calculate backup word
$backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename')));
$backupword = trim(clean_filename($backupword), '_');
+ // Not $useidonly, lets fetch the name
$shortname = '';
- // Not $useidasname, lets calculate it, else $id will be used
- if (!$useidasname) {
+ if (!$useidonly) {
// Calculate proper name element (based on type)
switch ($type) {
case backup::TYPE_1COURSE:
@@ -231,7 +231,11 @@ public static function get_default_backup_filename($format, $type, $id, $users,
$shortname = textlib::strtolower(trim(clean_filename($shortname), '_'));
}
- $name = empty($shortname) ? $id : $shortname;
+ // The name will always contain the ID, but we append the course short name if requested.
+ $name = $id;
+ if (!$useidonly && $shortname != '') {
+ $name .= '-' . $shortname;
+ }
// Calculate date
$backupdateformat = str_replace(' ', '_', get_string('backupnameformat', 'langconfig'));
View
12 backup/util/dbops/restore_dbops.class.php
@@ -818,10 +818,13 @@ public static function restore_get_questions($restoreid, $qcatid) {
* @param int|null $olditemid
* @param int|null $forcenewcontextid explicit value for the new contextid (skip mapping)
* @param bool $skipparentitemidctxmatch
+ * @return array of result object
*/
public static function send_files_to_pool($basepath, $restoreid, $component, $filearea, $oldcontextid, $dfltuserid, $itemname = null, $olditemid = null, $forcenewcontextid = null, $skipparentitemidctxmatch = false) {
global $DB;
+ $results = array();
+
if ($forcenewcontextid) {
// Some components can have "forced" new contexts (example: questions can end belonging to non-standard context mappings,
// with questions originally at system/coursecat context in source being restored to course context in target). So we need
@@ -901,8 +904,14 @@ public static function send_files_to_pool($basepath, $restoreid, $component, $fi
// this is a regular file, it must be present in the backup pool
$backuppath = $basepath . backup_file_manager::get_backup_content_file_location($file->contenthash);
+ // The file is not found in the backup.
if (!file_exists($backuppath)) {
- throw new restore_dbops_exception('file_not_found_in_pool', $file);
+ $result = new stdClass();
+ $result->code = 'file_missing_in_backup';
+ $result->message = sprintf('missing file %s%s in backup', $file->filepath, $file->filename);
+ $result->level = backup::LOG_WARNING;
+ $results[] = $result;
+ continue;
}
// create the file in the filepool if it does not exist yet
@@ -959,6 +968,7 @@ public static function send_files_to_pool($basepath, $restoreid, $component, $fi
}
}
$rs->close();
+ return $results;
}
/**
View
68 backup/util/helper/backup_cron_helper.class.php
@@ -46,6 +46,8 @@
const BACKUP_STATUS_UNFINISHED = 2;
/** Course automated backup was skipped */
const BACKUP_STATUS_SKIPPED = 3;
+ /** Course automated backup had warnings */
+ const BACKUP_STATUS_WARNING = 4;
/** Run if required by the schedule set in config. Default. **/
const RUN_ON_SCHEDULE = 0;
@@ -139,7 +141,7 @@ public static function run_automated_backup($rundirective = self::RUN_ON_SCHEDUL
$params = array('courseid' => $course->id, 'time' => $now-31*24*60*60, 'action' => '%view%');
$logexists = $DB->record_exists_select('log', $sqlwhere, $params);
if (!$logexists) {
- $backupcourse->laststatus = backup_cron_automated_helper::BACKUP_STATUS_SKIPPED;
+ $backupcourse->laststatus = self::BACKUP_STATUS_SKIPPED;
$backupcourse->nextstarttime = $nextstarttime;
$DB->update_record('backup_courses', $backupcourse);
mtrace('Skipping unchanged course '.$course->fullname);
@@ -160,7 +162,7 @@ public static function run_automated_backup($rundirective = self::RUN_ON_SCHEDUL
$starttime = time();
$backupcourse->laststarttime = time();
- $backupcourse->laststatus = backup_cron_automated_helper::BACKUP_STATUS_UNFINISHED;
+ $backupcourse->laststatus = self::BACKUP_STATUS_UNFINISHED;
$DB->update_record('backup_courses', $backupcourse);
$backupcourse->laststatus = backup_cron_automated_helper::launch_automated_backup($course, $backupcourse->laststarttime, $admin->id);
@@ -169,7 +171,7 @@ public static function run_automated_backup($rundirective = self::RUN_ON_SCHEDUL
$DB->update_record('backup_courses', $backupcourse);
- if ($backupcourse->laststatus) {
+ if ($backupcourse->laststatus === self::BACKUP_STATUS_OK) {
// Clean up any excess course backups now that we have
// taken a successful backup.
$removedcount = backup_cron_automated_helper::remove_excess_backups($course);
@@ -188,17 +190,18 @@ public static function run_automated_backup($rundirective = self::RUN_ON_SCHEDUL
$message = "";
$count = backup_cron_automated_helper::get_backup_status_array();
- $haserrors = ($count[backup_cron_automated_helper::BACKUP_STATUS_ERROR] != 0 || $count[backup_cron_automated_helper::BACKUP_STATUS_UNFINISHED] != 0);
+ $haserrors = ($count[self::BACKUP_STATUS_ERROR] != 0 || $count[self::BACKUP_STATUS_UNFINISHED] != 0);
//Build the message text
//Summary
$message .= get_string('summary')."\n";
$message .= "==================================================\n";
$message .= " ".get_string('courses').": ".array_sum($count)."\n";
- $message .= " ".get_string('ok').": ".$count[backup_cron_automated_helper::BACKUP_STATUS_OK]."\n";
- $message .= " ".get_string('skipped').": ".$count[backup_cron_automated_helper::BACKUP_STATUS_SKIPPED]."\n";
- $message .= " ".get_string('error').": ".$count[backup_cron_automated_helper::BACKUP_STATUS_ERROR]."\n";
- $message .= " ".get_string('unfinished').": ".$count[backup_cron_automated_helper::BACKUP_STATUS_UNFINISHED]."\n\n";
+ $message .= " ".get_string('ok').": ".$count[self::BACKUP_STATUS_OK]."\n";
+ $message .= " ".get_string('skipped').": ".$count[self::BACKUP_STATUS_SKIPPED]."\n";
+ $message .= " ".get_string('error').": ".$count[self::BACKUP_STATUS_ERROR]."\n";
+ $message .= " ".get_string('unfinished').": ".$count[self::BACKUP_STATUS_UNFINISHED]."\n";
+ $message .= " ".get_string('warning').": ".$count[self::BACKUP_STATUS_WARNING]."\n\n";
//Reference
if ($haserrors) {
@@ -261,6 +264,7 @@ public static function get_backup_status_array() {
self::BACKUP_STATUS_OK => 0,
self::BACKUP_STATUS_UNFINISHED => 0,
self::BACKUP_STATUS_SKIPPED => 0,
+ self::BACKUP_STATUS_WARNING => 0
);
$statuses = $DB->get_records_sql('SELECT DISTINCT bc.laststatus, COUNT(bc.courseid) AS statuscount FROM {backup_courses} bc GROUP BY bc.laststatus');
@@ -334,7 +338,7 @@ public static function calculate_next_automated_backup($timezone, $now) {
*/
public static function launch_automated_backup($course, $starttime, $userid) {
- $outcome = true;
+ $outcome = self::BACKUP_STATUS_OK;
$config = get_config('backup');
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id, backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_AUTOMATED, $userid);
@@ -369,6 +373,7 @@ public static function launch_automated_backup($course, $starttime, $userid) {
$bc->execute_plan();
$results = $bc->get_results();
+ $outcome = self::outcome_from_results($results);
$file = $results['backup_destination']; // may be empty if file already moved to target location
$dir = $config->backup_auto_destination;
$storage = (int)$config->backup_auto_storage;
@@ -377,8 +382,10 @@ public static function launch_automated_backup($course, $starttime, $userid) {
}
if ($file && !empty($dir) && $storage !== 0) {
$filename = backup_plan_dbops::get_default_backup_filename($format, $type, $course->id, $users, $anonymised, !$config->backup_shortname);
- $outcome = $file->copy_content_to($dir.'/'.$filename);
- if ($outcome && $storage === 1) {
+ if (!$file->copy_content_to($dir.'/'.$filename)) {
+ $outcome = self::BACKUP_STATUS_ERROR;
+ }
+ if ($outcome != self::BACKUP_STATUS_ERROR && $storage === 1) {
$file->delete();
}
}
@@ -387,7 +394,7 @@ public static function launch_automated_backup($course, $starttime, $userid) {
$bc->log('backup_auto_failed_on_course', backup::LOG_ERROR, $course->shortname); // Log error header.
$bc->log('Exception: ' . $e->errorcode, backup::LOG_ERROR, $e->a, 1); // Log original exception problem.
$bc->log('Debug: ' . $e->debuginfo, backup::LOG_DEBUG, null, 1); // Log original debug information.
- $outcome = false;
+ $outcome = self::BACKUP_STATUS_ERROR;
}
$bc->destroy();
@@ -397,6 +404,30 @@ public static function launch_automated_backup($course, $starttime, $userid) {
}
/**
+ * Returns the backup outcome by analysing its results.
+ *
+ * @param array $results returned by a backup
+ * @return int {@link self::BACKUP_STATUS_OK} and other constants
+ */
+ public static function outcome_from_results($results) {
+ $outcome = self::BACKUP_STATUS_OK;
+ foreach ($results as $code => $value) {
+ // Each possible error and warning code has to be specified in this switch
+ // which basically analyses the results to return the correct backup status.
+ switch ($code) {
+ case 'missing_files_in_pool':
+ $outcome = self::BACKUP_STATUS_WARNING;
+ break;
+ }
+ // If we found the highest error level, we exit the loop.
+ if ($outcome == self::BACKUP_STATUS_ERROR) {
+ break;
+ }
+ }
+ return $outcome;
+ }
+
+ /**
* Removes deleted courses fromn the backup_courses table so that we don't
* waste time backing them up.
*
@@ -530,18 +561,7 @@ public static function remove_excess_backups($course) {
if (!empty($dir) && ($storage == 1 || $storage == 2)) {
// Calculate backup filename regex, ignoring the date/time/info parts that can be
// variable, depending of languages, formats and automated backup settings
-
-
- // MDL-33531: use different filenames depending on backup_shortname option
- if ( !empty($config->backup_shortname) ) {
- $context = get_context_instance(CONTEXT_COURSE, $course->id);
- $courseref = format_string($course->shortname, true, array('context' => $context));
- $courseref = str_replace(' ', '_', $courseref);
- $courseref = textlib::strtolower(trim(clean_filename($courseref), '_'));
- } else {
- $courseref = $course->id;
- }
- $filename = $backupword . '-' . backup::FORMAT_MOODLE . '-' . backup::TYPE_1COURSE . '-' .$courseref . '-';
+ $filename = $backupword . '-' . backup::FORMAT_MOODLE . '-' . backup::TYPE_1COURSE . '-' .$course->id . '-';
$regex = '#^'.preg_quote($filename, '#').'.*\.mbz$#';
// Store all the matching files into fullpath => timemodified array
View
11 backup/util/plan/backup_structure_step.class.php
@@ -94,11 +94,22 @@ public function execute() {
// Process structure definition
$structure->process($pr);
+ // Get the results from the nested elements
+ $results = $structure->get_results();
+
+ // Get the log messages to append to the log
+ $logs = $structure->get_logs();
+ foreach ($logs as $log) {
+ $this->log($log->message, $log->level, $log->a, $log->depth, $log->display);
+ }
+
// Close everything
$xw->stop();
// Destroy the structure. It helps PHP 5.2 memory a lot!
$structure->destroy();
+
+ return $results;
}
/**
View
10 backup/util/plan/restore_structure_step.class.php
@@ -218,8 +218,14 @@ public function get_mapping($itemname, $oldid) {
*/
public function add_related_files($component, $filearea, $mappingitemname, $filesctxid = null, $olditemid = null) {
$filesctxid = is_null($filesctxid) ? $this->task->get_old_contextid() : $filesctxid;
- restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), $component,
- $filearea, $filesctxid, $this->task->get_userid(), $mappingitemname, $olditemid);
+ $results = restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), $component,
+ $filearea, $filesctxid, $this->task->get_userid(), $mappingitemname, $olditemid);
+ $resultstoadd = array();
+ foreach ($results as $result) {
+ $this->log($result->message, $result->level);
+ $resultstoadd[$result->code] = true;
+ }
+ $this->task->add_result($resultstoadd);
}
/**
View
73 backup/util/structure/backup_nested_element.class.php
@@ -37,6 +37,8 @@ class backup_nested_element extends base_nested_element implements processable {
protected $aliases; // Define DB->final element aliases
protected $fileannotations; // array of file areas to be searched by file annotations
protected $counter; // Number of instances of this element that have been processed
+ protected $results; // Logs the results we encounter during the process.
+ protected $logs; // Some log messages that could be retrieved later.
/**
* Constructor - instantiates one backup_nested_element, specifying its basic info.
@@ -55,8 +57,16 @@ public function __construct($name, $attributes = null, $final_elements = null) {
$this->aliases = array();
$this->fileannotations = array();
$this->counter = 0;
+ $this->results = array();
+ $this->logs = array();
}
+ /**
+ * Process the nested element
+ *
+ * @param object $processor the processor
+ * @return void
+ */
public function process($processor) {
if (!$processor instanceof base_processor) { // No correct processor, throw exception
throw new base_element_struct_exception('incorrect_processor');
@@ -113,6 +123,69 @@ public function process($processor) {
$iterator->close();
}
+ /**
+ * Saves a log message to an array
+ *
+ * @see backup_helper::log()
+ * @param string $message to add to the logs
+ * @param int $level level of importance {@link backup::LOG_DEBUG} and other constants
+ * @param mixed $a to be included in $message
+ * @param int $depth of the message
+ * @param display $bool supporting translation via get_string() if true
+ * @return void
+ */
+ protected function add_log($message, $level, $a = null, $depth = null, $display = false) {
+ // Adding the result to the oldest parent.
+ if ($this->get_parent()) {
+ $parent = $this->get_grandparent();
+ $parent->add_log($message, $level, $a, $depth, $display);
+ } else {
+ $log = new stdClass();
+ $log->message = $message;
+ $log->level = $level;
+ $log->a = $a;
+ $log->depth = $depth;
+ $log->display = $display;
+ $this->logs[] = $log;
+ }
+ }
+
+ /**
+ * Saves the results to an array
+ *
+ * @param array $result associative array
+ * @return void
+ */
+ protected function add_result($result) {
+ if (is_array($result)) {
+ // Adding the result to the oldest parent.
+ if ($this->get_parent()) {
+ $parent = $this->get_grandparent();
+ $parent->add_result($result);
+ } else {
+ $this->results = array_merge($this->results, $result);
+ }
+ }
+ }
+
+ /**
+ * Returns the logs
+ *
+ * @return array of log objects
+ */
+ public function get_logs() {
+ return $this->logs;
+ }
+
+ /**
+ * Returns the results
+ *
+ * @return associative array of results
+ */
+ public function get_results() {
+ return $this->results;
+ }
+
public function set_source_array($arr) {
// TODO: Only elements having final elements can set source
$this->var_array = $arr;
View
3 backup/util/ui/backup_ui_stage.class.php
@@ -487,6 +487,9 @@ public function display(core_backup_renderer $renderer) {
if (!empty($this->results['include_file_references_to_external_content'])) {
$output .= $renderer->notification(get_string('filereferencesincluded', 'backup'), 'notifyproblem');
}
+ if (!empty($this->results['missing_files_in_pool'])) {
+ $output .= $renderer->notification(get_string('missingfilesinpool', 'backup'), 'notifyproblem');
+ }
$output .= $renderer->notification(get_string('executionsuccess', 'backup'), 'notifysuccess');
$output .= $renderer->continue_button($restorerul);
$output .= $renderer->box_end();
View
3 backup/util/ui/restore_ui_stage.class.php
@@ -772,6 +772,9 @@ public function display(core_backup_renderer $renderer) {
$html .= $renderer->box_end();
}
$html .= $renderer->box_start();
+ if (array_key_exists('file_missing_in_backup', $this->results)) {
+ $html .= $renderer->notification(get_string('restorefileweremissing', 'backup'), 'notifyproblem');
+ }
$html .= $renderer->notification(get_string('restoreexecutionsuccess', 'backup'), 'notifysuccess');
$html .= $renderer->continue_button(new moodle_url('/course/view.php', array(
'id' => $this->get_ui()->get_controller()->get_courseid())), 'get');
View
29 blocks/completionstatus/block_completionstatus.php
@@ -19,15 +19,14 @@
*
* @package block
* @subpackage completion
- * @copyright 2009 Catalyst IT Ltd
+ * @copyright 2009-2012 Catalyst IT Ltd
* @author Aaron Barnes <aaronb@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
-
-require_once($CFG->libdir.'/completionlib.php');
+require_once("{$CFG->libdir}/completionlib.php");
/**
* Course completion status
@@ -36,25 +35,28 @@
class block_completionstatus extends block_base {
public function init() {
- $this->title = get_string('pluginname', 'block_completionstatus');
+ $this->title = get_string('pluginname', 'block_completionstatus');
}
public function get_content() {
- global $USER, $CFG, $DB, $COURSE;
+ global $USER;
// If content is cached
if ($this->content !== NULL) {
return $this->content;
}
+ $course = $this->page->course;
+ $context = context_course::instance($course->id);
+
// Create empty content
- $this->content = new stdClass;
+ $this->content = new stdClass();
// Can edit settings?
- $can_edit = has_capability('moodle/course:update', context_course::instance($this->page->course->id));
+ $can_edit = has_capability('moodle/course:update', $context);
// Get course completion data
- $info = new completion_info($this->page->course);
+ $info = new completion_info($course);
// Don't display if completion isn't enabled!
if (!completion_info::is_enabled_for_site()) {
@@ -84,9 +86,9 @@ public function get_content() {
// Check this user is enroled
if (!$info->is_tracked_user($USER->id)) {
// If not enrolled, but are can view the report:
- if (has_capability('report/completion:view', context_course::instance($COURSE->id))) {
- $this->content->text = '<a href="'.$CFG->wwwroot.'/report/completion/index.php?course='.$COURSE->id.
- '">'.get_string('viewcoursereport', 'completion').'</a>';
+ if (has_capability('report/completion:view', $context)) {
+ $report = new moodle_url('/report/completion/index.php', array('course' => $course->id));
+ $this->content->text = '<a href="'.$report->out().'">'.get_string('viewcoursereport', 'completion').'</a>';
return $this->content;
}
@@ -187,7 +189,7 @@ public function get_content() {
// Load course completion
$params = array(
'userid' => $USER->id,
- 'course' => $COURSE->id
+ 'course' => $course->id
);
$ccompletion = new completion_completion($params);
@@ -221,7 +223,8 @@ public function get_content() {
$this->content->text .= $shtml.'</tbody></table>';
// Display link to detailed view
- $this->content->footer = '<br><a href="'.$CFG->wwwroot.'/blocks/completionstatus/details.php?course='.$COURSE->id.'">'.get_string('moredetails', 'completion').'</a>';
+ $details = new moodle_url('/blocks/completionstatus/details.php', array('course' => $course->id));
+ $this->content->footer = '<br><a href="'.$details->out().'">'.get_string('moredetails', 'completion').'</a>';
return $this->content;
}
View
239 blocks/completionstatus/details.php
@@ -19,27 +19,23 @@
*
* @package block
* @subpackage completion
- * @copyright 2009 Catalyst IT Ltd
+ * @copyright 2009-2012 Catalyst IT Ltd
* @author Aaron Barnes <aaronb@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once('../../config.php');
-require_once($CFG->libdir.'/completionlib.php');
-
-
-// TODO: Make this page Moodle 2.0 compliant
+require_once(dirname(__FILE__).'/../../config.php');
+require_once("{$CFG->libdir}/completionlib.php");
///
/// Load data
///
$id = required_param('course', PARAM_INT);
-// User id
$userid = optional_param('user', 0, PARAM_INT);
// Load course
-$course = $DB->get_record('course', array('id' => $id));
+$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
// Load user
if ($userid) {
@@ -76,21 +72,13 @@
// Load completion data
$info = new completion_info($course);
-$returnurl = "{$CFG->wwwroot}/course/view.php?id={$id}";
+$returnurl = new moodle_url('/course/view.php', array('id' => $id));
// Don't display if completion isn't enabled!
if (!$info->is_enabled()) {
print_error('completionnotenabled', 'completion', $returnurl);
}
-// Load criteria to display
-$completions = $info->get_completions($user->id);
-
-// Check if this course has any criteria
-if (empty($completions)) {
- print_error('nocriteriaset', 'completion', $returnurl);
-}
-
// Check this user is enroled
if (!$info->is_tracked_user($user->id)) {
if ($USER->id == $user->id) {
@@ -104,14 +92,15 @@
///
/// Display page
///
+$PAGE->set_context(context_course::instance($course->id));
// Print header
$page = get_string('completionprogressdetails', 'block_completionstatus');
$title = format_string($course->fullname) . ': ' . $page;
$PAGE->navbar->add($page);
$PAGE->set_pagelayout('standard');
-$PAGE->set_url('/blocks/completionstatus/details.php', array('course' => $course->id));
+$PAGE->set_url('/blocks/completionstatus/details.php', array('course' => $course->id, 'user' => $user->id));
$PAGE->set_title(get_string('course') . ': ' . $course->fullname);
$PAGE->set_heading($title);
echo $OUTPUT->header();
@@ -135,122 +124,148 @@
// Has this user completed any criteria?
$criteriacomplete = $info->count_course_user_data($user->id);
+// Load course completion
+$params = array(
+ 'userid' => $user->id,
+ 'course' => $course->id,
+);
+$ccompletion = new completion_completion($params);
+
if ($coursecomplete) {
echo get_string('complete');
-} else if (!$criteriacomplete) {
+} else if (!$criteriacomplete && !$ccompletion->timestarted) {
echo '<i>'.get_string('notyetstarted', 'completion').'</i>';
} else {
echo '<i>'.get_string('inprogress','completion').'</i>';
}
echo '</td></tr>';
-echo '<tr><td colspan="2"><b>'.get_string('required').':</b> ';
-// Get overall aggregation method
-$overall = $info->get_aggregation_method();
+// Load criteria to display
+$completions = $info->get_completions($user->id);
-if ($overall == COMPLETION_AGGREGATION_ALL) {
- echo get_string('criteriarequiredall', 'completion');
+// Check if this course has any criteria
+if (empty($completions)) {
+ echo '<tr><td colspan="2"><br />';
+ echo $OUTPUT->box(get_string('err_nocriteria', 'completion'), 'noticebox');
+ echo '</td></tr></tbody></table>';
} else {
- echo get_string('criteriarequiredany', 'completion');
-}
+ echo '<tr><td colspan="2"><b>'.get_string('required').':</b> ';
-echo '</td></tr></tbody></table>';
-
-// Generate markup for criteria statuses
-echo '<table class="generalbox boxaligncenter" cellpadding="3"><tbody>';
-echo '<tr class="ccheader">';
-echo '<th class="c0 header" scope="col">'.get_string('criteriagroup', 'block_completionstatus').'</th>';
-echo '<th class="c1 header" scope="col">'.get_string('criteria', 'completion').'</th>';
-echo '<th class="c2 header" scope="col">'.get_string('requirement', 'block_completionstatus').'</th>';
-echo '<th class="c3 header" scope="col">'.get_string('status').'</th>';
-echo '<th class="c4 header" scope="col">'.get_string('complete').'</th>';
-echo '<th class="c5 header" scope="col">'.get_string('completiondate', 'report_completion').'</th>';
-echo '</tr>';
-
-// Save row data
-$rows = array();
-
-global $COMPLETION_CRITERIA_TYPES;
-
-// Loop through course criteria
-foreach ($completions as $completion) {
- $criteria = $completion->get_criteria();
- $complete = $completion->is_complete();
-
- $row = array();
- $row['type'] = $criteria->criteriatype;
- $row['title'] = $criteria->get_title();
- $row['status'] = $completion->get_status();
- $row['timecompleted'] = $completion->timecompleted;
- $row['details'] = $criteria->get_details($completion);
- $rows[] = $row;
-}
+ // Get overall aggregation method
+ $overall = $info->get_aggregation_method();
-// Print table
-$last_type = '';
-$agg_type = false;
+ if ($overall == COMPLETION_AGGREGATION_ALL) {
+ echo get_string('criteriarequiredall', 'completion');
+ } else {
+ echo get_string('criteriarequiredany', 'completion');
+ }
+
+ echo '</td></tr></tbody></table>';
+
+ // Generate markup for criteria statuses
+ echo '<table class="generalbox logtable boxaligncenter" id="criteriastatus" width="100%"><tbody>';
+ echo '<tr class="ccheader">';
+ echo '<th class="c0 header" scope="col">'.get_string('criteriagroup', 'block_completionstatus').'</th>';
+ echo '<th class="c1 header" scope="col">'.get_string('criteria', 'completion').'</th>';
+ echo '<th class="c2 header" scope="col">'.get_string('requirement', 'block_completionstatus').'</th>';
+ echo '<th class="c3 header" scope="col">'.get_string('status').'</th>';
+ echo '<th class="c4 header" scope="col">'.get_string('complete').'</th>';
+ echo '<th class="c5 header" scope="col">'.get_string('completiondate', 'report_completion').'</th>';
+ echo '</tr>';
-foreach ($rows as $row) {
+ // Save row data
+ $rows = array();
+
+ // Loop through course criteria
+ foreach ($completions as $completion) {
+ $criteria = $completion->get_criteria();
+
+ $row = array();
+ $row['type'] = $criteria->criteriatype;
+ $row['title'] = $criteria->get_title();
+ $row['status'] = $completion->get_status();
+ $row['complete'] = $completion->is_complete();
+ $row['timecompleted'] = $completion->timecompleted;
+ $row['details'] = $criteria->get_details($completion);
+ $rows[] = $row;
+ }
- // Criteria group
- echo '<td class="c0">';
- if ($last_type !== $row['details']['type']) {
- $last_type = $row['details']['type'];
- echo $last_type;
+ // Print table
+ $last_type = '';
+ $agg_type = false;
+ $oddeven = 0;
- // Reset agg type
- $agg_type = true;
- } else {
- // Display aggregation type
- if ($agg_type) {
- $agg = $info->get_aggregation_method($row['type']);
+ foreach ($rows as $row) {
- echo '(<i>';
+ echo '<tr class="r' . $oddeven . '">';
- if ($agg == COMPLETION_AGGREGATION_ALL) {
- echo strtolower(get_string('all', 'completion'));
- } else {
- echo strtolower(get_string('any', 'completion'));
- }
+ // Criteria group
+ echo '<td class="cell c0">';
+ if ($last_type !== $row['details']['type']) {
+ $last_type = $row['details']['type'];
+ echo $last_type;
+
+ // Reset agg type
+ $agg_type = true;
+ } else {
+ // Display aggregation type
+ if ($agg_type) {
+ $agg = $info->get_aggregation_method($row['type']);
- echo '</i> '.strtolower(get_string('required')).')';
- $agg_type = false;
+ echo '(<i>';
+
+ if ($agg == COMPLETION_AGGREGATION_ALL) {
+ echo strtolower(get_string('aggregateall', 'completion'));
+ } else {
+ echo strtolower(get_string('aggregateany', 'completion'));
+ }
+
+ echo '</i> '.strtolower(get_string('required')).')';
+ $agg_type = false;
+ }
}
+ echo '</td>';
+
+ // Criteria title
+ echo '<td class="cell c1">';
+ echo $row['details']['criteria'];
+ echo '</td>';
+
+ // Requirement
+ echo '<td class="cell c2">';
+ echo $row['details']['requirement'];
+ echo '</td>';
+
+ // Status
+ echo '<td class="cell c3">';
+ echo $row['details']['status'];
+ echo '</td>';
+
+ // Is complete
+ echo '<td class="cell c4">';
+ echo $row['complete'] ? get_string('yes') : get_string('no');
+ echo '</td>';
+
+ // Completion data
+ echo '<td class="cell c5">';
+ if ($row['timecompleted']) {
+ echo userdate($row['timecompleted'], get_string('strftimedate', 'langconfig'));
+ } else {
+ echo '-';
+ }
+ echo '</td>';
+ echo '</tr>';
+ // for row striping
+ $oddeven = $oddeven ? 0 : 1;
}
- echo '</td>';
-
- // Criteria title
- echo '<td class="c1">';
- echo $row['details']['criteria'];
- echo '</td>';
-
- // Requirement
- echo '<td class="c2">';
- echo $row['details']['requirement'];
- echo '</td>';
-
- // Status
- echo '<td class="c3">';
- echo $row['details']['status'];
- echo '</td>';
-
- // Is complete
- echo '<td class="c4">';
- echo ($row['status'] === get_string('yes')) ? get_string('yes') : get_string('no');
- echo '</td>';
-
- // Completion data
- echo '<td class="c5">';
- if ($row['timecompleted']) {
- echo userdate($row['timecompleted'], '%e %B %G');
- } else {
- echo '-';
- }
- echo '</td>';
- echo '</tr>';
+
+ echo '</tbody></table>';
}
-echo '</tbody></table>';
+echo '<div class="buttons">';
+$courseurl = new moodle_url("/course/view.php", array('id' => $course->id));
+echo $OUTPUT->single_button($courseurl, get_string('returntocourse', 'block_completionstatus'), 'get');
+echo '</div>';
echo $OUTPUT->footer();
View
1 blocks/completionstatus/lang/en/block_completionstatus.php
@@ -5,3 +5,4 @@
$string['firstofsecond'] = '{$a->first} of {$a->second}';
$string['pluginname'] = 'Course completion status';
$string['requirement'] = 'Requirement';
+$string['returntocourse'] = 'Return to course';
View
9 blog/external_blogs.php
@@ -44,7 +44,16 @@
if ($delete && confirm_sesskey()) {
$externalbloguserid = $DB->get_field('blog_external', 'userid', array('id' => $delete));
if ($externalbloguserid == $USER->id) {
+ // Delete the external blog
$DB->delete_records('blog_external', array('id' => $delete));
+
+ // Delete the external blog's posts
+ $deletewhere = 'module = :module
+ AND userid = :userid
+ AND ' . $DB->sql_isnotempty('post', 'uniquehash', false, false) . '
+ AND ' . $DB->sql_compare_text('content') . ' = ' . $DB->sql_compare_text(':delete');
+ $DB->delete_records_select('post', $deletewhere, array('module' => 'blog_external', 'userid' => $USER->id, 'delete' => $delete));
+
$message = get_string('externalblogdeleted', 'blog');
}
}
View
5 blog/locallib.php
@@ -292,11 +292,10 @@ public function edit($params=array(), $form=null, $summaryoptions=array(), $atta
* @return void
*/
public function delete() {
- global $DB, $USER;
-
- $returnurl = '';
+ global $DB;
$this->delete_attachments();
+ $this->remove_associations();
$DB->delete_records('post', array('id' => $this->id));
tag_set('post', $this->id, array());
View
2 enrol/manual/yui/quickenrolment/quickenrolment.js
@@ -339,7 +339,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
count++;
var user = result.response.users[i];
users.append(create('<div class="'+CSS.USER+' clearfix" rel="'+user.id+'"></div>')
- .addClass((i%2)?CSS.ODD:CSS.EVEN)
+ .addClass((count%2)?CSS.ODD:CSS.EVEN)
.append(create('<div class="'+CSS.COUNT+'">'+count+'</div>'))
.append(create('<div class="'+CSS.PICTURE+'"></div>')
.append(create(user.picture)))
View
22 enrol/paypal/ipn.php
@@ -34,6 +34,7 @@
require_once("lib.php");
require_once($CFG->libdir.'/eventslib.php');
require_once($CFG->libdir.'/enrollib.php');
+require_once($CFG->libdir . '/filelib.php');
/// Keep out casual intruders
@@ -89,27 +90,27 @@
$plugin = enrol_get_plugin('paypal');
/// Open a connection back to PayPal to validate the data
-$header = '';
-$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
-$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
-$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
+$c = new curl();
+$options = array(
+ 'returntransfer' => true,
+ 'httpheader' => array('application/x-www-form-urlencoded'),
+ 'timeout' => 30,
+);
$paypaladdr = empty($CFG->usepaypalsandbox) ? 'www.paypal.com' : 'www.sandbox.paypal.com';
-$fp = fsockopen ($paypaladdr, 80, $errno, $errstr, 30);
+$location = "https://$paypaladdr/cgi-bin/webscr";
+$result = $c->post($location, $req, $options);
-if (!$fp) { /// Could not open a socket to PayPal - FAIL
+if (!$result) { /// Could not connect to PayPal - FAIL
echo "<p>Error: could not access paypal.com</p>";
message_paypal_error_to_admin("Could not access paypal.com to verify payment", $data);
die;
}
/// Connection is OK, so now we post the data to validate it
-fputs ($fp, $header.$req);
-
/// Now read the response and check if everything is OK.
-while (!feof($fp)) {
- $result = fgets($fp, 1024);
+if (strlen($result) > 0) {
if (strcmp($result, "VERIFIED") == 0) { // VALID PAYMENT!
@@ -296,7 +297,6 @@
}
}
-fclose($fp);
exit;
View
3 filter/mediaplugin/tests/filter_test.php
@@ -57,6 +57,9 @@ function test_filter_mediaplugin_link() {
'<a id="movie player" class="center" href="http://moodle.org/testfile/test.mpg">test mpg</a>',
'<a href="http://moodle.org/testfile/test.ram">test</a>',
'<a href="http://www.youtube.com/watch?v=JghQgA2HMX8" class="href=css">test file</a>',
+ '<a href="http://www.youtube-nocookie.com/watch?v=JghQgA2HMX8" class="href=css">test file</a>',
+ '<a href="http://youtu.be/JghQgA2HMX8" class="href=css">test file</a>',
+ '<a href="http://y2u.be/JghQgA2HMX8" class="href=css">test file</a>',
'<a class="youtube" href="http://www.youtube.com/watch?v=JghQgA2HMX8">test file</a>',
'<a class="_blanktarget" href="http://moodle.org/testfile/test.flv?d=100x100">test flv</a>',
'<a class="hrefcss" href="http://www.youtube.com/watch?v=JghQgA2HMX8">test file</a>',
View
3 grade/edit/tree/category_form.php
@@ -225,7 +225,7 @@ function definition() {
$mform->addElement('header', 'headerparent', get_string('parentcategory', 'grades'));
$options = array();
- $default = '';
+ $default = -1;
$categories = grade_category::fetch_all(array('courseid'=>$COURSE->id));
foreach ($categories as $cat) {
@@ -238,6 +238,7 @@ function definition() {
if (count($categories) > 1) {
$mform->addElement('select', 'parentcategory', get_string('parentcategory', 'grades'), $options);
+ $mform->setDefault('parentcategory', $default);
$mform->addElement('static', 'currentparentaggregation', get_string('currentparentaggregation', 'grades'));
}
View
2 lang/en/admin.php
@@ -68,7 +68,7 @@
$string['backgroundcolour'] = 'Transparent colour';
$string['backups'] = 'Backups';
$string['backup_shortname'] = 'Use course name in backup filename';
-$string['backup_shortnamehelp'] = 'Use the course name as part of the backup filename instead of the course id number.';
+$string['backup_shortnamehelp'] = 'Use the course name as part of the backup filename.';
$string['badwordsconfig'] = 'Enter your list of bad words separated by commas.';
$string['badwordsdefault'] = 'If the custom list is empty, a default list from the language pack will be used.';
$string['badwordslist'] = 'Custom bad words list';
View
2 lang/en/backup.php
@@ -163,6 +163,7 @@
$string['lockedbyconfig'] = 'This setting has been locked by the default backup settings';
$string['lockedbyhierarchy'] = 'Locked by dependencies';
$string['managefiles'] = 'Manage backup files';
+$string['missingfilesinpool'] = 'Some files could not be saved during the backup, it won\'t be possible to restore them.';
$string['moodleversion'] = 'Moodle version';
$string['moreresults'] = 'There are too many results, enter a more specific search.';
$string['nomatchingcourses'] = 'There are no courses to display';
@@ -177,6 +178,7 @@
$string['restorecourse'] = 'Restore course';
$string['restorecoursesettings'] = 'Course settings';
$string['restoreexecutionsuccess'] = 'The course was restored successfully, clicking the continue button below will take you to view the course you restored.';
+$string['restorefileweremissing'] = 'Some files could not be restored because they were missing in the backup.';
$string['restorenewcoursefullname'] = 'New course name';
$string['restorenewcourseshortname'] = 'New course short name';
$string['restorenewcoursestartdate'] = 'New start date';
View
2 lang/en/block.php
@@ -37,6 +37,8 @@
$string['defaultregion_help'] = 'Themes may define one or more named block regions where blocks are displayed. This setting defines which of these you want this block to appear in by default. The region may be overridden on specific pages if required.';
$string['defaultweight'] = 'Default weight';
$string['defaultweight_help'] = 'The default weight allows you to choose roughly where you want the block to appear in the chosen region, either at the top or the bottom. The final location is calculated from all the blocks in that region (for example, only one block can actually be at the top). This value can be overridden on specific pages if required.';
+$string['deletecheck'] = 'Delete {$a} block?';
+$string['deleteblockcheck'] = 'Are you sure that you want to delete this block titled {$a}?';
$string['moveblockhere'] = 'Move block here';
$string['movingthisblockcancel'] = 'Moving this block ({$a})';
$string['onthispage'] = 'On this page';
View
1 lang/en/moodle.php
@@ -1802,6 +1802,7 @@
$string['virusplaceholder'] = 'This file that has been uploaded was found to contain a virus and has been moved or deleted and the user notified.';
$string['visible'] = 'Visible';
$string['visibletostudents'] = 'Visible to {$a}';
+$string['warning'] = 'Warning';
$string['warningdeleteresource'] = 'Warning: {$a} is referred in a resource. Would you like to update the resource?';
$string['webpage'] = 'Web page';
$string['week'] = 'Week';
View
2 lib/accesslib.php
@@ -6676,7 +6676,7 @@ public function get_context_name($withprefix = true, $short = false) {
if ($withprefix){
$name = get_string('modulename', $cm->modname).': ';
}
- $name .= $mod->name;
+ $name .= format_string($mod->name, true, array('context' => $this));
}
}
return $name;
View
2 lib/adodb/adodb-active-record.inc.php
@@ -1,7 +1,7 @@
<?php
/*
-@version V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+@version V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
Latest version is available at http://adodb.sourceforge.net
Released under both BSD license and Lesser GPL library license.
View
2 lib/adodb/adodb-csvlib.inc.php
@@ -8,7 +8,7 @@
/*
- V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
View
2 lib/adodb/adodb-datadict.inc.php
@@ -1,7 +1,7 @@
<?php
/**
- V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
View
2 lib/adodb/adodb-error.inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ * @version V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
View
2 lib/adodb/adodb-errorhandler.inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ * @version V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
View
2 lib/adodb/adodb-errorpear.inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ * @version V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
* Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
View
2 lib/adodb/adodb-exceptions.inc.php
@@ -1,7 +1,7 @@
<?php
/**
- * @version V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ * @version V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
View
2 lib/adodb/adodb-iterator.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
View
2 lib/adodb/adodb-lib.inc.php
@@ -6,7 +6,7 @@
$ADODB_INCLUDED_LIB = 1;
/*
- @version V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ @version V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
View
2 lib/adodb/adodb-memcache.lib.inc.php
@@ -11,7 +11,7 @@
/*
- V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.17 17 May 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.