Compare commits
449 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d0649e537 | |||
| b36b735a3b | |||
| 1df212a569 | |||
| 843fcc5fac | |||
| 4d3595e7af | |||
| c68568541f | |||
| dde166ba07 | |||
| 542536418d | |||
| 603ba08d27 | |||
| 0dcab26cd9 | |||
| 26c501f37e | |||
| 545174182a | |||
| 5166e06e08 | |||
| e7e9d4c0b5 | |||
| 2786be9622 | |||
| 27442e8c01 | |||
| 5e2cd4637e | |||
| 2588195fc0 | |||
| 315214fd80 | |||
| 04f5ebb886 | |||
| 08ff55dad7 | |||
| 5c93b9a5ce | |||
| 4f14f2f491 | |||
| 24db354737 | |||
| c0e9e7e0a0 | |||
| 900f974216 | |||
| 61f2bbbf36 | |||
| e5bec10f56 | |||
| 9005f18486 | |||
| 29df554433 | |||
| b31860af40 | |||
| 605cba073c | |||
| 46573be04b | |||
| 6adcb47532 | |||
| 0fc3aba77e | |||
| 29c2971468 | |||
| 1536b56796 | |||
| 26713f79f4 | |||
| 1769ede142 | |||
| e411b59f80 | |||
| 21b902996a | |||
| 9c68807f6c | |||
| c06dc57666 | |||
| e707c69cce | |||
| d39fbc3e06 | |||
| 1d2368318a | |||
| 7dfa47b2dd | |||
| 0c61a163ae | |||
| 0af674082c | |||
| 927a6221aa | |||
| e63627f50e | |||
| 77be0785fd | |||
| 9427e333c7 | |||
| 506fd9545c | |||
| a7ce01cc70 | |||
| de9af122db | |||
| 9b04032e45 | |||
| e42f41b81a | |||
| 5b1b83101e | |||
| 50e53bb6ea | |||
| e025fd2123 | |||
| 4b7b979d39 | |||
| e2180dbc89 | |||
| 7b4ecf6fe2 | |||
| 51134125fc | |||
| 4268f10674 | |||
| 6cbdb4c31c | |||
| 2bbd04781c | |||
| 454d532acb | |||
| b30c0b6b68 | |||
| afb659ff15 | |||
| a7457acc52 | |||
| 34ed4e0e19 | |||
| c7c84089f1 | |||
| 3b9df47dfe | |||
| 79f0d69bca | |||
| 89cd3cfc02 | |||
| b57860bfbb | |||
| 740917fa43 | |||
| 9c5c5e2ee6 | |||
| e88bef20f5 | |||
| 6785483b81 | |||
| 0923ed6bb8 | |||
| 42ee071ab5 | |||
| a22951044f | |||
| bd34549316 | |||
| 3bef945fbe | |||
| 4bd3c5766e | |||
| c6fa627a23 | |||
| 79d8b6f1bd | |||
| f5850997b4 | |||
| df2b12bf1b | |||
| e8d61c6f11 | |||
| 4a1f3cf807 | |||
| c075a898e1 | |||
| f181e3cf70 | |||
| 6ef412801f | |||
| baf42679ab | |||
| 2c0857ba05 | |||
| 781f643d95 | |||
| 520a528943 | |||
| 7e95809a37 | |||
| a3309be840 | |||
| 637b3ff3de | |||
| 22983bd4da | |||
| 3422a9148b | |||
| 231a80c010 | |||
| a6c36884b3 | |||
| 81292696c8 | |||
| 89e5f43109 | |||
| f6ae580fbb | |||
| d8928b4535 | |||
| 23ba40cf63 | |||
| 09d7121146 | |||
| db370772bd | |||
| 47abeb18f6 | |||
| 8890feae27 | |||
| e1fffdbc27 | |||
| f654011e0d | |||
| 9de798de71 | |||
| 4d6d096336 | |||
| 65704ab9b3 | |||
| f3f513ec7b | |||
| f14510d944 | |||
| 4d19341a0a | |||
| 6df5fb575c | |||
| 1eee389afe | |||
| c2a65ab688 | |||
| e02ebdc5fe | |||
| b702e5b44e | |||
| b77027c57d | |||
| 5acfcf8777 | |||
| 201812e592 | |||
| 87562dbe24 | |||
| e5a5962d00 | |||
| e9569a7fa3 | |||
| 76e50ea9e7 | |||
| 8b196aa53e | |||
| f0be1f90da | |||
| 42f9eb4c56 | |||
| d3c4f13490 | |||
| e8e2c512b8 | |||
| 31d8260331 | |||
| 6fd68f6967 | |||
| 11f3ea4f94 | |||
| 07e95f49fc | |||
| 0f7ed737fc | |||
| f821c0a5e2 | |||
| 2321c81d52 | |||
| 94f61491de | |||
| 913493048b | |||
| 8d82a20f4b | |||
| 1ea218b63e | |||
| 75728ebe8d | |||
| af6a891144 | |||
| 2eda090ebe | |||
| a239fdd2a0 | |||
| 5f368c5dd7 | |||
| 37e25a19a8 | |||
| 7a27817f98 | |||
| 6b00083d7f | |||
| 5dc2aeda9a | |||
| 75cb3afa71 | |||
| 4b98e2986c | |||
| d77585c672 | |||
| dd82501911 | |||
| acdf91203c | |||
| 3f48012eb5 | |||
| 31867bb1b4 | |||
| 97baaf9a53 | |||
| becf6318c2 | |||
| c7806282a8 | |||
| 2f8db6a31e | |||
| c26566f21b | |||
| 0ae9094a96 | |||
| 1a1cc84af1 | |||
| 10fed49ab2 | |||
| e57beee8dc | |||
| 2be51b7633 | |||
| 48d02c4437 | |||
| b72615601b | |||
| ac5f2bc552 | |||
| f569989db3 | |||
| af84c619a0 | |||
| ce51586b24 | |||
| b9866e9e71 | |||
| 45a4ebb697 | |||
| 9574aee37c | |||
| 229ffe02dc | |||
| 52f391ceab | |||
| f494350d40 | |||
| ef79f05067 | |||
| 3fc319c0c4 | |||
| 57d9979b43 | |||
| 3cd85bbfae | |||
| 354d0f5e84 | |||
| 42306af15e | |||
| 9ffd2349a2 | |||
| 5efec4d5a3 | |||
| 00a142859b | |||
| 17b7ca5b2b | |||
| e5edbe8ccd | |||
| 258db34bfc | |||
| c3c88e8673 | |||
| be12bb8ab8 | |||
| 8da9781a25 | |||
| 6f3be9d5ce | |||
| 045a69fd3e | |||
| 7bfa58873a | |||
| 889a985b62 | |||
| 5f90019098 | |||
| c5ed804680 | |||
| 72536bd5a8 | |||
| 94ae0b7f7b | |||
| 5d8822ff11 | |||
| ea8ce0c362 | |||
| afbb1b7fb5 | |||
| cd099d041f | |||
| 6e0b2cde30 | |||
| 2c60b80795 | |||
| 6e0c45eab6 | |||
| 71a3196ddf | |||
| 9ec7dbc419 | |||
| b147cea65f | |||
| 0c9a5310f9 | |||
| 67f8fc9419 | |||
| aec0f344de | |||
| baad350a71 | |||
| 3a9570a37a | |||
| 3203027f54 | |||
| f96f84cb19 | |||
| f285d9203f | |||
| 6766dabe82 | |||
| d56e2cd3eb | |||
| 9b7f4e9e8e | |||
| 7b3608625e | |||
| 0a76cd2ca1 | |||
| 36706f5b98 | |||
| ff2b56b538 | |||
| b6a8a31088 | |||
| 3fe3805d79 | |||
| 3ce9798faf | |||
| e0a41273a6 | |||
| 238b87a2fb | |||
| 7ea1dd1580 | |||
| 1a13098682 | |||
| ed961702c6 | |||
| 17da61847f | |||
| 6805a9e11b | |||
| fe785db8db | |||
| b6500c619a | |||
| 62fbaeecbb | |||
| 80e10c2278 | |||
| dcbcc94a51 | |||
| 0ce3aa0562 | |||
| 47dc780e98 | |||
| 471a306b44 | |||
| e52a7a4fe0 | |||
| 5e1a2d2a42 | |||
| 20c506c970 | |||
| c8e6ceb4c4 | |||
| 967451e8ed | |||
| 6098e65822 | |||
| fb1fcfb4f3 | |||
| 39e019735f | |||
| b95cb5e0e5 | |||
| 44b6b2318f | |||
| c89650cd42 | |||
| 3d062e2cdf | |||
| f9465c0974 | |||
| ced9b94a04 | |||
| 55bf30c23c | |||
| c91507f8d5 | |||
| c8d7affbb5 | |||
| 188892a7a8 | |||
| 12ec6228a5 | |||
| b7265c5a4f | |||
| bdff8c070f | |||
| 3b8f30b128 | |||
| f76f70f1b3 | |||
| 7b14fef527 | |||
| cf350bc4f4 | |||
| 99105dabb5 | |||
| 9634c940d4 | |||
| 330f27b3fd | |||
| 48f3c5744d | |||
| 8b913c588a | |||
| 3bf7fdb1e8 | |||
| 6a85db36f5 | |||
| ac4c7623fe | |||
| d0f5f3ad11 | |||
| 8a63956d8d | |||
| 957f81aaa6 | |||
| 9a910e7e8c | |||
| 2135c7e9ed | |||
| 87cafedcc0 | |||
| 5911ac9525 | |||
| 5a6e167a0b | |||
| 771f6902df | |||
| 1626dc7c1f | |||
| 4eb15e3225 | |||
| 1d9bd31e42 | |||
| 4d2bd9a054 | |||
| 34502102b4 | |||
| 95cd5edfab | |||
| c36e94ad98 | |||
| 8225414388 | |||
| 71f3a6c9c0 | |||
| c1ee0772ff | |||
| f5b9fddac4 | |||
| ea76a7cde3 | |||
| 8e99e8c014 | |||
| 131e69e29b | |||
| 9c6cc265da | |||
| 0767770d95 | |||
| 79fcb7446a | |||
| 91f22e1486 | |||
| b2a8d8af06 | |||
| b34f0b369f | |||
| 8163446fee | |||
| a331f6b0d8 | |||
| b3094c4751 | |||
| 2d47619503 | |||
| 1494620bfb | |||
| f1fd291473 | |||
| b20d56c357 | |||
| 9e49655f16 | |||
| 805a4017ab | |||
| 0e69daef28 | |||
| c704f0da1a | |||
| f15c70ab7f | |||
| 26ef0c5c79 | |||
| 7f5df63d6e | |||
| ae1cb40c5e | |||
| 609d5f1826 | |||
| 70b465a75c | |||
| 341af0a779 | |||
| 1e2f25c79c | |||
| 95004c72af | |||
| da83f4d2fc | |||
| 5799fb8640 | |||
| e1c3a4d24f | |||
| c20f9c6678 | |||
| 556ca7fa16 | |||
| 7dfbe69352 | |||
| bc091a045b | |||
| 257ef7c065 | |||
| d8b7b023a6 | |||
| 622a713fa1 | |||
| 7b48139c7a | |||
| 5ef761f4d8 | |||
| 4f865489f0 | |||
| 475a266e31 | |||
| d77412d35f | |||
| 5fee906a30 | |||
| a04076a1f2 | |||
| d0ed5742d0 | |||
| 2ba930d7bb | |||
| 650197e4dc | |||
| 53b48f0116 | |||
| 21f77735fc | |||
| 049838f998 | |||
| 6df1f24a6b | |||
| 1f47d41b03 | |||
| 903ef33978 | |||
| 7d2477a859 | |||
| 054a23264c | |||
| 9e50e8c386 | |||
| 1a52d63ea9 | |||
| 78d40d3e6d | |||
| afaeae1796 | |||
| f518505d71 | |||
| b5c0146072 | |||
| d5b78c7c81 | |||
| 99e0439396 | |||
| 9660b5f471 | |||
| 742671e7c9 | |||
| 81e812c697 | |||
| b984606f45 | |||
| 072a971908 | |||
| 829e7ae8a3 | |||
| df222f7338 | |||
| 8a0eb277db | |||
| 836747b10a | |||
| b638f51bd0 | |||
| 371f4c2e72 | |||
| 787e897899 | |||
| c341626927 | |||
| 86ef5ce6be | |||
| eee6c61ea6 | |||
| 79441b56ba | |||
| c4b9228d18 | |||
| 571f5aba3e | |||
| 8a954a1571 | |||
| 4e9072d20b | |||
| f49ff4b736 | |||
| 52c14af205 | |||
| 087e52eccf | |||
| 26c76fcc0b | |||
| 544a47fc07 | |||
| dfbbb39a25 | |||
| c52766af64 | |||
| 4af0bb82e1 | |||
| c2a9f46692 | |||
| 3398ecbfc2 | |||
| 3ce28cce2e | |||
| 54cbf4279a | |||
| e611797d37 | |||
| db27b57aa5 | |||
| 8d270f56e2 | |||
| 1e25d9306d | |||
| b3b8d045b7 | |||
| ab1c2037fc | |||
| 29aafc0ec7 | |||
| 03ed7684d4 | |||
| 8d1bf87c0e | |||
| ec4e2838cd | |||
| d3bfb8ceac | |||
| 10ce06e159 | |||
| 23cf2f6db3 | |||
| d3a22bc5a8 | |||
| 18937c1577 | |||
| 93c8f9347e | |||
| 26c09bc165 | |||
| 35ce557a91 | |||
| bdccf17907 | |||
| 91557e03ee | |||
| 5b5424a8ee | |||
| 3a5de34b03 | |||
| 6608a30b15 | |||
| bb21b0ad57 | |||
| 8e2349f196 | |||
| c4f051e2e9 | |||
| 691868bdaa | |||
| bc1643135c | |||
| 1910eaf251 | |||
| e3d53b99aa | |||
| d05d5cd4c7 | |||
| 1790647ff9 | |||
| fe51a68590 | |||
| 62ca5c4b91 | |||
| 33952ce027 | |||
| 893ed748bc | |||
| 13c9addc7d | |||
| 0d1c739aeb | |||
| 3ef9d54387 | |||
| 29c62b300c | |||
| b7afb51132 | |||
| d346c55175 |
+3
-1
@@ -137,11 +137,13 @@ before_script:
|
||||
sed -i \
|
||||
-e "s%= 'pgsql'%= 'mysqli'%" \
|
||||
-e "s%= 'username'%= 'travis'%" \
|
||||
-e "s%=> 'utf8mb4_unicode_ci'%=> 'utf8mb4_bin'%" \
|
||||
config.php;
|
||||
|
||||
mysql -u root -e 'SET GLOBAL innodb_file_format=barracuda;' ;
|
||||
mysql -u root -e 'SET GLOBAL innodb_file_per_table=ON;' ;
|
||||
mysql -e 'CREATE DATABASE travis_ci_test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;' ;
|
||||
mysql -u root -e 'SET GLOBAL innodb_large_prefix=ON;' ;
|
||||
mysql -e 'CREATE DATABASE travis_ci_test DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin;' ;
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -64,6 +64,71 @@ if (!empty($options['collation'])) {
|
||||
cli_error("Error: collation '$collation' is not available on this server!");
|
||||
}
|
||||
|
||||
$collationinfo = explode('_', $collation);
|
||||
$charset = reset($collationinfo);
|
||||
|
||||
$engine = strtolower($DB->get_dbengine());
|
||||
|
||||
// Do checks for utf8mb4.
|
||||
if (strpos($collation, 'utf8mb4') === 0) {
|
||||
// Do we have the right engine?
|
||||
if ($engine !== 'innodb' && $engine !== 'xtradb') {
|
||||
cli_error("Error: '$collation' requires InnoDB or XtraDB set as the engine.");
|
||||
}
|
||||
// Are we using Barracuda?
|
||||
if ($DB->get_row_format() != 'Barracuda') {
|
||||
// Try setting it here.
|
||||
try {
|
||||
$DB->execute("SET GLOBAL innodb_file_format=Barracuda");
|
||||
} catch (dml_exception $e) {
|
||||
cli_error("Error: '$collation' requires the file format to be set to Barracuda.
|
||||
An attempt was made to change the format, but it failed. Please try doing this manually.");
|
||||
}
|
||||
echo "GLOBAL SETTING: innodb_file_format changed to Barracuda\n";
|
||||
}
|
||||
// Is one file per table being used?
|
||||
if (!$DB->is_file_per_table_enabled()) {
|
||||
try {
|
||||
$DB->execute("SET GLOBAL innodb_file_per_table=1");
|
||||
} catch (dml_exception $e) {
|
||||
cli_error("Error: '$collation' requires the setting 'innodb_file_per_table' be set to 'ON'.
|
||||
An attempt was made to change the format, but it failed. Please try doing this manually.");
|
||||
}
|
||||
echo "GLOBAL SETTING: innodb_file_per_table changed to 1\n";
|
||||
}
|
||||
// Is large prefix set?
|
||||
if (!$DB->is_large_prefix_enabled()) {
|
||||
try {
|
||||
$DB->execute("SET GLOBAL innodb_large_prefix=1");
|
||||
} catch (dml_exception $e) {
|
||||
cli_error("Error: '$collation' requires the setting 'innodb_large_prefix' be set to 'ON'.
|
||||
An attempt was made to change the format, but it failed. Please try doing this manually.");
|
||||
}
|
||||
echo "GLOBAL SETTING: innodb_large_prefix changed to 1\n";
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SHOW VARIABLES LIKE 'collation_database'";
|
||||
if (!$dbcollation = $DB->get_record_sql($sql)) {
|
||||
cli_error("Error: Could not access collation information on the database.");
|
||||
}
|
||||
$sql = "SHOW VARIABLES LIKE 'character_set_database'";
|
||||
if (!$dbcharset = $DB->get_record_sql($sql)) {
|
||||
cli_error("Error: Could not access character set information on the database.");
|
||||
}
|
||||
if ($dbcollation->value !== $collation || $dbcharset->value !== $charset) {
|
||||
// Try to convert the DB.
|
||||
echo "Converting database to '$collation' for $CFG->wwwroot:\n";
|
||||
$sql = "ALTER DATABASE $CFG->dbname DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation";
|
||||
try {
|
||||
$DB->change_database_structure($sql);
|
||||
} catch (exception $e) {
|
||||
cli_error("Error: Tried to alter the database with no success. Please try manually changing the database
|
||||
to the new collation and character set and then run this script again.");
|
||||
}
|
||||
echo "DATABASE CONVERTED\n";
|
||||
}
|
||||
|
||||
echo "Converting tables and columns to '$collation' for $CFG->wwwroot:\n";
|
||||
$prefix = $DB->get_prefix();
|
||||
$prefix = str_replace('_', '\\_', $prefix);
|
||||
@@ -80,7 +145,7 @@ if (!empty($options['collation'])) {
|
||||
$skipped++;
|
||||
|
||||
} else {
|
||||
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT COLLATE = $collation");
|
||||
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation");
|
||||
echo "CONVERTED\n";
|
||||
$converted++;
|
||||
}
|
||||
@@ -96,18 +161,32 @@ if (!empty($options['collation'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for utf8mb4 collation.
|
||||
$rowformat = $DB->get_row_format_sql($engine, $collation);
|
||||
|
||||
if ($column->type === 'tinytext' or $column->type === 'mediumtext' or $column->type === 'text' or $column->type === 'longtext') {
|
||||
$notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL';
|
||||
$default = (!is_null($column->default) and $column->default !== '') ? "DEFAULT '$column->default'" : '';
|
||||
// primary, unique and inc are not supported for texts
|
||||
$sql = "ALTER TABLE $table->name MODIFY COLUMN $column->field $column->type COLLATE $collation $notnull $default";
|
||||
$sql = "ALTER TABLE $table->name
|
||||
MODIFY COLUMN $column->field $column->type
|
||||
CHARACTER SET $charset
|
||||
COLLATE $collation $notnull $default";
|
||||
$DB->change_database_structure($sql);
|
||||
|
||||
} else if (strpos($column->type, 'varchar') === 0) {
|
||||
$notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL';
|
||||
$default = !is_null($column->default) ? "DEFAULT '$column->default'" : '';
|
||||
// primary, unique and inc are not supported for texts
|
||||
$sql = "ALTER TABLE $table->name MODIFY COLUMN $column->field $column->type COLLATE $collation $notnull $default";
|
||||
|
||||
if ($rowformat != '') {
|
||||
$sql = "ALTER TABLE $table->name $rowformat";
|
||||
$DB->change_database_structure($sql);
|
||||
}
|
||||
|
||||
$sql = "ALTER TABLE $table->name
|
||||
MODIFY COLUMN $column->field $column->type
|
||||
CHARACTER SET $charset
|
||||
COLLATE $collation $notnull $default";
|
||||
$DB->change_database_structure($sql);
|
||||
} else {
|
||||
echo "ERROR (unknown column type: $column->type)\n";
|
||||
@@ -180,7 +259,9 @@ function mysql_get_collations() {
|
||||
global $DB;
|
||||
|
||||
$collations = array();
|
||||
$sql = "SHOW COLLATION WHERE Collation LIKE 'utf8\_%' AND Charset = 'utf8'";
|
||||
$sql = "SHOW COLLATION
|
||||
WHERE Collation LIKE 'utf8\_%' AND Charset = 'utf8'
|
||||
OR Collation LIKE 'utf8mb4\_%' AND Charset = 'utf8mb4'";
|
||||
$rs = $DB->get_recordset_sql($sql);
|
||||
foreach ($rs as $collation) {
|
||||
$collations[$collation->collation] = $collation->collation;
|
||||
|
||||
@@ -47,6 +47,7 @@ switch ($action) {
|
||||
// remove from enabled list
|
||||
$key = array_search($editor, $active_editors);
|
||||
unset($active_editors[$key]);
|
||||
add_to_config_log('editor_visibility', '1', '0', $editor);
|
||||
break;
|
||||
|
||||
case 'enable':
|
||||
@@ -54,6 +55,7 @@ switch ($action) {
|
||||
if (!in_array($editor, $active_editors)) {
|
||||
$active_editors[] = $editor;
|
||||
$active_editors = array_unique($active_editors);
|
||||
add_to_config_log('editor_visibility', '0', '1', $editor);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -66,6 +68,7 @@ switch ($action) {
|
||||
$fsave = $active_editors[$key];
|
||||
$active_editors[$key] = $active_editors[$key + 1];
|
||||
$active_editors[$key + 1] = $fsave;
|
||||
add_to_config_log('editor_position', $key, $key + 1, $editor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -79,6 +82,7 @@ switch ($action) {
|
||||
$fsave = $active_editors[$key];
|
||||
$active_editors[$key] = $active_editors[$key - 1];
|
||||
$active_editors[$key - 1] = $fsave;
|
||||
add_to_config_log('editor_position', $key, $key - 1, $editor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1723,6 +1723,21 @@
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.2" requires="2.7">
|
||||
@@ -1873,6 +1888,197 @@
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.3" requires="2.7">
|
||||
<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.3" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.6.5" 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="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="opensslrequired" />
|
||||
</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="xmlreader" 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_EXTENSION name="fileinfo" 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_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ishttpswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="incompleteunicodesupport" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -421,12 +421,12 @@ class site_registration_form extends moodleform {
|
||||
$mform->addElement('checkbox', 'badges', '',
|
||||
" " . get_string('badgesnumber', 'hub', $badges));
|
||||
$mform->setDefault('badges', $badgesnumber != -1);
|
||||
$mform->setType('resources', PARAM_INT);
|
||||
$mform->setType('badges', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'issuedbadges', '',
|
||||
" " . get_string('issuedbadgesnumber', 'hub', $issuedbadges));
|
||||
$mform->setDefault('issuedbadges', $issuedbadgesnumber != -1);
|
||||
$mform->setType('resources', PARAM_INT);
|
||||
$mform->setType('issuedbadges', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'participantnumberaverage', '',
|
||||
" " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
|
||||
|
||||
+1
-1
@@ -1598,7 +1598,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$row = new html_table_row();
|
||||
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
|
||||
|
||||
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
|
||||
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name, null)) {
|
||||
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'icon pluginicon'));
|
||||
} else {
|
||||
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
@tool @tool_behat
|
||||
Feature: Backported behat step definitions
|
||||
In order to provide feature file compatibility between multiple Moodle versions
|
||||
As a developer
|
||||
I need to be able to use backported steps from newer Moodle versiosn
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C101 | topics |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C101 | student |
|
||||
| teacher1 | C101 | editingteacher |
|
||||
|
||||
Scenario: I am on the course homepage
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I should see "Topic 1"
|
||||
|
||||
@javascript
|
||||
Scenario: I am on the course homepage with JS
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I should see "Topic 1"
|
||||
|
||||
Scenario: I am on the course homepage with editing
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
Then I should see "Topic 1"
|
||||
And I should see "Add an activity or resource"
|
||||
|
||||
@javascript
|
||||
Scenario: I am on the course homepage with editing and JS
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
Then I should see "Topic 1"
|
||||
And I should see "Add an activity or resource"
|
||||
@@ -7,8 +7,7 @@ Feature: Forms manipulation
|
||||
@javascript
|
||||
Scenario: Basic forms manipulation
|
||||
Given I log in as "admin"
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
And I open my profile in edit mode
|
||||
When I set the field "First name" to "Field value"
|
||||
And I set the field "Select a country" to "Japan"
|
||||
And I set the field "Unmask" to "1"
|
||||
|
||||
@@ -10,8 +10,7 @@ Feature: Transform steps arguments
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
And I open my profile in edit mode
|
||||
|
||||
Scenario: Use nasty strings on steps arguments
|
||||
When I set the field "Surname" to "$NASTYSTRING1"
|
||||
|
||||
@@ -99,7 +99,7 @@ class competency extends persistent {
|
||||
// Description.
|
||||
$mform->addElement('editor', 'description',
|
||||
get_string('description', 'tool_lp'), array('rows' => 4));
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
$mform->setType('description', PARAM_CLEANHTML);
|
||||
// ID number.
|
||||
$mform->addElement('text', 'idnumber', get_string('idnumber', 'tool_lp'), 'maxlength="100"');
|
||||
$mform->setType('idnumber', PARAM_RAW);
|
||||
|
||||
@@ -62,7 +62,7 @@ class competency_framework extends persistent {
|
||||
// Description.
|
||||
$mform->addElement('editor', 'description',
|
||||
get_string('description', 'tool_lp'), array('rows' => 4));
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
$mform->setType('description', PARAM_CLEANHTML);
|
||||
// ID number.
|
||||
$mform->addElement('text', 'idnumber', get_string('idnumber', 'tool_lp'), 'maxlength="100"');
|
||||
$mform->setType('idnumber', PARAM_RAW);
|
||||
|
||||
@@ -184,8 +184,14 @@ abstract class persistent extends moodleform {
|
||||
$data = $this->get_persistent()->to_record();
|
||||
$class = static::$persistentclass;
|
||||
$properties = $class::get_formatted_properties();
|
||||
$allproperties = $class::properties_definition();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
// Clean data if it is to be displayed in a form.
|
||||
if (isset($allproperties[$field]['type'])) {
|
||||
$data->$field = clean_param($data->$field, $allproperties[$field]['type']);
|
||||
}
|
||||
|
||||
// Convert formatted properties.
|
||||
if (isset($properties[$field])) {
|
||||
$data->$field = array(
|
||||
|
||||
@@ -59,7 +59,7 @@ class plan extends persistent {
|
||||
$mform->addRule('name', get_string('maximumchars', '', 100), 'maxlength', 100, 'client');
|
||||
// Description.
|
||||
$mform->addElement('editor', 'description', get_string('plandescription', 'tool_lp'), array('rows' => 4));
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
$mform->setType('description', PARAM_CLEANHTML);
|
||||
|
||||
$mform->addElement('date_time_selector', 'duedate', get_string('duedate', 'tool_lp'), array('optional' => true));
|
||||
$mform->addHelpButton('duedate', 'duedate', 'tool_lp');
|
||||
|
||||
@@ -58,7 +58,7 @@ class template extends persistent {
|
||||
// Description.
|
||||
$mform->addElement('editor', 'description',
|
||||
get_string('description', 'tool_lp'), array('rows' => 4));
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
$mform->setType('description', PARAM_CLEANHTML);
|
||||
$mform->addElement('selectyesno', 'visible',
|
||||
get_string('visible', 'tool_lp'));
|
||||
$mform->addElement('date_time_selector',
|
||||
|
||||
@@ -54,7 +54,7 @@ class user_evidence extends persistent {
|
||||
$mform->addRule('name', get_string('maximumchars', '', 100), 'maxlength', 100, 'client');
|
||||
// Description.
|
||||
$mform->addElement('editor', 'description', get_string('userevidencedescription', 'tool_lp'), array('rows' => 10));
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
$mform->setType('description', PARAM_CLEANHTML);
|
||||
|
||||
$mform->addElement('url', 'url', get_string('userevidenceurl', 'tool_lp'), array(), array('usefilepicker' => false));
|
||||
$mform->setType('url', PARAM_RAW_TRIMMED); // Can not use PARAM_URL, it silently converts bad URLs to ''.
|
||||
|
||||
@@ -92,7 +92,7 @@ require(['core/str'], function(Str) {
|
||||
{ key: 'comments', component: 'moodle' },
|
||||
{ key: 'commentscount', component: 'moodle' },
|
||||
{ key: 'commentsrequirelogin', component: 'moodle' },
|
||||
{ key: 'deletecomment', component: 'moodle' },
|
||||
{ key: 'deletecommentbyon', component: 'moodle' },
|
||||
]).then(function() {
|
||||
// Kick off when strings are loaded.
|
||||
Y.use('core_comment', function(Y) {
|
||||
|
||||
@@ -45,6 +45,13 @@ class api {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
// Check if we can return this from cache.
|
||||
$cache = \cache::make('tool_mobile', 'plugininfo');
|
||||
$pluginsinfo = $cache->get('mobileplugins');
|
||||
if ($pluginsinfo !== false) {
|
||||
return (array)$pluginsinfo;
|
||||
}
|
||||
|
||||
$pluginsinfo = [];
|
||||
$plugintypes = core_component::get_plugin_types();
|
||||
|
||||
@@ -56,7 +63,7 @@ class api {
|
||||
$component = $plugintype . '_' . $plugin;
|
||||
$version = get_component_version($component);
|
||||
|
||||
require_once("$path/db/mobile.php");
|
||||
require("$path/db/mobile.php");
|
||||
foreach ($addons as $addonname => $addoninfo) {
|
||||
$plugininfo = array(
|
||||
'component' => $component,
|
||||
@@ -69,7 +76,7 @@ class api {
|
||||
);
|
||||
|
||||
// All the mobile packages must be under the plugin mobile directory.
|
||||
$package = $path . DIRECTORY_SEPARATOR . 'mobile' . DIRECTORY_SEPARATOR . $addonname . '.zip';
|
||||
$package = $path . '/mobile/' . $addonname . '.zip';
|
||||
if (file_exists($package)) {
|
||||
$plugininfo['fileurl'] = $CFG->wwwroot . '' . str_replace($CFG->dirroot, '', $package);
|
||||
$plugininfo['filehash'] = sha1_file($package);
|
||||
@@ -79,6 +86,9 @@ class api {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cache->set('mobileplugins', $pluginsinfo);
|
||||
|
||||
return $pluginsinfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Mobile cache definitions.
|
||||
*
|
||||
* @package tool_mobile
|
||||
* @copyright 2017 Skylar Kelty <S.Kelty@kent.ac.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$definitions = array(
|
||||
'plugininfo' => array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'staticacceleration' => true,
|
||||
'staticaccelerationsize' => 1
|
||||
)
|
||||
);
|
||||
@@ -23,3 +23,4 @@
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Moodle Mobile tools';
|
||||
$string['cachedef_plugininfo'] = 'This stores the list of plugins with mobile addons';
|
||||
|
||||
@@ -53,10 +53,13 @@ class eventobservers {
|
||||
* @param \core\event\course_deleted $event The course deleted event.
|
||||
*/
|
||||
public static function course_deleted(\core\event\course_deleted $event) {
|
||||
// Delete rules defined inside this course and associated subscriptions.
|
||||
$rules = rule_manager::get_rules_by_courseid($event->courseid, 0, 0, false);
|
||||
foreach ($rules as $rule) {
|
||||
rule_manager::delete_rule($rule->id, $event->get_context());
|
||||
}
|
||||
// Delete remaining subscriptions inside this course (from site-wide rules).
|
||||
subscription_manager::remove_all_subscriptions_in_course($event->get_context());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -176,8 +176,12 @@ class subscription {
|
||||
if (empty($courseid)) {
|
||||
return get_string('site');
|
||||
} else {
|
||||
$course = get_course($courseid);
|
||||
return format_string($course->fullname, true, array('context' => $context));
|
||||
try {
|
||||
$course = get_course($courseid);
|
||||
return format_string($course->fullname, true, array('context' => $context));
|
||||
} catch (\dml_exception $e) {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,9 +118,10 @@ class subscription_manager {
|
||||
|
||||
// If successful trigger a subscription_deleted event.
|
||||
if ($success) {
|
||||
if (!empty($subscription->courseid)) {
|
||||
if (!empty($subscription->courseid) &&
|
||||
($coursecontext = \context_course::instance($subscription->courseid, IGNORE_MISSING))) {
|
||||
$courseid = $subscription->courseid;
|
||||
$context = \context_course::instance($subscription->courseid);
|
||||
$context = $coursecontext;
|
||||
} else {
|
||||
$courseid = 0;
|
||||
$context = \context_system::instance();
|
||||
@@ -222,6 +223,31 @@ class subscription_manager {
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all subscriptions in a course.
|
||||
*
|
||||
* This is called after a course was deleted, context no longer exists but we kept the object
|
||||
*
|
||||
* @param \context_course $coursecontext the context of the course
|
||||
*/
|
||||
public static function remove_all_subscriptions_in_course($coursecontext) {
|
||||
global $DB;
|
||||
|
||||
// Store all the subscriptions we have to delete.
|
||||
if ($subscriptions = $DB->get_records('tool_monitor_subscriptions', ['courseid' => $coursecontext->instanceid])) {
|
||||
// Delete subscriptions in bulk.
|
||||
$DB->delete_records('tool_monitor_subscriptions', ['courseid' => $coursecontext->instanceid]);
|
||||
|
||||
// Trigger events one by one.
|
||||
foreach ($subscriptions as $subscription) {
|
||||
$params = ['objectid' => $subscription->id, 'context' => $coursecontext];
|
||||
$event = \tool_monitor\event\subscription_deleted::create($params);
|
||||
$event->add_record_snapshot('tool_monitor_subscriptions', $subscription);
|
||||
$event->trigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a subscription instance for an given subscription id.
|
||||
*
|
||||
|
||||
@@ -77,5 +77,22 @@ function xmldb_tool_monitor_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2016052305, 'tool', 'monitor');
|
||||
}
|
||||
|
||||
if ($oldversion < 2016052306) {
|
||||
|
||||
// Delete "orphaned" subscriptions.
|
||||
$sql = "SELECT DISTINCT s.courseid
|
||||
FROM {tool_monitor_subscriptions} s
|
||||
LEFT OUTER JOIN {course} c ON c.id = s.courseid
|
||||
WHERE s.courseid <> 0 and c.id IS NULL";
|
||||
$deletedcourses = $DB->get_field_sql($sql);
|
||||
if ($deletedcourses) {
|
||||
list($sql, $params) = $DB->get_in_or_equal($deletedcourses);
|
||||
$DB->execute("DELETE FROM {tool_monitor_subscriptions} WHERE courseid " . $sql, $params);
|
||||
}
|
||||
|
||||
// Monitor savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2016052306, 'tool', 'monitor');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ if (empty($courseid)) {
|
||||
// check system level capability.
|
||||
if (!has_capability('tool/monitor:subscribe', $context)) {
|
||||
// If not system level then check to see if they have access to any course level rules.
|
||||
if (tool_monitor_get_user_courses()){
|
||||
if (tool_monitor_can_subscribe()) {
|
||||
// Make them choose a course.
|
||||
$choose = true;
|
||||
} else {
|
||||
|
||||
@@ -75,12 +75,20 @@ function tool_monitor_extend_navigation_frontpage($navigation, $course, $context
|
||||
* @param context $coursecontext The context of the course
|
||||
*/
|
||||
function tool_monitor_extend_navigation_user_settings($navigation, $user, $usercontext, $course, $coursecontext) {
|
||||
global $USER, $SITE;
|
||||
global $USER, $PAGE;
|
||||
|
||||
// Don't bother doing needless calculations unless we are on the relevant pages.
|
||||
$onpreferencepage = $PAGE->url->compare(new moodle_url('/user/preferences.php'), URL_MATCH_BASE);
|
||||
$onmonitorpage = $PAGE->url->compare(new moodle_url('/admin/tool/monitor/index.php'), URL_MATCH_BASE);
|
||||
if (!$onpreferencepage && !$onmonitorpage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Don't show the setting if the event monitor isn't turned on. No access to other peoples subscriptions.
|
||||
if (get_config('tool_monitor', 'enablemonitor') && $USER->id == $user->id) {
|
||||
// Now let's check to see if the user has any courses / site rules that they can subscribe to.
|
||||
if ($courses = tool_monitor_get_user_courses()) {
|
||||
// We skip doing a check here if we are on the event monitor page as the check is done internally on that page.
|
||||
if ($onmonitorpage || tool_monitor_can_subscribe()) {
|
||||
$url = new moodle_url('/admin/tool/monitor/index.php');
|
||||
$subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'), $url,
|
||||
navigation_node::TYPE_SETTING, null, 'monitor', new pix_icon('i/settings', ''));
|
||||
@@ -92,6 +100,19 @@ function tool_monitor_extend_navigation_user_settings($navigation, $user, $userc
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user has the capacity to subscribe to an event monitor anywhere.
|
||||
*
|
||||
* @return bool True if a capability in a course is found. False otherwise.
|
||||
*/
|
||||
function tool_monitor_can_subscribe() {
|
||||
if (has_capability('tool/monitor:subscribe', context_system::instance())) {
|
||||
return true;
|
||||
}
|
||||
$courses = get_user_capability_course('tool/monitor:subscribe', null, true, '', '', 1);
|
||||
return empty($courses) ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of courses and also include 'Site' for site wide rules.
|
||||
*
|
||||
@@ -103,8 +124,11 @@ function tool_monitor_get_user_courses() {
|
||||
if (has_capability('tool/monitor:subscribe', context_system::instance())) {
|
||||
$options[0] = get_string('site');
|
||||
}
|
||||
if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, 'fullname, visible', $orderby)) {
|
||||
|
||||
$fields = 'fullname, visible, ctxid, ctxpath, ctxdepth, ctxlevel, ctxinstance';
|
||||
if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, $fields, $orderby)) {
|
||||
foreach ($courses as $course) {
|
||||
context_helper::preload_from_record($course);
|
||||
$coursectx = context_course::instance($course->id);
|
||||
if ($course->visible || has_capability('moodle/course:viewhiddencourses', $coursectx)) {
|
||||
$options[$course->id] = format_string($course->fullname, true, array('context' => $coursectx));
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2016052305; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2016052306; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_monitor'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -49,7 +49,7 @@ It\'s highly recommended to be running the latest (+ version) available of your
|
||||
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
|
||||
$string['confirmcheckforeignkeys'] = 'This functionality will search for potential violations of the foreign keys defined in the install.xml definitions. (Moodle does not currently generate actual foreign key constraints in the database, which is why invalid data may be present.)
|
||||
|
||||
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of missing indexes.
|
||||
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search for potential violations of the foreign keys.
|
||||
|
||||
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
|
||||
$string['confirmcheckindexes'] = 'This functionality will search for potential missing indexes in your Moodle server, generating (but not executing!) automatically the needed SQL statements to keep everything updated.
|
||||
|
||||
+24
-2
@@ -99,9 +99,31 @@ if (!isset($config->removeuser)) {
|
||||
$yesno = array( get_string('no'), get_string('yes') );
|
||||
|
||||
$disabled = '';
|
||||
if (!ldap_paged_results_supported($config->ldap_version)) {
|
||||
$pagedresultssupported = false;
|
||||
if ($config->host_url !== '') {
|
||||
/**
|
||||
* We try to connect each and every time we open the config, because we want to set the Page
|
||||
* Size setting as enabled or disabled depending on the configured LDAP server supporting
|
||||
* pagination or not, and to notify the user about it. If the user changed the LDAP server (or
|
||||
* the LDAP protocol version) last time, it might happen that paged results are no longer
|
||||
* available and we want to show that to the user the next time she goes to the settings page.
|
||||
*/
|
||||
try {
|
||||
$ldapconn = $this->ldap_connect();
|
||||
$pagedresultssupported = ldap_paged_results_supported($config->ldap_version, $ldapconn);
|
||||
} catch (Exception $e) {
|
||||
// If we couldn't connect and get the supported options, we can only assume we don't support paged results.
|
||||
$pagedresultssupported = false;
|
||||
}
|
||||
}
|
||||
/* Make sure we only disable the paged result size setting and show the notification about it if
|
||||
* there is a configured server that we tried to contact. Othersiwe, if someone's LDAP server does
|
||||
* support paged results, they won't be able to turn it on the first time they set it up (because
|
||||
* the field will be disabled).
|
||||
*/
|
||||
if (($config->host_url !== '') && (!$pagedresultssupported)) {
|
||||
$disabled = ' disabled="disabled"';
|
||||
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
|
||||
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'), \core\output\notification::NOTIFY_INFO);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+2
-2
@@ -695,7 +695,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
array_push($contexts, $this->config->create_context);
|
||||
}
|
||||
|
||||
$ldap_pagedresults = ldap_paged_results_supported($this->config->ldap_version);
|
||||
$ldap_pagedresults = ldap_paged_results_supported($this->config->ldap_version, $ldapconnection);
|
||||
$ldap_cookie = '';
|
||||
foreach ($contexts as $context) {
|
||||
$context = trim($context);
|
||||
@@ -1540,7 +1540,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
$ldap_cookie = '';
|
||||
$ldap_pagedresults = ldap_paged_results_supported($this->config->ldap_version);
|
||||
$ldap_pagedresults = ldap_paged_results_supported($this->config->ldap_version, $ldapconnection);
|
||||
foreach ($contexts as $context) {
|
||||
$context = trim($context);
|
||||
if (empty($context)) {
|
||||
|
||||
+24
-2
@@ -117,9 +117,31 @@ $fastpathoptions = array(AUTH_NTLM_FASTPATH_YESFORM => get_string('auth_ntlmsso_
|
||||
AUTH_NTLM_FASTPATH_ATTEMPT => get_string('auth_ntlmsso_ie_fastpath_attempt', 'auth_ldap'));
|
||||
|
||||
$disabled = '';
|
||||
if (!ldap_paged_results_supported($config->ldap_version)) {
|
||||
$pagedresultssupported = false;
|
||||
if ($config->host_url !== '') {
|
||||
/**
|
||||
* We try to connect each and every time we open the config, because we want to set the Page
|
||||
* Size setting as enabled or disabled depending on the configured LDAP server supporting
|
||||
* pagination or not, and to notify the user about it. If the user changed the LDAP server (or
|
||||
* the LDAP protocol version) last time, it might happen that paged results are no longer
|
||||
* available and we want to show that to the user the next time she goes to the settings page.
|
||||
*/
|
||||
try {
|
||||
$ldapconn = $this->ldap_connect();
|
||||
$pagedresultssupported = ldap_paged_results_supported($config->ldap_version, $ldapconn);
|
||||
} catch (Exception $e) {
|
||||
// If we couldn't connect and get the supported options, we can only assume we don't support paged results.
|
||||
$pagedresultssupported = false;
|
||||
}
|
||||
}
|
||||
/* Make sure we only disable the paged result size setting and show the notification about it if
|
||||
* there is a configured server that we tried to contact. Othersiwe, if someone's LDAP server does
|
||||
* support paged results, they won't be able to turn it on the first time they set it up (because
|
||||
* the field will be disabled).
|
||||
*/
|
||||
if (($config->host_url !== '') && (!$pagedresultssupported)) {
|
||||
$disabled = ' disabled="disabled"';
|
||||
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
|
||||
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'), \core\output\notification::NOTIFY_INFO);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -132,7 +132,7 @@ $string['ntlmsso_attempting'] = 'Attempting Single Sign On via NTLM...';
|
||||
$string['ntlmsso_failed'] = 'Auto-login failed, try the normal login page...';
|
||||
$string['ntlmsso_isdisabled'] = 'NTLM SSO is disabled.';
|
||||
$string['ntlmsso_unknowntype'] = 'Unknown ntlmsso type!';
|
||||
$string['pagedresultsnotsupp'] = 'LDAP paged results not supported (either your PHP version lacks support or you have configured Moodle to use LDAP protocol version 2)';
|
||||
$string['pagedresultsnotsupp'] = 'LDAP paged results not supported (either your PHP version lacks support, you have configured Moodle to use LDAP protocol version 2 or Moodle cannot contact your LDAP server to see if paged support is available.)';
|
||||
$string['pagesize'] = 'Make sure this value is smaller than your LDAP server result set size limit (the maximum number of entries that can be returned in a single query)';
|
||||
$string['pagesize_key'] = 'Page Size';
|
||||
$string['pluginname'] = 'LDAP server';
|
||||
|
||||
@@ -26,13 +26,14 @@ if (!is_enabled_auth('shibboleth')) {
|
||||
$inputstream = file_get_contents("php://input");
|
||||
if ($action == 'logout' && !empty($redirect)) {
|
||||
|
||||
if ($USER->auth == 'shibboleth') {
|
||||
// Logout out user from application.
|
||||
if (isloggedin($USER) && $USER->auth == 'shibboleth') {
|
||||
// Logout user from application.
|
||||
require_logout();
|
||||
// Finally, send user to the return URL.
|
||||
redirect($redirect);
|
||||
}
|
||||
|
||||
// Finally, send user to the return URL.
|
||||
redirect($redirect);
|
||||
|
||||
} else if (!empty($inputstream)) {
|
||||
|
||||
// Back channel logout.
|
||||
|
||||
@@ -2666,7 +2666,7 @@ class restore_calendarevents_structure_step extends restore_structure_step {
|
||||
'courseid' => $this->get_courseid(),
|
||||
'groupid' => $data->groupid,
|
||||
'userid' => $data->userid,
|
||||
'repeatid' => $data->repeatid,
|
||||
'repeatid' => $this->get_mappingid('event', $data->repeatid),
|
||||
'modulename' => $data->modulename,
|
||||
'eventtype' => $data->eventtype,
|
||||
'timestart' => $this->apply_date_offset($data->timestart),
|
||||
@@ -2684,18 +2684,27 @@ class restore_calendarevents_structure_step extends restore_structure_step {
|
||||
FROM {event}
|
||||
WHERE " . $DB->sql_compare_text('name', 255) . " = " . $DB->sql_compare_text('?', 255) . "
|
||||
AND courseid = ?
|
||||
AND repeatid = ?
|
||||
AND modulename = ?
|
||||
AND timestart = ?
|
||||
AND timeduration = ?
|
||||
AND " . $DB->sql_compare_text('description', 255) . " = " . $DB->sql_compare_text('?', 255);
|
||||
$arg = array ($params['name'], $params['courseid'], $params['repeatid'], $params['modulename'], $params['timestart'], $params['timeduration'], $params['description']);
|
||||
$arg = array ($params['name'], $params['courseid'], $params['modulename'], $params['timestart'], $params['timeduration'], $params['description']);
|
||||
$result = $DB->record_exists_sql($sql, $arg);
|
||||
if (empty($result)) {
|
||||
$newitemid = $DB->insert_record('event', $params);
|
||||
$this->set_mapping('event', $oldid, $newitemid);
|
||||
$this->set_mapping('event_description', $oldid, $newitemid, $restorefiles);
|
||||
}
|
||||
// With repeating events, each event has the repeatid pointed at the first occurrence.
|
||||
// Since the repeatid will be empty when the first occurrence is restored,
|
||||
// Get the repeatid from the second occurrence of the repeating event and use that to update the first occurrence.
|
||||
// Then keep a list of repeatids so we only perform this update once.
|
||||
static $repeatids = array();
|
||||
if (!empty($params['repeatid']) && !in_array($params['repeatid'], $repeatids)) {
|
||||
// This entry is repeated so the repeatid field must be set.
|
||||
$DB->set_field('event', 'repeatid', $params['repeatid'], array('id' => $params['repeatid']));
|
||||
$repeatids[] = $params['repeatid'];
|
||||
}
|
||||
|
||||
}
|
||||
protected function after_execute() {
|
||||
|
||||
+42
-25
@@ -46,23 +46,6 @@ class edit_backpack_form extends moodleform {
|
||||
$mform->addElement('header', 'backpackheader', get_string('backpackconnection', 'badges'));
|
||||
$mform->addHelpButton('backpackheader', 'backpackconnection', 'badges');
|
||||
$mform->addElement('static', 'url', get_string('url'), BADGE_BACKPACKURL);
|
||||
$status = html_writer::tag('span', get_string('notconnected', 'badges'),
|
||||
array('class' => 'notconnected', 'id' => 'connection-status'));
|
||||
$mform->addElement('static', 'status', get_string('status'), $status);
|
||||
|
||||
$nojs = html_writer::tag('noscript', get_string('error:personaneedsjs', 'badges'),
|
||||
array('class' => 'notconnected'));
|
||||
$personadiv = $OUTPUT->container($nojs, null, 'persona-container');
|
||||
|
||||
$mform->addElement('static', 'persona', '', $personadiv);
|
||||
$mform->addHelpButton('persona', 'personaconnection', 'badges');
|
||||
|
||||
$PAGE->requires->js(new moodle_url('https://login.persona.org/include.js'));
|
||||
$PAGE->requires->js('/badges/backpack.js');
|
||||
$PAGE->requires->js_init_call('badges_init_persona_login_button', null, false);
|
||||
$PAGE->requires->strings_for_js(array('error:backpackloginfailed', 'signinwithyouremail',
|
||||
'error:noassertion', 'error:connectionunknownreason', 'error:badjson', 'connecting',
|
||||
'notconnected'), 'badges');
|
||||
|
||||
$mform->addElement('hidden', 'userid', $USER->id);
|
||||
$mform->setType('userid', PARAM_INT);
|
||||
@@ -70,23 +53,57 @@ class edit_backpack_form extends moodleform {
|
||||
$mform->addElement('hidden', 'backpackurl', BADGE_BACKPACKURL);
|
||||
$mform->setType('backpackurl', PARAM_URL);
|
||||
|
||||
if (isset($this->_customdata['email'])) {
|
||||
// Email will be passed in when we're in the process of verifying the user's email address,
|
||||
// so set the connection status, lock the email field, and provide options to resend the verification
|
||||
// email or cancel the verification process entirely and start over.
|
||||
$status = html_writer::tag('span', get_string('backpackemailverificationpending', 'badges'),
|
||||
array('class' => 'notconnected', 'id' => 'connection-status'));
|
||||
$mform->addElement('static', 'status', get_string('status'), $status);
|
||||
$mform->addElement('hidden', 'email', $this->_customdata['email']);
|
||||
$mform->setType('email', PARAM_RAW_TRIMMED);
|
||||
$mform->hardFreeze(['email']);
|
||||
$status = html_writer::tag('span', $this->_customdata['email'], []);
|
||||
$mform->addElement('static', 'emailverify', get_string('email'), $status);
|
||||
$buttonarray = [];
|
||||
$buttonarray[] = &$mform->createElement('submit', 'submitbutton',
|
||||
get_string('backpackconnectionresendemail', 'badges'));
|
||||
$buttonarray[] = &$mform->createElement('submit', 'revertbutton',
|
||||
get_string('backpackconnectioncancelattempt', 'badges'));
|
||||
$mform->addGroup($buttonarray, 'buttonar', '', [''], false);
|
||||
$mform->closeHeaderBefore('buttonar');
|
||||
} else {
|
||||
// Email isn't present, so provide an input element to get it and a button to start the verification process.
|
||||
$status = html_writer::tag('span', get_string('notconnected', 'badges'),
|
||||
array('class' => 'notconnected', 'id' => 'connection-status'));
|
||||
$mform->addElement('static', 'status', get_string('status'), $status);
|
||||
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
|
||||
$mform->addHelpButton('email', 'backpackemail', 'badges');
|
||||
$mform->addRule('email', get_string('required'), 'required', null, 'client');
|
||||
$mform->setType('email', PARAM_RAW_TRIMMED);
|
||||
$this->add_action_buttons(false, get_string('backpackconnectionconnect', 'badges'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates form data
|
||||
*/
|
||||
public function validation($data, $files) {
|
||||
global $DB;
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
$check = new stdClass();
|
||||
$check->backpackurl = $data['backpackurl'];
|
||||
$check->email = $data['email'];
|
||||
// We don't need to verify the email address if we're clearing a pending email verification attempt.
|
||||
if (!isset($data['revertbutton'])) {
|
||||
$check = new stdClass();
|
||||
$check->backpackurl = $data['backpackurl'];
|
||||
$check->email = $data['email'];
|
||||
|
||||
$bp = new OpenBadgesBackpackHandler($check);
|
||||
$request = $bp->curl_request('user');
|
||||
if (isset($request->status) && $request->status == 'missing') {
|
||||
$errors['email'] = get_string('error:nosuchuser', 'badges');
|
||||
$bp = new OpenBadgesBackpackHandler($check);
|
||||
$request = $bp->curl_request('user');
|
||||
if (isset($request->status) && $request->status == 'missing') {
|
||||
$errors['email'] = get_string('error:nosuchuser', 'badges');
|
||||
} else if (!isset($request->status) || $request->status !== 'okay') {
|
||||
$errors['email'] = get_string('backpackconnectionunexpectedresult', 'badges');
|
||||
}
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Endpoint for the verification email link.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage badges
|
||||
* @copyright 2016 Jake Dallimore <jrhdallimore@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
require_once(__DIR__ . '/lib/backpacklib.php');
|
||||
|
||||
$data = optional_param('data', '', PARAM_RAW);
|
||||
require_login();
|
||||
$PAGE->set_url('/badges/openbackpackemailverify.php');
|
||||
$PAGE->set_context(context_user::instance($USER->id));
|
||||
$redirect = '/badges/mybackpack.php';
|
||||
|
||||
// Confirm the secret and create the backpack connection.
|
||||
$storedsecret = get_user_preferences('badges_email_verify_secret');
|
||||
if (!is_null($storedsecret)) {
|
||||
if ($data === $storedsecret) {
|
||||
$storedemail = get_user_preferences('badges_email_verify_address');
|
||||
|
||||
$data = new stdClass();
|
||||
$data->backpackurl = BADGE_BACKPACKURL;
|
||||
$data->email = $storedemail;
|
||||
$bp = new OpenBadgesBackpackHandler($data);
|
||||
|
||||
// Make sure we have all the required information before trying to save the connection.
|
||||
$backpackuser = $bp->curl_request('user');
|
||||
if (isset($backpackuser->status) && $backpackuser->status === 'okay' && isset($backpackuser->userId)) {
|
||||
$backpackuid = $backpackuser->userId;
|
||||
} else {
|
||||
redirect(new moodle_url($redirect), get_string('backpackconnectionunexpectedresult', 'badges'),
|
||||
null, \core\output\notification::NOTIFY_ERROR);
|
||||
}
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->userid = $USER->id;
|
||||
$obj->email = $data->email;
|
||||
$obj->backpackurl = $data->backpackurl;
|
||||
$obj->backpackuid = $backpackuid;
|
||||
$obj->autosync = 0;
|
||||
$obj->password = '';
|
||||
$DB->insert_record('badge_backpack', $obj);
|
||||
|
||||
// Remove the verification vars and redirect to the mypackpack page.
|
||||
unset_user_preference('badges_email_verify_secret');
|
||||
unset_user_preference('badges_email_verify_address');
|
||||
redirect(new moodle_url($redirect), get_string('backpackemailverifysuccess', 'badges'),
|
||||
null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
} else {
|
||||
// Stored secret doesn't match the supplied secret. Take user back to the mybackpack page and present a warning message.
|
||||
redirect(new moodle_url($redirect), get_string('backpackemailverifytokenmismatch', 'badges'),
|
||||
null, \core\output\notification::NOTIFY_ERROR);
|
||||
}
|
||||
} else {
|
||||
// Stored secret is null. Either the email address has already been verified, or there is no record of a verification attempt
|
||||
// for the current user. Either way, just redirect to the mybackpack page.
|
||||
redirect(new moodle_url($redirect));
|
||||
}
|
||||
@@ -117,3 +117,45 @@ class OpenBadgesBackpackHandler {
|
||||
return $this->backpack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and send a verification email to the email address supplied.
|
||||
*
|
||||
* Since we're not sending this email to a user, email_to_user can't be used
|
||||
* but this function borrows largely the code from that process.
|
||||
*
|
||||
* @param string $email the email address to send the verification email to.
|
||||
* @return true if the email was sent successfully, false otherwise.
|
||||
*/
|
||||
function send_verification_email($email) {
|
||||
global $DB, $USER;
|
||||
|
||||
// Store a user secret (badges_email_verify_secret) and the address (badges_email_verify_address) as users prefs.
|
||||
// The address will be used by edit_backpack_form for display during verification and to facilitate the resending
|
||||
// of verification emails to said address.
|
||||
$secret = random_string(15);
|
||||
set_user_preference('badges_email_verify_secret', $secret);
|
||||
set_user_preference('badges_email_verify_address', $email);
|
||||
|
||||
// To, from.
|
||||
$tempuser = $DB->get_record('user', array('id' => $USER->id), '*', MUST_EXIST);
|
||||
$tempuser->email = $email;
|
||||
$noreplyuser = core_user::get_noreply_user();
|
||||
|
||||
// Generate the verification email body.
|
||||
$verificationurl = '/badges/backpackemailverify.php';
|
||||
$verificationurl = new moodle_url($verificationurl);
|
||||
$verificationpath = $verificationurl->out(false);
|
||||
|
||||
$site = get_site();
|
||||
$args = new stdClass();
|
||||
$args->link = $verificationpath . '?data='. $secret;
|
||||
$args->sitename = $site->fullname;
|
||||
$args->admin = generate_email_signoff();
|
||||
|
||||
$messagesubject = get_string('backpackemailverifyemailsubject', 'badges', $site->fullname);
|
||||
$messagetext = get_string('backpackemailverifyemailbody', 'badges', $args);
|
||||
$messagehtml = text_to_html($messagetext, false, false, true);
|
||||
|
||||
return email_to_user($tempuser, $noreplyuser, $messagesubject, $messagetext, $messagehtml);
|
||||
}
|
||||
|
||||
+29
-13
@@ -110,23 +110,39 @@ if ($backpack) {
|
||||
}
|
||||
} else {
|
||||
// If backpack is not connected, need to connect first.
|
||||
$form = new edit_backpack_form();
|
||||
// To create a new connection to the backpack, first we need to verify the user's email address:
|
||||
// 1. User enters email and clicks 'Connect to backpack'.
|
||||
// 2. After cross-checking the email address against the backpack provider, an email is sent to the specified address,
|
||||
// and the email and secret are stored in user preferences. These will be cleared upon successful verification.
|
||||
// 3. User clicks verification link in the email to confirm the backpack connection.
|
||||
// 4. User redirected to the mybackpack page.
|
||||
// While the verification process is pending, the edit_backpack_form form will present the user with options to resend the
|
||||
// verification email, and to cancel the current verification attempt and start over.
|
||||
|
||||
// To pass through the current state of the verification attempt to the form.
|
||||
$params['email'] = get_user_preferences('badges_email_verify_address');
|
||||
|
||||
$form = new edit_backpack_form(new moodle_url('/badges/mybackpack.php'), $params);
|
||||
if ($form->is_cancelled()) {
|
||||
redirect(new moodle_url('/badges/mybadges.php'));
|
||||
} else if ($data = $form->get_data()) {
|
||||
$bp = new OpenBadgesBackpackHandler($data);
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->userid = $data->userid;
|
||||
$obj->email = $data->email;
|
||||
$obj->backpackurl = $data->backpackurl;
|
||||
$obj->backpackuid = $bp->curl_request('user')->userId;
|
||||
$obj->autosync = 0;
|
||||
$obj->password = '';
|
||||
$DB->insert_record('badge_backpack', $obj);
|
||||
|
||||
redirect(new moodle_url('/badges/mybackpack.php'));
|
||||
// The form may have been submitted under one of the following circumstances:
|
||||
// 1. After clicking 'Connect to backpack'. We'll have $data->email.
|
||||
// 2. After clicking 'Resend verification email'. We'll have $data->email.
|
||||
// 3. After clicking 'Connect using a different email' to cancel the verification process. We'll have $data->revertbutton.
|
||||
if (isset($data->revertbutton)) {
|
||||
unset_user_preference('badges_email_verify_secret');
|
||||
unset_user_preference('badges_email_verify_address');
|
||||
redirect(new moodle_url('/badges/mybackpack.php'));
|
||||
} else if (isset($data->email)) {
|
||||
if (send_verification_email($data->email)) {
|
||||
redirect(new moodle_url('/badges/mybackpack.php'),
|
||||
get_string('backpackemailverifypending', 'badges', $data->email),
|
||||
null, \core\output\notification::NOTIFY_INFO);
|
||||
} else {
|
||||
print_error ('backpackcannotsendverification', 'badges');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,7 @@ Feature: Award badges
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I click on "Admin User" "link"
|
||||
And I follow "Profile" in the open menu
|
||||
And I follow "Edit profile"
|
||||
And I open my profile in edit mode
|
||||
And I expand all fieldsets
|
||||
And I set the field "Phone" to "123456789"
|
||||
And I press "Update profile"
|
||||
|
||||
@@ -673,7 +673,7 @@ class block_activity_results extends block_base {
|
||||
|
||||
$o = html_writer::start_tag('h3');
|
||||
$o .= html_writer::link(new moodle_url('/mod/'.$activity->itemmodule.'/view.php',
|
||||
array('id' => $cm->id)), $activity->itemname);
|
||||
array('id' => $cm->id)), format_string(($activity->itemname), true, ['context' => context_module::instance($cm->id)]));
|
||||
$o .= html_writer::end_tag('h3');
|
||||
return $o;
|
||||
}
|
||||
@@ -690,4 +690,4 @@ class block_activity_results extends block_base {
|
||||
return $scale;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ class block_activity_results_edit_form extends block_edit_form {
|
||||
$sql = 'SELECT id, itemname FROM {grade_items} WHERE courseid = ? and itemtype = ? and (gradetype = ? or gradetype = ?)';
|
||||
$params = array($this->page->course->id, 'mod', GRADE_TYPE_VALUE, GRADE_TYPE_SCALE);
|
||||
$activities = $DB->get_records_sql_menu($sql, $params);
|
||||
core_collator::asort($activities);
|
||||
|
||||
if (empty($activities)) {
|
||||
$mform->addElement('static', 'noactivitieswarning', get_string('config_select_activity', 'block_activity_results'),
|
||||
|
||||
@@ -153,7 +153,8 @@ class block_community_renderer extends plugin_renderer_base {
|
||||
array('class' => 'hubcourseuserinfo'));
|
||||
|
||||
//create course content related information html
|
||||
$course->subject = get_string($course->subject, 'edufields');
|
||||
$course->subject = (get_string_manager()->string_exists($course->subject, 'edufields')) ?
|
||||
get_string($course->subject, 'edufields') : get_string('none');
|
||||
$course->audience = get_string('audience' . $course->audience, 'hub');
|
||||
$course->educationallevel = get_string('edulevel' . $course->educationallevel, 'hub');
|
||||
$coursecontentinfo = '';
|
||||
|
||||
@@ -64,7 +64,7 @@ class block_course_overview extends block_base {
|
||||
$content = array();
|
||||
|
||||
$updatemynumber = optional_param('mynumber', -1, PARAM_INT);
|
||||
if ($updatemynumber >= 0) {
|
||||
if ($updatemynumber >= 0 && optional_param('sesskey', '', PARAM_RAW) && confirm_sesskey()) {
|
||||
block_course_overview_update_mynumber($updatemynumber);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ function block_course_overview_get_myorder() {
|
||||
// If preference was not found, look in the old location and convert if found.
|
||||
$order = array();
|
||||
if ($value = get_user_preferences('course_overview_course_order')) {
|
||||
$order = unserialize($value);
|
||||
$order = unserialize_array($value);
|
||||
block_course_overview_update_myorder($order);
|
||||
unset_user_preference('course_overview_course_order');
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ class block_course_overview_renderer extends plugin_renderer_base {
|
||||
for ($i = 1; $i <= $max; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$url = new moodle_url('/my/index.php');
|
||||
$url = new moodle_url('/my/index.php', ['sesskey' => sesskey()]);
|
||||
$select = new single_select($url, 'mynumber', $options, block_course_overview_get_max_user_courses(), array());
|
||||
$select->set_label(get_string('numtodisplay', 'block_course_overview'));
|
||||
$output .= $this->output->render($select);
|
||||
|
||||
@@ -52,11 +52,11 @@ $action = (empty($id)) ? 'add' : 'edit';
|
||||
|
||||
$external = new stdClass();
|
||||
|
||||
// Check that this id exists.
|
||||
if (!empty($id) && !$DB->record_exists('blog_external', array('id' => $id))) {
|
||||
print_error('wrongexternalid', 'blog');
|
||||
} else if (!empty($id)) {
|
||||
$external = $DB->get_record('blog_external', array('id' => $id));
|
||||
// Retrieve the external blog record.
|
||||
if (!empty($id)) {
|
||||
if (!$external = $DB->get_record('blog_external', array('id' => $id, 'userid' => $USER->id))) {
|
||||
print_error('wrongexternalid', 'blog');
|
||||
}
|
||||
$external->autotags = core_tag_tag::get_item_tags_array('core', 'blog_external', $id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -872,7 +872,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
|
||||
}
|
||||
|
||||
// Append Search info.
|
||||
if (!empty($search)) {
|
||||
if (!empty($search) && has_capability('moodle/blog:search', $sitecontext)) {
|
||||
$headers['filters']['search'] = $search;
|
||||
$blogurl->param('search', $search);
|
||||
$PAGE->navbar->add(get_string('searchterm', 'blog', $search), $blogurl->out());
|
||||
|
||||
Vendored
+1
-1
@@ -213,7 +213,7 @@ class cache implements cache_loader {
|
||||
$this->definition = $definition;
|
||||
$this->store = $store;
|
||||
$this->storetype = get_class($store);
|
||||
$this->perfdebug = !empty($CFG->perfdebug);
|
||||
$this->perfdebug = (!empty($CFG->perfdebug) and $CFG->perfdebug > 7);
|
||||
if ($loader instanceof cache_loader) {
|
||||
$this->loader = $loader;
|
||||
// Mark the loader as a sub (chained) loader.
|
||||
|
||||
Vendored
+54
-2
@@ -229,8 +229,60 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
|
||||
$version = phpversion('memcached');
|
||||
$this->candeletemulti = ($version && version_compare($version, self::REQUIRED_VERSION, '>='));
|
||||
|
||||
// Test the connection to the main connection.
|
||||
$this->isready = @$this->connection->set("ping", 'ping', 1);
|
||||
$this->isready = $this->is_connection_ready();
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm whether the connection is ready and usable.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_connection_ready() {
|
||||
if (!@$this->connection->set("ping", 'ping', 1)) {
|
||||
// Test the connection to the server.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isshared) {
|
||||
// There is a bug in libmemcached which means that it is not possible to purge the cache in a shared cache
|
||||
// configuration.
|
||||
// This issue currently affects:
|
||||
// - memcached 1.4.23+ with php-memcached <= 2.2.0
|
||||
// The following combinations are not affected:
|
||||
// - memcached <= 1.4.22 with any version of php-memcached
|
||||
// - any version of memcached with php-memcached >= 3.0.1
|
||||
|
||||
|
||||
// This check is cheapest as it does not involve connecting to the server at all.
|
||||
$safecombination = false;
|
||||
$extension = new ReflectionExtension('memcached');
|
||||
if ((version_compare($extension->getVersion(), '3.0.1') >= 0)) {
|
||||
// This is php-memcached version >= 3.0.1 which is a safe combination.
|
||||
$safecombination = true;
|
||||
}
|
||||
|
||||
if (!$safecombination) {
|
||||
$allsafe = true;
|
||||
foreach ($this->connection->getVersion() as $version) {
|
||||
$allsafe = $allsafe && (version_compare($version, '1.4.22') <= 0);
|
||||
}
|
||||
// All memcached servers connected are version <= 1.4.22 which is a safe combination.
|
||||
$safecombination = $allsafe;
|
||||
}
|
||||
|
||||
if (!$safecombination) {
|
||||
// This is memcached 1.4.23+ and php-memcached < 3.0.1.
|
||||
// The issue may have been resolved in a subsequent update to any of the three libraries.
|
||||
// The only way to safely determine if the combination is safe is to call getAllKeys.
|
||||
// A safe combination will return an array, whilst an affected combination will return false.
|
||||
// This is the most expensive check.
|
||||
if (!is_array($this->connection->getAllKeys())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -286,6 +286,10 @@ class cachestore_memcached_test extends cachestore_tests {
|
||||
|
||||
$definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_memcached', 'phpunit_test');
|
||||
$cachestore = $this->create_test_cache_with_config($definition, array('isshared' => true));
|
||||
if (!$cachestore->is_connection_ready()) {
|
||||
$this->markTestSkipped('Could not test cachestore_memcached. Connection is not ready.');
|
||||
}
|
||||
|
||||
$connection = new Memcached(crc32(__METHOD__));
|
||||
$connection->addServers($this->get_servers(TEST_CACHESTORE_MEMCACHED_TESTSERVERS));
|
||||
$connection->setOptions(array(
|
||||
|
||||
Vendored
+53
@@ -2170,4 +2170,57 @@ class core_cache_testcase extends advanced_testcase {
|
||||
$this->assertEquals(0, $endstats[$requestid]['stores']['cachestore_static']['sets'] -
|
||||
$startstats[$requestid]['stores']['cachestore_static']['sets']);
|
||||
}
|
||||
|
||||
public function test_performance_debug_off() {
|
||||
global $CFG;
|
||||
$this->resetAfterTest(true);
|
||||
$CFG->perfdebug = 7;
|
||||
|
||||
$instance = cache_config_testing::instance();
|
||||
$applicationid = 'phpunit/applicationperfoff';
|
||||
$instance->phpunit_add_definition($applicationid, array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'component' => 'phpunit',
|
||||
'area' => 'applicationperfoff'
|
||||
));
|
||||
$sessionid = 'phpunit/sessionperfoff';
|
||||
$instance->phpunit_add_definition($sessionid, array(
|
||||
'mode' => cache_store::MODE_SESSION,
|
||||
'component' => 'phpunit',
|
||||
'area' => 'sessionperfoff'
|
||||
));
|
||||
$requestid = 'phpunit/requestperfoff';
|
||||
$instance->phpunit_add_definition($requestid, array(
|
||||
'mode' => cache_store::MODE_REQUEST,
|
||||
'component' => 'phpunit',
|
||||
'area' => 'requestperfoff'
|
||||
));
|
||||
|
||||
$application = cache::make('phpunit', 'applicationperfoff');
|
||||
$session = cache::make('phpunit', 'sessionperfoff');
|
||||
$request = cache::make('phpunit', 'requestperfoff');
|
||||
|
||||
// Check that no stats are recorded for these definitions yet.
|
||||
$stats = cache_helper::get_stats();
|
||||
$this->assertArrayNotHasKey($applicationid, $stats);
|
||||
$this->assertArrayNotHasKey($sessionid, $stats);
|
||||
$this->assertArrayNotHasKey($requestid, $stats);
|
||||
|
||||
// Trigger cache misses, cache sets and cache hits.
|
||||
$this->assertFalse($application->get('missMe'));
|
||||
$this->assertTrue($application->set('setMe', 1));
|
||||
$this->assertEquals(1, $application->get('setMe'));
|
||||
$this->assertFalse($session->get('missMe'));
|
||||
$this->assertTrue($session->set('setMe', 3));
|
||||
$this->assertEquals(3, $session->get('setMe'));
|
||||
$this->assertFalse($request->get('missMe'));
|
||||
$this->assertTrue($request->set('setMe', 4));
|
||||
$this->assertEquals(4, $request->get('setMe'));
|
||||
|
||||
// Check that no stats are being recorded for these definitions.
|
||||
$endstats = cache_helper::get_stats();
|
||||
$this->assertArrayNotHasKey($applicationid, $endstats);
|
||||
$this->assertArrayNotHasKey($sessionid, $endstats);
|
||||
$this->assertArrayNotHasKey($requestid, $endstats);
|
||||
}
|
||||
}
|
||||
|
||||
+1024
-338
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,535 +0,0 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Defines test class to test manage rrule during ical imports.
|
||||
*
|
||||
* @package core_calendar
|
||||
* @category test
|
||||
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_calendar_rrule_manager_testcase extends advanced_testcase {
|
||||
|
||||
/** @var stdClass a dummy event */
|
||||
protected $event;
|
||||
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
protected function setUp() {
|
||||
global $DB, $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setTimezone('Australia/Perth');
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$sub = new stdClass();
|
||||
$sub->url = '';
|
||||
$sub->courseid = 0;
|
||||
$sub->groupid = 0;
|
||||
$sub->userid = $user->id;
|
||||
$sub->pollinterval = 0;
|
||||
$subid = $DB->insert_record('event_subscriptions', $sub, true);
|
||||
|
||||
$event = new stdClass();
|
||||
$event->name = 'Event name';
|
||||
$event->description = '';
|
||||
$event->timestart = 1385913700; // A 2013-12-2 Monday event.
|
||||
$event->timeduration = 3600;
|
||||
$event->uuid = 'uuid';
|
||||
$event->subscriptionid = $subid;
|
||||
$event->userid = $user->id;
|
||||
$event->groupid = 0;
|
||||
$event->courseid = 0;
|
||||
$event->eventtype = 'user';
|
||||
$eventobj = calendar_event::create($event, false);
|
||||
$DB->set_field('event', 'repeatid', $eventobj->id, array('id' => $eventobj->id));
|
||||
$eventobj->repeatid = $eventobj->id;
|
||||
$this->event = $eventobj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test parse_rrule() method.
|
||||
*/
|
||||
public function test_parse_rrule() {
|
||||
|
||||
$rrule = "FREQ=DAILY;COUNT=3;INTERVAL=4;BYSECOND=20,40;BYMINUTE=2,30;BYHOUR=3,4;BYDAY=MO,TH;BYMONTHDAY=20,
|
||||
30;BYYEARDAY=300,-20;BYWEEKNO=22,33;BYMONTH=3,4";
|
||||
$mang = new core_tests_calendar_rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$this->assertEquals(\core_calendar\rrule_manager::FREQ_DAILY, $mang->freq);
|
||||
$this->assertEquals(3, $mang->count);
|
||||
$this->assertEquals(4, $mang->interval);
|
||||
$this->assertEquals(array(20, 40), $mang->bysecond);
|
||||
$this->assertEquals(array(2, 30), $mang->byminute);
|
||||
$this->assertEquals(array(3, 4), $mang->byhour);
|
||||
$this->assertEquals(array('MO', 'TH'), $mang->byday);
|
||||
$this->assertEquals(array(20, 30), $mang->bymonthday);
|
||||
$this->assertEquals(array(300, -20), $mang->byyearday);
|
||||
$this->assertEquals(array(22, 33), $mang->byweekno);
|
||||
$this->assertEquals(array(3, 4), $mang->bymonth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception is thrown for invalid property.
|
||||
*/
|
||||
public function test_parse_rrule_validation() {
|
||||
|
||||
$rrule = "RANDOM=PROPERTY;";
|
||||
$this->setExpectedException('moodle_exception');
|
||||
$mang = new core_tests_calendar_rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception is thrown for invalid frequency.
|
||||
*/
|
||||
public function test_freq_validation() {
|
||||
|
||||
$rrule = "FREQ=RANDOMLY;";
|
||||
$this->setExpectedException('moodle_exception');
|
||||
$mang = new core_tests_calendar_rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test recurrence rules for daily frequency.
|
||||
*/
|
||||
public function test_daily_events() {
|
||||
global $DB;
|
||||
|
||||
$rrule = 'FREQ=DAILY;COUNT=3'; // This should generate 2 child events + 1 parent.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(3, $count);
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + DAYSECS)));
|
||||
$this->assertTrue($result);
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + 2 * DAYSECS)));
|
||||
$this->assertTrue($result);
|
||||
|
||||
$until = $this->event->timestart + DAYSECS * 2;
|
||||
$until = date('Y-m-d', $until);
|
||||
$rrule = "FREQ=DAILY;UNTIL=$until"; // This should generate 1 child event + 1 parent,since by then until bound would be hit.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(2, $count);
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + DAYSECS)));
|
||||
$this->assertTrue($result);
|
||||
|
||||
$rrule = 'FREQ=DAILY;COUNT=3;INTERVAL=3'; // This should generate 2 child events + 1 parent, every 3rd day.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(3, $count);
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + 3 * DAYSECS)));
|
||||
$this->assertTrue($result);
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + 6 * DAYSECS)));
|
||||
$this->assertTrue($result);
|
||||
|
||||
// Forever event. This should generate events for time() + 10 year period, every 300th day.
|
||||
$rrule = 'FREQ=DAILY;INTERVAL=300';
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $time = $this->event->timestart + 300 * DAYSECS * $i) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test recurrence rules for weekly frequency.
|
||||
*/
|
||||
public function test_weekly_events() {
|
||||
global $DB;
|
||||
|
||||
$rrule = 'FREQ=WEEKLY;COUNT=1'; // This should generate 7 events in total, one for each day.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(7, $count);
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + $i * DAYSECS)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// This should generate 4 child event + 1 parent, since by then until bound would be hit.
|
||||
$until = $this->event->timestart + WEEKSECS * 4;
|
||||
$until = date('YmdThis', $until);
|
||||
$rrule = "FREQ=WEEKLY;BYDAY=MO;UNTIL=$until";
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(5, $count);
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + $i * WEEKSECS)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// This should generate 4 events in total every monday and Wednesday of every 3rd week.
|
||||
$rrule = 'FREQ=WEEKLY;INTERVAL=3;BYDAY=MO,WE;COUNT=2';
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(4, $count);
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + 3 * WEEKSECS))); // Monday event.
|
||||
$this->assertTrue($result);
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + 2 * DAYSECS))); // Wednesday event.
|
||||
$this->assertTrue($result);
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($this->event->timestart + 3 * WEEKSECS + 2 * DAYSECS))); // Wednesday event.
|
||||
$this->assertTrue($result);
|
||||
|
||||
// Forever event. This should generate events over time() + 10 year period, every 50th monday.
|
||||
$rrule = 'FREQ=WEEKLY;BYDAY=MO;INTERVAL=50';
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $time = $this->event->timestart + 50 * WEEKSECS * $i) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test recurrence rules for monthly frequency.
|
||||
*/
|
||||
public function test_monthly_events() {
|
||||
global $DB;
|
||||
$rrule = 'FREQ=MONTHLY;COUNT=3;BYMONTHDAY=2'; // This should generate 3 events in total.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(3, $count);
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => (strtotime("+$i month", $this->event->timestart))));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// This much seconds after the start of the day.
|
||||
$offset = $this->event->timestart - mktime(0, 0, 0, date("n", $this->event->timestart), date("j", $this->event->timestart),
|
||||
date("Y", $this->event->timestart));
|
||||
$monthstart = mktime(0, 0, 0, date("n", $this->event->timestart), 1, date("Y", $this->event->timestart));
|
||||
|
||||
$rrule = 'FREQ=MONTHLY;COUNT=3;BYDAY=1MO'; // This should generate 3 events in total, first monday of the month.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(3, $count);
|
||||
$time = strtotime('1 Monday', strtotime("+1 months", $monthstart)) + $offset;
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
|
||||
$this->assertTrue($result);
|
||||
$time = strtotime('1 Monday', strtotime("+2 months", $monthstart)) + $offset;
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
|
||||
$this->assertTrue($result);
|
||||
|
||||
// This should generate 10 child event + 1 parent, since by then until bound would be hit.
|
||||
$until = strtotime('+1 day +10 months', $this->event->timestart);
|
||||
$until = date('YmdThis', $until);
|
||||
$rrule = "FREQ=MONTHLY;BYMONTHDAY=2;UNTIL=$until";
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(11, $count);
|
||||
for ($i = 0; $i < 11; $i++) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => (strtotime("+$i month", $this->event->timestart))));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// This should generate 10 child event + 1 parent, since by then until bound would be hit.
|
||||
$until = strtotime('+1 day +10 months', $this->event->timestart);
|
||||
$until = date('YmdThis', $until);
|
||||
$rrule = "FREQ=MONTHLY;BYDAY=1MO;UNTIL=$until";
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(10, $count);
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$time = strtotime('1 Monday', strtotime("+$i months", $monthstart)) + $offset;
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// This should generate 11 child event + 1 parent, since by then until bound would be hit.
|
||||
$until = strtotime('+10 day +10 months', $this->event->timestart); // 12 oct 2014.
|
||||
$until = date('YmdThis', $until);
|
||||
$rrule = "FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=2,5;UNTIL=$until";
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(12, $count);
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
$moffset = $i * 2;
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => (strtotime("+$moffset month", $this->event->timestart))));
|
||||
$this->assertTrue($result);
|
||||
// Event on the 5th of a month.
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => (strtotime("+3 days +$moffset month", $this->event->timestart))));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// This should generate 11 child event + 1 parent, since by then until bound would be hit.
|
||||
$until = strtotime('+20 day +10 months', $this->event->timestart); // 22 oct 2014.
|
||||
$until = date('YmdTHis', $until);
|
||||
$rrule = "FREQ=MONTHLY;INTERVAL=2;BYDAY=1MO,3WE;UNTIL=$until";
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(12, $count);
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
$moffset = $i * 2;
|
||||
$time = strtotime("+$moffset month", $monthstart);
|
||||
$time2 = strtotime("+1 Monday", $time) + $offset;
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time2));
|
||||
$this->assertTrue($result);
|
||||
$time2 = strtotime("+3 Wednesday", $time) + $offset;
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => $time2)); // Event on the 5th of a month.
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// Forever event. This should generate events over 10 year period, on 2nd of every 12th month.
|
||||
$rrule = 'FREQ=MONTHLY;INTERVAL=12;BYMONTHDAY=2';
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $moffset = $i * 12,
|
||||
$time = strtotime("+$moffset month", $this->event->timestart)) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// Forever event. This should generate 10 child events + 1 parent over 10 year period, every 50th Monday.
|
||||
$rrule = 'FREQ=MONTHLY;BYDAY=1MO;INTERVAL=12';
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(11, $count);
|
||||
for ($i = 0, $moffset = 0, $time = $this->event->timestart; $time < $until; $i++, $moffset = $i * 12) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
$time = strtotime("+$moffset month", $monthstart);
|
||||
$time = strtotime("+1 Monday", $time) + $offset;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test recurrence rules for yearly frequency.
|
||||
*/
|
||||
public function test_yearly_events() {
|
||||
global $DB;
|
||||
|
||||
$rrule = 'FREQ=YEARLY;COUNT=3;BYMONTH=12'; // This should generate 3 events in total.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(3, $count);
|
||||
for ($i = 0, $time = $this->event->timestart; $i < 3; $i++, $time = strtotime("+$i years", $this->event->timestart)) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// Create an event every december, until the time limit is hit.
|
||||
$until = strtotime('+20 day +10 years', $this->event->timestart);
|
||||
$until = date('YmdTHis', $until);
|
||||
$rrule = "FREQ=YEARLY;BYMONTH=12;UNTIL=$until"; // Forever event.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(11, $count);
|
||||
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2,
|
||||
$time = strtotime("+$yoffset years", $this->event->timestart)) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// This should generate 5 events in total, every second year in the month of december.
|
||||
$rrule = 'FREQ=YEARLY;BYMONTH=12;INTERVAL=2;COUNT=5';
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(5, $count);
|
||||
for ($i = 0, $time = $this->event->timestart; $i < 5; $i++, $yoffset = $i * 2,
|
||||
$time = strtotime("+$yoffset years", $this->event->timestart)) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
$rrule = 'FREQ=YEARLY;BYMONTH=12;INTERVAL=2'; // Forever event.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(6, $count);
|
||||
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2,
|
||||
$time = strtotime("+$yoffset years", $this->event->timestart)) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// This much seconds after the start of the day.
|
||||
$offset = $this->event->timestart - mktime(0, 0, 0, date("n", $this->event->timestart), date("j", $this->event->timestart),
|
||||
date("Y", $this->event->timestart));
|
||||
$yearstart = mktime(0, 0, 0, 1, 1, date("Y", $this->event->timestart));
|
||||
|
||||
$rrule = 'FREQ=YEARLY;COUNT=3;BYMONTH=12;BYDAY=1MO'; // This should generate 3 events in total.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(3, $count);
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$time = strtotime("+11 months +$i years", $yearstart);
|
||||
$time = strtotime("+1 Monday", $time) + $offset;
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
// Create an event every december, until the time limit is hit.
|
||||
$until = strtotime('+20 day +10 years', $this->event->timestart);
|
||||
$until = date('YmdTHis', $until);
|
||||
$rrule = "FREQ=YEARLY;BYMONTH=12;UNTIL=$until;BYDAY=1MO";
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(11, $count);
|
||||
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
$time = strtotime("+11 months +$i years", $yearstart);
|
||||
$time = strtotime("+1 Monday", $time) + $offset;
|
||||
}
|
||||
|
||||
// This should generate 5 events in total, every second year in the month of december.
|
||||
$rrule = 'FREQ=YEARLY;BYMONTH=12;INTERVAL=2;COUNT=5;BYDAY=1MO';
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(5, $count);
|
||||
for ($i = $yoffset = 0, $time = $this->event->timestart; $i < 5; $i++, $yoffset = $i * 2) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
$time = strtotime("+11 months +$yoffset years", $yearstart);
|
||||
$time = strtotime("+1 Monday", $time) + $offset;
|
||||
}
|
||||
|
||||
$rrule = 'FREQ=YEARLY;BYMONTH=12;INTERVAL=2;BYDAY=1MO'; // Forever event.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(6, $count);
|
||||
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
$time = strtotime("+11 months +$yoffset years", $yearstart);
|
||||
$time = strtotime("+1 Monday", $time) + $offset;
|
||||
}
|
||||
|
||||
$rrule = 'FREQ=YEARLY;INTERVAL=2'; // Forever event.
|
||||
$mang = new \core_calendar\rrule_manager($rrule);
|
||||
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
|
||||
$mang->parse_rrule();
|
||||
$mang->create_events($this->event);
|
||||
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
|
||||
$this->assertEquals(6, $count);
|
||||
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2) {
|
||||
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
|
||||
'timestart' => ($time)));
|
||||
$this->assertTrue($result);
|
||||
$time = strtotime("+11 months +$yoffset years", $yearstart);
|
||||
$time = strtotime("+1 Monday", $time) + $offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class core_calendar_test_rrule_manager
|
||||
*
|
||||
* Wrapper to access protected vars for testing.
|
||||
*
|
||||
* @package core_calendar
|
||||
* @category test
|
||||
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_tests_calendar_rrule_manager extends \core_calendar\rrule_manager{
|
||||
|
||||
/**
|
||||
* Magic method to get properties.
|
||||
*
|
||||
* @param $prop string property
|
||||
*
|
||||
* @return mixed
|
||||
* @throws coding_exception
|
||||
*/
|
||||
public function __get($prop) {
|
||||
if (property_exists($this, $prop)) {
|
||||
return $this->$prop;
|
||||
}
|
||||
throw new coding_exception('invalidproperty');
|
||||
}
|
||||
}
|
||||
+24
-1
@@ -57,6 +57,12 @@ M.core_comment = {
|
||||
this.view(0);
|
||||
return false;
|
||||
}, this);
|
||||
// Also handle space/enter key.
|
||||
handle.on('key', function(e) {
|
||||
e.preventDefault();
|
||||
this.view(0);
|
||||
return false;
|
||||
}, '13,32', this);
|
||||
}
|
||||
scope.toggle_textarea(false);
|
||||
},
|
||||
@@ -186,7 +192,17 @@ M.core_comment = {
|
||||
val = val.replace('___name___', list[i].fullname);
|
||||
}
|
||||
if (list[i]['delete']||newcmt) {
|
||||
list[i].content = '<div class="comment-delete"><a href="#" id ="comment-delete-'+this.client_id+'-'+list[i].id+'" title="'+M.util.get_string('deletecomment', 'moodle')+'"><img alt="" src="'+M.util.image_url('t/delete', 'core')+'" /></a></div>' + list[i].content;
|
||||
var tokens = {
|
||||
user: list[i].fullname,
|
||||
time: list[i].time
|
||||
};
|
||||
var deleteStr = Y.Escape.html(M.util.get_string('deletecommentbyon', 'moodle', tokens));
|
||||
list[i].content = '<div class="comment-delete">' +
|
||||
'<a href="#" role="button" id ="comment-delete-' + this.client_id + '-' + list[i].id + '"' +
|
||||
' title="' + deleteStr + '">' +
|
||||
'<img alt="' + deleteStr + '" src="' + M.util.image_url('t/delete', 'core') + '" />' +
|
||||
'</a>' +
|
||||
'</div>' + list[i].content;
|
||||
}
|
||||
val = val.replace('___time___', list[i].time);
|
||||
val = val.replace('___picture___', list[i].avatar);
|
||||
@@ -335,6 +351,7 @@ M.core_comment = {
|
||||
);
|
||||
},
|
||||
view: function(page) {
|
||||
var commenttoggler = Y.one('#comment-link-' + this.client_id);
|
||||
var container = Y.one('#comment-ctrl-'+this.client_id);
|
||||
var ta = Y.one('#dlg-content-'+this.client_id);
|
||||
var img = Y.one('#comment-img-'+this.client_id);
|
||||
@@ -351,6 +368,9 @@ M.core_comment = {
|
||||
if (img) {
|
||||
img.set('src', M.util.image_url('t/expanded', 'core'));
|
||||
}
|
||||
if (commenttoggler) {
|
||||
commenttoggler.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
} else {
|
||||
// hide
|
||||
container.setStyle('display', 'none');
|
||||
@@ -364,6 +384,9 @@ M.core_comment = {
|
||||
if (ta) {
|
||||
ta.set('value','');
|
||||
}
|
||||
if (commenttoggler) {
|
||||
commenttoggler.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
}
|
||||
if (ta) {
|
||||
//toggle_textarea.apply(ta, [false]);
|
||||
|
||||
+8
-2
@@ -263,7 +263,7 @@ class comment {
|
||||
'comments',
|
||||
'commentscount',
|
||||
'commentsrequirelogin',
|
||||
'deletecomment',
|
||||
'deletecommentbyon',
|
||||
),
|
||||
'moodle'
|
||||
);
|
||||
@@ -460,7 +460,13 @@ class comment {
|
||||
} else {
|
||||
$collapsedimage= 't/collapsed';
|
||||
}
|
||||
$html .= html_writer::start_tag('a', array('class' => 'comment-link', 'id' => 'comment-link-'.$this->cid, 'href' => '#'));
|
||||
$html .= html_writer::start_tag('a', array(
|
||||
'class' => 'comment-link',
|
||||
'id' => 'comment-link-'.$this->cid,
|
||||
'href' => '#',
|
||||
'role' => 'button',
|
||||
'aria-expanded' => 'false')
|
||||
);
|
||||
$html .= html_writer::empty_tag('img', array('id' => 'comment-img-'.$this->cid, 'src' => $OUTPUT->pix_url($collapsedimage), 'alt' => $this->linktext, 'title' => $this->linktext));
|
||||
$html .= html_writer::tag('span', $this->linktext.' '.$countstring, array('id' => 'comment-link-text-'.$this->cid));
|
||||
$html .= html_writer::end_tag('a');
|
||||
|
||||
@@ -68,7 +68,7 @@ class competency extends persistent {
|
||||
),
|
||||
'description' => array(
|
||||
'default' => '',
|
||||
'type' => PARAM_RAW
|
||||
'type' => PARAM_CLEANHTML
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
'choices' => array(FORMAT_HTML, FORMAT_MOODLE, FORMAT_PLAIN, FORMAT_MARKDOWN),
|
||||
@@ -676,7 +676,8 @@ class competency extends persistent {
|
||||
public static function share_same_framework(array $ids) {
|
||||
global $DB;
|
||||
list($insql, $params) = $DB->get_in_or_equal($ids);
|
||||
return $DB->count_records_select(self::TABLE, "id $insql", $params, "COUNT(DISTINCT(competencyframeworkid))") == 1;
|
||||
$sql = "SELECT COUNT('x') FROM (SELECT DISTINCT(competencyframeworkid) FROM {" . self::TABLE . "} WHERE id {$insql}) f";
|
||||
return $DB->count_records_sql($sql, $params) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,7 +90,7 @@ class competency_framework extends persistent {
|
||||
'type' => PARAM_RAW
|
||||
),
|
||||
'description' => array(
|
||||
'type' => PARAM_RAW,
|
||||
'type' => PARAM_CLEANHTML,
|
||||
'default' => ''
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
|
||||
+3
-2
@@ -334,7 +334,8 @@ abstract class exporter {
|
||||
*/
|
||||
final protected static function get_format_field($definitions, $property) {
|
||||
$formatproperty = $property . 'format';
|
||||
if ($definitions[$property]['type'] == PARAM_RAW && isset($definitions[$formatproperty])
|
||||
if (($definitions[$property]['type'] == PARAM_RAW || $definitions[$property]['type'] == PARAM_CLEANHTML)
|
||||
&& isset($definitions[$formatproperty])
|
||||
&& $definitions[$formatproperty]['type'] == PARAM_INT) {
|
||||
return $formatproperty;
|
||||
}
|
||||
@@ -451,7 +452,7 @@ abstract class exporter {
|
||||
// This is a nested array of more properties.
|
||||
$thisvalue = self::get_read_structure_from_properties($type, $proprequired, $propdefault);
|
||||
} else {
|
||||
if ($definition['type'] == PARAM_TEXT) {
|
||||
if ($definition['type'] == PARAM_TEXT || $definition['type'] == PARAM_CLEANHTML) {
|
||||
// PARAM_TEXT always becomes PARAM_RAW because filters may be applied.
|
||||
$type = PARAM_RAW;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,8 @@ abstract class persistent {
|
||||
$formatted = array();
|
||||
foreach ($properties as $property => $definition) {
|
||||
$propertyformat = $property . 'format';
|
||||
if ($definition['type'] == PARAM_RAW && array_key_exists($propertyformat, $properties)
|
||||
if (($definition['type'] == PARAM_RAW || $definition['type'] == PARAM_CLEANHTML)
|
||||
&& array_key_exists($propertyformat, $properties)
|
||||
&& $properties[$propertyformat]['type'] == PARAM_INT) {
|
||||
$formatted[$property] = $propertyformat;
|
||||
}
|
||||
@@ -616,6 +617,10 @@ abstract class persistent {
|
||||
// Validate_param() does not like false with PARAM_BOOL, better to convert it to int.
|
||||
$value = 0;
|
||||
}
|
||||
if ($definition['type'] === PARAM_CLEANHTML) {
|
||||
// We silently clean for this type. It may introduce changes even to valid data.
|
||||
$value = clean_param($value, PARAM_CLEANHTML);
|
||||
}
|
||||
validate_param($value, $definition['type'], $definition['null']);
|
||||
} catch (invalid_parameter_exception $e) {
|
||||
$errors[$property] = static::get_property_error_message($property);
|
||||
|
||||
@@ -71,7 +71,7 @@ class plan extends persistent {
|
||||
'type' => PARAM_TEXT,
|
||||
),
|
||||
'description' => array(
|
||||
'type' => PARAM_RAW,
|
||||
'type' => PARAM_CLEANHTML,
|
||||
'default' => ''
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
|
||||
@@ -53,7 +53,7 @@ class template extends persistent {
|
||||
),
|
||||
'description' => array(
|
||||
'default' => '',
|
||||
'type' => PARAM_RAW,
|
||||
'type' => PARAM_CLEANHTML,
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
'choices' => array(FORMAT_HTML, FORMAT_MOODLE, FORMAT_PLAIN, FORMAT_MARKDOWN),
|
||||
|
||||
@@ -53,7 +53,7 @@ class user_evidence extends persistent {
|
||||
'type' => PARAM_TEXT
|
||||
),
|
||||
'description' => array(
|
||||
'type' => PARAM_RAW,
|
||||
'type' => PARAM_CLEANHTML,
|
||||
'default' => '',
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
|
||||
@@ -288,6 +288,7 @@ function core_competency_pluginfile($course, $cm, $context, $filearea, $args, $f
|
||||
if ($filearea == 'userevidence' && $context->contextlevel == CONTEXT_USER) {
|
||||
if (user_evidence::can_read_user($context->instanceid)) {
|
||||
$file = $fs->get_file($context->id, 'core_competency', $filearea, $itemid, $filepath, $filename);
|
||||
$forcedownload = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,12 +121,13 @@ class behat_completion extends behat_base {
|
||||
public function activity_marked_as_complete($activityname, $activitytype, $completiontype) {
|
||||
if ($completiontype == "manual") {
|
||||
$imgalttext = get_string("completion-alt-manual-y", 'core_completion', $activityname);
|
||||
$xpathtocheck = "//input[@type='image'][contains(@alt, '$imgalttext')]";
|
||||
} else {
|
||||
$imgalttext = get_string("completion-alt-auto-y", 'core_completion', $activityname);
|
||||
$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
|
||||
}
|
||||
$csselementforactivitytype = "li.modtype_".strtolower($activitytype);
|
||||
|
||||
$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
|
||||
$this->execute("behat_general::should_exist_in_the",
|
||||
array($xpathtocheck, "xpath_element", $csselementforactivitytype, "css_element")
|
||||
);
|
||||
@@ -141,12 +142,13 @@ class behat_completion extends behat_base {
|
||||
public function activity_marked_as_not_complete($activityname, $activitytype, $completiontype) {
|
||||
if ($completiontype == "manual") {
|
||||
$imgalttext = get_string("completion-alt-manual-n", 'core_completion', $activityname);
|
||||
$xpathtocheck = "//input[@type='image'][contains(@alt, '$imgalttext')]";
|
||||
} else {
|
||||
$imgalttext = get_string("completion-alt-auto-n", 'core_completion', $activityname);
|
||||
$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
|
||||
}
|
||||
$csselementforactivitytype = "li.modtype_".strtolower($activitytype);
|
||||
|
||||
$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
|
||||
$this->execute("behat_general::should_exist_in_the",
|
||||
array($xpathtocheck, "xpath_element", $csselementforactivitytype, "css_element")
|
||||
);
|
||||
|
||||
@@ -25,15 +25,16 @@ Feature: Allow students to manually mark an activity as complete
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
And I press "Save and display"
|
||||
When I add a "Forum" to section "1" and I fill the form with:
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
Then "Student First" user has not completed "Test forum name" activity
|
||||
And "Student First" user has not completed "Test forum name" activity
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I press "Mark as complete: Test forum name"
|
||||
When I press "Mark as complete: Test forum name"
|
||||
Then the "Test forum name" "forum" activity with "manual" completion should be marked as complete
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on site homepage
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@
|
||||
"phpunit/dbUnit": "1.4.1",
|
||||
"sebastian/environment": "1.3.7",
|
||||
"sebastian/recursion-context": "1.0.2",
|
||||
"moodlehq/behat-extension": "3.31.5"
|
||||
"moodlehq/behat-extension": "3.31.6"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+137
-135
@@ -4,8 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "718062e279632fdee27a7d1af74bf0db",
|
||||
"content-hash": "795038882ba93b89ab58b678ce582f87",
|
||||
"content-hash": "be501c2af95e3e00762b8cf30d957b2b",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
@@ -86,7 +85,7 @@
|
||||
"symfony",
|
||||
"testing"
|
||||
],
|
||||
"time": "2016-03-28 07:04:45"
|
||||
"time": "2016-03-28T07:04:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "behat/gherkin",
|
||||
@@ -145,7 +144,7 @@
|
||||
"gherkin",
|
||||
"parser"
|
||||
],
|
||||
"time": "2016-10-30 11:50:56"
|
||||
"time": "2016-10-30T11:50:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "behat/mink",
|
||||
@@ -203,7 +202,7 @@
|
||||
"testing",
|
||||
"web"
|
||||
],
|
||||
"time": "2016-03-05 08:26:18"
|
||||
"time": "2016-03-05T08:26:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "behat/mink-browserkit-driver",
|
||||
@@ -259,7 +258,7 @@
|
||||
"browser",
|
||||
"testing"
|
||||
],
|
||||
"time": "2016-03-05 08:59:47"
|
||||
"time": "2016-03-05T08:59:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "behat/mink-extension",
|
||||
@@ -318,7 +317,7 @@
|
||||
"test",
|
||||
"web"
|
||||
],
|
||||
"time": "2016-02-15 07:55:18"
|
||||
"time": "2016-02-15T07:55:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "behat/mink-goutte-driver",
|
||||
@@ -373,7 +372,7 @@
|
||||
"headless",
|
||||
"testing"
|
||||
],
|
||||
"time": "2016-03-05 09:04:22"
|
||||
"time": "2016-03-05T09:04:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "behat/mink-selenium2-driver",
|
||||
@@ -434,7 +433,7 @@
|
||||
"testing",
|
||||
"webdriver"
|
||||
],
|
||||
"time": "2016-03-05 09:10:18"
|
||||
"time": "2016-03-05T09:10:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "behat/transliterator",
|
||||
@@ -474,7 +473,7 @@
|
||||
"slug",
|
||||
"transliterator"
|
||||
],
|
||||
"time": "2015-09-28 16:26:35"
|
||||
"time": "2015-09-28T16:26:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
@@ -528,7 +527,7 @@
|
||||
"constructor",
|
||||
"instantiate"
|
||||
],
|
||||
"time": "2015-06-14 21:17:01"
|
||||
"time": "2015-06-14T21:17:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fabpot/goutte",
|
||||
@@ -577,7 +576,7 @@
|
||||
"keywords": [
|
||||
"scraper"
|
||||
],
|
||||
"time": "2015-05-05 21:14:57"
|
||||
"time": "2015-05-05T21:14:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
@@ -629,7 +628,7 @@
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2016-07-15 19:28:39"
|
||||
"time": "2016-07-15T19:28:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/ringphp",
|
||||
@@ -680,7 +679,7 @@
|
||||
}
|
||||
],
|
||||
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
|
||||
"time": "2015-05-20 03:37:09"
|
||||
"time": "2015-05-20T03:37:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/streams",
|
||||
@@ -730,7 +729,7 @@
|
||||
"Guzzle",
|
||||
"stream"
|
||||
],
|
||||
"time": "2014-10-12 19:18:40"
|
||||
"time": "2014-10-12T19:18:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "instaclick/php-webdriver",
|
||||
@@ -788,20 +787,20 @@
|
||||
"webdriver",
|
||||
"webtest"
|
||||
],
|
||||
"time": "2015-06-15 20:19:33"
|
||||
"time": "2015-06-15T20:19:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "moodlehq/behat-extension",
|
||||
"version": "v3.31.5",
|
||||
"version": "v3.31.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/moodlehq/moodle-behat-extension.git",
|
||||
"reference": "1f0393a5b3505e7e95c5708368ec7ea15e0910e0"
|
||||
"reference": "ae6be43e359fb36f825da1f248b727d7a46a94ed"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/moodlehq/moodle-behat-extension/zipball/1f0393a5b3505e7e95c5708368ec7ea15e0910e0",
|
||||
"reference": "1f0393a5b3505e7e95c5708368ec7ea15e0910e0",
|
||||
"url": "https://api.github.com/repos/moodlehq/moodle-behat-extension/zipball/ae6be43e359fb36f825da1f248b727d7a46a94ed",
|
||||
"reference": "ae6be43e359fb36f825da1f248b727d7a46a94ed",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -837,7 +836,7 @@
|
||||
"Behat",
|
||||
"moodle"
|
||||
],
|
||||
"time": "2016-11-10 23:37:45"
|
||||
"time": "2017-01-19T00:08:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
@@ -886,20 +885,20 @@
|
||||
"email": "mike.vanriel@naenius.com"
|
||||
}
|
||||
],
|
||||
"time": "2015-02-03 12:10:50"
|
||||
"time": "2015-02-03T12:10:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
"version": "v1.6.1",
|
||||
"version": "v1.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/prophecy.git",
|
||||
"reference": "58a8137754bc24b25740d4281399a4a3596058e0"
|
||||
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0",
|
||||
"reference": "58a8137754bc24b25740d4281399a4a3596058e0",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb",
|
||||
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -907,10 +906,11 @@
|
||||
"php": "^5.3|^7.0",
|
||||
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
|
||||
"sebastian/comparator": "^1.1",
|
||||
"sebastian/recursion-context": "^1.0"
|
||||
"sebastian/recursion-context": "^1.0|^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "^2.0"
|
||||
"phpspec/phpspec": "^2.0",
|
||||
"phpunit/phpunit": "^4.8 || ^5.6.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -948,7 +948,7 @@
|
||||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2016-06-07 08:13:47"
|
||||
"time": "2016-11-21T14:58:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/dbunit",
|
||||
@@ -1007,7 +1007,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-08-07 04:57:38"
|
||||
"time": "2015-08-07T04:57:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@@ -1069,20 +1069,20 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-10-06 15:47:00"
|
||||
"time": "2015-10-06T15:47:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
||||
"reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
|
||||
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
|
||||
"reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
|
||||
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1116,7 +1116,7 @@
|
||||
"filesystem",
|
||||
"iterator"
|
||||
],
|
||||
"time": "2015-06-21 13:08:43"
|
||||
"time": "2016-10-03T07:40:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-text-template",
|
||||
@@ -1157,7 +1157,7 @@
|
||||
"keywords": [
|
||||
"template"
|
||||
],
|
||||
"time": "2015-06-21 13:50:34"
|
||||
"time": "2015-06-21T13:50:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-timer",
|
||||
@@ -1201,20 +1201,20 @@
|
||||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"time": "2016-05-12 18:03:57"
|
||||
"time": "2016-05-12T18:03:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-token-stream",
|
||||
"version": "1.4.8",
|
||||
"version": "1.4.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
||||
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
|
||||
"reference": "3b402f65a4cc90abf6e1104e388b896ce209631b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
|
||||
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b",
|
||||
"reference": "3b402f65a4cc90abf6e1104e388b896ce209631b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1250,7 +1250,7 @@
|
||||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"time": "2015-09-15 10:49:45"
|
||||
"time": "2016-11-15T14:06:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
@@ -1322,7 +1322,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2016-07-21 06:48:14"
|
||||
"time": "2016-07-21T06:48:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
@@ -1378,7 +1378,7 @@
|
||||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-10-02 06:51:40"
|
||||
"time": "2015-10-02T06:51:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
@@ -1425,31 +1425,26 @@
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10 12:19:37"
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/promise",
|
||||
"version": "v2.4.1",
|
||||
"version": "v2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/promise.git",
|
||||
"reference": "8025426794f1944de806618671d4fa476dc7626f"
|
||||
"reference": "2760f3898b7e931aa71153852dcd48a75c9b95db"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/promise/zipball/8025426794f1944de806618671d4fa476dc7626f",
|
||||
"reference": "8025426794f1944de806618671d4fa476dc7626f",
|
||||
"url": "https://api.github.com/repos/reactphp/promise/zipball/2760f3898b7e931aa71153852dcd48a75c9b95db",
|
||||
"reference": "2760f3898b7e931aa71153852dcd48a75c9b95db",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\Promise\\": "src/"
|
||||
@@ -1469,26 +1464,30 @@
|
||||
}
|
||||
],
|
||||
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
|
||||
"time": "2016-05-03 17:50:52"
|
||||
"keywords": [
|
||||
"promise",
|
||||
"promises"
|
||||
],
|
||||
"time": "2016-12-22T14:09:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
|
||||
"reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
|
||||
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f",
|
||||
"reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"sebastian/diff": "~1.2",
|
||||
"sebastian/exporter": "~1.2"
|
||||
"sebastian/exporter": "~1.2 || ~2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
@@ -1533,7 +1532,7 @@
|
||||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"time": "2015-07-26 15:48:44"
|
||||
"time": "2016-11-19T09:18:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
@@ -1585,7 +1584,7 @@
|
||||
"keywords": [
|
||||
"diff"
|
||||
],
|
||||
"time": "2015-12-08 07:14:41"
|
||||
"time": "2015-12-08T07:14:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
@@ -1635,7 +1634,7 @@
|
||||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"time": "2016-05-17 03:18:57"
|
||||
"time": "2016-05-17T03:18:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
@@ -1702,7 +1701,7 @@
|
||||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2016-06-17 09:04:28"
|
||||
"time": "2016-06-17T09:04:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
@@ -1753,7 +1752,7 @@
|
||||
"keywords": [
|
||||
"global state"
|
||||
],
|
||||
"time": "2015-10-12 03:26:01"
|
||||
"time": "2015-10-12T03:26:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
@@ -1806,7 +1805,7 @@
|
||||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"time": "2015-11-11 19:50:13"
|
||||
"time": "2015-11-11T19:50:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
@@ -1841,20 +1840,20 @@
|
||||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"time": "2015-06-21 13:59:46"
|
||||
"time": "2015-06-21T13:59:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/browser-kit.git",
|
||||
"reference": "165bf6d1e72cd72f2fe170a070aa2a1f17f2d744"
|
||||
"reference": "d2a5de15c8341a470a66becf4597bc675686a72b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/165bf6d1e72cd72f2fe170a070aa2a1f17f2d744",
|
||||
"reference": "165bf6d1e72cd72f2fe170a070aa2a1f17f2d744",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/d2a5de15c8341a470a66becf4597bc675686a72b",
|
||||
"reference": "d2a5de15c8341a470a66becf4597bc675686a72b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1898,20 +1897,20 @@
|
||||
],
|
||||
"description": "Symfony BrowserKit Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-09-06 10:55:00"
|
||||
"time": "2017-01-02T20:30:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/class-loader",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/class-loader.git",
|
||||
"reference": "fb50892408036f9f431b563aac51a3f2f0087e81"
|
||||
"reference": "7c46951128f7169cbece2c303fba4a9eb35cbe68"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/class-loader/zipball/fb50892408036f9f431b563aac51a3f2f0087e81",
|
||||
"reference": "fb50892408036f9f431b563aac51a3f2f0087e81",
|
||||
"url": "https://api.github.com/repos/symfony/class-loader/zipball/7c46951128f7169cbece2c303fba4a9eb35cbe68",
|
||||
"reference": "7c46951128f7169cbece2c303fba4a9eb35cbe68",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1951,26 +1950,29 @@
|
||||
],
|
||||
"description": "Symfony ClassLoader Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-09-06 23:19:39"
|
||||
"time": "2017-01-10T14:03:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/config.git",
|
||||
"reference": "f8b1922bbda9d2ac86aecd649399040bce849fde"
|
||||
"reference": "4537f2413348fe271c2c4b09da219ed615d79f9c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/config/zipball/f8b1922bbda9d2ac86aecd649399040bce849fde",
|
||||
"reference": "f8b1922bbda9d2ac86aecd649399040bce849fde",
|
||||
"url": "https://api.github.com/repos/symfony/config/zipball/4537f2413348fe271c2c4b09da219ed615d79f9c",
|
||||
"reference": "4537f2413348fe271c2c4b09da219ed615d79f9c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9",
|
||||
"symfony/filesystem": "~2.3|~3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/yaml": "~2.7|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/yaml": "To use the yaml reference dumper"
|
||||
},
|
||||
@@ -2004,20 +2006,20 @@
|
||||
],
|
||||
"description": "Symfony Config Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-09-14 20:31:12"
|
||||
"time": "2017-01-02T20:30:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "7350016c8abcab897046f1aead2b766b84d3eff8"
|
||||
"reference": "2e18b8903d9c498ba02e1dfa73f64d4894bb6912"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/7350016c8abcab897046f1aead2b766b84d3eff8",
|
||||
"reference": "7350016c8abcab897046f1aead2b766b84d3eff8",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/2e18b8903d9c498ba02e1dfa73f64d4894bb6912",
|
||||
"reference": "2e18b8903d9c498ba02e1dfa73f64d4894bb6912",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2065,20 +2067,20 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-10-06 01:43:09"
|
||||
"time": "2017-01-08T20:43:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "71c8c3a04c126300c37089b1baa7c6322dfb845f"
|
||||
"reference": "f45daea42232d9ca5cf561ec64f0d4aea820877f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/71c8c3a04c126300c37089b1baa7c6322dfb845f",
|
||||
"reference": "71c8c3a04c126300c37089b1baa7c6322dfb845f",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/f45daea42232d9ca5cf561ec64f0d4aea820877f",
|
||||
"reference": "f45daea42232d9ca5cf561ec64f0d4aea820877f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2118,20 +2120,20 @@
|
||||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-09-06 10:55:00"
|
||||
"time": "2017-01-02T20:30:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "8c29235936a47473af16fb91c7c4b7b193c5693c"
|
||||
"reference": "567681e2c4e5431704e884e4be25a95fd900770f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/8c29235936a47473af16fb91c7c4b7b193c5693c",
|
||||
"reference": "8c29235936a47473af16fb91c7c4b7b193c5693c",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/567681e2c4e5431704e884e4be25a95fd900770f",
|
||||
"reference": "567681e2c4e5431704e884e4be25a95fd900770f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2175,20 +2177,20 @@
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-09-06 10:55:00"
|
||||
"time": "2017-01-02T20:30:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dependency-injection.git",
|
||||
"reference": "3d61c765daa1a5832f1d7c767f48886b8d8ea64c"
|
||||
"reference": "b75356611675364607d697f314850d9d870a84aa"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/3d61c765daa1a5832f1d7c767f48886b8d8ea64c",
|
||||
"reference": "3d61c765daa1a5832f1d7c767f48886b8d8ea64c",
|
||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b75356611675364607d697f314850d9d870a84aa",
|
||||
"reference": "b75356611675364607d697f314850d9d870a84aa",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2238,20 +2240,20 @@
|
||||
],
|
||||
"description": "Symfony DependencyInjection Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-10-24 15:52:36"
|
||||
"time": "2017-01-10T14:27:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4"
|
||||
"reference": "52cc211afa9458c0a54c478010a55f44892c1c02"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4",
|
||||
"reference": "a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/52cc211afa9458c0a54c478010a55f44892c1c02",
|
||||
"reference": "52cc211afa9458c0a54c478010a55f44892c1c02",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2294,20 +2296,20 @@
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-10-18 15:35:45"
|
||||
"time": "2017-01-02T20:30:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "25c576abd4e0f212e678fe8b2bd9a9a98c7ea934"
|
||||
"reference": "74877977f90fb9c3e46378d5764217c55f32df34"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/25c576abd4e0f212e678fe8b2bd9a9a98c7ea934",
|
||||
"reference": "25c576abd4e0f212e678fe8b2bd9a9a98c7ea934",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74877977f90fb9c3e46378d5764217c55f32df34",
|
||||
"reference": "74877977f90fb9c3e46378d5764217c55f32df34",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2354,20 +2356,20 @@
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-10-13 01:43:15"
|
||||
"time": "2017-01-02T20:30:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "a3784111af9f95f102b6411548376e1ae7c93898"
|
||||
"reference": "5b77d49ab76e5b12743b359ef4b4a712e6f5360d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a3784111af9f95f102b6411548376e1ae7c93898",
|
||||
"reference": "a3784111af9f95f102b6411548376e1ae7c93898",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/5b77d49ab76e5b12743b359ef4b4a712e6f5360d",
|
||||
"reference": "5b77d49ab76e5b12743b359ef4b4a712e6f5360d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2403,7 +2405,7 @@
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-10-18 04:28:30"
|
||||
"time": "2017-01-08T20:43:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-apcu",
|
||||
@@ -2456,7 +2458,7 @@
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2016-11-14 01:06:16"
|
||||
"time": "2016-11-14T01:06:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
@@ -2515,20 +2517,20 @@
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2016-11-14 01:06:16"
|
||||
"time": "2016-11-14T01:06:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f"
|
||||
"reference": "ebb3c2abe0940a703f08e0cbe373f62d97d40231"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f",
|
||||
"reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/ebb3c2abe0940a703f08e0cbe373f62d97d40231",
|
||||
"reference": "ebb3c2abe0940a703f08e0cbe373f62d97d40231",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2564,20 +2566,20 @@
|
||||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-09-29 14:03:54"
|
||||
"time": "2017-01-02T20:30:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "cca6ff892355876534b01a927f789bac9601c935"
|
||||
"reference": "b4ac4a393f6970cc157fba17be537380de396a86"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/cca6ff892355876534b01a927f789bac9601c935",
|
||||
"reference": "cca6ff892355876534b01a927f789bac9601c935",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/b4ac4a393f6970cc157fba17be537380de396a86",
|
||||
"reference": "b4ac4a393f6970cc157fba17be537380de396a86",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2628,20 +2630,20 @@
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-10-18 04:28:30"
|
||||
"time": "2017-01-02T20:30:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v2.8.13",
|
||||
"version": "v2.8.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "396784cd06b91f3db576f248f2402d547a077787"
|
||||
"reference": "dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/396784cd06b91f3db576f248f2402d547a077787",
|
||||
"reference": "396784cd06b91f3db576f248f2402d547a077787",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2",
|
||||
"reference": "dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2677,7 +2679,7 @@
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-10-21 20:59:10"
|
||||
"time": "2017-01-03T13:49:52+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
||||
@@ -59,6 +59,13 @@ $CFG->dboptions = array(
|
||||
'dbport' => '', // the TCP port number to use when connecting
|
||||
// to the server. keep empty string for the
|
||||
// default port
|
||||
'dbcollation' => 'utf8mb4_unicode_ci', // MySQL has partial and full UTF-8
|
||||
// support. If you wish to use partial UTF-8
|
||||
// (three bytes) then set this option to
|
||||
// 'utf8_unicode_ci', otherwise this option
|
||||
// can be removed for MySQL (by default it will
|
||||
// use 'utf8mb4_unicode_ci'. This option should
|
||||
// be removed for all other databases.
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -774,6 +774,10 @@ M.course_dndupload = {
|
||||
resel.li.outerHTML = unescape(resel.li.outerHTML);
|
||||
}
|
||||
self.add_editing(result.elementid);
|
||||
// Fire the content updated event.
|
||||
require(['core/event', 'jquery'], function(event, $) {
|
||||
event.notifyFilterContentUpdated($(result.fullcontent));
|
||||
});
|
||||
} else {
|
||||
// Error - remove the dummy element
|
||||
resel.parent.removeChild(resel.li);
|
||||
|
||||
@@ -427,7 +427,9 @@ class core_course_external extends external_api {
|
||||
$exceptionparam->courseid = $course->id;
|
||||
throw new moodle_exception('errorcoursecontextnotvalid', 'webservice', '', $exceptionparam);
|
||||
}
|
||||
require_capability('moodle/course:view', $context);
|
||||
if ($course->id != SITEID) {
|
||||
require_capability('moodle/course:view', $context);
|
||||
}
|
||||
|
||||
$courseinfo = array();
|
||||
$courseinfo['id'] = $course->id;
|
||||
|
||||
@@ -678,7 +678,9 @@ abstract class format_base {
|
||||
if (isset($option['type'])) {
|
||||
$mform->setType($optionname, $option['type']);
|
||||
}
|
||||
if (is_null($mform->getElementValue($optionname)) && isset($option['default'])) {
|
||||
if (isset($option['default']) && !array_key_exists($optionname, $mform->_defaultValues)) {
|
||||
// Set defaults for the elements in the form.
|
||||
// Since we call this method after set_data() make sure that we don't override what was already set.
|
||||
$mform->setDefault($optionname, $option['default']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,7 @@ Feature: Browse course list and return back from enrolment page
|
||||
@javascript
|
||||
Scenario: A user can return to the previous page from enrolment page by clicking navigation links
|
||||
When I log in as "user2"
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
And I open my profile in edit mode
|
||||
And I expand "Courses" node
|
||||
And I expand "Sample category" node
|
||||
And I follow "Course 1"
|
||||
|
||||
@@ -2016,7 +2016,7 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
|
||||
// Create the course with sections.
|
||||
$course = $this->getDataGenerator()->create_course(array('numsections' => 10), array('createsections' => true));
|
||||
$sections = $DB->get_records('course_sections', array('course' => $course->id));
|
||||
$sections = $DB->get_records('course_sections', array('course' => $course->id), 'section');
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$section = array_pop($sections);
|
||||
course_delete_section($course, $section);
|
||||
|
||||
@@ -462,7 +462,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals($courseinfo->numsections, $course3options['numsections']);
|
||||
$this->assertEquals($courseinfo->coursedisplay, $course3options['coursedisplay']);
|
||||
} else {
|
||||
throw moodle_exception('Unexpected shortname');
|
||||
throw new moodle_exception('Unexpected shortname');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,6 +619,32 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals($DB->count_records('course'), count($courses));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get_courses without capability
|
||||
*/
|
||||
public function test_get_courses_without_capability() {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
$this->setUser($this->getDataGenerator()->create_user());
|
||||
|
||||
// No permissions are required to get the site course.
|
||||
$courses = core_course_external::get_courses(array('ids' => [SITEID]));
|
||||
$courses = external_api::clean_returnvalue(core_course_external::get_courses_returns(), $courses);
|
||||
|
||||
$this->assertEquals(1, count($courses));
|
||||
$this->assertEquals('PHPUnit test site', $courses[0]['fullname']);
|
||||
$this->assertEquals('site', $courses[0]['format']);
|
||||
|
||||
// Requesting course without being enrolled or capability to view it will throw an exception.
|
||||
try {
|
||||
core_course_external::get_courses(array('ids' => [$course1->id]));
|
||||
$this->fail('Exception expected');
|
||||
} catch (moodle_exception $e) {
|
||||
$this->assertEquals(1, preg_match('/Course or activity not accessible. \(Not enrolled\)/', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test search_courses
|
||||
*/
|
||||
@@ -1100,7 +1126,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals(0, $courseinfo->newsitems);
|
||||
$this->assertEquals(FORMAT_MOODLE, $courseinfo->summaryformat);
|
||||
} else {
|
||||
throw moodle_exception('Unexpected shortname');
|
||||
throw new moodle_exception('Unexpected shortname');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ $string['course_summary'] = 'Optional: LDAP attribute to get the summary from';
|
||||
$string['course_summary_key'] = 'Summary';
|
||||
$string['course_summary_updateonsync'] = 'Update summary during synchronization script';
|
||||
$string['course_summary_updateonsync_key'] = 'Update summary';
|
||||
$string['createcourseextid'] = 'CREATE User enrolled to a nonexistant course \'{$a->courseextid}\'';
|
||||
$string['createnotcourseextid'] = 'User enrolled to a nonexistant course \'{$a->courseextid}\'';
|
||||
$string['createcourseextid'] = 'CREATE User enrolled to a non-existing course \'{$a->courseextid}\'';
|
||||
$string['createnotcourseextid'] = 'User enrolled to a non-existing course \'{$a->courseextid}\'';
|
||||
$string['creatingcourse'] = 'Creating course \'{$a}\'...';
|
||||
$string['duplicateshortname'] = "Course creation failed. Duplicate short name. Skipping course with idnumber '{\$a->idnumber}'...";
|
||||
$string['editlock'] = 'Lock value';
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ class enrol_ldap_plugin extends enrol_plugin {
|
||||
*/
|
||||
public function can_hide_show_instance($instance) {
|
||||
$context = context_course::instance($instance->courseid);
|
||||
return has_capability('enrol/ldap:config', $context);
|
||||
return has_capability('enrol/ldap:manage', $context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,9 +80,10 @@ switch ($action) {
|
||||
} else {
|
||||
$useroptions['link'] = false;
|
||||
}
|
||||
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
|
||||
foreach ($outcome->response['users'] as &$user) {
|
||||
$user->picture = $OUTPUT->user_picture($user, $useroptions);
|
||||
$user->fullname = fullname($user);
|
||||
$user->fullname = fullname($user, $viewfullnames);
|
||||
$fieldvalues = array();
|
||||
foreach ($extrafields as $field) {
|
||||
$fieldvalues[] = s($user->{$field});
|
||||
|
||||
@@ -37,6 +37,7 @@ $context = context_course::instance($course->id, MUST_EXIST);
|
||||
require_login($course);
|
||||
$canenrol = has_capability('enrol/manual:enrol', $context);
|
||||
$canunenrol = has_capability('enrol/manual:unenrol', $context);
|
||||
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
|
||||
|
||||
// Note: manage capability not used here because it is used for editing
|
||||
// of existing enrolments which is not possible here.
|
||||
@@ -74,7 +75,9 @@ navigation_node::override_active_url(new moodle_url('/enrol/users.php', array('i
|
||||
$options = array('enrolid' => $enrolid, 'accesscontext' => $context);
|
||||
|
||||
$potentialuserselector = new enrol_manual_potential_participant('addselect', $options);
|
||||
$potentialuserselector->viewfullnames = $viewfullnames;
|
||||
$currentuserselector = new enrol_manual_current_participant('removeselect', $options);
|
||||
$currentuserselector->viewfullnames = $viewfullnames;
|
||||
|
||||
// Build the list of options for the enrolment period dropdown.
|
||||
$unlimitedperiod = get_string('unlimited');
|
||||
|
||||
@@ -280,6 +280,62 @@ class core_enrollib_testcase extends advanced_testcase {
|
||||
$this->assertEquals($sharedcourse->id, $course1->id);
|
||||
}
|
||||
|
||||
public function test_enrol_get_shared_courses_different_methods() {
|
||||
global $DB, $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/enrol/self/externallib.php');
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
$user3 = $this->getDataGenerator()->create_user();
|
||||
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
|
||||
// Enrol user1 and user2 in course1 with a different enrolment methode.
|
||||
// Add self enrolment method for course1.
|
||||
$selfplugin = enrol_get_plugin('self');
|
||||
$this->assertNotEmpty($selfplugin);
|
||||
|
||||
$studentrole = $DB->get_record('role', array('shortname' => 'student'));
|
||||
$this->assertNotEmpty($studentrole);
|
||||
|
||||
$instance1id = $selfplugin->add_instance($course1, array('status' => ENROL_INSTANCE_ENABLED,
|
||||
'name' => 'Test instance 1',
|
||||
'customint6' => 1,
|
||||
'roleid' => $studentrole->id));
|
||||
|
||||
$instance1 = $DB->get_record('enrol', array('id' => $instance1id), '*', MUST_EXIST);
|
||||
|
||||
self::setUser($user2);
|
||||
// Self enrol me (user2).
|
||||
$result = enrol_self_external::enrol_user($course1->id);
|
||||
|
||||
// Enrol user1 manually.
|
||||
$this->getDataGenerator()->enrol_user($user1->id, $course1->id, null, 'manual');
|
||||
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$this->getDataGenerator()->enrol_user($user1->id, $course2->id);
|
||||
|
||||
$course3 = $this->getDataGenerator()->create_course();
|
||||
$this->getDataGenerator()->enrol_user($user2->id, $course3->id);
|
||||
|
||||
// Test that user1 and user2 have courses in common.
|
||||
$this->assertTrue(enrol_get_shared_courses($user1, $user2, false, true));
|
||||
// Test that user1 and user3 have no courses in common.
|
||||
$this->assertFalse(enrol_get_shared_courses($user1, $user3, false, true));
|
||||
|
||||
// Test retrieving the courses in common.
|
||||
$sharedcourses = enrol_get_shared_courses($user1, $user2, true);
|
||||
|
||||
// Only should be one shared course.
|
||||
$this->assertCount(1, $sharedcourses);
|
||||
$sharedcourse = array_shift($sharedcourses);
|
||||
// It should be course 1.
|
||||
$this->assertEquals($sharedcourse->id, $course1->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test user enrolment created event.
|
||||
*/
|
||||
@@ -422,4 +478,58 @@ class core_enrollib_testcase extends advanced_testcase {
|
||||
$this->assertEquals('self', $event->other['enrol']);
|
||||
$this->assertEventContextNotUsed($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms that timemodified field was updated after modification of user enrollment
|
||||
*/
|
||||
public function test_enrollment_update_timemodified() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$datagen = $this->getDataGenerator();
|
||||
|
||||
/** @var enrol_manual_plugin $manualplugin */
|
||||
$manualplugin = enrol_get_plugin('manual');
|
||||
$this->assertNotNull($manualplugin);
|
||||
|
||||
$studentroleid = $DB->get_field('role', 'id', ['shortname' => 'student'], MUST_EXIST);
|
||||
$course = $datagen->create_course();
|
||||
$user = $datagen->create_user();
|
||||
|
||||
$instanceid = null;
|
||||
$instances = enrol_get_instances($course->id, true);
|
||||
foreach ($instances as $inst) {
|
||||
if ($inst->enrol == 'manual') {
|
||||
$instanceid = (int)$inst->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($instanceid)) {
|
||||
$instanceid = $manualplugin->add_default_instance($course);
|
||||
if (empty($instanceid)) {
|
||||
$instanceid = $manualplugin->add_instance($course);
|
||||
}
|
||||
}
|
||||
$this->assertNotNull($instanceid);
|
||||
|
||||
$instance = $DB->get_record('enrol', ['id' => $instanceid], '*', MUST_EXIST);
|
||||
$manualplugin->enrol_user($instance, $user->id, $studentroleid, 0, 0, ENROL_USER_ACTIVE);
|
||||
$userenrolorig = (int)$DB->get_field(
|
||||
'user_enrolments',
|
||||
'timemodified',
|
||||
['enrolid' => $instance->id, 'userid' => $user->id],
|
||||
MUST_EXIST
|
||||
);
|
||||
$this->waitForSecond();
|
||||
$this->waitForSecond();
|
||||
$manualplugin->update_user_enrol($instance, $user->id, ENROL_USER_SUSPENDED);
|
||||
$userenrolpost = (int)$DB->get_field(
|
||||
'user_enrolments',
|
||||
'timemodified',
|
||||
['enrolid' => $instance->id, 'userid' => $user->id],
|
||||
MUST_EXIST
|
||||
);
|
||||
|
||||
$this->assertGreaterThan($userenrolorig, $userenrolpost);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
require_once($CFG->dirroot . '/filter/mathjaxloader/db/upgradelib.php');
|
||||
|
||||
if ($oldversion < 2014081100) {
|
||||
|
||||
$sslcdnurl = get_config('filter_mathjaxloader', 'httpsurl');
|
||||
@@ -131,5 +133,50 @@ MathJax.Hub.Config({
|
||||
upgrade_plugin_savepoint(true, 2016032200, 'filter', 'mathjaxloader');
|
||||
}
|
||||
|
||||
if ($oldversion < 2016052301) {
|
||||
$httpurl = get_config('filter_mathjaxloader', 'httpurl');
|
||||
$newcdnurl = filter_mathjaxloader_upgrade_cdn_cloudflare($httpurl, true);
|
||||
set_config('httpurl', $newcdnurl, 'filter_mathjaxloader');
|
||||
|
||||
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
|
||||
$newcdnurl = filter_mathjaxloader_upgrade_cdn_cloudflare($httpsurl, false);
|
||||
set_config('httpsurl', $newcdnurl, 'filter_mathjaxloader');
|
||||
|
||||
$mathjaxconfig = get_config('filter_mathjaxloader', 'mathjaxconfig');
|
||||
if (strpos($mathjaxconfig, 'MathJax.Ajax.config.path') === false) {
|
||||
$newconfig = 'MathJax.Ajax.config.path["Contrib"] = "{wwwroot}/filter/mathjaxloader/contrib";' . "\n";
|
||||
$newconfig .= $mathjaxconfig;
|
||||
|
||||
set_config('mathjaxconfig', $newconfig, 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2016052301, 'filter', 'mathjaxloader');
|
||||
}
|
||||
if ($oldversion < 2016052302) {
|
||||
|
||||
$httpurl = get_config('filter_mathjaxloader', 'httpurl');
|
||||
if ($httpurl === "http://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js") {
|
||||
set_config('httpurl', 'http://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js', 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
|
||||
if ($httpsurl === "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js") {
|
||||
set_config('httpsurl', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js', 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
$mathjaxconfig = get_config('filter_mathjaxloader', 'mathjaxconfig');
|
||||
|
||||
if (strpos($mathjaxconfig, 'MathJax.Ajax.config.path') !== false) {
|
||||
// Now we need to remove this config again because mathjax 2.7.1 supports the extensions on the CDN.
|
||||
$configtoremove = 'MathJax.Ajax.config.path["Contrib"] = "{wwwroot}/filter/mathjaxloader/contrib";';
|
||||
|
||||
$mathjaxconfig = str_replace($configtoremove, '', $mathjaxconfig);
|
||||
|
||||
set_config('mathjaxconfig', $mathjaxconfig, 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2016052302, 'filter', 'mathjaxloader');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Random functions for mathjax upgrades.
|
||||
*
|
||||
* @package filter_mathjaxloader
|
||||
* @copyright 2017 Damyon Wiese (damyon@moodle.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* This function takes an existing mathjax url and, if it was using the standard mathjax cdn,
|
||||
* upgrades it to use the cloudflare matchjax cdn (because the standard one is shutting down).
|
||||
* @param string $mathjaxurl - The current url.
|
||||
* @param boolean $httponly - Use http instead of https - really only for 3.1 upgrades.
|
||||
* @return string The new url.
|
||||
*/
|
||||
function filter_mathjaxloader_upgrade_cdn_cloudflare($mathjaxurl, $httponly = false) {
|
||||
$newcdnurl = $mathjaxurl;
|
||||
$cdnroot = 'https://cdn.mathjax.org/mathjax/';
|
||||
if ($httponly) {
|
||||
$cdnroot = 'http://cdn.mathjax.org/mathjax/';
|
||||
}
|
||||
$usingcdn = strpos($mathjaxurl, $cdnroot) === 0;
|
||||
if ($usingcdn) {
|
||||
$majorversion = substr($mathjaxurl, strlen($cdnroot), 3);
|
||||
$latestversion = '2.7.0';
|
||||
if ($majorversion == '2.6') {
|
||||
$latestversion = '2.6.1';
|
||||
} else if ($majorversion == '2.5') {
|
||||
$latestversion = '2.5.3';
|
||||
}
|
||||
|
||||
$offset = strpos($mathjaxurl, '/', strlen($cdnroot));
|
||||
if ($offset === false) {
|
||||
return $newcdnurl;
|
||||
}
|
||||
|
||||
$endofurl = substr($mathjaxurl, $offset + 1);
|
||||
|
||||
$newcdnbase = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/';
|
||||
if ($httponly) {
|
||||
$newcdnbase = 'http://cdnjs.cloudflare.com/ajax/libs/mathjax/';
|
||||
}
|
||||
|
||||
$newcdnurl = $newcdnbase . $latestversion . '/' . $endofurl;
|
||||
}
|
||||
|
||||
return $newcdnurl;
|
||||
}
|
||||
@@ -115,6 +115,9 @@ class filter_mathjaxloader extends moodle_text_filter {
|
||||
$page->requires->js_module($moduleconfig);
|
||||
|
||||
$config = get_config('filter_mathjaxloader', 'mathjaxconfig');
|
||||
$wwwroot = new moodle_url('/');
|
||||
|
||||
$config = str_replace('{wwwroot}', $wwwroot->out(true), $config);
|
||||
|
||||
$params = array('mathjaxconfig' => $config, 'lang' => $lang);
|
||||
|
||||
|
||||
@@ -33,14 +33,14 @@ if ($ADMIN->fulltree) {
|
||||
$item = new admin_setting_configtext('filter_mathjaxloader/httpurl',
|
||||
new lang_string('httpurl', 'filter_mathjaxloader'),
|
||||
new lang_string('httpurl_help', 'filter_mathjaxloader'),
|
||||
'http://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/mathjax/2.6.1/MathJax.js',
|
||||
PARAM_RAW);
|
||||
$settings->add($item);
|
||||
|
||||
$item = new admin_setting_configtext('filter_mathjaxloader/httpsurl',
|
||||
new lang_string('httpsurl', 'filter_mathjaxloader'),
|
||||
new lang_string('httpsurl_help', 'filter_mathjaxloader'),
|
||||
'https://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.6.1/MathJax.js',
|
||||
PARAM_RAW);
|
||||
$settings->add($item);
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Unit test for the upgrade MathJax code.
|
||||
*
|
||||
* @package filter_mathjaxloader
|
||||
* @copyright 2017 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/filter/mathjaxloader/db/upgradelib.php');
|
||||
|
||||
/**
|
||||
* Unit test for the upgrade MathJax code.
|
||||
*
|
||||
* Test the functions in upgradelib.php
|
||||
*
|
||||
* @copyright 2017 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class filter_mathjax_upgradelib_testcase extends advanced_testcase {
|
||||
|
||||
public function test_upgradelib() {
|
||||
$current = 'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
|
||||
$expected = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?...';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
|
||||
|
||||
$current = 'http://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
|
||||
$expected = 'http://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?...';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current, true));
|
||||
|
||||
$current = 'http://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
|
||||
$expected = 'http://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current, false));
|
||||
|
||||
$current = 'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
|
||||
$expected = 'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current, true));
|
||||
|
||||
$current = 'https://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?...';
|
||||
$expected = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.6.1/MathJax.js?...';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
|
||||
|
||||
$current = 'https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?...';
|
||||
$expected = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.5.3/MathJax.js?...';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
|
||||
|
||||
// Dont touch non https links.
|
||||
$current = 'http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?...';
|
||||
$expected = 'http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?...';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
|
||||
|
||||
// Dont touch non local links.
|
||||
$current = 'https://mylocalmirror/mathjax/2.7-latest/MathJax.js?...';
|
||||
$expected = 'https://mylocalmirror/mathjax/2.7-latest/MathJax.js?...';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
|
||||
|
||||
// Try some unexpected things.
|
||||
$current = '';
|
||||
$expected = '';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
|
||||
|
||||
// Try some unexpected things.
|
||||
$current = 'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js';
|
||||
$expected = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
|
||||
|
||||
// Try some unexpected things.
|
||||
$current = 'https://cdn.mathjax.org/mathjax/2.7-latest';
|
||||
$expected = 'https://cdn.mathjax.org/mathjax/2.7-latest';
|
||||
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<libraries>
|
||||
<!-- Accessibility extensions for mathjax were briefly included - and then removed again -->
|
||||
</libraries>
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300;
|
||||
$plugin->version = 2016052302;
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->component= 'filter_mathjaxloader';
|
||||
|
||||
@@ -236,6 +236,7 @@ class gradingform_guide_renderer extends plugin_renderer_base {
|
||||
$input = html_writer::tag('textarea', s($currentremark), $remarkparams);
|
||||
|
||||
// Show the frequently-used comments chooser only if there are defined entries.
|
||||
$commentchooser = '';
|
||||
if (!empty($comments)) {
|
||||
// Frequently used comments chooser.
|
||||
$chooserbuttonid = 'criteria-' . $criterion['id'] . '-commentchooser';
|
||||
@@ -248,7 +249,7 @@ class gradingform_guide_renderer extends plugin_renderer_base {
|
||||
foreach ($comments as $id => $comment) {
|
||||
$commentoption = new stdClass();
|
||||
$commentoption->id = $id;
|
||||
$commentoption->description = s($comment['description']);
|
||||
$commentoption->description = $comment['description'];
|
||||
$commentoptions[] = $commentoption;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ Feature: Marking guides can be created and edited
|
||||
| Comment 1 |
|
||||
| Comment 2 |
|
||||
| Comment 3 |
|
||||
| Comment 4 |
|
||||
| Comment "4" |
|
||||
And I press "Save marking guide and make it ready"
|
||||
Then I should see "Ready for use"
|
||||
And I should see "Guide criterion A"
|
||||
@@ -46,7 +46,7 @@ Feature: Marking guides can be created and edited
|
||||
And I should see "Comment 1"
|
||||
And I should see "Comment 2"
|
||||
And I should see "Comment 3"
|
||||
And I should see "Comment 4"
|
||||
And I should see "Comment \"4\""
|
||||
|
||||
@javascript
|
||||
Scenario: Deleting criterion and comment
|
||||
@@ -66,7 +66,7 @@ Feature: Marking guides can be created and edited
|
||||
And I press "Save"
|
||||
Then I should see "Comment 1"
|
||||
And I should see "Comment 2"
|
||||
And I should see "Comment 4"
|
||||
And I should see "Comment \"4\""
|
||||
But I should not see "Comment 3"
|
||||
|
||||
@javascript
|
||||
@@ -80,9 +80,9 @@ Feature: Marking guides can be created and edited
|
||||
# Inserting frequently used comment.
|
||||
And I click on "Insert frequently used comment" "button" in the "Guide criterion B" "table_row"
|
||||
And I wait "1" seconds
|
||||
And I press "Comment 4"
|
||||
And I press "Comment \"4\""
|
||||
And I wait "1" seconds
|
||||
Then the field "Guide criterion B criterion remark" matches value "Comment 4"
|
||||
Then the field "Guide criterion B criterion remark" matches value "Comment \"4\""
|
||||
When I press "Save changes"
|
||||
And I press "Ok"
|
||||
And I follow "Edit settings"
|
||||
@@ -98,7 +98,7 @@ Feature: Marking guides can be created and edited
|
||||
And I should see "80" in the ".feedback" "css_element"
|
||||
And I should see "Marking guide test description" in the ".feedback" "css_element"
|
||||
And I should see "Very good"
|
||||
And I should see "Comment 4"
|
||||
And I should see "Comment \"4\""
|
||||
And I should see "Nice!"
|
||||
|
||||
Scenario: I can use marking guides to grade and edit them later updating students grades with Javascript disabled
|
||||
|
||||
@@ -45,6 +45,13 @@ class grade_report_grader extends grade_report {
|
||||
*/
|
||||
private $allgrades;
|
||||
|
||||
/**
|
||||
* Contains all grade items expect GRADE_TYPE_NONE.
|
||||
*
|
||||
* @var array $allgradeitems
|
||||
*/
|
||||
private $allgradeitems;
|
||||
|
||||
/**
|
||||
* Array of errors for bulk grades updating.
|
||||
* @var array $gradeserror
|
||||
@@ -183,6 +190,7 @@ class grade_report_grader extends grade_report {
|
||||
array_unshift($mygroups, $this->currentgroup);
|
||||
}
|
||||
}
|
||||
$viewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
|
||||
|
||||
// always initialize all arrays
|
||||
$queue = array();
|
||||
@@ -288,7 +296,7 @@ class grade_report_grader extends grade_report {
|
||||
$userfields = 'id, ' . get_all_user_name_fields(true);
|
||||
$user = $DB->get_record('user', array('id' => $userid), $userfields);
|
||||
$gradestr = new stdClass();
|
||||
$gradestr->username = fullname($user);
|
||||
$gradestr->username = fullname($user, $viewfullnames);
|
||||
$gradestr->itemname = $gradeitem->get_name();
|
||||
$warnings[] = get_string($errorstr, 'grades', $gradestr);
|
||||
if ($skip) {
|
||||
@@ -519,6 +527,22 @@ class grade_report_grader extends grade_report {
|
||||
return $this->users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all grade items.
|
||||
*/
|
||||
protected function get_allgradeitems() {
|
||||
if (!empty($this->allgradeitems)) {
|
||||
return $this->allgradeitems;
|
||||
}
|
||||
$allgradeitems = grade_item::fetch_all(array('courseid' => $this->courseid));
|
||||
// But hang on - don't include ones which are set to not show the grade at all.
|
||||
$this->allgradeitems = array_filter($allgradeitems, function($item) {
|
||||
return $item->gradetype != GRADE_TYPE_NONE;
|
||||
});
|
||||
|
||||
return $this->allgradeitems;
|
||||
}
|
||||
|
||||
/**
|
||||
* we supply the userids in this query, and get all the grades
|
||||
* pulls out all the grades, this does not need to worry about paging
|
||||
@@ -542,11 +566,16 @@ class grade_report_grader extends grade_report {
|
||||
WHERE g.itemid = gi.id AND gi.courseid = :courseid {$this->userselect}";
|
||||
|
||||
$userids = array_keys($this->users);
|
||||
$allgradeitems = $this->get_allgradeitems();
|
||||
|
||||
if ($grades = $DB->get_records_sql($sql, $params)) {
|
||||
foreach ($grades as $graderec) {
|
||||
$grade = new grade_grade($graderec, false);
|
||||
$this->allgrades[$graderec->userid][$graderec->itemid] = $grade;
|
||||
if (!empty($allgradeitems[$graderec->itemid])) {
|
||||
// Note: Filter out grades which have a grade type of GRADE_TYPE_NONE.
|
||||
// Only grades without this type are present in $allgradeitems.
|
||||
$this->allgrades[$graderec->userid][$graderec->itemid] = $grade;
|
||||
}
|
||||
if (in_array($graderec->userid, $userids) and array_key_exists($graderec->itemid, $this->gtree->get_items())) { // some items may not be present!!
|
||||
$this->grades[$graderec->userid][$graderec->itemid] = $grade;
|
||||
$this->grades[$graderec->userid][$graderec->itemid]->grade_item = $this->gtree->get_item($graderec->itemid); // db caching
|
||||
@@ -567,6 +596,18 @@ class grade_report_grader extends grade_report {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pre fill grades for any remaining items which might be collapsed.
|
||||
foreach ($userids as $userid) {
|
||||
foreach ($allgradeitems as $itemid => $gradeitem) {
|
||||
if (!isset($this->allgrades[$userid][$itemid])) {
|
||||
$this->allgrades[$userid][$itemid] = new grade_grade();
|
||||
$this->allgrades[$userid][$itemid]->itemid = $itemid;
|
||||
$this->allgrades[$userid][$itemid]->userid = $userid;
|
||||
$this->allgrades[$userid][$itemid]->grade_item = $gradeitem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -611,6 +652,7 @@ class grade_report_grader extends grade_report {
|
||||
'moodle/grade:edit'), $this->context);
|
||||
}
|
||||
$hasuserreportcell = $canseeuserreport || $canseesingleview;
|
||||
$viewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
|
||||
|
||||
$strfeedback = $this->get_lang_string("feedback");
|
||||
$strgrade = $this->get_lang_string('grade');
|
||||
@@ -682,7 +724,7 @@ class grade_report_grader extends grade_report {
|
||||
$usercell->text = $OUTPUT->user_picture($user, array('visibletoscreenreaders' => false));
|
||||
}
|
||||
|
||||
$fullname = fullname($user);
|
||||
$fullname = fullname($user, $viewfullnames);
|
||||
$usercell->text .= html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), $fullname, array(
|
||||
'class' => 'username',
|
||||
));
|
||||
@@ -781,6 +823,8 @@ class grade_report_grader extends grade_report {
|
||||
$strexcludedgrades = get_string('excluded', 'grades');
|
||||
$strerror = get_string('error');
|
||||
|
||||
$viewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
|
||||
|
||||
foreach ($this->gtree->get_levels() as $key => $row) {
|
||||
$headingrow = new html_table_row();
|
||||
$headingrow->attributes['class'] = 'heading_name_row';
|
||||
@@ -918,7 +962,7 @@ class grade_report_grader extends grade_report {
|
||||
// grade items (in case one has been hidden) as the course total shown needs to be adjusted for this particular
|
||||
// user.
|
||||
if (!$this->canviewhidden) {
|
||||
$allgradeitems = grade_item::fetch_all(array('courseid' => $this->courseid));
|
||||
$allgradeitems = $this->get_allgradeitems();
|
||||
}
|
||||
|
||||
foreach ($this->users as $userid => $user) {
|
||||
@@ -937,7 +981,7 @@ class grade_report_grader extends grade_report {
|
||||
$itemrow = new html_table_row();
|
||||
$itemrow->id = 'user_'.$userid;
|
||||
|
||||
$fullname = fullname($user);
|
||||
$fullname = fullname($user, $viewfullnames);
|
||||
$jsarguments['users'][$userid] = $fullname;
|
||||
|
||||
foreach ($this->gtree->items as $itemid => $unused) {
|
||||
@@ -1729,7 +1773,7 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
// Try looking for old location of user setting that used to store all courses in one serialized user preference.
|
||||
if (($oldcollapsedpref = get_user_preferences('grade_report_grader_collapsed_categories')) !== null) {
|
||||
if ($collapsedall = @unserialize($oldcollapsedpref)) {
|
||||
if ($collapsedall = unserialize_array($oldcollapsedpref)) {
|
||||
// We found the old-style preference, filter out only categories that belong to this course and update the prefs.
|
||||
$collapsed = static::filter_collapsed_categories($courseid, $collapsedall);
|
||||
if (!empty($collapsed['aggregatesonly']) || !empty($collapsed['gradesonly'])) {
|
||||
|
||||
@@ -12,6 +12,7 @@ Feature: We can change what we are viewing on the grader report
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 1 | student2@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@@ -95,6 +96,9 @@ Feature: We can change what we are viewing on the grader report
|
||||
| capability | permission |
|
||||
| moodle/grade:viewhidden | Prevent |
|
||||
And I log out
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student2 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
|
||||
@@ -29,9 +29,16 @@ require_once $CFG->dirroot.'/grade/report/user/lib.php';
|
||||
|
||||
$courseid = required_param('id', PARAM_INT);
|
||||
$userid = optional_param('userid', $USER->id, PARAM_INT);
|
||||
$userview = optional_param('userview', 0, PARAM_INT);
|
||||
|
||||
$PAGE->set_url(new moodle_url('/grade/report/user/index.php', array('id'=>$courseid)));
|
||||
|
||||
if ($userview == 0) {
|
||||
$userview = get_user_preferences('gradereport_user_view_user', GRADE_REPORT_USER_VIEW_USER);
|
||||
} else {
|
||||
set_user_preference('gradereport_user_view_user', $userview);
|
||||
}
|
||||
|
||||
/// basic access checks
|
||||
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
||||
print_error('nocourseid');
|
||||
@@ -103,6 +110,15 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
|
||||
$defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
|
||||
$showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
|
||||
$showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $context);
|
||||
|
||||
$renderer = $PAGE->get_renderer('gradereport_user');
|
||||
|
||||
if ($userview == GRADE_REPORT_USER_VIEW_USER) {
|
||||
$viewasuser = true;
|
||||
} else {
|
||||
$viewasuser = false;
|
||||
}
|
||||
|
||||
if (empty($userid)) {
|
||||
$gui = new graded_users_iterator($course, null, $currentgroup);
|
||||
$gui->require_active_enrolment($showonlyactiveenrol);
|
||||
@@ -112,13 +128,14 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
|
||||
groups_print_course_menu($course, $gpr->get_return_url('index.php?id='.$courseid, array('userid'=>0)));
|
||||
|
||||
if ($user_selector) {
|
||||
$renderer = $PAGE->get_renderer('gradereport_user');
|
||||
echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, true);
|
||||
}
|
||||
|
||||
echo $renderer->view_user_selector($userid, $userview);
|
||||
|
||||
while ($userdata = $gui->next_user()) {
|
||||
$user = $userdata->user;
|
||||
$report = new grade_report_user($courseid, $gpr, $context, $user->id);
|
||||
$report = new grade_report_user($courseid, $gpr, $context, $user->id, $viewasuser);
|
||||
|
||||
$studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user));
|
||||
echo $OUTPUT->heading(get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink);
|
||||
@@ -130,7 +147,7 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
|
||||
}
|
||||
$gui->close();
|
||||
} else { // Only show one user's report
|
||||
$report = new grade_report_user($courseid, $gpr, $context, $userid);
|
||||
$report = new grade_report_user($courseid, $gpr, $context, $userid, $viewasuser);
|
||||
|
||||
$studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user));
|
||||
print_grade_page_head($courseid, 'report', 'user', get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink,
|
||||
@@ -139,11 +156,12 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
|
||||
groups_print_course_menu($course, $gpr->get_return_url('index.php?id='.$courseid, array('userid'=>0)));
|
||||
|
||||
if ($user_selector) {
|
||||
$renderer = $PAGE->get_renderer('gradereport_user');
|
||||
$showallusersoptions = true;
|
||||
echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, $showallusersoptions);
|
||||
}
|
||||
|
||||
echo $renderer->view_user_selector($userid, $userview);
|
||||
|
||||
if ($currentgroup and !groups_is_member($currentgroup, $userid)) {
|
||||
echo $OUTPUT->notification(get_string('groupusernotmember', 'error'));
|
||||
} else {
|
||||
|
||||
@@ -25,4 +25,7 @@
|
||||
$string['eventgradereportviewed'] = 'Grade user report viewed';
|
||||
$string['pluginname'] = 'User report';
|
||||
$string['user:view'] = 'View your own grade report';
|
||||
$string['myself'] = 'Myself';
|
||||
$string['otheruser'] = 'User';
|
||||
$string['tablesummary'] = 'The table is arranged as a list of graded items including categories of graded items. When items are in a category they will be indicated as such.';
|
||||
$string['viewas'] = 'View report as';
|
||||
|
||||
@@ -30,6 +30,9 @@ define("GRADE_REPORT_USER_HIDE_HIDDEN", 0);
|
||||
define("GRADE_REPORT_USER_HIDE_UNTIL", 1);
|
||||
define("GRADE_REPORT_USER_SHOW_HIDDEN", 2);
|
||||
|
||||
define("GRADE_REPORT_USER_VIEW_SELF", 1);
|
||||
define("GRADE_REPORT_USER_VIEW_USER", 2);
|
||||
|
||||
/**
|
||||
* Class providing an API for the user report building and displaying.
|
||||
* @uses grade_report
|
||||
|
||||
@@ -43,4 +43,29 @@ class gradereport_user_renderer extends plugin_renderer_base {
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and renders the single select box for the user view.
|
||||
*
|
||||
* @param int $userid The selected userid
|
||||
* @param int $userview The current view user setting constant
|
||||
* @return string
|
||||
*/
|
||||
public function view_user_selector($userid, $userview) {
|
||||
global $PAGE, $USER;
|
||||
$url = $PAGE->url;
|
||||
if ($userid != $USER->id) {
|
||||
$url->param('userid', $userid);
|
||||
}
|
||||
|
||||
$options = array(GRADE_REPORT_USER_VIEW_USER => get_string('otheruser', 'gradereport_user'),
|
||||
GRADE_REPORT_USER_VIEW_SELF => get_string('myself', 'gradereport_user'));
|
||||
$select = new single_select($url, 'userview', $options, $userview, null);
|
||||
|
||||
$select->label = get_string('viewas', 'gradereport_user');
|
||||
|
||||
$output = html_writer::tag('div', $this->output->render($select), array('class' => 'view_users_selector'));
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,15 @@
|
||||
float: right;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.path-grade-report-user #graded_users_selector .singleselect label {
|
||||
|
||||
.path-grade-report-user .view_users_selector {
|
||||
clear: both;
|
||||
float: right;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.path-grade-report-user #graded_users_selector .singleselect label,
|
||||
.path-grade-report-user .view_users_selector .singleselect label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
@core @core_grades @gradereport_user
|
||||
Feature: View the user report as the student will see it
|
||||
In order to know what grades students will see
|
||||
As a teacher
|
||||
I need to be able to view the user report as that other user
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
|
||||
| student1 | Student | 1 | student1@example.com | s1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "grade categories" exist:
|
||||
| fullname | course |
|
||||
| Sub category 1 | C1 |
|
||||
| Sub category 2 | C1 |
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro | gradecategory| grade |
|
||||
| assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 | 100 |
|
||||
| assign | C1 | a2 | Test assignment two | Submit something! | Sub category 1 | 100 |
|
||||
| assign | C1 | a3 | Test assignment three | Submit something! | Sub category 2 | 100 |
|
||||
| assign | C1 | a4 | Test assignment four | Submit something! | Sub category 2 | 100 |
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro | grade |
|
||||
| assign | C1 | a5 | Test assignment five | Submit something! | 100 |
|
||||
| assign | C1 | a6 | Test assignment six | Submit something! | 100 |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Gradebook setup" node in "Course administration"
|
||||
And I hide the grade item "Test assignment six"
|
||||
And I hide the grade item "Sub category 2"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
And I turn editing mode on
|
||||
And I change window size to "large"
|
||||
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
|
||||
And I give the grade "35.00" to the user "Student 1" for the grade item "Test assignment two"
|
||||
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment three"
|
||||
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment four"
|
||||
And I give the grade "21.00" to the user "Student 1" for the grade item "Test assignment five"
|
||||
And I give the grade "97.00" to the user "Student 1" for the grade item "Test assignment six"
|
||||
And I press "Save changes"
|
||||
And I change window size to "medium"
|
||||
|
||||
Scenario: View the report as the teacher themselves
|
||||
When I navigate to "User report" node in "Grade administration"
|
||||
And I select "Student 1" from the "Select all or one user" singleselect
|
||||
And I select "Myself" from the "View report as" singleselect
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | 50.00 % | 80.00 | 0–100 | 80.00 % | 13.33 % |
|
||||
| Test assignment two | 50.00 % | 35.00 | 0–100 | 35.00 % | 5.83 % |
|
||||
| Sub category 1 total | 33.33 % | 115.00 | 0–200 | 57.50 % | - |
|
||||
| Test assignment three | 50.00 % | 100.00 | 0–100 | 100.00 % | 16.67 % |
|
||||
| Test assignment four | 50.00 % | 50.00 | 0–100 | 50.00 % | 8.33 % |
|
||||
| Sub category 2 total | 33.33 % | 150.00 | 0–200 | 75.00 % | - |
|
||||
| Test assignment five | 16.67 % | 21.00 | 0–100 | 21.00 % | 3.50 % |
|
||||
| Test assignment six | 16.67 % | 97.00 | 0–100 | 97.00 % | 16.17 % |
|
||||
| Course total | - | 383.00 | 0–600 | 63.83 % | - |
|
||||
|
||||
Scenario: View the report as the student from both the teachers and students perspective
|
||||
When I navigate to "User report" node in "Grade administration"
|
||||
And I select "Student 1" from the "Select all or one user" singleselect
|
||||
And I select "User" from the "View report as" singleselect
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | - | 80.00 | 0–100 | 80.00 % | - |
|
||||
| Test assignment two | - | 35.00 | 0–100 | 35.00 % | - |
|
||||
| Sub category 1 total | 33.33 % | - | 0–200 | - | - |
|
||||
| Test assignment five | - | 21.00 | 0–100 | 21.00 % | - |
|
||||
| Course total | - | - | 0–600 | - | - |
|
||||
And the following should not exist in the "user-grade" table:
|
||||
| Grade item |
|
||||
| Test assignment three |
|
||||
| Test assignment four |
|
||||
| Sub category 2 total |
|
||||
| Test assignment six |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | - | 80.00 | 0–100 | 80.00 % | - |
|
||||
| Test assignment two | - | 35.00 | 0–100 | 35.00 % | - |
|
||||
| Sub category 1 total | 33.33 % | - | 0–200 | - | - |
|
||||
| Test assignment five | - | 21.00 | 0–100 | 21.00 % | - |
|
||||
| Course total | - | - | 0–600 | - | - |
|
||||
And the following should not exist in the "user-grade" table:
|
||||
| Grade item |
|
||||
| Test assignment three |
|
||||
| Test assignment four |
|
||||
| Sub category 2 total |
|
||||
| Test assignment six |
|
||||
|
||||
Scenario: View the report as the student from both the teachers and students perspective with totals excluding hidden
|
||||
Given I navigate to "Course grade settings" node in "Grade administration > Setup"
|
||||
And I set the field with xpath "//select[@name='report_user_showtotalsifcontainhidden']" to "Show totals excluding hidden items"
|
||||
And I press "Save changes"
|
||||
And I navigate to "User report" node in "Grade administration"
|
||||
When I select "Student 1" from the "Select all or one user" singleselect
|
||||
And I select "User" from the "View report as" singleselect
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | 50.00 % | 80.00 | 0–100 | 80.00 % | 26.67 % |
|
||||
| Test assignment two | 50.00 % | 35.00 | 0–100 | 35.00 % | 11.67 % |
|
||||
| Sub category 1 total | 66.67 % | 115.00 | 0–200 | 57.50 | - |
|
||||
| Test assignment five | 33.33 % | 21.00 | 0–100 | 21.00 % | 7.00 % |
|
||||
| Course total | - | 136.00 | 0–300 | 45.33 % | - |
|
||||
And the following should not exist in the "user-grade" table:
|
||||
| Grade item |
|
||||
| Test assignment three |
|
||||
| Test assignment four |
|
||||
| Sub category 2 total |
|
||||
| Test assignment six |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | 50.00 % | 80.00 | 0–100 | 80.00 % | 26.67 % |
|
||||
| Test assignment two | 50.00 % | 35.00 | 0–100 | 35.00 % | 11.67 % |
|
||||
| Sub category 1 total | 66.67 % | 115.00 | 0–200 | 57.50 | - |
|
||||
| Test assignment five | 33.33 % | 21.00 | 0–100 | 21.00 % | 7.00 % |
|
||||
| Course total | - | 136.00 | 0–300 | 45.33 % | - |
|
||||
And the following should not exist in the "user-grade" table:
|
||||
| Grade item |
|
||||
| Test assignment three |
|
||||
| Test assignment four |
|
||||
| Sub category 2 total |
|
||||
| Test assignment six |
|
||||
|
||||
Scenario: View the report as the student from both the teachers and students perspective with totals including hidden
|
||||
Given I navigate to "Course grade settings" node in "Grade administration > Setup"
|
||||
And I set the field with xpath "//select[@name='report_user_showtotalsifcontainhidden']" to "Show totals including hidden items"
|
||||
And I press "Save changes"
|
||||
And I navigate to "User report" node in "Grade administration"
|
||||
When I select "Student 1" from the "Select all or one user" singleselect
|
||||
And I select "User" from the "View report as" singleselect
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | 50.00 % | 80.00 | 0–100 | 80.00 % | 13.33 % |
|
||||
| Test assignment two | 50.00 % | 35.00 | 0–100 | 35.00 % | 5.83 % |
|
||||
| Sub category 1 total | 33.33 % | 115.00 | 0–200 | 57.50 % | - |
|
||||
| Test assignment five | 16.67 % | 21.00 | 0–100 | 21.00 % | 3.50 % |
|
||||
| Course total | - | 383.00 | 0–600 | 63.83 % | - |
|
||||
And the following should not exist in the "user-grade" table:
|
||||
| Grade item |
|
||||
| Test assignment three |
|
||||
| Test assignment four |
|
||||
| Sub category 2 total |
|
||||
| Test assignment six |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | 50.00 % | 80.00 | 0–100 | 80.00 % | 13.33 % |
|
||||
| Test assignment two | 50.00 % | 35.00 | 0–100 | 35.00 % | 5.83 % |
|
||||
| Sub category 1 total | 33.33 % | 115.00 | 0–200 | 57.50 % | - |
|
||||
| Test assignment five | 16.67 % | 21.00 | 0–100 | 21.00 % | 3.50 % |
|
||||
| Course total | - | 383.00 | 0–600 | 63.83 % | - |
|
||||
And the following should not exist in the "user-grade" table:
|
||||
| Grade item |
|
||||
| Test assignment three |
|
||||
| Test assignment four |
|
||||
| Sub category 2 total |
|
||||
| Test assignment six |
|
||||
|
||||
Scenario: View the report as the student from both the teachers and students perspective when the student can view hidden
|
||||
Given I log out
|
||||
And I log in as "admin"
|
||||
And I set the following system permissions of "Student" role:
|
||||
| capability | permission |
|
||||
| moodle/grade:viewhidden | Allow |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Gradebook setup" node in "Course administration"
|
||||
And I navigate to "Course grade settings" node in "Grade administration > Setup"
|
||||
And I set the field with xpath "//select[@name='report_user_showtotalsifcontainhidden']" to "Show totals excluding hidden items"
|
||||
And I press "Save changes"
|
||||
And I navigate to "User report" node in "Grade administration"
|
||||
When I select "Student 1" from the "Select all or one user" singleselect
|
||||
And I select "User" from the "View report as" singleselect
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | 50.00 % | 80.00 | 0–100 | 80.00 % | 13.33 % |
|
||||
| Test assignment two | 50.00 % | 35.00 | 0–100 | 35.00 % | 5.83 % |
|
||||
| Sub category 1 total | 33.33 % | 115.00 | 0–200 | 57.50 % | - |
|
||||
| Test assignment three | 50.00 % | 100.00 | 0–100 | 100.00 % | 16.67 % |
|
||||
| Test assignment four | 50.00 % | 50.00 | 0–100 | 50.00 % | 8.33 % |
|
||||
| Sub category 2 total | 33.33 % | 150.00 | 0–200 | 75.00 % | - |
|
||||
| Test assignment five | 16.67 % | 21.00 | 0–100 | 21.00 % | 3.50 % |
|
||||
| Test assignment six | 16.67 % | 97.00 | 0–100 | 97.00 % | 16.17 % |
|
||||
| Course total | - | 383.00 | 0–600 | 63.83 % | - |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | 50.00 % | 80.00 | 0–100 | 80.00 % | 13.33 % |
|
||||
| Test assignment two | 50.00 % | 35.00 | 0–100 | 35.00 % | 5.83 % |
|
||||
| Sub category 1 total | 33.33 % | 115.00 | 0–200 | 57.50 % | - |
|
||||
| Test assignment three | 50.00 % | 100.00 | 0–100 | 100.00 % | 16.67 % |
|
||||
| Test assignment four | 50.00 % | 50.00 | 0–100 | 50.00 % | 8.33 % |
|
||||
| Sub category 2 total | 33.33 % | 150.00 | 0–200 | 75.00 % | - |
|
||||
| Test assignment five | 16.67 % | 21.00 | 0–100 | 21.00 % | 3.50 % |
|
||||
| Test assignment six | 16.67 % | 97.00 | 0–100 | 97.00 % | 16.17 % |
|
||||
| Course total | - | 383.00 | 0–600 | 63.83 % | - |
|
||||
@@ -91,6 +91,31 @@ class behat_grade extends behat_base {
|
||||
$this->execute('behat_forms::press_button', $this->escape($savechanges));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hids a grade item or category.
|
||||
*
|
||||
* Teacher must be either on the grade setup page or on the Grader report page with editing mode turned on.
|
||||
*
|
||||
* @Given /^I hide the grade item "(?P<grade_item_string>(?:[^"]|\\")*)"$/
|
||||
* @param string $gradeitem
|
||||
*/
|
||||
public function i_hide_the_grade_item($gradeitem) {
|
||||
|
||||
$gradeitem = behat_context_helper::escape($gradeitem);
|
||||
|
||||
if ($this->running_javascript()) {
|
||||
$xpath = "//tr[contains(.,$gradeitem)]//*[contains(@class,'moodle-actionmenu')]//a[contains(@class,'toggle-display')]";
|
||||
if ($this->getSession()->getPage()->findAll('xpath', $xpath)) {
|
||||
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
|
||||
}
|
||||
}
|
||||
|
||||
$hide = behat_context_helper::escape(get_string('hide') . ' ');
|
||||
$linkxpath = "//a[./img[starts-with(@title,$hide) and contains(@title,$gradeitem)]]";
|
||||
|
||||
$this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a calculated manual grade item. Needs a table with item name - idnumber relation.
|
||||
* The step requires you to be in the 'Gradebook setup' page.
|
||||
|
||||
@@ -345,6 +345,7 @@ Feature: We can use calculated grade totals
|
||||
And I set the field "Show weightings" to "Show"
|
||||
And I press "Save changes"
|
||||
And I select "User report" from the "Grade report" singleselect
|
||||
And I select "Myself" from the "View report as" singleselect
|
||||
And I select "Student 1" from the "Select all or one user" singleselect
|
||||
And the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Contribution to course total |
|
||||
@@ -534,6 +535,7 @@ Feature: We can use calculated grade totals
|
||||
And I press "Save changes"
|
||||
Then I should see "75.00 (16.85 %)" in the ".course" "css_element"
|
||||
And I select "User report" from the "Grade report" singleselect
|
||||
And I select "Myself" from the "View report as" singleselect
|
||||
And I select "Student 1" from the "Select all or one user" singleselect
|
||||
And the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Contribution to course total |
|
||||
|
||||
@@ -46,6 +46,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
And I select "User report" from the "Grade report" singleselect
|
||||
And I select "Myself" from the "View report as" singleselect
|
||||
And I select "Student 1" from the "Select all or one user" singleselect
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
|
||||
@@ -230,6 +230,74 @@ class core_grade_report_graderlib_testcase extends advanced_testcase {
|
||||
$this->assertEquals(count($toobigvalue['gradesonly']) - 1, count($report1->collapsed['gradesonly']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the get_right_rows function with one 'normal' and one 'ungraded' quiz.
|
||||
*
|
||||
* Previously, with an ungraded quiz (which results in a grade item with type GRADETYPE_NONE)
|
||||
* there was a bug in get_right_rows in some situations.
|
||||
*/
|
||||
public function test_get_right_rows() {
|
||||
global $USER, $DB;
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
// Create manager and student on a course.
|
||||
$generator = $this->getDataGenerator();
|
||||
$manager = $generator->create_user();
|
||||
$student = $generator->create_user();
|
||||
$course = $generator->create_course();
|
||||
$generator->enrol_user($manager->id, $course->id, 'manager');
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
|
||||
// Create a couple of quizzes on the course.
|
||||
$normalquiz = $generator->create_module('quiz', array('course' => $course->id,
|
||||
'name' => 'NormalQuiz'));
|
||||
$ungradedquiz = $generator->create_module('quiz', array('course' => $course->id,
|
||||
'name' => 'UngradedQuiz'));
|
||||
|
||||
// Set the grade for the second one to 0 (note, you have to do this after creating it,
|
||||
// otherwise it doesn't create an ungraded grade item).
|
||||
$ungradedquiz->instance = $ungradedquiz->id;
|
||||
quiz_set_grade(0, $ungradedquiz);
|
||||
|
||||
// Set current user.
|
||||
$this->setUser($manager);
|
||||
$USER->gradeediting[$course->id] = false;
|
||||
|
||||
// Get the report.
|
||||
$report = $this->create_report($course);
|
||||
$report->load_users();
|
||||
$report->load_final_grades();
|
||||
$result = $report->get_right_rows(false);
|
||||
|
||||
// There should be 3 rows (2 header rows, plus the grades for the first user).
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
// The second row should contain 2 cells - one for the graded quiz and course total.
|
||||
$this->assertCount(2, $result[1]->cells);
|
||||
$this->assertContains('NormalQuiz', $result[1]->cells[0]->text);
|
||||
$this->assertContains('Course total', $result[1]->cells[1]->text);
|
||||
|
||||
// User row should contain grade values '-'.
|
||||
$this->assertCount(2, $result[2]->cells);
|
||||
$this->assertContains('>-<', $result[2]->cells[0]->text);
|
||||
$this->assertContains('>-<', $result[2]->cells[1]->text);
|
||||
|
||||
// Supposing the user cannot view hidden grades, this shouldn't make any difference (due
|
||||
// to a bug, it previously did).
|
||||
$context = context_course::instance($course->id);
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
assign_capability('moodle/grade:viewhidden', CAP_PROHIBIT, $managerroleid, $context->id, true);
|
||||
$context->mark_dirty();
|
||||
$this->assertFalse(has_capability('moodle/grade:viewhidden', $context));
|
||||
|
||||
// Recreate the report. Confirm it returns successfully still.
|
||||
$report = $this->create_report($course);
|
||||
$report->load_users();
|
||||
$report->load_final_grades();
|
||||
$result = $report->get_right_rows(false);
|
||||
$this->assertCount(3, $result);
|
||||
}
|
||||
|
||||
private function create_grade_category($course) {
|
||||
static $cnt = 0;
|
||||
$cnt++;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user