Compare commits
350 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa54db9c03 | |||
| a7c5b8b2c7 | |||
| ffe5c78488 | |||
| 6ac71df086 | |||
| f3e7afedb9 | |||
| 630b8fdaea | |||
| 5673aae914 | |||
| 5b25b33fa7 | |||
| c8a1646ab8 | |||
| 76cd16e6e4 | |||
| f886f76e7f | |||
| 2d6c0ecd0d | |||
| 920d2d9585 | |||
| 2bd8a55dfd | |||
| 2f6c18c88c | |||
| baa9517b57 | |||
| 5330c5c2d4 | |||
| 30aeabb79e | |||
| 2f63a6883f | |||
| ebb8f60603 | |||
| 37fd0a3d81 | |||
| 547932e130 | |||
| ee612f1ed2 | |||
| 67ac2b0cee | |||
| a5155586fe | |||
| 12e29080e1 | |||
| 70a3da5396 | |||
| 3109a202db | |||
| 3a22694267 | |||
| bda6ef6fe9 | |||
| a13f667276 | |||
| 295fad3d07 | |||
| fee5de5adf | |||
| dfea73010d | |||
| 3c542cdda5 | |||
| 9f1cd92626 | |||
| 045be2b1a7 | |||
| b7d307e807 | |||
| 70bd537332 | |||
| b4da1e0ae4 | |||
| 78ec6751fc | |||
| 28947c1d7d | |||
| 350397da93 | |||
| 4068025c04 | |||
| 80eb5bc7b7 | |||
| 19bf8ae268 | |||
| 7f426dd24f | |||
| 278cd8f20f | |||
| 39ae18a2f9 | |||
| df96662b0e | |||
| 323f3745fe | |||
| 8cad4af03e | |||
| afa1a8e3fb | |||
| 0a2c4e7eca | |||
| 79da0b1581 | |||
| 03e35c77fd | |||
| 8e20b6da45 | |||
| dbfaa2da32 | |||
| 7f99e1d1ea | |||
| e534e99afd | |||
| 29b97d94bb | |||
| a25eef762f | |||
| 5473b69ade | |||
| 4d711ff280 | |||
| 04b42e3077 | |||
| 1a8400f5eb | |||
| a1b09ffb52 | |||
| ffce507736 | |||
| f78f3fb749 | |||
| e4e261bd7e | |||
| 1354593011 | |||
| be18b7c593 | |||
| f7db06401e | |||
| 697929847f | |||
| bbeaad5052 | |||
| 21c59d05e1 | |||
| 62099b3be0 | |||
| 3a33d06d85 | |||
| e22d6ad0ed | |||
| a9074a2649 | |||
| d89e4bc0e6 | |||
| df967d0185 | |||
| d9f965c1e4 | |||
| 2842b48847 | |||
| bba516205b | |||
| ade5a860b5 | |||
| 5452cc62f2 | |||
| 9aae67ec07 | |||
| e47d9d12c6 | |||
| e07cff97f1 | |||
| 056e2ea0be | |||
| 436463209e | |||
| 2a9e7de93c | |||
| 86a79e2578 | |||
| 40d66dfdd0 | |||
| d2d64d0264 | |||
| 467fe2e4b1 | |||
| 16ade9d88c | |||
| b34be49db4 | |||
| a5f4089c68 | |||
| a6e090b15f | |||
| 26507a9a67 | |||
| 83180e040a | |||
| 2ab166e39e | |||
| 46ebedce58 | |||
| 70cb53466d | |||
| a164589209 | |||
| 5ae7cc6255 | |||
| 52cdd42a89 | |||
| 43f35d037e | |||
| 07f50b7284 | |||
| 852d96580b | |||
| 4d3bad7e51 | |||
| b4a592aa3b | |||
| a94e5a405d | |||
| 3428cd4c9b | |||
| 6cb449dc0f | |||
| de8958e8ac | |||
| 267f12abe1 | |||
| e69a1a6b6f | |||
| 83503c9838 | |||
| fca58b02df | |||
| c0ffc90640 | |||
| 5ee0d1d3ee | |||
| fd6358feaa | |||
| 99a5af9eda | |||
| e0caa3031d | |||
| 62990c9d11 | |||
| 0bbacc0e2f | |||
| 300503ddd6 | |||
| 3d1c374bd5 | |||
| 59061012b8 | |||
| df2f832789 | |||
| 3135752ba0 | |||
| d6fd894a76 | |||
| 433b5c28db | |||
| ef394f5aa9 | |||
| 982440c14f | |||
| 715d55c963 | |||
| 8b011c7b2e | |||
| 1106aa4c4c | |||
| 840cb4e4d6 | |||
| c85de44a7b | |||
| 59728f1a7c | |||
| 6378ece404 | |||
| a82add34eb | |||
| 8a8ae4df07 | |||
| 62f8da23af | |||
| 24eae8af65 | |||
| 16dde93127 | |||
| 81c0cd9644 | |||
| ab3ac68481 | |||
| 55b5acd0a8 | |||
| b0761ac9bd | |||
| d0a74e4db9 | |||
| 91afdf5f61 | |||
| 9eb5bab913 | |||
| 8ecc51ed61 | |||
| 409722bf2f | |||
| 3b19fb6319 | |||
| 3e7ae2b7da | |||
| b09e0ba6c4 | |||
| e5e2a01924 | |||
| b0682b9333 | |||
| 5e5a7b24b3 | |||
| 2bcfe2567e | |||
| 70cbcfe454 | |||
| 68f9c67088 | |||
| 4f1e546cc7 | |||
| 6d2f958fc5 | |||
| 41fecc5d7f | |||
| c428924fbf | |||
| 3c5c1fc348 | |||
| bef2cf1d28 | |||
| 52df0b99ee | |||
| a0c267eaa8 | |||
| e9d861b105 | |||
| c57d132ebb | |||
| 06d2bb239e | |||
| 5bc1cf85db | |||
| 8f59956765 | |||
| 56e611331e | |||
| a1952e8f70 | |||
| e9a4047b81 | |||
| 0f8a6f5696 | |||
| 08c50738b3 | |||
| 55588fd82e | |||
| ab0fb67e46 | |||
| 39cf27cf64 | |||
| 453a4c9202 | |||
| 9070a896ae | |||
| 2003c6ef66 | |||
| d77da9c15a | |||
| 0edc188114 | |||
| aa6b26be8c | |||
| 1cd346e6a7 | |||
| 2bce61f247 | |||
| 85978ff0d1 | |||
| f679a1e068 | |||
| ca92a72426 | |||
| cdca415c62 | |||
| 9225863595 | |||
| ebfb2e51e3 | |||
| 4659117d2e | |||
| 877ea00888 | |||
| f6267b1f20 | |||
| 847de86adf | |||
| 1d86f3c18e | |||
| c2217dea2c | |||
| f5afe1acb0 | |||
| 1280d41691 | |||
| 7c6628941b | |||
| 38ebaa270d | |||
| 22335cfd9d | |||
| 7198eb72d9 | |||
| b582e4b1f1 | |||
| ba8240b429 | |||
| c25f161423 | |||
| 737df5ca1b | |||
| 0fddb5735c | |||
| b365d5cc2d | |||
| c301086a1f | |||
| 412b144b98 | |||
| 51a31cbec1 | |||
| 3142069285 | |||
| e34d82ac30 | |||
| 0582523ced | |||
| a1f4486b19 | |||
| 5aa2e6a6c8 | |||
| dd504eded3 | |||
| 036c72ea8a | |||
| 87f1d0aeab | |||
| 7cf70d686e | |||
| e532ca42e5 | |||
| 8885056125 | |||
| 16d070960d | |||
| 6d20d0f39e | |||
| e2ac2c6692 | |||
| bcecb03bbf | |||
| 7a9544773f | |||
| 225526cd29 | |||
| 83bcf92ca4 | |||
| 1c21735b18 | |||
| 32fae6b5e3 | |||
| a45058e2a4 | |||
| 6eac74a233 | |||
| a4546be3a8 | |||
| a3aa563b60 | |||
| 1fad87a81c | |||
| 83190c6188 | |||
| f33400b3a8 | |||
| 299ea13687 | |||
| 9ad24a034e | |||
| 9c1a586e4c | |||
| 82c8214fdd | |||
| 72ca43735f | |||
| 7e39143012 | |||
| 51b1d8cb99 | |||
| 061bfe9071 | |||
| 01cf3fc45e | |||
| 194f690f1b | |||
| a1df482ac4 | |||
| 55211a8d66 | |||
| 2608c20590 | |||
| aea1c25f07 | |||
| 36d5d6d51b | |||
| ed18a447b1 | |||
| f70f73517c | |||
| 5ffcd725ce | |||
| baf58176f0 | |||
| 1a27d1b1fa | |||
| 5cc5164228 | |||
| e4643add2f | |||
| bac2631892 | |||
| cfc17e4d61 | |||
| f1a1e58f91 | |||
| 86fdfa6e6e | |||
| 5cb340368f | |||
| 0a45b86dca | |||
| 111141b38a | |||
| b199c83c3a | |||
| 1359e4db0b | |||
| 37dadfe23e | |||
| 7df2c28ca4 | |||
| cc2957a8b8 | |||
| 788ca28e2a | |||
| 4e47cc03ac | |||
| 93971a7435 | |||
| b71319ecff | |||
| 38335b585e | |||
| 883bf7b4ba | |||
| dad3040e87 | |||
| a264c46f06 | |||
| 2c4557c760 | |||
| d7bbbdcd39 | |||
| e8c6bca2c8 | |||
| ce980d24f4 | |||
| b8062ad45c | |||
| d856439a71 | |||
| cda5471399 | |||
| 5dcc5dc2ba | |||
| 1164d83897 | |||
| 65c0f42251 | |||
| 393f5575b0 | |||
| 41f5bf1300 | |||
| 67f6370208 | |||
| 9b3049630d | |||
| c957fdc649 | |||
| c228f82bbb | |||
| a0f47922fc | |||
| 784fe082be | |||
| e495eb5a52 | |||
| 8c4d6cc3a7 | |||
| 4aee467e1b | |||
| 1cdc355053 | |||
| 3478cf2337 | |||
| cd5be28db8 | |||
| 928f68efc6 | |||
| 69067fb44b | |||
| 723e307909 | |||
| d3c05d5bab | |||
| 28a33650aa | |||
| 154356ede5 | |||
| 9de52c1c5b | |||
| 8581b4aaa0 | |||
| fad0937a82 | |||
| 5b1e0822ac | |||
| c1106792b1 | |||
| 44b789cc6d | |||
| ffd413d436 | |||
| cbf87a42c8 | |||
| 52f5987d67 | |||
| f911807a10 | |||
| 9ab0b3da2b | |||
| 37a00d0eae | |||
| 86b1847c71 | |||
| 5f6ae21a57 | |||
| 4a3d2cf9ff | |||
| 4e482832b3 | |||
| 6af3c65f4f | |||
| ef381fdae1 | |||
| 4e54faadc0 | |||
| 69031e3e1d | |||
| 002f6fe9c0 | |||
| 4ea8fc0a7e | |||
| e1e21e55e6 | |||
| b4c0270557 | |||
| ac5e89c4f4 | |||
| a1d4beea54 | |||
| 9f1149e66a |
@@ -1134,6 +1134,16 @@
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.8" requires="2.2">
|
||||
@@ -1257,6 +1267,154 @@
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.9" requires="2.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.1" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR 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_ERROR 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="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR 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="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+21
-16
@@ -561,31 +561,36 @@ $cronoverdue = ($lastcron < time() - 3600 * 24);
|
||||
$dbproblems = $DB->diagnose();
|
||||
$maintenancemode = !empty($CFG->maintenance_enabled);
|
||||
|
||||
// Available updates for Moodle core
|
||||
// Available updates for Moodle core.
|
||||
$updateschecker = \core\update\checker::instance();
|
||||
$availableupdates = array();
|
||||
$availableupdates['core'] = $updateschecker->get_update_info('core',
|
||||
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
|
||||
$availableupdatesfetch = null;
|
||||
|
||||
// Available updates for contributed plugins
|
||||
$pluginman = core_plugin_manager::instance();
|
||||
foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) {
|
||||
foreach ($plugintypeinstances as $pluginname => $plugininfo) {
|
||||
if (!empty($plugininfo->availableupdates)) {
|
||||
foreach ($plugininfo->availableupdates as $pluginavailableupdate) {
|
||||
if ($pluginavailableupdate->version > $plugininfo->versiondisk) {
|
||||
if (!isset($availableupdates[$plugintype.'_'.$pluginname])) {
|
||||
$availableupdates[$plugintype.'_'.$pluginname] = array();
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
// Only compute the update information when it is going to be displayed to the user.
|
||||
$availableupdates['core'] = $updateschecker->get_update_info('core',
|
||||
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
|
||||
|
||||
// Available updates for contributed plugins
|
||||
$pluginman = core_plugin_manager::instance();
|
||||
foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) {
|
||||
foreach ($plugintypeinstances as $pluginname => $plugininfo) {
|
||||
if (!empty($plugininfo->availableupdates)) {
|
||||
foreach ($plugininfo->availableupdates as $pluginavailableupdate) {
|
||||
if ($pluginavailableupdate->version > $plugininfo->versiondisk) {
|
||||
if (!isset($availableupdates[$plugintype.'_'.$pluginname])) {
|
||||
$availableupdates[$plugintype.'_'.$pluginname] = array();
|
||||
}
|
||||
$availableupdates[$plugintype.'_'.$pluginname][] = $pluginavailableupdate;
|
||||
}
|
||||
$availableupdates[$plugintype.'_'.$pluginname][] = $pluginavailableupdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The timestamp of the most recent check for available updates
|
||||
$availableupdatesfetch = $updateschecker->get_last_timefetched();
|
||||
// The timestamp of the most recent check for available updates
|
||||
$availableupdatesfetch = $updateschecker->get_last_timefetched();
|
||||
}
|
||||
|
||||
$buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
|
||||
//check if the site is registered on Moodle.org
|
||||
|
||||
@@ -65,7 +65,7 @@ if (!empty($registeredhub) and $registeredhub->token == $token) {
|
||||
$registeredhub->hubname = $hubname;
|
||||
$registrationmanager->update_registeredhub($registeredhub);
|
||||
|
||||
//display notficiation message
|
||||
// Display notification message.
|
||||
$notificationmessage = $OUTPUT->notification(
|
||||
get_string('registrationconfirmedon', 'hub', $hublink), 'notifysuccess');
|
||||
echo $notificationmessage;
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
|
||||
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
|
||||
*
|
||||
* On this page the administrator selects which hub he wants to register,
|
||||
* except for MOOCH. Admins can register with MOOCH with the top admin menu "Registration" link.
|
||||
* On this page the administrator can also unregister from any hubs, including MOOCH.
|
||||
* On this page the administrator selects which hub he wants to register (except for moodle.net)
|
||||
* Admins can register with moodle.net via the site admin menu "Registration" link.
|
||||
* On this page the administrator can also unregister from any hubs including moodle.net.
|
||||
*/
|
||||
|
||||
require('../../config.php');
|
||||
|
||||
+28
-24
@@ -53,32 +53,36 @@ class registration_manager {
|
||||
public function cron() {
|
||||
global $CFG;
|
||||
if (extension_loaded('xmlrpc')) {
|
||||
//check if the last registration cron update was less than a week ago
|
||||
$lastcron = get_config('registration', 'crontime');
|
||||
if ($lastcron === false or $lastcron < strtotime("-7 day")) { //set to a week, see MDL-23704
|
||||
$function = 'hub_update_site_info';
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
|
||||
//update all hub where the site is registered on
|
||||
$hubs = $this->get_registered_on_hubs();
|
||||
foreach ($hubs as $hub) {
|
||||
//update the registration
|
||||
$siteinfo = $this->get_site_info($hub->huburl);
|
||||
$params = array('siteinfo' => $siteinfo);
|
||||
$serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
|
||||
} catch (Exception $e) {
|
||||
$errorparam = new stdClass();
|
||||
$errorparam->errormessage = $e->getMessage();
|
||||
$errorparam->hubname = $hub->hubname;
|
||||
mtrace(get_string('errorcron', 'hub', $errorparam));
|
||||
}
|
||||
}
|
||||
set_config('crontime', time(), 'registration');
|
||||
if ($lastcron > strtotime("-7 day")) { // Prevent this happening more than once a week.
|
||||
return;
|
||||
}
|
||||
|
||||
$function = 'hub_update_site_info';
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
|
||||
// Update all hubs where the site is registered.
|
||||
$hubs = $this->get_registered_on_hubs();
|
||||
if (empty($hubs)) {
|
||||
mtrace(get_string('registrationwarning', 'admin'));
|
||||
}
|
||||
foreach ($hubs as $hub) {
|
||||
// Update the registration.
|
||||
$siteinfo = $this->get_site_info($hub->huburl);
|
||||
$params = array('siteinfo' => $siteinfo);
|
||||
$serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
|
||||
} catch (Exception $e) {
|
||||
$errorparam = new stdClass();
|
||||
$errorparam->errormessage = $e->getMessage();
|
||||
$errorparam->hubname = $hub->hubname;
|
||||
mtrace(get_string('errorcron', 'hub', $errorparam));
|
||||
}
|
||||
}
|
||||
set_config('crontime', time(), 'registration');
|
||||
} else {
|
||||
mtrace(get_string('errorcronnoxmlrpc', 'hub'));
|
||||
}
|
||||
|
||||
@@ -177,6 +177,13 @@ if (!empty($error)) {
|
||||
|
||||
//some Moodle.org resitration explanation
|
||||
if ($huburl == HUB_MOODLEORGHUBURL) {
|
||||
if (!empty($registeredhub->token)) {
|
||||
$registrationmessage = get_string('pleaserefreshregistration', 'admin');
|
||||
} else {
|
||||
$registrationmessage = get_string('registrationwarning', 'admin');
|
||||
}
|
||||
echo $OUTPUT->notification($registrationmessage);
|
||||
|
||||
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
echo $renderer->moodleorg_registration_message();
|
||||
|
||||
@@ -36,13 +36,18 @@ class core_register_renderer extends plugin_renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
public function moodleorg_registration_message() {
|
||||
$moodleorgurl = html_writer::link('http://moodle.org', 'Moodle.org');
|
||||
$moodleorgstatsurl = html_writer::link('http://moodle.org/stats', get_string('statsmoodleorg', 'admin'));
|
||||
$moochurl = html_writer::link(HUB_MOODLEORGHUBURL, get_string('moodleorghubname', 'admin'));
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin', $moodleorgurl);
|
||||
|
||||
$moodleorgstatslink = html_writer::link('http://moodle.net/stats',
|
||||
get_string('statsmoodleorg', 'admin'),
|
||||
array('target' => '_blank'));
|
||||
|
||||
$hublink = html_writer::link('https://moodle.net/mod/page/view.php?id=1',
|
||||
get_string('moodleorghubname', 'admin'),
|
||||
array('target' => '_blank'));
|
||||
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin', $hublink);
|
||||
$items = array(get_string('registermoodleorgli1', 'admin'),
|
||||
get_string('registermoodleorgli2', 'admin', $moodleorgstatsurl),
|
||||
get_string('registermoodleorgli3', 'admin', $moochurl));
|
||||
get_string('registermoodleorgli2', 'admin', $moodleorgstatslink));
|
||||
$moodleorgregmsg .= html_writer::alist($items);
|
||||
return $moodleorgregmsg;
|
||||
}
|
||||
|
||||
+14
-4
@@ -264,6 +264,7 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
$strshow = get_string('on', 'repository');
|
||||
$strhide = get_string('off', 'repository');
|
||||
$strdelete = get_string('disabled', 'repository');
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
|
||||
$actionchoicesforexisting = array(
|
||||
'show' => $strshow,
|
||||
@@ -286,9 +287,9 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
|
||||
// Table to list plug-ins
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr);
|
||||
$table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr, $struninstall);
|
||||
|
||||
$table->colclasses = array('leftalign', 'centeralign', 'centeralign', 'centeralign', 'centeralign');
|
||||
$table->colclasses = array('leftalign', 'centeralign', 'centeralign', 'centeralign', 'centeralign', 'centeralign');
|
||||
$table->id = 'repositoriessetting';
|
||||
$table->data = array();
|
||||
$table->attributes['class'] = 'admintable generaltable';
|
||||
@@ -384,7 +385,12 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
|
||||
$updowncount++;
|
||||
|
||||
$table->data[] = array($i->get_readablename(), $OUTPUT->render($select), $updown, $settings);
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('repository_' . $typename, 'manage')) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
$table->data[] = array($i->get_readablename(), $OUTPUT->render($select), $updown, $settings, $uninstall);
|
||||
|
||||
if (!in_array($typename, $alreadyplugins)) {
|
||||
$alreadyplugins[] = $typename;
|
||||
@@ -400,7 +406,11 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
if (!in_array($plugin, $alreadyplugins)) {
|
||||
$select = new single_select(repository_action_url($plugin, 'repos'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . basename($plugin));
|
||||
$select->set_label(get_string('action'), array('class' => 'accesshide'));
|
||||
$table->data[] = array(get_string('pluginname', 'repository_'.$plugin), $OUTPUT->render($select), '', '');
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('repository_' . $plugin, 'manage')) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
$table->data[] = array(get_string('pluginname', 'repository_'.$plugin), $OUTPUT->render($select), '', '', $uninstall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,30 @@ class behat_admin extends behat_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the specified site settings. A table with | config | value | (optional)plugin | is expected.
|
||||
*
|
||||
* @Given /^the following config values are set as admin:$/
|
||||
* @param TableNode $table
|
||||
*/
|
||||
public function the_following_config_values_are_set_as_admin(TableNode $table) {
|
||||
|
||||
if (!$data = $table->getRowsHash()) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($data as $config => $value) {
|
||||
// Default plugin value is null.
|
||||
$plugin = null;
|
||||
|
||||
if (is_array($value)) {
|
||||
$plugin = $value[1];
|
||||
$value = $value[0];
|
||||
}
|
||||
set_config($config, $value, $plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits with the provided params if we are running a JS session.
|
||||
*
|
||||
|
||||
@@ -7,10 +7,10 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | auth | confirmed |
|
||||
| user1 | User | One | one@asd.com | manual | 0 |
|
||||
| user2 | User | Two | two@asd.com | ldap | 1 |
|
||||
| user3 | User | Three | three@asd.com | manual | 1 |
|
||||
| user4 | User | Four | four@asd.com | ldap | 0 |
|
||||
| user1 | User | One | one@example.com | manual | 0 |
|
||||
| user2 | User | Two | two@example.com | ldap | 1 |
|
||||
| user3 | User | Three | three@example.com | manual | 1 |
|
||||
| user4 | User | Four | four@example.com | ldap | 0 |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| Cohort 1 | CH1 |
|
||||
@@ -23,8 +23,8 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
| user2 | C1 | student |
|
||||
| user3 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I add "User Two (two@asd.com)" user to "CH1" cohort members
|
||||
And I add "User Three (three@asd.com)" user to "CH1" cohort members
|
||||
And I add "User Two (two@example.com)" user to "CH1" cohort members
|
||||
And I add "User Three (three@example.com)" user to "CH1" cohort members
|
||||
And I follow "Browse list of users"
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -13,15 +13,13 @@ Feature: Set admin settings value
|
||||
And I should not see "C_shortname Course fullname"
|
||||
|
||||
Scenario: set admin value with full name
|
||||
Given I set the following administration settings values:
|
||||
| Display extended course names | 1 |
|
||||
When I press "Save changes"
|
||||
Given the following config values are set as admin:
|
||||
| courselistshortnames | 1 |
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
|
||||
Scenario: set admin value with short name
|
||||
Given I set the following administration settings values:
|
||||
Given the following config values are set as admin:
|
||||
| courselistshortnames | 1 |
|
||||
When I press "Save changes"
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
@@ -21,7 +21,7 @@ Feature: Upload users
|
||||
And I should see "Tom"
|
||||
And I should see "Jones"
|
||||
And I should see "verysecret"
|
||||
And I should see "jonest@someplace.edu"
|
||||
And I should see "jonest@example.com"
|
||||
And I should see "Reznor"
|
||||
And I should see "course1"
|
||||
And I should see "math102"
|
||||
@@ -32,7 +32,7 @@ Feature: Upload users
|
||||
And I follow "Browse list of users"
|
||||
And I should see "Tom Jones"
|
||||
And I should see "Trent Reznor"
|
||||
And I should see "reznor@someplace.edu"
|
||||
And I should see "reznor@example.com"
|
||||
And I am on homepage
|
||||
And I follow "Maths"
|
||||
And I expand "Users" node
|
||||
|
||||
@@ -13,8 +13,8 @@ Feature: Manage availability conditions
|
||||
Then I should not see "Availability restrictions"
|
||||
|
||||
# Enable it and check I can now see and click on it.
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I am on homepage
|
||||
And I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions"
|
||||
|
||||
@@ -28,9 +28,9 @@ Feature: Manage availability conditions
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I am on homepage
|
||||
When I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions"
|
||||
|
||||
|
||||
@@ -44,13 +44,19 @@ require_once(__DIR__ . '/../../../../lib/behat/lib.php');
|
||||
chdir(__DIR__);
|
||||
$output = null;
|
||||
exec("php util.php --diag", $output, $code);
|
||||
|
||||
// Ensure we have composer installed, before we install or re-install test site.
|
||||
if ($code == BEHAT_EXITCODE_COMPOSER || $code == BEHAT_EXITCODE_INSTALL || $code == BEHAT_EXITCODE_REINSTALL) {
|
||||
testing_update_composer_dependencies();
|
||||
chdir(__DIR__);
|
||||
exec("php util.php --diag", $output, $code);
|
||||
}
|
||||
|
||||
if ($code == 0) {
|
||||
echo "Behat test environment already installed\n";
|
||||
|
||||
} else if ($code == BEHAT_EXITCODE_INSTALL) {
|
||||
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
// Behat and dependencies are installed and we need to install the test site.
|
||||
chdir(__DIR__);
|
||||
passthru("php util.php --install", $code);
|
||||
@@ -60,8 +66,6 @@ if ($code == 0) {
|
||||
|
||||
} else if ($code == BEHAT_EXITCODE_REINSTALL) {
|
||||
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
// Test site data is outdated.
|
||||
chdir(__DIR__);
|
||||
passthru("php util.php --drop", $code);
|
||||
@@ -74,18 +78,6 @@ if ($code == 0) {
|
||||
exit($code);
|
||||
}
|
||||
|
||||
} else if ($code == BEHAT_EXITCODE_COMPOSER) {
|
||||
// Missing Behat dependencies.
|
||||
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
// Returning to admin/tool/behat/cli.
|
||||
chdir(__DIR__);
|
||||
passthru("php util.php --install", $code);
|
||||
if ($code != 0) {
|
||||
exit($code);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Generic error, we just output it.
|
||||
echo implode("\n", $output)."\n";
|
||||
|
||||
@@ -165,7 +165,7 @@ class tool_behat_renderer extends plugin_renderer_base {
|
||||
// Info.
|
||||
$installurl = behat_command::DOCS_URL . '#Installation';
|
||||
$installlink = html_writer::tag('a', $installurl, array('href' => $installurl, 'target' => '_blank'));
|
||||
$writetestsurl = behat_command::DOCS_URL . '#Writting_features';
|
||||
$writetestsurl = behat_command::DOCS_URL . '#Writing_features';
|
||||
$writetestslink = html_writer::tag('a', $writetestsurl, array('href' => $writetestsurl, 'target' => '_blank'));
|
||||
$writestepsurl = behat_command::DOCS_URL . '#Adding_steps_definitions';
|
||||
$writestepslink = html_writer::tag('a', $writestepsurl, array('href' => $writestepsurl, 'target' => '_blank'));
|
||||
|
||||
@@ -69,8 +69,8 @@ Feature: Set up contextual data for tests
|
||||
Scenario: Role overrides
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
@@ -99,7 +99,7 @@ Feature: Set up contextual data for tests
|
||||
Scenario: Add course enrolments
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
@@ -117,11 +117,11 @@ Feature: Set up contextual data for tests
|
||||
| Custom student | custom2 | | |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@moodlemoodle.com |
|
||||
| user2 | User | 2 | user2@moodlemoodle.com |
|
||||
| user3 | User | 3 | user3@moodlemoodle.com |
|
||||
| user4 | User | 4 | user4@moodlemoodle.com |
|
||||
| user5 | User | 5 | user5@moodlemoodle.com |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
| user3 | User | 3 | user3@example.com |
|
||||
| user4 | User | 4 | user4@example.com |
|
||||
| user5 | User | 5 | user5@example.com |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
@@ -219,8 +219,8 @@ Feature: Set up contextual data for tests
|
||||
Scenario: Add relations between users and groups
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
@@ -259,8 +259,8 @@ Feature: Set up contextual data for tests
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| System cohort A | CHSA |
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: Edit capabilities
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
|
||||
@@ -10,9 +10,9 @@ Feature: Verify that all form fields values can be get and set
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | email | firstname | lastname |
|
||||
| student1 | s1@asd.com | Student | 1 |
|
||||
| student2 | s2@asd.com | Student | 2 |
|
||||
| student3 | s3@asd.com | Student | 3 |
|
||||
| student1 | s1@example.com | Student | 1 |
|
||||
| student2 | s2@example.com | Student | 2 |
|
||||
| student3 | s3@example.com | Student | 3 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
|
||||
@@ -91,19 +91,24 @@ class store implements \tool_log\log\store, \core\log\sql_select_reader {
|
||||
// Replace the query with hardcoded mappings required for core.
|
||||
list($selectwhere, $params, $sort) = self::replace_sql_legacy($selectwhere, $params, $sort);
|
||||
|
||||
$events = array();
|
||||
$records = array();
|
||||
|
||||
try {
|
||||
$records = $DB->get_records_select('log', $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);
|
||||
// A custom report + on the fly SQL rewriting = a possible exception.
|
||||
$records = $DB->get_recordset_select('log', $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);
|
||||
} catch (\moodle_exception $ex) {
|
||||
debugging("error converting legacy event data " . $ex->getMessage() . $ex->debuginfo, DEBUG_DEVELOPER);
|
||||
return array();
|
||||
}
|
||||
|
||||
$events = array();
|
||||
|
||||
foreach ($records as $data) {
|
||||
$events[$data->id] = \logstore_legacy\event\legacy_logged::restore_legacy($data);
|
||||
}
|
||||
|
||||
$records->close();
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,26 @@ class cleanup_task extends \core\task\scheduled_task {
|
||||
public function execute() {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Delete old logs to save space (this might need a timer to slow it down...).
|
||||
if (!empty($CFG->loglifetime)) { // Value in days.
|
||||
$loglifetime = time(0) - ($CFG->loglifetime * 3600 * 24);
|
||||
$DB->delete_records_select("log", "time < ?", array($loglifetime));
|
||||
mtrace(" Deleted old legacy log records");
|
||||
if (empty($CFG->loglifetime)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$loglifetime = time() - ($CFG->loglifetime * 3600 * 24); // Value in days.
|
||||
$lifetimep = array($loglifetime);
|
||||
$start = time();
|
||||
|
||||
while ($min = $DB->get_field_select("log", "MIN(time)", "time < ?", $lifetimep)) {
|
||||
// Break this down into chunks to avoid transaction for too long and generally thrashing database.
|
||||
// Experiments suggest deleting one day takes up to a few seconds; probably a reasonable chunk size usually.
|
||||
// If the cleanup has just been enabled, it might take e.g a month to clean the years of logs.
|
||||
$params = array(min($min + 3600 * 24, $loglifetime));
|
||||
$DB->delete_records_select("log", "time < ?", $params);
|
||||
if (time() > $start + 300) {
|
||||
// Do not churn on log deletion for too long each run.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mtrace(" Deleted old legacy log records");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,4 +273,33 @@ class logstore_legacy_store_testcase extends advanced_testcase {
|
||||
$this->assertContains($expectedreport, $reports);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the legacy log cleanup works correctly.
|
||||
*/
|
||||
public function test_cleanup_task() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create some records spread over various days; test multiple iterations in cleanup.
|
||||
$record = (object) array('time' => time());
|
||||
$DB->insert_record('log', $record);
|
||||
$record->time -= 3600 * 24 * 30;
|
||||
$DB->insert_record('log', $record);
|
||||
$record->time -= 3600 * 24 * 30;
|
||||
$DB->insert_record('log', $record);
|
||||
$record->time -= 3600 * 24 * 30;
|
||||
$DB->insert_record('log', $record);
|
||||
$this->assertEquals(4, $DB->count_records('log'));
|
||||
|
||||
// Remove all logs before "today".
|
||||
set_config('loglifetime', 1);
|
||||
|
||||
$this->expectOutputString(" Deleted old legacy log records\n");
|
||||
$clean = new \logstore_legacy\task\cleanup_task();
|
||||
$clean->execute();
|
||||
|
||||
$this->assertEquals(1, $DB->count_records('log'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class store implements \tool_log\log\writer, \core\log\sql_internal_reader {
|
||||
$sort = self::tweak_sort_by_id($sort);
|
||||
|
||||
$events = array();
|
||||
$records = $DB->get_records_select('logstore_standard_log', $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);
|
||||
$records = $DB->get_recordset_select('logstore_standard_log', $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);
|
||||
|
||||
foreach ($records as $data) {
|
||||
$extra = array('origin' => $data->origin, 'ip' => $data->ip, 'realuserid' => $data->realuserid);
|
||||
@@ -94,6 +94,8 @@ class store implements \tool_log\log\writer, \core\log\sql_internal_reader {
|
||||
}
|
||||
}
|
||||
|
||||
$records->close();
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,12 +43,29 @@ class cleanup_task extends \core\task\scheduled_task {
|
||||
*/
|
||||
public function execute() {
|
||||
global $DB;
|
||||
|
||||
$loglifetime = (int)get_config('logstore_standard', 'loglifetime');
|
||||
|
||||
if ($loglifetime > 0) {
|
||||
$loglifetime = time() - ($loglifetime * 3600 * 24); // Value in days.
|
||||
$DB->delete_records_select("logstore_standard_log", "timecreated < ?", array($loglifetime));
|
||||
mtrace(" Deleted old log records from standard store.");
|
||||
if (empty($loglifetime) || $loglifetime < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$loglifetime = time() - ($loglifetime * 3600 * 24); // Value in days.
|
||||
$lifetimep = array($loglifetime);
|
||||
$start = time();
|
||||
|
||||
while ($min = $DB->get_field_select("logstore_standard_log", "MIN(timecreated)", "timecreated < ?", $lifetimep)) {
|
||||
// Break this down into chunks to avoid transaction for too long and generally thrashing database.
|
||||
// Experiments suggest deleting one day takes up to a few seconds; probably a reasonable chunk size usually.
|
||||
// If the cleanup has just been enabled, it might take e.g a month to clean the years of logs.
|
||||
$params = array(min($min + 3600 * 24, $loglifetime));
|
||||
$DB->delete_records_select("logstore_standard_log", "timecreated < ?", $params);
|
||||
if (time() > $start + 300) {
|
||||
// Do not churn on log deletion for too long each run.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mtrace(" Deleted old log records from standard store.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,4 +218,41 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$this->assertContains($expectedreport, $reports);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the standard log cleanup works correctly.
|
||||
*/
|
||||
public function test_cleanup_task() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create some records spread over various days; test multiple iterations in cleanup.
|
||||
$ctx = context_course::instance(1);
|
||||
$record = (object) array(
|
||||
'edulevel' => 0,
|
||||
'contextid' => $ctx->id,
|
||||
'contextlevel' => $ctx->contextlevel,
|
||||
'contextinstanceid' => $ctx->instanceid,
|
||||
'userid' => 1,
|
||||
'timecreated' => time(),
|
||||
);
|
||||
$DB->insert_record('logstore_standard_log', $record);
|
||||
$record->timecreated -= 3600 * 24 * 30;
|
||||
$DB->insert_record('logstore_standard_log', $record);
|
||||
$record->timecreated -= 3600 * 24 * 30;
|
||||
$DB->insert_record('logstore_standard_log', $record);
|
||||
$record->timecreated -= 3600 * 24 * 30;
|
||||
$DB->insert_record('logstore_standard_log', $record);
|
||||
$this->assertEquals(4, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
// Remove all logs before "today".
|
||||
set_config('loglifetime', 1, 'logstore_standard');
|
||||
|
||||
$this->expectOutputString(" Deleted old log records from standard store.\n");
|
||||
$clean = new \logstore_standard\task\cleanup_task();
|
||||
$clean->execute();
|
||||
|
||||
$this->assertEquals(1, $DB->count_records('logstore_standard_log'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,25 +104,29 @@ if ($execute = $options['execute']) {
|
||||
|
||||
$predbqueries = $DB->perf_get_queries();
|
||||
$pretime = microtime(true);
|
||||
|
||||
mtrace("Scheduled task: " . $task->get_name());
|
||||
// NOTE: it would be tricky to move this code to \core\task\manager class,
|
||||
// because we want to do detailed error reporting.
|
||||
$cronlockfactory = \core\lock\lock_config::get_lock_factory('cron');
|
||||
if (!$cronlock = $cronlockfactory->get_lock('core_cron', 10)) {
|
||||
mtrace('Cannot obtain cron lock');
|
||||
exit(129);
|
||||
}
|
||||
if (!$lock = $cronlockfactory->get_lock('\\' . get_class($task), 10)) {
|
||||
$cronlock->release();
|
||||
mtrace('Cannot obtain task lock');
|
||||
exit(130);
|
||||
}
|
||||
|
||||
$task->set_lock($lock);
|
||||
if (!$task->is_blocking()) {
|
||||
$cronlock->release();
|
||||
} else {
|
||||
$task->set_cron_lock($cronlock);
|
||||
}
|
||||
|
||||
try {
|
||||
mtrace("Scheduled task: " . $task->get_name());
|
||||
// NOTE: it would be tricky to move this code to \core\task\manager class,
|
||||
// because we want to do detailed error reporting.
|
||||
$cronlockfactory = \core\lock\lock_config::get_lock_factory('cron');
|
||||
if (!$cronlock = $cronlockfactory->get_lock('core_cron', 10)) {
|
||||
mtrace('Cannot obtain cron lock');
|
||||
exit(129);
|
||||
}
|
||||
if (!$lock = $cronlockfactory->get_lock('\\' . get_class($task), 10)) {
|
||||
mtrace('Cannot obtain task lock');
|
||||
exit(130);
|
||||
}
|
||||
$task->set_lock($lock);
|
||||
if (!$task->is_blocking()) {
|
||||
$cronlock->release();
|
||||
} else {
|
||||
$task->set_cron_lock($cronlock);
|
||||
}
|
||||
get_mailer('buffer');
|
||||
$task->execute();
|
||||
if (isset($predbqueries)) {
|
||||
|
||||
@@ -402,8 +402,14 @@ function uu_pre_process_custom_profile_data($data) {
|
||||
function uu_check_custom_profile_data(&$data) {
|
||||
global $CFG, $DB;
|
||||
$noerror = true;
|
||||
$testuserid = null;
|
||||
|
||||
// find custom profile fields and check if data needs to converted.
|
||||
if (!empty($data['username'])) {
|
||||
if (preg_match('/id=(.*)"/i', $data['username'], $result)) {
|
||||
$testuserid = $result[1];
|
||||
}
|
||||
}
|
||||
// Find custom profile fields and check if data needs to converted.
|
||||
foreach ($data as $key => $value) {
|
||||
if (preg_match('/^profile_field_/', $key)) {
|
||||
$shortname = str_replace('profile_field_', '', $key);
|
||||
@@ -417,9 +423,20 @@ function uu_check_custom_profile_data(&$data) {
|
||||
$data['status'][] = get_string('invaliduserfield', 'error', $shortname);
|
||||
$noerror = false;
|
||||
}
|
||||
// Check for duplicate value.
|
||||
if (method_exists($formfield, 'edit_validate_field') ) {
|
||||
$testuser = new stdClass();
|
||||
$testuser->{$key} = $value;
|
||||
$testuser->id = $testuserid;
|
||||
$err = $formfield->edit_validate_field($testuser);
|
||||
if (!empty($err[$key])) {
|
||||
$data['status'][] = $err[$key].' ('.$key.')';
|
||||
$noerror = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $noerror;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class auth_db_events_testcase extends advanced_testcase {
|
||||
$user = new stdClass();
|
||||
$user->name = 'mark';
|
||||
$user->pass = 'password123';
|
||||
$user->email = 'what@legend.com';
|
||||
$user->email = 'what@example.com';
|
||||
$user->id = $DB->insert_record('auth_db_users', $user);
|
||||
|
||||
// Run sync_users and capture the user_created event.
|
||||
@@ -107,7 +107,7 @@ class auth_db_events_testcase extends advanced_testcase {
|
||||
$user = new stdClass();
|
||||
$user->name = 'mark';
|
||||
$user->pass = 'password123';
|
||||
$user->email = 'what@legend.com';
|
||||
$user->email = 'what@example.com';
|
||||
$user->id = $DB->insert_record('auth_db_users', $user);
|
||||
|
||||
// Set the config to remove the suspension on the user.
|
||||
|
||||
+4
-4
@@ -139,12 +139,12 @@ class auth_plugin_email extends auth_plugin_base {
|
||||
$user = get_complete_user_data('username', $username);
|
||||
|
||||
if (!empty($user)) {
|
||||
if ($user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
|
||||
} else if ($user->auth != $this->authtype) {
|
||||
if ($user->auth != $this->authtype) {
|
||||
return AUTH_CONFIRM_ERROR;
|
||||
|
||||
} else if ($user->secret == $confirmsecret && $user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
|
||||
} else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in
|
||||
$DB->set_field("user", "confirmed", 1, array("id"=>$user->id));
|
||||
if ($user->firstaccess == 0) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
$string['auth_emaildescription'] = '<p>Email-based self-registration enables a user to create their own account via a \'Create new account\' button on the login page. The user then receives an email containing a secure link to a page where they can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.</p><p>Note: In addition to enabling the plugin, email-based self-registration must also be selected from the self registration drop-down menu on the \'Manage authentication\' page.</p>';
|
||||
$string['auth_emailnoemail'] = 'Tried to send you an email but failed!';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://www.google.com/recaptcha/learnmore for more details. <br /><em>PHP cURL extension is required.</em>';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the sign-up page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://www.google.com/recaptcha for more details.';
|
||||
$string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element';
|
||||
$string['auth_emailsettings'] = 'Settings';
|
||||
$string['pluginname'] = 'Email-based self-registration';
|
||||
|
||||
+6
-5
@@ -604,12 +604,12 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$user = get_complete_user_data('username', $username);
|
||||
|
||||
if (!empty($user)) {
|
||||
if ($user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
|
||||
} else if ($user->auth != $this->authtype) {
|
||||
if ($user->auth != $this->authtype) {
|
||||
return AUTH_CONFIRM_ERROR;
|
||||
|
||||
} else if ($user->secret == $confirmsecret && $user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
|
||||
} else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in
|
||||
if (!$this->user_activate($username)) {
|
||||
return AUTH_CONFIRM_FAIL;
|
||||
@@ -1653,7 +1653,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->wwwroot &&
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->wwwroot.'/' &&
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->httpswwwroot.'/login/' &&
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->httpswwwroot.'/login/index.php')
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->httpswwwroot.'/login/index.php' &&
|
||||
clean_param($_SERVER['HTTP_REFERER'], PARAM_LOCALURL) != '')
|
||||
? $_SERVER['HTTP_REFERER'] : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ class auth_ldap_plugin_testcase extends advanced_testcase {
|
||||
'lastnamephonetic' => '最後のお名前のテスト一号',
|
||||
'firstnamephonetic' => 'お名前のテスト一号',
|
||||
'alternatename' => 'Alternate Name User Test 1',
|
||||
'email' => 'usersignuptest1@email.com',
|
||||
'email' => 'usersignuptest1@example.com',
|
||||
'description' => 'This is a description for user 1',
|
||||
'city' => 'Perth',
|
||||
'country' => 'au',
|
||||
|
||||
@@ -16,7 +16,7 @@ Feature: Authentication
|
||||
Scenario: Log in as an existing admin user filling the form
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname | email |
|
||||
| testuser | testuser | Test | User | moodle@moodlemoodle.com |
|
||||
| testuser | testuser | Test | User | moodle@example.com |
|
||||
And I am on homepage
|
||||
When I follow "Log in"
|
||||
And I set the field "Username" to "testuser"
|
||||
@@ -27,7 +27,7 @@ Feature: Authentication
|
||||
Scenario: Log in as an unexisting user filling the form
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname | email |
|
||||
| testuser | testuser | Test | User | moodle@moodlemoodle.com |
|
||||
| testuser | testuser | Test | User | moodle@example.com |
|
||||
And I am on homepage
|
||||
When I follow "Log in"
|
||||
And I set the field "Username" to "testuser"
|
||||
|
||||
@@ -53,8 +53,8 @@ class condition extends \core_availability\condition {
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get cmid.
|
||||
if (isset($structure->cm) && is_int($structure->cm)) {
|
||||
$this->cmid = $structure->cm;
|
||||
if (isset($structure->cm) && is_number($structure->cm)) {
|
||||
$this->cmid = (int)$structure->cm;
|
||||
} else {
|
||||
throw new \coding_exception('Missing or invalid ->cm for completion condition');
|
||||
}
|
||||
|
||||
@@ -16,11 +16,9 @@ Feature: availability_completion
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
| Enable completion tracking | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
| enablecompletion | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
|
||||
@@ -16,10 +16,8 @@ Feature: availability_date
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
|
||||
@@ -10,16 +10,14 @@ Feature: availability_grade
|
||||
| Course 1 | C1 | topics | 1 |
|
||||
And the following "users" exist:
|
||||
| username | email |
|
||||
| teacher1 | t@example.org |
|
||||
| student1 | s@example.org |
|
||||
| teacher1 | t@example.com |
|
||||
| student1 | s@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
@@ -60,8 +58,22 @@ Feature: availability_grade
|
||||
And I set the field "Grade" to "A1"
|
||||
And I click on "min" "checkbox" in the ".availability-item" "css_element"
|
||||
And I set the field "Minimum grade percentage (inclusive)" to "50"
|
||||
And I click on "max" "checkbox" in the ".availability-item" "css_element"
|
||||
And I set the field "Maximum grade percentage (exclusive)" to "80"
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Check if disabling a part of the restriction is get saved.
|
||||
And I open "P3" actions menu
|
||||
And I click on "Edit settings" "link" in the "P3" activity
|
||||
And I expand all fieldsets
|
||||
And I click on "max" "checkbox" in the ".availability-item" "css_element"
|
||||
And I press "Save and return to course"
|
||||
And I open "P3" actions menu
|
||||
And I click on "Edit settings" "link" in the "P3" activity
|
||||
And I expand all fieldsets
|
||||
And the field "Maximum grade percentage (exclusive)" matches value ""
|
||||
And I follow "Course 1"
|
||||
|
||||
# Add a Page with a grade condition for 10%.
|
||||
And I add a "Page" to section "4"
|
||||
And I set the following fields to these values:
|
||||
@@ -103,8 +115,8 @@ Feature: availability_grade
|
||||
# Give the assignment 40%.
|
||||
And I follow "A1"
|
||||
And I follow "View/grade all submissions"
|
||||
# Pick the grade link in the row that has s@example.org in it.
|
||||
And I click on "//a[contains(@href, 'action=grade') and ancestor::tr/td[normalize-space(.) = 's@example.org']]/img" "xpath_element"
|
||||
# Pick the grade link in the row that has s@example.com in it.
|
||||
And I click on "//a[contains(@href, 'action=grade') and ancestor::tr/td[normalize-space(.) = 's@example.com']]/img" "xpath_element"
|
||||
And I set the field "Grade out of 100" to "40"
|
||||
And I click on "Save changes" "button"
|
||||
|
||||
|
||||
+1
@@ -95,6 +95,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
|
||||
root.delegate('click', function() {
|
||||
updateCheckbox(this, true);
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade input[type=checkbox]');
|
||||
|
||||
root.delegate('valuechange', function() {
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n=M.str.availability_grade,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id"><option value="0">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.grades.length;i++){var s=this.grades[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+='</select></span></label> <span class="availability-group"><label><input type="checkbox" name="min"/>'+n.option_min+'</label> <label><span class="accesshide">'+n.label_min+'</span><input type="text" name="minval" title="'+n.label_min+'"/></label>%</span>'+'<span class="availability-group">'+'<label><input type="checkbox" name="max"/>'+n.option_max+'</label> <label><span class="accesshide">'+n.label_max+'</span><input type="text" name="maxval" title="'+n.label_max+'"/></label>%</span>';var o=e.Node.create("<span>"+r+"</span>");t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")&&o.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(o.one("input[name=min]").set("checked",!0),o.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(o.one("input[name=max]").set("checked",!0),o.one("input[name=maxval]").set("value",t.max));var u=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};o.all("input[type=checkbox]").each(u);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var a=e.one("#fitem_id_availabilityconditionsjson");a.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),a.delegate("click",function(){u(this,!0)},".availability_grade input[type=checkbox]"),a.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return o},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n=M.str.availability_grade,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id"><option value="0">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.grades.length;i++){var s=this.grades[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+='</select></span></label> <span class="availability-group"><label><input type="checkbox" name="min"/>'+n.option_min+'</label> <label><span class="accesshide">'+n.label_min+'</span><input type="text" name="minval" title="'+n.label_min+'"/></label>%</span>'+'<span class="availability-group">'+'<label><input type="checkbox" name="max"/>'+n.option_max+'</label> <label><span class="accesshide">'+n.label_max+'</span><input type="text" name="maxval" title="'+n.label_max+'"/></label>%</span>';var o=e.Node.create("<span>"+r+"</span>");t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")&&o.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(o.one("input[name=min]").set("checked",!0),o.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(o.one("input[name=max]").set("checked",!0),o.one("input[name=maxval]").set("value",t.max));var u=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};o.all("input[type=checkbox]").each(u);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var a=e.one("#fitem_id_availabilityconditionsjson");a.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),a.delegate("click",function(){u(this,!0),M.core_availability.form.update()},".availability_grade input[type=checkbox]"),a.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return o},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+1
@@ -95,6 +95,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
|
||||
root.delegate('click', function() {
|
||||
updateCheckbox(this, true);
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade input[type=checkbox]');
|
||||
|
||||
root.delegate('valuechange', function() {
|
||||
|
||||
@@ -93,6 +93,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
|
||||
root.delegate('click', function() {
|
||||
updateCheckbox(this, true);
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade input[type=checkbox]');
|
||||
|
||||
root.delegate('valuechange', function() {
|
||||
|
||||
@@ -16,10 +16,8 @@ Feature: availability_group
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
|
||||
@@ -22,10 +22,8 @@ Feature: availability_grouping
|
||||
And the following "group members" exist:
|
||||
| user | group |
|
||||
| student1 | GI1 |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
|
||||
@@ -10,16 +10,14 @@ Feature: availability_profile
|
||||
| Course 1 | C1 | topics | 1 |
|
||||
And the following "users" exist:
|
||||
| username | email |
|
||||
| teacher1 | t@example.org |
|
||||
| student1 | s@example.org |
|
||||
| teacher1 | t@example.com |
|
||||
| student1 | s@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
@@ -38,7 +36,7 @@ Feature: availability_profile
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "User profile" "button"
|
||||
And I set the field "User profile field" to "Email address"
|
||||
And I set the field "Value to compare against" to "s@example.org"
|
||||
And I set the field "Value to compare against" to "s@example.com"
|
||||
And I click on ".availability-item .availability-eye img" "css_element"
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
@@ -52,7 +50,7 @@ Feature: availability_profile
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "User profile" "button"
|
||||
And I set the field "User profile field" to "Email address"
|
||||
And I set the field "Value to compare against" to "q@example.org"
|
||||
And I set the field "Value to compare against" to "q@example.com"
|
||||
And I click on ".availability-item .availability-eye img" "css_element"
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
@@ -78,7 +76,7 @@ Feature: availability_profile
|
||||
|
||||
# Set field value for user.
|
||||
And I navigate to "Browse list of users" node in "Site administration > Users > Accounts"
|
||||
And I click on "a[title=Edit]" "css_element" in the "s@example.org" "table_row"
|
||||
And I click on "a[title=Edit]" "css_element" in the "s@example.com" "table_row"
|
||||
And I expand all fieldsets
|
||||
And I set the field "Super field" to "Bananaman"
|
||||
And I click on "Update profile" "button"
|
||||
|
||||
@@ -34,10 +34,8 @@ Feature: display_availability
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Activity availability display
|
||||
@@ -76,7 +74,7 @@ Feature: display_availability
|
||||
And I press "Add restriction..."
|
||||
And I click on "User profile" "button" in the "Add restriction..." "dialogue"
|
||||
And I set the field "User profile field" to "Email address"
|
||||
And I set the field "Value to compare against" to "email@example.org"
|
||||
And I set the field "Value to compare against" to "email@example.com"
|
||||
And I set the field "Method of comparison" to "is equal to"
|
||||
And I press "Save and return to course"
|
||||
|
||||
|
||||
@@ -39,15 +39,10 @@ Feature: edit_availability
|
||||
When I edit the section "1"
|
||||
Then "Restrict access" "fieldset" should not exist
|
||||
|
||||
When I log out
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
|
||||
When I log out
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
Then "Restrict access" "fieldset" should exist
|
||||
|
||||
@@ -58,10 +53,8 @@ Feature: edit_availability
|
||||
@javascript
|
||||
Scenario: Edit availability using settings in activity form
|
||||
# Set up.
|
||||
Given I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
Given the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
|
||||
@@ -153,10 +146,8 @@ Feature: edit_availability
|
||||
@javascript
|
||||
Scenario: Edit availability using settings in section form
|
||||
# Set up.
|
||||
Given I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
Given the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
@@ -172,3 +163,4 @@ Feature: edit_availability
|
||||
And I should not see "None" in the "Restrict access" "fieldset"
|
||||
And "Restriction type" "select" should be visible
|
||||
And I should see "Date" in the "Restrict access" "fieldset"
|
||||
|
||||
|
||||
+3
-3
@@ -299,7 +299,7 @@
|
||||
<IDNUMBER>891220979</IDNUMBER>
|
||||
<FIRSTNAME>Admin</FIRSTNAME>
|
||||
<LASTNAME>User</LASTNAME>
|
||||
<EMAIL>adamzap@gmail.com</EMAIL>
|
||||
<EMAIL>adamzap@example.com</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
@@ -368,7 +368,7 @@
|
||||
<IDNUMBER>891111111</IDNUMBER>
|
||||
<FIRSTNAME>Adam</FIRSTNAME>
|
||||
<LASTNAME>Zapletal</LASTNAME>
|
||||
<EMAIL>azaple1@lsu.edu</EMAIL>
|
||||
<EMAIL>azaple1@example.com</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
@@ -481,7 +481,7 @@
|
||||
<IDNUMBER></IDNUMBER>
|
||||
<FIRSTNAME>Philip</FIRSTNAME>
|
||||
<LASTNAME>Cali</LASTNAME>
|
||||
<EMAIL>pcali1@lsu.edu</EMAIL>
|
||||
<EMAIL>pcali1@example.com</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
|
||||
@@ -516,7 +516,7 @@ class backup_enrolments_structure_step extends backup_structure_step {
|
||||
|
||||
$enrol = new backup_nested_element('enrol', array('id'), array(
|
||||
'enrol', 'status', 'name', 'enrolperiod', 'enrolstartdate',
|
||||
'enrolenddate', 'expirynotify', 'expirytreshold', 'notifyall',
|
||||
'enrolenddate', 'expirynotify', 'expirythreshold', 'notifyall',
|
||||
'password', 'cost', 'currency', 'roleid',
|
||||
'customint1', 'customint2', 'customint3', 'customint4', 'customint5', 'customint6', 'customint7', 'customint8',
|
||||
'customchar1', 'customchar2', 'customchar3',
|
||||
|
||||
@@ -1386,13 +1386,31 @@ class restore_section_structure_step extends restore_structure_step {
|
||||
|
||||
public function process_course_format_options($data) {
|
||||
global $DB;
|
||||
$data = (object)$data;
|
||||
$oldid = $data->id;
|
||||
unset($data->id);
|
||||
$data->sectionid = $this->task->get_sectionid();
|
||||
$data->courseid = $this->get_courseid();
|
||||
$newid = $DB->insert_record('course_format_options', $data);
|
||||
$this->set_mapping('course_format_options', $oldid, $newid);
|
||||
static $courseformats = array();
|
||||
$courseid = $this->get_courseid();
|
||||
if (!array_key_exists($courseid, $courseformats)) {
|
||||
// It is safe to have a static cache of course formats because format can not be changed after this point.
|
||||
$courseformats[$courseid] = $DB->get_field('course', 'format', array('id' => $courseid));
|
||||
}
|
||||
$data = (array)$data;
|
||||
if ($courseformats[$courseid] === $data['format']) {
|
||||
// Import section format options only if both courses (the one that was backed up
|
||||
// and the one we are restoring into) have same formats.
|
||||
$params = array(
|
||||
'courseid' => $this->get_courseid(),
|
||||
'sectionid' => $this->task->get_sectionid(),
|
||||
'format' => $data['format'],
|
||||
'name' => $data['name']
|
||||
);
|
||||
if ($record = $DB->get_record('course_format_options', $params, 'id, value')) {
|
||||
// Do not overwrite existing information.
|
||||
$newid = $record->id;
|
||||
} else {
|
||||
$params['value'] = $data['value'];
|
||||
$newid = $DB->insert_record('course_format_options', $params);
|
||||
}
|
||||
$this->set_mapping('course_format_options', $data['id'], $newid);
|
||||
}
|
||||
}
|
||||
|
||||
protected function after_execute() {
|
||||
@@ -2901,11 +2919,6 @@ class restore_activity_grades_structure_step extends restore_structure_step {
|
||||
$oldparentid = $data->categoryid;
|
||||
$courseid = $this->get_courseid();
|
||||
|
||||
// make sure top course category exists, all grade items will be associated
|
||||
// to it. Later, if restoring the whole gradebook, categories will be introduced
|
||||
$coursecat = grade_category::fetch_course_category($courseid);
|
||||
$coursecatid = $coursecat->id; // Get the categoryid to be used
|
||||
|
||||
$idnumber = null;
|
||||
if (!empty($data->idnumber)) {
|
||||
// Don't get any idnumber from course module. Keep them as they are in grade_item->idnumber
|
||||
@@ -2930,8 +2943,18 @@ class restore_activity_grades_structure_step extends restore_structure_step {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data->categoryid)) {
|
||||
// If the grade category id of the grade item being restored belongs to this course
|
||||
// then it is a fair assumption that this is the correct grade category for the activity
|
||||
// and we should leave it in place, if not then unset it.
|
||||
// TODO MDL-34790 Gradebook does not import if target course has gradebook categories.
|
||||
$conditions = array('id' => $data->categoryid, 'courseid' => $courseid);
|
||||
if (!$this->task->is_samesite() || !$DB->record_exists('grade_categories', $conditions)) {
|
||||
unset($data->categoryid);
|
||||
}
|
||||
}
|
||||
|
||||
unset($data->id);
|
||||
$data->categoryid = $coursecatid;
|
||||
$data->courseid = $this->get_courseid();
|
||||
$data->iteminstance = $this->task->get_activityid();
|
||||
$data->idnumber = $idnumber;
|
||||
@@ -3688,6 +3711,11 @@ class restore_create_categories_and_questions extends restore_structure_step {
|
||||
|
||||
$data = (object)$data;
|
||||
$newquestion = $this->get_new_parentid('question');
|
||||
$questioncreated = (bool) $this->get_mappingid('question_created', $this->get_old_parentid('question'));
|
||||
if (!$questioncreated) {
|
||||
// This question already exists in the question bank. Nothing for us to do.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($CFG->usetags)) { // if enabled in server
|
||||
// TODO: This is highly inefficient. Each time we add one tag
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Tests for Moodle 2 format backup operation.
|
||||
*
|
||||
* @package core_backup
|
||||
* @copyright 2014 Russell Smith
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
|
||||
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
|
||||
require_once($CFG->dirroot . '/course/format/topics/lib.php');
|
||||
require_once($CFG->libdir . '/completionlib.php');
|
||||
|
||||
/**
|
||||
* Tests for Moodle 2 course format section_options backup operation.
|
||||
*
|
||||
* @package core_backup
|
||||
* @copyright 2014 Russell Smith
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_backup_moodle2_course_format_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tidy up open files that may be left open.
|
||||
*/
|
||||
protected function tearDown() {
|
||||
gc_collect_cycles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests a backup and restore adds the required section option data
|
||||
* when the same course format is used.
|
||||
*/
|
||||
public function test_course_format_options_restore() {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$CFG->enableavailability = true;
|
||||
$CFG->enablecompletion = true;
|
||||
|
||||
// Create a course with some availability data set.
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course(
|
||||
array('format' => 'test_cs_options', 'numsections' => 3,
|
||||
'enablecompletion' => COMPLETION_ENABLED),
|
||||
array('createsections' => true));
|
||||
|
||||
$courseobject = format_base::instance($course->id);
|
||||
$section = $DB->get_record('course_sections',
|
||||
array('course' => $course->id, 'section' => 1), '*', MUST_EXIST);
|
||||
$data = array('id' => $section->id,
|
||||
'numdaystocomplete' => 2);
|
||||
$courseobject->update_section_format_options($data);
|
||||
// Backup and restore it.
|
||||
$this->backup_and_restore($course);
|
||||
|
||||
$sectionoptions = $courseobject->get_format_options(1);
|
||||
$this->assertArrayHasKey('numdaystocomplete', $sectionoptions);
|
||||
$this->assertEquals(2, $sectionoptions['numdaystocomplete']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests an import into the same subject successfully
|
||||
* restores the options without error.
|
||||
*/
|
||||
public function test_course_format_options_import_myself() {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$CFG->enableavailability = true;
|
||||
$CFG->enablecompletion = true;
|
||||
|
||||
// Create a course with some availability data set.
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course(
|
||||
array('format' => 'test_cs_options', 'numsections' => 3,
|
||||
'enablecompletion' => COMPLETION_ENABLED),
|
||||
array('createsections' => true));
|
||||
|
||||
$courseobject = format_base::instance($course->id);
|
||||
$section = $DB->get_record('course_sections',
|
||||
array('course' => $course->id, 'section' => 1), '*', MUST_EXIST);
|
||||
$data = array('id' => $section->id,
|
||||
'numdaystocomplete' => 2);
|
||||
$courseobject->update_section_format_options($data);
|
||||
|
||||
$this->backup_and_restore($course, $course);
|
||||
|
||||
$sectionoptions = $courseobject->get_format_options(1);
|
||||
$this->assertArrayHasKey('numdaystocomplete', $sectionoptions);
|
||||
$this->assertArrayNotHasKey('secondparameter', $sectionoptions);
|
||||
$this->assertEquals(2, $sectionoptions['numdaystocomplete']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that all section options are copied when the course format is changed.
|
||||
* None of the data is copied.
|
||||
*
|
||||
* It is a future enhancement to copy;
|
||||
* 1. Only the relevant options.
|
||||
* 2. Only the data associated with relevant options.
|
||||
*/
|
||||
public function test_course_format_options_restore_new_format() {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$CFG->enableavailability = true;
|
||||
$CFG->enablecompletion = true;
|
||||
|
||||
// Create a course with some availability data set.
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course(
|
||||
array('format' => 'test_cs2_options', 'numsections' => 3,
|
||||
'enablecompletion' => COMPLETION_ENABLED),
|
||||
array('createsections' => true));
|
||||
$newcourse = $generator->create_course(
|
||||
array('format' => 'test_cs_options', 'numsections' => 3,
|
||||
'enablecompletion' => COMPLETION_ENABLED),
|
||||
array('createsections' => true));
|
||||
|
||||
$courseobject = format_base::instance($course->id);
|
||||
$section = $DB->get_record('course_sections',
|
||||
array('course' => $course->id, 'section' => 1), '*', MUST_EXIST);
|
||||
|
||||
$data = array('id' => $section->id,
|
||||
'numdaystocomplete' => 2,
|
||||
'secondparameter' => 8);
|
||||
$courseobject->update_section_format_options($data);
|
||||
// Backup and restore it.
|
||||
$this->backup_and_restore($course, $newcourse);
|
||||
|
||||
$newcourseobject = format_base::instance($newcourse->id);
|
||||
$sectionoptions = $newcourseobject->get_format_options(1);
|
||||
$this->assertArrayHasKey('numdaystocomplete', $sectionoptions);
|
||||
$this->assertArrayHasKey('secondparameter', $sectionoptions);
|
||||
$this->assertEquals(0, $sectionoptions['numdaystocomplete']);
|
||||
$this->assertEquals(0, $sectionoptions['secondparameter']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Backs a course up and restores it.
|
||||
*
|
||||
* @param stdClass $srccourse Course object to backup
|
||||
* @param stdClass $dstcourse Course object to restore into
|
||||
* @return int ID of newly restored course
|
||||
*/
|
||||
protected function backup_and_restore($srccourse, $dstcourse = null) {
|
||||
global $USER, $CFG;
|
||||
|
||||
// Turn off file logging, otherwise it can't delete the file (Windows).
|
||||
$CFG->backup_file_logger_level = backup::LOG_NONE;
|
||||
|
||||
// Do backup with default settings. MODE_IMPORT means it will just
|
||||
// create the directory and not zip it.
|
||||
$bc = new backup_controller(backup::TYPE_1COURSE, $srccourse->id,
|
||||
backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_IMPORT,
|
||||
$USER->id);
|
||||
$backupid = $bc->get_backupid();
|
||||
$bc->execute_plan();
|
||||
$bc->destroy();
|
||||
|
||||
// Do restore to new course with default settings.
|
||||
if ($dstcourse !== null) {
|
||||
$newcourseid = $dstcourse->id;
|
||||
} else {
|
||||
$newcourseid = restore_dbops::create_new_course(
|
||||
$srccourse->fullname, $srccourse->shortname . '_2', $srccourse->category);
|
||||
}
|
||||
$rc = new restore_controller($backupid, $newcourseid,
|
||||
backup::INTERACTIVE_NO, backup::MODE_GENERAL, $USER->id,
|
||||
backup::TARGET_NEW_COURSE);
|
||||
|
||||
$this->assertTrue($rc->execute_precheck());
|
||||
$rc->execute_plan();
|
||||
$rc->destroy();
|
||||
|
||||
return $newcourseid;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class format_test_cs_options
|
||||
*
|
||||
* Test course format that has 1 option.
|
||||
*/
|
||||
class format_test_cs_options extends format_topics {
|
||||
public function section_format_options($foreditform = false) {
|
||||
return array(
|
||||
'numdaystocomplete' => array(
|
||||
'type' => PARAM_INT,
|
||||
'label' => 'Test days',
|
||||
'element_type' => 'text',
|
||||
'default' => 0,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class format_test_cs2_options
|
||||
*
|
||||
* Test course format that has 2 options, 1 inherited.
|
||||
*/
|
||||
class format_test_cs2_options extends format_test_cs_options {
|
||||
public function section_format_options($foreditform = false) {
|
||||
return array(
|
||||
'secondparameter' => array(
|
||||
'type' => PARAM_INT,
|
||||
'label' => 'Test Parmater',
|
||||
'element_type' => 'text',
|
||||
'default' => 0,
|
||||
),
|
||||
) + parent::section_format_options($foreditform);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ Feature: Duplicate activities
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -12,7 +12,7 @@ Feature: Import course's contents into another course
|
||||
| Course 2 | C2 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -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
|
||||
@@ -43,6 +42,22 @@ abstract class grouped_parser_processor extends simplified_parser_processor {
|
||||
protected $groupedpaths; // Paths we are requesting grouped
|
||||
protected $currentdata; // Where we'll be acummulating data
|
||||
|
||||
// We create a array that stores each of the paths in a tree fashion
|
||||
// like the filesystem. Each element stores all the child elements that are
|
||||
// part of a full path that builds the grouped parent path we are storing.
|
||||
// eg Array keys are stored as follows;
|
||||
// root => a => b
|
||||
// => b
|
||||
// => c => d
|
||||
// => e => f.
|
||||
// Grouped paths here are; /a/b, /b, /c/d, /c/e/f.
|
||||
// There are no nested parent paths, that is an enforced rule so
|
||||
// we store an empty array to designate that the particular XML path element
|
||||
// is in fact a grouped path.
|
||||
// eg; $this->groupedparentprefixtree['a']['b'] = array();
|
||||
/** @var array Search tree storing the grouped paths. */
|
||||
protected $groupedparentprefixtree;
|
||||
|
||||
/**
|
||||
* Keep cache of parent directory paths for XML parsing.
|
||||
* @var array
|
||||
@@ -78,6 +93,18 @@ abstract class grouped_parser_processor extends simplified_parser_processor {
|
||||
throw new progressive_parser_exception('xml_grouped_child_found', $a);
|
||||
}
|
||||
$this->groupedpaths[$path] = true;
|
||||
|
||||
// We check earlier in the function if there is a parent that is above the path
|
||||
// to be added so we can be sure no parent exists in the tree.
|
||||
$patharray = explode('/', $path);
|
||||
$currentpos = &$this->groupedparentprefixtree;
|
||||
foreach ($patharray as $item) {
|
||||
if (!isset($currentpos[$item])) {
|
||||
$currentpos[$item] = array();
|
||||
}
|
||||
// Update the current array position using a reference to allow in-place updates to the array.
|
||||
$currentpos = &$currentpos[$item];
|
||||
}
|
||||
}
|
||||
parent::add_path($path);
|
||||
}
|
||||
@@ -162,13 +189,29 @@ abstract class grouped_parser_processor extends simplified_parser_processor {
|
||||
* false if not
|
||||
*/
|
||||
protected function grouped_parent_exists($path) {
|
||||
$parentpath = $this->get_parent_path($path);
|
||||
|
||||
while ($parentpath != '/') {
|
||||
if ($this->path_is_grouped($parentpath)) {
|
||||
return $parentpath;
|
||||
// Search the tree structure to find out if one of the paths
|
||||
// above the $path is a grouped path.
|
||||
$patharray = explode('/', $this->get_parent_path($path));
|
||||
$groupedpath = '';
|
||||
$currentpos = &$this->groupedparentprefixtree;
|
||||
foreach ($patharray as $item) {
|
||||
// When the item isn't set in the array we know
|
||||
// there is no parent grouped path.
|
||||
if (!isset($currentpos[$item])) {
|
||||
return false;
|
||||
}
|
||||
$parentpath = $this->get_parent_path($parentpath);
|
||||
|
||||
// When we aren't at the start of the path, continue to build
|
||||
// a string representation of the path that is traversed. We will
|
||||
// return the grouped path to the caller if we find one.
|
||||
if ($item != '') {
|
||||
$groupedpath .= '/'.$item;
|
||||
}
|
||||
|
||||
if ($currentpos[$item] == array()) {
|
||||
return $groupedpath;
|
||||
}
|
||||
$currentpos = &$currentpos[$item];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class award_criteria_activity extends award_criteria {
|
||||
if (!$mod) {
|
||||
$str = $OUTPUT->error_text(get_string('error:nosuchmod', 'badges'));
|
||||
} else {
|
||||
$str = html_writer::tag('b', '"' . ucfirst($mod->modname) . ' - ' . $mod->name . '"');
|
||||
$str = html_writer::tag('b', '"' . get_string('modulename', $mod->modname) . ' - ' . $mod->name . '"');
|
||||
if (isset($p['bydate'])) {
|
||||
$str .= get_string('criteria_descr_bydate', 'badges', userdate($p['bydate'], get_string('strftimedate', 'core_langconfig')));
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class award_criteria_activity extends award_criteria {
|
||||
}
|
||||
$param = array('id' => $mod->id,
|
||||
'checked' => $checked,
|
||||
'name' => ucfirst($mod->modname) . ' - ' . $mod->name,
|
||||
'name' => get_string('modulename', $mod->modname) . ' - ' . $mod->name,
|
||||
'error' => false
|
||||
);
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ class award_criteria_courseset extends award_criteria {
|
||||
$param = array(
|
||||
'id' => $course->id,
|
||||
'checked' => true,
|
||||
'name' => ucfirst(format_string($course->fullname, true, array('context' => $coursecontext))),
|
||||
'name' => format_string($course->fullname, true, array('context' => $coursecontext)),
|
||||
'error' => false
|
||||
);
|
||||
|
||||
|
||||
@@ -59,13 +59,15 @@ class OpenBadgesBackpackHandler {
|
||||
break;
|
||||
}
|
||||
|
||||
$curl->setHeader(array('Accept: application/json', 'Expect:'));
|
||||
$options = array(
|
||||
'FRESH_CONNECT' => true,
|
||||
'RETURNTRANSFER' => true,
|
||||
'FORBID_REUSE' => true,
|
||||
'HEADER' => 0,
|
||||
'HTTPHEADER' => array('Expect:'),
|
||||
'CONNECTTIMEOUT' => 3,
|
||||
'FRESH_CONNECT' => true,
|
||||
'RETURNTRANSFER' => true,
|
||||
'FORBID_REUSE' => true,
|
||||
'HEADER' => 0,
|
||||
'CONNECTTIMEOUT' => 3,
|
||||
// Follow redirects with the same type of request when sent 301, or 302 redirects.
|
||||
'CURLOPT_POSTREDIR' => 3
|
||||
);
|
||||
|
||||
if ($action == 'user') {
|
||||
|
||||
@@ -14,10 +14,10 @@ Feature: Add badges to the system
|
||||
And I expand "Badges" node
|
||||
And I follow "Badges settings"
|
||||
And I set the field "Default badge issuer name" to "Test Badge Site"
|
||||
And I set the field "Default badge issuer contact details" to "testuser@test-badge-site.com"
|
||||
And I set the field "Default badge issuer contact details" to "testuser@example.com"
|
||||
And I press "Save changes"
|
||||
When I follow "Add a new badge"
|
||||
Then the field "issuercontact" matches value "testuser@test-badge-site.com"
|
||||
Then the field "issuercontact" matches value "testuser@example.com"
|
||||
And the field "issuername" matches value "Test Badge Site"
|
||||
|
||||
@javascript
|
||||
@@ -35,7 +35,7 @@ Feature: Add badges to the system
|
||||
| Name | Test Badge |
|
||||
| Description | Test badge description |
|
||||
| issuername | Test Badge Site |
|
||||
| issuercontact | testuser@test-badge-site.com |
|
||||
| issuercontact | testuser@example.com |
|
||||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||
When I press "Create badge"
|
||||
Then I should see "Edit details"
|
||||
|
||||
@@ -12,7 +12,7 @@ Feature: Award badges
|
||||
| Name | Profile Badge |
|
||||
| Description | Test badge description |
|
||||
| issuername | Test Badge Site |
|
||||
| issuercontact | testuser@test-badge-site.com |
|
||||
| issuercontact | testuser@example.com |
|
||||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||
And I press "Create badge"
|
||||
And I set the field "type" to "Profile completion"
|
||||
@@ -39,8 +39,8 @@ Feature: Award badges
|
||||
Scenario: Award site badge
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher | teacher | 1 | teacher1@asd.com |
|
||||
| student | student | 1 | student1@asd.com |
|
||||
| teacher | teacher | 1 | teacher1@example.com |
|
||||
| student | student | 1 | student1@example.com |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Add a new badge" node in "Site administration > Badges"
|
||||
And I set the following fields to these values:
|
||||
@@ -56,9 +56,9 @@ Feature: Award badges
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "teacher 1 (teacher1@asd.com)"
|
||||
And I set the field "potentialrecipients[]" to "teacher 1 (teacher1@example.com)"
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "student 1 (student1@asd.com)"
|
||||
And I set the field "potentialrecipients[]" to "student 1 (student1@example.com)"
|
||||
And I press "Award badge"
|
||||
When I follow "Site Badge"
|
||||
Then I should see "Recipients (2)"
|
||||
@@ -72,9 +72,9 @@ Feature: Award badges
|
||||
Scenario: Award course badge
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
@@ -100,9 +100,9 @@ Feature: Award badges
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 2 (student2@asd.com)"
|
||||
And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@asd.com)"
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
When I press "Award badge"
|
||||
And I follow "Course Badge"
|
||||
Then I should see "Recipients (2)"
|
||||
@@ -120,16 +120,15 @@ Feature: Award badges
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | Frist | teacher1@asd.com |
|
||||
| student1 | Student | First | student1@asd.com |
|
||||
| teacher1 | Teacher | Frist | teacher1@example.com |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable completion tracking | 1 |
|
||||
And I follow "Home"
|
||||
And the following config values are set as admin:
|
||||
| enablecompletion | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Edit settings"
|
||||
And I set the following fields to these values:
|
||||
@@ -139,8 +138,6 @@ Feature: Award badges
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment name |
|
||||
| Description | Submit your online text |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I click on "//span[text()='Badges']" "xpath_element" in the "Administration" "block"
|
||||
And I follow "Add a new badge"
|
||||
@@ -175,16 +172,15 @@ Feature: Award badges
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | Frist | teacher1@asd.com |
|
||||
| student1 | Student | First | student1@asd.com |
|
||||
| teacher1 | Teacher | Frist | teacher1@example.com |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable completion tracking | 1 |
|
||||
And I follow "Home"
|
||||
And the following config values are set as admin:
|
||||
| enablecompletion | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Edit settings"
|
||||
And I set the following fields to these values:
|
||||
@@ -200,8 +196,6 @@ Feature: Award badges
|
||||
And I click on "Condition: Activity completion" "link"
|
||||
And I set the field "Assign - Test assignment name" to "1"
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I click on "//span[text()='Badges']" "xpath_element" in the "Administration" "block"
|
||||
And I follow "Add a new badge"
|
||||
|
||||
@@ -10,8 +10,8 @@ Feature: Add a comment to the comments block
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | Frist | teacher1@asd.com |
|
||||
| student1 | Student | First | student1@asd.com |
|
||||
| teacher1 | Teacher | Frist | teacher1@example.com |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -11,8 +11,8 @@ Feature: Delete comment block messages
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | First | teacher1@asd.com |
|
||||
| student1 | Student | First | student1@asd.com |
|
||||
| teacher1 | Teacher | First | teacher1@example.com |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -10,8 +10,8 @@ Feature: Course summary block used in a course
|
||||
| Course 1 | C101 | Proved the course summary block works! |0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Sam | Student | student1@asd.com |
|
||||
| teacher1 | Teacher | One | teacher1@asd.com |
|
||||
| student1 | Sam | Student | student1@example.com |
|
||||
| teacher1 | Teacher | One | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C101 | student |
|
||||
|
||||
@@ -10,8 +10,8 @@ Feature: Random glossary entry block is used in a course
|
||||
| Course 1 | C1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Sam1 | Student1 | student1@test.com |
|
||||
| teacher1 | Terry1 | Teacher1 | teacher1@test.com |
|
||||
| student1 | Sam1 | Student1 | student1@example.com |
|
||||
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
|
||||
@@ -7,8 +7,8 @@ Feature: HTML blocks in a course
|
||||
Scenario: Adding HTML block in a course
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Terry1 | Teacher1 | teacher@asd.com |
|
||||
| student1 | Sam1 | Student1 | student1@asd.com |
|
||||
| teacher1 | Terry1 | Teacher1 | teacher@example.com |
|
||||
| student1 | Sam1 | Student1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: Login from a block
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname | email |
|
||||
| testuser | testpass | Test | User | student1@asd.com |
|
||||
| testuser | testpass | Test | User | student1@example.com |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Turn editing on" node in "Front page settings"
|
||||
And I add the "Login" block
|
||||
|
||||
@@ -7,8 +7,8 @@ Feature: Expand the courses nodes within the navigation block
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@local.host |
|
||||
| student1 | Student | 1 | student1@local.host |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber | visible |
|
||||
| cat1 | 0 | cat1 | 1 |
|
||||
@@ -187,4 +187,4 @@ Feature: Expand the courses nodes within the navigation block
|
||||
And navigation node "c1" should not be expandable
|
||||
And navigation node "c2" should be expandable
|
||||
And navigation node "c3" should not be expandable
|
||||
And navigation node "c4" should not be expandable
|
||||
And navigation node "c4" should not be expandable
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: View my courses in navigation block
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| cat1 | 0 | cat1 |
|
||||
@@ -29,13 +29,11 @@ Feature: View my courses in navigation block
|
||||
| student1 | c1 | student |
|
||||
| student1 | c31 | student |
|
||||
| student1 | c331 | student |
|
||||
And I log in as "admin"
|
||||
|
||||
@javascript
|
||||
Scenario: The plain list of enrolled courses is shown
|
||||
Given I set the following administration settings values:
|
||||
| Show my course categories | 0 |
|
||||
And I log out
|
||||
Given the following config values are set as admin:
|
||||
| navshowmycoursecategories | 0 |
|
||||
And I log in as "student1"
|
||||
When I follow "My home"
|
||||
Then I should not see "cat1" in the "Navigation" "block"
|
||||
@@ -49,9 +47,8 @@ Feature: View my courses in navigation block
|
||||
|
||||
@javascript
|
||||
Scenario: The nested list of enrolled courses is shown
|
||||
Given I set the following administration settings values:
|
||||
| Show my course categories | 1 |
|
||||
And I log out
|
||||
Given the following config values are set as admin:
|
||||
| navshowmycoursecategories | 1 |
|
||||
And I log in as "student1"
|
||||
When I follow "My home"
|
||||
Then I should see "cat1" in the "Navigation" "block"
|
||||
@@ -69,10 +66,9 @@ Feature: View my courses in navigation block
|
||||
|
||||
@javascript
|
||||
Scenario: I can expand categories and courses as guest
|
||||
Given I set the following administration settings values:
|
||||
| Show my course categories | 1 |
|
||||
| Show all courses | 1 |
|
||||
And I log out
|
||||
Given the following config values are set as admin:
|
||||
| navshowmycoursecategories | 1 |
|
||||
| navshowallcourses | 1 |
|
||||
And I expand "Courses" node
|
||||
And I should see "cat1" in the "Navigation" "block"
|
||||
And I should see "cat2" in the "Navigation" "block"
|
||||
|
||||
@@ -8,7 +8,7 @@ Feature: Latest news block displays the course latest news
|
||||
Scenario: Latest course news are displayed and can be configured
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And I log in as "admin"
|
||||
And I create a course with:
|
||||
| Course full name | Course 1 |
|
||||
|
||||
@@ -10,7 +10,7 @@ Feature: People Block used in a course
|
||||
| Course 1 | C101 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Sam | Student | student1@asd.com |
|
||||
| student1 | Sam | Student | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C101 | student |
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: People Block used on frontpage
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Sam | Student | student1@asd.com |
|
||||
| student1 | Sam | Student | student1@example.com |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Turn editing on" node in "Front page settings"
|
||||
And I add the "People" block
|
||||
|
||||
@@ -40,7 +40,7 @@ $string['config_show_best'] = 'How many of the highest grades should be shown (0
|
||||
$string['config_show_worst'] = 'How many of the lowest grades should be shown (0 to disable)?';
|
||||
$string['configuredtoshownothing'] = 'This block\'s configuration currently does not allow it to show any results. You may want to either configure it or hide it.';
|
||||
$string['config_use_groups'] = 'Show groups instead of students (only if the quiz supports groups)?';
|
||||
$string['error_emptyquizid'] = 'There is an error right now with this block: you need to select which quiz it should display results from.';
|
||||
$string['error_emptyquizid'] = 'Please configure this block and select which quiz it should display results from.';
|
||||
$string['error_emptyquizrecord'] = 'There is an error right now with this block: the selected quiz does not seem to exist in the database.';
|
||||
$string['error_nogroupsexist'] = 'There is an error right now with this block: it is set to display grades in group mode, but the course has no defined groups.';
|
||||
$string['pluginname'] = 'Quiz results';
|
||||
|
||||
@@ -10,11 +10,11 @@ Feature: View structural changes in recent activity block
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Terry1 | Teacher1 | teacher1@asd.com |
|
||||
| assistant1 | Terry2 | Teacher2 | teacher2@asd.com |
|
||||
| student1 | Sam1 | Student1 | student1@asd.com |
|
||||
| student2 | Sam2 | Student2 | student2@asd.com |
|
||||
| student3 | Sam3 | Student3 | student3@asd.com |
|
||||
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
|
||||
| assistant1 | Terry2 | Teacher2 | teacher2@example.com |
|
||||
| student1 | Sam1 | Student1 | student1@example.com |
|
||||
| student2 | Sam2 | Student2 | student2@example.com |
|
||||
| student3 | Sam3 | Student3 | student3@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@@ -46,10 +46,8 @@ Feature: View structural changes in recent activity block
|
||||
| GG3 | G2 |
|
||||
|
||||
Scenario: Check that Added module information is displayed respecting view capability
|
||||
Given I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable group members only | 1 |
|
||||
And I log out
|
||||
Given the following config values are set as admin:
|
||||
| enablegroupmembersonly | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -7,8 +7,8 @@ Feature: Add blocks
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
|
||||
@@ -10,7 +10,7 @@ Feature: Add and configure blocks throughout the site
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| manager1 | Manager | 1 | manager1@asd.com |
|
||||
| manager1 | Manager | 1 | manager1@example.com |
|
||||
And the following "system role assigns" exist:
|
||||
| user | course | role |
|
||||
| manager1 | Acceptance test site | manager |
|
||||
@@ -36,7 +36,7 @@ Feature: Add and configure blocks throughout the site
|
||||
Scenario: My home does not allow assignation of roles on blocks
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| manager1 | Manager | 1 | manager1@asd.com |
|
||||
| manager1 | Manager | 1 | manager1@example.com |
|
||||
And I log in as "manager1"
|
||||
And I click on "My home" "link" in the "Navigation" "block"
|
||||
When I press "Customise this page"
|
||||
|
||||
@@ -10,7 +10,7 @@ Feature: Block appearances
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | teacher | 1 | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: Allowed blocks controls
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
|
||||
@@ -7,8 +7,8 @@ Feature: Comment on a blog entry
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| testuser | Test | User | moodle@moodlemoodle.com |
|
||||
| testuser2 | Test2 | User2 | moodle2@moodlemoodle.com |
|
||||
| testuser | Test | User | moodle@example.com |
|
||||
| testuser2 | Test2 | User2 | moodle2@example.com |
|
||||
And I log in as "testuser"
|
||||
And I am on homepage
|
||||
And I expand "My profile" node
|
||||
|
||||
+2
-2
@@ -2944,7 +2944,7 @@ function calendar_add_icalendar_event($event, $courseid, $subscriptionid, $timez
|
||||
$name = $event->properties['SUMMARY'][0]->value;
|
||||
$name = str_replace('\n', '<br />', $name);
|
||||
$name = str_replace('\\', '', $name);
|
||||
$name = preg_replace('/\s+/', ' ', $name);
|
||||
$name = preg_replace('/\s+/u', ' ', $name);
|
||||
|
||||
$eventrecord = new stdClass;
|
||||
$eventrecord->name = clean_param($name, PARAM_NOTAGS);
|
||||
@@ -2956,7 +2956,7 @@ function calendar_add_icalendar_event($event, $courseid, $subscriptionid, $timez
|
||||
$description = clean_param($description, PARAM_NOTAGS);
|
||||
$description = str_replace('\n', '<br />', $description);
|
||||
$description = str_replace('\\', '', $description);
|
||||
$description = preg_replace('/\s+/', ' ', $description);
|
||||
$description = preg_replace('/\s+/u', ' ', $description);
|
||||
}
|
||||
$eventrecord->description = $description;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ Feature: Perform basic calendar functionality
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
|
||||
@@ -328,6 +328,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
$paramevents = array ('courseids' => array($course->id), 'groupids' => array($group->id));
|
||||
$events = core_calendar_external::get_calendar_events($paramevents, $options);
|
||||
$events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
|
||||
$this->assertEquals(4, count($events['events'])); // site, user, group, one course event.
|
||||
$this->assertEquals(0, count($events['warnings']));
|
||||
|
||||
@@ -390,6 +391,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
|
||||
array('name' => 'user')
|
||||
);
|
||||
$eventsret = core_calendar_external::create_calendar_events($events);
|
||||
$eventsret = external_api::clean_returnvalue(core_calendar_external::create_calendar_events_returns(), $eventsret);
|
||||
|
||||
// Check to see if things were created properly.
|
||||
$aftercount = $DB->count_records('event');
|
||||
|
||||
@@ -7,10 +7,10 @@ Feature: Add cohorts of users
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | First | User | first@user.com |
|
||||
| user2 | Second | User | second@user.com |
|
||||
| user3 | Third | User | third@user.com |
|
||||
| user4 | Forth | User | forth@user.com |
|
||||
| user1 | First | User | first@example.com |
|
||||
| user2 | Second | User | second@example.com |
|
||||
| user3 | Third | User | third@example.com |
|
||||
| user4 | Forth | User | forth@example.com |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
|
||||
And I press "Add"
|
||||
@@ -31,13 +31,13 @@ Feature: Add cohorts of users
|
||||
|
||||
@javascript
|
||||
Scenario: Add users to a cohort selecting them from the system users list
|
||||
When I add "First User (first@user.com)" user to "333" cohort members
|
||||
And I add "Second User (second@user.com)" user to "333" cohort members
|
||||
When I add "First User (first@example.com)" user to "333" cohort members
|
||||
And I add "Second User (second@example.com)" user to "333" cohort members
|
||||
Then I should see "2" in the "#cohorts" "css_element"
|
||||
And I follow "Assign"
|
||||
And the "Current users" select box should contain "First User (first@user.com)"
|
||||
And the "Current users" select box should contain "Second User (second@user.com)"
|
||||
And the "Current users" select box should not contain "Forth User (forth@user.com)"
|
||||
And the "Current users" select box should contain "First User (first@example.com)"
|
||||
And the "Current users" select box should contain "Second User (second@example.com)"
|
||||
And the "Current users" select box should not contain "Forth User (forth@example.com)"
|
||||
|
||||
@javascript
|
||||
Scenario: Add users to a cohort using a bulk user action
|
||||
@@ -53,6 +53,6 @@ Feature: Add cohorts of users
|
||||
And I follow "Cohorts"
|
||||
Then I should see "2" in the "#cohorts" "css_element"
|
||||
And I follow "Assign"
|
||||
And the "Current users" select box should contain "Third User (third@user.com)"
|
||||
And the "Current users" select box should contain "Forth User (forth@user.com)"
|
||||
And the "Current users" select box should not contain "First User (first@user.com)"
|
||||
And the "Current users" select box should contain "Third User (third@example.com)"
|
||||
And the "Current users" select box should contain "Forth User (forth@example.com)"
|
||||
And the "Current users" select box should not contain "First User (first@example.com)"
|
||||
|
||||
@@ -40,7 +40,7 @@ use Behat\Behat\Context\Step\Given as Given;
|
||||
class behat_cohort extends behat_base {
|
||||
|
||||
/**
|
||||
* Adds the user to the specified cohort. The user should be specified like "Firstname Lastname (user@email.com)".
|
||||
* Adds the user to the specified cohort. The user should be specified like "Firstname Lastname (user@example.com)".
|
||||
*
|
||||
* @Given /^I add "(?P<user_fullname_string>(?:[^"]|\\")*)" user to "(?P<cohort_idnumber_string>(?:[^"]|\\")*)" cohort members$/
|
||||
* @param string $user
|
||||
|
||||
@@ -66,6 +66,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Call the external function.
|
||||
$createdcohorts = core_cohort_external::create_cohorts(array($cohort1, $cohort2));
|
||||
$createdcohorts = external_api::clean_returnvalue(core_cohort_external::create_cohorts_returns(), $createdcohorts);
|
||||
|
||||
// Check we retrieve the good total number of created cohorts + no error on capability.
|
||||
$this->assertEquals(2, count($createdcohorts));
|
||||
@@ -143,6 +144,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
||||
// Call the external function.
|
||||
$returnedcohorts = core_cohort_external::get_cohorts(array(
|
||||
$cohort1->id, $cohort2->id));
|
||||
$returnedcohorts = external_api::clean_returnvalue(core_cohort_external::get_cohorts_returns(), $returnedcohorts);
|
||||
|
||||
// Check we retrieve the good total number of enrolled cohorts + no error on capability.
|
||||
$this->assertEquals(2, count($returnedcohorts));
|
||||
@@ -160,6 +162,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
||||
// Call the external function.
|
||||
$returnedcohorts = core_cohort_external::get_cohorts(array(
|
||||
$cohort1->id, $cohort2->id));
|
||||
$returnedcohorts = external_api::clean_returnvalue(core_cohort_external::get_cohorts_returns(), $returnedcohorts);
|
||||
|
||||
// Check we retrieve the good total number of enrolled cohorts + no error on capability.
|
||||
$this->assertEquals(2, count($returnedcohorts));
|
||||
@@ -345,6 +348,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Call the external function.
|
||||
$addcohortmembers = core_cohort_external::add_cohort_members(array($cohort1));
|
||||
$addcohortmembers = external_api::clean_returnvalue(core_cohort_external::add_cohort_members_returns(), $addcohortmembers);
|
||||
|
||||
// Check we retrieve the good total number of created cohorts + no error on capability.
|
||||
$this->assertEquals(1, count($addcohortmembers));
|
||||
@@ -386,11 +390,14 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
||||
'usertype' => array('type' => 'id', 'value' => $user1->id)
|
||||
);
|
||||
$cohortmembers1 = core_cohort_external::add_cohort_members(array($cohortaddmember1));
|
||||
$cohortmembers1 = external_api::clean_returnvalue(core_cohort_external::add_cohort_members_returns(), $cohortmembers1);
|
||||
|
||||
$cohortaddmember2 = array(
|
||||
'cohorttype' => array('type' => 'id', 'value' => $cohort2->id),
|
||||
'usertype' => array('type' => 'id', 'value' => $user2->id)
|
||||
);
|
||||
$cohortmembers2 = core_cohort_external::add_cohort_members(array($cohortaddmember2));
|
||||
$cohortmembers2 = external_api::clean_returnvalue(core_cohort_external::add_cohort_members_returns(), $cohortmembers2);
|
||||
|
||||
// Check we retrieve no cohorts + no error on capability.
|
||||
$this->assertEquals(2, $DB->count_records_select('cohort_members', ' ((cohortid = :idcohort1 AND userid = :iduser1)
|
||||
|
||||
+1
-1
@@ -656,7 +656,7 @@ class comment {
|
||||
$newcmt->fullname = fullname($USER);
|
||||
$url = new moodle_url('/user/view.php', array('id' => $USER->id, 'course' => $this->courseid));
|
||||
$newcmt->profileurl = $url->out();
|
||||
$newcmt->content = format_text($newcmt->content, $format, array('overflowdiv'=>true));
|
||||
$newcmt->content = format_text($newcmt->content, $newcmt->format, array('overflowdiv'=>true));
|
||||
$newcmt->avatar = $OUTPUT->user_picture($USER, array('size'=>16));
|
||||
|
||||
$commentlist = array($newcmt);
|
||||
|
||||
@@ -11,17 +11,15 @@ Feature: Allow students to manually mark an activity as complete
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | Frist | teacher1@asd.com |
|
||||
| student1 | Student | First | student1@asd.com |
|
||||
| teacher1 | Teacher | Frist | teacher1@example.com |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable completion tracking | 1 |
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enablecompletion | 1 |
|
||||
| enableavailability | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -10,16 +10,14 @@ Feature: Restrict activity availability through date conditions
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | Frist | teacher1@asd.com |
|
||||
| student1 | Student | First | student1@asd.com |
|
||||
| teacher1 | Teacher | Frist | teacher1@example.com |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -11,16 +11,14 @@ Feature: Restrict activity availability through grade conditions
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | Frist | teacher1@asd.com |
|
||||
| student1 | Student | First | student1@asd.com |
|
||||
| teacher1 | Teacher | Frist | teacher1@example.com |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -10,17 +10,15 @@ Feature: Restrict sections availability through completion or grade conditions
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | Frist | teacher1@asd.com |
|
||||
| student1 | Student | First | student1@asd.com |
|
||||
| teacher1 | Teacher | Frist | teacher1@example.com |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable completion tracking | 1 |
|
||||
| Enable conditional access | 1 |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enablecompletion | 1 |
|
||||
| enableavailability | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Show section greyed-out to student when completion condition is not satisfied
|
||||
|
||||
@@ -16,9 +16,9 @@ Feature: Allow teachers to manually mark users as complete when configured
|
||||
| user | course | role |
|
||||
| student1 | CC1 | student |
|
||||
| teacher1 | CC1 | editingteacher |
|
||||
And the following config values are set as admin:
|
||||
| enablecompletion | 1 |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable completion tracking | 1 |
|
||||
And I am on homepage
|
||||
And I follow "Completion course"
|
||||
And completion tracking is "Enabled" in current course
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*",
|
||||
"phpunit/dbUnit": "1.2.*",
|
||||
"moodlehq/behat-extension": "1.27.13"
|
||||
"moodlehq/behat-extension": "1.27.14"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-10
@@ -341,15 +341,6 @@ $CFG->admin = 'admin';
|
||||
// $CFG->forcefirstname = 'Bruce';
|
||||
// $CFG->forcelastname = 'Simpson';
|
||||
//
|
||||
// The following setting will turn SQL Error logging on. This will output an
|
||||
// entry in apache error log indicating the position of the error and the statement
|
||||
// called. This option will action disregarding error_reporting setting.
|
||||
// $CFG->dblogerror = true;
|
||||
//
|
||||
// The following setting will log every database query to a table called adodb_logsql.
|
||||
// Use this setting on a development server only, the table grows quickly!
|
||||
// $CFG->logsql = true;
|
||||
//
|
||||
// The following setting will turn on username logging into Apache log. For full details regarding setting
|
||||
// up of this function please refer to the install section of the document.
|
||||
// $CFG->apacheloguser = 0; // Turn this feature off. Default value.
|
||||
@@ -689,7 +680,7 @@ $CFG->admin = 'admin';
|
||||
// (the basic and behat_* ones) to avoid problems with production environments. This setting can be
|
||||
// used to expand the default white list with an array of extra settings.
|
||||
// Example:
|
||||
// $CFG->behat_extraallowedsettings = array('logsql', 'dblogerror');
|
||||
// $CFG->behat_extraallowedsettings = array('somecoresetting', ...);
|
||||
//
|
||||
// You should explicitly allow the usage of the deprecated behat steps, otherwise an exception will
|
||||
// be thrown when using them. The setting is disabled by default.
|
||||
|
||||
@@ -109,6 +109,11 @@ abstract class format_base {
|
||||
return self::$classesforformat[$format];
|
||||
}
|
||||
|
||||
if (PHPUNIT_TEST && class_exists('format_' . $format)) {
|
||||
// Allow unittests to use non-existing course formats.
|
||||
return $format;
|
||||
}
|
||||
|
||||
// Else return default format
|
||||
$defaultformat = get_config('moodlecourse', 'format');
|
||||
if (!in_array($defaultformat, $plugins)) {
|
||||
@@ -136,7 +141,7 @@ abstract class format_base {
|
||||
if (!isset($classnames[$format])) {
|
||||
$plugins = core_component::get_plugin_list('format');
|
||||
$usedformat = self::get_format_or_default($format);
|
||||
if (file_exists($plugins[$usedformat].'/lib.php')) {
|
||||
if (isset($plugins[$usedformat]) && file_exists($plugins[$usedformat].'/lib.php')) {
|
||||
require_once($plugins[$usedformat].'/lib.php');
|
||||
}
|
||||
$classnames[$format] = 'format_'. $usedformat;
|
||||
@@ -936,7 +941,7 @@ class format_site extends format_base {
|
||||
* @return null|moodle_url
|
||||
*/
|
||||
public function get_view_url($section, $options = array()) {
|
||||
return new moodle_url('/');
|
||||
return new moodle_url('/', array('redirect' => 0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -218,13 +218,14 @@ function edit_module_post_actions($moduleinfo, $course) {
|
||||
}
|
||||
$moduleinfo->gradecat = $grade_category->id;
|
||||
}
|
||||
$gradecategory = $grade_item->get_parent_category();
|
||||
|
||||
foreach ($items as $itemid=>$unused) {
|
||||
$items[$itemid]->set_parent($moduleinfo->gradecat);
|
||||
if ($itemid == $grade_item->id) {
|
||||
// Use updated grade_item.
|
||||
$grade_item = $items[$itemid];
|
||||
}
|
||||
$gradecategory = $grade_item->get_parent_category();
|
||||
if (!empty($moduleinfo->add)) {
|
||||
if (grade_category::aggregation_uses_aggregationcoef($gradecategory->aggregation)) {
|
||||
if ($gradecategory->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) {
|
||||
|
||||
@@ -8,9 +8,9 @@ Feature: Edit completion settings of an activity
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | enablecompletion |
|
||||
| Course 1 | C1 | 1 |
|
||||
And the following config values are set as admin:
|
||||
| enablecompletion | 1 |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable completion tracking | 1 |
|
||||
And I am on homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -8,7 +8,7 @@ Feature: Open the edit menu when a block is docked
|
||||
Scenario: Open the action menu with a block docked
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | weeks |
|
||||
|
||||
@@ -8,7 +8,7 @@ Feature: Toggle activities groups mode from the course page
|
||||
Scenario: Groups mode toggle with javascript enabled
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
|
||||
@@ -8,8 +8,8 @@ Feature: Indent items on the course page
|
||||
Scenario: Indent course items with Javascript enabled
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | weeks |
|
||||
|
||||
@@ -8,8 +8,8 @@ Feature: Toggle activities visibility from the course page
|
||||
Scenario: Hide/Show toggle with javascript enabled
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
@@ -44,7 +44,7 @@ Feature: Toggle activities visibility from the course page
|
||||
Scenario: Activities can be shown and hidden inside a hidden section
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format | numsections |
|
||||
| Course 1 | C1 | topics | 2 |
|
||||
@@ -71,7 +71,7 @@ Feature: Toggle activities visibility from the course page
|
||||
Scenario: Activities can be shown and hidden inside an orphaned section
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format | numsections |
|
||||
| Course 1 | C1 | topics | 2 |
|
||||
|
||||
@@ -7,8 +7,8 @@ Feature: Add activities to courses
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
|
||||
@@ -19,7 +19,7 @@ Feature: Course activity controls works as expected
|
||||
Scenario Outline: General activities course controls using topics and weeks formats, and paged mode and not paged mode works as expected
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format | coursedisplay | numsections |
|
||||
| Course 1 | C1 | <courseformat> | <coursedisplay> | 5 |
|
||||
@@ -99,7 +99,7 @@ Feature: Course activity controls works as expected
|
||||
Scenario Outline: General activities course controls using topics and weeks formats, and paged mode and not paged mode works as expected
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format | coursedisplay | numsections |
|
||||
| Course 1 | C1 | <courseformat> | <coursedisplay> | 5 |
|
||||
|
||||
@@ -8,8 +8,8 @@ Feature: Managers can create courses
|
||||
Scenario: Courses are created with the default forum and blocks
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And I log in as "admin"
|
||||
And I create a course with:
|
||||
| Course full name | Course 1 |
|
||||
|
||||
@@ -8,7 +8,7 @@ Feature: Edit course settings
|
||||
Scenario: Edit course settings
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | summary | format |
|
||||
| Course 1 | C1 | <p>Course summary</p> | topics |
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user