Compare commits
541 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70fa678586 | |||
| 0c6de97371 | |||
| 63981e5a82 | |||
| 6a0dfc60d6 | |||
| 38c4435a37 | |||
| 3cc4e2f725 | |||
| ca3cbbc233 | |||
| 7d196ef3b3 | |||
| 069b9d5820 | |||
| 454a3d34d5 | |||
| db3a985faf | |||
| c535520966 | |||
| e35ad40de1 | |||
| 436acc27fe | |||
| 73fd6f2928 | |||
| 84e17f59c5 | |||
| 63464df041 | |||
| 17c82085fc | |||
| 5e3ce67f37 | |||
| ec02a34e1f | |||
| 1e1e1b8229 | |||
| f7af2c5fc7 | |||
| 92194c1c8d | |||
| 7bbe8a1c76 | |||
| 22ee65c275 | |||
| 9354f9de64 | |||
| 04d2305788 | |||
| e21e294072 | |||
| 19b7ac05ad | |||
| 4294bbd50f | |||
| b1ffb73177 | |||
| cde1ac3eea | |||
| 059759aab9 | |||
| 188d41ccc9 | |||
| 0b5f9f6e60 | |||
| fa60a11522 | |||
| 29cdf58116 | |||
| 3db24b8015 | |||
| b21b210f41 | |||
| 79482e3fe8 | |||
| 3935371599 | |||
| 14026572ae | |||
| ee66d63054 | |||
| af2d6085cd | |||
| e615d70923 | |||
| ae8388d51c | |||
| 962e3eb662 | |||
| 4c586b025e | |||
| 8612c8aa3e | |||
| a7db91030b | |||
| d807d3c603 | |||
| 8f61b909e8 | |||
| e44ce23c9f | |||
| 6c87b08240 | |||
| 9afdc8fc12 | |||
| e30a500fb9 | |||
| 121d3e0d29 | |||
| 5b7356cdde | |||
| 169d972bf6 | |||
| 4fef0dadf0 | |||
| 96a0d1bc7a | |||
| 01c2ca76c0 | |||
| 46c68c1b42 | |||
| e65f6a7e40 | |||
| 800da1b13d | |||
| a53008f1f0 | |||
| f1a117b86b | |||
| bcbd4140a1 | |||
| c99c5a436e | |||
| b7d36bdbaf | |||
| c21f12e786 | |||
| 2dd1bb44c2 | |||
| 63de9b5cdb | |||
| 24a00cadec | |||
| 3f709d3272 | |||
| def32a798d | |||
| b63524492f | |||
| 46f0136a5a | |||
| 83dbc72f38 | |||
| c6911cefb4 | |||
| dfbdf40af9 | |||
| 3e0fb6862e | |||
| 0e8eba7e1f | |||
| d0209e611f | |||
| ec9ed6d067 | |||
| 3e340aba45 | |||
| de80be59bb | |||
| 310172571b | |||
| a550b70a94 | |||
| 3cd6842501 | |||
| f17c1aadb3 | |||
| 043dffdd34 | |||
| 6fef2ab3db | |||
| 9ffcf8a3e9 | |||
| 56b8f8c8be | |||
| fede68a0ac | |||
| 6588079c5d | |||
| f7e4c3627c | |||
| 6c3f7e0ae6 | |||
| 89d948d86b | |||
| e1dcad3d13 | |||
| 07d000c51e | |||
| 636e7a13b6 | |||
| a57bdfa055 | |||
| 80a57cf924 | |||
| 059d6ffd9f | |||
| fd13953a8a | |||
| 488e115027 | |||
| 72e3ff3c15 | |||
| bd4f6ce186 | |||
| 5416d932d7 | |||
| 27e719e709 | |||
| b577d34861 | |||
| dcd27d9cee | |||
| 863dcb14a8 | |||
| 1a754e8446 | |||
| 95e9f4cc02 | |||
| bac13609ca | |||
| df90a44f3f | |||
| 23fd4f3afc | |||
| 9b39a92170 | |||
| 69c5e60f8c | |||
| cc36a37ea4 | |||
| 2678ee4e81 | |||
| 5a9f3039a7 | |||
| 667784420f | |||
| f628e0ecf6 | |||
| 9ae3b89cc5 | |||
| 098a875e4e | |||
| 9d64f4f078 | |||
| 5fac573391 | |||
| def9c15904 | |||
| d4e9fe521e | |||
| 343cdba46b | |||
| aca74d0d74 | |||
| ce01dbab40 | |||
| 21cf201536 | |||
| dfefe26665 | |||
| de70bc556c | |||
| 7b06a12ef3 | |||
| a415eb505e | |||
| 54a20ea8fc | |||
| a1740aad65 | |||
| 3680b1efa0 | |||
| b90c2e2627 | |||
| 5c53893f97 | |||
| 3049c086a3 | |||
| c644b03f02 | |||
| 7693409caa | |||
| eac59c38f8 | |||
| cd6612b079 | |||
| 7d88829470 | |||
| 9fde80dfa0 | |||
| e787fa6ab4 | |||
| 24cfd4c7d8 | |||
| de33f85405 | |||
| 57e38e1d12 | |||
| ddbf8c29ae | |||
| f265312fcf | |||
| 7dc6674cc4 | |||
| c1b9c51914 | |||
| 14da7f58a4 | |||
| 18221902bc | |||
| 7d9ee66a2f | |||
| de60425a16 | |||
| 4eb3f8d9b7 | |||
| 994e94bf76 | |||
| 2f9f8b5903 | |||
| 3923610e6c | |||
| 0913eb3c2a | |||
| f5b50e0472 | |||
| 09261027b6 | |||
| e0c4e6496f | |||
| 672ce4c6cd | |||
| 13a2a8344c | |||
| 8184f47d6c | |||
| 7a7320af90 | |||
| 70fd9fbb39 | |||
| e16448d3f1 | |||
| 2b4eb2cb71 | |||
| ed798679bb | |||
| 299dcca1b1 | |||
| c16c53d137 | |||
| 52723e1e3f | |||
| 0bcbd5b205 | |||
| ec319d13df | |||
| 0c4422af0b | |||
| 40dcbac3d6 | |||
| 62eb5ef8eb | |||
| 434e8abac8 | |||
| 28add18d9b | |||
| f9220d8138 | |||
| 32237b8308 | |||
| c2ae90c553 | |||
| 7035e0f5b5 | |||
| 6a3777f90c | |||
| de7a6ff47e | |||
| 46e26a1b69 | |||
| 0db0a63e50 | |||
| 120798e85f | |||
| 4679634e36 | |||
| 1c0462deb3 | |||
| 7dc8cc1ab6 | |||
| 170cd579ff | |||
| 6c83de1d51 | |||
| 0ef42d5f6d | |||
| ffc60d23b4 | |||
| 4f5a6ca40e | |||
| a669c6b21e | |||
| e7734513b8 | |||
| 44b4f83298 | |||
| 49053808a2 | |||
| 8ea5d72218 | |||
| e33b7b342a | |||
| f33a8d4eee | |||
| 6a4a1d812c | |||
| c94dce9c89 | |||
| a551ea0210 | |||
| 72b489ef65 | |||
| 827d93f88a | |||
| 884f4d3ec3 | |||
| a072271853 | |||
| 95c794075a | |||
| 890f84cdb2 | |||
| b4e1bbef47 | |||
| 678d051bee | |||
| c83ef7e25b | |||
| 1ee447d3a4 | |||
| 217d523d43 | |||
| 76cebe50cb | |||
| 7dfc04ff98 | |||
| ff037d9698 | |||
| 39dc183d9f | |||
| f7ddcd23f8 | |||
| 92f57f8397 | |||
| 98f246ae97 | |||
| f9e7ee4534 | |||
| b14507a31f | |||
| 4436b9e9dd | |||
| 2568183232 | |||
| bcca23f9c5 | |||
| bab24efe70 | |||
| 45a46ecbd8 | |||
| 64cfe467f8 | |||
| 48f0ebcd49 | |||
| 6537c557b5 | |||
| 225e039e73 | |||
| c8dddb5ccb | |||
| 3e276d6efa | |||
| adf2ea6166 | |||
| fd90d0e925 | |||
| 58a4ce4774 | |||
| b44972cc8b | |||
| 655570df00 | |||
| dbf70dec42 | |||
| c40ed5f6ff | |||
| 2827c7f997 | |||
| 2259fb5f36 | |||
| 6dc7039af9 | |||
| ee7b977a8b | |||
| f4841f394c | |||
| 6973e38a91 | |||
| c1b158b569 | |||
| 21a8a95869 | |||
| 359914c8f6 | |||
| 95208fe135 | |||
| df428648ee | |||
| 9148905e9a | |||
| 64df3fed13 | |||
| ed4aaea57b | |||
| 163fc8588d | |||
| 39e34b9586 | |||
| 5c63ab7ee8 | |||
| 3e3068cd11 | |||
| a27dde0ba7 | |||
| b92400a49f | |||
| a477c8b752 | |||
| 7f52d5c740 | |||
| f52bdbb885 | |||
| 7c519588f1 | |||
| 7345917de4 | |||
| 8a71b10a68 | |||
| 18907a51d5 | |||
| 11d04ffe8a | |||
| 5e1014a76e | |||
| 6e497e6e7d | |||
| 66a4a376ee | |||
| 3563244314 | |||
| bf02dc9819 | |||
| 8e8c066448 | |||
| 67f83d9279 | |||
| bcd1915dd0 | |||
| 992ffccfd2 | |||
| 97fd5a9841 | |||
| 6b47a070e7 | |||
| b4cfb7d733 | |||
| a9fa51024f | |||
| 2eec6ffc6c | |||
| 3f1574f849 | |||
| 40b78a23e9 | |||
| fb5655b5c2 | |||
| 405dcba6f3 | |||
| 7f32c5a447 | |||
| ec3eeb7ace | |||
| 1af3d13bf3 | |||
| 84122523ba | |||
| 382c069e52 | |||
| 3f58a36504 | |||
| 9e41e4e8ea | |||
| 7523d99558 | |||
| 9a375bdf6c | |||
| 07f6358b03 | |||
| 7ffb98d0f5 | |||
| dda99bb3f2 | |||
| 9cff26295b | |||
| 2fd5ceadb5 | |||
| 5865a6875b | |||
| ef2eed1b3c | |||
| 6601017d02 | |||
| a204d7d921 | |||
| bf345fc4ca | |||
| 2722404791 | |||
| 256f820dfd | |||
| 173f5515e3 | |||
| 7ed6f330c6 | |||
| 418d01aaf4 | |||
| 11f9ff55e1 | |||
| 04d4796089 | |||
| e889aee562 | |||
| 228157ebf5 | |||
| c77ae4e017 | |||
| 1da3022e50 | |||
| f6507b8e35 | |||
| d52b937932 | |||
| ce36e3626f | |||
| 063f7c198b | |||
| 83dedbcd33 | |||
| 0ad466926d | |||
| ced9a33352 | |||
| 3b4fba5588 | |||
| 926d5a53ff | |||
| 9cc9dabf17 | |||
| cb8be0b6b8 | |||
| c6bd4c1a45 | |||
| 31e4c05002 | |||
| c5f11c0f3c | |||
| 6158379f75 | |||
| bc076bf1b8 | |||
| 27a3a42efd | |||
| b0c2ea4640 | |||
| 00ef7b1caa | |||
| 7914b0035f | |||
| cb358279b7 | |||
| 339edb47e2 | |||
| bd6bc508df | |||
| c53194f3f9 | |||
| c477dc23c0 | |||
| 8cd421e941 | |||
| f18c2a9d15 | |||
| 403e0d96e5 | |||
| 5984ffded4 | |||
| cd9a925e6a | |||
| 40471ed54c | |||
| 000b0949e6 | |||
| 6c7f60dbc0 | |||
| 3b37e372f2 | |||
| 44b94d9324 | |||
| e5bc84f84f | |||
| a38d0650d4 | |||
| 8d9edc0e7c | |||
| 4e0357c1e3 | |||
| 9efd73abec | |||
| c31b5bbf9d | |||
| 7606ba2133 | |||
| 88c0fcb03f | |||
| 51b7f8f0a4 | |||
| 40fdf0f84f | |||
| 3e99f4f642 | |||
| 324e613b48 | |||
| 502397dcbc | |||
| f1f83c3ba1 | |||
| 2c3f09ccf7 | |||
| e2f5592b8f | |||
| 522fcf2ffc | |||
| 96e743ff78 | |||
| e514ae345e | |||
| 2659b808ab | |||
| 54037cf3e2 | |||
| b0773d70c6 | |||
| 4348fffe0c | |||
| 216c68b834 | |||
| a3c1bd86ed | |||
| e0006399ff | |||
| 2084c59b82 | |||
| a09a9879e5 | |||
| a3a095b6eb | |||
| 0edf724367 | |||
| a953ac5942 | |||
| 5627b0b1a1 | |||
| 5d3a7be453 | |||
| 8f27fdf1ab | |||
| 1d5c2c6560 | |||
| 18317c7c1c | |||
| b83fd5b1fe | |||
| 972304f4cb | |||
| 11eeb2e347 | |||
| 0aa8b11f5c | |||
| 829cafc050 | |||
| 25474b5e84 | |||
| b7f902b5b3 | |||
| 11488775eb | |||
| 32ec7e3d30 | |||
| 1a1eef4345 | |||
| 4942dfc7cd | |||
| d469fb2181 | |||
| 0213ce081c | |||
| 70b6a6618a | |||
| 089cf944f3 | |||
| 68d9adcba8 | |||
| 32636d1757 | |||
| 48ff43d3bd | |||
| 725863abe4 | |||
| 9de4bbf8a8 | |||
| cd7ca81fdd | |||
| 1ca30f2503 | |||
| c47a9439d3 | |||
| 2ce5b1d637 | |||
| c4ade76ee5 | |||
| 62fc665ff6 | |||
| 263865899e | |||
| f927f3e196 | |||
| 70f5e9ba61 | |||
| 3b7bf2cee0 | |||
| a57a9053d7 | |||
| 0292245755 | |||
| dd7aa695b2 | |||
| 2626dce64c | |||
| 7e2e135943 | |||
| cc15b9d46f | |||
| ce47bacfe9 | |||
| 7c89091995 | |||
| 7766ffc618 | |||
| 75efa0860c | |||
| d31412392c | |||
| da694c75ff | |||
| 76f5d7b9ab | |||
| e7d8926583 | |||
| c87f1ac4c7 | |||
| 75c4f5b0ca | |||
| f7b3774380 | |||
| 78293c74bf | |||
| 406fc019c1 | |||
| 903cd37434 | |||
| 6fd8b0098a | |||
| 34954a6050 | |||
| 949d8ae04e | |||
| 1c7cbed23c | |||
| 9156498826 | |||
| 71adc9a9a3 | |||
| 49612b733f | |||
| bc0721c7d9 | |||
| c5452484ee | |||
| 74eecb6078 | |||
| 725be51c11 | |||
| d0d8a7f984 | |||
| 4a50811ae3 | |||
| b82ddcbcac | |||
| 6e4cc6caf4 | |||
| fe8e9b1b4e | |||
| 72770e9a60 | |||
| a847efc70b | |||
| 9e99327888 | |||
| 9973eebb91 | |||
| a162f636d8 | |||
| 8ff8d598fe | |||
| 8704d2e5fc | |||
| f9dd21a17a | |||
| eb349bdfc4 | |||
| 89d186af72 | |||
| 65de977483 | |||
| e167481759 | |||
| 457c913461 | |||
| 422449dca8 | |||
| 53c8f0ca3c | |||
| b094b88a9a | |||
| 49e5d04a8d | |||
| 38e28dfbcd | |||
| 44047dc78d | |||
| c06b8145b1 | |||
| 79da2c5bfa | |||
| a5800adaf0 | |||
| c1c3f50965 | |||
| cff14cf0d1 | |||
| c95ea731bc | |||
| b98f14632b | |||
| a1e1b45ae7 | |||
| 2d44bb544b | |||
| c60d333578 | |||
| 182690b018 | |||
| b36b54179d | |||
| fc4b768e25 | |||
| 7e0f1972f1 | |||
| 93e64c823c | |||
| 20d598f094 | |||
| e376549179 | |||
| 163a317bcc | |||
| 7ecf13ac1d | |||
| 2fbe4fca87 | |||
| d07a8ebd7e | |||
| d4feb70e17 | |||
| f477809e38 | |||
| 94caed45db | |||
| 8c4fdb1073 | |||
| e5bbe44230 | |||
| d0a58fe035 | |||
| 9c68157292 | |||
| 44f71599df | |||
| 1fac7b914b | |||
| cede73411f | |||
| 47deb83b5c | |||
| 4ea56c1c80 | |||
| 311121b16c | |||
| 5863f1b073 | |||
| 2bb195f64f | |||
| f6b50d9901 | |||
| a0b0234a18 | |||
| f8b8a363ae | |||
| b197272987 | |||
| e4976aefc5 | |||
| dcd408b81f | |||
| 4a564ca40b | |||
| 5da06d632a | |||
| d797e57255 | |||
| 55d2042f0a | |||
| 8cd6972966 | |||
| 9cbc0a0cdb | |||
| 931d12b589 | |||
| 0beeb95a8a | |||
| 617f8bb911 | |||
| 75dd21a002 | |||
| a0c13477ab |
+2
-9
@@ -6,6 +6,7 @@ vendor/
|
||||
admin/tool/usertours/amd/src/tour.js
|
||||
admin/tool/usertours/amd/src/popper.js
|
||||
auth/cas/CAS/
|
||||
auth/fc/fcFPP.php
|
||||
enrol/lti/ims-blti/
|
||||
filter/algebra/AlgParser.pm
|
||||
filter/tex/mimetex.*
|
||||
@@ -13,7 +14,6 @@ lib/editor/atto/yui/src/rangy/js/*.*
|
||||
lib/editor/tinymce/plugins/pdw/tinymce/
|
||||
lib/editor/tinymce/plugins/spellchecker/rpc.php
|
||||
lib/editor/tinymce/tiny_mce/
|
||||
lib/mlbackend/php/phpml/
|
||||
lib/adodb/
|
||||
lib/bennu/
|
||||
lib/evalmath/
|
||||
@@ -56,14 +56,9 @@ lib/amd/src/chartjs-lazy.js
|
||||
lib/maxmind/GeoIp2/
|
||||
lib/maxmind/MaxMind/
|
||||
lib/ltiprovider/
|
||||
lib/amd/src/truncate.js
|
||||
lib/fonts/
|
||||
lib/validateurlsyntax.php
|
||||
media/player/videojs/amd/src/video-lazy.js
|
||||
media/player/videojs/amd/src/Youtube-lazy.js
|
||||
media/player/videojs/videojs/
|
||||
media/player/videojs/amd/src/videojs-flash-lazy.js
|
||||
media/player/videojs/videojs/video-js.swf
|
||||
mod/assign/feedback/editpdf/fpdi/
|
||||
repository/s3/S3.php
|
||||
theme/boost/scss/bootstrap/
|
||||
@@ -79,8 +74,6 @@ theme/boost/amd/src/tab.js
|
||||
theme/boost/amd/src/tooltip.js
|
||||
theme/boost/amd/src/util.js
|
||||
theme/boost/amd/src/tether.js
|
||||
theme/boost/scss/fontawesome/
|
||||
theme/bootstrapbase/less/bootstrap/
|
||||
theme/bootstrapbase/javascript/html5shiv.js
|
||||
theme/bootstrapbase/amd/src/bootstrap.js
|
||||
theme/bootstrapbase/less/fontawesome/
|
||||
theme/bootstrapbase/amd/src/bootstrap.js
|
||||
@@ -1,7 +1,4 @@
|
||||
{
|
||||
'plugins': [
|
||||
'promise',
|
||||
],
|
||||
'env': {
|
||||
'browser': true,
|
||||
'amd': true
|
||||
@@ -16,7 +13,6 @@
|
||||
|
||||
// === Possible Errors ===
|
||||
'comma-dangle': 'off',
|
||||
'no-compare-neg-zero': 'error',
|
||||
'no-cond-assign': 'error',
|
||||
'no-console': 'error',
|
||||
'no-constant-condition': 'error',
|
||||
@@ -68,6 +64,7 @@
|
||||
'no-fallthrough': 'error',
|
||||
'no-floating-decimal': 'warn',
|
||||
'no-global-assign': 'warn',
|
||||
// Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
|
||||
'no-implied-eval': 'error',
|
||||
'no-invalid-this': 'error',
|
||||
'no-iterator': 'error',
|
||||
@@ -106,7 +103,6 @@
|
||||
'block-spacing': 'warn',
|
||||
'brace-style': ['warn', '1tbs'],
|
||||
'camelcase': 'warn',
|
||||
'capitalized-comments': ['warn', 'always', { 'ignoreConsecutiveComments': true }],
|
||||
'comma-spacing': ['warn', { 'before': false, 'after': true }],
|
||||
'comma-style': ['warn', 'last'],
|
||||
'computed-property-spacing': 'error',
|
||||
@@ -174,41 +170,11 @@
|
||||
'unicode-bom': 'error',
|
||||
'wrap-regex': 'off',
|
||||
|
||||
// === Promises ===
|
||||
'promise/always-return': 'warn',
|
||||
'promise/no-return-wrap': 'warn',
|
||||
'promise/param-names': 'warn',
|
||||
'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
|
||||
'promise/no-native': 'warn',
|
||||
'promise/no-promise-in-callback': 'warn',
|
||||
'promise/no-callback-in-promise': 'warn',
|
||||
'promise/avoid-new': 'warn',
|
||||
|
||||
// === Deprecations ===
|
||||
"no-restricted-properties": ['warn', {
|
||||
'object': 'M',
|
||||
'property': 'str',
|
||||
'message': 'Use AMD module "core/str" or M.util.get_string()'
|
||||
}],
|
||||
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["**/yui/src/**/*.js"],
|
||||
// Disable some rules which we can't safely define for YUI rollups.
|
||||
rules: {
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'no-unused-expressions': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ["**/amd/src/*.js"],
|
||||
// Check AMD with some slightly stricter rules.
|
||||
rules: {
|
||||
'no-unused-vars': 'error',
|
||||
'no-implicit-globals': 'error'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"indentation": ["on",{
|
||||
"Feature": 0,
|
||||
"Background": 2,
|
||||
"Scenario": 2,
|
||||
"Step": 4,
|
||||
"given": 4,
|
||||
"and": 4
|
||||
}],
|
||||
"no-dupe-feature-names": "on",
|
||||
"no-dupe-scenario-names": "off",
|
||||
"no-empty-file": "on",
|
||||
"no-files-without-scenarios": "on",
|
||||
"no-multiple-empty-lines": "on",
|
||||
"no-partially-commented-tag-lines": "on",
|
||||
"no-trailing-spaces": "on",
|
||||
"no-unamed-features": "on",
|
||||
"no-unamed-scenarios": "on",
|
||||
"no-scenario-outlines-without-examples": "on"
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
**/yui/build/** -diff
|
||||
**/amd/build/** -diff
|
||||
lib/dml/oci_native_moodle_package.sql text eol=lf
|
||||
theme/bootstrapbase/style/editor.css -diff
|
||||
theme/bootstrapbase/style/moodle.css -diff
|
||||
|
||||
+2
-9
@@ -7,6 +7,7 @@ vendor/
|
||||
admin/tool/usertours/amd/src/tour.js
|
||||
admin/tool/usertours/amd/src/popper.js
|
||||
auth/cas/CAS/
|
||||
auth/fc/fcFPP.php
|
||||
enrol/lti/ims-blti/
|
||||
filter/algebra/AlgParser.pm
|
||||
filter/tex/mimetex.*
|
||||
@@ -14,7 +15,6 @@ lib/editor/atto/yui/src/rangy/js/*.*
|
||||
lib/editor/tinymce/plugins/pdw/tinymce/
|
||||
lib/editor/tinymce/plugins/spellchecker/rpc.php
|
||||
lib/editor/tinymce/tiny_mce/
|
||||
lib/mlbackend/php/phpml/
|
||||
lib/adodb/
|
||||
lib/bennu/
|
||||
lib/evalmath/
|
||||
@@ -57,14 +57,9 @@ lib/amd/src/chartjs-lazy.js
|
||||
lib/maxmind/GeoIp2/
|
||||
lib/maxmind/MaxMind/
|
||||
lib/ltiprovider/
|
||||
lib/amd/src/truncate.js
|
||||
lib/fonts/
|
||||
lib/validateurlsyntax.php
|
||||
media/player/videojs/amd/src/video-lazy.js
|
||||
media/player/videojs/amd/src/Youtube-lazy.js
|
||||
media/player/videojs/videojs/
|
||||
media/player/videojs/amd/src/videojs-flash-lazy.js
|
||||
media/player/videojs/videojs/video-js.swf
|
||||
mod/assign/feedback/editpdf/fpdi/
|
||||
repository/s3/S3.php
|
||||
theme/boost/scss/bootstrap/
|
||||
@@ -80,8 +75,6 @@ theme/boost/amd/src/tab.js
|
||||
theme/boost/amd/src/tooltip.js
|
||||
theme/boost/amd/src/util.js
|
||||
theme/boost/amd/src/tether.js
|
||||
theme/boost/scss/fontawesome/
|
||||
theme/bootstrapbase/less/bootstrap/
|
||||
theme/bootstrapbase/javascript/html5shiv.js
|
||||
theme/bootstrapbase/amd/src/bootstrap.js
|
||||
theme/bootstrapbase/less/fontawesome/
|
||||
theme/bootstrapbase/amd/src/bootstrap.js
|
||||
+10
-11
@@ -1,22 +1,18 @@
|
||||
{
|
||||
"plugins": [
|
||||
"stylelint-csstree-validator"
|
||||
],
|
||||
"rules": {
|
||||
"csstree/validator": true,
|
||||
"at-rule-empty-line-before": [ "always",
|
||||
{"except": [ "blockless-after-blockless"], ignore: ["after-comment", "inside-block"]}
|
||||
{"except": [ "blockless-group"], ignore: ["after-comment", "all-nested"]}
|
||||
],
|
||||
"at-rule-name-case": "lower",
|
||||
"at-rule-name-space-after": "always-single-line",
|
||||
"at-rule-no-unknown": null, # Enabled for non-scss in grunt.
|
||||
"at-rule-semicolon-newline-after": "always",
|
||||
"at-rule-semicolon-space-before": "never",
|
||||
"block-closing-brace-newline-after": "always",
|
||||
"block-closing-brace-newline-before": "always",
|
||||
"block-closing-brace-newline-before": "always-multi-line",
|
||||
"block-closing-brace-space-before": "always-single-line",
|
||||
"block-no-empty": true,
|
||||
"block-opening-brace-newline-after": "always",
|
||||
"block-no-single-line": true,
|
||||
"block-opening-brace-newline-after": "always-multi-line",
|
||||
"block-opening-brace-space-after": "always-single-line",
|
||||
"block-opening-brace-space-before": "always",
|
||||
"color-hex-case": ["lower", { "severity": "warning" }],
|
||||
@@ -25,6 +21,7 @@
|
||||
"declaration-bang-space-after": "never",
|
||||
"declaration-bang-space-before": "always",
|
||||
"declaration-block-no-duplicate-properties": true,
|
||||
"declaration-block-no-ignored-properties": true,
|
||||
"declaration-block-no-shorthand-property-overrides": true,
|
||||
"declaration-block-semicolon-newline-after": "always-multi-line",
|
||||
"declaration-block-semicolon-space-after": "always-single-line",
|
||||
@@ -35,7 +32,6 @@
|
||||
"declaration-colon-space-after": "always-single-line",
|
||||
"declaration-colon-space-before": "never",
|
||||
"declaration-no-important": true,
|
||||
"font-family-no-duplicate-names": true,
|
||||
"function-calc-no-unspaced-operator": true,
|
||||
"function-comma-newline-after": "always-multi-line",
|
||||
"function-comma-space-after": "always-single-line",
|
||||
@@ -45,7 +41,7 @@
|
||||
"function-name-case": "lower",
|
||||
"function-parentheses-newline-inside": "always-multi-line",
|
||||
"function-parentheses-space-inside": "never-single-line",
|
||||
"function-url-scheme-blacklist": ["data"],
|
||||
"function-url-data-uris": never,
|
||||
"function-whitespace-after": "always",
|
||||
"indentation": 4,
|
||||
"keyframe-declaration-no-important": true,
|
||||
@@ -54,12 +50,14 @@
|
||||
"max-line-length": [132, { "severity": "warning" }],
|
||||
"media-feature-colon-space-after": "always",
|
||||
"media-feature-colon-space-before": "never",
|
||||
"media-feature-no-missing-punctuation": true,
|
||||
"media-feature-parentheses-space-inside": "never",
|
||||
"media-feature-range-operator-space-after": "always",
|
||||
"media-feature-range-operator-space-before": "always",
|
||||
"media-query-list-comma-newline-after": "always-multi-line",
|
||||
"media-query-list-comma-space-after": "always-single-line",
|
||||
"media-query-list-comma-space-before": "never",
|
||||
"no-browser-hacks": null, # Enabled for non-scss in grunt.
|
||||
"no-empty-source": true,
|
||||
"no-eol-whitespace": true,
|
||||
"no-extra-semicolons": [true, { "severity": "warning" }],
|
||||
@@ -80,10 +78,11 @@
|
||||
"selector-pseudo-class-parentheses-space-inside": "never",
|
||||
"selector-pseudo-element-case": "lower",
|
||||
"selector-pseudo-element-no-unknown": true,
|
||||
"selector-root-no-composition": true,
|
||||
"selector-type-case": "lower",
|
||||
"selector-type-no-unknown": true,
|
||||
"string-no-newline": true,
|
||||
"time-min-milliseconds": 100,
|
||||
"time-no-imperceptible": true,
|
||||
"unit-blacklist": ["pt"],
|
||||
"unit-case": "lower",
|
||||
"unit-no-unknown": true,
|
||||
|
||||
+25
-48
@@ -2,7 +2,7 @@
|
||||
# process (which uses our internal CI system) this file is here for the benefit
|
||||
# of community developers git clones - see MDL-51458.
|
||||
|
||||
sudo: required
|
||||
sudo: false
|
||||
|
||||
# We currently disable Travis notifications entirely until https://github.com/travis-ci/travis-ci/issues/4976
|
||||
# is fixed.
|
||||
@@ -13,25 +13,17 @@ language: php
|
||||
|
||||
php:
|
||||
# We only run the highest and lowest supported versions to reduce the load on travis-ci.org.
|
||||
- 7.2
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 5.6
|
||||
|
||||
addons:
|
||||
postgresql: "9.6"
|
||||
packages:
|
||||
- mysql-server-5.6
|
||||
- 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
|
||||
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.
|
||||
#
|
||||
# We only run MySQL on PHP 7.2, so run that first.
|
||||
# We only run MySQL on PHP 7.1, so run that first.
|
||||
# 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.
|
||||
|
||||
@@ -54,16 +46,23 @@ matrix:
|
||||
fast_finish: true
|
||||
|
||||
include:
|
||||
# Run grunt/npm install on lowest supported npm version
|
||||
- php: 7.1
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='4'
|
||||
# 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='8.9'
|
||||
- php: 7.1
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='node'
|
||||
|
||||
exclude:
|
||||
# MySQL - it's just too slow.
|
||||
# Exclude it on all versions except for 7.2
|
||||
# Exclude it on all versions except for 7.1
|
||||
|
||||
- env: DB=mysqli TASK=PHPUNIT
|
||||
php: 7.0
|
||||
php: 5.6
|
||||
|
||||
# Moodle 2.7 is not compatible with PHP 7 for the upgrade test.
|
||||
- env: DB=pgsql TASK=UPGRADE
|
||||
php: 7.1
|
||||
|
||||
cache:
|
||||
directories:
|
||||
@@ -71,26 +70,6 @@ cache:
|
||||
- $HOME/.npm
|
||||
|
||||
install:
|
||||
- >
|
||||
if [ "$DB" = 'mysqli' ];
|
||||
then
|
||||
sudo mkdir /mnt/ramdisk
|
||||
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
|
||||
sudo stop mysql
|
||||
sudo mv /var/lib/mysql /mnt/ramdisk
|
||||
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
|
||||
sudo start mysql
|
||||
fi
|
||||
- >
|
||||
if [ "$DB" = 'pgsql' ];
|
||||
then
|
||||
sudo mkdir /mnt/ramdisk
|
||||
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
|
||||
sudo service postgresql stop
|
||||
sudo mv /var/lib/postgresql /mnt/ramdisk
|
||||
sudo ln -s /mnt/ramdisk/postgresql /var/lib/postgresql
|
||||
sudo service postgresql start 9.6
|
||||
fi
|
||||
- >
|
||||
if [ "$TASK" = 'PHPUNIT' ];
|
||||
then
|
||||
@@ -100,9 +79,8 @@ install:
|
||||
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.
|
||||
@@ -136,7 +114,7 @@ before_script:
|
||||
|
||||
# The wwwroot and dataroot.
|
||||
sed -i \
|
||||
-e "s%http://example.com/moodle%https://localhost%" \
|
||||
-e "s%http://example.com/moodle%http://localhost%" \
|
||||
-e "s%/home/example/moodledata%/home/travis/roots/base%" \
|
||||
config.php ;
|
||||
|
||||
@@ -173,11 +151,10 @@ 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_';" \
|
||||
-e "/require_once/i \\define('TEST_SESSION_REDIS_HOST', '127.0.0.1');" \
|
||||
config.php ;
|
||||
|
||||
# Initialise PHPUnit for Moodle.
|
||||
@@ -207,7 +184,7 @@ before_script:
|
||||
# We need the official upstream for comparison
|
||||
git remote add upstream https://github.com/moodle/moodle.git;
|
||||
|
||||
git fetch upstream MOODLE_34_STABLE;
|
||||
git fetch upstream MOODLE_32_STABLE;
|
||||
export GIT_PREVIOUS_COMMIT="`git merge-base FETCH_HEAD $TRAVIS_COMMIT`";
|
||||
export GIT_COMMIT="$TRAVIS_COMMIT";
|
||||
export UPSTREAM_FETCH_HEAD=`git rev-parse FETCH_HEAD`
|
||||
@@ -227,9 +204,9 @@ before_script:
|
||||
# We need the official upstream.
|
||||
git remote add upstream https://github.com/moodle/moodle.git;
|
||||
|
||||
# Checkout 30 STABLE branch (the first version compatible with PHP 7.x)
|
||||
git fetch upstream MOODLE_30_STABLE;
|
||||
git checkout MOODLE_30_STABLE;
|
||||
# Checkout 27 STABLE branch.
|
||||
git fetch upstream MOODLE_27_STABLE;
|
||||
git checkout MOODLE_27_STABLE;
|
||||
|
||||
# Perform the upgrade
|
||||
php admin/cli/install_database.php --agree-license --adminpass=Password --adminemail=admin@example.com --fullname="Upgrade test" --shortname=Upgrade;
|
||||
|
||||
+22
-30
@@ -106,15 +106,33 @@ module.exports = function(grunt) {
|
||||
return libs;
|
||||
};
|
||||
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
eslint: {
|
||||
// Even though warnings dont stop the build we don't display warnings by default because
|
||||
// at this moment we've got too many core warnings.
|
||||
options: {quiet: !grunt.option('show-lint-warnings')},
|
||||
amd: {src: amdSrc},
|
||||
amd: {
|
||||
src: amdSrc,
|
||||
// Check AMD with some slightly stricter rules.
|
||||
rules: {
|
||||
'no-unused-vars': 'error',
|
||||
'no-implicit-globals': 'error'
|
||||
}
|
||||
},
|
||||
// Check YUI module source files.
|
||||
yui: {src: ['**/yui/src/**/*.js', '!*/**/yui/src/*/meta/*.js']}
|
||||
yui: {
|
||||
src: ['**/yui/src/**/*.js', '!*/**/yui/src/*/meta/*.js'],
|
||||
options: {
|
||||
// Disable some rules which we can't safely define for YUI rollups.
|
||||
rules: {
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'no-unused-expressions': 'off'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
amd: {
|
||||
@@ -153,10 +171,6 @@ module.exports = function(grunt) {
|
||||
files: ['**/yui/src/**/*.js'],
|
||||
tasks: ['yui']
|
||||
},
|
||||
gherkinlint: {
|
||||
files: ['**/tests/behat/*.feature'],
|
||||
tasks: ['gherkinlint']
|
||||
}
|
||||
},
|
||||
shifter: {
|
||||
options: {
|
||||
@@ -164,11 +178,6 @@ module.exports = function(grunt) {
|
||||
paths: [cwd]
|
||||
}
|
||||
},
|
||||
gherkinlint: {
|
||||
options: {
|
||||
files: ['**/tests/behat/*.feature'],
|
||||
}
|
||||
},
|
||||
stylelint: {
|
||||
less: {
|
||||
options: {
|
||||
@@ -177,6 +186,7 @@ module.exports = function(grunt) {
|
||||
rules: {
|
||||
// These rules have to be disabled in .stylelintrc for scss compat.
|
||||
"at-rule-no-unknown": true,
|
||||
"no-browser-hacks": [true, {"severity": "warning"}]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -193,6 +203,7 @@ module.exports = function(grunt) {
|
||||
rules: {
|
||||
// These rules have to be disabled in .stylelintrc for scss compat.
|
||||
"at-rule-no-unknown": true,
|
||||
"no-browser-hacks": [true, {"severity": "warning"}]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,22 +318,6 @@ module.exports = function(grunt) {
|
||||
}, done);
|
||||
};
|
||||
|
||||
tasks.gherkinlint = function() {
|
||||
var done = this.async(),
|
||||
options = grunt.config('gherkinlint.options');
|
||||
|
||||
var args = grunt.file.expand(options.files);
|
||||
args.unshift(path.normalize(__dirname + '/node_modules/.bin/gherkin-lint'));
|
||||
grunt.util.spawn({
|
||||
cmd: 'node',
|
||||
args: args,
|
||||
opts: {stdio: 'inherit', env: process.env}
|
||||
}, function(error, result, code) {
|
||||
// Propagate the exit code.
|
||||
done(code === 0);
|
||||
});
|
||||
};
|
||||
|
||||
tasks.startup = function() {
|
||||
// Are we in a YUI directory?
|
||||
if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
|
||||
@@ -334,7 +329,6 @@ module.exports = function(grunt) {
|
||||
// Run them all!.
|
||||
grunt.task.run('css');
|
||||
grunt.task.run('js');
|
||||
grunt.task.run('gherkinlint');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -349,7 +343,6 @@ module.exports = function(grunt) {
|
||||
grunt.config('uglify.amd.files', [{expand: true, src: files, rename: uglifyRename}]);
|
||||
grunt.config('shifter.options.paths', files);
|
||||
grunt.config('stylelint.less.src', files);
|
||||
grunt.config('gherkinlint.options.files', files);
|
||||
changedFiles = Object.create(null);
|
||||
}, 200);
|
||||
|
||||
@@ -367,7 +360,6 @@ module.exports = function(grunt) {
|
||||
|
||||
// Register JS tasks.
|
||||
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
|
||||
grunt.registerTask('gherkinlint', 'Run gherkinlint against the current directory', tasks.gherkinlint);
|
||||
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', tasks.ignorefiles);
|
||||
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
|
||||
grunt.registerTask('amd', ['eslint:amd', 'uglify']);
|
||||
|
||||
+4
-29
@@ -16,9 +16,6 @@ $err = array();
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
|
||||
|
||||
debugging("Use of config.html files in authentication plugins have been deprecated. " .
|
||||
" Please migrate your plugin to use the admin settings API", DEBUG_DEVELOPER);
|
||||
|
||||
// save configuration changes
|
||||
if ($frm = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
@@ -89,28 +86,12 @@ exit;
|
||||
|
||||
/// Functions /////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* auth field locking
|
||||
* Good enough for most auth plugins
|
||||
* but some may want a custom one if they are offering
|
||||
* other options
|
||||
* Note: lockconfig_ fields have special handling.
|
||||
*
|
||||
* @param string $auth authentication plugin shortname
|
||||
* @param array $user_fields user profile fields
|
||||
* @param string $helptext help text to be displayed at top of form
|
||||
* @param boolean $retrieveopts Map fields or lock only.
|
||||
* @param boolean $updateopts Allow remote updates
|
||||
* @param array $customfields list of custom profile fields
|
||||
* @deprecated since Moodle 3.3
|
||||
*/
|
||||
// Good enough for most auth plugins
|
||||
// but some may want a custom one if they are offering
|
||||
// other options
|
||||
// Note: lockconfig_ fields have special handling.
|
||||
function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts, $updateopts, $customfields = array()) {
|
||||
global $DB, $OUTPUT;
|
||||
debugging("The function 'print_auth_lock_options' has been deprecated, " .
|
||||
"Please migrate your code to use the admin settings API and use the function 'display_auth_lock_options' instead. ",
|
||||
DEBUG_DEVELOPER);
|
||||
|
||||
echo '<tr><td colspan="3">';
|
||||
if ($retrieveopts) {
|
||||
echo $OUTPUT->heading(get_string('auth_data_mapping', 'auth'));
|
||||
@@ -165,12 +146,6 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
|
||||
// If custom field then pick name from database.
|
||||
$fieldshortname = str_replace('profile_field_', '', $fieldname);
|
||||
$fieldname = $customfieldname[$fieldshortname]->name;
|
||||
if (core_text::strlen($fieldshortname) > 67) {
|
||||
// If custom profile field name is longer than 67 characters we will not be able to store the setting
|
||||
// such as 'field_updateremote_profile_field_NOTSOSHORTSHORTNAME' in the database because the character
|
||||
// limit for the setting name is 100.
|
||||
continue;
|
||||
}
|
||||
} elseif ($fieldname == 'url') {
|
||||
$fieldname = get_string('webpage');
|
||||
} else {
|
||||
|
||||
+4
-4
@@ -168,10 +168,10 @@
|
||||
$visible = '';
|
||||
} else if ($blocks[$blockid]->visible) {
|
||||
$visible = '<a href="blocks.php?hide='.$blockid.'&sesskey='.sesskey().'" title="'.$strhide.'">'.
|
||||
$OUTPUT->pix_icon('t/hide', $strhide) . '</a>';
|
||||
'<img src="'.$OUTPUT->pix_url('t/hide') . '" class="iconsmall" alt="'.$strhide.'" /></a>';
|
||||
} else {
|
||||
$visible = '<a href="blocks.php?show='.$blockid.'&sesskey='.sesskey().'" title="'.$strshow.'">'.
|
||||
$OUTPUT->pix_icon('t/show', $strshow) . '</a>';
|
||||
'<img src="'.$OUTPUT->pix_url('t/show') . '" class="iconsmall" alt="'.$strshow.'" /></a>';
|
||||
$class = 'dimmed_text';
|
||||
}
|
||||
|
||||
@@ -186,10 +186,10 @@
|
||||
$undeletable = '';
|
||||
} else if (in_array($blockname, $undeletableblocktypes)) {
|
||||
$undeletable = '<a href="blocks.php?unprotect='.$blockid.'&sesskey='.sesskey().'" title="'.$strunprotect.'">'.
|
||||
$OUTPUT->pix_icon('t/unlock', $strunprotect) . '</a>';
|
||||
'<img src="'.$OUTPUT->pix_url('t/unlock') . '" class="iconsmall" alt="'.$strunprotect.'" /></a>';
|
||||
} else {
|
||||
$undeletable = '<a href="blocks.php?protect='.$blockid.'&sesskey='.sesskey().'" title="'.$strprotect.'">'.
|
||||
$OUTPUT->pix_icon('t/lock', $strprotect) . '</a>';
|
||||
'<img src="'.$OUTPUT->pix_url('t/lock') . '" class="iconsmall" alt="'.$strprotect.'" /></a>';
|
||||
}
|
||||
|
||||
$row = array(
|
||||
|
||||
+10
-14
@@ -54,16 +54,14 @@ $statusmsg = '';
|
||||
$errormsg = '';
|
||||
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
$count = admin_write_settings($data);
|
||||
if (admin_write_settings($data)) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
|
||||
if (empty($adminroot->errors)) {
|
||||
// No errors. Did we change any setting? If so, then indicate success.
|
||||
if ($count) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
} else {
|
||||
switch ($return) {
|
||||
case 'site': redirect("$CFG->wwwroot/");
|
||||
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
}
|
||||
switch ($return) {
|
||||
case 'site': redirect("$CFG->wwwroot/");
|
||||
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
}
|
||||
} else {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
@@ -75,7 +73,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if ($PAGE->user_allowed_editing() && $adminediting != -1) {
|
||||
$USER->editing = $adminediting;
|
||||
}
|
||||
$buttons = null;
|
||||
|
||||
if ($PAGE->user_allowed_editing()) {
|
||||
$url = clone($PAGE->url);
|
||||
if ($PAGE->user_is_editing()) {
|
||||
@@ -91,7 +89,7 @@ if ($PAGE->user_allowed_editing()) {
|
||||
$savebutton = false;
|
||||
$outputhtml = '';
|
||||
foreach ($settingspage->children as $childpage) {
|
||||
if ($childpage->is_hidden() || !$childpage->check_access()) {
|
||||
if ($childpage->is_hidden()) {
|
||||
continue;
|
||||
}
|
||||
if ($childpage instanceof admin_externalpage) {
|
||||
@@ -129,9 +127,7 @@ if ($savebutton) {
|
||||
$visiblepathtosection = array_reverse($settingspage->visiblepath);
|
||||
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
if ($buttons) {
|
||||
$PAGE->set_button($buttons);
|
||||
}
|
||||
$PAGE->set_button($buttons);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Build and store theme CSS.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage cli
|
||||
* @copyright 2017 Ryan Wyllie <ryan@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require(__DIR__.'/../../config.php');
|
||||
require_once("$CFG->libdir/clilib.php");
|
||||
require_once("$CFG->libdir/csslib.php");
|
||||
require_once("$CFG->libdir/outputlib.php");
|
||||
|
||||
$longparams = [
|
||||
'themes' => null,
|
||||
'direction' => null,
|
||||
'help' => false,
|
||||
'verbose' => false
|
||||
];
|
||||
|
||||
$shortmappings = [
|
||||
't' => 'themes',
|
||||
'd' => 'direction',
|
||||
'h' => 'help',
|
||||
'v' => 'verbose'
|
||||
];
|
||||
|
||||
// Get CLI params.
|
||||
list($options, $unrecognized) = cli_get_params($longparams, $shortmappings);
|
||||
|
||||
if ($unrecognized) {
|
||||
$unrecognized = implode("\n ", $unrecognized);
|
||||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
|
||||
}
|
||||
|
||||
if ($options['help']) {
|
||||
echo
|
||||
"Compile the CSS for one or more installed themes.
|
||||
Existing CSS caches will replaced.
|
||||
By default all themes will be recompiled unless otherwise specified.
|
||||
|
||||
Options:
|
||||
-t, --themes A comma separated list of themes to be compiled
|
||||
-d, --direction Only compile a single direction (either ltr or rtl)
|
||||
-v, --verbose Print info comments to stdout
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$ sudo -u www-data /usr/bin/php admin/cli/build_theme_css.php --themes=boost --direction=ltr
|
||||
";
|
||||
|
||||
die;
|
||||
}
|
||||
|
||||
if (empty($options['verbose'])) {
|
||||
$trace = new null_progress_trace();
|
||||
} else {
|
||||
$trace = new text_progress_trace();
|
||||
}
|
||||
|
||||
cli_heading('Build theme css');
|
||||
|
||||
// Determine which themes we need to build.
|
||||
$themenames = [];
|
||||
if (is_null($options['themes'])) {
|
||||
$trace->output('No themes specified. Finding all installed themes.');
|
||||
$themenames = array_keys(core_component::get_plugin_list('theme'));
|
||||
} else {
|
||||
if (is_string($options['themes'])) {
|
||||
$themenames = explode(',', $options['themes']);
|
||||
} else {
|
||||
cli_error('--themes must be a comma separated list of theme names');
|
||||
}
|
||||
}
|
||||
|
||||
$trace->output('Checking that each theme is correctly installed...');
|
||||
$themeconfigs = [];
|
||||
foreach ($themenames as $themename) {
|
||||
if (is_null(theme_get_config_file_path($themename))) {
|
||||
cli_error("Unable to find theme config for {$themename}");
|
||||
}
|
||||
|
||||
// Load the config for the theme.
|
||||
$themeconfigs[] = theme_config::load($themename);
|
||||
}
|
||||
|
||||
$directions = ['ltr', 'rtl'];
|
||||
|
||||
if (!is_null($options['direction'])) {
|
||||
if (!in_array($options['direction'], $directions)) {
|
||||
cli_error("--direction must be either ltr or rtl");
|
||||
}
|
||||
|
||||
$directions = [$options['direction']];
|
||||
}
|
||||
|
||||
$trace->output('Building CSS for themes: ' . implode(', ', $themenames));
|
||||
theme_build_css_for_themes($themeconfigs, $directions);
|
||||
|
||||
exit(0);
|
||||
@@ -1,173 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* CLI script allowing to get and set config values.
|
||||
*
|
||||
* This is technically just a thin wrapper for {@link get_config()} and
|
||||
* {@link set_config()} functions.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage cli
|
||||
* @copyright 2017 David Mudrák <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require(__DIR__.'/../../config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
|
||||
$usage = "Displays the current value of the given site setting. Allows to set it to the given value, too.
|
||||
|
||||
Usage:
|
||||
# php cfg.php [--component=<componentname>] [--json] [--shell-arg]
|
||||
# php cfg.php --name=<configname> [--component=<componentname>] [--shell-arg] [--no-eol]
|
||||
# php cfg.php --name=<configname> [--component=<componentname>] --set=<value>
|
||||
# php cfg.php --name=<configname> [--component=<componentname>] --unset
|
||||
# php cfg.php [--help|-h]
|
||||
|
||||
Options:
|
||||
-h --help Print this help.
|
||||
--component=<frankenstyle> Name of the component the variable is part of. Defaults to core.
|
||||
--name=<configname> Name of the configuration variable to get/set. If missing, print all
|
||||
configuration variables of the given component.
|
||||
--set=<value> Set the given variable to this value.
|
||||
--unset Unset the given variable.
|
||||
--shell-arg Escape output values so that they can be directly used as shell script arguments.
|
||||
--json Encode output list of values using JSON notation.
|
||||
--no-eol Do not include the trailing new line character when printing the value.
|
||||
|
||||
The list of all variables of the given component can be printed as
|
||||
tab-separated list (default) or JSON object (--json). Particular values are
|
||||
printed as raw text values, optionally escaped so that they can be directly
|
||||
used as shell script arguments (--shell-arg). Single values are displayed with
|
||||
trailing new line by default, unless explicitly disabled (--no-eol).
|
||||
|
||||
In the read mode, the script exits with success status 0 if the requested value
|
||||
is found. If the requested variable is not set, the script exits with status 3.
|
||||
When listing all variables of the component, the exit status is always 0 even
|
||||
if no variables for the given component are found. When setting/unsetting a
|
||||
value, the exit status is 0. When attempting to set/unset a value that has
|
||||
already been hard-set in config.php, the script exits with error status 4. In
|
||||
case of unexpected error, the script exits with error status 1.
|
||||
|
||||
Examples:
|
||||
|
||||
# php cfg.php
|
||||
Prints tab-separated list of all core configuration variables and their values.
|
||||
|
||||
# php cfg.php --json
|
||||
Prints list of all core configuration variables and their values as a JSON object.
|
||||
|
||||
# php cfg.php --name=release
|
||||
Prints the given configuration variable - e.g. \$CFG->release in this case.
|
||||
|
||||
# php cfg.php --component=tool_recyclebin
|
||||
# Prints tab-separated list of the plugin's configuration variables.
|
||||
|
||||
# export DATAROOT=\$(php cfg.php --name=dataroot --shell-arg --no-eol)
|
||||
Stores the given configuration variable in the shell variable, escaped
|
||||
so that it can be safely used as a shell argument.
|
||||
|
||||
# php cfg.php --name=theme --set=clean
|
||||
Sets the given configuration variable to the given value.
|
||||
|
||||
# php cfg.php --name=noemailever --unset
|
||||
Unsets the previously configured variable.
|
||||
";
|
||||
|
||||
list($options, $unrecognised) = cli_get_params([
|
||||
'help' => false,
|
||||
'component' => null,
|
||||
'name' => null,
|
||||
'set' => null,
|
||||
'unset' => false,
|
||||
'shell-arg' => false,
|
||||
'json' => false,
|
||||
'no-eol' => false,
|
||||
], [
|
||||
'h' => 'help'
|
||||
]);
|
||||
|
||||
if ($unrecognised) {
|
||||
$unrecognised = implode(PHP_EOL.' ', $unrecognised);
|
||||
cli_error(get_string('cliunknowoption', 'core_admin', $unrecognised));
|
||||
}
|
||||
|
||||
if ($options['help']) {
|
||||
cli_writeln($usage);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if ($options['unset'] || $options['set'] !== null) {
|
||||
// Unset the variable or set it to the given value.
|
||||
if (empty($options['name'])) {
|
||||
cli_error('Missing configuration variable name', 2);
|
||||
}
|
||||
|
||||
// Check that the variable is not hard-set in the main config.php already.
|
||||
if (array_key_exists($options['name'], $CFG->config_php_settings)) {
|
||||
cli_error('The configuration variable is hard-set in the config.php, unable to change.', 4);
|
||||
}
|
||||
|
||||
set_config($options['name'], $options['set'], $options['component']);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($options['name'] === null) {
|
||||
// List all variables provided by the component (defaults to core).
|
||||
$got = get_config($options['component']);
|
||||
|
||||
if ($options['json']) {
|
||||
cli_writeln(json_encode($got));
|
||||
|
||||
} else {
|
||||
foreach ($got as $name => $value) {
|
||||
if ($options['shell-arg']) {
|
||||
$value = escapeshellarg($value);
|
||||
}
|
||||
cli_writeln($name."\t".$value);
|
||||
}
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
} else {
|
||||
// Display the value of a single variable.
|
||||
|
||||
$got = get_config($options['component'], $options['name']);
|
||||
|
||||
if ($got === false) {
|
||||
cli_error('No such configuration variable found.', 3);
|
||||
}
|
||||
|
||||
if ($options['shell-arg']) {
|
||||
$got = escapeshellarg($got);
|
||||
}
|
||||
|
||||
if ($options['json']) {
|
||||
$got = json_encode($got);
|
||||
}
|
||||
|
||||
if ($options['no-eol']) {
|
||||
cli_write($got);
|
||||
} else {
|
||||
cli_writeln($got);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@@ -146,9 +146,14 @@ define('PHPUNIT_TEST', false);
|
||||
|
||||
define('IGNORE_COMPONENT_CACHE', true);
|
||||
|
||||
// Check that PHP is of a sufficient version as soon as possible.
|
||||
require_once(__DIR__.'/../../lib/phpminimumversionlib.php');
|
||||
moodle_require_minimum_php_version();
|
||||
// Check that PHP is of a sufficient version
|
||||
if (version_compare(phpversion(), "5.6.5") < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
|
||||
fwrite(STDERR, "Moodle 3.2 or later requires at least PHP 5.6.5 (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// set up configuration
|
||||
global $CFG;
|
||||
@@ -803,12 +808,6 @@ if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
|
||||
|
||||
if (!$options['skip-database']) {
|
||||
install_cli_database($options, $interactive);
|
||||
// This needs to happen at the end to ensure it occurs after all caches
|
||||
// have been purged for the last time.
|
||||
// This will build a cached version of the current theme for the user
|
||||
// to immediately start browsing the site.
|
||||
require_once($CFG->libdir.'/upgradelib.php');
|
||||
upgrade_themes();
|
||||
} else {
|
||||
echo get_string('cliskipdatabase', 'install')."\n";
|
||||
}
|
||||
|
||||
@@ -62,9 +62,14 @@ Example:
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/install_database.php --lang=cs --adminpass=soMePass123 --agree-license
|
||||
";
|
||||
|
||||
// Check that PHP is of a sufficient version as soon as possible.
|
||||
require_once(__DIR__.'/../../lib/phpminimumversionlib.php');
|
||||
moodle_require_minimum_php_version();
|
||||
// Check that PHP is of a sufficient version
|
||||
if (version_compare(phpversion(), "5.6.5") < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
|
||||
fwrite(STDERR, "Moodle 3.2 or later requires at least PHP 5.6.5 (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Nothing to do if config.php does not exist
|
||||
$configfile = __DIR__.'/../../config.php';
|
||||
@@ -178,12 +183,5 @@ if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
|
||||
|
||||
install_cli_database($options, true);
|
||||
|
||||
// This needs to happen at the end to ensure it occurs after all caches
|
||||
// have been purged for the last time.
|
||||
// This will build a cached version of the current theme for the user
|
||||
// to immediately start browsing the site.
|
||||
require_once($CFG->libdir.'/upgradelib.php');
|
||||
upgrade_themes();
|
||||
|
||||
echo get_string('cliinstallfinished', 'install')."\n";
|
||||
exit(0); // 0 means success
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* CLI script to kill all user sessions without asking for confirmation.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage cli
|
||||
* @copyright 2017 Alexander Bias <alexander.bias@uni-ulm.de>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require(__DIR__.'/../../config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
|
||||
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
|
||||
|
||||
if ($unrecognized) {
|
||||
$unrecognized = implode("\n ", $unrecognized);
|
||||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2);
|
||||
}
|
||||
|
||||
if ($options['help']) {
|
||||
$help =
|
||||
"Kill all Moodle sessions
|
||||
|
||||
Options:
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/kill_all_sessions.php
|
||||
";
|
||||
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
\core\session\manager::kill_all_sessions();
|
||||
|
||||
exit(0);
|
||||
@@ -53,7 +53,7 @@ Options:
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
|
||||
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8_general_ci
|
||||
";
|
||||
|
||||
if (!empty($options['collation'])) {
|
||||
@@ -145,22 +145,9 @@ if (!empty($options['collation'])) {
|
||||
$skipped++;
|
||||
|
||||
} else {
|
||||
try {
|
||||
$DB->change_database_structure("ALTER TABLE $table->name CONVERT TO CHARACTER SET $charset COLLATE $collation");
|
||||
echo "CONVERTED\n";
|
||||
$converted++;
|
||||
} catch (ddl_exception $e) {
|
||||
$result = mysql_set_row_format($table->name, $charset, $collation, $engine);
|
||||
if ($result) {
|
||||
echo "CONVERTED\n";
|
||||
$converted++;
|
||||
} else {
|
||||
// We don't know what the problem is. Stop the conversion.
|
||||
cli_error("Error: Tried to convert $table->name, but there was a problem. Please check the details of this
|
||||
table and try again.");
|
||||
die();
|
||||
}
|
||||
}
|
||||
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation");
|
||||
echo "CONVERTED\n";
|
||||
$converted++;
|
||||
}
|
||||
|
||||
$sql = "SHOW FULL COLUMNS FROM $table->name WHERE collation IS NOT NULL";
|
||||
@@ -203,7 +190,7 @@ if (!empty($options['collation'])) {
|
||||
$DB->change_database_structure($sql);
|
||||
} else {
|
||||
echo "ERROR (unknown column type: $column->type)\n";
|
||||
$errors++;
|
||||
$error++;
|
||||
continue;
|
||||
}
|
||||
echo "CONVERTED\n";
|
||||
@@ -303,26 +290,3 @@ function mysql_get_column_collations($tablename) {
|
||||
$rs->close();
|
||||
return $collations;
|
||||
}
|
||||
|
||||
function mysql_set_row_format($tablename, $charset, $collation, $engine) {
|
||||
global $DB;
|
||||
|
||||
$sql = "SELECT row_format
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_schema = DATABASE() AND table_name = ?";
|
||||
$rs = $DB->get_record_sql($sql, array($tablename));
|
||||
if ($rs) {
|
||||
if ($rs->row_format == 'Compact' || $rs->row_format == 'Redundant') {
|
||||
$rowformat = $DB->get_row_format_sql($engine, $collation);
|
||||
// Try to convert to compressed format and then try updating the collation again.
|
||||
$DB->change_database_structure("ALTER TABLE $tablename $rowformat");
|
||||
$DB->change_database_structure("ALTER TABLE $tablename CONVERT TO CHARACTER SET $charset COLLATE $collation");
|
||||
} else {
|
||||
// Row format may not be the problem. Can not diagnose problem. Send fail reply.
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* CLI script to purge caches without asking for confirmation.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage cli
|
||||
* @copyright 2011 David Mudrak <david@moodle.com>
|
||||
@@ -52,4 +50,4 @@ Example:
|
||||
|
||||
purge_all_caches();
|
||||
|
||||
exit(0);
|
||||
exit(0);
|
||||
@@ -187,11 +187,5 @@ upgrade_noncore(true);
|
||||
admin_apply_default_settings(NULL, false);
|
||||
admin_apply_default_settings(NULL, false);
|
||||
|
||||
// This needs to happen at the end to ensure it occurs after all caches
|
||||
// have been purged for the last time.
|
||||
// This will build a cached version of the current theme for the user
|
||||
// to immediately start browsing the site.
|
||||
upgrade_themes();
|
||||
|
||||
echo get_string('cliupgradefinished', 'admin')."\n";
|
||||
exit(0); // 0 means success
|
||||
|
||||
@@ -47,7 +47,6 @@ switch ($action) {
|
||||
// remove from enabled list
|
||||
$key = array_search($editor, $active_editors);
|
||||
unset($active_editors[$key]);
|
||||
add_to_config_log('editor_visibility', '1', '0', $editor);
|
||||
break;
|
||||
|
||||
case 'enable':
|
||||
@@ -55,7 +54,6 @@ switch ($action) {
|
||||
if (!in_array($editor, $active_editors)) {
|
||||
$active_editors[] = $editor;
|
||||
$active_editors = array_unique($active_editors);
|
||||
add_to_config_log('editor_visibility', '0', '1', $editor);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -68,7 +66,6 @@ switch ($action) {
|
||||
$fsave = $active_editors[$key];
|
||||
$active_editors[$key] = $active_editors[$key + 1];
|
||||
$active_editors[$key + 1] = $fsave;
|
||||
add_to_config_log('editor_position', $key, $key + 1, $editor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -82,7 +79,6 @@ switch ($action) {
|
||||
$fsave = $active_editors[$key];
|
||||
$active_editors[$key] = $active_editors[$key - 1];
|
||||
$active_editors[$key - 1] = $fsave;
|
||||
add_to_config_log('editor_position', $key, $key - 1, $editor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1754,7 +1754,6 @@
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.6.5" level="required">
|
||||
<RESTRICT function="restrict_php_version_72" message="unsupportedphpversion72" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -1906,533 +1905,4 @@
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.3" requires="2.7">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.3" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.6.5" level="required">
|
||||
<RESTRICT function="restrict_php_version_72" message="unsupportedphpversion72" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="opensslrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlreader" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
<PHP_EXTENSION name="fileinfo" level="required"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ishttpswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="incompleteunicodesupport" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.4" requires="3.0">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.3" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="7.0.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_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.5" requires="3.1">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.3" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="7.0.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_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ function get_table_row(\core\plugininfo\filter $plugininfo, $state, $isfirstrow,
|
||||
|
||||
// Re-order.
|
||||
$updown = '';
|
||||
$spacer = $OUTPUT->spacer();
|
||||
$spacer = '<img src="' . $OUTPUT->pix_url('spacer') . '" class="iconsmall" alt="" />';
|
||||
if ($state->active != TEXTFILTER_DISABLED) {
|
||||
if (!$isfirstrow) {
|
||||
$updown .= $OUTPUT->action_icon(filters_action_url($filter, 'up'), new pix_icon('t/up', get_string('up'), '', array('class' => 'iconsmall')));
|
||||
|
||||
+10
-27
@@ -29,9 +29,14 @@ if (!file_exists('../config.php')) {
|
||||
die();
|
||||
}
|
||||
|
||||
// Check that PHP is of a sufficient version as soon as possible.
|
||||
require_once(__DIR__.'/../lib/phpminimumversionlib.php');
|
||||
moodle_require_minimum_php_version();
|
||||
// Check that PHP is of a sufficient version as soon as possible
|
||||
if (version_compare(phpversion(), '5.6.5') < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it to later place
|
||||
echo "Moodle 3.2 or later requires at least PHP 5.6.5 (currently using version $phpversion).<br />";
|
||||
echo "Please upgrade your server software or install older Moodle version.";
|
||||
die();
|
||||
}
|
||||
|
||||
// make sure iconv is available and actually works
|
||||
if (!function_exists('iconv')) {
|
||||
@@ -96,12 +101,6 @@ if (function_exists('opcache_invalidate')) {
|
||||
// indirectly calls the protected init() method is good here.
|
||||
core_component::get_core_subsystems();
|
||||
|
||||
if (is_major_upgrade_required() && isloggedin()) {
|
||||
// A major upgrade is required.
|
||||
// Terminate the session and redirect back here before anything DB-related happens.
|
||||
redirect_if_major_upgrade_required();
|
||||
}
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions
|
||||
require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions
|
||||
|
||||
@@ -699,7 +698,6 @@ if (!$cache and moodle_needs_upgrading()) {
|
||||
if (during_initial_install()) {
|
||||
set_config('rolesactive', 1); // after this, during_initial_install will return false.
|
||||
set_config('adminsetuppending', 1);
|
||||
set_config('registrationpending', 1); // Remind to register site after all other setup is finished.
|
||||
// we need this redirect to setup proper session
|
||||
upgrade_finished("index.php?sessionstarted=1&lang=$CFG->lang");
|
||||
}
|
||||
@@ -815,9 +813,6 @@ if (isset($SESSION->pluginuninstallreturn)) {
|
||||
}
|
||||
}
|
||||
|
||||
// If site registration needs updating, redirect.
|
||||
\core\hub\registration::registration_reminder('/admin/index.php');
|
||||
|
||||
// Everything should now be set up, and the user is an admin
|
||||
|
||||
// Print default admin page with notifications.
|
||||
@@ -861,23 +856,12 @@ if ($updateschecker->enabled()) {
|
||||
|
||||
$buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
|
||||
//check if the site is registered on Moodle.org
|
||||
$registered = \core\hub\registration::is_registered();
|
||||
$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
|
||||
// Check if there are any cache warnings.
|
||||
$cachewarnings = cache_helper::warnings();
|
||||
// Check if there are events 1 API handlers.
|
||||
$eventshandlers = $DB->get_records_sql('SELECT DISTINCT component FROM {events_handlers}');
|
||||
$themedesignermode = !empty($CFG->themedesignermode);
|
||||
$mobileconfigured = !empty($CFG->enablemobilewebservice);
|
||||
$invalidforgottenpasswordurl = !empty($CFG->forgottenpasswordurl) && empty(clean_param($CFG->forgottenpasswordurl, PARAM_URL));
|
||||
|
||||
// Check if a directory with development libraries exists.
|
||||
if (empty($CFG->disabledevlibdirscheck) && (is_dir($CFG->dirroot.'/vendor') || is_dir($CFG->dirroot.'/node_modules'))) {
|
||||
$devlibdir = true;
|
||||
} else {
|
||||
$devlibdir = false;
|
||||
}
|
||||
// Check if the site is being foced onto ssl.
|
||||
$overridetossl = !empty($CFG->overridetossl);
|
||||
|
||||
admin_externalpage_setup('adminnotifications');
|
||||
|
||||
@@ -885,5 +869,4 @@ $output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
|
||||
$maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
|
||||
$registered, $cachewarnings, $eventshandlers, $themedesignermode, $devlibdir,
|
||||
$mobileconfigured, $overridetossl, $invalidforgottenpasswordurl);
|
||||
$registered, $cachewarnings, $eventshandlers, $themedesignermode);
|
||||
|
||||
@@ -150,7 +150,7 @@ foreach ($columns as $column) {
|
||||
} else {
|
||||
$columndir = $dir == "ASC" ? "DESC" : "ASC";
|
||||
$columnicon = $dir == "ASC" ? "down" : "up";
|
||||
$columnicon = " " . $OUTPUT->pix_icon('t/' . $columnicon, get_string('sort'));
|
||||
$columnicon = " <img src=\"" . $OUTPUT->pix_url('t/' . $columnicon) . "\" alt=\"\" />";
|
||||
}
|
||||
$headings[$column] = "<a href=\"?sort=$column&dir=$columndir&\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
|
||||
+3
-3
@@ -94,7 +94,7 @@
|
||||
$missing = true;
|
||||
} else {
|
||||
// took out hspace="\10\", because it does not validate. don't know what to replace with.
|
||||
$icon = "<img src=\"" . $OUTPUT->image_url('icon', $module->name) . "\" class=\"icon\" alt=\"\" />";
|
||||
$icon = "<img src=\"" . $OUTPUT->pix_url('icon', $module->name) . "\" class=\"icon\" alt=\"\" />";
|
||||
$strmodulename = $icon.' '.get_string('modulename', $module->name);
|
||||
$missing = false;
|
||||
}
|
||||
@@ -130,11 +130,11 @@
|
||||
$class = '';
|
||||
} else if ($module->visible) {
|
||||
$visible = "<a href=\"modules.php?hide=$module->name&sesskey=".sesskey()."\" title=\"$strhide\">".
|
||||
$OUTPUT->pix_icon('t/hide', $strhide) . '</a>';
|
||||
"<img src=\"" . $OUTPUT->pix_url('t/hide') . "\" class=\"iconsmall\" alt=\"$strhide\" /></a>";
|
||||
$class = '';
|
||||
} else {
|
||||
$visible = "<a href=\"modules.php?show=$module->name&sesskey=".sesskey()."\" title=\"$strshow\">".
|
||||
$OUTPUT->pix_icon('t/show', $strshow) . '</a>';
|
||||
"<img src=\"" . $OUTPUT->pix_url('t/show') . "\" class=\"iconsmall\" alt=\"$strshow\" /></a>";
|
||||
$class = 'dimmed_text';
|
||||
}
|
||||
if ($module->name == "forum") {
|
||||
|
||||
@@ -30,17 +30,6 @@
|
||||
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
|
||||
$error = optional_param('error', '', PARAM_RAW);
|
||||
if ($error) {
|
||||
$message = optional_param('error_description', '', PARAM_RAW);
|
||||
if ($message) {
|
||||
print_error($message);
|
||||
} else {
|
||||
print_error($error);
|
||||
}
|
||||
die();
|
||||
}
|
||||
|
||||
// The authorization code generated by the authorization server.
|
||||
$code = required_param('code', PARAM_RAW);
|
||||
// The state parameter we've given (used in moodle as a redirect url).
|
||||
|
||||
@@ -29,10 +29,9 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
|
||||
|
||||
admin_externalpage_setup('purgecaches');
|
||||
|
||||
// If we have got here as a confirmed aciton, do it.
|
||||
if ($confirm && confirm_sesskey()) {
|
||||
if ($confirm && isloggedin() && confirm_sesskey()) {
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
|
||||
// Valid request. Purge, and redirect the user back to where they came from.
|
||||
purge_all_caches();
|
||||
@@ -46,6 +45,8 @@ if ($confirm && confirm_sesskey()) {
|
||||
}
|
||||
|
||||
// Otherwise, show a button to actually purge the caches.
|
||||
admin_externalpage_setup('purgecaches');
|
||||
|
||||
$actionurl = new moodle_url('/admin/purgecaches.php', array('sesskey'=>sesskey(), 'confirm'=>1));
|
||||
if ($returnurl) {
|
||||
$actionurl->param('returnurl', $returnurl);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
/*
|
||||
* @package moodle
|
||||
* @subpackage registration
|
||||
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
require('../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
|
||||
|
||||
$newtoken = optional_param('newtoken', '', PARAM_ALPHANUM);
|
||||
$url = optional_param('url', '', PARAM_URL);
|
||||
@@ -43,19 +44,7 @@ $hubname = optional_param('hubname', '', PARAM_TEXT);
|
||||
$token = optional_param('token', '', PARAM_TEXT);
|
||||
$error = optional_param('error', '', PARAM_ALPHANUM);
|
||||
|
||||
admin_externalpage_setup('registrationmoodleorg');
|
||||
|
||||
if ($url !== HUB_MOODLEORGHUBURL) {
|
||||
// Allow other plugins to confirm registration on hubs other than moodle.net . Plugins implementing this
|
||||
// callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration .
|
||||
$callbacks = get_plugins_with_function('hub_registration');
|
||||
foreach ($callbacks as $plugintype => $plugins) {
|
||||
foreach ($plugins as $plugin => $callback) {
|
||||
$callback('confirm');
|
||||
}
|
||||
}
|
||||
throw new moodle_exception('errorotherhubsnotsupported', 'hub');
|
||||
}
|
||||
admin_externalpage_setup('registrationhubs');
|
||||
|
||||
if (!empty($error) and $error == 'urlalreadyexist') {
|
||||
throw new moodle_exception('urlalreadyregistered', 'hub',
|
||||
@@ -63,22 +52,38 @@ if (!empty($error) and $error == 'urlalreadyexist') {
|
||||
}
|
||||
|
||||
//check that we are waiting a confirmation from this hub, and check that the token is correct
|
||||
core\hub\registration::confirm_registration($token, $newtoken, $hubname);
|
||||
$registrationmanager = new registration_manager();
|
||||
$registeredhub = $registrationmanager->get_unconfirmedhub($url);
|
||||
if (!empty($registeredhub) and $registeredhub->token == $token) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
|
||||
|
||||
// Display notification message.
|
||||
echo $OUTPUT->notification(get_string('registrationconfirmedon', 'hub'), 'notifysuccess');
|
||||
$registeredhub->token = $newtoken;
|
||||
$registeredhub->confirmed = 1;
|
||||
$registeredhub->hubname = $hubname;
|
||||
$registrationmanager->update_registeredhub($registeredhub);
|
||||
|
||||
// Display continue button.
|
||||
$returnurl = !empty($SESSION->registrationredirect) ? clean_param($SESSION->registrationredirect, PARAM_LOCALURL) : null;
|
||||
unset($SESSION->registrationredirect);
|
||||
$continueurl = new moodle_url($returnurl ?: '/admin/registration/index.php');
|
||||
$continuebutton = $OUTPUT->render(new single_button($continueurl, get_string('continue')));
|
||||
$continuebutton = html_writer::tag('div', $continuebutton, array('class' => 'mdl-align'));
|
||||
echo $continuebutton;
|
||||
// Display notification message.
|
||||
echo $OUTPUT->notification(get_string('registrationconfirmedon', 'hub'), 'notifysuccess');
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
//display continue button
|
||||
$registrationpage = new moodle_url('/admin/registration/index.php');
|
||||
$continuebutton = $OUTPUT->render(new single_button($registrationpage, get_string('continue', 'hub')));
|
||||
$continuebutton = html_writer::tag('div', $continuebutton, array('class' => 'mdl-align'));
|
||||
echo $continuebutton;
|
||||
|
||||
if (!extension_loaded('xmlrpc')) {
|
||||
//display notice about xmlrpc
|
||||
$xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
|
||||
$xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
|
||||
echo $OUTPUT->notification($xmlrpcnotification);
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
} else {
|
||||
throw new moodle_exception('wrongtoken', 'hub',
|
||||
$CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
/*
|
||||
* @package moodle
|
||||
* @subpackage registration
|
||||
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
|
||||
@@ -30,7 +30,482 @@
|
||||
* The forms needed by registration pages.
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
debugging('Support for alternative hubs has been removed from Moodle in 3.4. For communication with moodle.net ' .
|
||||
'see lib/classes/hub/ .', DEBUG_DEVELOPER);
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
|
||||
|
||||
/**
|
||||
* This form display a unregistration form.
|
||||
*/
|
||||
class site_unregistration_form extends moodleform {
|
||||
|
||||
public function definition() {
|
||||
$mform = & $this->_form;
|
||||
$mform->addElement('header', 'site', get_string('unregister', 'hub'));
|
||||
|
||||
$huburl = $this->_customdata['huburl'];
|
||||
$hubname = $this->_customdata['hubname'];
|
||||
|
||||
$unregisterlabel = get_string('unregister', 'hub');
|
||||
$mform->addElement('checkbox', 'unpublishalladvertisedcourses', '',
|
||||
' ' . get_string('unpublishalladvertisedcourses', 'hub'));
|
||||
$mform->setType('unpublishalladvertisedcourses', PARAM_INT);
|
||||
$mform->addElement('checkbox', 'unpublishalluploadedcourses', '',
|
||||
' ' . get_string('unpublishalluploadedcourses', 'hub'));
|
||||
$mform->setType('unpublishalluploadedcourses', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'confirm', 1);
|
||||
$mform->setType('confirm', PARAM_INT);
|
||||
$mform->addElement('hidden', 'unregistration', 1);
|
||||
$mform->setType('unregistration', PARAM_INT);
|
||||
$mform->addElement('hidden', 'huburl', $huburl);
|
||||
$mform->setType('huburl', PARAM_URL);
|
||||
$mform->addElement('hidden', 'hubname', $hubname);
|
||||
$mform->setType('hubname', PARAM_TEXT);
|
||||
|
||||
$this->add_action_buttons(true, $unregisterlabel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This form display a clean registration data form.
|
||||
*/
|
||||
class site_clean_registration_data_form extends moodleform {
|
||||
|
||||
public function definition() {
|
||||
$mform = & $this->_form;
|
||||
$mform->addElement('header', 'site', get_string('unregister', 'hub'));
|
||||
|
||||
$huburl = $this->_customdata['huburl'];
|
||||
$hubname = $this->_customdata['hubname'];
|
||||
|
||||
|
||||
$unregisterlabel = get_string('forceunregister', 'hub');
|
||||
$mform->addElement('static', '', get_string('warning', 'hub'), get_string('forceunregisterconfirmation', 'hub', $hubname));
|
||||
|
||||
$mform->addElement('hidden', 'confirm', 1);
|
||||
$mform->setType('confirm', PARAM_INT);
|
||||
$mform->addElement('hidden', 'unregistration', 1);
|
||||
$mform->setType('unregistration', PARAM_INT);
|
||||
$mform->addElement('hidden', 'cleanregdata', 1);
|
||||
$mform->setType('cleanregdata', PARAM_INT);
|
||||
$mform->addElement('hidden', 'huburl', $huburl);
|
||||
$mform->setType('huburl', PARAM_URL);
|
||||
$mform->addElement('hidden', 'hubname', $hubname);
|
||||
$mform->setType('hubname', PARAM_TEXT);
|
||||
|
||||
$this->add_action_buttons(true, $unregisterlabel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This form display a hub selector.
|
||||
* The hub list is retrieved from Moodle.org hub directory.
|
||||
* Also displayed, a text field to enter private hub url + its password
|
||||
*/
|
||||
class hub_selector_form extends moodleform {
|
||||
|
||||
public function definition() {
|
||||
global $CFG, $OUTPUT;
|
||||
$mform = & $this->_form;
|
||||
$mform->addElement('header', 'site', get_string('selecthub', 'hub'));
|
||||
|
||||
//retrieve the hub list on the hub directory by web service
|
||||
$function = 'hubdirectory_get_hubs';
|
||||
$params = array();
|
||||
$serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php";
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory');
|
||||
try {
|
||||
$hubs = $xmlrpcclient->call($function, $params);
|
||||
} catch (Exception $e) {
|
||||
$error = $OUTPUT->notification(get_string('errorhublisting', 'hub', $e->getMessage()));
|
||||
$mform->addElement('static', 'errorhub', '', $error);
|
||||
$hubs = array();
|
||||
}
|
||||
|
||||
//remove moodle.org from the hub list
|
||||
foreach ($hubs as $key => $hub) {
|
||||
if ($hub['url'] == HUB_MOODLEORGHUBURL) {
|
||||
unset($hubs[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
//Public hub list
|
||||
$options = array();
|
||||
foreach ($hubs as $hub) {
|
||||
//to not display a name longer than 100 character (too big)
|
||||
if (core_text::strlen($hub['name']) > 100) {
|
||||
$hubname = core_text::substr($hub['name'], 0, 100);
|
||||
$hubname = $hubname . "...";
|
||||
} else {
|
||||
$hubname = $hub['name'];
|
||||
}
|
||||
$options[$hub['url']] = $hubname;
|
||||
$mform->addElement('hidden', clean_param($hub['url'], PARAM_ALPHANUMEXT), $hubname);
|
||||
$mform->setType(clean_param($hub['url'], PARAM_ALPHANUMEXT), PARAM_ALPHANUMEXT);
|
||||
}
|
||||
if (!empty($hubs)) {
|
||||
$mform->addElement('select', 'publichub', get_string('publichub', 'hub'),
|
||||
$options, array("size" => 15));
|
||||
$mform->setType('publichub', PARAM_URL);
|
||||
}
|
||||
|
||||
$mform->addElement('static', 'or', '', get_string('orenterprivatehub', 'hub'));
|
||||
|
||||
//Private hub
|
||||
$mform->addElement('text', 'unlistedurl', get_string('privatehuburl', 'hub'),
|
||||
array('class' => 'registration_textfield'));
|
||||
$mform->setType('unlistedurl', PARAM_URL);
|
||||
$mform->addElement('text', 'password', get_string('password'),
|
||||
array('class' => 'registration_textfield'));
|
||||
$mform->setType('password', PARAM_RAW);
|
||||
|
||||
$this->add_action_buttons(false, get_string('selecthub', 'hub'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the unlisted URL is a URL
|
||||
*/
|
||||
function validation($data, $files) {
|
||||
global $CFG;
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
$unlistedurl = $this->_form->_submitValues['unlistedurl'];
|
||||
|
||||
if (empty($unlistedurl)) {
|
||||
$errors['unlistedurl'] = get_string('badurlformat', 'hub');
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The site registration form. Information will be sent to a given hub.
|
||||
*/
|
||||
class site_registration_form extends moodleform {
|
||||
|
||||
public function definition() {
|
||||
global $CFG, $DB;
|
||||
|
||||
$strrequired = get_string('required');
|
||||
$mform = & $this->_form;
|
||||
$huburl = $this->_customdata['huburl'];
|
||||
$hubname = $this->_customdata['hubname'];
|
||||
$password = $this->_customdata['password'];
|
||||
$admin = get_admin();
|
||||
$site = get_site();
|
||||
|
||||
//retrieve config for this hub and set default if they don't exist
|
||||
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
|
||||
$sitename = get_config('hub', 'site_name_' . $cleanhuburl);
|
||||
if ($sitename === false) {
|
||||
$sitename = format_string($site->fullname, true, array('context' => context_course::instance(SITEID)));
|
||||
}
|
||||
$sitedescription = get_config('hub', 'site_description_' . $cleanhuburl);
|
||||
if ($sitedescription === false) {
|
||||
$sitedescription = $site->summary;
|
||||
}
|
||||
$contactname = get_config('hub', 'site_contactname_' . $cleanhuburl);
|
||||
if ($contactname === false) {
|
||||
$contactname = fullname($admin, true);
|
||||
}
|
||||
$contactemail = get_config('hub', 'site_contactemail_' . $cleanhuburl);
|
||||
if ($contactemail === false) {
|
||||
$contactemail = $admin->email;
|
||||
}
|
||||
$contactphone = get_config('hub', 'site_contactphone_' . $cleanhuburl);
|
||||
if ($contactphone === false) {
|
||||
$contactphone = $admin->phone1;
|
||||
}
|
||||
$imageurl = get_config('hub', 'site_imageurl_' . $cleanhuburl);
|
||||
$privacy = get_config('hub', 'site_privacy_' . $cleanhuburl);
|
||||
$address = get_config('hub', 'site_address_' . $cleanhuburl);
|
||||
$region = get_config('hub', 'site_region_' . $cleanhuburl);
|
||||
$country = get_config('hub', 'site_country_' . $cleanhuburl);
|
||||
if ($country === false) {
|
||||
$country = $admin->country;
|
||||
}
|
||||
$language = get_config('hub', 'site_language_' . $cleanhuburl);
|
||||
if ($language === false) {
|
||||
$language = current_language();
|
||||
}
|
||||
$geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
|
||||
$contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
|
||||
$emailalert = get_config('hub', 'site_emailalert_' . $cleanhuburl);
|
||||
$emailalert = ($emailalert === 0) ? 0 : 1;
|
||||
$coursesnumber = get_config('hub', 'site_coursesnumber_' . $cleanhuburl);
|
||||
$usersnumber = get_config('hub', 'site_usersnumber_' . $cleanhuburl);
|
||||
$roleassignmentsnumber = get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl);
|
||||
$postsnumber = get_config('hub', 'site_postsnumber_' . $cleanhuburl);
|
||||
$questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
|
||||
$resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
|
||||
$badgesnumber = get_config('hub', 'site_badges_' . $cleanhuburl);
|
||||
$issuedbadgesnumber = get_config('hub', 'site_issuedbadges_' . $cleanhuburl);
|
||||
$mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
|
||||
$participantnumberaveragecfg = get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl);
|
||||
$modulenumberaveragecfg = get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl);
|
||||
|
||||
//hidden parameters
|
||||
$mform->addElement('hidden', 'huburl', $huburl);
|
||||
$mform->setType('huburl', PARAM_URL);
|
||||
$mform->addElement('hidden', 'hubname', $hubname);
|
||||
$mform->setType('hubname', PARAM_TEXT);
|
||||
$mform->addElement('hidden', 'password', $password);
|
||||
$mform->setType('password', PARAM_RAW);
|
||||
|
||||
//the input parameters
|
||||
$mform->addElement('header', 'moodle', get_string('registrationinfo', 'hub'));
|
||||
|
||||
$mform->addElement('text', 'name', get_string('sitename', 'hub'),
|
||||
array('class' => 'registration_textfield'));
|
||||
$mform->addRule('name', $strrequired, 'required', null, 'client');
|
||||
$mform->setType('name', PARAM_TEXT);
|
||||
$mform->setDefault('name', $sitename);
|
||||
$mform->addHelpButton('name', 'sitename', 'hub');
|
||||
|
||||
$options = array();
|
||||
$registrationmanager = new registration_manager();
|
||||
$options[HUB_SITENOTPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENOTPUBLISHED);
|
||||
$options[HUB_SITENAMEPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENAMEPUBLISHED);
|
||||
$options[HUB_SITELINKPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITELINKPUBLISHED);
|
||||
$mform->addElement('select', 'privacy', get_string('siteprivacy', 'hub'), $options);
|
||||
$mform->setDefault('privacy', $privacy);
|
||||
$mform->setType('privacy', PARAM_ALPHA);
|
||||
$mform->addHelpButton('privacy', 'privacy', 'hub');
|
||||
unset($options);
|
||||
|
||||
$mform->addElement('textarea', 'description', get_string('sitedesc', 'hub'),
|
||||
array('rows' => 8, 'cols' => 41));
|
||||
$mform->addRule('description', $strrequired, 'required', null, 'client');
|
||||
$mform->setDefault('description', $sitedescription);
|
||||
$mform->setType('description', PARAM_TEXT);
|
||||
$mform->addHelpButton('description', 'sitedesc', 'hub');
|
||||
|
||||
$languages = get_string_manager()->get_list_of_languages();
|
||||
core_collator::asort($languages);
|
||||
$mform->addElement('select', 'language', get_string('sitelang', 'hub'),
|
||||
$languages);
|
||||
$mform->setType('language', PARAM_ALPHANUMEXT);
|
||||
$mform->addHelpButton('language', 'sitelang', 'hub');
|
||||
$mform->setDefault('language', $language);
|
||||
|
||||
$mform->addElement('textarea', 'address', get_string('postaladdress', 'hub'),
|
||||
array('rows' => 4, 'cols' => 41));
|
||||
$mform->setType('address', PARAM_TEXT);
|
||||
$mform->setDefault('address', $address);
|
||||
$mform->addHelpButton('address', 'postaladdress', 'hub');
|
||||
|
||||
//TODO: use the region array I generated
|
||||
// $mform->addElement('select', 'region', get_string('selectaregion'), array('-' => '-'));
|
||||
// $mform->setDefault('region', $region);
|
||||
$mform->addElement('hidden', 'regioncode', '-');
|
||||
$mform->setType('regioncode', PARAM_ALPHANUMEXT);
|
||||
|
||||
$countries = get_string_manager()->get_list_of_countries();
|
||||
$mform->addElement('select', 'countrycode', get_string('sitecountry', 'hub'), $countries);
|
||||
$mform->setDefault('countrycode', $country);
|
||||
$mform->setType('countrycode', PARAM_ALPHANUMEXT);
|
||||
$mform->addHelpButton('countrycode', 'sitecountry', 'hub');
|
||||
|
||||
$mform->addElement('text', 'geolocation', get_string('sitegeolocation', 'hub'),
|
||||
array('class' => 'registration_textfield'));
|
||||
$mform->setDefault('geolocation', $geolocation);
|
||||
$mform->setType('geolocation', PARAM_RAW);
|
||||
$mform->addHelpButton('geolocation', 'sitegeolocation', 'hub');
|
||||
|
||||
$mform->addElement('text', 'contactname', get_string('siteadmin', 'hub'),
|
||||
array('class' => 'registration_textfield'));
|
||||
$mform->addRule('contactname', $strrequired, 'required', null, 'client');
|
||||
$mform->setType('contactname', PARAM_TEXT);
|
||||
$mform->setDefault('contactname', $contactname);
|
||||
$mform->addHelpButton('contactname', 'siteadmin', 'hub');
|
||||
|
||||
$mform->addElement('text', 'contactphone', get_string('sitephone', 'hub'),
|
||||
array('class' => 'registration_textfield'));
|
||||
$mform->setType('contactphone', PARAM_TEXT);
|
||||
$mform->addHelpButton('contactphone', 'sitephone', 'hub');
|
||||
$mform->setForceLtr('contactphone');
|
||||
|
||||
$mform->addElement('text', 'contactemail', get_string('siteemail', 'hub'),
|
||||
array('class' => 'registration_textfield'));
|
||||
$mform->addRule('contactemail', $strrequired, 'required', null, 'client');
|
||||
$mform->setType('contactemail', PARAM_EMAIL);
|
||||
$mform->setDefault('contactemail', $contactemail);
|
||||
$mform->addHelpButton('contactemail', 'siteemail', 'hub');
|
||||
|
||||
$options = array();
|
||||
$options[0] = get_string("registrationcontactno");
|
||||
$options[1] = get_string("registrationcontactyes");
|
||||
$mform->addElement('select', 'contactable', get_string('siteregistrationcontact', 'hub'), $options);
|
||||
$mform->setDefault('contactable', $contactable);
|
||||
$mform->setType('contactable', PARAM_INT);
|
||||
$mform->addHelpButton('contactable', 'siteregistrationcontact', 'hub');
|
||||
unset($options);
|
||||
|
||||
$options = array();
|
||||
$options[0] = get_string("registrationno");
|
||||
$options[1] = get_string("registrationyes");
|
||||
$mform->addElement('select', 'emailalert', get_string('siteregistrationemail', 'hub'), $options);
|
||||
$mform->setDefault('emailalert', $emailalert);
|
||||
$mform->setType('emailalert', PARAM_INT);
|
||||
$mform->addHelpButton('emailalert', 'siteregistrationemail', 'hub');
|
||||
unset($options);
|
||||
|
||||
//TODO site logo
|
||||
$mform->addElement('hidden', 'imageurl', ''); //TODO: temporary
|
||||
$mform->setType('imageurl', PARAM_URL);
|
||||
|
||||
$mform->addElement('static', 'urlstring', get_string('siteurl', 'hub'), $CFG->wwwroot);
|
||||
$mform->addHelpButton('urlstring', 'siteurl', 'hub');
|
||||
|
||||
$mform->addElement('static', 'versionstring', get_string('siteversion', 'hub'), $CFG->version);
|
||||
$mform->addElement('hidden', 'moodleversion', $CFG->version);
|
||||
$mform->setType('moodleversion', PARAM_INT);
|
||||
$mform->addHelpButton('versionstring', 'siteversion', 'hub');
|
||||
|
||||
$mform->addElement('static', 'releasestring', get_string('siterelease', 'hub'), $CFG->release);
|
||||
$mform->addElement('hidden', 'moodlerelease', $CFG->release);
|
||||
$mform->setType('moodlerelease', PARAM_TEXT);
|
||||
$mform->addHelpButton('releasestring', 'siterelease', 'hub');
|
||||
|
||||
/// Display statistic that are going to be retrieve by the hub
|
||||
$coursecount = $DB->count_records('course') - 1;
|
||||
$usercount = $DB->count_records('user', array('deleted' => 0));
|
||||
$roleassigncount = $DB->count_records('role_assignments');
|
||||
$postcount = $DB->count_records('forum_posts');
|
||||
$questioncount = $DB->count_records('question');
|
||||
$resourcecount = $DB->count_records('resource');
|
||||
require_once($CFG->dirroot . "/course/lib.php");
|
||||
$participantnumberaverage = number_format(average_number_of_participants(), 2);
|
||||
$modulenumberaverage = number_format(average_number_of_courses_modules(), 2);
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
$badges = $DB->count_records_select('badge', 'status <> ' . BADGE_STATUS_ARCHIVED);
|
||||
$issuedbadges = $DB->count_records('badge_issued');
|
||||
|
||||
if (HUB_MOODLEORGHUBURL != $huburl) {
|
||||
$mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
|
||||
" " . get_string('coursesnumber', 'hub', $coursecount));
|
||||
$mform->setDefault('courses', $coursesnumber != -1);
|
||||
$mform->setType('courses', PARAM_INT);
|
||||
$mform->addHelpButton('courses', 'sendfollowinginfo', 'hub');
|
||||
|
||||
$mform->addElement('checkbox', 'users', '',
|
||||
" " . get_string('usersnumber', 'hub', $usercount));
|
||||
$mform->setDefault('users', $usersnumber != -1);
|
||||
$mform->setType('users', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'roleassignments', '',
|
||||
" " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
|
||||
$mform->setDefault('roleassignments', $roleassignmentsnumber != -1);
|
||||
$mform->setType('roleassignments', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'posts', '',
|
||||
" " . get_string('postsnumber', 'hub', $postcount));
|
||||
$mform->setDefault('posts', $postsnumber != -1);
|
||||
$mform->setType('posts', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'questions', '',
|
||||
" " . get_string('questionsnumber', 'hub', $questioncount));
|
||||
$mform->setDefault('questions', $questionsnumber != -1);
|
||||
$mform->setType('questions', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'resources', '',
|
||||
" " . get_string('resourcesnumber', 'hub', $resourcecount));
|
||||
$mform->setDefault('resources', $resourcesnumber != -1);
|
||||
$mform->setType('resources', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'badges', '',
|
||||
" " . get_string('badgesnumber', 'hub', $badges));
|
||||
$mform->setDefault('badges', $badgesnumber != -1);
|
||||
$mform->setType('resources', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'issuedbadges', '',
|
||||
" " . get_string('issuedbadgesnumber', 'hub', $issuedbadges));
|
||||
$mform->setDefault('issuedbadges', $issuedbadgesnumber != -1);
|
||||
$mform->setType('resources', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'participantnumberaverage', '',
|
||||
" " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
|
||||
$mform->setDefault('participantnumberaverage', $participantnumberaveragecfg != -1);
|
||||
$mform->setType('participantnumberaverage', PARAM_FLOAT);
|
||||
|
||||
$mform->addElement('checkbox', 'modulenumberaverage', '',
|
||||
" " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
|
||||
$mform->setDefault('modulenumberaverage', $modulenumberaveragecfg != -1);
|
||||
$mform->setType('modulenumberaverage', PARAM_FLOAT);
|
||||
} else {
|
||||
$mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
|
||||
" " . get_string('coursesnumber', 'hub', $coursecount));
|
||||
$mform->addElement('hidden', 'courses', 1);
|
||||
$mform->setType('courses', PARAM_INT);
|
||||
$mform->addHelpButton('courseslabel', 'sendfollowinginfo', 'hub');
|
||||
|
||||
$mform->addElement('static', 'userslabel', '',
|
||||
" " . get_string('usersnumber', 'hub', $usercount));
|
||||
$mform->addElement('hidden', 'users', 1);
|
||||
$mform->setType('users', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'roleassignmentslabel', '',
|
||||
" " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
|
||||
$mform->addElement('hidden', 'roleassignments', 1);
|
||||
$mform->setType('roleassignments', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'postslabel', '',
|
||||
" " . get_string('postsnumber', 'hub', $postcount));
|
||||
$mform->addElement('hidden', 'posts', 1);
|
||||
$mform->setType('posts', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'questionslabel', '',
|
||||
" " . get_string('questionsnumber', 'hub', $questioncount));
|
||||
$mform->addElement('hidden', 'questions', 1);
|
||||
$mform->setType('questions', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'resourceslabel', '',
|
||||
" " . get_string('resourcesnumber', 'hub', $resourcecount));
|
||||
$mform->addElement('hidden', 'resources', 1);
|
||||
$mform->setType('resources', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'badgeslabel', '',
|
||||
" " . get_string('badgesnumber', 'hub', $badges));
|
||||
$mform->addElement('hidden', 'badges', 1);
|
||||
$mform->setType('badges', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'issuedbadgeslabel', '',
|
||||
" " . get_string('issuedbadgesnumber', 'hub', $issuedbadges));
|
||||
$mform->addElement('hidden', 'issuedbadges', true);
|
||||
$mform->setType('issuedbadges', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'participantnumberaveragelabel', '',
|
||||
" " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
|
||||
$mform->addElement('hidden', 'participantnumberaverage', 1);
|
||||
$mform->setType('participantnumberaverage', PARAM_FLOAT);
|
||||
|
||||
$mform->addElement('static', 'modulenumberaveragelabel', '',
|
||||
" " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
|
||||
$mform->addElement('hidden', 'modulenumberaverage', 1);
|
||||
$mform->setType('modulenumberaverage', PARAM_FLOAT);
|
||||
}
|
||||
|
||||
//check if it's a first registration or update
|
||||
$hubregistered = $registrationmanager->get_registeredhub($huburl);
|
||||
|
||||
if (!empty($hubregistered)) {
|
||||
$buttonlabel = get_string('updatesite', 'hub',
|
||||
!empty($hubname) ? $hubname : $huburl);
|
||||
$mform->addElement('hidden', 'update', true);
|
||||
$mform->setType('update', PARAM_BOOL);
|
||||
} else {
|
||||
$buttonlabel = get_string('registersite', 'hub',
|
||||
!empty($hubname) ? $hubname : $huburl);
|
||||
}
|
||||
|
||||
$this->add_action_buttons(false, $buttonlabel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+171
-83
@@ -15,111 +15,199 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
/*
|
||||
* @package moodle
|
||||
* @subpackage registration
|
||||
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
|
||||
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
|
||||
*
|
||||
* This page displays the site registration form for Moodle.net.
|
||||
* It handles redirection to the hub to continue the registration workflow process.
|
||||
* It also handles update operation by web service.
|
||||
* On this page the administrator selects which hub he wants to register (except for moodle.net)
|
||||
* Admins can register with moodle.net via the site admin menu "Registration" link.
|
||||
* On this page the administrator can also unregister from any hubs including moodle.net.
|
||||
*/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require('../../config.php');
|
||||
|
||||
admin_externalpage_setup('registrationmoodleorg');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
|
||||
require_once($CFG->dirroot . '/course/publish/lib.php');
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
|
||||
admin_externalpage_setup('registrationhubs');
|
||||
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
|
||||
$unregistration = optional_param('unregistration', 0, PARAM_INT);
|
||||
$cleanregdata = optional_param('cleanregdata', 0, PARAM_BOOL);
|
||||
$confirm = optional_param('confirm', 0, PARAM_INT);
|
||||
$huburl = optional_param('huburl', '', PARAM_URL);
|
||||
$cancel = optional_param('cancel', null, PARAM_ALPHA);
|
||||
|
||||
if ($unregistration && \core\hub\registration::is_registered()) {
|
||||
$siteunregistrationform = new \core\hub\site_unregistration_form();
|
||||
$registrationmanager = new registration_manager();
|
||||
$publicationmanager = new course_publish_manager();
|
||||
$errormessage = '';
|
||||
if (empty($cancel) and $unregistration and $confirm and confirm_sesskey()) {
|
||||
|
||||
if ($siteunregistrationform->is_cancelled()) {
|
||||
redirect(new moodle_url('/admin/registration/index.php'));
|
||||
} else if ($data = $siteunregistrationform->get_data()) {
|
||||
if (\core\hub\registration::unregister($data->unpublishalladvertisedcourses,
|
||||
$data->unpublishalluploadedcourses)) {
|
||||
redirect(new moodle_url('/admin/registration/index.php'));
|
||||
$hub = $registrationmanager->get_registeredhub($huburl);
|
||||
|
||||
//unpublish course and unregister the site by web service
|
||||
if (!$cleanregdata) {
|
||||
|
||||
//check if we need to unpublish courses
|
||||
//enrollable courses
|
||||
$unpublishalladvertisedcourses = optional_param('unpublishalladvertisedcourses', 0, PARAM_INT);
|
||||
$hubcourseids = array();
|
||||
if ($unpublishalladvertisedcourses) {
|
||||
$enrollablecourses = $publicationmanager->get_publications($huburl, null, 1);
|
||||
if (!empty($enrollablecourses)) {
|
||||
foreach ($enrollablecourses as $enrollablecourse) {
|
||||
$hubcourseids[] = $enrollablecourse->hubcourseid;
|
||||
}
|
||||
}
|
||||
}
|
||||
//downloadable courses
|
||||
$unpublishalluploadedcourses = optional_param('unpublishalluploadedcourses', 0, PARAM_INT);
|
||||
if ($unpublishalluploadedcourses) {
|
||||
$downloadablecourses = $publicationmanager->get_publications($huburl, null, 0);
|
||||
if (!empty($downloadablecourses)) {
|
||||
foreach ($downloadablecourses as $downloadablecourse) {
|
||||
$hubcourseids[] = $downloadablecourse->hubcourseid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//unpublish the courses by web service
|
||||
if (!empty($hubcourseids)) {
|
||||
$function = 'hub_unregister_courses';
|
||||
$params = array('courseids' => $hubcourseids);
|
||||
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
//delete the published courses
|
||||
if (!empty($enrollablecourses)) {
|
||||
$publicationmanager->delete_hub_publications($huburl, 1);
|
||||
}
|
||||
if (!empty($downloadablecourses)) {
|
||||
$publicationmanager->delete_hub_publications($huburl, 0);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$errormessage = $e->getMessage();
|
||||
$errormessage .= html_writer::empty_tag('br') .
|
||||
get_string('errorunpublishcourses', 'hub');
|
||||
$confirm = false;
|
||||
$cleanregdata = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//course unpublish went ok, unregister the site now
|
||||
if ($confirm) {
|
||||
$function = 'hub_unregister_site';
|
||||
$params = array();
|
||||
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
} catch (Exception $e) {
|
||||
if (!$cleanregdata) {
|
||||
$errormessage = $e->getMessage();
|
||||
$confirm = false;
|
||||
$cleanregdata = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check that we are still processing the unregistration,
|
||||
//it could have been unset if an exception were previsouly catched
|
||||
if ($confirm) {
|
||||
$registrationmanager->delete_registeredhub($huburl);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($cancel) and $unregistration and !$confirm) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
//do not check sesskey if confirm = false because this script is linked into email message
|
||||
if (!empty($errormessage)) {
|
||||
echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
|
||||
}
|
||||
|
||||
$hub = $registrationmanager->get_registeredhub($huburl);
|
||||
echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', $hub->hubname), 3, 'main');
|
||||
if ($cleanregdata) {
|
||||
$siteunregistrationform = new site_clean_registration_data_form('',
|
||||
array('huburl' => $huburl, 'hubname' => $hub->hubname));
|
||||
} else {
|
||||
$siteunregistrationform = new site_unregistration_form('',
|
||||
array('huburl' => $huburl, 'hubname' => $hub->hubname));
|
||||
}
|
||||
|
||||
$siteunregistrationform->display();
|
||||
} else {
|
||||
$registeredonmoodleorg = false;
|
||||
$moodleorghub = $registrationmanager->get_registeredhub(HUB_MOODLEORGHUBURL);
|
||||
if (!empty($moodleorghub)) {
|
||||
$registeredonmoodleorg = true;
|
||||
}
|
||||
|
||||
// load the hub selector form
|
||||
$hubselectorform = new hub_selector_form();
|
||||
$fromform = $hubselectorform->get_data();
|
||||
$selectedhuburl = optional_param('publichub', false, PARAM_URL);
|
||||
$unlistedhuburl = optional_param('unlistedurl', false, PARAM_TEXT);
|
||||
$password = optional_param('password', '', PARAM_RAW);
|
||||
$registeringhuburl = null;
|
||||
if (!empty($unlistedhuburl)) {
|
||||
if (clean_param($unlistedhuburl, PARAM_URL) !== '') {
|
||||
$registeringhuburl = $unlistedhuburl;
|
||||
}
|
||||
} else if (!empty($selectedhuburl)) {
|
||||
$registeringhuburl = $selectedhuburl;
|
||||
}
|
||||
|
||||
// a hub has been selected, redirect to the hub registration page
|
||||
if (empty($cancel) and !empty($registeringhuburl) and confirm_sesskey()) {
|
||||
$hubname = optional_param(clean_param($registeringhuburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT);
|
||||
$params = array('sesskey' => sesskey(), 'huburl' => $registeringhuburl,
|
||||
'password' => $password, 'hubname' => $hubname);
|
||||
redirect(new moodle_url($CFG->wwwroot . "/" . $CFG->admin . "/registration/register.php",
|
||||
$params));
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', 'Moodle.net'), 3, 'main');
|
||||
$siteunregistrationform->display();
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
$isinitialregistration = \core\hub\registration::show_after_install(true);
|
||||
if (!$returnurl = optional_param('returnurl', null, PARAM_LOCALURL)) {
|
||||
$returnurl = $isinitialregistration ? '/admin/index.php' : '/admin/registration/index.php';
|
||||
}
|
||||
//check if the site is registered on Moodle.org and display a message about registering on MOOCH
|
||||
$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
|
||||
if (empty($registered)) {
|
||||
$warningmsg = get_string('registermoochtips', 'hub');
|
||||
$warningmsg .= $renderer->single_button(new moodle_url('register.php', array('huburl' => HUB_MOODLEORGHUBURL
|
||||
, 'hubname' => 'Moodle.org')), get_string('register', 'admin'));
|
||||
echo $renderer->box($warningmsg, 'buttons mdl-align generalbox adminwarning');
|
||||
}
|
||||
|
||||
$siteregistrationform = new \core\hub\site_registration_form();
|
||||
$siteregistrationform->set_data(['returnurl' => $returnurl]);
|
||||
if ($fromform = $siteregistrationform->get_data()) {
|
||||
//do not check sesskey if confirm = false because this script is linked into email message
|
||||
if (!empty($errormessage)) {
|
||||
echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
|
||||
}
|
||||
|
||||
// Save the settings.
|
||||
\core\hub\registration::save_site_info($fromform);
|
||||
echo $OUTPUT->heading(get_string('registerwith', 'hub'));
|
||||
|
||||
if (\core\hub\registration::is_registered()) {
|
||||
if (\core\hub\registration::update_manual()) {
|
||||
redirect(new moodle_url($returnurl));
|
||||
$hubselectorform->display();
|
||||
|
||||
if (extension_loaded('xmlrpc')) {
|
||||
$hubs = $registrationmanager->get_registered_on_hubs();
|
||||
if (!empty($hubs)) {
|
||||
echo $OUTPUT->heading(get_string('registeredon', 'hub'), 3, 'main');
|
||||
echo $renderer->registeredonhublisting($hubs);
|
||||
}
|
||||
redirect(new moodle_url('/admin/registration/index.php', ['returnurl' => $returnurl]));
|
||||
} else {
|
||||
\core\hub\registration::register($returnurl);
|
||||
// This method will redirect away.
|
||||
} else { //display notice about xmlrpc
|
||||
$xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
|
||||
$xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
|
||||
echo $OUTPUT->notification($xmlrpcnotification);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// OUTPUT SECTION.
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Current status of registration on Moodle.net.
|
||||
|
||||
$notificationtype = \core\output\notification::NOTIFY_ERROR;
|
||||
if (\core\hub\registration::is_registered()) {
|
||||
$lastupdated = \core\hub\registration::get_last_updated();
|
||||
if ($lastupdated == 0) {
|
||||
$registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin');
|
||||
} else if (\core\hub\registration::get_new_registration_fields()) {
|
||||
$registrationmessage = get_string('pleaserefreshregistrationnewdata', 'admin');
|
||||
} else {
|
||||
$lastupdated = userdate($lastupdated, get_string('strftimedate', 'langconfig'));
|
||||
$registrationmessage = get_string('pleaserefreshregistration', 'admin', $lastupdated);
|
||||
$notificationtype = \core\output\notification::NOTIFY_INFO;
|
||||
}
|
||||
echo $OUTPUT->notification($registrationmessage, $notificationtype);
|
||||
} else if (!$isinitialregistration) {
|
||||
$registrationmessage = get_string('registrationwarning', 'admin');
|
||||
echo $OUTPUT->notification($registrationmessage, $notificationtype);
|
||||
}
|
||||
|
||||
// Heading.
|
||||
if (\core\hub\registration::is_registered()) {
|
||||
echo $OUTPUT->heading(get_string('updatesite', 'hub', 'Moodle.net'));
|
||||
} else if ($isinitialregistration) {
|
||||
echo $OUTPUT->heading(get_string('completeregistration', 'hub'));
|
||||
} else {
|
||||
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
|
||||
}
|
||||
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
echo $renderer->moodleorg_registration_message();
|
||||
|
||||
$siteregistrationform->display();
|
||||
|
||||
if (\core\hub\registration::is_registered()) {
|
||||
// Unregister link.
|
||||
$unregisterhuburl = new moodle_url("/admin/registration/index.php", ['unregistration' => 1]);
|
||||
echo html_writer::div(html_writer::link($unregisterhuburl, get_string('unregister', 'hub')), 'unregister');
|
||||
} else if ($isinitialregistration) {
|
||||
echo html_writer::div(html_writer::link(new moodle_url($returnurl), get_string('skipregistration', 'hub')), 'skipregistration');
|
||||
}
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
+295
-1
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@@ -14,4 +15,297 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
|
||||
//// SITE PRIVACY /////
|
||||
|
||||
/**
|
||||
* Site privacy: private
|
||||
*/
|
||||
define('HUB_SITENOTPUBLISHED', 'notdisplayed');
|
||||
|
||||
/**
|
||||
* Site privacy: public
|
||||
*/
|
||||
define('HUB_SITENAMEPUBLISHED', 'named');
|
||||
|
||||
/**
|
||||
* Site privacy: public and global
|
||||
*/
|
||||
define('HUB_SITELINKPUBLISHED', 'linked');
|
||||
|
||||
/**
|
||||
*
|
||||
* Site registration library
|
||||
*
|
||||
* @package course
|
||||
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
|
||||
* @author Jerome Mouneyrac
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class registration_manager {
|
||||
|
||||
/**
|
||||
* Automatically update the registration on all hubs
|
||||
*/
|
||||
public function cron() {
|
||||
global $CFG;
|
||||
if (extension_loaded('xmlrpc')) {
|
||||
$function = 'hub_update_site_info';
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
|
||||
// Update all hubs where the site is registered.
|
||||
$hubs = $this->get_registered_on_hubs();
|
||||
if (empty($hubs)) {
|
||||
mtrace(get_string('registrationwarning', 'admin'));
|
||||
}
|
||||
foreach ($hubs as $hub) {
|
||||
// Update the registration.
|
||||
$siteinfo = $this->get_site_info($hub->huburl);
|
||||
$params = array('siteinfo' => $siteinfo);
|
||||
$serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
$this->update_registeredhub($hub); // To update timemodified.
|
||||
mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
|
||||
} catch (Exception $e) {
|
||||
$errorparam = new stdClass();
|
||||
$errorparam->errormessage = $e->getMessage();
|
||||
$errorparam->hubname = $hub->hubname;
|
||||
mtrace(get_string('errorcron', 'hub', $errorparam));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mtrace(get_string('errorcronnoxmlrpc', 'hub'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the site secret for a given hub
|
||||
* site identifier is assigned to Mooch
|
||||
* each hub has a unique and personal site secret.
|
||||
* @param string $huburl
|
||||
* @return string site secret
|
||||
*/
|
||||
public function get_site_secret_for_hub($huburl) {
|
||||
global $DB;
|
||||
|
||||
$existingregistration = $DB->get_record('registration_hubs',
|
||||
array('huburl' => $huburl));
|
||||
|
||||
if (!empty($existingregistration)) {
|
||||
return $existingregistration->secret;
|
||||
}
|
||||
|
||||
if ($huburl == HUB_MOODLEORGHUBURL) {
|
||||
$siteidentifier = get_site_identifier();
|
||||
} else {
|
||||
$siteidentifier = random_string(32) . $_SERVER['HTTP_HOST'];
|
||||
}
|
||||
|
||||
return $siteidentifier;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* When the site register on a hub, he must call this function
|
||||
* @param object $hub where the site is registered on
|
||||
* @return integer id of the record
|
||||
*/
|
||||
public function add_registeredhub($hub) {
|
||||
global $DB;
|
||||
$hub->timemodified = time();
|
||||
$id = $DB->insert_record('registration_hubs', $hub);
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* When a site unregister from a hub, he must call this function
|
||||
* @param string $huburl the huburl to delete
|
||||
*/
|
||||
public function delete_registeredhub($huburl) {
|
||||
global $DB;
|
||||
$DB->delete_records('registration_hubs', array('huburl' => $huburl));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a hub on which the site is registered for a given url or token
|
||||
* Mostly use to check if the site is registered on a specific hub
|
||||
* @param string $huburl
|
||||
* @param string $token
|
||||
* @return object the hub
|
||||
*/
|
||||
public function get_registeredhub($huburl = null, $token = null) {
|
||||
global $DB;
|
||||
|
||||
$params = array();
|
||||
if (!empty($huburl)) {
|
||||
$params['huburl'] = $huburl;
|
||||
}
|
||||
if (!empty($token)) {
|
||||
$params['token'] = $token;
|
||||
}
|
||||
$params['confirmed'] = 1;
|
||||
$token = $DB->get_record('registration_hubs', $params);
|
||||
return $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hub which has not confirmed that the site is registered on,
|
||||
* but for which a request has been sent
|
||||
* @param string $huburl
|
||||
* @return object the hub
|
||||
*/
|
||||
public function get_unconfirmedhub($huburl) {
|
||||
global $DB;
|
||||
|
||||
$params = array();
|
||||
$params['huburl'] = $huburl;
|
||||
$params['confirmed'] = 0;
|
||||
$token = $DB->get_record('registration_hubs', $params);
|
||||
return $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a registered hub (mostly use to update the confirmation status)
|
||||
* @param object $hub the hub
|
||||
*/
|
||||
public function update_registeredhub($hub) {
|
||||
global $DB;
|
||||
$hub->timemodified = time();
|
||||
$DB->update_record('registration_hubs', $hub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all hubs where the site is registered
|
||||
*/
|
||||
public function get_registered_on_hubs() {
|
||||
global $DB;
|
||||
$hubs = $DB->get_records('registration_hubs', array('confirmed' => 1));
|
||||
return $hubs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return site information for a specific hub
|
||||
* @param string $huburl
|
||||
* @return array site info
|
||||
*/
|
||||
public function get_site_info($huburl) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$siteinfo = array();
|
||||
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
|
||||
$siteinfo['name'] = get_config('hub', 'site_name_' . $cleanhuburl);
|
||||
$siteinfo['description'] = get_config('hub', 'site_description_' . $cleanhuburl);
|
||||
$siteinfo['contactname'] = get_config('hub', 'site_contactname_' . $cleanhuburl);
|
||||
$siteinfo['contactemail'] = get_config('hub', 'site_contactemail_' . $cleanhuburl);
|
||||
$siteinfo['contactphone'] = get_config('hub', 'site_contactphone_' . $cleanhuburl);
|
||||
$siteinfo['imageurl'] = get_config('hub', 'site_imageurl_' . $cleanhuburl);
|
||||
$siteinfo['privacy'] = get_config('hub', 'site_privacy_' . $cleanhuburl);
|
||||
$siteinfo['street'] = get_config('hub', 'site_address_' . $cleanhuburl);
|
||||
$siteinfo['regioncode'] = get_config('hub', 'site_region_' . $cleanhuburl);
|
||||
$siteinfo['countrycode'] = get_config('hub', 'site_country_' . $cleanhuburl);
|
||||
$siteinfo['geolocation'] = get_config('hub', 'site_geolocation_' . $cleanhuburl);
|
||||
$siteinfo['contactable'] = get_config('hub', 'site_contactable_' . $cleanhuburl);
|
||||
$siteinfo['emailalert'] = get_config('hub', 'site_emailalert_' . $cleanhuburl);
|
||||
if (get_config('hub', 'site_coursesnumber_' . $cleanhuburl) == -1) {
|
||||
$coursecount = -1;
|
||||
} else {
|
||||
$coursecount = $DB->count_records('course') - 1;
|
||||
}
|
||||
$siteinfo['courses'] = $coursecount;
|
||||
if (get_config('hub', 'site_usersnumber_' . $cleanhuburl) == -1) {
|
||||
$usercount = -1;
|
||||
} else {
|
||||
$usercount = $DB->count_records('user', array('deleted' => 0));
|
||||
}
|
||||
$siteinfo['users'] = $usercount;
|
||||
|
||||
if (get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl) == -1) {
|
||||
$roleassigncount = -1;
|
||||
} else {
|
||||
$roleassigncount = $DB->count_records('role_assignments');
|
||||
}
|
||||
$siteinfo['enrolments'] = $roleassigncount;
|
||||
if (get_config('hub', 'site_postsnumber_' . $cleanhuburl) == -1) {
|
||||
$postcount = -1;
|
||||
} else {
|
||||
$postcount = $DB->count_records('forum_posts');
|
||||
}
|
||||
$siteinfo['posts'] = $postcount;
|
||||
if (get_config('hub', 'site_questionsnumber_' . $cleanhuburl) == -1) {
|
||||
$questioncount = -1;
|
||||
} else {
|
||||
$questioncount = $DB->count_records('question');
|
||||
}
|
||||
$siteinfo['questions'] = $questioncount;
|
||||
if (get_config('hub', 'site_resourcesnumber_' . $cleanhuburl) == -1) {
|
||||
$resourcecount = -1;
|
||||
} else {
|
||||
$resourcecount = $DB->count_records('resource');
|
||||
}
|
||||
$siteinfo['resources'] = $resourcecount;
|
||||
// Badge statistics.
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
if (get_config('hub', 'site_badges_' . $cleanhuburl) == -1) {
|
||||
$badges = -1;
|
||||
} else {
|
||||
$badges = $DB->count_records_select('badge', 'status <> ' . BADGE_STATUS_ARCHIVED);
|
||||
}
|
||||
$siteinfo['badges'] = $badges;
|
||||
if (get_config('hub', 'site_issuedbadges_' . $cleanhuburl) == -1) {
|
||||
$issuedbadges = -1;
|
||||
} else {
|
||||
$issuedbadges = $DB->count_records('badge_issued');
|
||||
}
|
||||
$siteinfo['issuedbadges'] = $issuedbadges;
|
||||
//TODO
|
||||
require_once($CFG->dirroot . "/course/lib.php");
|
||||
if (get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl) == -1) {
|
||||
$participantnumberaverage = -1;
|
||||
} else {
|
||||
$participantnumberaverage = average_number_of_participants();
|
||||
}
|
||||
$siteinfo['participantnumberaverage'] = $participantnumberaverage;
|
||||
if (get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl) == -1) {
|
||||
$modulenumberaverage = -1;
|
||||
} else {
|
||||
$modulenumberaverage = average_number_of_courses_modules();
|
||||
}
|
||||
$siteinfo['modulenumberaverage'] = $modulenumberaverage;
|
||||
$siteinfo['language'] = get_config('hub', 'site_language_' . $cleanhuburl);
|
||||
$siteinfo['moodleversion'] = $CFG->version;
|
||||
$siteinfo['moodlerelease'] = $CFG->release;
|
||||
$siteinfo['url'] = $CFG->wwwroot;
|
||||
|
||||
return $siteinfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the site privacy string matching the define value
|
||||
* @param string $privacy must match the define into moodlelib.php
|
||||
* @return string
|
||||
*/
|
||||
public function get_site_privacy_string($privacy) {
|
||||
switch ($privacy) {
|
||||
case HUB_SITENOTPUBLISHED:
|
||||
$privacystring = get_string('siteprivacynotpublished', 'hub');
|
||||
break;
|
||||
case HUB_SITENAMEPUBLISHED:
|
||||
$privacystring = get_string('siteprivacypublished', 'hub');
|
||||
break;
|
||||
case HUB_SITELINKPUBLISHED:
|
||||
$privacystring = get_string('siteprivacylinked', 'hub');
|
||||
break;
|
||||
}
|
||||
if (empty($privacystring)) {
|
||||
throw new moodle_exception('unknownprivacy');
|
||||
}
|
||||
return $privacystring;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
/*
|
||||
* @package moodle
|
||||
* @subpackage registration
|
||||
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
|
||||
@@ -34,5 +34,168 @@
|
||||
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
|
||||
require_once($CFG->dirroot . '/webservice/lib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
|
||||
|
||||
redirect(new moodle_url('/admin/registration/index.php'));
|
||||
require_sesskey();
|
||||
|
||||
$huburl = required_param('huburl', PARAM_URL);
|
||||
$huburl = rtrim($huburl, "/");
|
||||
|
||||
if ($huburl == HUB_MOODLEORGHUBURL) { // register to Moodle.org
|
||||
admin_externalpage_setup('registrationmoodleorg');
|
||||
} else { //register to a hub
|
||||
admin_externalpage_setup('registrationhub');
|
||||
}
|
||||
|
||||
$password = optional_param('password', '', PARAM_TEXT);
|
||||
$hubname = optional_param('hubname', '', PARAM_TEXT);
|
||||
|
||||
$registrationmanager = new registration_manager();
|
||||
|
||||
$registeredhub = $registrationmanager->get_registeredhub($huburl);
|
||||
|
||||
$siteregistrationform = new site_registration_form('',
|
||||
array('alreadyregistered' => !empty($registeredhub->token),
|
||||
'huburl' => $huburl, 'hubname' => $hubname,
|
||||
'password' => $password));
|
||||
$fromform = $siteregistrationform->get_data();
|
||||
|
||||
if (!empty($fromform) and confirm_sesskey()) {
|
||||
|
||||
// Set to -1 all optional data marked as "don't send" by the admin.
|
||||
// The function get_site_info() will not calculate the optional data if config is set to -1.
|
||||
$inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
|
||||
'badges', 'issuedbadges', 'modulenumberaverage', 'participantnumberaverage');
|
||||
foreach ($inputnames as $inputname) {
|
||||
if (empty($fromform->{$inputname})) {
|
||||
$fromform->{$inputname} = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Save the settings.
|
||||
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
|
||||
set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
|
||||
set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
|
||||
set_config('site_contactname_' . $cleanhuburl, $fromform->contactname, 'hub');
|
||||
set_config('site_contactemail_' . $cleanhuburl, $fromform->contactemail, 'hub');
|
||||
set_config('site_contactphone_' . $cleanhuburl, $fromform->contactphone, 'hub');
|
||||
set_config('site_imageurl_' . $cleanhuburl, $fromform->imageurl, 'hub');
|
||||
set_config('site_privacy_' . $cleanhuburl, $fromform->privacy, 'hub');
|
||||
set_config('site_address_' . $cleanhuburl, $fromform->address, 'hub');
|
||||
set_config('site_region_' . $cleanhuburl, $fromform->regioncode, 'hub');
|
||||
set_config('site_country_' . $cleanhuburl, $fromform->countrycode, 'hub');
|
||||
set_config('site_language_' . $cleanhuburl, $fromform->language, 'hub');
|
||||
set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
|
||||
set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
|
||||
set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
|
||||
set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
|
||||
set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
|
||||
set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
|
||||
set_config('site_postsnumber_' . $cleanhuburl, $fromform->posts, 'hub');
|
||||
set_config('site_questionsnumber_' . $cleanhuburl, $fromform->questions, 'hub');
|
||||
set_config('site_resourcesnumber_' . $cleanhuburl, $fromform->resources, 'hub');
|
||||
set_config('site_badges_' . $cleanhuburl, $fromform->badges, 'hub');
|
||||
set_config('site_issuedbadges_' . $cleanhuburl, $fromform->issuedbadges, 'hub');
|
||||
set_config('site_modulenumberaverage_' . $cleanhuburl, $fromform->modulenumberaverage, 'hub');
|
||||
set_config('site_participantnumberaverage_' . $cleanhuburl, $fromform->participantnumberaverage, 'hub');
|
||||
}
|
||||
|
||||
/////// UPDATE ACTION ////////
|
||||
|
||||
// update the hub registration
|
||||
$update = optional_param('update', 0, PARAM_INT);
|
||||
if ($update and confirm_sesskey()) {
|
||||
|
||||
//update the registration
|
||||
$function = 'hub_update_site_info';
|
||||
$siteinfo = $registrationmanager->get_site_info($huburl);
|
||||
$params = array('siteinfo' => $siteinfo);
|
||||
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
$registrationmanager->update_registeredhub($registeredhub); // To update timemodified.
|
||||
} catch (Exception $e) {
|
||||
$error = $OUTPUT->notification(get_string('errorregistration', 'hub', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/////// FORM REGISTRATION ACTION //////
|
||||
|
||||
if (!empty($fromform) and empty($update) and confirm_sesskey()) {
|
||||
|
||||
if (!empty($fromform) and confirm_sesskey()) { // if the register button has been clicked
|
||||
|
||||
// Retrieve the optional info (specially course number, user number, module number average...).
|
||||
$siteinfo = $registrationmanager->get_site_info($huburl);
|
||||
$fromform->courses = $siteinfo['courses'];
|
||||
$fromform->users = $siteinfo['users'];
|
||||
$fromform->enrolments = $siteinfo['enrolments'];
|
||||
$fromform->posts = $siteinfo['posts'];
|
||||
$fromform->questions = $siteinfo['questions'];
|
||||
$fromform->resources = $siteinfo['resources'];
|
||||
$fromform->badges = $siteinfo['badges'];
|
||||
$fromform->issuedbadges = $siteinfo['issuedbadges'];
|
||||
$fromform->modulenumberaverage = $siteinfo['modulenumberaverage'];
|
||||
$fromform->participantnumberaverage = $siteinfo['participantnumberaverage'];
|
||||
$fromform->street = $siteinfo['street'];
|
||||
|
||||
$params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
|
||||
|
||||
$unconfirmedhub = $registrationmanager->get_unconfirmedhub($huburl);
|
||||
if (empty($unconfirmedhub)) {
|
||||
//we save the token into the communication table in order to have a reference
|
||||
$unconfirmedhub = new stdClass();
|
||||
$unconfirmedhub->token = $registrationmanager->get_site_secret_for_hub($huburl);
|
||||
$unconfirmedhub->secret = $unconfirmedhub->token;
|
||||
$unconfirmedhub->huburl = $huburl;
|
||||
$unconfirmedhub->hubname = $hubname;
|
||||
$unconfirmedhub->confirmed = 0;
|
||||
$unconfirmedhub->id = $registrationmanager->add_registeredhub($unconfirmedhub);
|
||||
}
|
||||
|
||||
$params['token'] = $unconfirmedhub->token;
|
||||
$params['url'] = $CFG->wwwroot;
|
||||
redirect(new moodle_url($huburl . '/local/hub/siteregistration.php', $params));
|
||||
}
|
||||
}
|
||||
|
||||
/////// OUTPUT SECTION /////////////
|
||||
|
||||
echo $OUTPUT->header();
|
||||
//Display update notification result
|
||||
if (!empty($registeredhub->confirmed)) {
|
||||
if (!empty($result)) {
|
||||
echo $OUTPUT->notification(get_string('siteregistrationupdated', 'hub'), 'notifysuccess');
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($error)) {
|
||||
echo $error;
|
||||
}
|
||||
|
||||
// Some Moodle.org registration explanation.
|
||||
if ($huburl == HUB_MOODLEORGHUBURL) {
|
||||
if (!empty($registeredhub->token)) {
|
||||
if ($registeredhub->timemodified == 0) {
|
||||
$registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin');
|
||||
} else {
|
||||
$lastupdated = userdate($registeredhub->timemodified, get_string('strftimedate', 'langconfig'));
|
||||
$registrationmessage = get_string('pleaserefreshregistration', 'admin', $lastupdated);
|
||||
}
|
||||
} else {
|
||||
$registrationmessage = get_string('registrationwarning', 'admin');
|
||||
}
|
||||
echo $OUTPUT->notification($registrationmessage);
|
||||
|
||||
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
echo $renderer->moodleorg_registration_message();
|
||||
}
|
||||
|
||||
$siteregistrationform->display();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
@@ -36,6 +36,60 @@ class core_register_renderer extends plugin_renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
public function moodleorg_registration_message() {
|
||||
return format_text(get_string('registermoodlenet', 'admin'), FORMAT_HTML, ['noclean' => true]);
|
||||
$moodleorgstatslink = html_writer::link('http://moodle.net/stats',
|
||||
get_string('statsmoodleorg', 'admin'),
|
||||
array('target' => '_blank'));
|
||||
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin');
|
||||
$items = array(get_string('registermoodleorgli1', 'admin'),
|
||||
get_string('registermoodleorgli2', 'admin', $moodleorgstatslink));
|
||||
$moodleorgregmsg .= html_writer::alist($items);
|
||||
return $moodleorgregmsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a box message confirming a site registration (add or update)
|
||||
* @param string $confirmationmessage
|
||||
* @return string
|
||||
*/
|
||||
public function registration_confirmation($confirmationmessage) {
|
||||
$linktositelist = html_writer::tag('a', get_string('sitelist', 'hub'),
|
||||
array('href' => new moodle_url('/local/hub/index.php')));
|
||||
$message = $confirmationmessage . html_writer::empty_tag('br') . $linktositelist;
|
||||
return $this->output->box($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the listing of registered on hub
|
||||
*/
|
||||
public function registeredonhublisting($hubs) {
|
||||
global $CFG;
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('hub', 'hub'), get_string('operation', 'hub'));
|
||||
$table->size = array('80%', '20%');
|
||||
|
||||
foreach ($hubs as $hub) {
|
||||
if ($hub->huburl == HUB_MOODLEORGHUBURL) {
|
||||
$hub->hubname = get_string('registeredmoodleorg', 'hub', $hub->hubname);
|
||||
}
|
||||
$hublink = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl));
|
||||
$hublinkcell = html_writer::tag('div', $hublink, array('class' => 'registeredhubrow'));
|
||||
|
||||
$unregisterhuburl = new moodle_url("/" . $CFG->admin . "/registration/index.php",
|
||||
array('sesskey' => sesskey(), 'huburl' => $hub->huburl,
|
||||
'unregistration' => 1));
|
||||
$unregisterbutton = new single_button($unregisterhuburl,
|
||||
get_string('unregister', 'hub'));
|
||||
$unregisterbutton->class = 'centeredbutton';
|
||||
$unregisterbuttonhtml = $this->output->render($unregisterbutton);
|
||||
|
||||
//add button cells
|
||||
$cells = array($hublinkcell, $unregisterbuttonhtml);
|
||||
$row = new html_table_row($cells);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
return html_writer::table($table);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
/*
|
||||
* @package moodle
|
||||
* @subpackage registration
|
||||
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
|
||||
@@ -33,40 +33,44 @@
|
||||
|
||||
require('../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
|
||||
|
||||
$url = optional_param('url', '', PARAM_URL);
|
||||
$hubname = optional_param('hubname', '', PARAM_TEXT);
|
||||
$token = optional_param('token', '', PARAM_TEXT);
|
||||
|
||||
admin_externalpage_setup('registrationmoodleorg');
|
||||
admin_externalpage_setup('registrationhubs');
|
||||
|
||||
if ($url !== HUB_MOODLEORGHUBURL) {
|
||||
// Allow other plugins to renew registration on hubs other than moodle.net . Plugins implementing this
|
||||
// callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration .
|
||||
$callbacks = get_plugins_with_function('hub_registration');
|
||||
foreach ($callbacks as $plugintype => $plugins) {
|
||||
foreach ($plugins as $plugin => $callback) {
|
||||
$callback('renew');
|
||||
}
|
||||
//check that we are waiting a confirmation from this hub, and check that the token is correct
|
||||
$registrationmanager = new registration_manager();
|
||||
$registeredhub = $registrationmanager->get_unconfirmedhub($url);
|
||||
if (!empty($registeredhub) and $registeredhub->token == $token) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
|
||||
$hublink = html_writer::tag('a', $hubname, array('href' => $url));
|
||||
|
||||
$registrationmanager->delete_registeredhub($url);
|
||||
|
||||
//Mooch case, need to recreate the siteidentifier
|
||||
if ($url == HUB_MOODLEORGHUBURL) {
|
||||
$CFG->siteidentifier = null;
|
||||
get_site_identifier();
|
||||
}
|
||||
throw new moodle_exception('errorotherhubsnotsupported', 'hub');
|
||||
|
||||
$deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
|
||||
|
||||
$button = new single_button(new moodle_url('/admin/registration/index.php'),
|
||||
get_string('restartregistration', 'hub'));
|
||||
$button->class = 'restartregbutton';
|
||||
|
||||
echo html_writer::tag('div', $deletedregmsg . $OUTPUT->render($button),
|
||||
array('class' => 'mdl-align'));
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
} else {
|
||||
throw new moodle_exception('wrongtoken', 'hub',
|
||||
$CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
|
||||
}
|
||||
|
||||
// Check that we are waiting a confirmation from this hub, and check that the token is correct.
|
||||
\core\hub\registration::reset_site_identifier($token);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
|
||||
$hublink = html_writer::tag('a', 'Moodle.net', array('href' => HUB_MOODLEORGHUBURL));
|
||||
|
||||
$deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
|
||||
|
||||
$button = new single_button(new moodle_url('/admin/registration/index.php'),
|
||||
get_string('restartregistration', 'hub'));
|
||||
$button->class = 'restartregbutton';
|
||||
|
||||
echo html_writer::tag('div', $deletedregmsg . $OUTPUT->render($button),
|
||||
array('class' => 'mdl-align'));
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
|
||||
|
||||
+7
-100
@@ -276,19 +276,12 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @param int|null $availableupdatesfetch timestamp of the most recent updates fetch or null (unknown)
|
||||
* @param string[] $cachewarnings An array containing warnings from the Cache API.
|
||||
* @param array $eventshandlers Events 1 API handlers.
|
||||
* @param bool $themedesignermode Warn about the theme designer mode.
|
||||
* @param bool $devlibdir Warn about development libs directory presence.
|
||||
* @param bool $mobileconfigured Whether the mobile web services have been enabled
|
||||
* @param bool $overridetossl Whether or not ssl is being forced.
|
||||
* @param bool $invalidforgottenpasswordurl Whether the forgotten password URL does not link to a valid URL.
|
||||
*
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
|
||||
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
|
||||
$buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0,
|
||||
$themedesignermode = false, $devlibdir = false, $mobileconfigured = false,
|
||||
$overridetossl = false, $invalidforgottenpasswordurl = false) {
|
||||
$buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0, $themedesignermode = false) {
|
||||
global $CFG;
|
||||
$output = '';
|
||||
|
||||
@@ -297,19 +290,15 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->legacy_log_store_writing_error();
|
||||
$output .= empty($CFG->disableupdatenotifications) ? $this->available_updates($availableupdates, $availableupdatesfetch) : '';
|
||||
$output .= $this->insecure_dataroot_warning($insecuredataroot);
|
||||
$output .= $this->development_libs_directories_warning($devlibdir);
|
||||
$output .= $this->themedesignermode_warning($themedesignermode);
|
||||
$output .= $this->display_errors_warning($errorsdisplayed);
|
||||
$output .= $this->buggy_iconv_warning($buggyiconvnomb);
|
||||
$output .= $this->cron_overdue_warning($cronoverdue);
|
||||
$output .= $this->db_problems($dbproblems);
|
||||
$output .= $this->maintenance_mode_warning($maintenancemode);
|
||||
$output .= $this->overridetossl_warning($overridetossl);
|
||||
$output .= $this->cache_warnings($cachewarnings);
|
||||
$output .= $this->events_handlers($eventshandlers);
|
||||
$output .= $this->registration_warning($registered);
|
||||
$output .= $this->mobile_configuration_warning($mobileconfigured);
|
||||
$output .= $this->forgotten_password_url_warning($invalidforgottenpasswordurl);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
|
||||
@@ -531,24 +520,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a warning that a directory with development libs is present.
|
||||
*
|
||||
* @param bool $devlibdir True if the warning should be displayed.
|
||||
* @return string
|
||||
*/
|
||||
protected function development_libs_directories_warning($devlibdir) {
|
||||
|
||||
if ($devlibdir) {
|
||||
$moreinfo = new moodle_url('/report/security/index.php');
|
||||
$warning = get_string('devlibdirpresent', 'core_admin', ['moreinfourl' => $moreinfo->out()]);
|
||||
return $this->warning($warning, 'error');
|
||||
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an appropriate message if dataroot is insecure.
|
||||
* @param bool $errorsdisplayed
|
||||
@@ -673,20 +644,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return $this->warning(get_string('sitemaintenancewarning2', 'admin', $url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a warning that ssl is forced because the site was on loginhttps.
|
||||
*
|
||||
* @param bool $overridetossl Whether or not ssl is being forced.
|
||||
* @return string
|
||||
*/
|
||||
protected function overridetossl_warning($overridetossl) {
|
||||
if (!$overridetossl) {
|
||||
return '';
|
||||
}
|
||||
$warning = get_string('overridetossl', 'core_admin');
|
||||
return $this->warning($warning, 'warning');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a warning about installing development code if necesary.
|
||||
* @param int $maturity
|
||||
@@ -825,67 +782,17 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
if (!$registered) {
|
||||
|
||||
if (has_capability('moodle/site:config', context_system::instance())) {
|
||||
$registerbutton = $this->single_button(new moodle_url('/admin/registration/index.php'),
|
||||
$registerbutton = $this->single_button(new moodle_url('/admin/registration/register.php',
|
||||
array('huburl' => HUB_MOODLEORGHUBURL, 'hubname' => 'Moodle.org')),
|
||||
get_string('register', 'admin'));
|
||||
$str = 'registrationwarning';
|
||||
} else {
|
||||
$registerbutton = '';
|
||||
$str = 'registrationwarningcontactadmin';
|
||||
}
|
||||
|
||||
return $this->warning( get_string($str, 'admin')
|
||||
. ' ' . $this->help_icon('registration', 'admin') . $registerbutton ,
|
||||
'error alert alert-danger');
|
||||
return $this->warning( get_string('registrationwarning', 'admin')
|
||||
. ' ' . $this->help_icon('registration', 'admin') . $registerbutton );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an admin page warning if site is not registered with moodle.org
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function warn_if_not_registered() {
|
||||
return $this->registration_warning(\core\hub\registration::is_registered());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a warning about the Mobile Web Services being disabled.
|
||||
*
|
||||
* @param boolean $mobileconfigured true if mobile web services are enabled
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
protected function mobile_configuration_warning($mobileconfigured) {
|
||||
$output = '';
|
||||
if (!$mobileconfigured) {
|
||||
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'mobilesettings']);
|
||||
$configurebutton = $this->single_button($settingslink, get_string('enablemobilewebservice', 'admin'));
|
||||
$output .= $this->warning(get_string('mobilenotconfiguredwarning', 'admin') . ' ' . $configurebutton);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a warning about the forgotten password URL not linking to a valid URL.
|
||||
*
|
||||
* @param boolean $invalidforgottenpasswordurl true if the forgotten password URL is not valid
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
protected function forgotten_password_url_warning($invalidforgottenpasswordurl) {
|
||||
$output = '';
|
||||
if ($invalidforgottenpasswordurl) {
|
||||
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'manageauths']);
|
||||
$configurebutton = $this->single_button($settingslink, get_string('check', 'moodle'));
|
||||
$output .= $this->warning(get_string('invalidforgottenpasswordurl', 'admin') . ' ' . $configurebutton,
|
||||
'error alert alert-danger');
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to render the information about the available Moodle update
|
||||
*
|
||||
@@ -1705,10 +1612,10 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$row = new html_table_row();
|
||||
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
|
||||
|
||||
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name, null)) {
|
||||
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
|
||||
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'icon pluginicon'));
|
||||
} else {
|
||||
$icon = $this->output->spacer();
|
||||
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
|
||||
}
|
||||
$status = $plugin->get_status();
|
||||
$row->attributes['class'] .= ' status-'.$status;
|
||||
|
||||
@@ -370,14 +370,14 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
|
||||
if ($updowncount > 1) {
|
||||
$updown .= "<a href=\"$sesskeyurl&action=moveup&repos=".$typename."\">";
|
||||
$updown .= $OUTPUT->pix_icon('t/up', get_string('moveup')) . "</a> ";
|
||||
$updown .= "<img src=\"" . $OUTPUT->pix_url('t/up') . "\" alt=\"up\" /></a> ";
|
||||
}
|
||||
else {
|
||||
$updown .= $spacer;
|
||||
}
|
||||
if ($updowncount < $totalrepositorytypes) {
|
||||
$updown .= "<a href=\"$sesskeyurl&action=movedown&repos=".$typename."\">";
|
||||
$updown .= $OUTPUT->pix_icon('t/down', get_string('movedown')) . "</a> ";
|
||||
$updown .= "<img src=\"" . $OUTPUT->pix_url('t/down') . "\" alt=\"down\" /></a>";
|
||||
}
|
||||
else {
|
||||
$updown .= $spacer;
|
||||
|
||||
@@ -245,7 +245,7 @@ if ($roleid) {
|
||||
$select = new single_select($PAGE->url, 'roleid', $nameswithcounts, $roleid, null);
|
||||
$select->label = get_string('assignanotherrole', 'core_role');
|
||||
echo $OUTPUT->render($select);
|
||||
echo '<p><a href="' . $url . '">' . get_string('backtoallroles', 'core_role') . '</a></p>';
|
||||
echo '<p><a href="' . $PAGE->url . '">' . get_string('backtoallroles', 'core_role') . '</a></p>';
|
||||
echo '</div>';
|
||||
|
||||
} else if (empty($assignableroles)) {
|
||||
|
||||
@@ -183,14 +183,10 @@ abstract class core_role_capability_table_with_risks extends core_role_capabilit
|
||||
public function get_risk_icon($type) {
|
||||
global $OUTPUT;
|
||||
|
||||
$alt = get_string("{$type}short", "admin");
|
||||
$title = get_string($type, "admin");
|
||||
|
||||
$text = $OUTPUT->pix_icon('i/' . str_replace('risk', 'risk_', $type), $alt, 'moodle', [
|
||||
'title' => $title,
|
||||
]);
|
||||
$iconurl = $OUTPUT->pix_url('i/' . str_replace('risk', 'risk_', $type));
|
||||
$text = '<img src="' . $iconurl . '" alt="' . get_string($type . 'short', 'admin') . '" />';
|
||||
$action = new popup_action('click', $this->risksurl, 'docspopup');
|
||||
$riskicon = $OUTPUT->action_link($this->risksurl, $text, $action);
|
||||
$riskicon = $OUTPUT->action_link($this->risksurl, $text, $action, array('title'=>get_string($type, 'admin')));
|
||||
|
||||
return $riskicon;
|
||||
}
|
||||
|
||||
@@ -100,8 +100,6 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
$this->role->shortname = core_text::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
|
||||
if (empty($this->role->shortname)) {
|
||||
$this->errors['shortname'] = get_string('errorbadroleshortname', 'core_role');
|
||||
} else if (core_text::strlen($this->role->shortname) > 100) { // Check if it exceeds the max of 100 characters.
|
||||
$this->errors['shortname'] = get_string('errorroleshortnametoolong', 'core_role');
|
||||
}
|
||||
}
|
||||
if ($DB->record_exists_select('role', 'shortname = ? and id <> ?', array($this->role->shortname, $this->roleid))) {
|
||||
@@ -478,7 +476,7 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
}
|
||||
|
||||
protected function get_shortname_field($id) {
|
||||
return '<input type="text" id="' . $id . '" name="' . $id . '" maxlength="100" value="' . s($this->role->shortname) . '"' .
|
||||
return '<input type="text" id="' . $id . '" name="' . $id . '" maxlength="254" value="' . s($this->role->shortname) . '"' .
|
||||
' class="form-control"/>';
|
||||
}
|
||||
|
||||
|
||||
@@ -56,24 +56,6 @@ class core_role_override_permissions_table_advanced extends core_role_capability
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds an additional class to a row if capability is other than inherited.
|
||||
*
|
||||
* @param stdClass $capability
|
||||
* @return array
|
||||
*/
|
||||
protected function get_row_attributes($capability) {
|
||||
$rowattributes = parent::get_row_attributes($capability);
|
||||
if ($this->permissions[$capability->name] !== 0) {
|
||||
if (empty($rowattributes['class'])) {
|
||||
$rowattributes['class'] = "overriddenpermission";
|
||||
} else {
|
||||
$rowattributes['class'] .= " overriddenpermission";
|
||||
}
|
||||
}
|
||||
return $rowattributes;
|
||||
}
|
||||
|
||||
protected function load_parent_permissions() {
|
||||
// Get the capabilities from the parent context, so that can be shown in the interface.
|
||||
$parentcontext = $this->context->get_parent_context();
|
||||
|
||||
@@ -93,10 +93,9 @@ class core_role_permissions_table extends core_role_capability_table_base {
|
||||
foreach ($roles as $id => $name) {
|
||||
if (isset($needed[$id])) {
|
||||
$templatecontext = array("rolename" => $name, "roleid" => $id, "action" => "prevent", "spanclass" => "allowed",
|
||||
"linkclass" => "preventlink", "adminurl" => $adminurl->out(), "icon" => "", "iconalt" => "");
|
||||
"linkclass" => "preventlink", "adminurl" => $adminurl->out(), "imageurl" => "");
|
||||
if (isset($overridableroles[$id]) and ($allowoverrides or ($allowsafeoverrides and is_safe_capability($capability)))) {
|
||||
$templatecontext['icon'] = 't/delete';
|
||||
$templatecontext['iconalt'] = get_string('delete');
|
||||
$templatecontext['imageurl'] = $renderer->pix_url('t/delete');
|
||||
}
|
||||
$neededroles[$id] = $renderer->render_from_template('core/permissionmanager_role', $templatecontext);
|
||||
}
|
||||
@@ -106,10 +105,9 @@ class core_role_permissions_table extends core_role_capability_table_base {
|
||||
if (isset($forbidden[$id]) and ($allowoverrides or ($allowsafeoverrides and is_safe_capability($capability)))) {
|
||||
$templatecontext = array("rolename" => $name, "roleid" => $id, "action" => "unprohibit",
|
||||
"spanclass" => "forbidden", "linkclass" => "unprohibitlink", "adminurl" => $adminurl->out(),
|
||||
"icon" => "", "iconalt" => "");
|
||||
"imageurl" => "");
|
||||
if (isset($overridableroles[$id]) and prohibit_is_removable($id, $context, $capability->name)) {
|
||||
$templatecontext['icon'] = 't/delete';
|
||||
$templatecontext['iconalt'] = get_string('delete');
|
||||
$templatecontext['imageurl'] = $renderer->pix_url('t/delete');
|
||||
}
|
||||
$forbiddenroles[$id] = $renderer->render_from_template('core/permissionmanager_role', $templatecontext);
|
||||
}
|
||||
|
||||
@@ -216,9 +216,9 @@ die;
|
||||
function get_action_icon($url, $icon, $alt, $tooltip) {
|
||||
global $OUTPUT;
|
||||
return '<a title="' . $tooltip . '" href="'. $url . '">' .
|
||||
$OUTPUT->pix_icon('t/' . $icon, $alt) . '</a> ';
|
||||
'<img src="' . $OUTPUT->pix_url('t/' . $icon) . '" class="iconsmall" alt="' . $alt . '" /></a> ';
|
||||
}
|
||||
function get_spacer() {
|
||||
global $OUTPUT;
|
||||
return $OUTPUT->spacer();
|
||||
return '<img src="' . $OUTPUT->pix_url('spacer') . '" class="iconsmall" alt="" /> ';
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
@core @core_admin @core_admin_roles
|
||||
Feature: Highlight non-inherited permissions
|
||||
In order that the status of capabilities can be more easily seen
|
||||
As an admin
|
||||
I need altered permissions to be highlighted
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course fullname | C_shortname |
|
||||
And I log in as "admin"
|
||||
|
||||
@javascript
|
||||
Scenario: Override a permission
|
||||
Given I am on "Course fullname" course homepage
|
||||
And I navigate to "Users > Permissions" in current page administration
|
||||
And I select "Manager (0)" from the "roleid" singleselect
|
||||
And I click on "Prohibit" "radio" in the "View added and updated modules in recent activity block" "table_row"
|
||||
And I press "Save changes"
|
||||
And I select "Manager (1)" from the "roleid" singleselect
|
||||
Then the "class" attribute of "View added and updated modules in recent activity block" "table_row" should contain "overriddenpermission"
|
||||
@@ -193,8 +193,10 @@ function print_report_tree($contextid, $contexts, $systemcontext, $fullname, $al
|
||||
$strgoto = get_string('gotoassignroles', 'core_role', $a);
|
||||
$strcheck = get_string('checkuserspermissionshere', 'core_role', $a);
|
||||
}
|
||||
echo ' <a title="' . $strgoto . '" href="' . $raurl . '">' . $OUTPUT->pix_icon('t/edit', $stredit) . '</a> ';
|
||||
echo ' <a title="' . $strcheck . '" href="' . $churl . '">' . $OUTPUT->pix_icon('t/preview', $strcheckpermissions) . '</a> ';
|
||||
echo ' <a title="' . $strgoto . '" href="' . $raurl . '"><img class="iconsmall" src="' .
|
||||
$OUTPUT->pix_url('t/edit') . '" alt="' . $stredit . '" /></a> ';
|
||||
echo ' <a title="' . $strcheck . '" href="' . $churl . '"><img class="iconsmall" src="' .
|
||||
$OUTPUT->pix_url('t/preview') . '" alt="' . $strcheckpermissions . '" /></a> ';
|
||||
echo "</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
+5
-23
@@ -5,22 +5,11 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
redirect_if_major_upgrade_required();
|
||||
|
||||
$query = trim(optional_param('query', '', PARAM_NOTAGS)); // Search string
|
||||
|
||||
$context = context_system::instance();
|
||||
$PAGE->set_context($context);
|
||||
|
||||
$hassiteconfig = has_capability('moodle/site:config', $context);
|
||||
|
||||
if ($hassiteconfig && moodle_needs_upgrading()) {
|
||||
redirect(new moodle_url('/admin/index.php'));
|
||||
}
|
||||
|
||||
// If site registration needs updating, redirect.
|
||||
\core\hub\registration::registration_reminder('/admin/search.php');
|
||||
|
||||
admin_externalpage_setup('search', '', array('query' => $query)); // now hidden page
|
||||
|
||||
$adminroot = admin_get_root(); // need all settings here
|
||||
@@ -32,16 +21,15 @@ $focus = '';
|
||||
// now we'll deal with the case that the admin has submitted the form with changed settings
|
||||
if ($data = data_submitted() and confirm_sesskey() and isset($data->action) and $data->action == 'save-settings') {
|
||||
require_capability('moodle/site:config', $context);
|
||||
$count = admin_write_settings($data);
|
||||
if (admin_write_settings($data)) {
|
||||
redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
}
|
||||
|
||||
if (!empty($adminroot->errors)) {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
$focus = $firsterror->id;
|
||||
} else {
|
||||
// No errors. Did we change any setting? If so, then redirect with success.
|
||||
if ($count) {
|
||||
redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
}
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
@@ -50,12 +38,6 @@ if ($data = data_submitted() and confirm_sesskey() and isset($data->action) and
|
||||
// to modify them
|
||||
echo $OUTPUT->header($focus);
|
||||
|
||||
// Display a warning if site is not registered.
|
||||
if (empty($query)) {
|
||||
$adminrenderer = $PAGE->get_renderer('core', 'admin');
|
||||
echo $adminrenderer->warn_if_not_registered();
|
||||
}
|
||||
|
||||
echo $OUTPUT->heading(get_string('administrationsite'));
|
||||
|
||||
if ($errormsg !== '') {
|
||||
@@ -67,7 +49,7 @@ if ($errormsg !== '') {
|
||||
|
||||
$showsettingslinks = true;
|
||||
|
||||
if ($hassiteconfig) {
|
||||
if (has_capability('moodle/site:config', $context)) {
|
||||
require_once("admin_settings_search_form.php");
|
||||
$form = new admin_settings_search_form();
|
||||
$form->display();
|
||||
|
||||
@@ -125,9 +125,6 @@ foreach ($searchareas as $area) {
|
||||
$areasconfig[$areaid]->docsprocessed . ' , ' .
|
||||
$areasconfig[$areaid]->recordsprocessed . ' , ' .
|
||||
$areasconfig[$areaid]->docsignored;
|
||||
if ($areasconfig[$areaid]->partial) {
|
||||
$laststatus .= ' ' . get_string('searchpartial', 'admin');
|
||||
}
|
||||
} else {
|
||||
$laststatus = '';
|
||||
}
|
||||
|
||||
+3
-7
@@ -39,15 +39,11 @@ $statusmsg = '';
|
||||
$errormsg = '';
|
||||
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if (admin_write_settings($data)) {
|
||||
redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
}
|
||||
|
||||
$count = admin_write_settings($data);
|
||||
// Regardless of whether any setting change was written (a positive count), check validation errors for those that didn't.
|
||||
if (empty($adminroot->errors)) {
|
||||
// No errors. Did we change any setting? If so, then redirect with success.
|
||||
if ($count) {
|
||||
redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
}
|
||||
// We didn't change a setting.
|
||||
switch ($return) {
|
||||
case 'site': redirect("$CFG->wwwroot/");
|
||||
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Adds settings links to admin tree.
|
||||
*
|
||||
* @package core_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$settings = new admin_settingpage('analyticssettings', new lang_string('analyticssettings', 'analytics'));
|
||||
$ADMIN->add('analytics', $settings);
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
// Select the site prediction's processor.
|
||||
$predictionprocessors = \core_analytics\manager::get_all_prediction_processors();
|
||||
$predictors = array();
|
||||
foreach ($predictionprocessors as $fullclassname => $predictor) {
|
||||
$pluginname = substr($fullclassname, 1, strpos($fullclassname, '\\', 1) - 1);
|
||||
$predictors[$fullclassname] = new lang_string('pluginname', $pluginname);
|
||||
}
|
||||
$settings->add(new \core_analytics\admin_setting_predictor('analytics/predictionsprocessor',
|
||||
new lang_string('predictionsprocessor', 'analytics'), new lang_string('predictionsprocessor_help', 'analytics'),
|
||||
'\mlbackend_php\processor', $predictors)
|
||||
);
|
||||
|
||||
// Log store.
|
||||
$logmanager = get_log_manager();
|
||||
$readers = $logmanager->get_readers('core\log\sql_reader');
|
||||
$options = array();
|
||||
$defaultreader = null;
|
||||
foreach ($readers as $plugin => $reader) {
|
||||
if (!$reader->is_logging()) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($defaultreader)) {
|
||||
// The top one as default reader.
|
||||
$defaultreader = $plugin;
|
||||
}
|
||||
$options[$plugin] = $reader->get_name();
|
||||
}
|
||||
|
||||
if (empty($defaultreader)) {
|
||||
// We fall here during initial site installation because log stores are not
|
||||
// enabled until admin/tool/log/db/install.php is executed and get_readers
|
||||
// return nothing.
|
||||
|
||||
if ($enabledlogstores = get_config('tool_log', 'enabled_stores')) {
|
||||
$enabledlogstores = explode(',', $enabledlogstores);
|
||||
$defaultreader = reset($enabledlogstores);
|
||||
|
||||
// No need to set the correct name, just the value, this will not be displayed.
|
||||
$options[$defaultreader] = $defaultreader;
|
||||
}
|
||||
}
|
||||
$settings->add(new admin_setting_configselect('analytics/logstore',
|
||||
new lang_string('analyticslogstore', 'analytics'), new lang_string('analyticslogstore_help', 'analytics'),
|
||||
$defaultreader, $options));
|
||||
|
||||
// Enable/disable time splitting methods.
|
||||
$alltimesplittings = \core_analytics\manager::get_all_time_splittings();
|
||||
|
||||
$timesplittingoptions = array();
|
||||
$timesplittingdefaults = array('\core\analytics\time_splitting\quarters_accum',
|
||||
'\core\analytics\time_splitting\quarters', '\core\analytics\time_splitting\single_range');
|
||||
foreach ($alltimesplittings as $key => $timesplitting) {
|
||||
$timesplittingoptions[$key] = $timesplitting->get_name();
|
||||
}
|
||||
$settings->add(new admin_setting_configmultiselect('analytics/timesplittings',
|
||||
new lang_string('enabledtimesplittings', 'analytics'), new lang_string('timesplittingmethod_help', 'analytics'),
|
||||
$timesplittingdefaults, $timesplittingoptions)
|
||||
);
|
||||
|
||||
// Predictions processor output dir.
|
||||
$defaultmodeloutputdir = rtrim($CFG->dataroot, '/') . DIRECTORY_SEPARATOR . 'models';
|
||||
if (empty(get_config('analytics', 'modeloutputdir')) && !file_exists($defaultmodeloutputdir) &&
|
||||
is_writable($defaultmodeloutputdir)) {
|
||||
// Automatically create the dir for them so users don't see the invalid value red cross.
|
||||
mkdir($defaultmodeloutputdir, $CFG->directorypermissions, true);
|
||||
}
|
||||
$settings->add(new admin_setting_configdirectory('analytics/modeloutputdir', new lang_string('modeloutputdir', 'analytics'),
|
||||
new lang_string('modeloutputdirinfo', 'analytics'), $defaultmodeloutputdir));
|
||||
|
||||
// Disable web interface evaluation and get predictions.
|
||||
$settings->add(new admin_setting_configcheckbox('analytics/onlycli', new lang_string('onlycli', 'analytics'),
|
||||
new lang_string('onlycliinfo', 'analytics'), 1));
|
||||
|
||||
// Training and prediction time limit per model.
|
||||
$settings->add(new admin_setting_configduration('analytics/modeltimelimit', new lang_string('modeltimelimit', 'analytics'),
|
||||
new lang_string('modeltimelimitinfo', 'analytics'), 20 * MINSECS));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -179,11 +179,10 @@ preferences,moodle|/user/preferences.php|preferences',
|
||||
'idnumber' => new lang_string('sort_idnumber', 'admin'),
|
||||
);
|
||||
$temp->add(new admin_setting_configselect('navsortmycoursessort', new lang_string('navsortmycoursessort', 'admin'), new lang_string('navsortmycoursessort_help', 'admin'), 'sortorder', $sortoptions));
|
||||
$temp->add(new admin_setting_configtext('navcourselimit', new lang_string('navcourselimit', 'admin'),
|
||||
new lang_string('confignavcourselimit', 'admin'), 10, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('linkcoursesections', new lang_string('linkcoursesections', 'admin'), new lang_string('linkcoursesections_help', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('linkcoursesections', new lang_string('linkcoursesections', 'admin'), new lang_string('linkcoursesections_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('navshowfrontpagemods', new lang_string('navshowfrontpagemods', 'admin'), new lang_string('navshowfrontpagemods_help', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('navadduserpostslinks', new lang_string('navadduserpostslinks', 'admin'), new lang_string('navadduserpostslinks_help', 'admin'), 1));
|
||||
|
||||
|
||||
+1
-105
@@ -92,9 +92,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'),
|
||||
new lang_string('coursedisplay_help'), COURSE_DISPLAY_SINGLEPAGE, $choices));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('moodlecourse/courseenddateenabled', get_string('courseenddateenabled'),
|
||||
get_string('courseenddateenabled_desc'), 1));
|
||||
|
||||
$temp->add(new admin_setting_configduration('moodlecourse/courseduration', get_string('courseduration'),
|
||||
get_string('courseduration_desc'), YEARSECS));
|
||||
|
||||
@@ -136,7 +133,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
// Completion tracking.
|
||||
$temp->add(new admin_setting_heading('progress', new lang_string('completion','completion'), ''));
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', new lang_string('completion', 'completion'),
|
||||
new lang_string('enablecompletion_help', 'completion'), 1, array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
|
||||
new lang_string('enablecompletion_help', 'completion'), 0, array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
|
||||
|
||||
// Groups.
|
||||
$temp->add(new admin_setting_heading('groups', new lang_string('groups', 'group'), ''));
|
||||
@@ -346,105 +343,4 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blogs', new lang_string('blogs', 'blog'), new lang_string('backupblogshelp','blog'), 0));
|
||||
|
||||
$ADMIN->add('backups', $temp);
|
||||
|
||||
// Create a page for general restore configuration and defaults.
|
||||
$temp = new admin_settingpage('restoregeneralsettings', new lang_string('generalrestoredefaults', 'backup'));
|
||||
|
||||
// General restore defaults.
|
||||
$temp->add(new admin_setting_heading('generalsettings', new lang_string('generalrestoresettings', 'backup'), ''));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_users',
|
||||
new lang_string('generalusers', 'backup'), new lang_string('configrestoreusers', 'backup'),
|
||||
array('value' => 1, 'locked' => 0)));
|
||||
// Can not use actual constants here because we'd need to include 100 of backup/restore files.
|
||||
$options = [
|
||||
0/*backup::ENROL_NEVER*/ => get_string('rootsettingenrolments_never', 'backup'),
|
||||
1/*backup::ENROL_WITHUSERS*/ => get_string('rootsettingenrolments_withusers', 'backup'),
|
||||
2/*backup::ENROL_ALWAYS*/ => get_string('rootsettingenrolments_always', 'backup'),
|
||||
];
|
||||
$temp->add(new admin_setting_configselect_with_lock('restore/restore_general_enrolments',
|
||||
new lang_string('generalenrolments', 'backup'), new lang_string('configrestoreenrolments', 'backup'),
|
||||
array('value' => 1/*backup::ENROL_WITHUSERS*/, 'locked' => 0), $options));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_role_assignments',
|
||||
new lang_string('generalroleassignments', 'backup'),
|
||||
new lang_string('configrestoreroleassignments', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_activities',
|
||||
new lang_string('generalactivities', 'backup'),
|
||||
new lang_string('configrestoreactivities', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_blocks',
|
||||
new lang_string('generalblocks', 'backup'),
|
||||
new lang_string('configrestoreblocks', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_filters',
|
||||
new lang_string('generalfilters', 'backup'),
|
||||
new lang_string('configrestorefilters', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_comments',
|
||||
new lang_string('generalcomments', 'backup'),
|
||||
new lang_string('configrestorecomments', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_badges',
|
||||
new lang_string('generalbadges', 'backup'),
|
||||
new lang_string('configrestorebadges', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_calendarevents',
|
||||
new lang_string('generalcalendarevents', 'backup'),
|
||||
new lang_string('configrestorecalendarevents', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_userscompletion',
|
||||
new lang_string('generaluserscompletion', 'backup'),
|
||||
new lang_string('configrestoreuserscompletion', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_logs',
|
||||
new lang_string('generallogs', 'backup'),
|
||||
new lang_string('configrestorelogs', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_histories',
|
||||
new lang_string('generalhistories', 'backup'),
|
||||
new lang_string('configrestorehistories', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_groups',
|
||||
new lang_string('generalgroups', 'backup'), new lang_string('configrestoregroups', 'backup'),
|
||||
array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_competencies',
|
||||
new lang_string('generalcompetencies', 'backup'),
|
||||
new lang_string('configrestorecompetencies', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
|
||||
// Restore defaults when merging into another course.
|
||||
$temp->add(new admin_setting_heading('mergerestoredefaults', new lang_string('mergerestoredefaults', 'backup'), ''));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_merge_overwrite_conf',
|
||||
new lang_string('setting_overwrite_conf', 'backup'),
|
||||
new lang_string('config_overwrite_conf', 'backup'), array('value' => 0, 'locked' => 0)));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_merge_course_fullname',
|
||||
new lang_string('setting_overwrite_course_fullname', 'backup'),
|
||||
new lang_string('config_overwrite_course_fullname', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_merge_course_shortname',
|
||||
new lang_string('setting_overwrite_course_shortname', 'backup'),
|
||||
new lang_string('config_overwrite_course_shortname', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_merge_course_startdate',
|
||||
new lang_string('setting_overwrite_course_startdate', 'backup'),
|
||||
new lang_string('config_overwrite_course_startdate', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
|
||||
// Restore defaults when replacing course contents.
|
||||
$temp->add(new admin_setting_heading('replacerestoredefaults', new lang_string('replacerestoredefaults', 'backup'), ''));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_replace_overwrite_conf',
|
||||
new lang_string('setting_overwrite_conf', 'backup'),
|
||||
new lang_string('config_overwrite_conf', 'backup'), array('value' => 0, 'locked' => 0)));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_replace_course_fullname',
|
||||
new lang_string('setting_overwrite_course_fullname', 'backup'),
|
||||
new lang_string('config_overwrite_course_fullname', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_replace_course_shortname',
|
||||
new lang_string('setting_overwrite_course_shortname', 'backup'),
|
||||
new lang_string('config_overwrite_course_shortname', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_replace_course_startdate',
|
||||
new lang_string('setting_overwrite_course_startdate', 'backup'),
|
||||
new lang_string('config_overwrite_course_startdate', 'backup'), array('value' => 1, 'locked' => 0)));
|
||||
|
||||
$temp->add(new admin_setting_configselect_with_lock('restore/restore_replace_keep_roles_and_enrolments',
|
||||
new lang_string('setting_keep_roles_and_enrolments', 'backup'),
|
||||
new lang_string('config_keep_roles_and_enrolments', 'backup'), array('value' => 0, 'locked' => 0),
|
||||
array(1 => get_string('yes'), 0 => get_string('no'))));
|
||||
$temp->add(new admin_setting_configselect_with_lock('restore/restore_replace_keep_groups_and_groupings',
|
||||
new lang_string('setting_keep_groups_and_groupings', 'backup'),
|
||||
new lang_string('config_keep_groups_and_groupings', 'backup'), array('value' => 0, 'locked' => 0),
|
||||
array(1 => get_string('yes'), 0 => get_string('no'))));
|
||||
|
||||
$ADMIN->add('backups', $temp);
|
||||
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ if ($hassiteconfig) {
|
||||
$temp->add(new admin_setting_configtext('alternateloginurl', new lang_string('alternateloginurl', 'auth'),
|
||||
new lang_string('alternatelogin', 'auth', htmlspecialchars(get_login_url())), ''));
|
||||
$temp->add(new admin_setting_configtext('forgottenpasswordurl', new lang_string('forgottenpasswordurl', 'auth'),
|
||||
new lang_string('forgottenpassword', 'auth'), '', PARAM_URL));
|
||||
new lang_string('forgottenpassword', 'auth'), ''));
|
||||
$temp->add(new admin_setting_confightmleditor('auth_instructions', new lang_string('instructions', 'auth'),
|
||||
new lang_string('authinstructions', 'auth'), ''));
|
||||
$setting = new admin_setting_configtext('allowemailaddresses', new lang_string('allowemailaddresses', 'admin'),
|
||||
@@ -230,19 +230,6 @@ if ($hassiteconfig) {
|
||||
300, PARAM_INT, 10));
|
||||
$ADMIN->add('mediaplayers', $temp);
|
||||
|
||||
// Convert plugins.
|
||||
$ADMIN->add('modules', new admin_category('fileconverterplugins', new lang_string('type_fileconverter_plural', 'plugin')));
|
||||
$temp = new admin_settingpage('managefileconverterplugins', new lang_string('type_fileconvertermanage', 'plugin'));
|
||||
$temp->add(new admin_setting_manage_fileconverter_plugins());
|
||||
$ADMIN->add('fileconverterplugins', $temp);
|
||||
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('fileconverter');
|
||||
core_collator::asort_objects_by_property($plugins, 'displayname');
|
||||
foreach ($plugins as $plugin) {
|
||||
/** @var \core\plugininfo\media $plugin */
|
||||
$plugin->load_settings($ADMIN, 'fileconverterplugins', $hassiteconfig);
|
||||
}
|
||||
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('media');
|
||||
core_collator::asort_objects_by_property($plugins, 'displayname');
|
||||
foreach ($plugins as $plugin) {
|
||||
@@ -557,21 +544,6 @@ if ($hassiteconfig) {
|
||||
$temp->add(new admin_setting_heading('searchengineheading', new lang_string('searchengine', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configselect('searchengine',
|
||||
new lang_string('selectsearchengine', 'admin'), '', 'solr', $engines));
|
||||
$temp->add(new admin_setting_heading('searchoptionsheading', new lang_string('searchoptions', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configcheckbox('searchindexwhendisabled',
|
||||
new lang_string('searchindexwhendisabled', 'admin'), new lang_string('searchindexwhendisabled_desc', 'admin'),
|
||||
0));
|
||||
$temp->add(new admin_setting_configduration('searchindextime',
|
||||
new lang_string('searchindextime', 'admin'), new lang_string('searchindextime_desc', 'admin'),
|
||||
600));
|
||||
$options = [
|
||||
0 => new lang_string('searchallavailablecourses_off', 'admin'),
|
||||
1 => new lang_string('searchallavailablecourses_on', 'admin')
|
||||
];
|
||||
$temp->add(new admin_setting_configselect('searchallavailablecourses',
|
||||
new lang_string('searchallavailablecourses', 'admin'),
|
||||
new lang_string('searchallavailablecourses_desc', 'admin'),
|
||||
0, $options));
|
||||
|
||||
$ADMIN->add('searchplugins', $temp);
|
||||
$ADMIN->add('searchplugins', new admin_externalpage('searchareas', new lang_string('searchareas', 'admin'),
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Adds privacy and policies links to admin tree.
|
||||
*
|
||||
* @package core_privacy
|
||||
* @copyright 2018 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($hassiteconfig) {
|
||||
// Privacy settings.
|
||||
$temp = new admin_settingpage('privacysettings', new lang_string('privacysettings', 'admin'));
|
||||
|
||||
$options = array(
|
||||
0 => get_string('no'),
|
||||
1 => get_string('yes')
|
||||
);
|
||||
$url = new moodle_url('/admin/settings.php?section=supportcontact');
|
||||
$url = $url->out();
|
||||
$setting = new admin_setting_configselect('agedigitalconsentverification',
|
||||
new lang_string('agedigitalconsentverification', 'admin'),
|
||||
new lang_string('agedigitalconsentverification_desc', 'admin', $url), 0, $options);
|
||||
$setting->set_force_ltr(true);
|
||||
$temp->add($setting);
|
||||
|
||||
$setting = new admin_setting_agedigitalconsentmap('agedigitalconsentmap',
|
||||
new lang_string('ageofdigitalconsentmap', 'admin'),
|
||||
new lang_string('ageofdigitalconsentmap_desc', 'admin'),
|
||||
// See {@link https://gdpr-info.eu/art-8-gdpr/}.
|
||||
implode(PHP_EOL, [
|
||||
'*, 16',
|
||||
'AT, 14',
|
||||
'CZ, 13',
|
||||
'DE, 14',
|
||||
'DK, 13',
|
||||
'ES, 13',
|
||||
'FI, 15',
|
||||
'GB, 13',
|
||||
'HU, 14',
|
||||
'IE, 13',
|
||||
'LT, 16',
|
||||
'LU, 16',
|
||||
'NL, 16',
|
||||
'PL, 13',
|
||||
'SE, 13',
|
||||
]),
|
||||
PARAM_RAW
|
||||
);
|
||||
$temp->add($setting);
|
||||
|
||||
$ADMIN->add('privacy', $temp);
|
||||
|
||||
// Policy settings.
|
||||
$temp = new admin_settingpage('policysettings', new lang_string('policysettings', 'admin'));
|
||||
$temp->add(new admin_settings_sitepolicy_handler_select('sitepolicyhandler', new lang_string('sitepolicyhandler', 'core_admin'),
|
||||
new lang_string('sitepolicyhandler_desc', 'core_admin')));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', new lang_string('sitepolicy', 'core_admin'),
|
||||
new lang_string('sitepolicy_help', 'core_admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('sitepolicyguest', new lang_string('sitepolicyguest', 'core_admin'),
|
||||
new lang_string('sitepolicyguest_help', 'core_admin'), (isset($CFG->sitepolicy) ? $CFG->sitepolicy : ''), PARAM_RAW));
|
||||
|
||||
$ADMIN->add('privacy', $temp);
|
||||
}
|
||||
@@ -18,11 +18,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', new lang_string('forceloginforprofiles', 'admin'), new lang_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', new lang_string('forceloginforprofileimage', 'admin'), new lang_string('forceloginforprofileimage_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('opentogoogle', new lang_string('opentogoogle', 'admin'), new lang_string('configopentogoogle', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('allowindexing', new lang_string('allowindexing', 'admin'), new lang_string('allowindexing_desc', 'admin'),
|
||||
0,
|
||||
array(0 => new lang_string('allowindexingexceptlogin', 'admin'),
|
||||
1 => new lang_string('allowindexingeverywhere', 'admin'),
|
||||
2 => new lang_string('allowindexingnowhere', 'admin'))));
|
||||
$temp->add(new admin_setting_pickroles('profileroles',
|
||||
new lang_string('profileroles','admin'),
|
||||
new lang_string('configprofileroles', 'admin'),
|
||||
@@ -54,7 +49,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
3600 => new lang_string('numminutes', '', 60))));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', new lang_string('extendedusernamechars', 'admin'), new lang_string('configextendedusernamechars', 'admin'), 0));
|
||||
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', new lang_string('sitepolicy', 'admin'), new lang_string('sitepolicy_help', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('sitepolicyguest', new lang_string('sitepolicyguest', 'admin'), new lang_string('sitepolicyguest_help', 'admin'), (isset($CFG->sitepolicy) ? $CFG->sitepolicy : ''), PARAM_RAW));
|
||||
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', new lang_string('extendedusernamechars', 'admin'), new lang_string('configextendedusernamechars', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('keeptagnamecase', new lang_string('keeptagnamecase','admin'),new lang_string('configkeeptagnamecase', 'admin'),'1'));
|
||||
|
||||
@@ -63,8 +59,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', new lang_string('cronclionly', 'admin'), new lang_string
|
||||
('configcronclionly', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', new lang_string('cronremotepassword', 'admin'), new lang_string('configcronremotepassword', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configcheckbox('tool_task/enablerunnow', new lang_string('enablerunnow', 'tool_task'),
|
||||
new lang_string('enablerunnow_desc', 'tool_task'), 1));
|
||||
|
||||
$options = array(0=>get_string('no'), 3=>3, 5=>5, 7=>7, 10=>10, 20=>20, 30=>30, 50=>50, 100=>100);
|
||||
$temp->add(new admin_setting_configselect('lockoutthreshold', new lang_string('lockoutthreshold', 'admin'), new lang_string('lockoutthreshold_desc', 'admin'), 0, $options));
|
||||
@@ -107,10 +101,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
new lang_string('passwordchangetokendeletion', 'admin'),
|
||||
new lang_string('passwordchangetokendeletion_desc', 'admin'), 0));
|
||||
|
||||
$temp->add(new admin_setting_configduration('tokenduration',
|
||||
new lang_string('tokenduration', 'admin'),
|
||||
new lang_string('tokenduration_desc', 'admin'), 12 * WEEKSECS, WEEKSECS));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('groupenrolmentkeypolicy', new lang_string('groupenrolmentkeypolicy', 'admin'), new lang_string('groupenrolmentkeypolicy_desc', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('disableuserimages', new lang_string('disableuserimages', 'admin'), new lang_string('configdisableuserimages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', new lang_string('emailchangeconfirmation', 'admin'), new lang_string('configemailchangeconfirmation', 'admin'), 1));
|
||||
@@ -123,10 +113,11 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
// "httpsecurity" settingpage
|
||||
$temp = new admin_settingpage('httpsecurity', new lang_string('httpsecurity', 'admin'));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('loginhttps', new lang_string('loginhttps', 'admin'), new lang_string('configloginhttps', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiesecure', new lang_string('cookiesecure', 'admin'), new lang_string('configcookiesecure', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiehttponly', new lang_string('cookiehttponly', 'admin'), new lang_string('configcookiehttponly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowframembedding', new lang_string('allowframembedding', 'admin'), new lang_string('allowframembedding_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', new lang_string('loginpasswordautocomplete', 'admin'), new lang_string('loginpasswordautocomplete_help', 'admin'), 0));
|
||||
|
||||
// Settings elements used by the \core\files\curl_security_helper class.
|
||||
$temp->add(new admin_setting_configmixedhostiplist('curlsecurityblockedhosts',
|
||||
|
||||
@@ -12,8 +12,7 @@ $temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('patht
|
||||
$temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'), new lang_string('edhelpaspellpath'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'), new lang_string('pathtodot_help', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'), new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
|
||||
$temp->add(new admin_setting_configexecutable('pathtopython', new lang_string('pathtopython', 'admin'),
|
||||
new lang_string('pathtopythondesc', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtounoconv', new lang_string('pathtounoconv', 'admin'), new lang_string('pathtounoconv_help', 'admin'), '/usr/bin/unoconv'));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
@@ -211,6 +210,9 @@ $temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
$ADMIN->add('server', new admin_externalpage('adminregistration', new lang_string('hubs', 'admin'),
|
||||
"$CFG->wwwroot/$CFG->admin/registration/index.php"));
|
||||
|
||||
// E-mail settings.
|
||||
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
|
||||
|
||||
|
||||
@@ -54,7 +54,4 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enableglobalsearch', new lang_string('enableglobalsearch', 'admin'),
|
||||
new lang_string('enableglobalsearch_desc', 'admin'), 0, 1, 0));
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('allowstealth', new lang_string('allowstealthmodules'),
|
||||
new lang_string('allowstealthmodules_help'), 0, 1, 0));
|
||||
}
|
||||
|
||||
@@ -11,7 +11,14 @@ $hassiteconfig = has_capability('moodle/site:config', $systemcontext);
|
||||
$ADMIN->add('root', new admin_externalpage('adminnotifications', new lang_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php"));
|
||||
|
||||
$ADMIN->add('root', new admin_externalpage('registrationmoodleorg', new lang_string('registration', 'admin'),
|
||||
new moodle_url("/admin/registration/index.php")));
|
||||
"$CFG->wwwroot/$CFG->admin/registration/register.php?huburl=" . HUB_MOODLEORGHUBURL . "&hubname=Moodle.org&sesskey=" . sesskey()));
|
||||
$ADMIN->add('root', new admin_externalpage('registrationhub', new lang_string('registerwith', 'hub'),
|
||||
"$CFG->wwwroot/$CFG->admin/registration/register.php", 'moodle/site:config', true));
|
||||
$ADMIN->add('root', new admin_externalpage('registrationhubs', new lang_string('hubs', 'admin'),
|
||||
"$CFG->wwwroot/$CFG->admin/registration/index.php", 'moodle/site:config', true));
|
||||
$ADMIN->add('root', new admin_externalpage('siteregistrationconfirmed',
|
||||
new lang_string('registrationconfirmed', 'hub'),
|
||||
$CFG->wwwroot."/".$CFG->admin."/registration/confirmregistration.php", 'moodle/site:config', true));
|
||||
// hidden upgrade script
|
||||
$ADMIN->add('root', new admin_externalpage('upgradesettings', new lang_string('upgradesettings', 'admin'), "$CFG->wwwroot/$CFG->admin/upgradesettings.php", 'moodle/site:config', true));
|
||||
|
||||
@@ -23,13 +30,11 @@ if ($hassiteconfig) {
|
||||
$ADMIN->add('root', new admin_category('users', new lang_string('users','admin')));
|
||||
$ADMIN->add('root', new admin_category('courses', new lang_string('courses','admin')));
|
||||
$ADMIN->add('root', new admin_category('grades', new lang_string('grades')));
|
||||
$ADMIN->add('root', new admin_category('analytics', new lang_string('analytics', 'analytics')));
|
||||
$ADMIN->add('root', new admin_category('competencies', new lang_string('competencies', 'core_competency')));
|
||||
$ADMIN->add('root', new admin_category('badges', new lang_string('badges'), empty($CFG->enablebadges)));
|
||||
$ADMIN->add('root', new admin_category('location', new lang_string('location','admin')));
|
||||
$ADMIN->add('root', new admin_category('language', new lang_string('language')));
|
||||
$ADMIN->add('root', new admin_category('modules', new lang_string('plugins', 'admin')));
|
||||
$ADMIN->add('root', new admin_category('privacy', new lang_string('privacyandpolicies', 'admin')));
|
||||
$ADMIN->add('root', new admin_category('security', new lang_string('security','admin')));
|
||||
$ADMIN->add('root', new admin_category('appearance', new lang_string('appearance','admin')));
|
||||
$ADMIN->add('root', new admin_category('frontpage', new lang_string('frontpage','admin')));
|
||||
|
||||
@@ -15,10 +15,15 @@ if ($hassiteconfig
|
||||
or has_capability('moodle/cohort:view', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
// stuff under the "accounts" subcategory
|
||||
$ADMIN->add('accounts', new admin_externalpage('editusers', new lang_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('userbulk', new lang_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$CFG->wwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
|
||||
|
||||
// "User default preferences" settingpage.
|
||||
$temp = new admin_settingpage('userdefaultpreferences', new lang_string('userdefaultpreferences', 'admin'));
|
||||
@@ -184,8 +189,6 @@ if ($hassiteconfig
|
||||
'phone2' => new lang_string('phone2'),
|
||||
'department' => new lang_string('department'),
|
||||
'institution' => new lang_string('institution'),
|
||||
'city' => new lang_string('city'),
|
||||
'country' => new lang_string('country'),
|
||||
)));
|
||||
$setting = new admin_setting_configtext('fullnamedisplay', new lang_string('fullnamedisplay', 'admin'),
|
||||
new lang_string('configfullnamedisplay', 'admin'), 'language', PARAM_TEXT, 50);
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
{{!
|
||||
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/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_admin/setting_configmultiselect_optgroup
|
||||
|
||||
Admin multiselect setting template with optgroup support.
|
||||
|
||||
Context variables required for this template:
|
||||
* name - form element name
|
||||
* id - element id
|
||||
* size - element size
|
||||
* options - list of options not grouped
|
||||
* optgroups - list of options grouped containing the group label and for each option: name, value, selected
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"name": "test",
|
||||
"id": "test0",
|
||||
"size": "3",
|
||||
"options": [
|
||||
{ "name": "Option 1", "value": "V", "selected": false },
|
||||
{ "name": "Option 2", "value": "V", "selected": true }
|
||||
],
|
||||
"optgroups": [
|
||||
{
|
||||
"label": "Group 1",
|
||||
"options": [
|
||||
{ "name": "Option 3", "value": "V", "selected": false },
|
||||
{ "name": "Option 4", "value": "V", "selected": true }
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Group 2",
|
||||
"options": [
|
||||
{ "name": "Option 5", "value": "V", "selected": false },
|
||||
{ "name": "Option 6", "value": "V", "selected": true }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}}
|
||||
<div class="form-select">
|
||||
<input type="hidden" name="{{name}}[xxxxx]" value="1">
|
||||
<select id="{{id}}" name="{{name}}[]" size="{{size}}" multiple>
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
{{#optgroups}}
|
||||
<optgroup label="{{label}}">
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
</optgroup>
|
||||
{{/optgroups}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
{{!
|
||||
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/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_admin/setting_configselect_optgroup
|
||||
|
||||
Admin select with optgroup setting template.
|
||||
|
||||
Context variables required for this template:
|
||||
* name - form element name
|
||||
* id - element id
|
||||
* options - list of options (not grouped)
|
||||
* optgroups - list of options grouped containing the group label and for each option: name, value, selected
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"name": "test",
|
||||
"id": "test0",
|
||||
"options": [
|
||||
{ "name": "Option 1", "value": "V", "selected": false },
|
||||
{ "name": "Option 2", "value": "V", "selected": false }
|
||||
],
|
||||
"optgroups": [
|
||||
{
|
||||
"label": "Group 1",
|
||||
"options": [
|
||||
{ "name": "Option 3", "value": "V", "selected": true },
|
||||
{ "name": "Option 4", "value": "V", "selected": false }
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Group 2",
|
||||
"options": [
|
||||
{ "name": "Option 5", "value": "V", "selected": false },
|
||||
{ "name": "Option 6", "value": "V", "selected": false }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}}
|
||||
<div class="form-select defaultsnext">
|
||||
<select id="{{id}}" name="{{name}}">
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
{{#optgroups}}
|
||||
<optgroup label="{{label}}">
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
</optgroup>
|
||||
{{/optgroups}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
{{!
|
||||
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/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_admin/setting_filetypes
|
||||
|
||||
Renders the admin_setting_filetypes setting element.
|
||||
|
||||
Context variables required for this template:
|
||||
* id - element id
|
||||
* name - form element name
|
||||
* value - element value
|
||||
* descriptions - data for the core_form/filetypes-descriptions template
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"id": "test0",
|
||||
"name": "test",
|
||||
"value": ".jpg,.gif",
|
||||
"descriptions": {
|
||||
"hasdescriptions": true,
|
||||
"descriptions": [
|
||||
{
|
||||
"description": "Image (JPEG)",
|
||||
"extensions": ".jpeg .jpe .jpg"
|
||||
},
|
||||
{
|
||||
"description": "Image (GIF)",
|
||||
"extensions": ".gif"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div class="form-text defaultsnext">
|
||||
<input type="text" name="{{name}}" value="{{value}}" size="30" id="{{id}}" class="text-ltr">
|
||||
<span data-filetypesbrowser="{{id}}"></span>
|
||||
<div data-filetypesdescriptions="{{id}}">{{#descriptions}}{{>core_form/filetypes-descriptions}}{{/descriptions}}</div>
|
||||
</div>
|
||||
@@ -1,65 +0,0 @@
|
||||
<table class="admintable generaltable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="header">{{#str}}name, moodle{{/str}}</th>
|
||||
{{#infocolumnname}}
|
||||
<th class="header">{{infocolumnname}}</th>
|
||||
{{/infocolumnname}}
|
||||
<th class="header">{{#str}}order, moodle{{/str}}</th>
|
||||
<th class="header">{{#str}}isenabled, plugin{{/str}}</th>
|
||||
<th class="header">{{#str}}settings, moodle{{/str}}</th>
|
||||
<th class="header">{{#str}}uninstall, plugin{{/str}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#plugins}}
|
||||
<tr>
|
||||
<td>{{plugin}}</td>
|
||||
{{#infocolumnname}}
|
||||
<td>
|
||||
{{info}}
|
||||
</td>
|
||||
{{/infocolumnname}}
|
||||
<td class="text-nowrap">
|
||||
{{#moveuplink}}
|
||||
<a href="{{{moveuplink}}}">
|
||||
{{#pix}}t/up, moodle, {{#str}} up, moodle {{/str}}{{/pix}}
|
||||
</a>
|
||||
{{/moveuplink}}
|
||||
{{^moveuplink}}
|
||||
{{#pix}}spacer, moodle{{/pix}}
|
||||
{{/moveuplink}}
|
||||
|
||||
{{#movedownlink}}
|
||||
<a href="{{{movedownlink}}}">
|
||||
{{#pix}}t/down, moodle, {{#str}} down, moodle {{/str}}{{/pix}}
|
||||
</a>
|
||||
{{/movedownlink}}
|
||||
{{^movedownlink}}
|
||||
{{#pix}}spacer, moodle{{/pix}}
|
||||
{{/movedownlink}}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{{togglelink}}}">
|
||||
{{#toggletarget}}
|
||||
{{#pix}}i/show, moodle, {{#str}} enable, moodle {{/str}}{{/pix}}
|
||||
{{/toggletarget}}
|
||||
{{^toggletarget}}
|
||||
{{#pix}}i/hide, moodle, {{#str}} disable, moodle {{/str}}{{/pix}}
|
||||
{{/toggletarget}}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{#settingslink}}
|
||||
<a href="{{{settingslink}}}">{{#str}}settings,plugin{{/str}}</a>
|
||||
{{/settingslink}}
|
||||
</td>
|
||||
<td>
|
||||
{{#uninstalllink}}
|
||||
<a href="{{{uninstalllink}}}">{{#str}}uninstall,plugin{{/str}}</a>
|
||||
{{/uninstalllink}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/plugins}}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1,26 +0,0 @@
|
||||
@core @core_admin
|
||||
Feature: Manage tokens
|
||||
In order to manage webservice usage
|
||||
As an admin
|
||||
I need to be able to create and delete tokens
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname |
|
||||
| testuser | testuser | Joe | Bloggs |
|
||||
| testuser2 | testuser2 | TestFirstname | TestLastname |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
|
||||
@javascript
|
||||
Scenario: Add & delete a token
|
||||
Given I navigate to "Plugins > Web services > Manage tokens" in site administration
|
||||
And I follow "Add"
|
||||
And I set the field "User" to "Joe Bloggs"
|
||||
And I set the field "IP restriction" to "127.0.0.1"
|
||||
When I press "Save changes"
|
||||
Then I should see "Joe Bloggs"
|
||||
And I should see "127.0.0.1"
|
||||
And I follow "Delete"
|
||||
And I press "Delete"
|
||||
And I should not see "Joe Bloggs"
|
||||
@@ -1 +0,0 @@
|
||||
define(["jquery","core/str","core/modal_factory","core/notification"],function(a,b,c,d){return{loadInfo:function(e,f){var g=a('[data-model-log-id="'+e+'"]');b.get_string("loginfo","tool_analytics").then(function(b){var d=a("<ul>");return f.forEach(function(a){d.append("<li>"+a+"</li>")}),d.append("</ul>"),c.create({title:b,body:d.html(),large:!0},g)})["catch"](d.exception)}}});
|
||||
-1
@@ -1 +0,0 @@
|
||||
define(["jquery","core/str","core/log","core/notification","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={clear:{title:{key:"clearpredictions",component:"tool_analytics"},body:{key:"clearmodelpredictions",component:"tool_analytics"}}},h=function(b){return a(b.closest("tr")[0]).find("span.target-name").text()};return{confirmAction:function(i,j){a('[data-action-id="'+i+'"]').on("click",function(i){i.preventDefault();var k=a(i.currentTarget);if("undefined"==typeof g[j])return void c.error('Action "'+j+'" is not allowed.');var l=[g[j].title,g[j].body];l[1].param=h(k);var m=b.get_strings(l),n=e.create({type:e.types.SAVE_CANCEL});a.when(m,n).then(function(a,b){return b.setTitle(a[0]),b.setBody(a[1]),b.setSaveButtonText(a[0]),b.getRoot().on(f.save,function(){window.location.href=k.attr("href")}),b.show(),b}).fail(d.exception)})}}});
|
||||
@@ -1,56 +0,0 @@
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* Shows a dialogue with info about this logs.
|
||||
*
|
||||
* @module tool_analytics/log_info
|
||||
* @class log_info
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, str, ModalFactory, Notification) {
|
||||
|
||||
return /** @alias module:tool_analytics/log_info */ {
|
||||
|
||||
/**
|
||||
* Prepares a modal info for a log's results.
|
||||
*
|
||||
* @method loadInfo
|
||||
* @param {int} id
|
||||
* @param {string[]} info
|
||||
*/
|
||||
loadInfo: function(id, info) {
|
||||
|
||||
var link = $('[data-model-log-id="' + id + '"]');
|
||||
str.get_string('loginfo', 'tool_analytics').then(function(langString) {
|
||||
|
||||
var bodyInfo = $("<ul>");
|
||||
info.forEach(function(item) {
|
||||
bodyInfo.append('<li>' + item + '</li>');
|
||||
});
|
||||
bodyInfo.append("</ul>");
|
||||
|
||||
return ModalFactory.create({
|
||||
title: langString,
|
||||
body: bodyInfo.html(),
|
||||
large: true,
|
||||
}, link);
|
||||
|
||||
}).catch(Notification.exception);
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -1,94 +0,0 @@
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* AMD module for model actions confirmation.
|
||||
*
|
||||
* @module tool_analytics/model
|
||||
* @copyright 2017 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery', 'core/str', 'core/log', 'core/notification', 'core/modal_factory', 'core/modal_events'],
|
||||
function($, Str, log, Notification, ModalFactory, ModalEvents) {
|
||||
|
||||
/**
|
||||
* List of actions that require confirmation and confirmation message.
|
||||
*/
|
||||
var actionsList = {
|
||||
clear: {
|
||||
title: {
|
||||
key: 'clearpredictions',
|
||||
component: 'tool_analytics'
|
||||
}, body: {
|
||||
key: 'clearmodelpredictions',
|
||||
component: 'tool_analytics'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the model name.
|
||||
*
|
||||
* @param {Object} actionItem The action item DOM node.
|
||||
* @return {String}
|
||||
*/
|
||||
var getModelName = function(actionItem) {
|
||||
return $(actionItem.closest('tr')[0]).find('span.target-name').text();
|
||||
};
|
||||
|
||||
/** @alias module:tool_analytics/model */
|
||||
return {
|
||||
|
||||
/**
|
||||
* Displays a confirm modal window before executing the action.
|
||||
*
|
||||
* @param {String} actionId
|
||||
* @param {String} actionType
|
||||
*/
|
||||
confirmAction: function(actionId, actionType) {
|
||||
$('[data-action-id="' + actionId + '"]').on('click', function(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
var a = $(ev.currentTarget);
|
||||
|
||||
if (typeof actionsList[actionType] === "undefined") {
|
||||
log.error('Action "' + actionType + '" is not allowed.');
|
||||
return;
|
||||
}
|
||||
|
||||
var reqStrings = [
|
||||
actionsList[actionType].title,
|
||||
actionsList[actionType].body
|
||||
];
|
||||
reqStrings[1].param = getModelName(a);
|
||||
|
||||
var stringsPromise = Str.get_strings(reqStrings);
|
||||
var modalPromise = ModalFactory.create({type: ModalFactory.types.SAVE_CANCEL});
|
||||
|
||||
$.when(stringsPromise, modalPromise).then(function(strings, modal) {
|
||||
modal.setTitle(strings[0]);
|
||||
modal.setBody(strings[1]);
|
||||
modal.setSaveButtonText(strings[0]);
|
||||
modal.getRoot().on(ModalEvents.save, function() {
|
||||
window.location.href = a.attr('href');
|
||||
});
|
||||
modal.show();
|
||||
return modal;
|
||||
}).fail(Notification.exception);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -1,119 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Model edit form.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_analytics\output\form;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot.'/lib/formslib.php');
|
||||
|
||||
/**
|
||||
* Model edit form.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class edit_model extends \moodleform {
|
||||
|
||||
/**
|
||||
* Form definition
|
||||
*/
|
||||
public function definition() {
|
||||
global $OUTPUT;
|
||||
|
||||
$mform = $this->_form;
|
||||
|
||||
if ($this->_customdata['model']->is_trained()) {
|
||||
$message = get_string('edittrainedwarning', 'tool_analytics');
|
||||
$mform->addElement('html', $OUTPUT->notification($message, \core\output\notification::NOTIFY_WARNING));
|
||||
}
|
||||
|
||||
$mform->addElement('advcheckbox', 'enabled', get_string('enabled', 'tool_analytics'));
|
||||
|
||||
$indicators = array();
|
||||
foreach ($this->_customdata['indicators'] as $classname => $indicator) {
|
||||
$optionname = \tool_analytics\output\helper::class_to_option($classname);
|
||||
$indicators[$optionname] = $indicator->get_name();
|
||||
}
|
||||
$options = array(
|
||||
'multiple' => true
|
||||
);
|
||||
$mform->addElement('autocomplete', 'indicators', get_string('indicators', 'tool_analytics'), $indicators, $options);
|
||||
$mform->setType('indicators', PARAM_ALPHANUMEXT);
|
||||
|
||||
$timesplittings = array('' => '');
|
||||
foreach ($this->_customdata['timesplittings'] as $classname => $timesplitting) {
|
||||
$optionname = \tool_analytics\output\helper::class_to_option($classname);
|
||||
$timesplittings[$optionname] = $timesplitting->get_name();
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'timesplitting', get_string('timesplittingmethod', 'analytics'), $timesplittings);
|
||||
$mform->addHelpButton('timesplitting', 'timesplittingmethod', 'analytics');
|
||||
|
||||
$mform->addElement('hidden', 'id', $this->_customdata['id']);
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'action', 'edit');
|
||||
$mform->setType('action', PARAM_ALPHANUMEXT);
|
||||
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Form validation
|
||||
*
|
||||
* @param array $data data from the form.
|
||||
* @param array $files files uploaded.
|
||||
*
|
||||
* @return array of errors.
|
||||
*/
|
||||
public function validation($data, $files) {
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
if (!empty($data['timesplitting'])) {
|
||||
$realtimesplitting = \tool_analytics\output\helper::option_to_class($data['timesplitting']);
|
||||
if (\core_analytics\manager::is_valid($realtimesplitting, '\core_analytics\local\time_splitting\base') === false) {
|
||||
$errors['timesplitting'] = get_string('errorinvalidtimesplitting', 'analytics');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data['indicators'])) {
|
||||
$errors['indicators'] = get_string('errornoindicators', 'analytics');
|
||||
} else {
|
||||
foreach ($data['indicators'] as $indicator) {
|
||||
$realindicatorname = \tool_analytics\output\helper::option_to_class($indicator);
|
||||
if (\core_analytics\manager::is_valid($realindicatorname, '\core_analytics\local\indicator\base') === false) {
|
||||
$errors['indicators'] = get_string('errorinvalidindicator', 'analytics', $realindicatorname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data['enabled']) && empty($data['timesplitting'])) {
|
||||
$errors['enabled'] = get_string('errorcantenablenotimesplitting', 'tool_analytics');
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Typical crappy helper class with tiny functions.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_analytics\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Helper class with general purpose tiny functions.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class helper {
|
||||
|
||||
/**
|
||||
* Converts a class full name to a select option key
|
||||
*
|
||||
* @param string $class
|
||||
* @return string
|
||||
*/
|
||||
public static function class_to_option($class) {
|
||||
// Form field is PARAM_ALPHANUMEXT and we are sending fully qualified class names
|
||||
// as option names, but replacing the backslash for a string that is really unlikely
|
||||
// to ever be part of a class name.
|
||||
return str_replace('\\', '2015102400ouuu', $class);
|
||||
}
|
||||
|
||||
/**
|
||||
* option_to_class
|
||||
*
|
||||
* @param string $option
|
||||
* @return string
|
||||
*/
|
||||
public static function option_to_class($option) {
|
||||
// Really unlikely but yeah, I'm a bad booyyy.
|
||||
return str_replace('2015102400ouuu', '\\', $option);
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Invalid analysables renderable.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_analytics\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Invalid analysables renderable.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class invalid_analysables implements \renderable, \templatable {
|
||||
|
||||
/**
|
||||
* @var \core_analytics\model
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $page = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $perpage = 0;
|
||||
|
||||
/**
|
||||
* Inits the invalid analysables renderable.
|
||||
*
|
||||
* @param \core_analytics\model $model
|
||||
* @param int $page
|
||||
* @param int $perpage
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function __construct(\core_analytics\model $model, $page, $perpage) {
|
||||
|
||||
$this->model = $model;
|
||||
$this->page = $page;
|
||||
$this->perpage = $perpage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the data.
|
||||
*
|
||||
* @param \renderer_base $output
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output) {
|
||||
global $PAGE;
|
||||
|
||||
$offset = $this->page * $this->perpage;
|
||||
|
||||
$analysables = $this->model->get_analyser(['notimesplitting' => true])->get_analysables();
|
||||
|
||||
$skipped = 0;
|
||||
$enoughresults = false;
|
||||
$morepages = false;
|
||||
$results = array();
|
||||
foreach ($analysables as $key => $analysable) {
|
||||
|
||||
$validtraining = $this->model->get_target()->is_valid_analysable($analysable, true);
|
||||
if ($validtraining === true) {
|
||||
if ($this->model->is_static()) {
|
||||
// We still want to show this analysable if it is not valid to get predictions.
|
||||
$validtraining = get_string('notrainingbasedassumptions', 'analytics');
|
||||
} else {
|
||||
// We skip analysables that are valid for training or valid for prediction.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$validprediction = $this->model->get_target()->is_valid_analysable($analysable, false);
|
||||
if ($validprediction === true) {
|
||||
// We skip analysables that are valid for training or valid for prediction.
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($offset && $skipped < $offset) {
|
||||
$skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add a new results if we don't have enough yet.
|
||||
if (!$enoughresults) {
|
||||
$results[$analysable->get_id()] = array($analysable, $validtraining, $validprediction);
|
||||
if ($this->perpage && count($results) === $this->perpage) {
|
||||
$enoughresults = true;
|
||||
}
|
||||
} else {
|
||||
// Confirmed that we have results we can not fit into this page.
|
||||
$morepages = true;
|
||||
break;
|
||||
}
|
||||
|
||||
unset($analysables[$key]);
|
||||
}
|
||||
|
||||
// Prepare the context object.
|
||||
$data = new \stdClass();
|
||||
$data->modelname = $this->model->get_target()->get_name();
|
||||
|
||||
if ($this->page > 0) {
|
||||
$prev = clone $PAGE->url;
|
||||
$prev->param('page', $this->page - 1);
|
||||
$button = new \single_button($prev, get_string('previouspage', 'tool_analytics'), 'get');
|
||||
$data->prev = $button->export_for_template($output);
|
||||
}
|
||||
if ($morepages) {
|
||||
$next = clone $PAGE->url;
|
||||
$next->param('page', $this->page + 1);
|
||||
$button = new \single_button($next, get_string('nextpage', 'tool_analytics'), 'get');
|
||||
$data->next = $button->export_for_template($output);
|
||||
}
|
||||
|
||||
$data->analysables = [];
|
||||
foreach ($results as list($analysable, $validtraining, $validprediction)) {
|
||||
$obj = new \stdClass();
|
||||
$obj->url = \html_writer::link($analysable->get_context()->get_url(), $analysable->get_name(),
|
||||
array('target' => '_blank'));
|
||||
|
||||
if ($validtraining !== true) {
|
||||
$obj->validtraining = $validtraining;
|
||||
}
|
||||
if ($validprediction !== true) {
|
||||
$obj->validprediction = $validprediction;
|
||||
}
|
||||
$data->analysables[] = $obj;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Model logs table class.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_analytics\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
require_once($CFG->libdir . '/tablelib.php');
|
||||
|
||||
/**
|
||||
* Model logs table class.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class model_logs extends \table_sql {
|
||||
|
||||
/**
|
||||
* @var \core_analytics\model
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* Sets up the table_log parameters.
|
||||
*
|
||||
* @param string $uniqueid unique id of form.
|
||||
* @param \core_analytics\model $model
|
||||
*/
|
||||
public function __construct($uniqueid, $model) {
|
||||
global $PAGE;
|
||||
|
||||
parent::__construct($uniqueid);
|
||||
|
||||
$this->model = $model;
|
||||
|
||||
$this->set_attribute('class', 'modellog generaltable generalbox');
|
||||
$this->set_attribute('aria-live', 'polite');
|
||||
|
||||
$this->define_columns(array('time', 'version', 'indicators', 'timesplitting', 'accuracy', 'info', 'usermodified'));
|
||||
$this->define_headers(array(
|
||||
get_string('time'),
|
||||
get_string('version'),
|
||||
get_string('indicators', 'tool_analytics'),
|
||||
get_string('timesplittingmethod', 'analytics'),
|
||||
get_string('accuracy', 'tool_analytics'),
|
||||
get_string('info', 'tool_analytics'),
|
||||
get_string('fullnameuser'),
|
||||
));
|
||||
$this->pageable(true);
|
||||
$this->collapsible(false);
|
||||
$this->sortable(false);
|
||||
$this->is_downloadable(false);
|
||||
|
||||
$this->define_baseurl($PAGE->url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the version column.
|
||||
*
|
||||
* @param \stdClass $log log data.
|
||||
* @return string HTML for the version column
|
||||
*/
|
||||
public function col_version($log) {
|
||||
$recenttimestr = get_string('strftimerecent', 'core_langconfig');
|
||||
return userdate($log->version, $recenttimestr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the time column.
|
||||
*
|
||||
* @param \stdClass $log log data.
|
||||
* @return string HTML for the time column
|
||||
*/
|
||||
public function col_time($log) {
|
||||
$recenttimestr = get_string('strftimerecent', 'core_langconfig');
|
||||
return userdate($log->timecreated, $recenttimestr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the indicators column.
|
||||
*
|
||||
* @param \stdClass $log log data.
|
||||
* @return string HTML for the indicators column
|
||||
*/
|
||||
public function col_indicators($log) {
|
||||
$indicatorclasses = json_decode($log->indicators);
|
||||
$indicators = array();
|
||||
foreach ($indicatorclasses as $indicatorclass) {
|
||||
$indicator = \core_analytics\manager::get_indicator($indicatorclass);
|
||||
if ($indicator) {
|
||||
$indicators[] = $indicator->get_name();
|
||||
} else {
|
||||
debugging('Can\'t load ' . $indicatorclass . ' indicator', DEBUG_DEVELOPER);
|
||||
}
|
||||
}
|
||||
return '<ul><li>' . implode('</li><li>', $indicators) . '</li></ul>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the context column.
|
||||
*
|
||||
* @param \stdClass $log log data.
|
||||
* @return string HTML for the context column
|
||||
*/
|
||||
public function col_timesplitting($log) {
|
||||
$timesplitting = \core_analytics\manager::get_time_splitting($log->timesplitting);
|
||||
return $timesplitting->get_name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the accuracy column.
|
||||
*
|
||||
* @param \stdClass $log log data.
|
||||
* @return string HTML for the accuracy column
|
||||
*/
|
||||
public function col_accuracy($log) {
|
||||
return strval(round($log->score * 100, 2)) . '%';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the info column.
|
||||
*
|
||||
* @param \stdClass $log log data.
|
||||
* @return string HTML for the score column
|
||||
*/
|
||||
public function col_info($log) {
|
||||
global $PAGE;
|
||||
|
||||
if (empty($log->info) && empty($log->dir)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$info = array();
|
||||
if (!empty($log->info)) {
|
||||
$info = json_decode($log->info);
|
||||
}
|
||||
if (!empty($log->dir)) {
|
||||
$info[] = get_string('predictorresultsin', 'tool_analytics', $log->dir);
|
||||
}
|
||||
$PAGE->requires->js_call_amd('tool_analytics/log_info', 'loadInfo', array($log->id, $info));
|
||||
return \html_writer::link('#', get_string('view'), array('data-model-log-id' => $log->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the usermodified column.
|
||||
*
|
||||
* @param \stdClass $log log data.
|
||||
* @return string HTML for the usermodified column
|
||||
*/
|
||||
public function col_usermodified($log) {
|
||||
$user = \core_user::get_user($log->usermodified);
|
||||
return fullname($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the logs table. Store results in the object for use by build_table.
|
||||
*
|
||||
* @param int $pagesize size of page for paginated displayed table.
|
||||
* @param bool $useinitialsbar do you want to use the initials bar.
|
||||
*/
|
||||
public function query_db($pagesize, $useinitialsbar = true) {
|
||||
$total = count($this->model->get_logs());
|
||||
$this->pagesize($pagesize, $total);
|
||||
$this->rawdata = $this->model->get_logs($this->get_page_start(), $this->get_page_size());
|
||||
|
||||
// Set initial bars.
|
||||
if ($useinitialsbar) {
|
||||
$this->initialbars($total > $pagesize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Prediction models list page.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_analytics\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Shows tool_analytics models list.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class models_list implements \renderable, \templatable {
|
||||
|
||||
/**
|
||||
* models
|
||||
*
|
||||
* @var \core_analytics\model[]
|
||||
*/
|
||||
protected $models = array();
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* @param \core_analytics\model[] $models
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($models) {
|
||||
$this->models = $models;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the data.
|
||||
*
|
||||
* @param \renderer_base $output
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output) {
|
||||
global $PAGE;
|
||||
|
||||
$data = new \stdClass();
|
||||
|
||||
$onlycli = get_config('analytics', 'onlycli');
|
||||
if ($onlycli === false) {
|
||||
// Default applied if no config found.
|
||||
$onlycli = 1;
|
||||
}
|
||||
|
||||
$data->models = array();
|
||||
foreach ($this->models as $model) {
|
||||
$modeldata = $model->export();
|
||||
|
||||
// Check if there is a help icon for the target to show.
|
||||
$identifier = $modeldata->target->get_identifier();
|
||||
$component = $modeldata->target->get_component();
|
||||
if (get_string_manager()->string_exists($identifier . '_help', $component)) {
|
||||
$helpicon = new \help_icon($identifier, $component);
|
||||
$modeldata->targethelp = $helpicon->export_for_template($output);
|
||||
} else {
|
||||
// We really want to encourage developers to add help to their targets.
|
||||
debugging("The target '{$modeldata->target}' should include a '{$identifier}_help' string to
|
||||
describe its purpose.", DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
// Check if there is a help icon for the indicators to show.
|
||||
if (!empty($modeldata->indicators)) {
|
||||
$indicators = array();
|
||||
foreach ($modeldata->indicators as $ind) {
|
||||
// Create the indicator with the details we want for the context.
|
||||
$indicator = new \stdClass();
|
||||
$indicator->name = $ind->out();
|
||||
$identifier = $ind->get_identifier();
|
||||
$component = $ind->get_component();
|
||||
if (get_string_manager()->string_exists($identifier . '_help', $component)) {
|
||||
$helpicon = new \help_icon($identifier, $component);
|
||||
$indicator->help = $helpicon->export_for_template($output);
|
||||
} else {
|
||||
// We really want to encourage developers to add help to their indicators.
|
||||
debugging("The indicator '{$ind}' should include a '{$identifier}_help' string to
|
||||
describe its purpose.", DEBUG_DEVELOPER);
|
||||
}
|
||||
$indicators[] = $indicator;
|
||||
}
|
||||
$modeldata->indicators = $indicators;
|
||||
}
|
||||
|
||||
// Check if there is a help icon for the time splitting method.
|
||||
if (!empty($modeldata->timesplitting)) {
|
||||
$identifier = $modeldata->timesplitting->get_identifier();
|
||||
$component = $modeldata->timesplitting->get_component();
|
||||
if (get_string_manager()->string_exists($identifier . '_help', $component)) {
|
||||
$helpicon = new \help_icon($identifier, $component);
|
||||
$modeldata->timesplittinghelp = $helpicon->export_for_template($output);
|
||||
} else {
|
||||
// We really want to encourage developers to add help to their time splitting methods.
|
||||
debugging("The time splitting method '{$modeldata->timesplitting}' should include a '{$identifier}_help'
|
||||
string to describe its purpose.", DEBUG_DEVELOPER);
|
||||
}
|
||||
} else {
|
||||
$helpicon = new \help_icon('timesplittingnotdefined', 'tool_analytics');
|
||||
$modeldata->timesplittinghelp = $helpicon->export_for_template($output);
|
||||
}
|
||||
|
||||
// Has this model generated predictions?.
|
||||
$predictioncontexts = $model->get_predictions_contexts();
|
||||
|
||||
// Model predictions list.
|
||||
if (!$model->is_enabled()) {
|
||||
$modeldata->noinsights = get_string('disabledmodel', 'analytics');
|
||||
} else if ($model->uses_insights()) {
|
||||
if ($predictioncontexts) {
|
||||
|
||||
foreach ($predictioncontexts as $contextid => $unused) {
|
||||
// We prepare this to be used as single_select template options.
|
||||
$context = \context::instance_by_id($contextid);
|
||||
|
||||
// Special name for system level predictions as showing "System is not visually nice".
|
||||
if ($contextid == SYSCONTEXTID) {
|
||||
$contextname = get_string('allpredictions', 'tool_analytics');
|
||||
} else {
|
||||
$contextname = shorten_text($context->get_context_name(true, true), 90);
|
||||
}
|
||||
$predictioncontexts[$contextid] = $contextname;
|
||||
}
|
||||
\core_collator::asort($predictioncontexts);
|
||||
|
||||
if (!empty($predictioncontexts)) {
|
||||
$url = new \moodle_url('/report/insights/insights.php', array('modelid' => $model->get_id()));
|
||||
$singleselect = new \single_select($url, 'contextid', $predictioncontexts);
|
||||
$modeldata->insights = $singleselect->export_for_template($output);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($modeldata->insights)) {
|
||||
if ($model->any_prediction_obtained()) {
|
||||
$modeldata->noinsights = get_string('noinsights', 'analytics');
|
||||
} else {
|
||||
$modeldata->noinsights = get_string('nopredictionsyet', 'analytics');
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$modeldata->noinsights = get_string('noinsightsmodel', 'analytics');
|
||||
}
|
||||
|
||||
// Actions.
|
||||
$actionsmenu = new \action_menu();
|
||||
$actionsmenu->set_menu_trigger(get_string('actions'));
|
||||
$actionsmenu->set_owner_selector('model-actions-' . $model->get_id());
|
||||
$actionsmenu->set_alignment(\action_menu::TL, \action_menu::BL);
|
||||
|
||||
$urlparams = ['id' => $model->get_id(), 'sesskey' => sesskey()];
|
||||
|
||||
// Get predictions.
|
||||
if (!$onlycli && $modeldata->enabled && !empty($modeldata->timesplitting)) {
|
||||
$urlparams['action'] = 'getpredictions';
|
||||
$url = new \moodle_url('model.php', $urlparams);
|
||||
$icon = new \action_menu_link_secondary($url, new \pix_icon('i/notifications',
|
||||
get_string('getpredictions', 'tool_analytics')), get_string('getpredictions', 'tool_analytics'));
|
||||
$actionsmenu->add($icon);
|
||||
}
|
||||
|
||||
// Evaluate machine-learning-based models.
|
||||
if (!$onlycli && $model->get_indicators() && !$model->is_static()) {
|
||||
$urlparams['action'] = 'evaluate';
|
||||
$url = new \moodle_url('model.php', $urlparams);
|
||||
$icon = new \action_menu_link_secondary($url, new \pix_icon('i/calc', get_string('evaluate', 'tool_analytics')),
|
||||
get_string('evaluate', 'tool_analytics'));
|
||||
$actionsmenu->add($icon);
|
||||
}
|
||||
|
||||
// Machine-learning-based models evaluation log.
|
||||
if (!$model->is_static()) {
|
||||
$urlparams['action'] = 'log';
|
||||
$url = new \moodle_url('model.php', $urlparams);
|
||||
$icon = new \action_menu_link_secondary($url, new \pix_icon('i/report', get_string('viewlog', 'tool_analytics')),
|
||||
get_string('viewlog', 'tool_analytics'));
|
||||
$actionsmenu->add($icon);
|
||||
}
|
||||
|
||||
// Edit model.
|
||||
if (!$model->is_static()) {
|
||||
$urlparams['action'] = 'edit';
|
||||
$url = new \moodle_url('model.php', $urlparams);
|
||||
$icon = new \action_menu_link_secondary($url, new \pix_icon('t/edit', get_string('edit')), get_string('edit'));
|
||||
$actionsmenu->add($icon);
|
||||
}
|
||||
|
||||
// Enable / disable.
|
||||
if ($model->is_enabled() || !empty($modeldata->timesplitting)) {
|
||||
// If there is no timesplitting method set, the model can not be enabled.
|
||||
if ($model->is_enabled()) {
|
||||
$action = 'disable';
|
||||
$text = get_string('disable');
|
||||
$icontype = 't/block';
|
||||
} else {
|
||||
$action = 'enable';
|
||||
$text = get_string('enable');
|
||||
$icontype = 'i/checked';
|
||||
}
|
||||
$urlparams['action'] = $action;
|
||||
$url = new \moodle_url('model.php', $urlparams);
|
||||
$icon = new \action_menu_link_secondary($url, new \pix_icon($icontype, $text), $text);
|
||||
$actionsmenu->add($icon);
|
||||
}
|
||||
|
||||
// Export training data.
|
||||
if (!$model->is_static() && $model->is_trained()) {
|
||||
$urlparams['action'] = 'export';
|
||||
$url = new \moodle_url('model.php', $urlparams);
|
||||
$icon = new \action_menu_link_secondary($url, new \pix_icon('i/export',
|
||||
get_string('exporttrainingdata', 'tool_analytics')), get_string('export', 'tool_analytics'));
|
||||
$actionsmenu->add($icon);
|
||||
}
|
||||
|
||||
// Invalid analysables.
|
||||
$analyser = $model->get_analyser(['notimesplitting' => true]);
|
||||
if (!$analyser instanceof \core_analytics\local\analyser\sitewide) {
|
||||
$urlparams['action'] = 'invalidanalysables';
|
||||
$url = new \moodle_url('model.php', $urlparams);
|
||||
$pix = new \pix_icon('i/report', get_string('invalidanalysables', 'tool_analytics'));
|
||||
$icon = new \action_menu_link_secondary($url, $pix, get_string('invalidanalysables', 'tool_analytics'));
|
||||
$actionsmenu->add($icon);
|
||||
}
|
||||
|
||||
// Clear model.
|
||||
if (!empty($predictioncontexts)) {
|
||||
$actionid = 'clear-' . $model->get_id();
|
||||
$PAGE->requires->js_call_amd('tool_analytics/model', 'confirmAction', [$actionid, 'clear']);
|
||||
$urlparams['action'] = 'clear';
|
||||
$url = new \moodle_url('model.php', $urlparams);
|
||||
$icon = new \action_menu_link_secondary($url, new \pix_icon('e/cleanup_messy_code',
|
||||
get_string('clearpredictions', 'tool_analytics')), get_string('clearpredictions', 'tool_analytics'),
|
||||
['data-action-id' => $actionid]);
|
||||
$actionsmenu->add($icon);
|
||||
}
|
||||
|
||||
$modeldata->actions = $actionsmenu->export_for_template($output);
|
||||
|
||||
$data->models[] = $modeldata;
|
||||
}
|
||||
|
||||
if (!$onlycli) {
|
||||
$data->warnings = array(
|
||||
(object)array('message' => get_string('bettercli', 'tool_analytics'), 'closebutton' => true)
|
||||
);
|
||||
} else {
|
||||
$url = new \moodle_url('/admin/settings.php', array('section' => 'analyticssettings'),
|
||||
'id_s_analytics_onlycli');
|
||||
|
||||
$langstrid = 'clievaluationandpredictionsnoadmin';
|
||||
if (is_siteadmin()) {
|
||||
$langstrid = 'clievaluationandpredictions';
|
||||
}
|
||||
$data->infos = array(
|
||||
(object)array('message' => get_string($langstrid, 'tool_analytics', $url->out()),
|
||||
'closebutton' => true)
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Renderer.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_analytics\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use plugin_renderer_base;
|
||||
use templatable;
|
||||
use renderable;
|
||||
|
||||
/**
|
||||
* Renderer class.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Defer to template.
|
||||
*
|
||||
* @param \tool_analytics\output\models_list $modelslist
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function render_models_list(\tool_analytics\output\models_list $modelslist) {
|
||||
$data = $modelslist->export_for_template($this);
|
||||
return parent::render_from_template('tool_analytics/models_list', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a table.
|
||||
*
|
||||
* @param \table_sql $table
|
||||
* @return string HTML
|
||||
*/
|
||||
public function render_table(\table_sql $table) {
|
||||
|
||||
ob_start();
|
||||
$table->out(10, true);
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Web interface evaluate results.
|
||||
*
|
||||
* @param \stdClass[] $results
|
||||
* @param string[] $logs
|
||||
* @return string HTML
|
||||
*/
|
||||
public function render_evaluate_results($results, $logs = array()) {
|
||||
global $OUTPUT;
|
||||
|
||||
$output = '';
|
||||
|
||||
foreach ($results as $timesplittingid => $result) {
|
||||
|
||||
if (!CLI_SCRIPT) {
|
||||
$output .= $OUTPUT->box_start('generalbox m-b-3');
|
||||
}
|
||||
|
||||
// Check that the array key is a string, not all results depend on time splitting methods (e.g. general errors).
|
||||
if (!is_numeric($timesplittingid)) {
|
||||
$timesplitting = \core_analytics\manager::get_time_splitting($timesplittingid);
|
||||
$langstrdata = (object)array('name' => $timesplitting->get_name(), 'id' => $timesplittingid);
|
||||
|
||||
if (CLI_SCRIPT) {
|
||||
$output .= $OUTPUT->heading(get_string('getpredictionsresultscli', 'tool_analytics', $langstrdata), 3);
|
||||
} else {
|
||||
$output .= $OUTPUT->heading(get_string('getpredictionsresults', 'tool_analytics', $langstrdata), 3);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result->status == 0) {
|
||||
$output .= $OUTPUT->notification(get_string('goodmodel', 'tool_analytics'),
|
||||
\core\output\notification::NOTIFY_SUCCESS);
|
||||
} else if ($result->status === \core_analytics\model::NO_DATASET) {
|
||||
$output .= $OUTPUT->notification(get_string('nodatatoevaluate', 'tool_analytics'),
|
||||
\core\output\notification::NOTIFY_WARNING);
|
||||
}
|
||||
|
||||
if (isset($result->score)) {
|
||||
// Score.
|
||||
$output .= $OUTPUT->heading(get_string('accuracy', 'tool_analytics') . ': ' .
|
||||
round(floatval($result->score), 4) * 100 . '%', 4);
|
||||
}
|
||||
|
||||
if (!empty($result->info)) {
|
||||
foreach ($result->info as $message) {
|
||||
$output .= $OUTPUT->notification($message, \core\output\notification::NOTIFY_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
if (!CLI_SCRIPT) {
|
||||
$output .= $OUTPUT->box_end();
|
||||
}
|
||||
}
|
||||
|
||||
// Info logged during evaluation.
|
||||
if (!empty($logs) && debugging()) {
|
||||
$output .= $OUTPUT->heading(get_string('extrainfo', 'tool_analytics'), 3);
|
||||
foreach ($logs as $log) {
|
||||
$output .= $OUTPUT->notification($log, \core\output\notification::NOTIFY_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
if (!CLI_SCRIPT) {
|
||||
$output .= $OUTPUT->single_button(new \moodle_url('/admin/tool/analytics/index.php'), get_string('continue'), 'get');
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Web interface training & prediction results.
|
||||
*
|
||||
* @param \stdClass|false $trainresults
|
||||
* @param string[] $trainlogs
|
||||
* @param \stdClass|false $predictresults
|
||||
* @param string[] $predictlogs
|
||||
* @return string HTML
|
||||
*/
|
||||
public function render_get_predictions_results($trainresults = false, $trainlogs = array(), $predictresults = false, $predictlogs = array()) {
|
||||
global $OUTPUT;
|
||||
|
||||
$output = '';
|
||||
|
||||
if ($trainresults || (!empty($trainlogs) && debugging())) {
|
||||
$output .= $OUTPUT->heading(get_string('trainingresults', 'tool_analytics'), 3);
|
||||
}
|
||||
|
||||
if ($trainresults) {
|
||||
if ($trainresults->status == 0) {
|
||||
$output .= $OUTPUT->notification(get_string('trainingprocessfinished', 'tool_analytics'),
|
||||
\core\output\notification::NOTIFY_SUCCESS);
|
||||
} else if ($trainresults->status === \core_analytics\model::NO_DATASET ||
|
||||
$trainresults->status === \core_analytics\model::NOT_ENOUGH_DATA) {
|
||||
$output .= $OUTPUT->notification(get_string('nodatatotrain', 'tool_analytics'),
|
||||
\core\output\notification::NOTIFY_WARNING);
|
||||
} else {
|
||||
$output .= $OUTPUT->notification(get_string('generalerror', 'tool_analytics', $trainresults->status),
|
||||
\core\output\notification::NOTIFY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($trainlogs) && debugging()) {
|
||||
$output .= $OUTPUT->heading(get_string('extrainfo', 'tool_analytics'), 4);
|
||||
foreach ($trainlogs as $log) {
|
||||
$output .= $OUTPUT->notification($log, \core\output\notification::NOTIFY_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
if ($predictresults || (!empty($predictlogs) && debugging())) {
|
||||
$output .= $OUTPUT->heading(get_string('predictionresults', 'tool_analytics'), 3, 'main m-t-3');
|
||||
}
|
||||
|
||||
if ($predictresults) {
|
||||
if ($predictresults->status == 0) {
|
||||
$output .= $OUTPUT->notification(get_string('predictionprocessfinished', 'tool_analytics'),
|
||||
\core\output\notification::NOTIFY_SUCCESS);
|
||||
} else if ($predictresults->status === \core_analytics\model::NO_DATASET ||
|
||||
$predictresults->status === \core_analytics\model::NOT_ENOUGH_DATA) {
|
||||
$output .= $OUTPUT->notification(get_string('nodatatopredict', 'tool_analytics'),
|
||||
\core\output\notification::NOTIFY_WARNING);
|
||||
} else {
|
||||
$output .= $OUTPUT->notification(get_string('generalerror', 'tool_analytics', $predictresults->status),
|
||||
\core\output\notification::NOTIFY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($predictlogs) && debugging()) {
|
||||
$output .= $OUTPUT->heading(get_string('extrainfo', 'tool_analytics'), 4);
|
||||
foreach ($predictlogs as $log) {
|
||||
$output .= $OUTPUT->notification($log, \core\output\notification::NOTIFY_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
if (!CLI_SCRIPT) {
|
||||
$output .= $OUTPUT->single_button(new \moodle_url('/admin/tool/analytics/index.php'), get_string('continue'), 'get');
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defer to template.
|
||||
*
|
||||
* @param \tool_analytics\output\invalid_analysables $invalidanalysables
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function render_invalid_analysables(\tool_analytics\output\invalid_analysables $invalidanalysables) {
|
||||
$data = $invalidanalysables->export_for_template($this);
|
||||
return parent::render_from_template('tool_analytics/invalid_analysables', $data);
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Predict system models with new data available.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_analytics\task;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Predict system models with new data available.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class predict_models extends \core\task\scheduled_task {
|
||||
|
||||
/**
|
||||
* get_name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
return get_string('predictmodels', 'tool_analytics');
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the prediction task.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute() {
|
||||
global $OUTPUT, $PAGE;
|
||||
|
||||
$models = \core_analytics\manager::get_all_models(true, true);
|
||||
if (!$models) {
|
||||
mtrace(get_string('errornoenabledandtrainedmodels', 'tool_analytics'));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($models as $model) {
|
||||
$result = $model->predict();
|
||||
if ($result) {
|
||||
echo $OUTPUT->heading(get_string('modelresults', 'tool_analytics', $model->get_target()->get_name()));
|
||||
$renderer = $PAGE->get_renderer('tool_analytics');
|
||||
echo $renderer->render_get_predictions_results(false, array(), $result, $model->get_analyser()->get_logs());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Train system models with new data available.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_analytics\task;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Train system models with new data available.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class train_models extends \core\task\scheduled_task {
|
||||
|
||||
/**
|
||||
* get_name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
return get_string('trainmodels', 'tool_analytics');
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the prediction task.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute() {
|
||||
global $OUTPUT, $PAGE;
|
||||
|
||||
$models = \core_analytics\manager::get_all_models(true);
|
||||
if (!$models) {
|
||||
mtrace(get_string('errornoenabledmodels', 'tool_analytics'));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($models as $model) {
|
||||
|
||||
if ($model->is_static()) {
|
||||
// Skip models based on assumptions.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$model->get_time_splitting()) {
|
||||
// Can not train if there is no time splitting method selected.
|
||||
continue;
|
||||
}
|
||||
|
||||
$result = $model->train();
|
||||
if ($result) {
|
||||
echo $OUTPUT->heading(get_string('modelresults', 'tool_analytics', $model->get_target()->get_name()));
|
||||
|
||||
$renderer = $PAGE->get_renderer('tool_analytics');
|
||||
echo $renderer->render_get_predictions_results($result, $model->get_analyser()->get_logs());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Enables the provided model.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require_once(__DIR__ . '/../../../../config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
|
||||
$help = "Enables the provided model.
|
||||
|
||||
Options:
|
||||
--modelid Model id
|
||||
--timesplitting Time splitting method full class name
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$ php admin/tool/analytics/cli/enable_model.php --modelid=1 --timesplitting=\"\\core\\analytics\\time_splitting\\quarters\"
|
||||
";
|
||||
|
||||
// Now get cli options.
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'help' => false,
|
||||
'modelid' => false,
|
||||
'timesplitting' => false
|
||||
),
|
||||
array(
|
||||
'h' => 'help',
|
||||
)
|
||||
);
|
||||
|
||||
if ($options['help']) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($options['modelid'] === false || $options['timesplitting'] === false) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// We need admin permissions.
|
||||
\core\session\manager::set_user(get_admin());
|
||||
|
||||
$model = new \core_analytics\model($options['modelid']);
|
||||
|
||||
// Evaluate its suitability to predict accurately.
|
||||
$model->enable($options['timesplitting']);
|
||||
|
||||
cli_heading(get_string('success'));
|
||||
exit(0);
|
||||
@@ -1,131 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Evaluates the provided model.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require_once(__DIR__ . '/../../../../config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
|
||||
$help = "Evaluates the provided model.
|
||||
|
||||
Options:
|
||||
--modelid Model id
|
||||
--non-interactive Not interactive questions
|
||||
--timesplitting Restrict the evaluation to 1 single time splitting method (Optional)
|
||||
--filter Analyser dependant. e.g. A courseid would evaluate the model using a single course (Optional)
|
||||
--reuse-prev-analysed Reuse recently analysed courses instead of analysing the whole site. Set it to false while" .
|
||||
" coding indicators. Defaults to true (Optional)" . "
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$ php admin/tool/analytics/cli/evaluate_model.php --modelid=1 --timesplitting='\\core\\analytics\\time_splitting\\quarters' --filter=123,321
|
||||
";
|
||||
|
||||
// Now get cli options.
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'help' => false,
|
||||
'modelid' => false,
|
||||
'timesplitting' => false,
|
||||
'reuse-prev-analysed' => true,
|
||||
'non-interactive' => false,
|
||||
'filter' => false
|
||||
),
|
||||
array(
|
||||
'h' => 'help',
|
||||
)
|
||||
);
|
||||
|
||||
if ($options['help']) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($options['modelid'] === false) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Reformat them as an array.
|
||||
if ($options['filter'] !== false) {
|
||||
$options['filter'] = explode(',', $options['filter']);
|
||||
}
|
||||
|
||||
// We need admin permissions.
|
||||
\core\session\manager::set_user(get_admin());
|
||||
|
||||
$model = new \core_analytics\model($options['modelid']);
|
||||
|
||||
mtrace(get_string('analysingsitedata', 'tool_analytics'));
|
||||
|
||||
if ($options['reuse-prev-analysed']) {
|
||||
mtrace(get_string('evaluationinbatches', 'tool_analytics'));
|
||||
}
|
||||
|
||||
$analyseroptions = array(
|
||||
'filter' => $options['filter'],
|
||||
'timesplitting' => $options['timesplitting'],
|
||||
'reuseprevanalysed' => $options['reuse-prev-analysed'],
|
||||
);
|
||||
// Evaluate its suitability to predict accurately.
|
||||
$results = $model->evaluate($analyseroptions);
|
||||
|
||||
$renderer = $PAGE->get_renderer('tool_analytics');
|
||||
echo $renderer->render_evaluate_results($results, $model->get_analyser()->get_logs());
|
||||
|
||||
// Check that we have, at leasa,t 1 valid dataset (not necessarily good) to use.
|
||||
foreach ($results as $result) {
|
||||
if ($result->status !== \core_analytics\model::NO_DATASET &&
|
||||
$result->status !== \core_analytics\model::GENERAL_ERROR) {
|
||||
$validdatasets = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($validdatasets) && !$model->is_enabled() && $options['non-interactive'] === false) {
|
||||
|
||||
// Select a dataset, train and enable the model.
|
||||
$input = cli_input(get_string('clienablemodel', 'tool_analytics'));
|
||||
while (!\core_analytics\manager::is_valid($input, '\core_analytics\local\time_splitting\base') && $input !== 'none') {
|
||||
mtrace(get_string('errorunexistingtimesplitting', 'analytics'));
|
||||
$input = cli_input(get_string('clienablemodel', 'tool_analytics'));
|
||||
}
|
||||
|
||||
if ($input === 'none') {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Refresh the instance to prevent unexpected issues.
|
||||
$model = new \core_analytics\model($modelobj);
|
||||
|
||||
// Set the time splitting method file and enable it.
|
||||
$model->enable($input);
|
||||
|
||||
mtrace(get_string('trainandpredictmodel', 'tool_analytics'));
|
||||
|
||||
// Train the model with the selected time splitting method and start predicting.
|
||||
$model->train();
|
||||
$model->predict();
|
||||
}
|
||||
|
||||
exit(0);
|
||||
@@ -1,228 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Guesses course start and end dates based on activity logs.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require_once(__DIR__ . '/../../../../config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
|
||||
require_once($CFG->dirroot . '/course/lib.php');
|
||||
require_once($CFG->dirroot . '/course/format/weeks/lib.php');
|
||||
|
||||
$help = "Guesses course start and end dates based on activity logs.
|
||||
|
||||
IMPORTANT: Don't use this script if you keep previous academic years users enrolled in courses. Guesses would not be accurate.
|
||||
|
||||
Options:
|
||||
--guessstart Guess the course start date (default to true)
|
||||
--guessend Guess the course end date (default to true)
|
||||
--guessall Guess all start and end dates, even if they are already set (default to false)
|
||||
--update Update the db or just notify the guess (default to false)
|
||||
--filter Analyser dependant. e.g. A courseid would evaluate the model using a single course (Optional)
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$ php admin/tool/analytics/cli/guess_course_start_and_end_dates.php --update=1 --filter=123,321
|
||||
";
|
||||
|
||||
// Now get cli options.
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'help' => false,
|
||||
'guessstart' => true,
|
||||
'guessend' => true,
|
||||
'guessall' => false,
|
||||
'update' => false,
|
||||
'filter' => false
|
||||
),
|
||||
array(
|
||||
'h' => 'help',
|
||||
)
|
||||
);
|
||||
|
||||
if ($options['help']) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($options['guessstart'] === false && $options['guessend'] === false && $options['guessall'] === false) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Reformat them as an array.
|
||||
if ($options['filter'] !== false) {
|
||||
$options['filter'] = explode(',', clean_param($options['filter'], PARAM_SEQUENCE));
|
||||
}
|
||||
|
||||
// We need admin permissions.
|
||||
\core\session\manager::set_user(get_admin());
|
||||
|
||||
$conditions = array('id != 1');
|
||||
if (!$options['guessall']) {
|
||||
if ($options['guessstart']) {
|
||||
$conditions[] = '(startdate is null or startdate = 0)';
|
||||
}
|
||||
if ($options['guessend']) {
|
||||
$conditions[] = '(enddate is null or enddate = 0)';
|
||||
}
|
||||
}
|
||||
|
||||
$coursessql = '';
|
||||
$params = null;
|
||||
if ($options['filter']) {
|
||||
list($coursessql, $params) = $DB->get_in_or_equal($options['filter'], SQL_PARAMS_NAMED);
|
||||
$conditions[] = 'id ' . $coursessql;
|
||||
}
|
||||
|
||||
$courses = $DB->get_recordset_select('course', implode(' AND ', $conditions), $params, 'sortorder ASC');
|
||||
foreach ($courses as $course) {
|
||||
tool_analytics_calculate_course_dates($course, $options);
|
||||
}
|
||||
$courses->close();
|
||||
|
||||
|
||||
/**
|
||||
* tool_analytics_calculate_course_dates
|
||||
*
|
||||
* @param stdClass $course
|
||||
* @param array $options CLI options
|
||||
* @return void
|
||||
*/
|
||||
function tool_analytics_calculate_course_dates($course, $options) {
|
||||
global $DB, $OUTPUT;
|
||||
|
||||
$courseman = new \core_analytics\course($course);
|
||||
|
||||
$notification = $course->shortname . ' (id = ' . $course->id . '): ';
|
||||
|
||||
$originalenddate = null;
|
||||
$guessedstartdate = null;
|
||||
$guessedenddate = null;
|
||||
$samestartdate = null;
|
||||
$lowerenddate = null;
|
||||
|
||||
if ($options['guessstart'] || $options['guessall']) {
|
||||
|
||||
$originalstartdate = $course->startdate;
|
||||
|
||||
$guessedstartdate = $courseman->guess_start();
|
||||
$samestartdate = ($guessedstartdate == $originalstartdate);
|
||||
$lowerenddate = ($course->enddate && ($course->enddate < $guessedstartdate));
|
||||
|
||||
if ($samestartdate) {
|
||||
if (!$guessedstartdate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('cantguessstartdate', 'tool_analytics');
|
||||
} else {
|
||||
// No need to update.
|
||||
$notification .= PHP_EOL . ' ' . get_string('samestartdate', 'tool_analytics') . ': ' . userdate($guessedstartdate);
|
||||
}
|
||||
} else if (!$guessedstartdate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('cantguessstartdate', 'tool_analytics');
|
||||
} else if ($lowerenddate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('cantguessstartdate', 'tool_analytics') . ': ' .
|
||||
get_string('enddatebeforestartdate', 'error') . ' - ' . userdate($guessedstartdate);
|
||||
} else {
|
||||
// Update it to something we guess.
|
||||
|
||||
// We set it to $course even if we don't update because may be needed to guess the end one.
|
||||
$course->startdate = $guessedstartdate;
|
||||
$notification .= PHP_EOL . ' ' . get_string('startdate') . ': ' . userdate($guessedstartdate);
|
||||
|
||||
// Two different course updates because week's end date may be recalculated after setting the start date.
|
||||
if ($options['update']) {
|
||||
update_course($course);
|
||||
|
||||
// Refresh course data as end date may have been updated.
|
||||
$course = $DB->get_record('course', array('id' => $course->id));
|
||||
$courseman = new \core_analytics\course($course);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($options['guessend'] || $options['guessall']) {
|
||||
|
||||
if (!empty($lowerenddate) && !empty($guessedstartdate)) {
|
||||
$course->startdate = $guessedstartdate;
|
||||
}
|
||||
|
||||
$originalenddate = $course->enddate;
|
||||
|
||||
$format = course_get_format($course);
|
||||
$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']) {
|
||||
// Special treatment for weeks-based formats with automatic end date.
|
||||
|
||||
if ($options['update']) {
|
||||
$format::update_end_date($course->id);
|
||||
$course->enddate = $DB->get_field('course', 'enddate', array('id' => $course->id));
|
||||
$notification .= PHP_EOL . ' ' . get_string('weeksenddateautomaticallyset', 'tool_analytics') . ': ' .
|
||||
userdate($course->enddate);
|
||||
} else {
|
||||
// We can't provide more info without actually updating it in db.
|
||||
$notification .= PHP_EOL . ' ' . get_string('weeksenddatedefault', 'tool_analytics');
|
||||
}
|
||||
} else {
|
||||
$guessedenddate = $courseman->guess_end();
|
||||
|
||||
if ($guessedenddate == $originalenddate) {
|
||||
if (!$guessedenddate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('cantguessenddate', 'tool_analytics');
|
||||
} else {
|
||||
// No need to update.
|
||||
$notification .= PHP_EOL . ' ' . get_string('sameenddate', 'tool_analytics') . ': ' . userdate($guessedenddate);
|
||||
}
|
||||
} else if (!$guessedenddate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('cantguessenddate', 'tool_analytics');
|
||||
} else {
|
||||
// Update it to something we guess.
|
||||
|
||||
$course->enddate = $guessedenddate;
|
||||
|
||||
$updateit = false;
|
||||
if ($course->enddate < $course->startdate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('errorendbeforestart', 'analytics', userdate($course->enddate));
|
||||
} else if ($course->startdate + (YEARSECS + (WEEKSECS * 4)) > $course->enddate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('coursetoolong', 'analytics');
|
||||
} else {
|
||||
$notification .= PHP_EOL . ' ' . get_string('enddate') . ': ' . userdate($course->enddate);
|
||||
$updateit = true;
|
||||
}
|
||||
|
||||
if ($options['update'] && $updateit) {
|
||||
update_course($course);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mtrace($notification);
|
||||
}
|
||||
|
||||
mtrace(get_string('success'));
|
||||
|
||||
exit(0);
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This file defines tasks performed by the tool.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// List of tasks.
|
||||
$tasks = array(
|
||||
array(
|
||||
'classname' => 'tool_analytics\task\train_models',
|
||||
'blocking' => 0,
|
||||
'minute' => '0',
|
||||
'hour' => 'R',
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
array(
|
||||
'classname' => 'tool_analytics\task\predict_models',
|
||||
'blocking' => 0,
|
||||
'minute' => '0',
|
||||
'hour' => 'R',
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
);
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Prediction models tool frontend.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('analyticmodels', '', null, '', array('pagelayout' => 'report'));
|
||||
|
||||
$models = \core_analytics\manager::get_all_models();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$templatable = new \tool_analytics\output\models_list($models);
|
||||
echo $PAGE->get_renderer('tool_analytics')->render($templatable);
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for tool_analytics.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['accuracy'] = 'Accuracy';
|
||||
$string['allpredictions'] = 'All predictions';
|
||||
$string['analysingsitedata'] = 'Analysing the site';
|
||||
$string['analyticmodels'] = 'Analytics models';
|
||||
$string['bettercli'] = 'Evaluating models and generating predictions may involve heavy processing. It is recommended to run these actions from the command line.';
|
||||
$string['cantguessstartdate'] = 'Can\'t guess the start date';
|
||||
$string['cantguessenddate'] = 'Can\'t guess the end date';
|
||||
$string['clearpredictions'] = 'Clear predictions';
|
||||
$string['clearmodelpredictions'] = 'Are you sure you want to clear all "{$a}" predictions?';
|
||||
$string['clienablemodel'] = 'You can enable the model by selecting a time-splitting method by its ID. Note that you can also enable it later using the web interface (\'none\' to exit).';
|
||||
$string['clievaluationandpredictions'] = 'A scheduled task iterates through enabled models and gets predictions. Models evaluation via the web interface is disabled. You can allow these processes to be executed manually via the web interface by disabling the <a href="{$a}">\'onlycli\'</a> analytics setting.';
|
||||
$string['clievaluationandpredictionsnoadmin'] = 'A scheduled task iterates through enabled models and gets predictions. Models evaluation via the web interface is disabled. It may be enabled by a site administrator.';
|
||||
$string['editmodel'] = 'Edit "{$a}" model';
|
||||
$string['edittrainedwarning'] = 'This model has already been trained. Note that changing its indicators or its time-splitting method will delete its previous predictions and start generating new predictions.';
|
||||
$string['enabled'] = 'Enabled';
|
||||
$string['errorcantenablenotimesplitting'] = 'You need to select a time-splitting method before enabling the model';
|
||||
$string['errornoenabledandtrainedmodels'] = 'There are no enabled and trained models to predict.';
|
||||
$string['errornoenabledmodels'] = 'There are no enabled models to train.';
|
||||
$string['errornoexport'] = 'Only trained models can be exported';
|
||||
$string['errornostaticedit'] = 'Models based on assumptions cannot be edited.';
|
||||
$string['errornostaticevaluated'] = 'Models based on assumptions cannot be evaluated. They are always 100% correct according to how they were defined.';
|
||||
$string['errornostaticlog'] = 'Models based on assumptions cannot be evaluated because there is no performance log.';
|
||||
$string['erroronlycli'] = 'Execution only allowed via command line';
|
||||
$string['errortrainingdataexport'] = 'The model training data could not be exported';
|
||||
$string['evaluate'] = 'Evaluate';
|
||||
$string['evaluatemodel'] = 'Evaluate model';
|
||||
$string['evaluationinbatches'] = 'The site contents are calculated and stored in batches. The evaluation process may be stopped at any time. The next time it is run, it will continue from the point when it was stopped.';
|
||||
$string['export'] = 'Export';
|
||||
$string['exporttrainingdata'] = 'Export training data';
|
||||
$string['getpredictionsresultscli'] = 'Results using {$a->name} (id: {$a->id}) course duration splitting';
|
||||
$string['getpredictionsresults'] = 'Results using {$a->name} course duration splitting';
|
||||
$string['extrainfo'] = 'Info';
|
||||
$string['generalerror'] = 'Evaluation error. Status code {$a}';
|
||||
$string['getpredictions'] = 'Get predictions';
|
||||
$string['goodmodel'] = 'This is a good model for using to obtain predictions. Enable it to start obtaining predictions.';
|
||||
$string['indicators'] = 'Indicators';
|
||||
$string['info'] = 'Info';
|
||||
$string['insights'] = 'Insights';
|
||||
$string['invalidanalysables'] = 'Invalid site elements';
|
||||
$string['invalidanalysablesinfo'] = 'This pages lists this site analysable elements that can not be used by this prediction model. The listed elements can not be used neither to train the prediction model nor the prediction model can get predictions for them.';
|
||||
$string['invalidanalysablestable'] = 'Invalid site analysable elements table';
|
||||
$string['invalidprediction'] = 'Invalid to get predictions';
|
||||
$string['invalidtraining'] = 'Invalid to train the model';
|
||||
$string['loginfo'] = 'Log extra info';
|
||||
$string['modelinvalidanalysables'] = 'Invalid analysable elements for "{$a}" model';
|
||||
$string['modelresults'] = '{$a} results';
|
||||
$string['modeltimesplitting'] = 'Time splitting';
|
||||
$string['nextpage'] = 'Next page';
|
||||
$string['nodatatoevaluate'] = 'There is no data to evaluate the model';
|
||||
$string['nodatatopredict'] = 'No new elements to get predictions for';
|
||||
$string['nodatatotrain'] = 'There is no new data that can be used for training';
|
||||
$string['notdefined'] = 'Not yet defined';
|
||||
$string['pluginname'] = 'Analytic models';
|
||||
$string['predictionresults'] = 'Prediction results';
|
||||
$string['predictmodels'] = 'Predict models';
|
||||
$string['predictorresultsin'] = 'Predictor logged information in {$a} directory';
|
||||
$string['predictionprocessfinished'] = 'Prediction process finished';
|
||||
$string['previouspage'] = 'Previous page';
|
||||
$string['samestartdate'] = 'Current start date is good';
|
||||
$string['sameenddate'] = 'Current end date is good';
|
||||
$string['target'] = 'Target';
|
||||
$string['timesplittingnotdefined'] = 'Time splitting is not defined.';
|
||||
$string['timesplittingnotdefined_help'] = 'You need to select a time-splitting method before enabling the model.';
|
||||
$string['trainandpredictmodel'] = 'Training model and calculating predictions';
|
||||
$string['trainingprocessfinished'] = 'Training process finished';
|
||||
$string['trainingresults'] = 'Training results';
|
||||
$string['trainmodels'] = 'Train models';
|
||||
$string['viewlog'] = 'Log';
|
||||
$string['weeksenddateautomaticallyset'] = 'End date automatically set based on start date and the number of sections';
|
||||
$string['weeksenddatedefault'] = 'End date automatically calculated from the course start date.';
|
||||
@@ -1,241 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Model-related actions.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$action = required_param('action', PARAM_ALPHANUMEXT);
|
||||
|
||||
$context = context_system::instance();
|
||||
|
||||
require_login();
|
||||
|
||||
$model = new \core_analytics\model($id);
|
||||
\core_analytics\manager::check_can_manage_models();
|
||||
|
||||
$params = array('id' => $id, 'action' => $action);
|
||||
$url = new \moodle_url('/admin/tool/analytics/model.php', $params);
|
||||
|
||||
switch ($action) {
|
||||
|
||||
case 'edit':
|
||||
$title = get_string('editmodel', 'tool_analytics', $model->get_target()->get_name());
|
||||
break;
|
||||
case 'evaluate':
|
||||
$title = get_string('evaluatemodel', 'tool_analytics');
|
||||
break;
|
||||
case 'getpredictions':
|
||||
$title = get_string('getpredictions', 'tool_analytics');
|
||||
break;
|
||||
case 'log':
|
||||
$title = get_string('viewlog', 'tool_analytics');
|
||||
break;
|
||||
case 'enable':
|
||||
$title = get_string('enable');
|
||||
break;
|
||||
case 'disable':
|
||||
$title = get_string('disable');
|
||||
break;
|
||||
case 'export':
|
||||
$title = get_string('export', 'tool_analytics');
|
||||
break;
|
||||
case 'clear':
|
||||
$title = get_string('clearpredictions', 'tool_analytics');
|
||||
break;
|
||||
case 'invalidanalysables':
|
||||
$title = get_string('invalidanalysables', 'tool_analytics');
|
||||
break;
|
||||
default:
|
||||
throw new moodle_exception('errorunknownaction', 'analytics');
|
||||
}
|
||||
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_pagelayout('report');
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($title);
|
||||
|
||||
$onlycli = get_config('analytics', 'onlycli');
|
||||
if ($onlycli === false) {
|
||||
// Default applied if no config found.
|
||||
$onlycli = 1;
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
|
||||
case 'enable':
|
||||
confirm_sesskey();
|
||||
|
||||
$model->enable();
|
||||
redirect(new \moodle_url('/admin/tool/analytics/index.php'));
|
||||
break;
|
||||
|
||||
case 'disable':
|
||||
confirm_sesskey();
|
||||
|
||||
$model->update(0, false, false);
|
||||
redirect(new \moodle_url('/admin/tool/analytics/index.php'));
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
confirm_sesskey();
|
||||
|
||||
if ($model->is_static()) {
|
||||
echo $OUTPUT->header();
|
||||
throw new moodle_exception('errornostaticedit', 'tool_analytics');
|
||||
}
|
||||
|
||||
$customdata = array(
|
||||
'id' => $model->get_id(),
|
||||
'model' => $model,
|
||||
'indicators' => $model->get_potential_indicators(),
|
||||
'timesplittings' => \core_analytics\manager::get_enabled_time_splitting_methods()
|
||||
);
|
||||
$mform = new \tool_analytics\output\form\edit_model(null, $customdata);
|
||||
|
||||
if ($mform->is_cancelled()) {
|
||||
redirect(new \moodle_url('/admin/tool/analytics/index.php'));
|
||||
|
||||
} else if ($data = $mform->get_data()) {
|
||||
|
||||
// Converting option names to class names.
|
||||
$indicators = array();
|
||||
foreach ($data->indicators as $indicator) {
|
||||
$indicatorclass = \tool_analytics\output\helper::option_to_class($indicator);
|
||||
$indicators[] = \core_analytics\manager::get_indicator($indicatorclass);
|
||||
}
|
||||
$timesplitting = \tool_analytics\output\helper::option_to_class($data->timesplitting);
|
||||
$model->update($data->enabled, $indicators, $timesplitting);
|
||||
redirect(new \moodle_url('/admin/tool/analytics/index.php'));
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$modelobj = $model->get_model_obj();
|
||||
|
||||
$callable = array('\tool_analytics\output\helper', 'class_to_option');
|
||||
$modelobj->indicators = array_map($callable, json_decode($modelobj->indicators));
|
||||
$modelobj->timesplitting = \tool_analytics\output\helper::class_to_option($modelobj->timesplitting);
|
||||
$mform->set_data($modelobj);
|
||||
$mform->display();
|
||||
break;
|
||||
|
||||
case 'evaluate':
|
||||
confirm_sesskey();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($model->is_static()) {
|
||||
throw new moodle_exception('errornostaticevaluate', 'tool_analytics');
|
||||
}
|
||||
|
||||
if ($onlycli) {
|
||||
throw new moodle_exception('erroronlycli', 'tool_analytics');
|
||||
}
|
||||
|
||||
// Web interface is used by people who can not use CLI nor code stuff, always use
|
||||
// cached stuff as they will change the model through the web interface as well
|
||||
// which invalidates the previously analysed stuff.
|
||||
$results = $model->evaluate(array('reuseprevanalysed' => true));
|
||||
$renderer = $PAGE->get_renderer('tool_analytics');
|
||||
echo $renderer->render_evaluate_results($results, $model->get_analyser()->get_logs());
|
||||
break;
|
||||
|
||||
case 'getpredictions':
|
||||
confirm_sesskey();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($onlycli) {
|
||||
throw new moodle_exception('erroronlycli', 'tool_analytics');
|
||||
}
|
||||
|
||||
$trainresults = $model->train();
|
||||
$trainlogs = $model->get_analyser()->get_logs();
|
||||
|
||||
// Looks dumb to get a new instance but better be conservative.
|
||||
$model = new \core_analytics\model($model->get_model_obj());
|
||||
if ($model->is_trained()) {
|
||||
$predictresults = $model->predict();
|
||||
$predictlogs = $model->get_analyser()->get_logs();
|
||||
} else {
|
||||
$predictresults = false;
|
||||
$predictlogs = array();
|
||||
}
|
||||
|
||||
$renderer = $PAGE->get_renderer('tool_analytics');
|
||||
echo $renderer->render_get_predictions_results($trainresults, $trainlogs, $predictresults, $predictlogs);
|
||||
break;
|
||||
|
||||
case 'log':
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($model->is_static()) {
|
||||
throw new moodle_exception('errornostaticlog', 'tool_analytics');
|
||||
}
|
||||
|
||||
$renderer = $PAGE->get_renderer('tool_analytics');
|
||||
$modellogstable = new \tool_analytics\output\model_logs('model-' . $model->get_id(), $model);
|
||||
echo $renderer->render_table($modellogstable);
|
||||
break;
|
||||
|
||||
case 'export':
|
||||
|
||||
if ($model->is_static() || !$model->is_trained()) {
|
||||
throw new moodle_exception('errornoexport', 'tool_analytics');
|
||||
}
|
||||
|
||||
$file = $model->get_training_data();
|
||||
if (!$file) {
|
||||
redirect(new \moodle_url('/admin/tool/analytics/index.php'), get_string('errortrainingdataexport', 'tool_analytics'),
|
||||
null, \core\output\notification::NOTIFY_ERROR);
|
||||
}
|
||||
|
||||
$filename = 'training-data.' . $model->get_id() . '.' . time() . '.csv';
|
||||
send_file($file, $filename, null, 0, false, true);
|
||||
break;
|
||||
|
||||
case 'clear':
|
||||
confirm_sesskey();
|
||||
|
||||
$model->clear();
|
||||
redirect(new \moodle_url('/admin/tool/analytics/index.php'));
|
||||
break;
|
||||
|
||||
case 'invalidanalysables':
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$page = optional_param('page', 0, PARAM_INT);
|
||||
// No option in the UI to change this, only for url hackers ;).
|
||||
$perpage = optional_param('perpage', 10, PARAM_INT);
|
||||
|
||||
$renderable = new \tool_analytics\output\invalid_analysables($model, $page, $perpage);
|
||||
$renderer = $PAGE->get_renderer('tool_analytics');
|
||||
echo $renderer->render($renderable);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Adds settings links to admin tree.
|
||||
*
|
||||
* @package tool_analytics
|
||||
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$ADMIN->add('analytics', new admin_externalpage('analyticmodels', get_string('analyticmodels', 'tool_analytics'),
|
||||
"$CFG->wwwroot/$CFG->admin/tool/analytics/index.php", 'moodle/analytics:managemodels'));
|
||||
@@ -1,78 +0,0 @@
|
||||
{{!
|
||||
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/>.
|
||||
}}
|
||||
{{!
|
||||
@template tool_analytics/invalid_analysables
|
||||
|
||||
Template for invalid analysables.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* none
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"modelname": "Not engaging courses",
|
||||
"analysables": [
|
||||
{
|
||||
"url": "<a href=\"#\">Maths</a>",
|
||||
"validtraining": "Ongoing course",
|
||||
"validprediction": "Not enough students activity"
|
||||
}, {
|
||||
"url": "<a href=\"#\">Psichology</a>",
|
||||
"validtraining": "No students",
|
||||
"validprediction": "No students"
|
||||
}
|
||||
]
|
||||
}
|
||||
}}
|
||||
|
||||
<div class="box">
|
||||
<h3>{{#str}}modelinvalidanalysables, tool_analytics, {{modelname}}{{/str}}</h3>
|
||||
<div>{{#str}}invalidanalysablesinfo, tool_analytics{{/str}}</div>
|
||||
<div class="m-t-2 m-b-1">
|
||||
<span>{{#prev}}{{> core/single_button}}{{/prev}}</span>
|
||||
<span>{{#next}}{{> core/single_button}}{{/next}}</span>
|
||||
</div>
|
||||
<table class="generaltable fullwidth">
|
||||
<caption class="accesshide">{{#str}}invalidanalysablestable, tool_analytics{{/str}}</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{#str}}name{{/str}}</th>
|
||||
<th scope="col">{{#str}}invalidtraining, tool_analytics{{/str}}</th>
|
||||
<th scope="col">{{#str}}invalidprediction, tool_analytics{{/str}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#analysables}}
|
||||
<tr>
|
||||
<td>{{{url}}}</td>
|
||||
<td>{{validtraining}}</td>
|
||||
<td>{{validprediction}}</td>
|
||||
</tr>
|
||||
{{/analysables}}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="m-t-1 m-b-2">
|
||||
<span>{{#prev}}{{> core/single_button}}{{/prev}}</span>
|
||||
<span>{{#next}}{{> core/single_button}}{{/next}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,186 +0,0 @@
|
||||
{{!
|
||||
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/>.
|
||||
}}
|
||||
{{!
|
||||
@template tool_analytics/models_list
|
||||
|
||||
Template for models list.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* none
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"target": "Prevent devs at risk",
|
||||
"targethelp": [
|
||||
{
|
||||
"title": "Help with something",
|
||||
"url": "http://example.org/help",
|
||||
"linktext": "",
|
||||
"icon":{
|
||||
"extraclasses": "iconhelp",
|
||||
"attributes": [
|
||||
{"name": "src", "value": "../../../pix/help.svg"},
|
||||
{"name": "alt", "value": "Help icon"}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"enabled": 1,
|
||||
"indicators": [{
|
||||
"name": "Indicator 1",
|
||||
"help": [{
|
||||
"title": "Help with something",
|
||||
"url": "http://example.org/help",
|
||||
"linktext": "",
|
||||
"icon":{
|
||||
"extraclasses": "iconhelp",
|
||||
"attributes": [
|
||||
{"name": "src", "value": "../../../pix/help.svg"},
|
||||
{"name": "alt", "value": "Help icon"}
|
||||
]
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "Indicator 2",
|
||||
"help": [{
|
||||
"title": "Help with something",
|
||||
"url": "http://example.org/help",
|
||||
"linktext": "",
|
||||
"icon":{
|
||||
"extraclasses": "iconhelp",
|
||||
"attributes": [
|
||||
{"name": "src", "value": "../../../pix/help.svg"},
|
||||
{"name": "alt", "value": "Help icon"}
|
||||
]
|
||||
}
|
||||
}]
|
||||
}],
|
||||
"timesplitting": "Quarters",
|
||||
"timesplittinghelp": [
|
||||
{
|
||||
"title": "Help with something",
|
||||
"url": "http://example.org/help",
|
||||
"linktext": "",
|
||||
"icon":{
|
||||
"extraclasses": "iconhelp",
|
||||
"attributes": [
|
||||
{"name": "src", "value": "../../../pix/help.svg"},
|
||||
{"name": "alt", "value": "Help icon"}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"noinsights": "No insights available yet"
|
||||
}
|
||||
],
|
||||
"warnings": {
|
||||
"message": "Hey, this is a warning"
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
{{#warnings}}
|
||||
{{> core/notification_warning}}
|
||||
{{/warnings}}
|
||||
{{#infos}}
|
||||
{{> core/notification_info}}
|
||||
{{/infos}}
|
||||
|
||||
<div class="box">
|
||||
<table class="generaltable fullwidth">
|
||||
<caption>{{#str}}analyticmodels, tool_analytics{{/str}}</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{#str}}target, tool_analytics{{/str}}</th>
|
||||
<th scope="col">{{#str}}enabled, tool_analytics{{/str}}</th>
|
||||
<th scope="col">{{#str}}indicators, tool_analytics{{/str}}</th>
|
||||
<th scope="col">{{#str}}modeltimesplitting, tool_analytics{{/str}}</th>
|
||||
<th scope="col">{{#str}}insights, tool_analytics{{/str}}</th>
|
||||
<th scope="col">{{#str}}actions{{/str}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#models}}
|
||||
<tr>
|
||||
<td>
|
||||
<span class="target-name">{{target}}</span>
|
||||
{{#targethelp}}
|
||||
{{>core/help_icon}}
|
||||
{{/targethelp}}
|
||||
</td>
|
||||
<td>
|
||||
{{#enabled}}
|
||||
{{#pix}}i/checked, core, {{#str}}yes{{/str}}{{/pix}}
|
||||
{{/enabled}}
|
||||
{{^enabled}}
|
||||
{{#str}}no{{/str}}
|
||||
{{/enabled}}
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
{{#indicators}}
|
||||
<li>
|
||||
{{name}}
|
||||
{{#help}}
|
||||
{{>core/help_icon}}
|
||||
{{/help}}
|
||||
</li>
|
||||
{{/indicators}}
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
{{#timesplitting}}
|
||||
{{timesplitting}}
|
||||
{{#timesplittinghelp}}
|
||||
{{>core/help_icon}}
|
||||
{{/timesplittinghelp}}
|
||||
{{/timesplitting}}
|
||||
{{^timesplitting}}
|
||||
{{#str}}notdefined, tool_analytics{{/str}}
|
||||
{{#timesplittinghelp}}
|
||||
{{>core/help_icon}}
|
||||
{{/timesplittinghelp}}
|
||||
{{/timesplitting}}
|
||||
</td>
|
||||
<td>
|
||||
{{! models_list renderer is responsible of sending one or the other}}
|
||||
{{#insights}}
|
||||
{{> core/single_select }}
|
||||
{{/insights}}
|
||||
{{#noinsights}}
|
||||
{{.}}
|
||||
{{/noinsights}}
|
||||
</td>
|
||||
<td>
|
||||
{{#actions}}
|
||||
{{> core/action_menu}}
|
||||
{{/actions}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/models}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2017111300;
|
||||
$plugin->requires = 2017110800;
|
||||
$plugin->version = 2016120500;
|
||||
$plugin->requires = 2016112900;
|
||||
$plugin->component = 'tool_assignmentupgrade';
|
||||
$plugin->dependencies = array('mod_assign' => 2017110800);
|
||||
$plugin->dependencies = array('mod_assign' => 2016112900);
|
||||
|
||||
@@ -103,9 +103,18 @@ foreach ($plugins as $plugin => $name) {
|
||||
|
||||
// Make enable control. This is a POST request (using a form control rather
|
||||
// than just a link) because it makes a database change.
|
||||
$params = array('sesskey' => sesskey(), 'plugin' => $plugin, 'action' => $enabledaction);
|
||||
$url = new moodle_url('/' . $CFG->admin . '/tool/availabilityconditions/', $params);
|
||||
$enablecontrol = html_writer::link($url, $OUTPUT->pix_icon('t/' . $enabledaction, $enabledstr));
|
||||
$enablecontrol = html_writer::tag('form', html_writer::div(
|
||||
html_writer::empty_tag('input', array('type' => 'hidden',
|
||||
'name' => 'sesskey', 'value' => sesskey())) .
|
||||
html_writer::empty_tag('input', array('type' => 'hidden',
|
||||
'name' => 'plugin', 'value' => $plugin)) .
|
||||
html_writer::empty_tag('input', array('type' => 'hidden',
|
||||
'name' => 'action', 'value' => $enabledaction)) .
|
||||
html_writer::empty_tag('input', array('type' => 'image',
|
||||
'src' => $OUTPUT->pix_url('t/' . $enabledaction), 'alt' => $enabledstr,
|
||||
'title' => $enabledstr))
|
||||
), array(
|
||||
'method' => 'post', 'action' => './'));
|
||||
|
||||
$table->add_data(array($namespan, $version, $enablecontrol));
|
||||
}
|
||||
|
||||
@@ -37,19 +37,21 @@ Feature: Manage availability conditions
|
||||
When I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions"
|
||||
|
||||
# Check the icon is there (it should be a Hide icon, meaning is currently visible).
|
||||
Then "Hide" "icon" should exist in the "Restriction by date" "table_row"
|
||||
Then "input[title=Hide]" "css_element" should exist in the "Restriction by date" "table_row"
|
||||
|
||||
# Click the icon. It should toggle to hidden (title=Show).
|
||||
And I click on "Hide" "icon" in the "Restriction by date" "table_row"
|
||||
And "Show" "icon" should exist in the "Restriction by date" "table_row"
|
||||
And I click on "input[title=Hide]" "css_element" in the "Restriction by date" "table_row"
|
||||
And "input[title=Show]" "css_element" should exist in the "Restriction by date" "table_row"
|
||||
|
||||
# Toggle it back to visible (title=Hide).
|
||||
And I click on "Show" "icon" in the "Restriction by date" "table_row"
|
||||
And "Hide" "icon" should exist in the "Restriction by date" "table_row"
|
||||
And I click on "input[title=Show]" "css_element" in the "Restriction by date" "table_row"
|
||||
And "input[title=Hide]" "css_element" should exist in the "Restriction by date" "table_row"
|
||||
|
||||
# OK, toggling works. Set the grade one to Hide and we'll go see if it actually worked.
|
||||
And I click on "Hide" "icon" in the "Restriction by grade" "table_row"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I click on "input[title=Hide]" "css_element" in the "Restriction by grade" "table_row"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2017111300;
|
||||
$plugin->requires = 2017110800;
|
||||
$plugin->version = 2016120500;
|
||||
$plugin->requires = 2016112900;
|
||||
$plugin->component = 'tool_availabilityconditions';
|
||||
|
||||
@@ -325,7 +325,6 @@ if ($verbose || $status) {
|
||||
}
|
||||
|
||||
// Update status after auto-rerun finished.
|
||||
$status = 0;
|
||||
foreach ($exitcodes as $name => $exitcode) {
|
||||
if ($exitcode) {
|
||||
if (!empty($parallelrun)) {
|
||||
|
||||
@@ -398,7 +398,7 @@ function print_combined_install_output($processes) {
|
||||
// Show process name in first row.
|
||||
foreach ($processes as $name => $process) {
|
||||
// If we don't have enough space to show full run name then show runX.
|
||||
if ($lengthofprocessline < strlen($name) + 2) {
|
||||
if ($lengthofprocessline < strlen($name + 2)) {
|
||||
$name = substr($name, -5);
|
||||
}
|
||||
// One extra padding as we are adding | separator for rest of the data.
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/behat/classes/behat_selectors.php');
|
||||
|
||||
/**
|
||||
* Renderer for behat tool web features
|
||||
*
|
||||
@@ -41,8 +44,6 @@ class tool_behat_renderer extends plugin_renderer_base {
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function render_stepsdefinitions($stepsdefinitions, $form) {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/behat/classes/behat_selectors.php');
|
||||
|
||||
$html = $this->generic_info();
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ Feature: Set up contextual data for tests
|
||||
| Grouping 1 | C1 | GG1 |
|
||||
| Grouping 2 | C1 | GG2 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Users > Groups" in current page administration
|
||||
Then I should see "Group 1"
|
||||
And I should see "Group 2"
|
||||
@@ -86,7 +87,8 @@ Feature: Set up contextual data for tests
|
||||
| mod/forum:editanypost | Allow | student | Course | C1 |
|
||||
| mod/forum:replynews | Prevent | editingteacher | Course | C1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Users > Permissions" in current page administration
|
||||
And I set the field "Advanced role override" to "Student (1)"
|
||||
Then "mod/forum:editanypost" capability has "Allow" permission
|
||||
@@ -106,7 +108,7 @@ Feature: Set up contextual data for tests
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Course 1"
|
||||
Then I should see "Topic 1"
|
||||
|
||||
Scenario: Add role assigns
|
||||
@@ -142,20 +144,24 @@ Feature: Set up contextual data for tests
|
||||
Then "Edit settings" "link" should exist in current page administration
|
||||
And I log out
|
||||
And I log in as "user2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And "Turn editing on" "link" should exist in current page administration
|
||||
And I log out
|
||||
And I log in as "user3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And "Turn editing on" "link" should exist in current page administration
|
||||
And I log out
|
||||
And I log in as "user4"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And "Turn editing on" "link" should exist in current page administration
|
||||
And I log out
|
||||
And I log in as "user5"
|
||||
And I should see "You are logged in as"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I should see "You can not enrol yourself in this course."
|
||||
|
||||
Scenario: Add modules
|
||||
@@ -193,7 +199,8 @@ Feature: Set up contextual data for tests
|
||||
| activity | name | intro | course | idnumber | grade |
|
||||
| assign | Test assignment name with scale | Test assignment description | C1 | assign1 | Test Scale 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
Then I should see "Test assignment name"
|
||||
# Assignment 2.2 module type is disabled by default
|
||||
# And I should see "Test assignment22 name"
|
||||
@@ -221,7 +228,7 @@ Feature: Set up contextual data for tests
|
||||
And I should see "Test workshop name"
|
||||
And I follow "Test assignment name"
|
||||
And I should see "Test assignment description"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "C1"
|
||||
And I follow "Test assignment name with scale"
|
||||
And I follow "Edit settings"
|
||||
And the field "Type" matches value "Scale"
|
||||
@@ -254,7 +261,8 @@ Feature: Set up contextual data for tests
|
||||
| grouping | group |
|
||||
| GG1 | G1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Users > Groups" in current page administration
|
||||
Then the "groups" select box should contain "Group 1 (1)"
|
||||
And the "groups" select box should contain "Group 2 (1)"
|
||||
@@ -312,7 +320,8 @@ Feature: Set up contextual data for tests
|
||||
| fullname | course | gradecategory |
|
||||
| Grade sub category 2 | C1 | Grade category 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on course index
|
||||
And I follow "Course 1"
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
Then I should see "Grade category 1"
|
||||
And I should see "Grade sub category 2"
|
||||
@@ -335,7 +344,8 @@ Feature: Set up contextual data for tests
|
||||
| Test Grade Item 2 | C1 | Grade category 1 |
|
||||
| Test Grade Item 3 | C1 | Grade sub category 2 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
Then I should see "Test Grade Item 1"
|
||||
And I follow "Edit Test Grade Item 1"
|
||||
@@ -363,7 +373,8 @@ Feature: Set up contextual data for tests
|
||||
| name | scale |
|
||||
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Scales" in the course gradebook
|
||||
Then I should see "Test Scale 1"
|
||||
And I should see "Disappointing, Good, Very good, Excellent"
|
||||
@@ -384,7 +395,8 @@ Feature: Set up contextual data for tests
|
||||
And the following config values are set as admin:
|
||||
| enableoutcomes | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I follow "Outcomes"
|
||||
Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
|
||||
And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
|
||||
@@ -412,7 +424,8 @@ Feature: Set up contextual data for tests
|
||||
And the following config values are set as admin:
|
||||
| enableoutcomes | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
Then I should see "Test Outcome Grade Item 1"
|
||||
And I follow "Edit Test Outcome Grade Item 1"
|
||||
@@ -429,5 +442,6 @@ Feature: Set up contextual data for tests
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| online_users | Course | C1 | course-view-* | site-pre |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
Then I should see "Online users"
|
||||
|
||||
@@ -19,7 +19,7 @@ Feature: Transform date time string arguments
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Course 1"
|
||||
And I follow "Test assignment name"
|
||||
And I should see "##yesterday##l, j F Y##"
|
||||
And I log out
|
||||
|
||||
@@ -31,7 +31,7 @@ Feature: Edit capabilities
|
||||
|
||||
Scenario: Course capabilities overrides
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Users > Permissions" in current page administration
|
||||
And I override the system permissions of "Student" role with:
|
||||
| mod/forum:deleteanypost | Prohibit |
|
||||
@@ -45,7 +45,8 @@ Feature: Edit capabilities
|
||||
|
||||
Scenario: Module capabilities overrides
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | I'm the name |
|
||||
| Description | I'm the introduction |
|
||||
|
||||
@@ -33,7 +33,8 @@ Feature: Verify that all form fields values can be get and set
|
||||
| activity | course | idnumber | name | intro | firstpagetitle | wikimode | visible |
|
||||
| wiki | C1 | wiki1 | Test this one | Test this one | Test this one | collaborative | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Reset" node in "Course administration"
|
||||
# Select (multi-select) - Checking "the select box should contain".
|
||||
And I expand all fieldsets
|
||||
@@ -47,7 +48,9 @@ Feature: Verify that all form fields values can be get and set
|
||||
And the "Unenrol users" select box should not contain "President"
|
||||
And the "Unenrol users" select box should not contain "Baker"
|
||||
And the "Unenrol users" select box should not contain "President, Baker"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I follow "Test this one"
|
||||
And I press "Create page"
|
||||
# Text (textarea & editor) & Select (multi-select) - Checking "I set the following fields to these values".
|
||||
@@ -58,51 +61,30 @@ Feature: Verify that all form fields values can be get and set
|
||||
# Select (multi-select) - Checking "I set the field".
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
# Checkbox - Checking "I set the field" and "The field matches value" ticked.
|
||||
And I set the field "Force format" to "1"
|
||||
# Checkbox - Checking "I set the field".
|
||||
And I set the field "Display description on course page" to "1"
|
||||
# Checkbox - Checking "I set the following fields to these values:".
|
||||
And I set the following fields to these values:
|
||||
| Force format | 1 |
|
||||
# Checkbox - Checking "the field matches value" and "the field does not match value".
|
||||
And the field "Display description on course page" matches value "1"
|
||||
And the field "Display description on course page" does not match value ""
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
# Checkbox - Checking "the field matches value" and "the following fields match these values".
|
||||
And the following fields match these values:
|
||||
| Display description on course page | 1 |
|
||||
| Default format | HTML |
|
||||
| Wiki name | Test this one |
|
||||
And the field "Force format" matches value "1"
|
||||
And the field "Force format" does not match value ""
|
||||
# Checkbox - Checking "I set the field" and "The field matches value" unticked.
|
||||
And I set the field "Force format" to ""
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And the field "Force format" matches value ""
|
||||
And the field "Force format" does not match value "1"
|
||||
# Checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" ticked.
|
||||
And I set the following fields to these values:
|
||||
| Force format | 1 |
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And the following fields match these values:
|
||||
| Force format | 1 |
|
||||
And the following fields do not match these values:
|
||||
| Force format | |
|
||||
# Checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" unticked.
|
||||
And I set the following fields to these values:
|
||||
| Force format | |
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And the following fields match these values:
|
||||
| Force format | |
|
||||
And the following fields do not match these values:
|
||||
| Force format | 1 |
|
||||
# Select (simple) - Checking "I set the following fields to these values:".
|
||||
And I set the following fields to these values:
|
||||
| Default format | NWiki |
|
||||
| Display description on course page | |
|
||||
# Checkbox - Checking "I set the field" to uncheck.
|
||||
And I set the field "Force format" to ""
|
||||
# Select (simple) - Checking "I set the field".
|
||||
And I set the field "Group mode" to "Separate groups"
|
||||
And I press "Save and display"
|
||||
@@ -110,12 +92,15 @@ Feature: Verify that all form fields values can be get and set
|
||||
And the following fields match these values:
|
||||
| Default format | NWiki |
|
||||
| Group mode | Separate groups |
|
||||
| Display description on course page | |
|
||||
| Force format | |
|
||||
# All fields - Checking "the following fields do not match these values".
|
||||
And the following fields do not match these values:
|
||||
| Wiki name | Test this one baby |
|
||||
| Default format | HTML |
|
||||
| Force format | 1 |
|
||||
And I press "Cancel"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Course 1"
|
||||
# Radio - Checking "I set the field" and "the field matches value".
|
||||
And I add a "Choice" to section "1" and I fill the form with:
|
||||
| Choice name | Test choice name |
|
||||
@@ -130,7 +115,8 @@ Feature: Verify that all form fields values can be get and set
|
||||
And the field "one" matches value "1"
|
||||
And the field "two" matches value ""
|
||||
# Check if field xpath set/match works.
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Edit settings" node in "Course administration"
|
||||
And I set the field with xpath "//input[@id='id_idnumber']" to "Course id number"
|
||||
And the field with xpath "//input[@name='idnumber']" matches value "Course id number"
|
||||
@@ -139,11 +125,12 @@ Feature: Verify that all form fields values can be get and set
|
||||
And I navigate to "Edit settings" node in "Course administration"
|
||||
And the field "Course ID number" matches value "Course id number"
|
||||
|
||||
|
||||
Scenario: with JS disabled all form fields getters and setters works as expected
|
||||
|
||||
@javascript
|
||||
Scenario: with JS enabled all form fields getters and setters works as expected
|
||||
Then I am on "Course 1" course homepage
|
||||
Then I follow "Course 1"
|
||||
And I navigate to "Users > Groups" in current page administration
|
||||
# Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain".
|
||||
And I set the field "groups" to "Group 2"
|
||||
@@ -155,7 +142,7 @@ Feature: Verify that all form fields values can be get and set
|
||||
And the "members" select box should contain "Student 2"
|
||||
And the "members" select box should not contain "Student 3"
|
||||
# Checkbox (AJAX) - Checking "I set the field" and "I set the following fields to these values".
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Course 1"
|
||||
And I add a "Lesson" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | Test lesson |
|
||||
@@ -172,45 +159,3 @@ Feature: Verify that all form fields values can be get and set
|
||||
And the "available[day]" "field" should be enabled
|
||||
And the field "deadline[enabled]" matches value "1"
|
||||
And I press "Cancel"
|
||||
# Advanced checkbox requires real browser to allow uncheck to work. MDL-58681. MDL-55386.
|
||||
# Advanced checkbox - Checking "I set the field" and "The field matches value" ticked.
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I set the field "Display description on course page" to "1"
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And the field "Display description on course page" matches value "1"
|
||||
And the field "Display description on course page" does not match value ""
|
||||
# Advanced checkbox - Checking "I set the field" and "The field matches value" unticked.
|
||||
And I set the field "Display description on course page" to ""
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And the field "Display description on course page" matches value ""
|
||||
And the field "Display description on course page" does not match value "1"
|
||||
# Advanced checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" ticked.
|
||||
And I set the following fields to these values:
|
||||
| Display description on course page | 1 |
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And the following fields match these values:
|
||||
| Display description on course page | 1 |
|
||||
And the following fields do not match these values:
|
||||
| Display description on course page | |
|
||||
# Advanced checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" unticked.
|
||||
And I set the following fields to these values:
|
||||
| Display description on course page | |
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And the following fields match these values:
|
||||
| Display description on course page | |
|
||||
And the following fields do not match these values:
|
||||
| Display description on course page | 1 |
|
||||
|
||||
@@ -26,3 +26,4 @@ Feature: List the system steps definitions
|
||||
Given I set the field "Contains" to "homepage"
|
||||
When I press "Filter"
|
||||
Then I should see "Opens Moodle homepage."
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@ Feature: Forms manipulation
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Quiz" to section "1"
|
||||
When I expand all fieldsets
|
||||
Then I should see "Close the quiz"
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2017111300; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2017110800; // Requires this Moodle version
|
||||
$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2016112900; // Requires this Moodle version
|
||||
$plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2017111300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2017110800; // Requires this Moodle version.
|
||||
$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016112900; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -149,13 +149,13 @@ class api {
|
||||
// We build an better structure to loop on.
|
||||
$info = array();
|
||||
foreach ($all as $cra) {
|
||||
if (!isset($info[$cra->get('userid')])) {
|
||||
$info[$cra->get('userid')] = array();
|
||||
if (!isset($info[$cra->get_userid()])) {
|
||||
$info[$cra->get_userid()] = array();
|
||||
}
|
||||
if (!isset($info[$cra->get('userid')][$cra->get('roleid')])) {
|
||||
$info[$cra->get('userid')][$cra->get('roleid')] = array();
|
||||
if (!isset($info[$cra->get_userid()][$cra->get_roleid()])) {
|
||||
$info[$cra->get_userid()][$cra->get_roleid()] = array();
|
||||
}
|
||||
array_push($info[$cra->get('userid')][$cra->get('roleid')], $cra->get('cohortid'));
|
||||
array_push($info[$cra->get_userid()][$cra->get_roleid()], $cra->get_cohortid());
|
||||
}
|
||||
// Then for each user+role combo - find user context in the cohort without a role assigned.
|
||||
|
||||
@@ -167,7 +167,7 @@ class api {
|
||||
$params['roleid'] = $roleid;
|
||||
$params['userid'] = $userid;
|
||||
|
||||
$sql = 'SELECT DISTINCT u.id AS userid, ra.id, ctx.id AS contextid
|
||||
$sql = 'SELECT u.id AS userid, ra.id, ctx.id AS contextid
|
||||
FROM {user} u
|
||||
JOIN {cohort_members} cm ON u.id = cm.userid
|
||||
JOIN {context} ctx ON u.id = ctx.instanceid AND ctx.contextlevel = :usercontext
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user