Compare commits
289 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b198428e41 | |||
| a5f09bca98 | |||
| 22124a36ca | |||
| 50794f5278 | |||
| e1cad3f07b | |||
| 2e4856a81f | |||
| 211f6809b9 | |||
| ad75599c7b | |||
| ca908dd42c | |||
| 76129617e5 | |||
| 56f92fa069 | |||
| d7815b0a79 | |||
| 376a2f64f2 | |||
| 634da01c65 | |||
| 8b0bb2389c | |||
| 83b311dcb3 | |||
| 299cdee4bf | |||
| 34b451dac4 | |||
| e2ac9903d9 | |||
| ee22b6faba | |||
| a6c6690e79 | |||
| acb0617d1b | |||
| 370c8c4a06 | |||
| 4782bf39af | |||
| 39f9832ce5 | |||
| ef0d79745f | |||
| e1b1217749 | |||
| 57886390a6 | |||
| 2a6ee587d3 | |||
| 43ab5e777d | |||
| 3f96ad977e | |||
| de068eb91a | |||
| e6539e7139 | |||
| 9a6c86b23f | |||
| ec2f7c0fe9 | |||
| 2077354356 | |||
| a3bce19260 | |||
| 08943d8121 | |||
| b053efae5d | |||
| b3bd9df0fd | |||
| 1d5341843f | |||
| 5da74261d3 | |||
| ee3b7666f2 | |||
| 9c96a6fcf7 | |||
| 6ab4eaf7f2 | |||
| 46c4afbeaf | |||
| e0e75192e8 | |||
| c0078c08df | |||
| e2c4f9d374 | |||
| 1b26a3db64 | |||
| fa5aa45de4 | |||
| 9c9ac43919 | |||
| b214024bda | |||
| cd59d03500 | |||
| 0db181f9a9 | |||
| 868c037261 | |||
| a1714472d3 | |||
| 7883551c72 | |||
| bc11df440e | |||
| 4efaec0a53 | |||
| 0ded67ffd7 | |||
| 61923d3bdd | |||
| 035d608c59 | |||
| d49a5c7826 | |||
| 7305ed72ec | |||
| 7ab8ebf5b1 | |||
| c4b9758766 | |||
| 679d2d1129 | |||
| 4faf9ff6c6 | |||
| 0a77242e3c | |||
| 1453ce1208 | |||
| 798dc31ada | |||
| 4a2a533fe1 | |||
| 61373c843d | |||
| 2937760c27 | |||
| 03989cb776 | |||
| a4f78b52f6 | |||
| ecc1bd1c73 | |||
| 694f33c2f6 | |||
| d93cdd955b | |||
| d80d0b4142 | |||
| b73ab4bf04 | |||
| a398df5381 | |||
| b0ff1a1600 | |||
| 98070f7020 | |||
| 40271e858d | |||
| f839aff2b5 | |||
| 0096c60d46 | |||
| 65424cea97 | |||
| 863b9081f5 | |||
| 44c178ec4f | |||
| 0703eeca7c | |||
| 866f014372 | |||
| 22ad84cb00 | |||
| d56311006a | |||
| 30d4327769 | |||
| d987202dff | |||
| 25d288d297 | |||
| aa6b0c6d03 | |||
| 6f3819a805 | |||
| 2641b5e31e | |||
| 35db491a6d | |||
| 27deb31ded | |||
| 511e5c933a | |||
| 5574d3431b | |||
| ee8c5098c9 | |||
| 480396103b | |||
| 4e5ebf89ba | |||
| 015607040a | |||
| c58a1e9067 | |||
| eecc04f29c | |||
| f237e35755 | |||
| bee606d3b1 | |||
| 38b5816722 | |||
| 6e5e4cc208 | |||
| 4af9077f26 | |||
| 0b2c17a183 | |||
| 2a55bff8f6 | |||
| e235ef7bd9 | |||
| 47dd7dd840 | |||
| 70c75a7a47 | |||
| a7367b6cf3 | |||
| ae8dfad361 | |||
| a0bdd53e21 | |||
| c615b3e96b | |||
| e3475fd088 | |||
| e934a351e9 | |||
| 564753102d | |||
| 91916adde5 | |||
| 7af3ae4834 | |||
| fdfd266454 | |||
| f3e11eef99 | |||
| 94c5e0ade7 | |||
| 55929d8a49 | |||
| d0b1204d8e | |||
| 81a3d127b1 | |||
| 4f7eaa8b46 | |||
| 54c6679153 | |||
| 089fbd15cc | |||
| 7132749e18 | |||
| 9ca2c8dc52 | |||
| f55a4c094e | |||
| 3a3a212405 | |||
| 0998cf8010 | |||
| 3766be85b2 | |||
| 83273d25b9 | |||
| b798b05411 | |||
| 7eb50a3753 | |||
| 4a4b4e28a4 | |||
| 42c31d53c8 | |||
| ea770fe8c8 | |||
| 434a580558 | |||
| 9a7a447722 | |||
| 1bf28ecb43 | |||
| 9c99a5da5c | |||
| 95008df6d9 | |||
| f499fa90f1 | |||
| 015b617739 | |||
| 423c1d6c50 | |||
| c4bee8e510 | |||
| 023ea98fc1 | |||
| f1e0128a43 | |||
| 167b85e60c | |||
| 4b6e850e68 | |||
| e48dd422f9 | |||
| dc8b92e0b2 | |||
| 840d6ba543 | |||
| 078699a1a5 | |||
| c0266bdaf6 | |||
| 46f7f67db1 | |||
| e8b50bbe34 | |||
| 33113481b5 | |||
| 8f11f7741a | |||
| b31ec4dfbf | |||
| 2b63da7763 | |||
| 24bc58278f | |||
| b59f56c259 | |||
| 29e40f3c13 | |||
| d2707c2d28 | |||
| 898befb275 | |||
| 938267b43a | |||
| f9f5f5ddc8 | |||
| ca66ad24c8 | |||
| e1f4756dfb | |||
| 12e04336a0 | |||
| 266aa66267 | |||
| af098adec2 | |||
| 202cfa2987 | |||
| bafa907941 | |||
| f5131809c8 | |||
| 37c30f2249 | |||
| 110a3639c3 | |||
| 7631b43d33 | |||
| a51f9bd003 | |||
| e998b14686 | |||
| 5ed8d694ee | |||
| f0782cc57b | |||
| 33b74df149 | |||
| 24e0b238d3 | |||
| dfddaa8ab6 | |||
| 57b83a4f41 | |||
| c9be953f05 | |||
| 794391b978 | |||
| a7df733250 | |||
| 15d5c9a276 | |||
| ec60f63f59 | |||
| a024a024e8 | |||
| 09304bcbff | |||
| 53ef327e54 | |||
| 685a71917b | |||
| 04288af505 | |||
| 4ac6149680 | |||
| 308046f1bc | |||
| d6c2bf620c | |||
| 8869cf8cd9 | |||
| b32974f12a | |||
| 48b3e4e9b2 | |||
| 4996f75a3b | |||
| bf2cecc440 | |||
| ec920f7901 | |||
| 1131af4409 | |||
| 46d8ffcefa | |||
| e2ea9b4c09 | |||
| 523efc4cd0 | |||
| 3f853115e9 | |||
| 8a8a02c903 | |||
| 946533c623 | |||
| 1f686d7fdf | |||
| 4e9e994da4 | |||
| 3ce4575dc0 | |||
| 88dfc54de9 | |||
| d855dcd29e | |||
| 5d4bf77a16 | |||
| fc00a6641c | |||
| cee73270c7 | |||
| 245de290f7 | |||
| 1a6160df3c | |||
| 2a3df3d55c | |||
| c227fc61f1 | |||
| 38a9ba9bcd | |||
| a4e309709d | |||
| e39f3b7db2 | |||
| 2a64720ac8 | |||
| cf0307a529 | |||
| c4758ab813 | |||
| d2c91281db | |||
| 9a88b8ec35 | |||
| 7a2beab44e | |||
| a586240cc0 | |||
| d2680dbb27 | |||
| c5b884bd51 | |||
| 5d5313537b | |||
| 5e6bc1b0f3 | |||
| 65d4f096db | |||
| cb69e26b15 | |||
| f25a7d2ac7 | |||
| de760475cf | |||
| a3824e559b | |||
| 67b64f85e9 | |||
| ac11f60853 | |||
| 09558248e8 | |||
| d186ba2f81 | |||
| 7ee550a943 | |||
| e260354fc9 | |||
| cd9c54c93c | |||
| 2cd4e5f8dc | |||
| 8978731b82 | |||
| 5c06a1935b | |||
| c04e89b086 | |||
| 4909257b07 | |||
| 695675483f | |||
| c3217a6b0d | |||
| 21527bf096 | |||
| 8178cf1bb9 | |||
| bc4f56abc3 | |||
| 0864ebc14c | |||
| 31354cc381 | |||
| 422a34a6f5 | |||
| d16540aa88 | |||
| d3a76147e0 | |||
| c48f2c90cc | |||
| 1f2cde345a | |||
| 171a83f79b | |||
| a137762fec | |||
| b52ceb2972 | |||
| 400239c7c5 | |||
| 159f904af5 | |||
| a01edef5be | |||
| cfa7d2653c |
+22
-22
@@ -11,10 +11,12 @@ notifications:
|
||||
|
||||
language: php
|
||||
|
||||
dist: trusty
|
||||
|
||||
php:
|
||||
# We only run the highest and lowest supported versions to reduce the load on travis-ci.org.
|
||||
- 7.2
|
||||
- 7.1
|
||||
- 7.3
|
||||
- 7.1.30 # Make this sticky because current default version (7.1.11) has a bug with redis-extension output (MDL-66062)
|
||||
|
||||
addons:
|
||||
postgresql: "9.6"
|
||||
@@ -23,10 +25,6 @@ addons:
|
||||
- mysql-client-core-5.6
|
||||
- mysql-client-5.6
|
||||
|
||||
# Redis tests are currently failing on php 7.2 due to https://bugs.php.net/bug.php?id=75628
|
||||
# services:
|
||||
# - redis-server
|
||||
|
||||
env:
|
||||
# Although we want to run these jobs and see failures as quickly as possible, we also want to get the slowest job to
|
||||
# start first so that the total run time is not too high.
|
||||
@@ -35,9 +33,6 @@ env:
|
||||
# CI Tests should be second-highest in priority as these only take <= 60 seconds to run under normal circumstances.
|
||||
# Postgres is significantly is pretty reasonable in its run-time.
|
||||
|
||||
# Run unit tests on MySQL
|
||||
- DB=mysqli TASK=PHPUNIT
|
||||
|
||||
# Run CI Tests without running PHPUnit.
|
||||
- DB=none TASK=CITEST
|
||||
|
||||
@@ -54,22 +49,22 @@ matrix:
|
||||
fast_finish: true
|
||||
|
||||
include:
|
||||
# Run mysql only on 7.3 - it's just too slow
|
||||
- php: 7.3
|
||||
env: DB=mysqli TASK=PHPUNIT
|
||||
# Run grunt/npm install on highest version ('node' is an alias for the latest node.js version.)
|
||||
- php: 7.2
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
|
||||
|
||||
exclude:
|
||||
# MySQL - it's just too slow.
|
||||
# Exclude it on all versions except for 7.2
|
||||
|
||||
- env: DB=mysqli TASK=PHPUNIT
|
||||
php: 7.1
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
- $HOME/.npm
|
||||
|
||||
before_install:
|
||||
# Avoid IPv6 default binding as service (causes redis not to start).
|
||||
sudo service redis-server start --bind 127.0.0.1
|
||||
|
||||
install:
|
||||
- >
|
||||
if [ "$DB" = 'mysqli' ];
|
||||
@@ -99,10 +94,8 @@ install:
|
||||
echo 'auth.json' >> .git/info/exclude
|
||||
fi
|
||||
|
||||
# Enable Redis.
|
||||
# Redis tests are currently failing on php 7.2 due to https://bugs.php.net/bug.php?id=75628
|
||||
# echo 'extension="redis.so"' > /tmp/redis.ini
|
||||
# phpenv config-add /tmp/redis.ini
|
||||
echo 'extension="redis.so"' > /tmp/redis.ini
|
||||
phpenv config-add /tmp/redis.ini
|
||||
|
||||
# Install composer dependencies.
|
||||
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
|
||||
@@ -173,12 +166,19 @@ before_script:
|
||||
mkdir -p "$HOME"/roots/phpunit
|
||||
|
||||
# The phpunit dataroot and prefix..
|
||||
# Redis tests are currently failing on php 7.2 due to https://bugs.php.net/bug.php?id=75628
|
||||
# -e "/require_once/i \\define('TEST_SESSION_REDIS_HOST', '127.0.0.1');" \
|
||||
sed -i \
|
||||
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
|
||||
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
|
||||
config.php ;
|
||||
# Redis cache store tests
|
||||
sed -i \
|
||||
-e "/require_once/i \\define('TEST_CACHESTORE_REDIS_TESTSERVERS', '127.0.0.1');" \
|
||||
config.php ;
|
||||
# Redis session tests, but not for PHP 7.2 and up. See MDL-60978 for more info.
|
||||
redissession="define('TEST_SESSION_REDIS_HOST', '127.0.0.1');"
|
||||
sed -i \
|
||||
-e "/require_once/i \\${redissession}" \
|
||||
config.php ;
|
||||
|
||||
# Initialise PHPUnit for Moodle.
|
||||
php admin/tool/phpunit/cli/init.php
|
||||
|
||||
@@ -2799,4 +2799,185 @@
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.8" requires="3.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.6" />
|
||||
<VENDOR name="postgres" version="9.4" />
|
||||
<VENDOR name="mssql" version="11.0" />
|
||||
<VENDOR name="oracle" version="11.2" />
|
||||
</DATABASE>
|
||||
<PHP version="7.1.0" 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="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="intlrequired" />
|
||||
</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_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="sixtyfourbitswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -96,7 +96,7 @@ class core_role_permissions_table extends core_role_capability_table_base {
|
||||
"linkclass" => "preventlink", "adminurl" => $adminurl->out(), "icon" => "", "iconalt" => "");
|
||||
if (isset($overridableroles[$id]) and ($allowoverrides or ($allowsafeoverrides and is_safe_capability($capability)))) {
|
||||
$templatecontext['icon'] = 't/delete';
|
||||
$templatecontext['iconalt'] = get_string('delete');
|
||||
$templatecontext['iconalt'] = get_string('deletexrole', 'core_role', $name);
|
||||
}
|
||||
$neededroles[$id] = $renderer->render_from_template('core/permissionmanager_role', $templatecontext);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class core_role_permissions_table extends core_role_capability_table_base {
|
||||
"icon" => "", "iconalt" => "");
|
||||
if (isset($overridableroles[$id]) and prohibit_is_removable($id, $context, $capability->name)) {
|
||||
$templatecontext['icon'] = 't/delete';
|
||||
$templatecontext['iconalt'] = get_string('delete');
|
||||
$templatecontext['iconalt'] = get_string('deletexrole', 'core_role', $name);
|
||||
}
|
||||
$forbiddenroles[$id] = $renderer->render_from_template('core/permissionmanager_role', $templatecontext);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ $arguments = array('contextid' => $contextid,
|
||||
$PAGE->requires->strings_for_js(
|
||||
array('roleprohibitinfo', 'roleprohibitheader', 'roleallowinfo', 'roleallowheader',
|
||||
'confirmunassigntitle', 'confirmroleunprohibit', 'confirmroleprevent', 'confirmunassignyes',
|
||||
'confirmunassignno'), 'core_role');
|
||||
'confirmunassignno', 'deletexrole'), 'core_role');
|
||||
$PAGE->requires->js_call_amd('core/permissionmanager', 'initialize', array($arguments));
|
||||
$table = new core_role_permissions_table($context, $contextname, $allowoverrides, $allowsafeoverrides, $overridableroles);
|
||||
echo $OUTPUT->box_start('generalbox capbox');
|
||||
|
||||
+22
-18
@@ -459,27 +459,31 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$ADMIN->add('backups', $temp);
|
||||
|
||||
// Create a page for asynchronous backup and restore configuration and defaults.
|
||||
if (!empty($CFG->enableasyncbackup)) { // Only add settings if async mode is enable at site level.
|
||||
$temp = new admin_settingpage('asyncgeneralsettings', new lang_string('asyncgeneralsettings', 'backup'));
|
||||
$temp = new admin_settingpage('asyncgeneralsettings', new lang_string('asyncgeneralsettings', 'backup'));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox(
|
||||
'backup/backup_async_message_users',
|
||||
new lang_string('asyncemailenable', 'backup'),
|
||||
new lang_string('asyncemailenabledetail', 'backup'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enableasyncbackup', new lang_string('enableasyncbackup', 'backup'),
|
||||
new lang_string('enableasyncbackup_help', 'backup'), 0, 1, 0));
|
||||
|
||||
$temp->add(new admin_setting_configtext(
|
||||
'backup/backup_async_message_subject',
|
||||
new lang_string('asyncmessagesubject', 'backup'),
|
||||
new lang_string('asyncmessagesubjectdetail', 'backup'),
|
||||
new lang_string('asyncmessagesubjectdefault', 'backup')));
|
||||
$temp->add(new admin_setting_configcheckbox(
|
||||
'backup/backup_async_message_users',
|
||||
new lang_string('asyncemailenable', 'backup'),
|
||||
new lang_string('asyncemailenabledetail', 'backup'), 0));
|
||||
$temp->hide_if('backup/backup_async_message_users', 'enableasyncbackup');
|
||||
|
||||
$temp->add(new admin_setting_confightmleditor(
|
||||
'backup/backup_async_message',
|
||||
new lang_string('asyncmessagebody', 'backup'),
|
||||
new lang_string('asyncmessagebodydetail', 'backup'),
|
||||
new lang_string('asyncmessagebodydefault', 'backup')));
|
||||
$temp->add(new admin_setting_configtext(
|
||||
'backup/backup_async_message_subject',
|
||||
new lang_string('asyncmessagesubject', 'backup'),
|
||||
new lang_string('asyncmessagesubjectdetail', 'backup'),
|
||||
new lang_string('asyncmessagesubjectdefault', 'backup')));
|
||||
$temp->hide_if('backup/backup_async_message_subject', 'backup/backup_async_message_users');
|
||||
|
||||
$ADMIN->add('backups', $temp);
|
||||
}
|
||||
$temp->add(new admin_setting_confightmleditor(
|
||||
'backup/backup_async_message',
|
||||
new lang_string('asyncmessagebody', 'backup'),
|
||||
new lang_string('asyncmessagebodydetail', 'backup'),
|
||||
new lang_string('asyncmessagebodydefault', 'backup')));
|
||||
$temp->hide_if('backup/backup_async_message', 'backup/backup_async_message_users');
|
||||
|
||||
$ADMIN->add('backups', $temp);
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,4 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enablecoursepublishing',
|
||||
new lang_string('enablecoursepublishing', 'hub'), new lang_string('enablecoursepublishing_help', 'hub'), 0));
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enableasyncbackup', new lang_string('enableasyncbackup', 'backup'),
|
||||
new lang_string('enableasyncbackup_help', 'backup'), 0, 1, 0));
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class models_list implements \renderable, \templatable {
|
||||
if ($contextid == SYSCONTEXTID) {
|
||||
$contextname = get_string('allpredictions', 'tool_analytics');
|
||||
} else {
|
||||
$contextname = shorten_text($context->get_context_name(true, true), 90);
|
||||
$contextname = shorten_text($context->get_context_name(false, true), 40);
|
||||
}
|
||||
$predictioncontexts[$contextid] = $contextname;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,8 @@ function tool_analytics_calculate_course_dates($course, $options) {
|
||||
$formatoptions = $format->get_format_options();
|
||||
|
||||
// Change this for a course formats API level call in MDL-60702.
|
||||
if (method_exists($format, 'update_end_date') && $formatoptions['automaticenddate']) {
|
||||
if ((get_class($format) == 'format_weeks' || is_subclass_of($format, 'format_weeks')) &&
|
||||
method_exists($format, 'update_end_date') && $formatoptions['automaticenddate']) {
|
||||
// Special treatment for weeks-based formats with automatic end date.
|
||||
|
||||
if ($options['update']) {
|
||||
|
||||
@@ -31,7 +31,7 @@ $string['errordataroot'] = '$CFG->behat_dataroot is not set or is invalid.';
|
||||
$string['errorsetconfig'] = '$CFG->behat_dataroot, $CFG->behat_prefix and $CFG->behat_wwwroot need to be set in config.php.';
|
||||
$string['erroruniqueconfig'] = '$CFG->behat_dataroot, $CFG->behat_prefix and $CFG->behat_wwwroot values need to be different than $CFG->dataroot, $CFG->prefix, $CFG->wwwroot, $CFG->phpunit_dataroot and $CFG->phpunit_prefix values.';
|
||||
$string['fieldvalueargument'] = 'Field value arguments';
|
||||
$string['fieldvalueargument_help'] = 'This argument should be completed by a field value. There are many field types, including simple ones like checkboxes, selects or textareas, or complex ones like date selectors. See the dev documentation <a href="http://docs.moodle.org/dev/Acceptance_testing" target="_blank">Acceptance_testing</a> for details of expected field values.';
|
||||
$string['fieldvalueargument_help'] = 'This argument should be completed by a field value. There are many field types, including simple ones like checkboxes, selects or textareas, or complex ones like date selectors. See the dev documentation <a href="https://docs.moodle.org/dev/Acceptance_testing" target="_blank">Acceptance_testing</a> for details of expected field values.';
|
||||
$string['giveninfo'] = 'Given. Processes to set up the environment';
|
||||
$string['infoheading'] = 'Info';
|
||||
$string['installinfo'] = 'Read {$a} for installation and tests execution info';
|
||||
|
||||
@@ -41,5 +41,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -113,14 +113,14 @@
|
||||
<div class="d-md-none">
|
||||
<strong>{{#str}}headingstandard, tool_customlang{{/str}}</strong>
|
||||
</div>
|
||||
{{{ master }}}
|
||||
{{ master }}
|
||||
<div class="info">
|
||||
{{{ placeholderhelp }}}
|
||||
{{{ outdatedhelp}}}
|
||||
</div>
|
||||
{{#showoriginalvsmaster}}
|
||||
<div class="alert-secondary mt-3 mt-1">
|
||||
{{{ original }}}
|
||||
{{ original }}
|
||||
</div>
|
||||
{{/showoriginalvsmaster}}
|
||||
</div>
|
||||
@@ -146,5 +146,14 @@
|
||||
</div>
|
||||
{{/strings}}
|
||||
</div>
|
||||
|
||||
<fieldset class="m-a-1 m-3">
|
||||
<button type="submit" name="savecontinue" class="btn btn-secondary">
|
||||
{{#str}}savecontinue, tool_customlang{{/str}}
|
||||
</button>
|
||||
<button type="submit" name="savecheckin" class="btn btn-secondary">
|
||||
{{#str}}savecheckin, tool_customlang{{/str}}
|
||||
</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
{{/hasstrings}}
|
||||
|
||||
@@ -316,5 +316,8 @@ function xmldb_tool_dataprivacy_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,5 +45,8 @@ function xmldb_tool_log_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
$string['actlogshdr'] = 'Available log stores';
|
||||
$string['configlogplugins'] = 'Please enable all required plugins and arrange them in appropriate order.';
|
||||
$string['exportlog'] = 'Include logs when exporting.';
|
||||
$string['exportlog'] = 'Include logs when exporting';
|
||||
$string['exportlogdetail'] = 'Include logs that relate to the user when exporting.';
|
||||
$string['logging'] = 'Logging';
|
||||
$string['managelogging'] = 'Manage log stores';
|
||||
|
||||
@@ -46,5 +46,8 @@ function xmldb_logstore_database_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2019032800, 'logstore', 'database');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,5 +46,8 @@ function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2019032800, 'logstore', 'standard');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,5 +42,8 @@ function xmldb_tool_mobile_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2019021100, 'tool', 'mobile');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,5 +62,8 @@ function xmldb_tool_monitor_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,5 +63,8 @@ function xmldb_tool_policy_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ $string['spamauto'] = 'Autodetect common spam patterns';
|
||||
$string['spamcannotdelete'] = 'Cannot delete this user';
|
||||
$string['spamcannotfinduser'] = 'No users matching your search';
|
||||
$string['spamcleanerintro'] = '<p>This script allows you to search all user profiles for certain strings and then delete those accounts which are obviously created by spammers. You can search for multiple keywords using commas (e.g. casino, porn).</p>
|
||||
<p>For further information, see the documentation <a href="http://docs.moodle.org/en/Reducing_spam_in_Moodle">Reducing spam in Moodle</a>.</p>';
|
||||
<p>For further information, see the documentation <a href="https://docs.moodle.org/en/Reducing_spam_in_Moodle">Reducing spam in Moodle</a>.</p>';
|
||||
$string['spamdeleteall'] = 'Delete all these user accounts';
|
||||
$string['spamdeleteallconfirm'] = 'Are you sure you want to delete all these user accounts? You can not undo this.';
|
||||
$string['spamdeleteconfirm'] = 'Are you sure you want to delete this entry? You can not undo this.';
|
||||
|
||||
@@ -50,7 +50,7 @@ Options:
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$sudo -u www-data /usr/bin/php admin/tool/task/cli/scheduled_task.php --execute=\\\\core\\\\task\\\\session_cleanup_task
|
||||
\$sudo -u www-data /usr/bin/php admin/tool/task/cli/schedule_task.php --execute=\\\\core\\\\task\\\\session_cleanup_task
|
||||
|
||||
";
|
||||
|
||||
|
||||
@@ -703,10 +703,18 @@ class tool_uploadcourse_course {
|
||||
$coursedata += $courseformat->validate_course_format_options($this->rawdata);
|
||||
}
|
||||
|
||||
// Special case, 'numsections' is not a course format option any more but still should apply from defaults.
|
||||
// Special case, 'numsections' is not a course format option any more but still should apply from the template course,
|
||||
// if any, and otherwise from defaults.
|
||||
if (!$exists || !array_key_exists('numsections', $coursedata)) {
|
||||
if (isset($this->rawdata['numsections']) && is_numeric($this->rawdata['numsections'])) {
|
||||
$coursedata['numsections'] = (int)$this->rawdata['numsections'];
|
||||
} else if (isset($this->options['templatecourse'])) {
|
||||
$numsections = tool_uploadcourse_helper::get_coursesection_count($this->options['templatecourse']);
|
||||
if ($numsections != 0) {
|
||||
$coursedata['numsections'] = $numsections;
|
||||
} else {
|
||||
$coursedata['numsections'] = get_config('moodlecourse', 'numsections');
|
||||
}
|
||||
} else {
|
||||
$coursedata['numsections'] = get_config('moodlecourse', 'numsections');
|
||||
}
|
||||
|
||||
@@ -286,6 +286,25 @@ class tool_uploadcourse_helper {
|
||||
return $roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to detect how many sections a course with a given shortname has.
|
||||
*
|
||||
* @param string $shortname shortname of a course to count sections from.
|
||||
* @return integer count of sections.
|
||||
*/
|
||||
public static function get_coursesection_count($shortname) {
|
||||
global $DB;
|
||||
if (!empty($shortname) || is_numeric($shortname)) {
|
||||
// Creating restore from an existing course.
|
||||
$course = $DB->get_record('course', array('shortname' => $shortname));
|
||||
}
|
||||
if (!empty($course)) {
|
||||
$courseformat = course_get_format($course);
|
||||
return $courseformat->get_last_section_number();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the role renaming data from the passed data.
|
||||
*
|
||||
|
||||
@@ -360,6 +360,7 @@ function uu_allowed_roles() {
|
||||
*/
|
||||
function uu_allowed_roles_cache() {
|
||||
$allowedroles = get_assignable_roles(context_course::instance(SITEID), ROLENAME_SHORT);
|
||||
$rolecache = [];
|
||||
foreach ($allowedroles as $rid=>$rname) {
|
||||
$rolecache[$rid] = new stdClass();
|
||||
$rolecache[$rid]->id = $rid;
|
||||
@@ -379,6 +380,7 @@ function uu_allowed_roles_cache() {
|
||||
*/
|
||||
function uu_allowed_sysroles_cache() {
|
||||
$allowedroles = get_assignable_roles(context_system::instance(), ROLENAME_SHORT);
|
||||
$rolecache = [];
|
||||
foreach ($allowedroles as $rid => $rname) {
|
||||
$rolecache[$rid] = new stdClass();
|
||||
$rolecache[$rid]->id = $rid;
|
||||
|
||||
@@ -61,5 +61,8 @@ function xmldb_tool_usertours_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2019030600, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,6 @@ class load_xml_file extends XMLDBAction {
|
||||
$this->can_subaction = ACTION_NONE;
|
||||
//$this->can_subaction = ACTION_HAVE_SUBACTIONS;
|
||||
|
||||
// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
// 'key' => 'module',
|
||||
|
||||
@@ -169,7 +169,7 @@ class main_view extends XMLDBAction {
|
||||
file_exists($key . '/install.xml') &&
|
||||
is_readable($key . '/install.xml') &&
|
||||
empty($dbdir->xml_loaded)) {
|
||||
$b .= '<a href="index.php?action=load_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['load'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=load_xml_file&sesskey=' . sesskey() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['load'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['load'] . ']';
|
||||
}
|
||||
@@ -239,7 +239,7 @@ class main_view extends XMLDBAction {
|
||||
is_readable($key . '/install.xml') &&
|
||||
!empty($dbdir->xml_loaded) &&
|
||||
empty($dbdir->xml_changed)) {
|
||||
$b .= '<a href="index.php?action=unload_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['unload'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=unload_xml_file&sesskey=' . sesskey() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['unload'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['unload'] . ']';
|
||||
}
|
||||
|
||||
@@ -35,9 +35,6 @@ class unload_xml_file extends XMLDBAction {
|
||||
function init() {
|
||||
parent::init();
|
||||
|
||||
// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
// 'key' => 'module',
|
||||
|
||||
@@ -34,7 +34,7 @@ $string['confirmdeleteindex'] = 'Are you absolutely sure that you want to delete
|
||||
$string['confirmdeletekey'] = 'Are you absolutely sure that you want to delete the key:';
|
||||
$string['confirmdeletetable'] = 'Are you absolutely sure that you want to delete the table:';
|
||||
$string['confirmdeletexmlfile'] = 'Are you absolutely sure that you want to delete the file:';
|
||||
$string['confirmcheckbigints'] = 'This functionality will search for <a href="http://tracker.moodle.org/browse/MDL-11038">potential wrong integer fields</a> in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the integers in your DB properly defined.
|
||||
$string['confirmcheckbigints'] = 'This functionality will search for <a href="https://tracker.moodle.org/browse/MDL-11038">potential wrong integer fields</a> in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the integers in your DB properly defined.
|
||||
|
||||
Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).
|
||||
|
||||
@@ -60,7 +60,7 @@ Once generated you can copy such statements and execute them safely with your fa
|
||||
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of missing indexes.
|
||||
|
||||
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
|
||||
$string['confirmcheckoraclesemantics'] = 'This functionality will search for <a href="http://tracker.moodle.org/browse/MDL-29322">Oracle varchar2 columns using BYTE semantics</a> in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the columns converted to use CHAR semantics instead (better for cross-db compatibility and increased contents max. length).
|
||||
$string['confirmcheckoraclesemantics'] = 'This functionality will search for <a href="https://tracker.moodle.org/browse/MDL-29322">Oracle varchar2 columns using BYTE semantics</a> in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the columns converted to use CHAR semantics instead (better for cross-db compatibility and increased contents max. length).
|
||||
|
||||
Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).
|
||||
|
||||
@@ -140,7 +140,7 @@ $string['incorrecttablename'] = 'Incorrect table name';
|
||||
$string['key'] = 'Key';
|
||||
$string['keynameempty'] = 'The key name cannot be empty';
|
||||
$string['keys'] = 'Keys';
|
||||
$string['listreservedwords'] = 'List of Reserved Words<br />(used to keep <a href="http://docs.moodle.org/en/XMLDB_reserved_words" target="_blank">XMLDB_reserved_words</a> updated)';
|
||||
$string['listreservedwords'] = 'List of reserved words<br />(used to keep <a href="https://docs.moodle.org/en/XMLDB_reserved_words" target="_blank">XMLDB reserved words</a> updated)';
|
||||
$string['load'] = 'Load';
|
||||
$string['main_view'] = 'Main view';
|
||||
$string['masterprimaryuniqueordernomatch'] = 'The fields in your foreign key must be listed in the same order as they are listed in the UNIQUE KEY on the referenced table.';
|
||||
|
||||
@@ -313,7 +313,8 @@ class analysis {
|
||||
}
|
||||
|
||||
try {
|
||||
$indicators = $this->analyser->get_indicators();
|
||||
// Instantiate empty indicators to ensure that no garbage is dragged from previous analyses.
|
||||
$indicators = $this->analyser->instantiate_indicators();
|
||||
foreach ($indicators as $key => $indicator) {
|
||||
// The analyser attaches the main entities the sample depends on and are provided to the
|
||||
// indicator to calculate the sample.
|
||||
|
||||
@@ -237,6 +237,18 @@ abstract class base {
|
||||
return $this->indicators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate the indicators.
|
||||
*
|
||||
* @return \core_analytics\local\indicator\base[]
|
||||
*/
|
||||
public function instantiate_indicators() {
|
||||
foreach ($this->indicators as $key => $indicator) {
|
||||
$this->indicators[$key] = call_user_func(array($indicator, 'instance'));
|
||||
}
|
||||
return $this->indicators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Samples data this analyser provides.
|
||||
*
|
||||
|
||||
@@ -836,7 +836,8 @@ abstract class community_of_inquiry_activity extends linear {
|
||||
// When the course is using format weeks we use the week's end date.
|
||||
$format = course_get_format($activity->get_modinfo()->get_course());
|
||||
// We should change this in MDL-60702.
|
||||
if (method_exists($format, 'get_section_dates')) {
|
||||
if (get_class($format) == 'format_weeks' || is_subclass_of($format, 'format_weeks')
|
||||
&& method_exists($format, 'get_section_dates')) {
|
||||
$dates = $format->get_section_dates($section);
|
||||
|
||||
// We need to consider the +2 hours added by get_section_dates.
|
||||
|
||||
@@ -130,8 +130,10 @@ abstract class base extends \core_analytics\calculable {
|
||||
global $PAGE;
|
||||
|
||||
$predictionid = $prediction->get_prediction_data()->id;
|
||||
$contextid = $prediction->get_prediction_data()->contextid;
|
||||
$modelid = $prediction->get_prediction_data()->modelid;
|
||||
|
||||
$PAGE->requires->js_call_amd('report_insights/actions', 'init', array($predictionid));
|
||||
$PAGE->requires->js_call_amd('report_insights/actions', 'init', array($predictionid, $contextid, $modelid));
|
||||
|
||||
$actions = array();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class analytics_analysis_testcase extends advanced_testcase {
|
||||
$this->assertEquals($afewsecsago, $firstanalyses[$modelid . '_' . $course1->id]);
|
||||
$this->assertEquals($afewsecsago + 1, $firstanalyses[$modelid . '_' . $course2->id]);
|
||||
|
||||
// The cached elements gets refreshed.
|
||||
// The cached elements get refreshed.
|
||||
$this->insert_used($modelid, $course1->id, 'prediction', $earliest);
|
||||
$firstanalyses = \core_analytics\analysis::fill_firstanalyses_cache($modelid, $course1->id);
|
||||
$this->assertCount(1, $firstanalyses);
|
||||
@@ -78,7 +78,7 @@ class analytics_analysis_testcase extends advanced_testcase {
|
||||
|
||||
// The generated ranges should start from the cached firstanalysis value, which is $earliest.
|
||||
$ranges = $seconds->get_all_ranges();
|
||||
$this->assertCount(7, $ranges);
|
||||
$this->assertGreaterThanOrEqual(7, count($ranges));
|
||||
$firstrange = reset($ranges);
|
||||
$this->assertEquals($earliest, $firstrange['time']);
|
||||
}
|
||||
|
||||
@@ -436,6 +436,7 @@ class core_analytics_prediction_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Basic test to check that prediction processors work as expected.
|
||||
*
|
||||
* @coversNothing
|
||||
* @dataProvider provider_ml_test_evaluation_configuration
|
||||
* @param string $modelquality
|
||||
* @param int $ncourses
|
||||
@@ -486,6 +487,7 @@ class core_analytics_prediction_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tests the evaluation of already trained models.
|
||||
*
|
||||
* @coversNothing
|
||||
* @dataProvider provider_ml_processors
|
||||
* @param string $predictionsprocessorclass
|
||||
* @return null
|
||||
|
||||
@@ -51,5 +51,8 @@ function xmldb_auth_cas_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,5 +51,8 @@ function xmldb_auth_db_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,5 +51,8 @@ function xmldb_auth_email_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
$string['auth_emaildescription'] = '<p>Email-based self-registration enables a user to create their own account via a \'Create new account\' button on the login page. The user then receives an email containing a secure link to a page where they can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.</p><p>Note: In addition to enabling the plugin, email-based self-registration must also be selected from the self registration drop-down menu on the \'Manage authentication\' page.</p>';
|
||||
$string['auth_emailnoemail'] = 'Tried to send you an email but failed!';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the sign-up page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://www.google.com/recaptcha for more details.';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the sign-up page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See https://www.google.com/recaptcha for more details.';
|
||||
$string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element';
|
||||
$string['auth_emailsettings'] = 'Settings';
|
||||
$string['pluginname'] = 'Email-based self-registration';
|
||||
|
||||
@@ -69,5 +69,8 @@ function xmldb_auth_ldap_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ $string['auth_ldap_usertypeundefined2'] = 'config.user_type not defined or funct
|
||||
$string['auth_ldap_version'] = 'The version of the LDAP protocol your server is using.';
|
||||
$string['auth_ldap_version_key'] = 'Version';
|
||||
$string['auth_ntlmsso'] = 'NTLM SSO';
|
||||
$string['auth_ntlmsso_enabled'] = 'Set to yes to attempt Single Sign On with the NTLM domain. <strong>Note:</strong> this requires additional setup on the webserver to work, see <a href="http://docs.moodle.org/en/NTLM_authentication">http://docs.moodle.org/en/NTLM_authentication</a>';
|
||||
$string['auth_ntlmsso_enabled'] = 'Set to yes to attempt Single Sign On with the NTLM domain. Note that this requires additional setup on the server to work. For further details, see the documentation <a href="https://docs.moodle.org/en/NTLM_authentication">NTLM authentication</a>.';
|
||||
$string['auth_ntlmsso_enabled_key'] = 'Enable';
|
||||
$string['auth_ntlmsso_ie_fastpath'] = 'Set to enable the NTLM SSO fast path (bypasses certain steps if the client\'s browser is MS Internet Explorer).';
|
||||
$string['auth_ntlmsso_ie_fastpath_key'] = 'MS IE fast path?';
|
||||
|
||||
@@ -51,5 +51,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,5 +51,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,5 +51,8 @@ function xmldb_auth_none_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,5 +47,8 @@ function xmldb_auth_oauth2_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,5 +51,8 @@ function xmldb_auth_shibboleth_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ $string['auth_shib_auth_method_description'] = 'Provide a name for the Shibbolet
|
||||
$string['auth_shib_auth_logo'] = 'Authentication method logo';
|
||||
$string['auth_shib_auth_logo_description'] = 'Provide a logo for the Shibboleth authentication method that is familiar to your users. This could be the logo of your Shibboleth federation, e.g. <tt>SWITCHaai Login</tt> or <tt>InCommon Login</tt> or similar.';
|
||||
$string['auth_shib_contact_administrator'] = 'In case you are not associated with the given organizations and you need access to a course on this server, please contact the <a href="mailto:{$a}">Moodle Administrator</a>.';
|
||||
$string['auth_shibbolethdescription'] = 'Using this method users are created and authenticated using <a href="http://shibboleth.internet2.edu/">Shibboleth</a>.<br />Be sure to read the <a href="../auth/shibboleth/README.txt">README</a> for Shibboleth on how to set up your Moodle with Shibboleth';
|
||||
$string['auth_shibbolethdescription'] = 'Using this method users are created and authenticated using Shibboleth. For set-up details, see the <a href="../auth/shibboleth/README.txt">Shibboleth README</a>.';
|
||||
$string['auth_shibboleth_errormsg'] = 'Please select the organization you are member of!';
|
||||
$string['auth_shibboleth_login'] = 'Shibboleth login';
|
||||
$string['auth_shibboleth_login_long'] = 'Login to Moodle via Shibboleth';
|
||||
|
||||
@@ -1980,6 +1980,12 @@ class restore_course_structure_step extends restore_structure_step {
|
||||
}
|
||||
|
||||
$capability = 'mod/' . $modname . ':addinstance';
|
||||
|
||||
if (!get_capability_info($capability)) {
|
||||
$this->log("Capability '{$capability}' was not found!", backup::LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($roleids as $roleid) {
|
||||
assign_capability($capability, CAP_PREVENT, $roleid, $context);
|
||||
}
|
||||
@@ -2107,9 +2113,12 @@ class restore_ras_and_caps_structure_step extends restore_structure_step {
|
||||
$newroleid = $this->get_mappingid('role', $data->roleid);
|
||||
// If newroleid and context are valid assign it via API (it handles dupes and so on)
|
||||
if ($newroleid && $this->task->get_contextid()) {
|
||||
// TODO: assign_capability() needs one userid param to be able to specify our restore userid
|
||||
// TODO: it seems that assign_capability() doesn't check for valid capabilities at all ???
|
||||
assign_capability($data->capability, $data->permission, $newroleid, $this->task->get_contextid());
|
||||
if (!get_capability_info($data->capability)) {
|
||||
$this->log("Capability '{$data->capability}' was not found!", backup::LOG_WARNING);
|
||||
} else {
|
||||
// TODO: assign_capability() needs one userid param to be able to specify our restore userid.
|
||||
assign_capability($data->capability, $data->permission, $newroleid, $this->task->get_contextid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,24 +79,25 @@ class collections extends moodleform {
|
||||
$hasgroups = false;
|
||||
if (!empty($groups)) {
|
||||
foreach ($groups as $group) {
|
||||
// Assertions or badges.
|
||||
$count = 0;
|
||||
|
||||
// Handle attributes based on backpack's supported version.
|
||||
if ($sitebackpack->apiversion == OPEN_BADGES_V2) {
|
||||
// OpenBadges v2 data attributes.
|
||||
if (empty($group->published)) {
|
||||
// Only public collections.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!empty($group->assertions)) {
|
||||
|
||||
// Get the number of badges associated with this collection from the assertions array returned.
|
||||
$count = count($group->assertions);
|
||||
}
|
||||
if (!empty($group->badges)) {
|
||||
$count = count($group->badges);
|
||||
}
|
||||
if (!empty($group->groupId)) {
|
||||
} else {
|
||||
// OpenBadges v1 data attributes.
|
||||
$group->entityId = $group->groupId;
|
||||
|
||||
// Get the number of badges associated with this collection. In that case, the number is returned directly.
|
||||
$count = $group->badges;
|
||||
}
|
||||
|
||||
if (!$hasgroups) {
|
||||
$mform->addElement('static', 'selectgroup', '', get_string('selectgroup_start', 'badges'));
|
||||
}
|
||||
|
||||
+8
-6
@@ -420,12 +420,14 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
|
||||
$output .= $this->output->heading(get_string('issuancedetails', 'badges'), 3);
|
||||
$dl = array();
|
||||
$issued['issuedOn'] = !preg_match( '~^[1-9][0-9]*$~', $issued['issuedOn'] ) ?
|
||||
strtotime($issued['issuedOn']) : $issued['issuedOn'];
|
||||
if (!is_numeric($issued['issuedOn'])) {
|
||||
$issued['issuedOn'] = strtotime($issued['issuedOn']);
|
||||
}
|
||||
$dl[get_string('dateawarded', 'badges')] = userdate($issued['issuedOn']);
|
||||
if (isset($issued['expires'])) {
|
||||
$issued['expires'] = !preg_match( '~^[1-9][0-9]*$~', $issued['expires'] ) ?
|
||||
strtotime($issued['expires']) : $issued['expires'];
|
||||
if (!is_numeric($issued['expires'])) {
|
||||
$issued['expires'] = strtotime($issued['expires']);
|
||||
}
|
||||
if ($issued['expires'] < $now) {
|
||||
$dl[get_string('expirydate', 'badges')] = userdate($issued['expires']) . get_string('warnexpired', 'badges');
|
||||
|
||||
@@ -508,7 +510,7 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$output .= html_writer::empty_tag('img', array('src' => $issued->image, 'width' => '100'));
|
||||
if (isset($assertion->expires)) {
|
||||
$expiration = !strtotime($assertion->expires) ? s($assertion->expires) : strtotime($assertion->expires);
|
||||
$expiration = is_numeric($assertion->expires) ? $assertion->expires : strtotime($assertion->expires);
|
||||
if ($expiration < $today) {
|
||||
$output .= $this->output->pix_icon('i/expired',
|
||||
get_string('expireddate', 'badges', userdate($expiration)),
|
||||
@@ -564,7 +566,7 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
|
||||
$dl = array();
|
||||
if (isset($assertion->issued_on)) {
|
||||
$issuedate = !strtotime($assertion->issued_on) ? s($assertion->issued_on) : strtotime($assertion->issued_on);
|
||||
$issuedate = is_numeric($assertion->issued_on) ? $assertion->issued_on : strtotime($assertion->issued_on);
|
||||
$dl[get_string('dateawarded', 'badges')] = userdate($issuedate);
|
||||
}
|
||||
if (isset($assertion->expires)) {
|
||||
|
||||
@@ -57,5 +57,8 @@ function xmldb_block_badges_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,5 +57,8 @@ function xmldb_block_calendar_month_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,5 +57,8 @@ function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -58,5 +58,8 @@ function xmldb_block_community_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -60,5 +60,8 @@ function xmldb_block_completionstatus_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -60,5 +60,8 @@ function xmldb_block_course_summary_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,5 +45,8 @@ function xmldb_block_html_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<span class="sr-only">
|
||||
{{#str}}aria:coursecategory, core_course{{/str}}
|
||||
</span>
|
||||
<span class="categoryname">
|
||||
<span class="categoryname text-truncate">
|
||||
{{{coursecategory}}}
|
||||
</span>
|
||||
{{/coursecategory}}
|
||||
|
||||
@@ -67,5 +67,8 @@ function xmldb_block_navigation_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,5 +57,8 @@ function xmldb_block_quiz_results_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -59,5 +59,8 @@ function xmldb_block_recent_activity_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,11 +53,13 @@ class helper {
|
||||
return $recentitems;
|
||||
}
|
||||
|
||||
// Determine sort sql clause.
|
||||
$sort = 'timeaccess DESC';
|
||||
|
||||
$paramsql = array('userid' => $userid);
|
||||
$records = $DB->get_records('block_recentlyaccesseditems', $paramsql, $sort);
|
||||
$sql = "SELECT rai.*
|
||||
FROM {block_recentlyaccesseditems} rai
|
||||
JOIN {course} c ON c.id = rai.courseid
|
||||
WHERE userid = :userid
|
||||
ORDER BY rai.timeaccess DESC";
|
||||
$records = $DB->get_records_sql($sql, $paramsql);
|
||||
$order = 0;
|
||||
|
||||
// Get array of items by course. Use $order index to keep sql sorted results.
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This file keeps track of upgrades to the recentlyaccesseditems block
|
||||
*
|
||||
* Sometimes, changes between versions involve alterations to database structures
|
||||
* and other major things that may break installations.
|
||||
*
|
||||
* The upgrade function in this file will attempt to perform all the necessary
|
||||
* actions to upgrade your older installation to the current version.
|
||||
*
|
||||
* If there's something it cannot do itself, it will tell you what you need to do.
|
||||
*
|
||||
* The commands in here will all be database-neutral, using the methods of
|
||||
* database_manager class
|
||||
*
|
||||
* Please do not forget to use upgrade_set_timeout()
|
||||
* before any action that may take longer time to finish.
|
||||
*
|
||||
* @package block_recentlyaccesseditems
|
||||
* @copyright 2019 Peter Dias
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Upgrade the recentlyaccesseditems db table.
|
||||
*
|
||||
* @param $oldversion
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_block_recentlyaccesseditems_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2019052001) {
|
||||
$sql = "courseid NOT IN (SELECT c.id from {course} c) OR cmid NOT IN (SELECT cm.id from {course_modules} cm)";
|
||||
$DB->delete_records_select("block_recentlyaccesseditems", $sql);
|
||||
upgrade_block_savepoint(true, 2019052001, 'recentlyaccesseditems', false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// This file is part of Moodle - https://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/>.
|
||||
|
||||
/**
|
||||
* The interface library between the core and the subsystem.
|
||||
*
|
||||
* @package block_recentlyaccesseditems
|
||||
* @copyright 2019 Peter Dias <peter@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Pre-delete course module hook to cleanup any records with references to the deleted module.
|
||||
*
|
||||
* @param stdClass $cm The deleted course module
|
||||
*/
|
||||
function block_recentlyaccesseditems_pre_course_module_delete($cm) {
|
||||
global $DB;
|
||||
|
||||
$DB->delete_records('block_recentlyaccesseditems', ['cmid' => $cm->id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-delete course hook to cleanup any records with references to the deleted course.
|
||||
*
|
||||
* @param stdClass $course The deleted course
|
||||
*/
|
||||
function block_recentlyaccesseditems_pre_course_delete($course) {
|
||||
global $DB;
|
||||
|
||||
$DB->delete_records('block_recentlyaccesseditems', ['courseid' => $course->id]);
|
||||
}
|
||||
@@ -103,5 +103,15 @@ class block_recentlyaccesseditems_externallib_testcase extends externallib_advan
|
||||
}
|
||||
$this->assertTrue($record->timeaccess < $result[$key - 1]->timeaccess);
|
||||
}
|
||||
|
||||
// Delete a course and confirm it's activities don't get returned.
|
||||
delete_course($courses[0], false);
|
||||
$result = \block_recentlyaccesseditems\external::get_recent_items();
|
||||
$this->assertCount((count($forum) + count($chat)) - 2, $result);
|
||||
|
||||
// Delete a single course module should still return.
|
||||
course_delete_module($forum[1]->cmid);
|
||||
$result = \block_recentlyaccesseditems\external::get_recent_items();
|
||||
$this->assertCount((count($forum) + count($chat)) - 3, $result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Block recentlyaccesseditems helper tests.
|
||||
*
|
||||
* @package block_recentlyaccesseditems
|
||||
* @copyright 2019 University of Nottingham
|
||||
* @author Neill Magill <neill.magill@nottingham.ac.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
use block_recentlyaccesseditems\helper;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Block Recently accessed helper class tests.
|
||||
*
|
||||
* @package block_recentlyaccesseditems
|
||||
* @copyright 2019 University of Nottingham
|
||||
* @author Neill Magill <neill.magill@nottingham.ac.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class block_recentlyaccesseditems_helper_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tests that the get recent items method can handle getting records when courses have been deleted.
|
||||
*/
|
||||
public function test_get_recent_items() {
|
||||
$this->resetAfterTest();
|
||||
$course = self::getDataGenerator()->create_course();
|
||||
$coursetodelete = self::getDataGenerator()->create_course();
|
||||
$user = self::getDataGenerator()->create_and_enrol($course, 'student');
|
||||
self::getDataGenerator()->enrol_user($user->id, $coursetodelete->id, 'student');
|
||||
|
||||
// Add an activity to each course.
|
||||
$forum = self::getDataGenerator()->create_module('forum', ['course' => $course]);
|
||||
$glossary = self::getDataGenerator()->create_module('glossary', ['course' => $coursetodelete]);
|
||||
self::setUser($user);
|
||||
|
||||
// Get the user to visit the activities.
|
||||
$event1params = ['context' => context_module::instance($forum->cmid), 'objectid' => $forum->id];
|
||||
$event1 = \mod_forum\event\course_module_viewed::create($event1params);
|
||||
$event1->trigger();
|
||||
$event2params = ['context' => context_module::instance($glossary->cmid), 'objectid' => $glossary->id];
|
||||
$event2 = \mod_glossary\event\course_module_viewed::create($event2params);
|
||||
$event2->trigger();
|
||||
$recent1 = helper::get_recent_items();
|
||||
self::assertCount(2, $recent1);
|
||||
$recentlimited = helper::get_recent_items(1);
|
||||
self::assertCount(1, $recentlimited);
|
||||
delete_course($coursetodelete, false);
|
||||
|
||||
// There should be no errors if a course has been deleted.
|
||||
$recent2 = helper::get_recent_items();
|
||||
self::assertCount(1, $recent2);
|
||||
}
|
||||
}
|
||||
@@ -207,6 +207,60 @@ class block_recentlyaccesseditems_privacy_testcase extends \core_privacy\tests\p
|
||||
// Confirm student's data is exported.
|
||||
$writer = \core_privacy\local\request\writer::with_context($studentcontext);
|
||||
$this->assertTrue($writer->has_any_data());
|
||||
|
||||
delete_course($course, false);
|
||||
$sc = context_user::instance($student->id);
|
||||
$approvedlist = new approved_contextlist($student, $component, [$sc->id]);
|
||||
provider::export_user_data($approvedlist);
|
||||
$writer = \core_privacy\local\request\writer::with_context($sc);
|
||||
$this->assertTrue($writer->has_any_data());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exporting data for an approved contextlist with a deleted course
|
||||
*/
|
||||
public function test_export_user_data_with_deleted_course() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
$component = 'block_recentlyaccesseditems';
|
||||
|
||||
$student = $generator->create_user();
|
||||
$studentcontext = context_user::instance($student->id);
|
||||
|
||||
// Enrol user in course and add course items.
|
||||
$course = $generator->create_course();
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
$forum = $generator->create_module('forum', ['course' => $course]);
|
||||
$chat = $generator->create_module('chat', ['course' => $course]);
|
||||
|
||||
// Generate some recent activity.
|
||||
$this->setUser($student);
|
||||
$event = \mod_forum\event\course_module_viewed::create(['context' => context_module::instance($forum->cmid),
|
||||
'objectid' => $forum->id]);
|
||||
$event->trigger();
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event->trigger();
|
||||
|
||||
// Confirm data is present.
|
||||
$params = [
|
||||
'courseid' => $course->id,
|
||||
'userid' => $student->id,
|
||||
];
|
||||
|
||||
$result = $DB->count_records('block_recentlyaccesseditems', $params);
|
||||
$this->assertEquals(2, $result);
|
||||
delete_course($course, false);
|
||||
|
||||
// Export data for student.
|
||||
$approvedlist = new approved_contextlist($student, $component, [$studentcontext->id]);
|
||||
provider::export_user_data($approvedlist);
|
||||
|
||||
// Confirm student's data is exported.
|
||||
$writer = \core_privacy\local\request\writer::with_context($studentcontext);
|
||||
$this->assertFalse($writer->has_any_data());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2019052000; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2019052001; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2019051100; // Requires this Moodle version.
|
||||
$plugin->component = 'block_recentlyaccesseditems'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -45,5 +45,8 @@ function xmldb_block_rss_client_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ $string['editfeeds'] = 'Edit, subscribe or unsubscribe from RSS/Atom news feeds'
|
||||
$string['editnewsfeeds'] = 'Edit news feeds';
|
||||
$string['editrssblock'] = 'Edit RSS headline block';
|
||||
$string['enableautodiscovery'] = 'Enable auto-discovery of feeds?';
|
||||
$string['enableautodiscovery_help'] = 'If enabled, feeds on web pages are found automatically. For example, if http://docs.moodle.org is entered, then http://docs.moodle.org/en/index.php?title=Special:RecentChanges&feed=rss would be found.';
|
||||
$string['enableautodiscovery_help'] = 'If enabled, feeds on web pages are found automatically. For example, if https://docs.moodle.org is entered, then https://docs.moodle.org/en/index.php?title=Special:RecentChanges&feed=rss would be found.';
|
||||
$string['failedfeed'] = 'Feed failed to download - will retry after {$a}';
|
||||
$string['failedfeeds'] = 'One or more RSS feeds have failed';
|
||||
$string['feed'] = 'Feed';
|
||||
|
||||
@@ -61,5 +61,8 @@ function xmldb_block_section_links_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -60,5 +60,8 @@ function xmldb_block_selfcompletion_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -67,5 +67,8 @@ function xmldb_block_settings_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,16 @@
|
||||
</div>
|
||||
<div class="w-100 event-name-container text-truncate line-height-3">
|
||||
<a href="{{url}}"
|
||||
title="{{name}}"
|
||||
aria-label='{{#str}} ariaeventlistitem, block_timeline, { "name": "{{name}}", "course": "{{course.fullnamedisplay}}", "date": "{{#userdate}} {{timesort}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}" } {{/str}}'
|
||||
><h6 class="event-name text-truncate mb-0">{{{name}}}</h6></a>
|
||||
<small class="text-muted text-truncate mb-0">{{{course.fullnamedisplay}}}</small>
|
||||
title={{#quote}}{{{name}}}{{/quote}}
|
||||
aria-label='{{#str}} ariaeventlistitem, block_timeline, { "name": {{#quote}}{{{name}}}{{/quote}}, "course": {{#quote}}{{{course.fullnamedisplay}}}{{/quote}}, "date": "{{#userdate}} {{timesort}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}" } {{/str}}'
|
||||
><h6 class="event-name text-truncate mb-0">{{#quote}}{{{name}}}{{/quote}}</h6></a>
|
||||
<small class="text-muted text-truncate mb-0">{{#quote}}{{{course.fullnamedisplay}}}{{/quote}}</small>
|
||||
{{#action.actionable}}
|
||||
<h6 class="mb-0 pt-2">
|
||||
<a href="{{{action.url}}}" aria-label="{{{action.name}}}" title="{{{action.name}}}" class="list-group-item-action">{{{action.name}}}</a>
|
||||
{{#action.showitemcount}}
|
||||
<span class="badge badge-secondary">{{action.itemcount}}</span>
|
||||
{{/action.showitemcount}}
|
||||
</h6>
|
||||
{{/action.actionable}}
|
||||
</div>
|
||||
|
||||
+3
-1
@@ -275,7 +275,9 @@ class event_exporter_base extends exporter {
|
||||
}
|
||||
$timesort = $event->get_times()->get_sort_time()->getTimestamp();
|
||||
$iconexporter = new event_icon_exporter($event, ['context' => $context]);
|
||||
$values['normalisedeventtypetext'] = get_string('type' . $values['normalisedeventtype'], 'calendar');
|
||||
$identifier = 'type' . $values['normalisedeventtype'];
|
||||
$stringexists = get_string_manager()->string_exists($identifier, 'calendar');
|
||||
$values['normalisedeventtypetext'] = $stringexists ? get_string($identifier, 'calendar') : '';
|
||||
|
||||
$values['icon'] = $iconexporter->export($output);
|
||||
|
||||
|
||||
@@ -100,8 +100,6 @@ class footer_options_exporter extends exporter {
|
||||
$params['course'] = $this->calendar->course->id;
|
||||
} else if (null !== $this->calendar->categoryid && $this->calendar->categoryid > 0) {
|
||||
$params['category'] = $this->calendar->categoryid;
|
||||
} else {
|
||||
$params['course'] = SITEID;
|
||||
}
|
||||
|
||||
return $params;
|
||||
|
||||
@@ -100,9 +100,6 @@ class event_vault implements event_vault_interface {
|
||||
$ignorehidden = true,
|
||||
callable $filter = null
|
||||
) {
|
||||
if ($limitnum < 1 || $limitnum > 200) {
|
||||
throw new limit_invalid_parameter_exception("Limit must be between 1 and 200 (inclusive)");
|
||||
}
|
||||
|
||||
$fromquery = function($field, $timefrom, $lastseenmethod, $afterevent, $withduration) {
|
||||
if (!$timefrom) {
|
||||
@@ -186,7 +183,11 @@ class event_vault implements event_vault_interface {
|
||||
}
|
||||
}
|
||||
|
||||
$offset += $limitnum;
|
||||
if (!$limitnum) {
|
||||
break;
|
||||
} else {
|
||||
$offset += $limitnum;
|
||||
}
|
||||
}
|
||||
|
||||
return $events;
|
||||
|
||||
@@ -98,7 +98,7 @@ trait eventtype {
|
||||
$mform->hideIf('categoryid', 'eventtype', 'noteq', 'category');
|
||||
}
|
||||
|
||||
$showall = $CFG->calendar_adminseesall && !has_capability('moodle/calendar:manageentries', \context_system::instance());
|
||||
$showall = is_siteadmin() && !empty($CFG->calendar_adminseesall);
|
||||
if (!empty($eventtypes['course'])) {
|
||||
$mform->addElement('course', 'courseid', get_string('course'), ['limittoenrolled' => !$showall]);
|
||||
$mform->hideIf('courseid', 'eventtype', 'noteq', 'course');
|
||||
|
||||
@@ -186,9 +186,9 @@ if(!empty($what) && !empty($time)) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$limitnum = 0;
|
||||
$events = calendar_get_legacy_events($timestart, $timeend, $users, $groups, array_keys($paramcourses), false, true,
|
||||
$paramcategory);
|
||||
$paramcategory, $limitnum);
|
||||
|
||||
$ical = new iCalendar;
|
||||
$ical->add_property('method', 'PUBLISH');
|
||||
|
||||
@@ -870,6 +870,11 @@ class core_calendar_external extends external_api {
|
||||
self::validate_context($context);
|
||||
parse_str($params['formdata'], $data);
|
||||
|
||||
if (WS_SERVER) {
|
||||
// Request via WS, ignore sesskey checks in form library.
|
||||
$USER->ignoresesskey = true;
|
||||
}
|
||||
|
||||
$eventtype = isset($data['eventtype']) ? $data['eventtype'] : null;
|
||||
$coursekey = ($eventtype == 'group') ? 'groupcourseid' : 'courseid';
|
||||
$courseid = (!empty($data[$coursekey])) ? $data[$coursekey] : null;
|
||||
|
||||
+7
-5
@@ -3237,10 +3237,12 @@ function core_calendar_user_preferences() {
|
||||
* or events in progress/already started selected as well
|
||||
* @param boolean $ignorehidden whether to select only visible events or all events
|
||||
* @param array $categories array of category ids and/or objects.
|
||||
* @param int $limitnum Number of events to fetch or zero to fetch all.
|
||||
*
|
||||
* @return array $events of selected events or an empty array if there aren't any (or there was an error)
|
||||
*/
|
||||
function calendar_get_legacy_events($tstart, $tend, $users, $groups, $courses,
|
||||
$withduration = true, $ignorehidden = true, $categories = []) {
|
||||
$withduration = true, $ignorehidden = true, $categories = [], $limitnum = 0) {
|
||||
// Normalise the users, groups and courses parameters so that they are compliant with \core_calendar\local\api::get_events().
|
||||
// Existing functions that were using the old calendar_get_events() were passing a mixture of array, int, boolean for these
|
||||
// parameters, but with the new API method, only null and arrays are accepted.
|
||||
@@ -3277,7 +3279,7 @@ function calendar_get_legacy_events($tstart, $tend, $users, $groups, $courses,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
40,
|
||||
$limitnum,
|
||||
null,
|
||||
$userparam,
|
||||
$groupparam,
|
||||
@@ -3314,7 +3316,7 @@ function calendar_get_view(\calendar_information $calendar, $view, $includenavig
|
||||
$calendardate = $type->timestamp_to_date_array($calendar->time);
|
||||
|
||||
$date = new \DateTime('now', core_date::get_user_timezone_object(99));
|
||||
$eventlimit = 200;
|
||||
$eventlimit = 0;
|
||||
|
||||
if ($view === 'day') {
|
||||
$tstart = $type->convert_to_timestamp($calendardate['year'], $calendardate['mon'], $calendardate['mday']);
|
||||
@@ -3500,7 +3502,7 @@ function calendar_output_fragment_event_form($args) {
|
||||
$eventtypes = calendar_get_allowed_event_types($courseid);
|
||||
|
||||
// If the user is on course context and is allowed to add course events set the event type default to course.
|
||||
if ($courseid != SITEID && !empty($eventtypes['course'])) {
|
||||
if (!empty($courseid) && !empty($eventtypes['course'])) {
|
||||
$data['eventtype'] = 'course';
|
||||
$data['courseid'] = $courseid;
|
||||
$data['groupcourseid'] = $courseid;
|
||||
@@ -3686,7 +3688,7 @@ function calendar_get_allowed_event_types(int $courseid = null) {
|
||||
|
||||
$types['user'] = has_capability('moodle/calendar:manageownentries', $context);
|
||||
|
||||
if (has_capability('moodle/calendar:manageentries', $context) || !empty($CFG->calendar_adminseesall)) {
|
||||
if (has_capability('moodle/calendar:manageentries', $context)) {
|
||||
$types['course'] = true;
|
||||
|
||||
$types['group'] = (!empty($groups) && has_capability('moodle/site:accessallgroups', $context))
|
||||
|
||||
@@ -129,6 +129,10 @@ $params = [];
|
||||
$usedefaultfilters = true;
|
||||
if (!empty($courseid) && $courseid == SITEID && !empty($types['site'])) {
|
||||
$searches[] = "(eventtype = 'site')";
|
||||
$usedefaultfilters = false;
|
||||
}
|
||||
|
||||
if (!empty($types['user'])) {
|
||||
$searches[] = "(eventtype = 'user' AND userid = :userid)";
|
||||
$params['userid'] = $USER->id;
|
||||
$usedefaultfilters = false;
|
||||
|
||||
@@ -59,10 +59,12 @@
|
||||
<div class="col-xs-1">{{#pix}} i/calendareventtime, core, {{#str}} when, core_calendar {{/str}} {{/pix}}</div>
|
||||
<div class="col-xs-11">{{{formattedtime}}}</div>
|
||||
</div>
|
||||
<div class="row mt-1">
|
||||
<div class="col-xs-1">{{#pix}} i/calendar, core, {{#str}} eventtype, core_calendar {{/str}} {{/pix}}</div>
|
||||
<div class="col-xs-11">{{normalisedeventtypetext}}</div>
|
||||
</div>
|
||||
{{#normalisedeventtypetext}}
|
||||
<div class="row mt-1">
|
||||
<div class="col-xs-1">{{#pix}} i/calendar, core, {{#str}} eventtype, core_calendar {{/str}} {{/pix}}</div>
|
||||
<div class="col-xs-11">{{normalisedeventtypetext}}</div>
|
||||
</div>
|
||||
{{/normalisedeventtypetext}}
|
||||
{{#description}}
|
||||
<div class="row mt-1">
|
||||
<div class="col-xs-1">{{#pix}} i/calendareventdescription, core, {{#str}} description {{/str}} {{/pix}}</div>
|
||||
|
||||
@@ -124,4 +124,16 @@ class behat_calendar extends behat_base {
|
||||
$this->getSession()->visit($this->locate_path('/calendar/view.php?view=month&course=1&time='.$time));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigate to site calendar.
|
||||
*
|
||||
* @Given /^I am viewing site calendar$/
|
||||
* @throws coding_exception
|
||||
* @return void
|
||||
*/
|
||||
public function i_am_viewing_site_calendar() {
|
||||
$url = new moodle_url('/calendar/view.php', ['view' => 'month']);
|
||||
$this->getSession()->visit($this->locate_path($url->out_as_local_url(false)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ Feature: Perform basic calendar functionality
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
| Course 2 | C2 | topics |
|
||||
| Course 3 | C3 | topics |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
@@ -177,3 +179,62 @@ Feature: Perform basic calendar functionality
|
||||
And I set the field "Type of event" to "Course"
|
||||
When I click on "Save" "button"
|
||||
And I should see "Select a course" in the "Course" "form_row"
|
||||
|
||||
@javascript
|
||||
Scenario: Default event type selection in the event form
|
||||
Given I log in as "teacher1"
|
||||
When I am viewing site calendar
|
||||
And I click on "New event" "button"
|
||||
Then the field "Type of event" matches value "User"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "This month"
|
||||
When I click on "New event" "button"
|
||||
Then the field "Type of event" matches value "Course"
|
||||
|
||||
@javascript
|
||||
Scenario: Admin can only see all courses if calendar_adminseesall setting is enabled.
|
||||
Given I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I enrol "admin" user as "Teacher"
|
||||
And I am viewing site calendar
|
||||
And I click on "New event" "button"
|
||||
And I set the field "Type of event" to "Course"
|
||||
When I open the autocomplete suggestions list
|
||||
Then I should see "Course 1" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I should not see "Course 2" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I should not see "Course 3" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I click on "Close" "button"
|
||||
And I am on site homepage
|
||||
And I navigate to "Appearance > Calendar" in site administration
|
||||
And I set the field "Admins see all" to "1"
|
||||
And I press "Save changes"
|
||||
And I am viewing site calendar
|
||||
And I click on "New event" "button"
|
||||
And I set the field "Type of event" to "Course"
|
||||
When I open the autocomplete suggestions list
|
||||
Then I should see "Course 1" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I should see "Course 2" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I should see "Course 3" in the ".form-autocomplete-suggestions" "css_element"
|
||||
|
||||
@javascript
|
||||
Scenario: Students can only see user event type by default.
|
||||
Given I log in as "student1"
|
||||
And I am viewing site calendar
|
||||
When I click on "New event" "button"
|
||||
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "This month"
|
||||
When I click on "New event" "button"
|
||||
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
|
||||
And I click on "Close" "button"
|
||||
And I log out
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Appearance > Calendar" in site administration
|
||||
And I set the field "Admins see all" to "1"
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "This month"
|
||||
When I click on "New event" "button"
|
||||
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
|
||||
|
||||
+8
-1
@@ -4,10 +4,17 @@
|
||||
"description": "Moodle - the world's open source learning platform",
|
||||
"type": "project",
|
||||
"homepage": "https://moodle.org",
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/moodlehq/php-webdriver.git"
|
||||
}
|
||||
],
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "7.5.*",
|
||||
"phpunit/dbunit": "4.0.*",
|
||||
"moodlehq/behat-extension": "3.37.0",
|
||||
"mikey179/vfsstream": "^1.6"
|
||||
"mikey179/vfsstream": "^1.6",
|
||||
"instaclick/php-webdriver": "dev-local as 1.x-dev"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+59
-42
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "3517a4473544055cd8523bb076cad8f6",
|
||||
"content-hash": "6a672c1cc2c9d005b5eab7c22af1ac49",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
@@ -808,16 +808,16 @@
|
||||
},
|
||||
{
|
||||
"name": "instaclick/php-webdriver",
|
||||
"version": "1.4.5",
|
||||
"version": "dev-local",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/instaclick/php-webdriver.git",
|
||||
"reference": "6fa959452e774dcaed543faad3a9d1a37d803327"
|
||||
"url": "https://github.com/moodlehq/php-webdriver.git",
|
||||
"reference": "e311e55bf2c4746db9df72707f3cf1a731ad98aa"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/6fa959452e774dcaed543faad3a9d1a37d803327",
|
||||
"reference": "6fa959452e774dcaed543faad3a9d1a37d803327",
|
||||
"url": "https://api.github.com/repos/moodlehq/php-webdriver/zipball/e311e55bf2c4746db9df72707f3cf1a731ad98aa",
|
||||
"reference": "e311e55bf2c4746db9df72707f3cf1a731ad98aa",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -839,7 +839,6 @@
|
||||
"WebDriver": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
@@ -863,7 +862,10 @@
|
||||
"webdriver",
|
||||
"webtest"
|
||||
],
|
||||
"time": "2017-06-30T04:02:48+00:00"
|
||||
"support": {
|
||||
"source": "https://github.com/moodlehq/php-webdriver/tree/local"
|
||||
},
|
||||
"time": "2019-06-03T22:55:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikey179/vfsStream",
|
||||
@@ -1633,16 +1635,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "7.5.9",
|
||||
"version": "7.5.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160"
|
||||
"reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/134669cf0eeac3f79bc7f0c793efbc158bffc160",
|
||||
"reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c",
|
||||
"reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1713,7 +1715,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2019-04-19T15:50:46+00:00"
|
||||
"time": "2019-05-28T11:59:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@@ -2469,16 +2471,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
"version": "v4.2.8",
|
||||
"version": "v4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/browser-kit.git",
|
||||
"reference": "c09c18cca96d7067152f78956faf55346c338283"
|
||||
"reference": "3fa7d8cbd2e5006038a09b8ef93f3859a89b627e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/c09c18cca96d7067152f78956faf55346c338283",
|
||||
"reference": "c09c18cca96d7067152f78956faf55346c338283",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/3fa7d8cbd2e5006038a09b8ef93f3859a89b627e",
|
||||
"reference": "3fa7d8cbd2e5006038a09b8ef93f3859a89b627e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2487,6 +2489,8 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/css-selector": "~3.4|~4.0",
|
||||
"symfony/http-client": "^4.3",
|
||||
"symfony/mime": "^4.3",
|
||||
"symfony/process": "~3.4|~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
@@ -2495,7 +2499,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.2-dev"
|
||||
"dev-master": "4.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -2522,11 +2526,11 @@
|
||||
],
|
||||
"description": "Symfony BrowserKit Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-04-07T09:56:43+00:00"
|
||||
"time": "2019-04-15T20:15:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/class-loader",
|
||||
"version": "v3.4.27",
|
||||
"version": "v3.4.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/class-loader.git",
|
||||
@@ -2582,7 +2586,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
"version": "v3.4.27",
|
||||
"version": "v3.4.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/config.git",
|
||||
@@ -2714,7 +2718,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v3.4.27",
|
||||
"version": "v3.4.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
@@ -2767,16 +2771,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v3.4.27",
|
||||
"version": "v3.4.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "681afbb26488903c5ac15e63734f1d8ac430c9b9"
|
||||
"reference": "671fc55bd14800668b1d0a3708c3714940e30a8c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/681afbb26488903c5ac15e63734f1d8ac430c9b9",
|
||||
"reference": "681afbb26488903c5ac15e63734f1d8ac430c9b9",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/671fc55bd14800668b1d0a3708c3714940e30a8c",
|
||||
"reference": "671fc55bd14800668b1d0a3708c3714940e30a8c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2819,7 +2823,7 @@
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-04-11T09:48:14+00:00"
|
||||
"time": "2019-05-18T13:32:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
@@ -2893,16 +2897,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v4.2.8",
|
||||
"version": "v4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "53c97769814c80a84a8403efcf3ae7ae966d53bb"
|
||||
"reference": "28edb1d371640654fbfb9df53d70fa03fdf69fb6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/53c97769814c80a84a8403efcf3ae7ae966d53bb",
|
||||
"reference": "53c97769814c80a84a8403efcf3ae7ae966d53bb",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/28edb1d371640654fbfb9df53d70fa03fdf69fb6",
|
||||
"reference": "28edb1d371640654fbfb9df53d70fa03fdf69fb6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2910,7 +2914,11 @@
|
||||
"symfony/polyfill-ctype": "~1.8",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"masterminds/html5": "<2.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"masterminds/html5": "^2.6",
|
||||
"symfony/css-selector": "~3.4|~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
@@ -2919,7 +2927,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.2-dev"
|
||||
"dev-master": "4.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -2946,11 +2954,11 @@
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-02-23T15:17:42+00:00"
|
||||
"time": "2019-04-26T05:53:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v3.4.27",
|
||||
"version": "v3.4.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
@@ -3013,16 +3021,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v4.2.8",
|
||||
"version": "v4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "e16b9e471703b2c60b95f14d31c1239f68f11601"
|
||||
"reference": "988ab7d70c267c34efa85772ca20de3fad11c74b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/e16b9e471703b2c60b95f14d31c1239f68f11601",
|
||||
"reference": "e16b9e471703b2c60b95f14d31c1239f68f11601",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/988ab7d70c267c34efa85772ca20de3fad11c74b",
|
||||
"reference": "988ab7d70c267c34efa85772ca20de3fad11c74b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3032,7 +3040,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.2-dev"
|
||||
"dev-master": "4.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -3059,7 +3067,7 @@
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-02-07T11:40:08+00:00"
|
||||
"time": "2019-05-24T12:50:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
@@ -3439,9 +3447,18 @@
|
||||
"time": "2018-12-25T11:19:39+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"aliases": [
|
||||
{
|
||||
"alias": "1.x-dev",
|
||||
"alias_normalized": "1.9999999.9999999.9999999-dev",
|
||||
"version": "dev-local",
|
||||
"package": "instaclick/php-webdriver"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {
|
||||
"instaclick/php-webdriver": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
|
||||
@@ -122,6 +122,8 @@ abstract class course_enrolments extends \core_analytics\local\target\binary {
|
||||
*/
|
||||
public function is_valid_sample($sampleid, \core_analytics\analysable $course, $fortraining = true) {
|
||||
|
||||
$now = time();
|
||||
|
||||
$userenrol = $this->retrieve('user_enrolments', $sampleid);
|
||||
if ($userenrol->timeend && $course->get_start() > $userenrol->timeend) {
|
||||
// Discard enrolments which time end is prior to the course start. This should get rid of
|
||||
@@ -139,9 +141,22 @@ abstract class course_enrolments extends \core_analytics\local\target\binary {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($userenrol->timestart && $userenrol->timestart > $course->get_end()) ||
|
||||
(!$userenrol->timestart && $userenrol->timecreated > $course->get_end())) {
|
||||
// Discard user enrolments that starts after the analysable official end.
|
||||
if ($course->get_end()) {
|
||||
if (($userenrol->timestart && $userenrol->timestart > $course->get_end()) ||
|
||||
(!$userenrol->timestart && $userenrol->timecreated > $course->get_end())) {
|
||||
// Discard user enrolments that starts after the analysable official end.
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($now < $userenrol->timestart && $userenrol->timestart) {
|
||||
// Discard enrolments whose start date is after now (no need to check timecreated > $now :P).
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$fortraining && $userenrol->timeend && $userenrol->timeend < $now) {
|
||||
// We don't want to generate predictions for finished enrolments.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -488,11 +488,6 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||
foreach ($modinfo->sections[$section->section] as $cmid) {
|
||||
$thismod = $modinfo->cms[$cmid];
|
||||
|
||||
if ($thismod->modname == 'label') {
|
||||
// Labels are special (not interesting for students)!
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($thismod->uservisible) {
|
||||
if (isset($sectionmods[$thismod->modname])) {
|
||||
$sectionmods[$thismod->modname]['name'] = $thismod->modplural;
|
||||
|
||||
@@ -65,5 +65,8 @@ function xmldb_format_topics_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -101,5 +101,8 @@ function xmldb_format_weeks_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
</a>
|
||||
<div class="card-body pr-1 course-info-container" id="course-info-container-{{id}}-{{uniqid}}">
|
||||
<div class="d-flex align-items-start">
|
||||
<div>
|
||||
<div class="text-muted muted d-flex w-100 mb-1 text-truncate flex-wrap">
|
||||
<div class="w-100 text-truncate">
|
||||
<div class="text-muted muted d-flex mb-1 flex-wrap">
|
||||
{{$coursecategory}}{{/coursecategory}}
|
||||
{{#showshortname}}
|
||||
{{$divider}}{{/divider}}
|
||||
@@ -56,7 +56,7 @@
|
||||
</div>
|
||||
{{/showshortname}}
|
||||
</div>
|
||||
<a href="{{viewurl}}" class="coursename mr-2 text-truncate">
|
||||
<a href="{{viewurl}}" class="coursename mr-2">
|
||||
{{> core_course/favouriteicon }}
|
||||
<span class="sr-only">
|
||||
{{#str}}aria:coursename, core_course{{/str}}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
@core @core_course @app @javascript
|
||||
Feature: Check course completion feature.
|
||||
In order to track the progress of the course on mobile device
|
||||
As a student
|
||||
I need to be able to update the activity completion status.
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | enablecompletion |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
|
||||
Scenario: Complete the activity manually by clicking at the completion checkbox.
|
||||
Given the following "activities" exist:
|
||||
| activity | name | course | idnumber | completion | completionview |
|
||||
| forum | First forum | C1 | forum1 | 1 | 0 |
|
||||
| forum | Second forum | C1 | forum2 | 1 | 0 |
|
||||
When I enter the app
|
||||
And I log in as "student1"
|
||||
And I press "Course 1" near "Recently accessed courses" in the app
|
||||
# Set activities as completed.
|
||||
And I should see "0%"
|
||||
And I press "Not completed: First forum. Select to mark as complete." in the app
|
||||
And I should see "50%"
|
||||
And I press "Not completed: Second forum. Select to mark as complete." in the app
|
||||
And I should see "100%"
|
||||
# Set activities as not completed.
|
||||
And I press "Completed: First forum. Select to mark as not complete." in the app
|
||||
And I should see "50%"
|
||||
And I press "Completed: Second forum. Select to mark as not complete." in the app
|
||||
And I should see "0%"
|
||||
@@ -1,120 +0,0 @@
|
||||
@core @core_course @app @javascript
|
||||
Feature: Test course list shown on app start tab
|
||||
In order to select a course
|
||||
As a student
|
||||
I need to see the correct list of courses
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
| Course 2 | C2 |
|
||||
And the following "users" exist:
|
||||
| username |
|
||||
| student1 |
|
||||
| student2 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
| student2 | C2 | student |
|
||||
|
||||
Scenario: Student is registered on one course
|
||||
When I enter the app
|
||||
And I log in as "student1"
|
||||
Then I should see "Course 1"
|
||||
And I should not see "Course 2"
|
||||
|
||||
Scenario: Student is registered on two courses (shortnames not displayed)
|
||||
When I enter the app
|
||||
And I log in as "student2"
|
||||
Then I should see "Course 1"
|
||||
And I should see "Course 2"
|
||||
And I should not see "C1"
|
||||
And I should not see "C2"
|
||||
|
||||
Scenario: Student is registered on two courses (shortnames displayed)
|
||||
Given the following config values are set as admin:
|
||||
| courselistshortnames | 1 |
|
||||
When I enter the app
|
||||
And I log in as "student2"
|
||||
Then I should see "Course 1"
|
||||
And I should see "Course 2"
|
||||
And I should see "C1"
|
||||
And I should see "C2"
|
||||
|
||||
Scenario: Student uses course list to enter course, then leaves it again
|
||||
When I enter the app
|
||||
And I log in as "student2"
|
||||
And I press "Course 2" near "Course overview" in the app
|
||||
Then the header should be "Course 2" in the app
|
||||
And I press the back button in the app
|
||||
Then the header should be "Acceptance test site" in the app
|
||||
|
||||
Scenario: Student uses filter feature to reduce course list
|
||||
Given the following config values are set as admin:
|
||||
| courselistshortnames | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Frog 3 | C3 |
|
||||
| Frog 4 | C4 |
|
||||
| Course 5 | C5 |
|
||||
| Toad 6 | C6 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student2 | C3 | student |
|
||||
| student2 | C4 | student |
|
||||
| student2 | C5 | student |
|
||||
| student2 | C6 | student |
|
||||
# Create bogus courses so that the main ones aren't shown in the 'recently accessed' part.
|
||||
# Because these come later in alphabetical order, they may not be displayed in the lower part
|
||||
# which is OK.
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Zogus 1 | Z1 |
|
||||
| Zogus 2 | Z2 |
|
||||
| Zogus 3 | Z3 |
|
||||
| Zogus 4 | Z4 |
|
||||
| Zogus 5 | Z5 |
|
||||
| Zogus 6 | Z6 |
|
||||
| Zogus 7 | Z7 |
|
||||
| Zogus 8 | Z8 |
|
||||
| Zogus 9 | Z9 |
|
||||
| Zogus 10 | Z10 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student2 | Z1 | student |
|
||||
| student2 | Z2 | student |
|
||||
| student2 | Z3 | student |
|
||||
| student2 | Z4 | student |
|
||||
| student2 | Z5 | student |
|
||||
| student2 | Z6 | student |
|
||||
| student2 | Z7 | student |
|
||||
| student2 | Z8 | student |
|
||||
| student2 | Z9 | student |
|
||||
| student2 | Z10 | student |
|
||||
When I enter the app
|
||||
And I log in as "student2"
|
||||
Then I should see "C1"
|
||||
And I should see "C2"
|
||||
And I should see "C3"
|
||||
And I should see "C4"
|
||||
And I should see "C5"
|
||||
And I should see "C6"
|
||||
And I press "more" near "Course overview" in the app
|
||||
And I press "Filter my courses" in the app
|
||||
And I set the field "Filter my courses" to "fr" in the app
|
||||
Then I should not see "C1"
|
||||
And I should not see "C2"
|
||||
And I should see "C3"
|
||||
And I should see "C4"
|
||||
And I should not see "C5"
|
||||
And I should not see "C6"
|
||||
And I press "more" near "Course overview" in the app
|
||||
And I press "Filter my courses" in the app
|
||||
Then I should see "C1"
|
||||
And I should see "C2"
|
||||
And I should see "C3"
|
||||
And I should see "C4"
|
||||
And I should see "C5"
|
||||
And I should see "C6"
|
||||
@@ -5021,6 +5021,7 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
* Test the course_get_recent_courses function.
|
||||
*/
|
||||
public function test_course_get_recent_courses() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
@@ -5043,9 +5044,15 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
// No course accessed.
|
||||
$this->assertCount(0, $result);
|
||||
|
||||
$time = time();
|
||||
foreach ($courses as $course) {
|
||||
$context = context_course::instance($course->id);
|
||||
course_view($context);
|
||||
$DB->set_field('user_lastaccess', 'timeaccess', $time, [
|
||||
'userid' => $student->id,
|
||||
'courseid' => $course->id,
|
||||
]);
|
||||
$time++;
|
||||
}
|
||||
|
||||
// Every course accessed.
|
||||
@@ -5056,10 +5063,10 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
$result = course_get_recent_courses($student->id, 2);
|
||||
$this->assertCount(2, $result);
|
||||
|
||||
// Every course accessed, with limit and offset. Should return only the last created course ($course[2]).
|
||||
// Every course accessed, with limit and offset should return the first course.
|
||||
$result = course_get_recent_courses($student->id, 3, 2);
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertArrayHasKey($courses[2]->id, $result);
|
||||
$this->assertArrayHasKey($courses[0]->id, $result);
|
||||
|
||||
// Every course accessed, order by shortname DESC. The last create course ($course[2]) should have the greater shortname.
|
||||
$result = course_get_recent_courses($student->id, 0, 0, 'shortname DESC');
|
||||
|
||||
@@ -55,8 +55,8 @@ class data_controller extends \core_customfield\data_controller {
|
||||
$field = $this->get_field();
|
||||
$config = $field->get('configdata');
|
||||
$elementname = $this->get_form_element_name();
|
||||
// TODO MDL-65506 element 'advcheckbox' does not support 'required' rule. If checkbox is required (i.e. "agree to terms")
|
||||
// then use 'checkbox' form element.
|
||||
// If checkbox is required (i.e. "agree to terms") then use 'checkbox' form element.
|
||||
// The advcheckbox element cannot be used for required fields because advcheckbox elements always provide a value.
|
||||
$isrequired = $field->get_configdata_property('required');
|
||||
$mform->addElement($isrequired ? 'checkbox' : 'advcheckbox', $elementname, $this->get_field()->get_formatted_name());
|
||||
$mform->setDefault($elementname, $config['checkbydefault']);
|
||||
|
||||
@@ -31,7 +31,7 @@ $string['errorconfiglinksyntax'] = 'The link must be a valid URL starting with e
|
||||
$string['errorconfigmaxlen'] = 'The maximum number of characters allowed must be between 1 and 1333.';
|
||||
$string['errormaxlength'] = 'The maximum number of characters allowed in this field is {$a}.';
|
||||
$string['islink'] = 'Link field';
|
||||
$string['islink_help'] = 'To transform the text into a link, enter a URL containing $$ as a placeholder, where $$ will be replaced with the text. For example, to transform a Twitter ID to a link, enter http://twitter.com/$$.';
|
||||
$string['islink_help'] = 'To transform the text into a link, enter a URL containing $$ as a placeholder, where $$ will be replaced with the text. For example, to transform a Twitter ID to a link, enter https://twitter.com/$$.';
|
||||
$string['ispassword'] = 'Password field';
|
||||
$string['linktarget'] = 'Link target';
|
||||
$string['maxlength'] = 'Maximum number of characters';
|
||||
|
||||
@@ -39,5 +39,8 @@ function xmldb_enrol_database_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,5 +39,8 @@ function xmldb_enrol_flatfile_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,5 +39,8 @@ function xmldb_enrol_guest_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user