Compare commits
640 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 257135e58e | |||
| 8ee5b976b1 | |||
| f9e1d25dbb | |||
| 676fff3fa1 | |||
| 6d558e7705 | |||
| 5ed143ccb7 | |||
| 79c4ecf30d | |||
| 47ee4d187f | |||
| deacd770bd | |||
| f9c229e1fa | |||
| 4dd49f4cac | |||
| 288a3b29a6 | |||
| 51e0609e4a | |||
| 54add7c3fa | |||
| 3e52ba108f | |||
| c22b20d440 | |||
| f133092053 | |||
| f8915b7b86 | |||
| 1f45a91137 | |||
| 15b9c8e9c6 | |||
| 5929c001fa | |||
| 5459e76dd1 | |||
| 182951c6ad | |||
| b8d7ecaa48 | |||
| 69df27c838 | |||
| d033b12887 | |||
| 7b9797028e | |||
| f544529f07 | |||
| a27c35d11f | |||
| dac27854a6 | |||
| 02941fdb0d | |||
| f465c19005 | |||
| 26f8490b91 | |||
| 17ba97e5be | |||
| 9bf18ccaad | |||
| 2b7cefa2f5 | |||
| dcb7585070 | |||
| ec252f75e7 | |||
| 09da7e96ce | |||
| 55e6d86a31 | |||
| f73ccb88fd | |||
| 1f5f68c810 | |||
| cf6e1ae752 | |||
| eaba242517 | |||
| 8c392d1855 | |||
| 9330cd063e | |||
| 4b682a44bc | |||
| 84971b914d | |||
| 64da683140 | |||
| 92145339d6 | |||
| 561020d00b | |||
| 622ba79b53 | |||
| 73f67f3e9b | |||
| 9208e5ed5e | |||
| ead8c49a45 | |||
| 7eba4674c1 | |||
| 57b2fa96d4 | |||
| 76c9f22f9e | |||
| b270b641f6 | |||
| 32409b67e3 | |||
| 2775026ffc | |||
| e892678aee | |||
| e228270611 | |||
| bddfa51dcf | |||
| 0f7b1a996a | |||
| c8554869ea | |||
| 56063d6f63 | |||
| 84011efb0d | |||
| 3e20548f1f | |||
| c917a13b47 | |||
| de7092fe1f | |||
| f7e5d9235b | |||
| 826e1aa33c | |||
| 4a7ab3c0fc | |||
| 2b98208b2c | |||
| bb4cf8d719 | |||
| 62adf3a036 | |||
| 8a7b41f2a6 | |||
| 8d1e5fdf4a | |||
| 4d93b2059f | |||
| a8adf25d11 | |||
| 55d5661bbc | |||
| 08df518104 | |||
| 56ed03a328 | |||
| 85f530cf0d | |||
| 6d8f205529 | |||
| b533531d9f | |||
| c2d4c1661a | |||
| 58693ff7a6 | |||
| 59fa78efa4 | |||
| 199be8868e | |||
| 426e269e58 | |||
| 3587b8dc5d | |||
| a762409317 | |||
| 291542b8ef | |||
| dd4b038bbf | |||
| 639f910c5f | |||
| 6367a8fa61 | |||
| f484cb3e30 | |||
| edd82b3a50 | |||
| b1807d5b43 | |||
| 76561f1e4e | |||
| 4dadad0869 | |||
| 8a66b47903 | |||
| a5f92356ae | |||
| ef489b88fe | |||
| 1ab9b8062f | |||
| c0c2459bed | |||
| 279929dd13 | |||
| 3786d95b19 | |||
| e9a71201b0 | |||
| 30a8ac9187 | |||
| 89ba2009a9 | |||
| 8993cd4d22 | |||
| 5c66ab35a3 | |||
| c7735da110 | |||
| 46697d1290 | |||
| 9d4b3666bb | |||
| 61b7eaffa7 | |||
| 0a4b736b9c | |||
| 5953ae1d30 | |||
| 8bcf4b5749 | |||
| efb9ebe76b | |||
| ccf90bf6cb | |||
| f7452149f8 | |||
| e9af57fc49 | |||
| 26dd61268e | |||
| f5b31df037 | |||
| 565ec4b9cb | |||
| ee92868003 | |||
| 53bf4729a0 | |||
| d58832a876 | |||
| 004179e48b | |||
| 799f8e0888 | |||
| 9dfb4d5e50 | |||
| 035d0f2edd | |||
| 514cda9cd7 | |||
| e06d7b43a0 | |||
| 726b471179 | |||
| 8e3264e21e | |||
| a102b48b2f | |||
| 8dba124a13 | |||
| 63f3e269ca | |||
| 94e4101a68 | |||
| 7f6c2d125d | |||
| 04a2ac065b | |||
| 4706907460 | |||
| d3e2e7e029 | |||
| 115cc42f87 | |||
| 2df591c3d5 | |||
| 38e7721a31 | |||
| f50ea0419e | |||
| 9218ade3ad | |||
| 2d40241c54 | |||
| b3640ec473 | |||
| c88a1f767e | |||
| 62f8381ff4 | |||
| 3545a15cfe | |||
| 661cf3677b | |||
| ed57b962ae | |||
| 0ef4abab04 | |||
| 7690817ffe | |||
| a025a96009 | |||
| b78d7c8ab0 | |||
| 7bfea4b502 | |||
| c3c76e6dc1 | |||
| 2d178e2222 | |||
| e6e4a19712 | |||
| c8b0aa2ff4 | |||
| 3e3281e82d | |||
| 593257a5ae | |||
| 066e898965 | |||
| 9568417f5f | |||
| df87462018 | |||
| 1ec7f48dbe | |||
| 7f541b07b2 | |||
| b3cdd9feb8 | |||
| fcaf521542 | |||
| 0e9e95a9f6 | |||
| 4f7212a44c | |||
| 650bb34fec | |||
| 349442efda | |||
| c3867d3188 | |||
| 69f471111c | |||
| 65db12fec4 | |||
| 4c26a3a865 | |||
| c5c1cd38a2 | |||
| 1057f66755 | |||
| f6b50c9286 | |||
| 9ec826a37a | |||
| 656925c007 | |||
| 80aafa81c2 | |||
| 5e150ff30f | |||
| 2289c2acde | |||
| 9ff9dc4a68 | |||
| 4978b2536c | |||
| 99b9115cff | |||
| a9dcd3fdb0 | |||
| dcaea5dc4f | |||
| f59ae74693 | |||
| 0f40532941 | |||
| 0140fcfc52 | |||
| 6f64d57154 | |||
| 70eb37b3fb | |||
| e35df1c80f | |||
| 0e93a4d60f | |||
| 07052301c3 | |||
| 59ae7c2a84 | |||
| 9846a7f090 | |||
| 81d2e45981 | |||
| 56788d24dd | |||
| 05f337cc5f | |||
| 6e0246e439 | |||
| 6385bf7185 | |||
| 53a810db85 | |||
| 62903322fc | |||
| dc63f8d03e | |||
| 8ebc88c4d9 | |||
| aa8c2e48bd | |||
| d626d3e470 | |||
| 64c63e6cbb | |||
| 621d9afe46 | |||
| 8bd76ea422 | |||
| f909dd7612 | |||
| e9bc93157c | |||
| 063bc73658 | |||
| 6190487787 | |||
| 158f3cb65f | |||
| e2f570a23a | |||
| 46e6e31b52 | |||
| 1afd70b2ac | |||
| bc6a100181 | |||
| c2b23ae47b | |||
| 6f94958749 | |||
| 897fa24950 | |||
| cd1ea5d656 | |||
| 06748958c5 | |||
| 2536c32b3e | |||
| bd1f93687d | |||
| 5ec6beffd6 | |||
| ed6a79d869 | |||
| b5cae06cd4 | |||
| a17fcb7b53 | |||
| 39a631bbe6 | |||
| a383e8db65 | |||
| e7e67de957 | |||
| 43fd59ea14 | |||
| bf088b3423 | |||
| b944b6c678 | |||
| e535262042 | |||
| dd48008c77 | |||
| 4eb5e15641 | |||
| 0e18d41b3b | |||
| fbd941aa94 | |||
| 9c40410a22 | |||
| 096cbd68a9 | |||
| e426c25127 | |||
| 3982f34f2c | |||
| 20b4684483 | |||
| c1c0d58867 | |||
| a3ba7fb4a7 | |||
| ab1b3440f2 | |||
| e2f5bc4700 | |||
| b264f0f0f4 | |||
| eef19f3eaa | |||
| fab7a109e2 | |||
| 58d75e5b3b | |||
| 81d57c26db | |||
| c4cf048ba7 | |||
| 94a87681a6 | |||
| 7fb9c3d85c | |||
| ce261c444d | |||
| cb09ed7ecb | |||
| c61ab3b6af | |||
| a4328b8f04 | |||
| dbd0d6062c | |||
| cee781ba9e | |||
| ba583fc1ec | |||
| f7503b9e66 | |||
| f58259c790 | |||
| bbb5b1aeaa | |||
| e9672d50de | |||
| d4d468ad37 | |||
| c572230139 | |||
| 64792d5d0b | |||
| 8c3185f763 | |||
| 690a7660ca | |||
| 3b938296a8 | |||
| 0325c08ea7 | |||
| 68dbc90489 | |||
| 9c55e9c0f7 | |||
| 61eed5acf7 | |||
| 5a7b40f684 | |||
| d5f343427d | |||
| 901dd449d6 | |||
| 3b94f1111a | |||
| 959e46857d | |||
| ff7eba4d78 | |||
| 94f638e915 | |||
| 425f43d8f3 | |||
| 08ca102966 | |||
| d76f87a94f | |||
| 7d8cede29c | |||
| 2ccfd7509d | |||
| 44659da943 | |||
| 6ab0935e93 | |||
| 582d4d91a0 | |||
| fca567dee4 | |||
| 3e3ae23846 | |||
| 5d850ce66e | |||
| 077f41dc19 | |||
| c32a9ec8cd | |||
| 9afbbd3834 | |||
| 3cc5c930cb | |||
| 601cd4ebd7 | |||
| 04019ee089 | |||
| d0c227d966 | |||
| 4ad2527e2e | |||
| 8a8a4a843d | |||
| 398e230331 | |||
| 65a2e5fe0e | |||
| 6c00930560 | |||
| 1a7f4d16c5 | |||
| 5934fe5d94 | |||
| d5e0549053 | |||
| de21347f57 | |||
| 5923607efe | |||
| 98c7487e6f | |||
| bb3ca655f7 | |||
| 29c374090b | |||
| 46055853d5 | |||
| 4cb35863d0 | |||
| a55516bfa4 | |||
| ec27b03b55 | |||
| 5e1ad59a07 | |||
| 07740e4f85 | |||
| 407faffcaf | |||
| 455d145b38 | |||
| 1c43ecde9c | |||
| b16c535b11 | |||
| 1119cfaf3f | |||
| 1d919f4c09 | |||
| 2debdc6b36 | |||
| 0bcda53a17 | |||
| 060ed3e43e | |||
| e1dea25400 | |||
| 451e2115fb | |||
| 9118464db9 | |||
| 20779888d0 | |||
| b494a7a518 | |||
| 26605cb7da | |||
| c0b6790784 | |||
| 5a68444794 | |||
| a058f40d19 | |||
| c9275385f8 | |||
| 0e96ba879d | |||
| d69c38ed33 | |||
| 10aee1921d | |||
| a77c773d85 | |||
| 6b966ac672 | |||
| 6683493bfe | |||
| 407cd995c7 | |||
| 7cad9118a7 | |||
| 2c23f4d946 | |||
| 2c6ad02fe8 | |||
| e1d1889bab | |||
| aba7ba077d | |||
| c3e9985a8c | |||
| edb3ed1ebb | |||
| 10369c9c5b | |||
| aeb4bd9ce5 | |||
| 42dc4cad26 | |||
| 8fbc973901 | |||
| 6a77e4cc89 | |||
| 9d597e5f0f | |||
| df0dcdcd82 | |||
| d236997758 | |||
| c14ee7225b | |||
| fc11c6512d | |||
| f64afbb455 | |||
| 355efd43c7 | |||
| c43b904d33 | |||
| 600bbd40ab | |||
| 1087d15324 | |||
| f446045c73 | |||
| d6436ff003 | |||
| d1a54306ea | |||
| 832c5b2f31 | |||
| 47c2387cf2 | |||
| 1407c22310 | |||
| 9ad1d1bbd5 | |||
| 7fe85994a6 | |||
| 0c25e4fdbf | |||
| 181b342dd4 | |||
| 9be4ad6dc9 | |||
| c5621562b2 | |||
| 34c0bd4cc7 | |||
| 4f6d0ff06d | |||
| a498087d87 | |||
| 65eebc1dc1 | |||
| 6a7f561589 | |||
| c01d42c269 | |||
| 4a5eefa65e | |||
| 8b6405ce85 | |||
| 087c82f2af | |||
| af8857f356 | |||
| 9add7352b4 | |||
| 894909f8bc | |||
| c1816feb13 | |||
| f7ad66498e | |||
| f0d42c3de0 | |||
| cf247b1cd2 | |||
| fbe18b35ff | |||
| 18a538ee7f | |||
| 83b7d9e66c | |||
| 699304bf04 | |||
| b8451e289e | |||
| 58d1d16f52 | |||
| 85ec42a6da | |||
| 0dcb01f5b0 | |||
| 65fde56506 | |||
| f72dda83d8 | |||
| d0beaac3e7 | |||
| 4720633c09 | |||
| 0cbf8dddf9 | |||
| 3983b7a590 | |||
| 21ae339623 | |||
| 4431b5bb02 | |||
| 31869bb435 | |||
| 3f842963f8 | |||
| 57e207d552 | |||
| a18e55c721 | |||
| f5553c87a3 | |||
| 0046f85241 | |||
| 429719b771 | |||
| ef597bbbd0 | |||
| 42f012ebb3 | |||
| 58cd93fd1d | |||
| d9794f1afd | |||
| 0e59339dff | |||
| 04ee3d1b45 | |||
| 0f5ef8a9cd | |||
| 8b0328b440 | |||
| b8b5df0f05 | |||
| fdd8054931 | |||
| fddfe2944a | |||
| 4da015a61e | |||
| b127df2bcf | |||
| a07107a0a4 | |||
| 2a78d7be39 | |||
| 52b20d0b14 | |||
| 74e12d5754 | |||
| 1f619d3788 | |||
| 2ae3f04143 | |||
| b12c56b9f7 | |||
| 59a47661a4 | |||
| c0e733fe65 | |||
| 16ad6fa4bb | |||
| 4398ce111c | |||
| 52f87775e4 | |||
| 6f37d406a9 | |||
| 4945b93ba5 | |||
| 361108bf87 | |||
| 2fde99f6f1 | |||
| 7c66bf1a3a | |||
| 997dbc1d6a | |||
| 6ab41ced9f | |||
| cef179fb17 | |||
| aac5cc99b8 | |||
| 2451a17e4f | |||
| 411db8a7aa | |||
| 13f3ab9e8d | |||
| 1c58794888 | |||
| 8dfe7ccdbd | |||
| f262d1a4a5 | |||
| e99bd28163 | |||
| 52e09d71ba | |||
| a36ee478a9 | |||
| 1c616dab4c | |||
| b8d435b455 | |||
| fe0c1c6bde | |||
| c2ff6d5028 | |||
| f089cc2af2 | |||
| fc54986465 | |||
| 51b9ca7c4d | |||
| e97b405e2c | |||
| b71ad710d6 | |||
| 48b54c3496 | |||
| 362b69f088 | |||
| c211a14454 | |||
| 6fe8629801 | |||
| 198a6cd63a | |||
| 6d638bd292 | |||
| 2ecb5ae389 | |||
| 6a1f28e57b | |||
| 7e3bd15bc8 | |||
| 3e41567353 | |||
| ac556e3797 | |||
| c27d3c82d8 | |||
| cffccd03e4 | |||
| 29903b3c3f | |||
| 9827731219 | |||
| af1bf994ec | |||
| 453b4cc48a | |||
| d2b7b16b46 | |||
| 26b85b5008 | |||
| 8e641dd622 | |||
| 815a6f0eeb | |||
| f39b778d66 | |||
| 97b04370db | |||
| f50bd3e783 | |||
| dc47097ac8 | |||
| 5c16582936 | |||
| 51f5316ac1 | |||
| 42a6a49bd6 | |||
| e2eef31dbd | |||
| 1ce6d0ec1f | |||
| f70996764e | |||
| 373ee66017 | |||
| e9465902bb | |||
| 282bdb24b4 | |||
| 75faea4326 | |||
| 656ff52256 | |||
| 7d8b34d478 | |||
| 51cd8f8ca5 | |||
| 3f34186fec | |||
| 88b8207d9e | |||
| 0990ae9330 | |||
| 46e6b10569 | |||
| a4e6bba980 | |||
| c6d3480f5d | |||
| 1952f448c5 | |||
| 74b57ece6c | |||
| 3c36dff587 | |||
| 3c2c558e23 | |||
| 622e5c7d9c | |||
| ffb76c3545 | |||
| 0176d8cbaa | |||
| 86ff0b039d | |||
| a7fa132804 | |||
| 49a9771cf5 | |||
| 0fbffac83f | |||
| aa9c8b7f8e | |||
| 593aa35503 | |||
| 936369ef5f | |||
| a9fcd45d83 | |||
| b5ebbaa5bf | |||
| f9fad8717d | |||
| 56e0fe9da5 | |||
| 17f822bd40 | |||
| b5840c4c7d | |||
| ea4c8536a4 | |||
| a9ca21c97c | |||
| e0645492c5 | |||
| f1bf386c43 | |||
| f433674a58 | |||
| dbbb455677 | |||
| cb06574d5b | |||
| a8c9711106 | |||
| 601812d71e | |||
| aab2bf6809 | |||
| a41ae1f4c7 | |||
| 56c978bf95 | |||
| 004c7f7b3f | |||
| d54f175dbb | |||
| 64a8d691e3 | |||
| 6a981ddfd6 | |||
| dfa9ca5415 | |||
| 945b367213 | |||
| 5e6aee4443 | |||
| 0a9a9d16c0 | |||
| 03c4d102a3 | |||
| e2a1ed12de | |||
| dba840d8fb | |||
| f5dc8313df | |||
| 0ecdc62ccb | |||
| 228c683a96 | |||
| 23fa78eced | |||
| 3a6c37d98e | |||
| e58b3abfeb | |||
| 82d93b8766 | |||
| 29dc93d1cd | |||
| 902ec3ccc2 | |||
| 8f50e29c85 | |||
| 5338f3b513 | |||
| 65e89b9f8a | |||
| 95449ba282 | |||
| 0b7ccd3524 | |||
| 1f4465fda8 | |||
| 145fcd4eef | |||
| 45e317821b | |||
| 319b9fbb7b | |||
| f80b5bd83d | |||
| cba6700b95 | |||
| 2cbc7b553e | |||
| fd0584f517 | |||
| 52aff1bfd3 | |||
| 42ad0d11ba | |||
| be88a9db22 | |||
| 9e8e8439c7 | |||
| 3978521f56 | |||
| 40bb96dbec | |||
| 7ee4f7c57b | |||
| 3d2d030f2b | |||
| ec3f14a25d | |||
| 9b1424d7f8 | |||
| 92b7afea55 | |||
| 9fa231c541 | |||
| c967c71d16 | |||
| 4ba39c2626 | |||
| 4bc822b746 | |||
| 83f9848c42 | |||
| cf9faae277 | |||
| b60e4cc9a3 | |||
| 72cc2e8c11 | |||
| e9e9c9e143 | |||
| 77464d6be4 | |||
| 369c4ab13d | |||
| 3e16e2fd1d | |||
| 73306a9b52 | |||
| 75beaae841 | |||
| a0a125af85 | |||
| 65f3fe2b8c | |||
| 9bc66d2797 | |||
| 6f8c094cf7 | |||
| 9604cd3be1 | |||
| e7cda6bee1 | |||
| 9ac7d1f1c9 | |||
| fc78375323 | |||
| 93dc135075 | |||
| 923c0f5342 | |||
| 16a5f6929a | |||
| 866a718532 | |||
| 3f1f634826 | |||
| 386f08f476 | |||
| 9fd87f072c | |||
| fe5b9f808b | |||
| 876a50f509 | |||
| 71c46bf1af | |||
| fb28188272 |
+12
-12
@@ -350,7 +350,7 @@
|
||||
p.id as prefid
|
||||
FROM {$CFG->prefix}user u
|
||||
JOIN {$CFG->prefix}user_preferences p ON u.id=p.userid
|
||||
WHERE p.name='create_password' AND p.value=1 AND u.email !='' ");
|
||||
WHERE p.name='create_password' AND p.value='1' AND u.email !='' ");
|
||||
|
||||
foreach ($newusers as $newuserid => $newuser) {
|
||||
$newuser->emailstop = 0; // send email regardless
|
||||
@@ -481,44 +481,44 @@
|
||||
|
||||
// run gradebook import/export/report cron
|
||||
if ($gradeimports = get_list_of_plugins('grade/import')) {
|
||||
foreach ($gradeimports as $gradeimport) {
|
||||
foreach ($gradeimports as $gradeimport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php');
|
||||
$cron_function = 'grade_import_'.$gradeimport.'_cron';
|
||||
$cron_function = 'grade_import_'.$gradeimport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook import function $cron_function ...", '');
|
||||
$cron_function;
|
||||
$cron_function();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($gradeexports = get_list_of_plugins('grade/export')) {
|
||||
foreach ($gradeexports as $gradeexport) {
|
||||
foreach ($gradeexports as $gradeexport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php');
|
||||
$cron_function = 'grade_export_'.$gradeexport.'_cron';
|
||||
$cron_function = 'grade_export_'.$gradeexport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook export function $cron_function ...", '');
|
||||
$cron_function;
|
||||
$cron_function();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($gradereports = get_list_of_plugins('grade/report')) {
|
||||
foreach ($gradereports as $gradereport) {
|
||||
foreach ($gradereports as $gradereport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php');
|
||||
$cron_function = 'grade_report_'.$gradereport.'_cron';
|
||||
$cron_function = 'grade_report_'.$gradereport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook report function $cron_function ...", '');
|
||||
$cron_function;
|
||||
$cron_function();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// run any customized cronjobs, if any
|
||||
// looking for functions in lib/local/cron.php
|
||||
if (file_exists($CFG->dirroot.'/local/cron.php')) {
|
||||
|
||||
+13
-6
@@ -80,7 +80,6 @@
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="7.4" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
@@ -140,7 +139,6 @@
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.0" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
@@ -218,21 +216,20 @@
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.3" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
<VENDOR name="sqlite" version="2.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.2.8" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
<ON_CHECK message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
@@ -260,6 +257,11 @@
|
||||
<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" />
|
||||
@@ -275,6 +277,11 @@
|
||||
<ON_CHECK message="gdrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="40M" level="required">
|
||||
|
||||
@@ -635,6 +635,11 @@
|
||||
|
||||
}
|
||||
|
||||
if (empty($CFG->passwordsaltmain)) {
|
||||
$path = $CFG->docroot.'/'.str_replace('_utf8', '', current_language()).'/report/security/report_security_check_passwordsaltmain';
|
||||
print_box(get_string('upgrade197notice', 'admin')."\n".get_string('upgrade197salt', 'admin', $path));
|
||||
}
|
||||
|
||||
if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
|
||||
print_box(get_string('displayerrorswarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
redirect('index.php', get_string('postrequired','mnet') ,7);
|
||||
}
|
||||
|
||||
require_sesskey();
|
||||
|
||||
if ('verify' == $step) {
|
||||
$mnet_peer = new mnet_peer();
|
||||
$mnet_peer->set_id($hostid);
|
||||
|
||||
@@ -85,9 +85,21 @@
|
||||
$mnet_request->set_method('enrol/mnet/enrol.php/course_enrolments');
|
||||
$mnet_request->add_param($course->remoteid, 'int');
|
||||
$mnet_request->send($mnet_peer);
|
||||
$all_enrolled_users = $mnet_request->response;
|
||||
|
||||
$raw_all_enrolled_users = $mnet_request->response;
|
||||
unset($mnet_request);
|
||||
|
||||
$all_enrolled_users = array();
|
||||
if (!empty($raw_all_enrolled_users)) {
|
||||
// Try to repair keying of remote users array, numeric usernames get lost in the fracas
|
||||
foreach ($raw_all_enrolled_users as $username => $userdetails) {
|
||||
if (empty($userdetails['username']) || !is_numeric($username)) {
|
||||
//Not able to repair, or no need to repair
|
||||
$all_enrolled_users[$username] = $userdetails;
|
||||
} else {
|
||||
$all_enrolled_users[$userdetails['username']] = $userdetails;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$select = '';
|
||||
$all_enrolled_usernames = '';
|
||||
|
||||
@@ -14,7 +14,7 @@ print_simple_box_start("center", "");
|
||||
<td valign="top"><?php echo $mnet_peer->name; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="top" colspan="2"><?php print_string('allhosts_no_options'); ?>:</td>
|
||||
<td align="right" valign="top" colspan="2"><?php print_string('allhosts_no_options','mnet'); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
@@ -55,6 +55,7 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
<div>
|
||||
<input type="hidden" name="hostid" value="<?php echo $host->id; ?>" />
|
||||
<input type="hidden" name="step" value="verify" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
<input type="submit" name="submit" value="<?php print_string('delete'); ?>"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -72,7 +72,7 @@ while(!feof($fd)) {
|
||||
|
||||
$function($modargs,$body);
|
||||
|
||||
fclose($handle);
|
||||
fclose($fd);
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
|
||||
echo "<form id=\"mform1\" class=\"mform\" action=\"http://moodle.org/register/\" method=\"post\">\n";
|
||||
echo '<fieldset id="registration">';
|
||||
echo '<legend>Registration Information</legend>';
|
||||
echo '<legend>'.get_string("registrationinfotitle").'</legend>';
|
||||
|
||||
echo "<!-- The following hidden variables are to help prevent fake entries being sent. -->\n";
|
||||
echo "<!-- Together they form a key. If any of these change between updates then the entry -->\n";
|
||||
|
||||
@@ -5,6 +5,11 @@ require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
// workaround for problems with compression
|
||||
if (ini_get('zlib.output_compression')) {
|
||||
@ini_set('zlib.output_compression', 'Off');
|
||||
}
|
||||
|
||||
admin_externalpage_setup('replace');
|
||||
|
||||
$search = optional_param('search', '', PARAM_RAW);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
$strcourse = get_string("course");
|
||||
$strtimetaken = get_string("timetaken","quiz");
|
||||
$strstatus = get_string("status");
|
||||
$strnext = get_string("next");
|
||||
$strnext = get_string("backupnext");
|
||||
|
||||
/// Decide when to show last execution logs or detailed logs
|
||||
/// Lastlog view
|
||||
|
||||
@@ -53,11 +53,13 @@ function report_security_get_issue_list() {
|
||||
'report_security_check_openprofiles',
|
||||
'report_security_check_google',
|
||||
'report_security_check_passwordpolicy',
|
||||
'report_security_check_passwordsaltmain',
|
||||
'report_security_check_emailchangeconfirmation',
|
||||
'report_security_check_cookiesecure',
|
||||
'report_security_check_configrw',
|
||||
'report_security_check_riskxss',
|
||||
'report_security_check_riskadmin',
|
||||
'report_security_check_riskbackup',
|
||||
'report_security_check_defaultuserrole',
|
||||
'report_security_check_guestrole',
|
||||
'report_security_check_frontpagerole',
|
||||
@@ -485,6 +487,37 @@ function report_security_check_configrw($detailed=false) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
function report_security_check_passwordsaltmain($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_passwordsaltmain';
|
||||
$result->name = get_string('check_passwordsaltmain_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = null;
|
||||
|
||||
if (empty($CFG->passwordsaltmain)) {
|
||||
$result->status = REPORT_SECURITY_WARNING;
|
||||
$result->info = get_string('check_passwordsaltmain_warning', 'report_security');
|
||||
} else if ($CFG->passwordsaltmain === 'a_very_long_random_string_of_characters#@6&*1'
|
||||
|| trim($CFG->passwordsaltmain) === '' || preg_match('/^([\w]+|[\d]+)$/i', $CFG->passwordsaltmain)) {
|
||||
$result->status = REPORT_SECURITY_WARNING;
|
||||
$result->info = get_string('check_passwordsaltmain_weak', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_passwordsaltmain_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$docspath = $CFG->docroot.'/'.str_replace('_utf8', '', current_language()).'/report/security/report_security_check_passwordsaltmain';
|
||||
$result->details = get_string('check_passwordsaltmain_details', 'report_security', $docspath);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all users with XSS risk, it would be great to combine this with risk trusts in user table,
|
||||
* unfortunately nobody implemented user trust UI yet :-(
|
||||
@@ -1060,3 +1093,112 @@ function report_security_check_riskadmin($detailed=false) {
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all roles that have the ability to backup user data, as well as users
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_riskbackup($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_riskbackup';
|
||||
$result->name = get_string('check_riskbackup_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = null;
|
||||
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
$systemroles = get_records_sql(
|
||||
"SELECT DISTINCT r.*
|
||||
FROM {$CFG->prefix}role r
|
||||
JOIN {$CFG->prefix}role_capabilities rc ON rc.roleid = r.id
|
||||
WHERE rc.capability = 'moodle/backup:userinfo' AND rc.contextid = $syscontext->id AND rc.permission = ".CAP_ALLOW."");
|
||||
|
||||
$overriddenroles = get_records_sql(
|
||||
"SELECT DISTINCT r.*, rc.contextid
|
||||
FROM {$CFG->prefix}role r
|
||||
JOIN {$CFG->prefix}role_capabilities rc ON rc.roleid = r.id
|
||||
WHERE rc.capability = 'moodle/backup:userinfo' AND rc.contextid <> $syscontext->id AND rc.permission = ".CAP_ALLOW."");
|
||||
|
||||
// list of users that are able to backup personal info
|
||||
// note: "sc" is context where is role assigned,
|
||||
// "c" is context where is role overriden or system context if in role definition
|
||||
$sqluserinfo = "
|
||||
FROM (SELECT rcx.*
|
||||
FROM {$CFG->prefix}role_capabilities rcx
|
||||
WHERE rcx.permission = ".CAP_ALLOW." AND rcx.capability = 'moodle/backup:userinfo') rc,
|
||||
{$CFG->prefix}context c,
|
||||
{$CFG->prefix}context sc,
|
||||
{$CFG->prefix}role_assignments ra,
|
||||
{$CFG->prefix}user u
|
||||
WHERE c.id = rc.contextid
|
||||
AND (sc.path = c.path OR sc.path LIKE ".sql_concat('c.path', "'/%'")." OR c.path LIKE ".sql_concat('sc.path', "'/%'").")
|
||||
AND u.id = ra.userid AND u.deleted = 0
|
||||
AND ra.contextid = sc.id AND ra.roleid = rc.roleid
|
||||
AND sc.contextlevel <= ".CONTEXT_COURSE." AND c.contextlevel <= ".CONTEXT_COURSE."";
|
||||
|
||||
$usercount = count_records_sql("SELECT COUNT('x') FROM (SELECT DISTINCT u.id $sqluserinfo) userinfo");
|
||||
$systemrolecount = empty($systemroles) ? 0 : count($systemroles);
|
||||
$overriddenrolecount = empty($overriddenroles) ? 0 : count($overriddenroles);
|
||||
|
||||
$result->status = REPORT_SECURITY_WARNING; // there is always at least one admin
|
||||
$a = (object)array('rolecount'=>$systemrolecount,'overridecount'=>$overriddenrolecount,'usercount'=>$usercount);
|
||||
$result->info = get_string('check_riskbackup_warning', 'report_security', $a);
|
||||
|
||||
if ($detailed) {
|
||||
|
||||
$result->details = ''; // Will be added to later
|
||||
|
||||
// Make a list of roles
|
||||
if ($systemroles) {
|
||||
$links = array();
|
||||
foreach ($systemroles as $role) {
|
||||
$role->url = "$CFG->wwwroot/$CFG->admin/roles/manage.php?action=edit&roleid=$role->id";
|
||||
$links[] = '<li>'.get_string('check_riskbackup_editrole', 'report_security', $role).'</li>';
|
||||
}
|
||||
$links = '<ul>'.implode($links).'</ul>';
|
||||
$result->details .= get_string('check_riskbackup_details_systemroles', 'report_security', $links);
|
||||
}
|
||||
|
||||
// Make a list of overrides to roles
|
||||
$rolelinks2 = array();
|
||||
if ($overriddenroles) {
|
||||
$links = array();
|
||||
foreach ($overriddenroles as $role) {
|
||||
$context = get_context_instance_by_id($role->contextid);
|
||||
if ($context->contextlevel == CONTEXT_COURSE) {
|
||||
$role->name = role_get_name($role, $context);
|
||||
}
|
||||
$role->contextname = print_context_name($context);
|
||||
$role->url = "$CFG->wwwroot/$CFG->admin/roles/override.php?contextid=$role->contextid&roleid=$role->id";
|
||||
$links[] = '<li>'.get_string('check_riskbackup_editoverride', 'report_security', $role).'</li>';
|
||||
}
|
||||
$links = '<ul>'.implode($links).'</ul>';
|
||||
$result->details .= get_string('check_riskbackup_details_overriddenroles', 'report_security', $links);
|
||||
}
|
||||
|
||||
// Get a list of affected users as well
|
||||
$rs = get_recordset_sql("SELECT DISTINCT u.id, u.firstname, u.lastname, u.picture, u.imagealt, u.email, ra.contextid, ra.roleid
|
||||
$sqluserinfo ORDER BY u.lastname, u.firstname");
|
||||
|
||||
$users = array();
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
$context = get_context_instance_by_id($user->contextid);
|
||||
$url = "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=$user->contextid&roleid=$user->roleid";
|
||||
$a = (object)array('fullname'=>fullname($user), 'url'=>$url, 'email'=>$user->email,
|
||||
'contextname'=>print_context_name($context));
|
||||
$users[] = '<li>'.get_string('check_riskbackup_unassign', 'report_security', $a).'</li>';
|
||||
}
|
||||
rs_close($rs);
|
||||
if (!empty($users)) {
|
||||
$users = '<ul>'.implode($users).'</ul>';
|
||||
$result->details .= get_string('check_riskbackup_details_users', 'report_security', $users);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ echo '</div>';
|
||||
|
||||
function search_spammers($keywords) {
|
||||
|
||||
global $CFG, $USER, $DB;
|
||||
global $CFG, $USER;
|
||||
|
||||
if (!is_array($keywords)) {
|
||||
$keywords = array($keywords); // Make it into an array
|
||||
|
||||
@@ -22,13 +22,13 @@ require_once($CFG->libdir . '/simpletestlib/test_case.php');
|
||||
* them into a group test.
|
||||
* @package SimpleTestEx
|
||||
*/
|
||||
class AutoGroupTest extends GroupTest {
|
||||
class AutoGroupTest extends TestSuite {
|
||||
|
||||
var $thorough;
|
||||
var $showsearch;
|
||||
|
||||
function AutoGroupTest($showsearch, $thorough, $test_name = null) {
|
||||
$this->GroupTest($test_name);
|
||||
$this->TestSuite($test_name);
|
||||
$this->showsearch = $showsearch;
|
||||
$this->thorough = $thorough;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
$roles = get_all_roles();
|
||||
|
||||
if ($grant = data_submitted()) {
|
||||
if ($grant = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
foreach ($grant as $grole => $val) {
|
||||
if ($grole == 'dummy') {
|
||||
if ($grole == 'dummy' or !strpos($grole, '_')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
print_table($table);
|
||||
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/>';
|
||||
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '</div></form>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
|
||||
$roles = get_all_roles();
|
||||
|
||||
if ($grant = data_submitted()) {
|
||||
if ($grant = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
foreach ($grant as $grole => $val) {
|
||||
if ($grole == 'dummy') {
|
||||
if ($grole == 'dummy' or !strpos($grole, '_')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
print_table($table);
|
||||
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/>';
|
||||
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '</div></form>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
@@ -35,6 +35,9 @@ if ($currenttab != 'update') {
|
||||
$navlinks[] = array('name' => $category->name,
|
||||
'link' => "$CFG->wwwroot/course/category.php?id=$category->id",
|
||||
'type' => 'misc');
|
||||
$navlinks[] = array('name' => get_string("roles"),
|
||||
'link' => null,
|
||||
'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header("$SITE->shortname: $category->name", "$SITE->fullname: $strcourses", $navigation, "", "", true);
|
||||
|
||||
@@ -16,6 +16,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$rqsetting->plugin = 'qtype_random';
|
||||
$temp->add($rqsetting);
|
||||
$temp->add(new admin_setting_configcheckbox('experimentalsplitrestore', get_string('experimentalsplitrestore', 'admin'), get_string('configexperimentalsplitrestore', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enableimsccimport', get_string('enable_cc_import', 'imscc'), get_string('enable_cc_import_description', 'imscc'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', get_string('enablesafebrowserintegration', 'admin'), get_string('configenablesafebrowserintegration', 'admin'), 0));
|
||||
|
||||
$ADMIN->add('misc', $temp);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), ''));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('passwordpolicy', get_string('passwordpolicy', 'admin'), get_string('configpasswordpolicy', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('passwordpolicy', get_string('passwordpolicy', 'admin'), get_string('configpasswordpolicy', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('minpasswordlength', get_string('minpasswordlength', 'admin'), get_string('configminpasswordlength', 'admin'), 8, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpassworddigits', get_string('minpassworddigits', 'admin'), get_string('configminpassworddigits', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordlower', get_string('minpasswordlower', 'admin'), get_string('configminpasswordlower', 'admin'), 1, PARAM_INT));
|
||||
@@ -65,6 +65,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('loginhttps', get_string('loginhttps', 'admin'), get_string('configloginhttps', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiesecure', get_string('cookiesecure', 'admin'), get_string('configcookiesecure', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiehttponly', get_string('cookiehttponly', 'admin'), get_string('configcookiehttponly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('regenloginsession', get_string('regenloginsession', 'admin'), get_string('configregenloginsession', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('excludeoldflashclients', get_string('excludeoldflashclients', 'admin'), get_string('configexcludeoldflashclients', 'admin'), '10.0.12', PARAM_TEXT));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ $overwritepicture = optional_param('overwritepicture', 0, PARAM_BOOL);
|
||||
admin_externalpage_print_header();
|
||||
print_heading_with_help($struploadpictures, 'uploadpictures');
|
||||
|
||||
$mform = new admin_uploadpicture_form();
|
||||
$mform = new admin_uploadpicture_form(null, $userfields);
|
||||
if ($formdata = $mform->get_data()) {
|
||||
if (!array_key_exists($userfield, $userfields)) {
|
||||
notify(get_string('uploadpicture_baduserfield','admin'));
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
class admin_uploadpicture_form extends moodleform {
|
||||
function definition (){
|
||||
global $CFG, $USER;
|
||||
global $userfields;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
@@ -14,11 +13,11 @@
|
||||
|
||||
$mform->addElement('file', 'userpicturesfile', get_string('file'), 'size="40"');
|
||||
$mform->addRule('userpicturesfile', null, 'required');
|
||||
|
||||
$choices = $userfields;
|
||||
|
||||
$choices =& $this->_customdata;
|
||||
$mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'admin'), $choices);
|
||||
$mform->setType('userfield', PARAM_INT);
|
||||
|
||||
|
||||
$choices = array( 0 => get_string('no'), 1 => get_string('yes') );
|
||||
$mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'admin'), $choices);
|
||||
$mform->setType('overwritepicture', PARAM_INT);
|
||||
|
||||
@@ -149,8 +149,7 @@ if ($formdata = $mform->is_cancelled()) {
|
||||
$renames = 0;
|
||||
$renameerrors = 0;
|
||||
$usersskipped = 0;
|
||||
|
||||
$forcechangepassword = 0;
|
||||
$weakpasswords = 0;
|
||||
|
||||
// caches
|
||||
$ccache = array(); // course cache - do not fetch all courses here, we will not probably use them all anyway!
|
||||
@@ -192,6 +191,8 @@ if ($formdata = $mform->is_cancelled()) {
|
||||
|
||||
$upt->track('line', $linenum);
|
||||
|
||||
$forcechangepassword = false;
|
||||
|
||||
$user = new object();
|
||||
// by default, use the local mnet id (this may be changed in the file)
|
||||
$user->mnethostid = $CFG->mnet_localhost_id;
|
||||
@@ -204,7 +205,8 @@ if ($formdata = $mform->is_cancelled()) {
|
||||
if ($value !== '') {
|
||||
$user->password = hash_internal_user_password($value);
|
||||
if (!empty($CFG->passwordpolicy) and !check_password_policy($value, $errmsg)) {
|
||||
$forcechangepassword++;
|
||||
$forcechangepassword = true;
|
||||
$weakpasswords++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -707,7 +709,7 @@ if ($formdata = $mform->is_cancelled()) {
|
||||
if ($usersskipped) {
|
||||
echo get_string('usersskipped', 'admin').': '.$usersskipped.'<br />';
|
||||
}
|
||||
echo get_string('usersweakpassword', 'admin').': '.$forcechangepassword.'<br />';
|
||||
echo get_string('usersweakpassword', 'admin').': '.$weakpasswords.'<br />';
|
||||
echo get_string('errors', 'admin').': '.$userserrors.'</p>';
|
||||
print_box_end();
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ if ($data = $action_form->get_data(false)) {
|
||||
case 3: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_delete.php');
|
||||
case 4: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_display.php');
|
||||
case 5: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_download.php');
|
||||
case 6: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_forcepasswordchange.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php //$Id$
|
||||
/**
|
||||
* script for bulk user force password change
|
||||
*/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once('lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('userbulk');
|
||||
require_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
if ($confirm and confirm_sesskey()) {
|
||||
// only force password change if user may actually change the password
|
||||
$authsavailable = get_list_of_plugins('auth');
|
||||
$changeable = array();
|
||||
foreach($authsavailable as $authname) {
|
||||
if (!$auth = get_auth_plugin($authname)) {
|
||||
continue;
|
||||
}
|
||||
if (@$auth->is_internal() and @$auth->can_change_password()) { // plugins may not be configured yet, not nice :-(
|
||||
$changeable[$authname] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$parts = array_chunk($SESSION->bulk_users, 300);
|
||||
foreach ($parts as $users) {
|
||||
$in = implode(',', $users);
|
||||
if ($rs = get_recordset_select('user', "id IN ($in)")) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if (!empty($changeable[$user->auth])) {
|
||||
set_user_preference('auth_forcepasswordchange', 1, $user->id);
|
||||
unset($SESSION->bulk_users[$user->id]);
|
||||
} else {
|
||||
notify(get_string('forcepasswordchangenot', '', fullname($user, true)));
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
}
|
||||
notify(get_string('changessaved'), 'notifysuccess');
|
||||
print_continue($return);
|
||||
|
||||
} else {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
$userlist = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname', 0, MAX_BULK_USERS);
|
||||
$usernames = implode(', ', $userlist);
|
||||
if (count($SESSION->bulk_users) > MAX_BULK_USERS) {
|
||||
$usernames .= ', ...';
|
||||
}
|
||||
$optionsyes = array();
|
||||
$optionsyes['confirm'] = 1;
|
||||
$optionsyes['sesskey'] = sesskey();
|
||||
print_heading(get_string('confirmation', 'admin'));
|
||||
notice_yesno(get_string('forcepasswordchangecheckfull', '', $usernames), 'user_bulk_forcepasswordchange.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
@@ -24,6 +24,9 @@ class user_bulk_action_form extends moodleform {
|
||||
if (has_capability('moodle/user:update', $syscontext)) {
|
||||
$actions[5] = get_string('download', 'admin');
|
||||
}
|
||||
if (has_capability('moodle/user:update', $syscontext)) {
|
||||
$actions[6] = get_string('forcepasswordchange');
|
||||
}
|
||||
|
||||
$objs = array();
|
||||
$objs[] =& $mform->createElement('select', 'action', null, $actions);
|
||||
|
||||
@@ -47,6 +47,8 @@ class XMLDBAction {
|
||||
|
||||
var $postaction; //Action to execute at the end of the invoke script
|
||||
|
||||
var $sesskey_protected; // Actions must be protected by sesskey mechanishm
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -72,6 +74,7 @@ class XMLDBAction {
|
||||
$this->output = NULL;
|
||||
$this->errormsg = NULL;
|
||||
$this->subaction = NULL;
|
||||
$this->sesskey_protected = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,13 +133,18 @@ class XMLDBAction {
|
||||
}
|
||||
|
||||
/**
|
||||
* main invoke method, it simply sets the postaction attribute
|
||||
* if possible
|
||||
* main invoke method, it sets the postaction attribute
|
||||
* if possible and checks sesskey_protected if needed
|
||||
*/
|
||||
function invoke() {
|
||||
|
||||
global $SESSION;
|
||||
|
||||
/// Sesskey protection
|
||||
if ($this->sesskey_protected) {
|
||||
require_sesskey();
|
||||
}
|
||||
|
||||
/// If we are used any dir, save it in the lastused session object
|
||||
/// Some actions can use it to perform positioning
|
||||
if ($lastused = optional_param ('dir', NULL, PARAM_PATH)) {
|
||||
|
||||
@@ -111,7 +111,7 @@ class check_bigints extends XMLDBAction {
|
||||
}
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=check_bigints&confirmed=yes" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=check_bigints&sesskey=' . sesskey() . '&confirmed=yes" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
@@ -208,6 +208,10 @@ class check_bigints extends XMLDBAction {
|
||||
$o.=' </ul>';
|
||||
}
|
||||
$o.=' </li>';
|
||||
/// Give the script some more time (resetting to current if exists)
|
||||
if ($currenttl = @ini_get('max_execution_time')) {
|
||||
@ini_set('max_execution_time',$currenttl);
|
||||
}
|
||||
}
|
||||
$o.=' </ul>';
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class check_indexes extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmcheckindexes'] . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=check_indexes&confirmed=yes" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=check_indexes&sesskey=' . sesskey() . '&confirmed=yes" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
@@ -213,6 +213,10 @@ class check_indexes extends XMLDBAction {
|
||||
$o.=' </ul>';
|
||||
}
|
||||
$o.=' </li>';
|
||||
/// Give the script some more time (resetting to current if exists)
|
||||
if ($currenttl = @ini_get('max_execution_time')) {
|
||||
@ini_set('max_execution_time',$currenttl);
|
||||
}
|
||||
}
|
||||
$o.=' </ul>';
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class delete_field extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletefield'] . '<br /><br />' . $fieldparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_field&confirmed=yes&postaction=edit_table&field=' . $fieldparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=delete_field&sesskey=' . sesskey() . '&confirmed=yes&postaction=edit_table&field=' . $fieldparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
|
||||
@@ -77,7 +77,7 @@ class delete_index extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeleteindex'] . '<br /><br />' . $indexparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_index&confirmed=yes&postaction=edit_table&index=' . $indexparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=delete_index&sesskey=' . sesskey() . '&confirmed=yes&postaction=edit_table&index=' . $indexparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
|
||||
@@ -77,7 +77,7 @@ class delete_key extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletekey'] . '<br /><br />' . $keyparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_key&confirmed=yes&postaction=edit_table&key=' . $keyparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=delete_key&sesskey=' . sesskey() . '&confirmed=yes&postaction=edit_table&key=' . $keyparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
|
||||
@@ -77,7 +77,7 @@ class delete_sentence extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletesentence'] . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_sentence&confirmed=yes&postaction=edit_statement&sentence=' . $sentenceparam . '&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=delete_sentence&sesskey=' . sesskey() . '&confirmed=yes&postaction=edit_statement&sentence=' . $sentenceparam . '&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
|
||||
@@ -76,7 +76,7 @@ class delete_statement extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletestatement'] . '<br /><br />' . $statementparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_statement&confirmed=yes&postaction=edit_xml_file&statement=' . $statementparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=delete_statement&sesskey=' . sesskey() . '&confirmed=yes&postaction=edit_xml_file&statement=' . $statementparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
|
||||
@@ -76,7 +76,7 @@ class delete_table extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletetable'] . '<br /><br />' . $tableparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_table&confirmed=yes&postaction=edit_xml_file&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=delete_table&sesskey=' . sesskey() . '&confirmed=yes&postaction=edit_xml_file&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
|
||||
@@ -75,7 +75,7 @@ class delete_xml_file extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletexmlfile'] . '<br /><br />' . $dirpath . '/install.php</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_xml_file&confirmed=yes&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&postaction=main_view#lastused" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=delete_xml_file&sesskey=' . sesskey() . '&confirmed=yes&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&postaction=main_view#lastused" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
|
||||
@@ -35,6 +35,7 @@ class edit_field extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
@@ -103,6 +104,7 @@ class edit_field extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="field" value="' . $fieldparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_field_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
|
||||
@@ -35,6 +35,7 @@ class edit_index extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
@@ -103,6 +104,7 @@ class edit_index extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="index" value="' . $indexparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_index_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
|
||||
@@ -35,6 +35,7 @@ class edit_key extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
@@ -103,6 +104,7 @@ class edit_key extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="key" value="' . $keyparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_key_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
|
||||
@@ -35,6 +35,7 @@ class edit_sentence extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
@@ -119,6 +120,7 @@ class edit_sentence extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="statement" value="' . $statementparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="sentence" value="' . $sentenceparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_sentence_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_statement" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
|
||||
@@ -35,6 +35,7 @@ class edit_statement extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
@@ -106,6 +107,7 @@ class edit_statement extends XMLDBAction {
|
||||
$o.= '<div>';
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="statement" value="' . $statementparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_statement_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_statement" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
@@ -129,7 +131,7 @@ class edit_statement extends XMLDBAction {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
/// The new sentence button
|
||||
$b .= ' <a href="index.php?action=new_sentence&postaction=edit_sentence&statement=' . $statementparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newsentence'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_sentence&postaction=edit_sentence&sesskey=' . sesskey() . '&statement=' . $statementparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newsentence'] . ']</a>';
|
||||
/// The back to edit xml file button
|
||||
$b .= ' <a href="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
@@ -157,10 +159,10 @@ class edit_statement extends XMLDBAction {
|
||||
$b .= '<a href="index.php?action=edit_sentence&sentence=' .$key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['edit'] . ']</a>';
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The duplicate button
|
||||
$b .= '<a href="index.php?action=new_sentence&postaction=edit_sentence&basesentence=' . $key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['duplicate'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=new_sentence&postaction=edit_sentence&sesskey=' . sesskey() . '&basesentence=' . $key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['duplicate'] . ']</a>';
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The delete button
|
||||
$b .= '<a href="index.php?action=delete_sentence&sentence=' . $key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_sentence&sesskey=' . sesskey() . '&sentence=' . $key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '</td>';
|
||||
/// Print table row
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell">' . $p . $sentence . $b . '</tr>';
|
||||
|
||||
@@ -35,6 +35,7 @@ class edit_table extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
@@ -107,6 +108,7 @@ class edit_table extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_table_save" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() .'" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
/// If the table is being used, we cannot rename it
|
||||
@@ -134,11 +136,11 @@ class edit_table extends XMLDBAction {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
/// The new field button
|
||||
$b .= ' <a href="index.php?action=new_field&postaction=edit_field&table=' . $tableparam . '&field=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newfield'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_field&sesskey=' . sesskey() . '&postaction=edit_field&table=' . $tableparam . '&field=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newfield'] . ']</a>';
|
||||
/// The new key button
|
||||
$b .= ' <a href="index.php?action=new_key&postaction=edit_key&table=' . $tableparam . '&key=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newkey'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_key&sesskey=' . sesskey() . '&postaction=edit_key&table=' . $tableparam . '&key=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newkey'] . ']</a>';
|
||||
/// The new index button
|
||||
$b .= ' <a href="index.php?action=new_index&postaction=edit_index&table=' . $tableparam . '&index=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newindex'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_index&sesskey=' . sesskey() . '&postaction=edit_index&table=' . $tableparam . '&index=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newindex'] . ']</a>';
|
||||
/// The back to edit xml file button
|
||||
$b .= ' <a href="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
@@ -185,14 +187,14 @@ class edit_table extends XMLDBAction {
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The up button
|
||||
if ($field->getPrevious()) {
|
||||
$b .= '<a href="index.php?action=move_updown_field&direction=up&field=' . $field->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_field&direction=up&sesskey=' . sesskey() . '&field=' . $field->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['up'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The down button
|
||||
if ($field->getNext()) {
|
||||
$b .= '<a href="index.php?action=move_updown_field&direction=down&field=' . $field->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_field&direction=down&sesskey=' . sesskey() . '&field=' . $field->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['down'] . ']';
|
||||
}
|
||||
@@ -200,7 +202,7 @@ class edit_table extends XMLDBAction {
|
||||
/// The delete button (if we have more than one and it isn't used
|
||||
if (count($fields) > 1 &&
|
||||
!$structure->getFieldUses($table->getName(), $field->getName())) {
|
||||
$b .= '<a href="index.php?action=delete_field&field=' . $field->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_field&sesskey=' . sesskey() . '&field=' . $field->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['delete'] . ']';
|
||||
}
|
||||
@@ -234,21 +236,21 @@ class edit_table extends XMLDBAction {
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The up button
|
||||
if ($key->getPrevious()) {
|
||||
$b .= '<a href="index.php?action=move_updown_key&direction=up&key=' . $key->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_key&direction=up&sesskey=' . sesskey() . '&key=' . $key->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['up'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The down button
|
||||
if ($key->getNext()) {
|
||||
$b .= '<a href="index.php?action=move_updown_key&direction=down&key=' . $key->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_key&direction=down&sesskey=' . sesskey() . '&key=' . $key->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['down'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The delete button (if the key hasn't uses)
|
||||
if (!$structure->getKeyUses($table->getName(), $key->getName())) {
|
||||
$b .= '<a href="index.php?action=delete_key&key=' . $key->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_key&sesskey=' . sesskey() . '&key=' . $key->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['delete'] . ']';
|
||||
}
|
||||
@@ -274,20 +276,20 @@ class edit_table extends XMLDBAction {
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The up button
|
||||
if ($index->getPrevious()) {
|
||||
$b .= '<a href="index.php?action=move_updown_index&direction=up&index=' . $index->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_index&direction=up&sesskey=' . sesskey() . '&index=' . $index->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['up'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The down button
|
||||
if ($index->getNext()) {
|
||||
$b .= '<a href="index.php?action=move_updown_index&direction=down&index=' . $index->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_index&direction=down&sesskey=' . sesskey() . '&index=' . $index->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['down'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The delete button
|
||||
$b .= '<a href="index.php?action=delete_index&index=' . $index->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_index&sesskey=' . sesskey() . '&index=' . $index->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
/// The readable info
|
||||
$r = '</td><td class="readableinfo cell">' . $index->readableInfo() . '</td>';
|
||||
/// Print table row
|
||||
|
||||
@@ -35,6 +35,7 @@ class edit_xml_file extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
@@ -107,6 +108,7 @@ class edit_xml_file extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_xml_file" />';
|
||||
$o.= ' <input type="hidden" name ="path" value="' . s($structure->getPath()) .'" />';
|
||||
$o.= ' <input type="hidden" name ="version" value="' . s($structure->getVersion()) .'" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() .'" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
$o.= ' <tr valign="top"><td>Path:</td><td>' . s($structure->getPath()) . '</td></tr>';
|
||||
$o.= ' <tr valign="top"><td>Version:</td><td>' . s($structure->getVersion()) . '</td></tr>';
|
||||
@@ -125,15 +127,15 @@ class edit_xml_file extends XMLDBAction {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
/// The new table button
|
||||
$b .= ' <a href="index.php?action=new_table&postaction=edit_table&table=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtable'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_table&sesskey=' . sesskey() . '&postaction=edit_table&table=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtable'] . ']</a>';
|
||||
/// The new from MySQL button
|
||||
if ($CFG->dbfamily == 'mysql') {
|
||||
$b .= ' <a href="index.php?action=new_table_from_mysql&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtablefrommysql'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_table_from_mysql&sesskey=' . sesskey() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtablefrommysql'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['newtablefrommysql'] . ']';
|
||||
}
|
||||
/// The new statement button
|
||||
$b .= ' <a href="index.php?action=new_statement&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newstatement'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_statement&sesskey=' . sesskey() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newstatement'] . ']</a>';
|
||||
/// The back to main menu button
|
||||
$b .= ' <a href="index.php?action=main_view#lastused">[' . $this->str['backtomainview'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
@@ -169,14 +171,14 @@ class edit_xml_file extends XMLDBAction {
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The up button
|
||||
if ($table->getPrevious()) {
|
||||
$b .= '<a href="index.php?action=move_updown_table&direction=up&table=' . $table->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_table&direction=up&sesskey=' . sesskey() . '&table=' . $table->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['up'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The down button
|
||||
if ($table->getNext()) {
|
||||
$b .= '<a href="index.php?action=move_updown_table&direction=down&table=' . $table->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_table&direction=down&sesskey=' . sesskey() . '&table=' . $table->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['down'] . ']';
|
||||
}
|
||||
@@ -185,7 +187,7 @@ class edit_xml_file extends XMLDBAction {
|
||||
if (count($tables) > 1 &&
|
||||
!$structure->getTableUses($table->getName())) {
|
||||
///!$structure->getTableUses($table->getName())) {
|
||||
$b .= '<a href="index.php?action=delete_table&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_table&sesskey=' . sesskey() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['delete'] . ']';
|
||||
}
|
||||
@@ -214,20 +216,20 @@ class edit_xml_file extends XMLDBAction {
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The up button
|
||||
if ($statement->getPrevious()) {
|
||||
$b .= '<a href="index.php?action=move_updown_statement&direction=up&statement=' . $statement->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_statement&direction=up&sesskey=' . sesskey() . '&statement=' . $statement->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['up'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The down button
|
||||
if ($statement->getNext()) {
|
||||
$b .= '<a href="index.php?action=move_updown_statement&direction=down&statement=' . $statement->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_statement&direction=down&sesskey=' . sesskey() . '&statement=' . $statement->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['down'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The delete button
|
||||
$b .= '<a href="index.php?action=delete_statement&statement=' . $statement->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_statement&sesskey=' . sesskey() . '&statement=' . $statement->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '</td>';
|
||||
/// Print statement row
|
||||
$o .= '<tr class="r' . $row . '"><td class="statement cell"><a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&statement=' . $statement->getName() . '&select=edited">' . $statement->getName() . '</a>' . $b . '</tr>';
|
||||
|
||||
@@ -39,6 +39,7 @@ class get_db_directories extends XMLDBAction {
|
||||
//$this->can_subaction = ACTION_HAVE_SUBACTIONS;
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -38,6 +38,7 @@ class load_xml_file extends XMLDBAction {
|
||||
//$this->can_subaction = ACTION_HAVE_SUBACTIONS;
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -35,6 +35,7 @@ class main_view extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
@@ -85,12 +86,12 @@ class main_view extends XMLDBAction {
|
||||
/// The reserved_words button
|
||||
$b .= ' <a href="index.php?action=view_reserved_words">[' . $this->str['reservedwords'] . ']</a>';
|
||||
/// The test button
|
||||
$b .= ' <a href="index.php?action=test">[' . $this->str['test'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=test&sesskey=' . sesskey() . '">[' . $this->str['test'] . ']</a>';
|
||||
/// The check indexes button
|
||||
$b .= ' <a href="index.php?action=check_indexes">[' . $this->str['checkindexes'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=check_indexes&sesskey=' . sesskey() . '">[' . $this->str['checkindexes'] . ']</a>';
|
||||
/// The check bigints button (only for MySQL and PostgreSQL) MDL-11038a
|
||||
if ($CFG->dbfamily == 'mysql' || $CFG->dbfamily == 'postgres') {
|
||||
$b .= ' <a href="index.php?action=check_bigints">[' . $this->str['checkbigints'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=check_bigints&sesskey=' . sesskey() . '">[' . $this->str['checkbigints'] . ']</a>';
|
||||
}
|
||||
$b .= '</p>';
|
||||
/// Send buttons to output
|
||||
@@ -131,7 +132,7 @@ class main_view extends XMLDBAction {
|
||||
if ($dbdir->path_exists &&
|
||||
!file_exists($key . '/install.xml') &&
|
||||
is_writeable($key)) {
|
||||
$b .= '<a href="index.php?action=create_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['create'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=create_xml_file&sesskey=' . sesskey() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['create'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['create'] . ']';
|
||||
}
|
||||
@@ -164,7 +165,7 @@ class main_view extends XMLDBAction {
|
||||
is_writeable($key) &&
|
||||
!empty($dbdir->xml_loaded) &&
|
||||
!empty($dbdir->xml_changed)) {
|
||||
$b .= '<a href="index.php?action=save_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['save'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=save_xml_file&sesskey=' . sesskey() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['save'] . ']</a>';
|
||||
/// Check if the file has been manually edited while being modified in the editor
|
||||
if ($dbdir->filemtime != filemtime($key . '/install.xml')) {
|
||||
/// File manually modified. Add to errors.
|
||||
@@ -183,7 +184,7 @@ class main_view extends XMLDBAction {
|
||||
is_writeable($key) &&
|
||||
!empty($dbdir->xml_loaded) &&
|
||||
!empty($dbdir->xml_changed)) {
|
||||
$b .= '<a href="index.php?action=revert_changes&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['revert'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=revert_changes&sesskey=' . sesskey() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['revert'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['revert'] . ']';
|
||||
}
|
||||
@@ -205,7 +206,7 @@ class main_view extends XMLDBAction {
|
||||
is_readable($key . '/install.xml') &&
|
||||
is_writeable($key) &&
|
||||
empty($dbdir->xml_loaded)) {
|
||||
$b .= '<a href="index.php?action=delete_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_xml_file&sesskey=' . sesskey() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['delete'] . ']';
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ class new_statement extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="new_statement" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_statement" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() . '" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter" cellpadding="5">';
|
||||
$o.= ' <tr><td><label for="type" accesskey="t">' . $this->str['statementtype'] .' </label>' . choose_from_menu($typeoptions, 'type', '', 'choose', '', 0, true) . '<label for="table" accesskey="a">' . $this->str['statementtable'] . ' </label>' .choose_from_menu($selecttables, 'table', '', 'choose', '', 0, true) . '</td></tr>';
|
||||
$o.= ' <tr><td colspan="2" align="center"><input type="submit" value="' .$this->str['create'] . '" /></td></tr>';
|
||||
|
||||
@@ -111,6 +111,7 @@ class new_table_from_mysql extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="new_table_from_mysql" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() . '" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter" cellpadding="5">';
|
||||
$o.= ' <tr><td><label for="table" accesskey="t">' . $this->str['createtable'] .' </label>' . choose_from_menu($selecttables, 'table', '', 'choose', '', 0, true) . '<label for="after" accesskey="a">' . $this->str['aftertable'] . ' </label>' .choose_from_menu($aftertables, 'after', '', 'choose', '', 0, true) . '</td></tr>';
|
||||
$o.= ' <tr><td colspan="2" align="center"><input type="submit" value="' .$this->str['create'] . '" /></td></tr>';
|
||||
|
||||
@@ -75,7 +75,7 @@ class revert_changes extends XMLDBAction {
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmrevertchanges'] . '<br /><br />' . $dirpath . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=revert_changes&confirmed=yes&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&postaction=main_view#lastused" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <form action="index.php?action=revert_changes&sesskey=' . sesskey() . '&confirmed=yes&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&postaction=main_view#lastused" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
|
||||
@@ -1014,6 +1014,20 @@ class test extends XMLDBAction {
|
||||
|
||||
$this->output = $o;
|
||||
|
||||
/// Finally drop all the potentially existing test tables
|
||||
$table = new XMLDBTable('testtable');
|
||||
if (table_exists($table)) {
|
||||
$status = drop_table($table, true, false);
|
||||
}
|
||||
$table = new XMLDBTable ('anothertest');
|
||||
if (table_exists($table)) {
|
||||
$status = drop_table($table, true, false);
|
||||
}
|
||||
$table = new XMLDBTable ('newnameforthetable');
|
||||
if (table_exists($table)) {
|
||||
$status = drop_table($table, true, false);
|
||||
}
|
||||
|
||||
/// Launch postaction if exists (leave this here!)
|
||||
if ($this->getPostAction() && $result) {
|
||||
return $this->launch($this->getPostAction());
|
||||
|
||||
@@ -35,6 +35,7 @@ class unload_xml_file extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -35,6 +35,7 @@ class view_field_xml extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -35,6 +35,7 @@ class view_index_xml extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -35,6 +35,7 @@ class view_key_xml extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -38,6 +38,7 @@ class view_reserved_words extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -35,6 +35,7 @@ class view_statement_xml extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -36,6 +36,7 @@ class view_structure_php extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -36,6 +36,7 @@ class view_structure_sql extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -35,6 +35,7 @@ class view_structure_xml extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -36,6 +36,7 @@ class view_table_php extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -36,6 +36,7 @@ class view_table_sql extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -35,6 +35,7 @@ class view_table_xml extends XMLDBAction {
|
||||
parent::init();
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
@@ -38,6 +38,7 @@ class view_xml extends XMLDBAction {
|
||||
//$this->can_subaction = ACTION_HAVE_SUBACTIONS;
|
||||
|
||||
/// Set own custom attributes
|
||||
$this->sesskey_protected = false; // This action doesn't need sesskey protection
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
|
||||
+6
-1
@@ -58,8 +58,13 @@ class auth_plugin_cas extends auth_plugin_base {
|
||||
*/
|
||||
function user_login ($username, $password) {
|
||||
$this->connectCAS();
|
||||
return phpCAS::isAuthenticated() && (phpCAS::getUser() == $username);
|
||||
return phpCAS::isAuthenticated() && (trim(moodle_strtolower(phpCAS::getUser())) == $username);
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -564,6 +564,13 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
if (!isset($this->config->passtype)) {
|
||||
return false;
|
||||
}
|
||||
return ($this->config->passtype != 'internal');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -146,6 +146,10 @@ class auth_plugin_email extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -144,6 +144,10 @@ class auth_plugin_fc extends auth_plugin_base {
|
||||
return false;
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -81,6 +81,10 @@ class auth_plugin_imap extends auth_plugin_base {
|
||||
return false; // No match
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
+22
-6
@@ -222,7 +222,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
$ldapval = NULL;
|
||||
foreach ($values as $value) {
|
||||
if ($value == 'dn') {
|
||||
if ((moodle_strtolower($value) == 'dn') || (moodle_strtolower($value) == 'distinguishedname')) {
|
||||
$result[$key] = $user_dn;
|
||||
}
|
||||
if (!array_key_exists($value, $user_entry[0])) {
|
||||
@@ -1803,6 +1803,10 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
return ($fresult);
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return !empty($this->config->preventpassindb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
@@ -1844,6 +1848,9 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
*/
|
||||
function loginpage_hook() {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
// HTTPS is potentially required
|
||||
httpsrequired();
|
||||
|
||||
if (($_SERVER['REQUEST_METHOD'] === 'GET' // Only on initial GET of loginpage
|
||||
|| ($_SERVER['REQUEST_METHOD'] === 'POST'
|
||||
@@ -2118,7 +2125,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote control characters in texts used in ldap filters - see rfc2254.txt
|
||||
* Quote control characters in texts used in ldap filters - see RFC 4515/2254
|
||||
*
|
||||
* @param string
|
||||
*/
|
||||
@@ -2130,14 +2137,23 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote control characters in quoted "texts" used in ldap
|
||||
* The order of the special characters in these arrays _IS IMPORTANT_.
|
||||
* Make sure '\\5C' (and '\\') are the first elements of the arrays.
|
||||
* Otherwise we'll double replace '\' with '\5C' which is Bad(tm)
|
||||
*/
|
||||
var $LDAP_DN_QUOTED_SPECIAL_CHARS = array('\\5c','\\20','\\22','\\23','\\2b','\\2c','\\3b','\\3c','\\3d','\\3e','\\00');
|
||||
var $LDAP_DN_SPECIAL_CHARS = array('\\', ' ', '"', '#', '+', ',', ';', '<', '=', '>', "\0");
|
||||
|
||||
/**
|
||||
* Quote control characters in distinguished names used in ldap - See RFC 4514/2253
|
||||
*
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
function ldap_addslashes($text) {
|
||||
$text = str_replace('\\', '\\\\', $text);
|
||||
$text = str_replace(array('"', "\0"),
|
||||
array('\\"', '\\00'), $text);
|
||||
$text = str_replace ($this->LDAP_DN_SPECIAL_CHARS,
|
||||
$this->LDAP_DN_QUOTED_SPECIAL_CHARS,
|
||||
$text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
if (!isset($config->opt_deref))
|
||||
{ $config->opt_deref = LDAP_DEREF_NEVER; }
|
||||
if (!isset($config->preventpassindb))
|
||||
{ $config->preventpassindb = 0; }
|
||||
{ $config->preventpassindb = 1; }
|
||||
if (!isset($config->bind_dn))
|
||||
{$config->bind_dn = ''; }
|
||||
if (!isset($config->bind_pw))
|
||||
@@ -92,7 +92,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
<td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
$varsions = array();
|
||||
$versions = array();
|
||||
$versions[2] = '2';
|
||||
$versions[3] = '3';
|
||||
choose_from_menu($versions, 'version', $config->version, '');
|
||||
|
||||
@@ -62,6 +62,10 @@ class auth_plugin_manual extends auth_plugin_base {
|
||||
return update_internal_user_password($user, $newpassword);
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
+12
-8
@@ -591,6 +591,10 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
delete_records_select('mnet_enrol_assignments', $whereclause);
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
@@ -950,7 +954,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
// There is no way to capture what the custom session handler
|
||||
// is and then reset it on each pass - I checked that out
|
||||
// already.
|
||||
$sesscache = clone($_SESSION);
|
||||
$sesscache = $_SESSION;
|
||||
$sessidcache = session_id();
|
||||
session_write_close();
|
||||
unset($_SESSION);
|
||||
@@ -970,7 +974,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
session_name('MoodleSession'.$CFG->sessioncookie);
|
||||
session_id($sessidcache);
|
||||
session_start();
|
||||
$_SESSION = clone($sesscache);
|
||||
$_SESSION = $sesscache;
|
||||
session_write_close();
|
||||
}
|
||||
}
|
||||
@@ -1140,7 +1144,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
$uc = ini_get('session.use_cookies');
|
||||
ini_set('session.use_cookies', false);
|
||||
$sesscache = clone($_SESSION);
|
||||
$sesscache = $_SESSION;
|
||||
$sessidcache = session_id();
|
||||
session_write_close();
|
||||
unset($_SESSION);
|
||||
@@ -1159,7 +1163,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
session_name('MoodleSession'.$CFG->sessioncookie);
|
||||
session_id($sessidcache);
|
||||
session_start();
|
||||
$_SESSION = clone($sesscache);
|
||||
$_SESSION = $sesscache;
|
||||
session_write_close();
|
||||
|
||||
$end = ob_end_clean();
|
||||
@@ -1186,7 +1190,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
$uc = ini_get('session.use_cookies');
|
||||
ini_set('session.use_cookies', false);
|
||||
$sesscache = clone($_SESSION);
|
||||
$sesscache = $_SESSION;
|
||||
$sessidcache = session_id();
|
||||
session_write_close();
|
||||
unset($_SESSION);
|
||||
@@ -1205,7 +1209,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
session_name('MoodleSession'.$CFG->sessioncookie);
|
||||
session_id($sessidcache);
|
||||
session_start();
|
||||
$_SESSION = clone($sesscache);
|
||||
$_SESSION = $sesscache;
|
||||
session_write_close();
|
||||
|
||||
$end = ob_end_clean();
|
||||
@@ -1228,7 +1232,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
$uc = ini_get('session.use_cookies');
|
||||
ini_set('session.use_cookies', false);
|
||||
$sesscache = clone($_SESSION);
|
||||
$sesscache = $_SESSION;
|
||||
$sessidcache = session_id();
|
||||
session_write_close();
|
||||
unset($_SESSION);
|
||||
@@ -1247,7 +1251,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
session_name('MoodleSession'.$CFG->sessioncookie);
|
||||
session_id($sessidcache);
|
||||
session_start();
|
||||
$_SESSION = clone($sesscache);
|
||||
$_SESSION = $sesscache;
|
||||
|
||||
$end = ob_end_clean();
|
||||
return true;
|
||||
|
||||
@@ -64,6 +64,10 @@ class auth_plugin_nntp extends auth_plugin_base {
|
||||
return false;
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -46,6 +46,11 @@ class auth_plugin_nologin extends auth_plugin_base {
|
||||
return false;
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
// just in case, we do not want to loose the passwords
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* No external data sync.
|
||||
*
|
||||
|
||||
@@ -62,6 +62,10 @@ class auth_plugin_none extends auth_plugin_base {
|
||||
return update_internal_user_password($user, $newpassword);
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -77,6 +77,10 @@ class auth_plugin_pam extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -81,6 +81,10 @@ class auth_plugin_pop3 extends auth_plugin_base {
|
||||
return false; // No matches found
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -126,6 +126,10 @@ class auth_plugin_radius extends auth_plugin_base {
|
||||
$rauth->close();
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
+36
-15
@@ -25,6 +25,9 @@ Changes:
|
||||
language files.
|
||||
- 3. 2009: Added various improvements and bug fixes reported by Ina Müller from
|
||||
university Tuebingen and Peter Ellis of University of Washington
|
||||
- 4. 2009: Added another requirement for logout regarding the call back script
|
||||
- 6. 2009: Changed handler URL when integrated Discovery Service is used
|
||||
- 10. 2009: Fixed HTML entity preservation in Shibboleth settings
|
||||
|
||||
Moodle Configuration with Dual login
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -33,11 +36,11 @@ Moodle Configuration with Dual login
|
||||
For Apache you have to define a rule like the following in the Apache config:
|
||||
|
||||
--
|
||||
<Location ~ "/auth/shibboleth/index.php">
|
||||
<Directory /path/to/moodle/auth/shibboleth/index.php>
|
||||
AuthType shibboleth
|
||||
ShibRequireSession On
|
||||
require valid-user
|
||||
</Location>
|
||||
</Directory>
|
||||
--
|
||||
|
||||
To restrict access to Moodle, replace the access rule 'require valid-user'
|
||||
@@ -106,6 +109,14 @@ Moodle Configuration with Dual login
|
||||
in step 1 only the index.php script in
|
||||
moodle/auth/shibboleth/ is protected but *not* the other
|
||||
scripts and especially not the login.php script.
|
||||
|
||||
If you were using the integrated WAYF alread with Shibboleth 1.3, it could
|
||||
be that the integrated WAYF is not working anymore after you updated Moodle.
|
||||
The reason is that the implicitly set default SessionInitiator changed in
|
||||
Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to
|
||||
add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS
|
||||
for Shibboleth 2.x.
|
||||
|
||||
|
||||
5. Save the changes for the 'Shibboleth settings'.
|
||||
|
||||
@@ -257,7 +268,6 @@ recommended to use the following approach when upgrading the Service Provider:
|
||||
|
||||
How to add logout support
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
In order make Moodle support Shibboleth logout, one has to make the Shibboleth
|
||||
Service Provider (SP) aware of the Moodle logout capability. Only then the SP
|
||||
can trigger Moodle's front or back channel logout handler.
|
||||
@@ -270,15 +280,6 @@ just before the <MetadataProvider> element.
|
||||
<Notify
|
||||
Channel="back"
|
||||
Location="https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php" />
|
||||
|
||||
<!--
|
||||
If possible, you should use only the back channel logout once it is working.
|
||||
-->
|
||||
<!--
|
||||
<Notify
|
||||
Channel="front"
|
||||
Location="https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php" />
|
||||
-->
|
||||
--
|
||||
|
||||
Then restart the Shibboleth daemon and check the log file for errors. If there
|
||||
@@ -293,15 +294,35 @@ Requirements:
|
||||
- PHP needs the Soap Extension, which maybe must installed manually:
|
||||
More information is available here http://ch.php.net/soap
|
||||
- Logout only works with Shibboleth Service Provider 2.1 or higher
|
||||
- /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!
|
||||
In case all of Moodle is protected with Shibboleth, you have to add something
|
||||
like this to your Apache configuration after all the other require rules
|
||||
|
||||
--
|
||||
<Directory /path/to/moodle/auth/shibboleth/logout.php>
|
||||
AuthType shibboleth
|
||||
ShibRequireSession Off
|
||||
require shibboleth
|
||||
</Directory>
|
||||
--
|
||||
When using IIS, the same can be achieved by something like:
|
||||
--
|
||||
<Path name="auth/shibboleth/logout.php" requireSession="false" >
|
||||
--
|
||||
in the shibboleth2.xml RequestMap.
|
||||
|
||||
|
||||
Limitations:
|
||||
Single Logout is only supported when SAML2 is used at the SP and the IdP.
|
||||
As of December 2008, the Shibboleth Identity Provider 2.1.1 does not yet support
|
||||
Single Logout (SLO). Therefore, the single logout feature cannot be used yet.
|
||||
As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support
|
||||
Single Logout (SLO). Therefore, the single logout feature cannot be used yet
|
||||
in a Shibboleth only setup but there may be other SAML2 products that could
|
||||
be used as Identity Provider, e.g. SimpleSAML PHP.
|
||||
One of the reasons why SLO isn't supported yet is because there aren't many
|
||||
applications yet that were adapted to support front and back channel
|
||||
logout. Hopefully, the Moodle logout helps to motivate the developers to
|
||||
implement SLO :)
|
||||
implement SLO. On the other hand, the easiest and safest way to log out
|
||||
still is to tell users to quit their web browsers :)
|
||||
|
||||
Also see https://spaces.internet2.edu/display/SHIB2/SLOIssues and
|
||||
https://spaces.internet2.edu/display/SHIB2/NativeSPLogoutInitiator for some
|
||||
|
||||
@@ -152,6 +152,10 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
return $moodleattributes;
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
https://another.idp-id.com/shibboleth, Other Example Organization, /Shibboleth.sso/DS/SWITCHaai
|
||||
urn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/SWITCHaai';
|
||||
} else {
|
||||
echo $config->organization_selection;
|
||||
echo htmlentities($config->organization_selection);
|
||||
}
|
||||
?>
|
||||
</textarea>
|
||||
@@ -110,7 +110,7 @@ urn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/
|
||||
<td>
|
||||
<input name="login_name" type="text" size="30" value="<?php
|
||||
if ( isset($config->login_name) and !empty($config->login_name)){
|
||||
echo $config->login_name;
|
||||
echo htmlentities($config->login_name);
|
||||
} else {
|
||||
echo 'Shibboleth Login';
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
}
|
||||
|
||||
redirect($urltogo);
|
||||
|
||||
}
|
||||
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
|
||||
@@ -56,13 +56,20 @@ httpsrequired();
|
||||
$selectedIdP = $_POST['idp'];
|
||||
set_saml_cookie($selectedIdP);
|
||||
|
||||
// Redirect to SessionInitiator with providerId as argument
|
||||
// Redirect to SessionInitiator with entityID as argument
|
||||
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])){
|
||||
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
// For Shibbolet 1.x Service Providers
|
||||
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
|
||||
// For Shibbolet 2.x Service Providers
|
||||
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
|
||||
} else {
|
||||
// TODO: This has to be changed to /Shibboleth.sso/DS?entityId= for
|
||||
// Shibbolet 2.x sometime...
|
||||
// For Shibbolet 1.x Service Providers
|
||||
header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
|
||||
// For Shibboleth 2.x Service Providers
|
||||
// header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
}
|
||||
} elseif (isset($_POST['idp']) && !isset($IdPs[$_POST['idp']])) {
|
||||
$errormsg = get_string('auth_shibboleth_errormsg', 'auth');
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@
|
||||
raise_memory_limit("192M");
|
||||
|
||||
//Call the form, depending the step we are
|
||||
if (!$launch) {
|
||||
if (!$launch or !data_submitted() or !confirm_sesskey()) {
|
||||
// if we're at the start, clear the cache of prefs
|
||||
if (isset($SESSION->backupprefs[$course->id])) {
|
||||
unset($SESSION->backupprefs[$course->id]);
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
// Init backupuserinfo
|
||||
$backupuserinfo = false;
|
||||
|
||||
if (!empty($course->id)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (empty($to)) {
|
||||
@@ -14,10 +17,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
$backupuserinfo = has_capability('moodle/backup:userinfo', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
$backupuserinfo = has_capability('moodle/backup:userinfo', get_context_instance(CONTEXT_SYSTEM));
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +50,7 @@
|
||||
<form id="form" method="post" action="backup.php">
|
||||
<table cellpadding="5" style="text-align:center;margin-left:auto;margin-right:auto">
|
||||
<?php
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
|
||||
if (empty($to)) {
|
||||
//Now print the Backup Name tr
|
||||
@@ -65,6 +71,16 @@
|
||||
|
||||
}
|
||||
|
||||
// Re-enforce 'moodle/site:backup' at system context to be able to backup all users
|
||||
if ($backupprefs->backup_users == 0 and !has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$backupprefs->backup_users = 1; // users => course
|
||||
}
|
||||
|
||||
// Re-enforce moodle/backup:userinfo capability
|
||||
if (!$backupuserinfo) {
|
||||
$backupprefs->backup_users = 2; // users => none
|
||||
}
|
||||
|
||||
//Here we check if backup_users = None. Then, we switch off every module
|
||||
//user info, user_files, logs and exercises, workshop and messages & blogs backups. A Warning is showed to
|
||||
//inform the user.
|
||||
|
||||
+30
-17
@@ -4,6 +4,9 @@
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
//Init backupuserinfo
|
||||
$backupuserinfo = false;
|
||||
|
||||
if (!empty($course->id)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (empty($to)) {
|
||||
@@ -14,10 +17,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
$backupuserinfo = has_capability('moodle/backup:userinfo', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
$backupuserinfo = has_capability('moodle/backup:userinfo', get_context_instance(CONTEXT_SYSTEM));
|
||||
}
|
||||
|
||||
//Check site
|
||||
@@ -118,6 +123,8 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
<form id="form1" method="post" action="backup.php">
|
||||
<table cellpadding="5" style="margin-left:auto;margin-right:auto;">
|
||||
<?php
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
|
||||
/// Acummulator for hidden options and proper XHTML output
|
||||
$hidden_options = '';
|
||||
//Now, check modules and info and show posibilities
|
||||
@@ -130,12 +137,16 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_', true);\">". get_string("all")."</a>/";
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_', false);\">". get_string("none")."</a>";
|
||||
echo "</td>";
|
||||
echo "<td align=\"right\">";
|
||||
echo '<b> </b>';
|
||||
echo "</td><td>";
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_user_info_', true);\">". get_string("all")."</a>/";
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_user_info_', false);\">". get_string("none")."</a>";
|
||||
echo "</td>";
|
||||
if (empty($to) and $backupuserinfo) {
|
||||
echo "<td align=\"right\">";
|
||||
echo '<b> </b>';
|
||||
echo "</td><td>";
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_user_info_', true);\">". get_string("all")."</a>/";
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_user_info_', false);\">". get_string("none")."</a>";
|
||||
echo "</td>";
|
||||
} else {
|
||||
echo "<td colspan=\"2\"> </td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
$currentrow = 0;
|
||||
@@ -159,7 +170,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td><td align=\"right\"> ";
|
||||
echo "</td><td>";
|
||||
$var = "backup_user_info_".$modname;
|
||||
if (empty($to)) {
|
||||
if (empty($to) and $backupuserinfo) {
|
||||
$backup_user_options[0] = get_string("withoutuserdata");
|
||||
$backup_user_options[1] = get_string("withuserdata");
|
||||
//choose_from_menu($backup_user_options, $var, $$var, "");
|
||||
@@ -179,7 +190,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo '</td><td align="right"> ';
|
||||
$var = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,1);
|
||||
if (empty($to)) {
|
||||
if (empty($to) and $backupuserinfo) {
|
||||
print_checkbox($var,$$var,$$var,get_string('userdata'),'','this.form.elements[\'backup_user_info_'.$modname.'\'].checked=1;');
|
||||
} else {
|
||||
echo '<input type="hidden" name="'.$var.'" value="0" />';
|
||||
@@ -207,23 +218,25 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
$hidden_options .= '<input type="hidden" name="backup_metacourse" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
if (empty($to) and $backupuserinfo) {
|
||||
//Now print the Users tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo '<label for="menubackup_users">'.get_string ("users").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$user_options[0] = get_string("all");
|
||||
if (has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$user_options[0] = get_string("all");
|
||||
}
|
||||
$user_options[1] = get_string("course");
|
||||
$user_options[2] = get_string("none");
|
||||
choose_from_menu($user_options, "backup_users", $backup_users, "");
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
$hidden_options .= '<input type="hidden" name="backup_users" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_users" value="2" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
if (empty($to) and $backupuserinfo) {
|
||||
//Now print the Logs tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
@@ -238,7 +251,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
$hidden_options .= '<input type="hidden" name="backup_logs" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
if (empty($to) and $backupuserinfo) {
|
||||
//Now print the User Files tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
@@ -278,7 +291,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
}
|
||||
|
||||
// do you want grade histories to be backed up?
|
||||
if (empty($CFG->disablegradehistory)) {
|
||||
if (empty($to) and $backupuserinfo and empty($CFG->disablegradehistory)) {
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo '<label for="menubackup_gradebook_history">'.get_string ('gradebookhistories', 'grades').'</label>';
|
||||
@@ -291,7 +304,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
$hidden_options .= '<input type="hidden" name="backup_gradebook_history" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to) && $course->id == SITEID) {
|
||||
if (empty($to) and $backupuserinfo and $course->id == SITEID) {
|
||||
//If we are in a SITEID backup print the Messages tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
@@ -306,7 +319,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
$hidden_options .= '<input type="hidden" name="backup_messages" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to) && $course->id == SITEID && !empty($CFG->bloglevel)) {
|
||||
if (empty($to) and $backupuserinfo and $course->id == SITEID and !empty($CFG->bloglevel)) {
|
||||
//If we are in a SITEID backup and blogs are enabled print the Blogs tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
@@ -323,7 +336,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
}
|
||||
|
||||
//Now print a place to select which role assignments to back up.
|
||||
if (empty($to)) {
|
||||
if (empty($to) and $backupuserinfo) {
|
||||
//Line
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>\n";
|
||||
|
||||
|
||||
+7
-20
@@ -85,7 +85,6 @@
|
||||
|
||||
//Returns every needed user (participant) in a course
|
||||
//It uses the xxxx_get_participants() function
|
||||
//plus users needed to backup scales.
|
||||
//Also it search for users having messages and
|
||||
//users having blogs
|
||||
//WARNING: It returns only NEEDED users, not every
|
||||
@@ -124,21 +123,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
//Now, add scale users (from site and course scales)
|
||||
//Get users
|
||||
$scaleusers = get_records_sql("SELECT DISTINCT userid,userid
|
||||
FROM {$CFG->prefix}scale
|
||||
WHERE courseid = '0' or courseid = '$courseid'");
|
||||
//Add scale users to results
|
||||
if ($scaleusers) {
|
||||
foreach ($scaleusers as $scaleuser) {
|
||||
//If userid != 0
|
||||
if ($scaleuser->userid != 0) {
|
||||
$result[$scaleuser->userid]->id = $scaleuser->userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now, add message users if necessary
|
||||
if ($includemessages) {
|
||||
include_once("$CFG->dirroot/message/lib.php");
|
||||
@@ -184,7 +168,7 @@
|
||||
// get all users with moodle/course:view capability, this will include people
|
||||
// assigned at cat level, or site level
|
||||
// but it should be ok if they have no direct assignment at course, mod, block level
|
||||
return get_users_by_capability(get_context_instance(CONTEXT_COURSE, $courseid), 'moodle/course:view');
|
||||
return get_users_by_capability(get_context_instance(CONTEXT_COURSE, $courseid), 'moodle/course:view', '', '', '', '', '', '', false);
|
||||
}
|
||||
|
||||
//Returns all users ids (every record in users table)
|
||||
@@ -1303,7 +1287,11 @@
|
||||
fwrite ($bf,full_tag("POLICYAGREED",4,false,$user->policyagreed));
|
||||
fwrite ($bf,full_tag("DELETED",4,false,$user->deleted));
|
||||
fwrite ($bf,full_tag("USERNAME",4,false,$user->username));
|
||||
fwrite ($bf,full_tag("PASSWORD",4,false,$user->password));
|
||||
// Prevent user passwords in backup files unless
|
||||
// $CFG->includeuserpasswordsinbackup is defined. MDL-20838
|
||||
if (!empty($CFG->includeuserpasswordsinbackup)) {
|
||||
fwrite ($bf,full_tag("PASSWORD",4,false,$user->password));
|
||||
}
|
||||
fwrite ($bf,full_tag("IDNUMBER",4,false,$user->idnumber));
|
||||
fwrite ($bf,full_tag("FIRSTNAME",4,false,$user->firstname));
|
||||
fwrite ($bf,full_tag("LASTNAME",4,false,$user->lastname));
|
||||
@@ -1329,7 +1317,6 @@
|
||||
fwrite ($bf,full_tag("LASTLOGIN",4,false,$user->lastlogin));
|
||||
fwrite ($bf,full_tag("CURRENTLOGIN",4,false,$user->currentlogin));
|
||||
fwrite ($bf,full_tag("LASTIP",4,false,$user->lastip));
|
||||
fwrite ($bf,full_tag("SECRET",4,false,$user->secret));
|
||||
fwrite ($bf,full_tag("PICTURE",4,false,$user->picture));
|
||||
fwrite ($bf,full_tag("URL",4,false,$user->url));
|
||||
fwrite ($bf,full_tag("DESCRIPTION",4,false,$user->description));
|
||||
@@ -2354,7 +2341,7 @@
|
||||
// This way, backup contents will be neutral and independent of slasharguments configuration. MDL-18799
|
||||
// Based in $unicoderegexp, decide the regular expression to use
|
||||
if ($unicoderegexp) { //We can use unicode modifiers
|
||||
$search = '/(\$@FILEPHP@\$)((?:(?:\/|%2f|%2F))(?:(?:\([-;:@#&=\pL0-9\$~_.+!*\',]*?\))|[-;:@#&=\pL0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*)?(\?(?:(?:(?:\([-;:@#&=\pL0-9\$~_.+!*\',]*?\))|[-;:@#&=?\pL0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*))?(?<![,.;])/';
|
||||
$search = '/(\$@FILEPHP@\$)((?:(?:\/|%2f|%2F))(?:(?:\([-;:@#&=\pL0-9\$~_.+!*\',]*?\))|[-;:@#&=\pL0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*)?(\?(?:(?:(?:\([-;:@#&=\pL0-9\$~_.+!*\',]*?\))|[-;:@#&=?\pL0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*))?(?<![,.;])/u';
|
||||
} else { //We cannot ue unicode modifiers
|
||||
$search = '/(\$@FILEPHP@\$)((?:(?:\/|%2f|%2F))(?:(?:\([-;:@#&=a-zA-Z0-9\$~_.+!*\',]*?\))|[-;:@#&=a-zA-Z0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*)?(\?(?:(?:(?:\([-;:@#&=a-zA-Z0-9\$~_.+!*\',]*?\))|[-;:@#&=?a-zA-Z0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*))?(?<![,.;])/';
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@
|
||||
</SUMMARY>
|
||||
<ALLTEXT></ALLTEXT>
|
||||
<POPUP></POPUP>
|
||||
<OPTIONS>frame</OPTIONS>
|
||||
<OPTIONS></OPTIONS>
|
||||
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
|
||||
</MOD>
|
||||
</xsl:template>
|
||||
@@ -512,7 +512,7 @@
|
||||
<xsl:value-of select="DESCRIPTION/TEXT"/>
|
||||
</ALLTEXT>
|
||||
<POPUP></POPUP>
|
||||
<OPTIONS>frame</OPTIONS>
|
||||
<OPTIONS></OPTIONS>
|
||||
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
|
||||
</MOD>
|
||||
</xsl:template>
|
||||
|
||||
@@ -445,7 +445,7 @@
|
||||
</SUMMARY>
|
||||
<ALLTEXT></ALLTEXT>
|
||||
<POPUP></POPUP>
|
||||
<OPTIONS>frame</OPTIONS>
|
||||
<OPTIONS></OPTIONS>
|
||||
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
|
||||
</MOD>
|
||||
</xsl:template>
|
||||
@@ -503,7 +503,7 @@
|
||||
<xsl:value-of select="DESCRIPTION/TEXT"/>
|
||||
</ALLTEXT>
|
||||
<POPUP></POPUP>
|
||||
<OPTIONS>frame</OPTIONS>
|
||||
<OPTIONS></OPTIONS>
|
||||
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
|
||||
</MOD>
|
||||
</xsl:template>
|
||||
|
||||
@@ -77,6 +77,7 @@ function blackboard_convert($dir){
|
||||
mkdir("$dir/course_files", $CFG->directorypermissions);
|
||||
foreach ($subdirs as $subdir){
|
||||
rename($subdir, "course_files/$subdir");
|
||||
rename_hexfiles($subdir);
|
||||
}
|
||||
|
||||
chdir($startdir);
|
||||
@@ -89,4 +90,34 @@ function blackboard_convert($dir){
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
/**
|
||||
* grabs all files in the directory, checks if the filenames start with a ! or @
|
||||
* then checks to see if the name is a hex - if so, it translates/renames correctly.
|
||||
*
|
||||
* @param string $subdir - the directory to parse.
|
||||
*
|
||||
*/
|
||||
function rename_hexfiles($subdir) {
|
||||
//this bit of code grabs all files in the directory, and if they start with ! or @, performs the name conversion
|
||||
if ($handle = opendir("course_files/$subdir")) {
|
||||
while ($file = readdir($handle)) {
|
||||
if ($file == '..' or $file == '.') { //don't bother processing these!
|
||||
continue;
|
||||
}
|
||||
if(substr($file,0,1)=="!" || substr($file,0,1)=="@"){
|
||||
$outputfilename = "";
|
||||
$filebase = substr($file,1,strrpos($file,".")-1);
|
||||
if (ctype_xdigit($filebase)) { //check if this name is a hex - if not, don't bother to rename
|
||||
$filenamesplit = str_split($filebase,2);
|
||||
foreach($filenamesplit as $hexvalue){
|
||||
$outputfilename .= chr(hexdec($hexvalue));
|
||||
}
|
||||
$outputfilename .= strrchr($file,".");
|
||||
rename("course_files/$subdir/$file","course_files/$subdir/$outputfilename");
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Executable
+714
@@ -0,0 +1,714 @@
|
||||
<?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/>.
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @subpackage backup-imscc
|
||||
* @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
require_once($CFG->dirroot . '/backup/cc/entities.class.php');
|
||||
require_once($CFG->dirroot . '/backup/cc/entity.label.class.php');
|
||||
require_once($CFG->dirroot . '/backup/cc/entity.resource.class.php');
|
||||
require_once($CFG->dirroot . '/backup/cc/entity.forum.class.php');
|
||||
require_once($CFG->dirroot . '/backup/cc/entity.quiz.class.php');
|
||||
|
||||
class cc2moodle {
|
||||
|
||||
public static $instances = array();
|
||||
public static $manifest;
|
||||
public static $path_to_manifest_folder;
|
||||
|
||||
public static $namespaces = array('imscc' => 'http://www.imsglobal.org/xsd/imscc/imscp_v1p1',
|
||||
'lomimscc' => 'http://ltsc.ieee.org/xsd/imscc/LOM',
|
||||
'lom' => 'http://ltsc.ieee.org/xsd/LOM',
|
||||
'voc' => 'http://ltsc.ieee.org/xsd/LOM/vocab',
|
||||
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'cc' => 'http://www.imsglobal.org/xsd/imsccauth_v1p0');
|
||||
|
||||
function __construct ($path_to_manifest) {
|
||||
|
||||
self::$manifest = new DOMDocument();
|
||||
|
||||
self::$path_to_manifest_folder = dirname($path_to_manifest);
|
||||
|
||||
self::log_action('Proccess start');
|
||||
self::log_action('Load the manifest file: ' . $path_to_manifest);
|
||||
|
||||
if (!self::$manifest->load($path_to_manifest)) {
|
||||
self::log_action('Cannot load the manifest file: ' . $path_to_manifest, true);
|
||||
}
|
||||
}
|
||||
|
||||
public function is_auth () {
|
||||
|
||||
$xpath = self::newx_path(self::$manifest, self::$namespaces);
|
||||
|
||||
$count_auth = $xpath->evaluate('count(/imscc:manifest/cc:authorizations)');
|
||||
|
||||
if ($count_auth > 0) {
|
||||
$response = true;
|
||||
} else {
|
||||
$response = false;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function get_metadata ($section, $key) {
|
||||
|
||||
$xpath = self::newx_path(self::$manifest, self::$namespaces);
|
||||
|
||||
$metadata = $xpath->query('/imscc:manifest/imscc:metadata/lomimscc:lom/lomimscc:' . $section . '/lomimscc:' . $key . '/lomimscc:string');
|
||||
$value = !empty($metadata->item(0)->nodeValue) ? $metadata->item(0)->nodeValue : '';
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function generate_moodle_xml () {
|
||||
|
||||
global $CFG;
|
||||
|
||||
mkdir(self::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files');
|
||||
|
||||
$sheet_base = self::loadsheet(SHEET_BASE);
|
||||
|
||||
// MOODLE_BACKUP / INFO / DETAILS / MOD
|
||||
$node_info_details_mod = $this->create_code_info_details_mod();
|
||||
|
||||
// MOODLE_BACKUP / BLOCKS / BLOCK
|
||||
$node_course_blocks_block = $this->create_node_course_blocks_block();
|
||||
|
||||
// MOODLE_BACKUP / COURSES / SECTIONS / SECTION
|
||||
$node_course_sections_section = $this->create_node_course_sections_section();
|
||||
|
||||
// MOODLE_BACKUP / COURSES / QUESTION_CATEGORIES
|
||||
$node_course_question_categories = $this->create_node_question_categories();
|
||||
|
||||
// MOODLE_BACKUP / COURSES / MODULES / MOD
|
||||
$node_course_modules_mod = $this->create_node_course_modules_mod();
|
||||
|
||||
// MOODLE_BACKUP / COURSE / HEADER
|
||||
$node_course_header = $this->create_node_course_header();
|
||||
|
||||
// GENERAL INFO
|
||||
$filename = optional_param('file', 'not_available.zip');
|
||||
$filename = basename($filename);
|
||||
|
||||
$www_root = $CFG->wwwroot;
|
||||
|
||||
$find_tags = array('[#zip_filename#]',
|
||||
'[#www_root#]',
|
||||
'[#node_course_header#]',
|
||||
'[#node_info_details_mod#]',
|
||||
'[#node_course_blocks_block#]',
|
||||
'[#node_course_sections_section#]',
|
||||
'[#node_course_question_categories#]',
|
||||
'[#node_course_modules#]');
|
||||
|
||||
$replace_values = array($filename,
|
||||
$www_root,
|
||||
$node_course_header,
|
||||
$node_info_details_mod,
|
||||
$node_course_blocks_block,
|
||||
$node_course_sections_section,
|
||||
$node_course_question_categories,
|
||||
$node_course_modules_mod);
|
||||
|
||||
$result_xml = str_replace($find_tags, $replace_values, $sheet_base);
|
||||
|
||||
// COPY RESOURSE FILES
|
||||
$entities = new entities();
|
||||
|
||||
$entities->move_all_files();
|
||||
|
||||
if (array_key_exists("index", self::$instances)) {
|
||||
|
||||
if (!file_put_contents(self::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', $result_xml)) {
|
||||
self::log_action('Cannot save the moodle manifest file: ' . self::$path_to_tmp_folder . DIRECTORY_SEPARATOR . 'moodle.xml', true);
|
||||
} else {
|
||||
$status = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
$status = false;
|
||||
notify('The course is empty');
|
||||
self::log_action('The course is empty', false);
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
||||
}
|
||||
|
||||
private function get_sections_numbers ($instances) {
|
||||
|
||||
$count = 0;
|
||||
|
||||
if (array_key_exists("index", $instances)) {
|
||||
foreach ($instances["index"] as $instance) {
|
||||
if ($instance["deep"] == ROOT_DEEP) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
private function create_node_course_header () {
|
||||
|
||||
$node_course_header = '';
|
||||
$sheet_course_header = self::loadsheet(SHEET_COURSE_HEADER);
|
||||
|
||||
$course_title = $this->get_metadata('general', 'title');
|
||||
$section_count = $this->get_sections_numbers(self::$instances) - 1;
|
||||
|
||||
if ($section_count == -1) {
|
||||
$section_count = 0;
|
||||
}
|
||||
|
||||
if (empty($course_title)) {
|
||||
$this->log_action('The course title not found', true);
|
||||
}
|
||||
|
||||
$course_short_name = $this->create_course_code($course_title);
|
||||
|
||||
$find_tags = array('[#course_name#]',
|
||||
'[#course_short_name#]',
|
||||
'[#date_now#]',
|
||||
'[#section_count#]');
|
||||
|
||||
$replace_values = array($course_title,
|
||||
$course_short_name,
|
||||
time(),
|
||||
$section_count);
|
||||
|
||||
$node_course_header = str_replace($find_tags, $replace_values, $sheet_course_header);
|
||||
|
||||
return $node_course_header;
|
||||
}
|
||||
|
||||
private function create_node_question_categories () {
|
||||
|
||||
$quiz = new quiz();
|
||||
|
||||
self::log_action('Creating node: QUESTION_CATEGORIES');
|
||||
|
||||
$node_course_question_categories = $quiz->generate_node_question_categories();
|
||||
|
||||
return $node_course_question_categories;
|
||||
}
|
||||
|
||||
private function create_node_course_modules_mod () {
|
||||
|
||||
$labels = new label();
|
||||
$resources = new resource();
|
||||
$forums = new forum();
|
||||
$quiz = new quiz();
|
||||
|
||||
self::log_action('Creating node: COURSE/MODULES/MOD');
|
||||
|
||||
// LABELS
|
||||
$node_course_modules_mod_label = $labels->generate_node();
|
||||
|
||||
// RESOURCES (WEB CONTENT AND WEB LINK)
|
||||
$node_course_modules_mod_resource = $resources->generate_node();
|
||||
|
||||
// FORUMS
|
||||
$node_course_modules_mod_forum = $forums->generate_node();
|
||||
|
||||
// QUIZ
|
||||
$node_course_modules_mod_quiz = $quiz->generate_node_course_modules_mod();
|
||||
$node_course_modules = $node_course_modules_mod_label . $node_course_modules_mod_resource . $node_course_modules_mod_forum . $node_course_modules_mod_quiz;
|
||||
|
||||
return $node_course_modules;
|
||||
}
|
||||
|
||||
|
||||
private function create_node_course_sections_section () {
|
||||
|
||||
self::log_action('Creating node: COURSE/SECTIONS/SECTION');
|
||||
|
||||
$node_course_sections_section = '';
|
||||
$sheet_course_sections_section = self::loadsheet(SHEET_COURSE_SECTIONS_SECTION);
|
||||
|
||||
$topics = $this->get_nodes_by_criteria('deep', ROOT_DEEP);
|
||||
|
||||
$i = 0;
|
||||
|
||||
if (!empty($topics)) {
|
||||
|
||||
foreach ($topics as $topic) {
|
||||
|
||||
$i++;
|
||||
$node_node_course_sections_section_mods_mod = $this->create_node_course_sections_section_mods_mod($topic['index']);
|
||||
|
||||
if ($topic['moodle_type'] == MOODLE_TYPE_LABEL) {
|
||||
|
||||
$find_tags = array('[#section_id#]',
|
||||
'[#section_number#]',
|
||||
'[#section_summary#]',
|
||||
'[#node_course_sections_section_mods_mod#]');
|
||||
|
||||
$replace_values = array($i,
|
||||
$i - 1,
|
||||
$topic['title'],
|
||||
$node_node_course_sections_section_mods_mod);
|
||||
|
||||
} else {
|
||||
|
||||
$find_tags = array('[#section_id#]',
|
||||
'[#section_number#]',
|
||||
'[#section_summary#]',
|
||||
'[#node_course_sections_section_mods_mod#]');
|
||||
|
||||
$replace_values = array($i,
|
||||
$i - 1,
|
||||
'',
|
||||
$node_node_course_sections_section_mods_mod);
|
||||
|
||||
}
|
||||
|
||||
$node_course_sections_section .= str_replace($find_tags, $replace_values, $sheet_course_sections_section);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $node_course_sections_section;
|
||||
}
|
||||
|
||||
private function create_node_course_blocks_block () {
|
||||
|
||||
global $CFG;
|
||||
|
||||
self::log_action('Creating node: COURSE/BLOCKS/BLOCK');
|
||||
|
||||
$sheet_course_blocks_block = self::loadsheet(SHEET_COURSE_BLOCKS_BLOCK);
|
||||
$node_course_blocks_block = '';
|
||||
|
||||
$format_config = $CFG->dirroot . '/course/format/weeks/config.php';
|
||||
|
||||
if (@is_file($format_config) && is_readable($format_config)) {
|
||||
require ($format_config);
|
||||
}
|
||||
|
||||
if (!empty($format['defaultblocks'])) {
|
||||
$blocknames = $format['defaultblocks'];
|
||||
} else {
|
||||
if (!empty($CFG->defaultblocks)) {
|
||||
$blocknames = $CFG->defaultblocks;
|
||||
} else {
|
||||
$blocknames = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
}
|
||||
}
|
||||
|
||||
$blocknames = explode(':', $blocknames);
|
||||
$blocks_left = explode(',', $blocknames[0]);
|
||||
$blocks_right = explode(',', $blocknames[1]);
|
||||
|
||||
$find_tags = array('[#block_id#]',
|
||||
'[#block_name#]',
|
||||
'[#block_position#]',
|
||||
'[#block_weight#]');
|
||||
|
||||
$i = 0;
|
||||
$weight = 0;
|
||||
|
||||
foreach ($blocks_left as $block) {
|
||||
$i++;
|
||||
$weight++;
|
||||
|
||||
$replace_values = array($i,
|
||||
$block,
|
||||
'l',
|
||||
$weight);
|
||||
|
||||
$node_course_blocks_block .= str_replace($find_tags, $replace_values, $sheet_course_blocks_block);
|
||||
}
|
||||
|
||||
$weight = 0;
|
||||
|
||||
foreach ($blocks_right as $block) {
|
||||
|
||||
$i++;
|
||||
$weight ++;
|
||||
|
||||
$replace_values = array($i,
|
||||
$block,
|
||||
'r',
|
||||
$weight);
|
||||
|
||||
$node_course_blocks_block .= str_replace($find_tags, $replace_values, $sheet_course_blocks_block);
|
||||
}
|
||||
|
||||
return $node_course_blocks_block;
|
||||
|
||||
}
|
||||
|
||||
private function create_node_course_sections_section_mods_mod ($root_parent) {
|
||||
|
||||
$sheet_course_sections_section_mods_mod = self::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD);
|
||||
$childs = $this->get_nodes_by_criteria('root_parent', $root_parent);
|
||||
|
||||
if ($childs) {
|
||||
|
||||
$node_course_sections_section_mods_mod = '';
|
||||
|
||||
foreach ($childs as $child) {
|
||||
|
||||
if ($child['moodle_type'] == MOODLE_TYPE_LABEL) {
|
||||
if ($child['index'] == $child['root_parent']) {
|
||||
$is_summary = true;
|
||||
} else {
|
||||
$is_summary = false;
|
||||
}
|
||||
} else {
|
||||
$is_summary = false;
|
||||
}
|
||||
|
||||
if (!$is_summary) {
|
||||
|
||||
$indent = $child['deep'] - ROOT_DEEP;
|
||||
|
||||
if ($indent > 0) {
|
||||
$indent = $indent - 1;
|
||||
}
|
||||
|
||||
$find_tags = array('[#mod_id#]',
|
||||
'[#mod_instance_id#]',
|
||||
'[#mod_type#]',
|
||||
'[#date_now#]',
|
||||
'[#mod_indent#]');
|
||||
|
||||
$replace_values = array($child['index'],
|
||||
$child['instance'],
|
||||
$child['moodle_type'],
|
||||
time(),
|
||||
$indent);
|
||||
|
||||
$node_course_sections_section_mods_mod .= str_replace($find_tags, $replace_values, $sheet_course_sections_section_mods_mod);
|
||||
}
|
||||
}
|
||||
|
||||
$response = $node_course_sections_section_mods_mod;
|
||||
|
||||
} else {
|
||||
$response = '';
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
public function get_nodes_by_criteria ($key, $value) {
|
||||
|
||||
$response = array();
|
||||
|
||||
if (array_key_exists('index', self::$instances)) {
|
||||
foreach (self::$instances['index'] as $item) {
|
||||
if ($item[$key] == $value) {
|
||||
$response[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function create_code_info_details_mod () {
|
||||
|
||||
self::log_action('Creating node: INFO/DETAILS/MOD');
|
||||
|
||||
$xpath = self::newx_path(self::$manifest, self::$namespaces);
|
||||
|
||||
$items = $xpath->query('/imscc:manifest/imscc:organizations/imscc:organization/imscc:item | /imscc:manifest/imscc:resources/imscc:resource[@type="' . CC_TYPE_QUESTION_BANK . '"]');
|
||||
|
||||
$this->create_instances($items);
|
||||
|
||||
$count_quiz = $this->count_instances(MOODLE_TYPE_QUIZ);
|
||||
$count_forum = $this->count_instances(MOODLE_TYPE_FORUM);
|
||||
$count_resource = $this->count_instances(MOODLE_TYPE_RESOURCE);
|
||||
$count_label = $this->count_instances(MOODLE_TYPE_LABEL);
|
||||
|
||||
$sheet_info_details_mod_instances_instance = self::loadsheet(SHEET_INFO_DETAILS_MOD_INSTANCE);
|
||||
|
||||
if ($count_resource > 0) {
|
||||
$resource_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_resource, self::$instances['instances'][MOODLE_TYPE_RESOURCE]);
|
||||
}
|
||||
if ($count_quiz > 0) {
|
||||
$quiz_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_quiz, self::$instances['instances'][MOODLE_TYPE_QUIZ]);
|
||||
}
|
||||
if ($count_forum > 0) {
|
||||
$forum_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_forum, self::$instances['instances'][MOODLE_TYPE_FORUM]);
|
||||
}
|
||||
if ($count_label > 0) {
|
||||
$label_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_label, self::$instances['instances'][MOODLE_TYPE_LABEL]);
|
||||
}
|
||||
|
||||
$resource_mod = $count_resource ? $this->create_mod_info_details_mod(MOODLE_TYPE_RESOURCE, $resource_instance) : '';
|
||||
$quiz_mod = $count_quiz ? $this->create_mod_info_details_mod(MOODLE_TYPE_QUIZ, $quiz_instance) : '';
|
||||
$forum_mod = $count_forum ? $this->create_mod_info_details_mod(MOODLE_TYPE_FORUM, $forum_instance) : '';
|
||||
$label_mod = $count_label ? $this->create_mod_info_details_mod(MOODLE_TYPE_LABEL, $label_instance) : '';
|
||||
|
||||
return $label_mod . $resource_mod . $quiz_mod . $forum_mod;
|
||||
|
||||
}
|
||||
|
||||
private function create_mod_info_details_mod ($mod_type, $node_info_details_mod_instances_instance) {
|
||||
|
||||
$sheet_info_details_mod = self::loadsheet(SHEET_INFO_DETAILS_MOD);
|
||||
|
||||
$find_tags = array('[#mod_type#]' ,'[#node_info_details_mod_instances_instance#]');
|
||||
$replace_values = array($mod_type , $node_info_details_mod_instances_instance);
|
||||
|
||||
return str_replace($find_tags, $replace_values, $sheet_info_details_mod);
|
||||
}
|
||||
|
||||
private function create_mod_info_details_mod_instances_instance ($sheet, $instances_quantity, $instances) {
|
||||
|
||||
$instance = '';
|
||||
|
||||
$find_tags = array('[#mod_instance_id#]',
|
||||
'[#mod_name#]',
|
||||
'[#mod_user_info#]');
|
||||
|
||||
for ($i = 1; $i <= $instances_quantity; $i++) {
|
||||
|
||||
$user_info = ($instances[$i - 1]['common_cartriedge_type'] == CC_TYPE_FORUM) ? 'true' : 'false';
|
||||
|
||||
$replace_values = array($instances[$i - 1]['instance'],
|
||||
$instances[$i - 1]['title'],
|
||||
$user_info);
|
||||
|
||||
$instance .= str_replace($find_tags, $replace_values, $sheet);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
private function create_instances ($items, $level = 0, &$array_index = 0, $index_root = 0) {
|
||||
|
||||
$level++;
|
||||
$i = 1;
|
||||
|
||||
if ($items) {
|
||||
|
||||
$xpath = self::newx_path(self::$manifest, self::$namespaces);
|
||||
|
||||
foreach ($items as $item) {
|
||||
|
||||
$array_index++;
|
||||
|
||||
if ($item->nodeName == "item") {
|
||||
|
||||
$identifierref = $xpath->query('@identifierref', $item);
|
||||
$identifierref = !empty($identifierref->item(0)->nodeValue) ? $identifierref->item(0)->nodeValue : '';
|
||||
|
||||
$title = $xpath->query('imscc:title', $item);
|
||||
$title = !empty($title->item(0)->nodeValue) ? $title->item(0)->nodeValue : '';
|
||||
|
||||
$cc_type = $this->get_item_cc_type($identifierref);
|
||||
$moodle_type = $this->convert_to_moodle_type($cc_type);
|
||||
|
||||
}
|
||||
elseif ($item->nodeName == "resource") {
|
||||
|
||||
$identifierref = $xpath->query('@identifier', $item);
|
||||
$identifierref = !empty($identifierref->item(0)->nodeValue) ? $identifierref->item(0)->nodeValue : '';
|
||||
|
||||
$cc_type = $this->get_item_cc_type($identifierref);
|
||||
$moodle_type = $this->convert_to_moodle_type($cc_type);
|
||||
|
||||
$title = 'Quiz Bank ' . ($this->count_instances($moodle_type) + 1);
|
||||
|
||||
}
|
||||
|
||||
if ($level == ROOT_DEEP) {
|
||||
$index_root = $array_index;
|
||||
}
|
||||
|
||||
self::$instances['index'][$array_index]['common_cartriedge_type'] = $cc_type;
|
||||
self::$instances['index'][$array_index]['moodle_type'] = $moodle_type;
|
||||
self::$instances['index'][$array_index]['title'] = $title ? $title : '';
|
||||
self::$instances['index'][$array_index]['root_parent'] = $index_root;
|
||||
self::$instances['index'][$array_index]['index'] = $array_index;
|
||||
self::$instances['index'][$array_index]['deep'] = $level;
|
||||
self::$instances['index'][$array_index]['instance'] = $this->count_instances($moodle_type);
|
||||
self::$instances['index'][$array_index]['resource_indentifier'] = $identifierref;
|
||||
|
||||
self::$instances['instances'][$moodle_type][] = array('title' => $title,
|
||||
'instance' => self::$instances['index'][$array_index]['instance'],
|
||||
'common_cartriedge_type' => $cc_type , 'resource_indentifier' => $identifierref);
|
||||
|
||||
$more_items = $xpath->query('imscc:item', $item);
|
||||
|
||||
if ($more_items->length > 0) {
|
||||
$this->create_instances($more_items, $level, $array_index, $index_root);
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function count_instances ($type) {
|
||||
|
||||
$quantity = 0;
|
||||
|
||||
if (array_key_exists('index', self::$instances)) {
|
||||
if (self::$instances['index'] && $type) {
|
||||
|
||||
foreach (self::$instances['index'] as $instance) {
|
||||
if (!empty($instance['moodle_type'])) {
|
||||
$types[] = $instance['moodle_type'];
|
||||
}
|
||||
}
|
||||
|
||||
$quantity_instances = array_count_values($types);
|
||||
$quantity = array_key_exists($type, $quantity_instances) ? $quantity_instances[$type] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $quantity;
|
||||
}
|
||||
|
||||
public function convert_to_moodle_type ($cc_type) {
|
||||
|
||||
if ($cc_type == CC_TYPE_FORUM) {
|
||||
$type = MOODLE_TYPE_FORUM;
|
||||
}
|
||||
if ($cc_type == CC_TYPE_QUIZ) {
|
||||
$type = MOODLE_TYPE_QUIZ;
|
||||
}
|
||||
if ($cc_type == CC_TYPE_WEBLINK) {
|
||||
$type = MOODLE_TYPE_RESOURCE;
|
||||
}
|
||||
if ($cc_type == CC_TYPE_WEBCONTENT) {
|
||||
$type = MOODLE_TYPE_RESOURCE;
|
||||
}
|
||||
if ($cc_type == CC_TYPE_ASSOCIATED_CONTENT) {
|
||||
$type = MOODLE_TYPE_RESOURCE;
|
||||
}
|
||||
if ($cc_type == CC_TYPE_QUESTION_BANK) {
|
||||
$type = MOODLE_TYPE_QUESTION_BANK;
|
||||
}
|
||||
if ($cc_type == CC_TYPE_EMPTY) {
|
||||
$type = MOODLE_TYPE_LABEL;
|
||||
}
|
||||
|
||||
$type = empty($type) ? TYPE_UNKNOWN : $type;
|
||||
|
||||
return $type;
|
||||
}
|
||||
|
||||
public function get_item_cc_type ($identifier) {
|
||||
|
||||
$xpath = self::newx_path(self::$manifest, self::$namespaces);
|
||||
|
||||
$nodes = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $identifier . '"]/@type');
|
||||
|
||||
if ($nodes && !empty($nodes->item(0)->nodeValue)) {
|
||||
return $nodes->item(0)->nodeValue;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public static function newx_path (DOMDocument $manifest, $namespaces = '') {
|
||||
|
||||
$xpath = new DOMXPath($manifest);
|
||||
|
||||
if (!empty($namespaces)) {
|
||||
foreach ($namespaces as $prefix => $ns) {
|
||||
if (!$xpath->registerNamespace($prefix, $ns)) {
|
||||
self::log_action('Cannot register the namespace: ' . $prefix . ':' . $ns, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $xpath;
|
||||
}
|
||||
|
||||
public static function loadsheet ($file) {
|
||||
|
||||
$content = (is_readable($file) && ($content = file_get_contents($file))) ? $content : false;
|
||||
|
||||
self::log_action('Loading sheet: ' . $file);
|
||||
|
||||
if (!$content) {
|
||||
self::log_action('Cannot load the xml sheet: ' . $file, true);
|
||||
}
|
||||
|
||||
self::log_action('Load OK!');
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public static function log_action ($text, $critical_error = false) {
|
||||
|
||||
$filename = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'cc2moodle.log';
|
||||
$full_message = strtoupper(date("j/n/Y g:i:s a")) . " - " . $text . "\r";
|
||||
|
||||
file_put_contents($filename, $full_message, FILE_APPEND);
|
||||
|
||||
if ($critical_error) {
|
||||
self::critical_error($text);
|
||||
}
|
||||
}
|
||||
|
||||
private function critical_error ($text) {
|
||||
|
||||
$path_to_log = cc2moodle::$path_to_manifest_folder . '/cc2moodle.log';
|
||||
|
||||
echo '
|
||||
|
||||
<p>
|
||||
<hr />A critical error has been found!
|
||||
|
||||
<p>' . $text . '</p>
|
||||
|
||||
|
||||
<p>
|
||||
The process has been stopped. Please see the <a href="' . $path_to_log . '">log file</a> for more information.</p>
|
||||
|
||||
<p>Log: ' . $path_to_log . '</p>
|
||||
|
||||
<hr />
|
||||
|
||||
</p>
|
||||
';
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
private function create_course_code ($title) {
|
||||
|
||||
$code = '';
|
||||
$words = explode(' ', $title);
|
||||
|
||||
foreach ($words as $word) {
|
||||
$code .= $word[0];
|
||||
}
|
||||
|
||||
$code = strtoupper($code . '-1');
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Executable
+270
@@ -0,0 +1,270 @@
|
||||
<?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/>.
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @subpackage backup-imscc
|
||||
* @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
class entities {
|
||||
|
||||
public function load_xml_resource ($path_to_file) {
|
||||
|
||||
$resource = new DOMDocument();
|
||||
|
||||
cc2moodle::log_action('Load the XML resource file: ' . $path_to_file);
|
||||
|
||||
if (!$resource->load($path_to_file)) {
|
||||
cc2moodle::log_action('Cannot load the XML resource file: ' . $path_to_file, true);
|
||||
}
|
||||
|
||||
return $resource;
|
||||
}
|
||||
|
||||
public function update_sources ($html, $root_path = '') {
|
||||
|
||||
$document = new DOMDocument();
|
||||
|
||||
@$document->loadHTML($html);
|
||||
|
||||
$tags = array('img' => 'src' , 'a' => 'href');
|
||||
|
||||
foreach ($tags as $tag => $attribute) {
|
||||
|
||||
$elements = $document->getElementsByTagName($tag);
|
||||
|
||||
foreach ($elements as $element) {
|
||||
|
||||
$attribute_value = $element->getAttribute($attribute);
|
||||
$protocol = parse_url($attribute_value, PHP_URL_SCHEME);
|
||||
|
||||
if (empty($protocol)) {
|
||||
$attribute_value = str_replace("\$IMS-CC-FILEBASE\$", "", $attribute_value);
|
||||
$attribute_value = $this->full_path($root_path . "/" . $attribute_value, "/");
|
||||
$attribute_value = "\$@FILEPHP@\$" . "/" . $attribute_value;
|
||||
}
|
||||
|
||||
$element->setAttribute($attribute, $attribute_value);
|
||||
}
|
||||
}
|
||||
|
||||
$html = $this->clear_doctype($document->saveHTML());
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function full_path ($path, $dir_sep = DIRECTORY_SEPARATOR) {
|
||||
|
||||
$token = '$IMS-CC-FILEBASE$';
|
||||
$path = str_replace($token, '', $path);
|
||||
|
||||
if (is_string($path) && ($path != '')) {
|
||||
$dir_sep;
|
||||
$dot_dir = '.';
|
||||
$up_dir = '..';
|
||||
$length = strlen($path);
|
||||
$rtemp = trim($path);
|
||||
$start = strrpos($path, $dir_sep);
|
||||
$can_continue = ($start !== false);
|
||||
$result = $can_continue ? '' : $path;
|
||||
$rcount = 0;
|
||||
|
||||
while ($can_continue) {
|
||||
|
||||
$dir_part = ($start !== false) ? substr($rtemp, $start + 1, $length - $start) : $rtemp;
|
||||
$can_continue = ($dir_part !== false);
|
||||
|
||||
if ($can_continue) {
|
||||
if ($dir_part != $dot_dir) {
|
||||
if ($dir_part == $up_dir) {
|
||||
$rcount++;
|
||||
} else {
|
||||
if ($rcount > 0) {
|
||||
$rcount --;
|
||||
} else {
|
||||
$result = ($result == '') ? $dir_part : $dir_part . $dir_sep . $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
$rtemp = substr($path, 0, $start);
|
||||
$start = strrpos($rtemp, $dir_sep);
|
||||
$can_continue = (($start !== false) || (strlen($rtemp) > 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
public function include_titles ($html) {
|
||||
|
||||
$document = new DOMDocument();
|
||||
@$document->loadHTML($html);
|
||||
|
||||
$images = $document->getElementsByTagName('img');
|
||||
|
||||
foreach ($images as $image) {
|
||||
|
||||
$src = $image->getAttribute('src');
|
||||
$alt = $image->getAttribute('alt');
|
||||
$title = $image->getAttribute('title');
|
||||
|
||||
$filename = pathinfo($src);
|
||||
$filename = $filename['filename'];
|
||||
|
||||
$alt = empty($alt) ? $filename : $alt;
|
||||
$title = empty($title) ? $filename : $title;
|
||||
|
||||
$image->setAttribute('alt', $alt);
|
||||
$image->setAttribute('title', $title);
|
||||
}
|
||||
|
||||
$html = $this->clear_doctype($document->saveHTML());
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function get_external_xml ($identifier) {
|
||||
|
||||
$response = '';
|
||||
|
||||
$xpath = cc2moodle::newx_path(cc2moodle::$manifest, cc2moodle::$namespaces);
|
||||
|
||||
$files = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $identifier . '"]/imscc:file/@href');
|
||||
|
||||
if (empty($files)) {
|
||||
$response = '';
|
||||
} else {
|
||||
$response = $files->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function move_files ($files, $destination_folder) {
|
||||
|
||||
if (!empty($files)) {
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
||||
$source = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $file->nodeValue;
|
||||
$destination = $destination_folder . DIRECTORY_SEPARATOR . $file->nodeValue;
|
||||
|
||||
$destination_directory = dirname($destination);
|
||||
|
||||
cc2moodle::log_action('Copy the file: ' . $source . ' to ' . $destination);
|
||||
|
||||
//echo 'Copy the file: ' . $source . ' to ' . $destination . '<br>';
|
||||
|
||||
if (!file_exists($destination_directory)) {
|
||||
mkdir($destination_directory, 0777, true);
|
||||
}
|
||||
|
||||
$copy_success = @copy($source, $destination);
|
||||
|
||||
if (!$copy_success) {
|
||||
notify('WARNING: Cannot copy the file ' . $source . ' to ' . $destination);
|
||||
cc2moodle::log_action('Cannot copy the file ' . $source . ' to ' . $destination, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function get_all_files () {
|
||||
|
||||
$all_files = array();
|
||||
|
||||
$xpath = cc2moodle::newx_path(cc2moodle::$manifest, cc2moodle::$namespaces);
|
||||
|
||||
$types = array('associatedcontent/imscc_xmlv1p0/learning-application-resource',
|
||||
'webcontent',
|
||||
);
|
||||
|
||||
foreach ($types as $type) {
|
||||
|
||||
$files = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@type="' . $type . '"]/imscc:file/@href');
|
||||
|
||||
if (!empty($files)) {
|
||||
foreach ($files as $file) {
|
||||
$all_files[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
unset($files);
|
||||
}
|
||||
|
||||
$all_files = empty($all_files) ? '' : $all_files;
|
||||
|
||||
return $all_files;
|
||||
}
|
||||
|
||||
public function move_all_files() {
|
||||
|
||||
$files = $this->get_all_files();
|
||||
|
||||
if (!empty($files)) {
|
||||
$this->move_files($files, cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function clear_doctype ($html) {
|
||||
|
||||
return preg_replace('/^<!DOCTYPE.+?>/',
|
||||
'',
|
||||
str_replace(array('<html>' , '</html>' , '<body>' , '</body>'),
|
||||
array('' , '' , '' , ''),
|
||||
$html));
|
||||
}
|
||||
|
||||
public function generate_random_string ($length = 6) {
|
||||
|
||||
$response = '';
|
||||
$source = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
if ($length > 0) {
|
||||
|
||||
$response = '';
|
||||
$source = str_split($source, 1);
|
||||
|
||||
for ($i = 1; $i <= $length; $i++) {
|
||||
mt_srand((double) microtime() * 1000000);
|
||||
$num = mt_rand(1, count($source));
|
||||
$response .= $source[$num - 1];
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function truncate_text ($text, $max, $remove_html) {
|
||||
|
||||
if ($max > 10) {
|
||||
$text = substr($text, 0, ($max - 6)) . ' [...]';
|
||||
} else {
|
||||
$text = substr($text, 0, $max);
|
||||
}
|
||||
|
||||
$text = $remove_html ? strip_tags($text) : $text;
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Executable
+128
@@ -0,0 +1,128 @@
|
||||
<?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/>.
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @subpackage backup-imscc
|
||||
* @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
class forum extends entities {
|
||||
|
||||
public function generate_node () {
|
||||
|
||||
cc2moodle::log_action('Creating Forum mods');
|
||||
|
||||
$response = '';
|
||||
|
||||
if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_FORUM])) {
|
||||
foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_FORUM] as $instance) {
|
||||
$response .= $this->create_node_course_modules_mod_forum($instance);
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function create_node_course_modules_mod_forum ($instance) {
|
||||
|
||||
$sheet_mod_forum = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_FORUM);
|
||||
|
||||
$topic_data = $this->get_topic_data($instance);
|
||||
|
||||
if (!empty($topic_data)) {
|
||||
|
||||
$find_tags = array('[#mod_instance#]',
|
||||
'[#mod_forum_title#]',
|
||||
'[#mod_forum_intro#]',
|
||||
'[#date_now#]');
|
||||
|
||||
$replace_values = array($instance['instance'],
|
||||
$instance['title'] . ' - ' . $topic_data['title'],
|
||||
$topic_data['description'],
|
||||
time());
|
||||
|
||||
return str_replace($find_tags, $replace_values, $sheet_mod_forum);
|
||||
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function get_topic_data ($instance) {
|
||||
|
||||
$topic_data = '';
|
||||
|
||||
$namespaces = array('dt' => 'http://www.imsglobal.org/xsd/imsdt_v1p0');
|
||||
|
||||
$topic_file = $this->get_external_xml($instance['resource_indentifier']);
|
||||
|
||||
if (!empty($topic_file)) {
|
||||
|
||||
$topic = $this->load_xml_resource(cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $topic_file);
|
||||
|
||||
if (!empty($topic)) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($topic, $namespaces);
|
||||
|
||||
$topic_title = $xpath->query('/dt:topic/title');
|
||||
$topic_title = !empty($topic_title->item(0)->nodeValue) ? $topic_title->item(0)->nodeValue : '';
|
||||
|
||||
$topic_text = $xpath->query('/dt:topic/text');
|
||||
$topic_text = !empty($topic_text->item(0)->nodeValue) ? $this->update_sources($topic_text->item(0)->nodeValue, dirname($topic_file)) : '';
|
||||
$topic_text = !empty($topic_text) ? str_replace("%24", "\$", $this->include_titles($topic_text)) : '';
|
||||
|
||||
if (!empty($topic_title)) {
|
||||
$topic_data['title'] = $topic_title;
|
||||
$topic_data['description'] = $topic_text;
|
||||
}
|
||||
}
|
||||
|
||||
$topic_attachments = $xpath->query('/dt:topic/attachments/attachment/@href');
|
||||
|
||||
if ($topic_attachments->length > 0) {
|
||||
|
||||
$attachment_html = '';
|
||||
|
||||
foreach ($topic_attachments as $file) {
|
||||
$attachment_html .= $this->generate_attachment_html($file->nodeValue);
|
||||
}
|
||||
|
||||
$topic_data['description'] = !empty($attachment_html) ? $topic_text . '<p>Attachments:</p>' . $attachment_html : $topic_text;
|
||||
}
|
||||
}
|
||||
|
||||
return $topic_data;
|
||||
}
|
||||
|
||||
private function generate_attachment_html ($filename) {
|
||||
|
||||
$images_extensions = array('gif' , 'jpeg' , 'jpg' , 'jif' , 'jfif' , 'png' , 'bmp');
|
||||
|
||||
$fileinfo = pathinfo($filename);
|
||||
|
||||
if (in_array($fileinfo['extension'], $images_extensions)) {
|
||||
return '<img src="$@FILEPHP@$/' . $filename . '" title="' . $fileinfo['basename'] . '" alt="' . $fileinfo['basename'] . '" /><br />';
|
||||
} else {
|
||||
return '<a href="$@FILEPHP@$/' . $filename . '" title="' . $fileinfo['basename'] . '" alt="' . $fileinfo['basename'] . '">' . $fileinfo['basename'] . '</a><br />';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
?>
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @subpackage backup-imscc
|
||||
* @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
class label extends entities {
|
||||
|
||||
public function generate_node () {
|
||||
|
||||
cc2moodle::log_action('Creating Labels mods');
|
||||
|
||||
$response = '';
|
||||
|
||||
$sheet_mod_label = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LABEL);
|
||||
|
||||
if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_LABEL])) {
|
||||
foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_LABEL] as $instance) {
|
||||
$response .= $this->create_node_course_modules_mod_label($sheet_mod_label, $instance);
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function create_node_course_modules_mod_label ($sheet_mod_label, $instance) {
|
||||
|
||||
$find_tags = array('[#mod_instance#]',
|
||||
'[#mod_name#]',
|
||||
'[#mod_content#]',
|
||||
'[#date_now#]');
|
||||
|
||||
$replace_values = array($instance['instance'],
|
||||
$instance['title'],
|
||||
$instance['title'],
|
||||
time());
|
||||
|
||||
return str_replace($find_tags, $replace_values, $sheet_mod_label);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Executable
+958
@@ -0,0 +1,958 @@
|
||||
<?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/>.
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @subpackage backup-imscc
|
||||
* @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
class quiz extends entities {
|
||||
|
||||
private $namespaces = array('xmlns' => 'http://www.imsglobal.org/xsd/ims_qtiasiv1p2');
|
||||
|
||||
public function generate_node_question_categories () {
|
||||
|
||||
$instances = $this->generate_instances();
|
||||
|
||||
$node_course_question_categories = $this->create_node_course_question_categories($instances);
|
||||
$node_course_question_categories = empty($node_course_question_categories) ? '' : $node_course_question_categories;
|
||||
|
||||
return $node_course_question_categories;
|
||||
|
||||
}
|
||||
|
||||
public function generate_node_course_modules_mod () {
|
||||
|
||||
cc2moodle::log_action('Creating Quiz mods');
|
||||
|
||||
$node_course_modules_mod = '';
|
||||
$instances = $this->generate_instances();
|
||||
|
||||
if (!empty($instances)) {
|
||||
foreach ($instances as $instance) {
|
||||
if ($instance['is_question_bank'] == 0) {
|
||||
$node_course_modules_mod .= $this->create_node_course_modules_mod($instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $node_course_modules_mod;
|
||||
|
||||
}
|
||||
|
||||
private function create_node_course_modules_mod_quiz_feedback () {
|
||||
|
||||
$sheet_question_mod_feedback = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_FEEDBACK);
|
||||
|
||||
return $sheet_question_mod_feedback;
|
||||
}
|
||||
|
||||
private function generate_instances () {
|
||||
|
||||
$last_instance_id = 0;
|
||||
$last_question_id = 0;
|
||||
$last_answer_id = 0;
|
||||
|
||||
$instances = '';
|
||||
|
||||
$types = array(MOODLE_TYPE_QUIZ, MOODLE_TYPE_QUESTION_BANK);
|
||||
|
||||
foreach ($types as $type) {
|
||||
|
||||
if (!empty(cc2moodle::$instances['instances'][$type])) {
|
||||
|
||||
foreach (cc2moodle::$instances['instances'][$type] as $instance) {
|
||||
|
||||
if ($type == MOODLE_TYPE_QUIZ) {
|
||||
$is_question_bank = 0;
|
||||
} else {
|
||||
$is_question_bank = 1;
|
||||
}
|
||||
|
||||
$assessment_file = $this->get_external_xml($instance['resource_indentifier']);
|
||||
|
||||
if (!empty($assessment_file)) {
|
||||
|
||||
$assessment = $this->load_xml_resource(cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $assessment_file);
|
||||
|
||||
if (!empty($assessment)) {
|
||||
|
||||
$replace_values = array('unlimited' => 0);
|
||||
|
||||
$questions = $this->get_questions($assessment, $last_question_id, $last_answer_id, dirname($assessment_file), $is_question_bank);
|
||||
$question_count = count($questions);
|
||||
|
||||
if (!empty($question_count)) {
|
||||
|
||||
$last_instance_id++;
|
||||
|
||||
$instances[$instance['resource_indentifier']]['questions'] = $questions;
|
||||
$instances[$instance['resource_indentifier']]['id'] = $last_instance_id;
|
||||
$instances[$instance['resource_indentifier']]['title'] = $instance['title'];
|
||||
$instances[$instance['resource_indentifier']]['is_question_bank'] = $is_question_bank;
|
||||
$instances[$instance['resource_indentifier']]['options']['timelimit'] = $this->get_global_config($assessment, 'qmd_timelimit', 0);
|
||||
$instances[$instance['resource_indentifier']]['options']['max_attempts'] = $this->get_global_config($assessment, 'cc_maxattempts', 0, $replace_values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $instances;
|
||||
}
|
||||
|
||||
|
||||
private function create_node_course_modules_mod ($instance) {
|
||||
|
||||
$sheet_question_mod = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ);
|
||||
|
||||
$node_course_modules_quiz_question_instances = $this->create_node_course_modules_mod_quiz_question_instances($instance);
|
||||
$node_course_modules_quiz_feedback = $this->create_node_course_modules_mod_quiz_feedback($instance);
|
||||
|
||||
$questions_strings = $this->get_questions_string($instance);
|
||||
$quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6);
|
||||
|
||||
$find_tags = array('[#mod_id#]',
|
||||
'[#mod_name#]',
|
||||
'[#mod_intro#]',
|
||||
'[#mod_stamp#]',
|
||||
'[#question_string#]',
|
||||
'[#date_now#]',
|
||||
'[#mod_max_attempts#]',
|
||||
'[#mod_timelimit#]',
|
||||
'[#node_question_instance#]',
|
||||
'[#node_questions_feedback#]');
|
||||
|
||||
$replace_values = array($instance['id'],
|
||||
$instance['title'],
|
||||
$instance['title'],
|
||||
$quiz_stamp,
|
||||
$questions_strings,
|
||||
time(),
|
||||
$instance['options']['max_attempts'],
|
||||
$instance['options']['timelimit'],
|
||||
$node_course_modules_quiz_question_instances,
|
||||
$node_course_modules_quiz_feedback);
|
||||
|
||||
$node_question_mod = str_replace($find_tags, $replace_values, $sheet_question_mod);
|
||||
|
||||
return $node_question_mod;
|
||||
}
|
||||
|
||||
private function get_global_config ($assessment, $option, $default_value, $replace_values = '') {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
$metadata = $xpath->query('/xmlns:questestinterop/xmlns:assessment/xmlns:qtimetadata/xmlns:qtimetadatafield');
|
||||
|
||||
foreach ($metadata as $field) {
|
||||
$field_label = $xpath->query('xmlns:fieldlabel', $field);
|
||||
$field_label = !empty($field_label->item(0)->nodeValue) ? $field_label->item(0)->nodeValue : '';
|
||||
|
||||
if (strtolower($field_label) == strtolower($option)) {
|
||||
$field_entry = $xpath->query('xmlns:fieldentry', $field);
|
||||
$response = !empty($field_entry->item(0)->nodeValue) ? $field_entry->item(0)->nodeValue : '';
|
||||
}
|
||||
}
|
||||
|
||||
$response = !empty($response) ? trim($response) : '';
|
||||
|
||||
if (!empty($replace_values)) {
|
||||
foreach ($replace_values as $key => $value) {
|
||||
$response = ($key == $response) ? $value : $response;
|
||||
}
|
||||
}
|
||||
|
||||
$response = empty($response) ? $default_value : $response;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function create_node_course_modules_mod_quiz_question_instances ($instance) {
|
||||
|
||||
$node_course_module_mod_quiz_questions_instances = '';
|
||||
$sheet_question_mod_instance = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_QUESTION_INSTANCE);
|
||||
|
||||
$find_tags = array('[#question_id#]' , '[#instance_id#]');
|
||||
|
||||
if (!empty($instance['questions'])) {
|
||||
|
||||
foreach ($instance['questions'] as $question) {
|
||||
$replace_values = array($question['id'] , $question['id']);
|
||||
$node_course_module_mod_quiz_questions_instances .= str_replace($find_tags, $replace_values, $sheet_question_mod_instance);
|
||||
}
|
||||
|
||||
$node_course_module_mod_quiz_questions_instances = str_replace($find_tags, $replace_values, $node_course_module_mod_quiz_questions_instances);
|
||||
}
|
||||
|
||||
return $node_course_module_mod_quiz_questions_instances;
|
||||
}
|
||||
|
||||
private function get_questions_string ($instance) {
|
||||
|
||||
$questions_string = '';
|
||||
|
||||
if (!empty($instance['questions'])) {
|
||||
foreach ($instance['questions'] as $question) {
|
||||
$questions_string .= $question['id'] . ',';
|
||||
}
|
||||
}
|
||||
|
||||
$questions_string = !empty($questions_string) ? substr($questions_string, 0, strlen($questions_string) - 1) : '';
|
||||
|
||||
return $questions_string;
|
||||
}
|
||||
|
||||
private function create_node_course_question_categories ($instances) {
|
||||
|
||||
$sheet_question_categories = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES);
|
||||
|
||||
if (!empty($instances)) {
|
||||
|
||||
$node_course_question_categories_question_category = '';
|
||||
|
||||
foreach ($instances as $instance) {
|
||||
$node_course_question_categories_question_category .= $this->create_node_course_question_categories_question_category($instance);
|
||||
}
|
||||
|
||||
$find_tags = array('[#node_course_question_categories_question_category#]');
|
||||
$replace_values = array($node_course_question_categories_question_category);
|
||||
|
||||
$node_course_question_categories = str_replace($find_tags, $replace_values, $sheet_question_categories);
|
||||
}
|
||||
|
||||
$node_course_question_categories = empty($node_course_question_categories) ? '' : $node_course_question_categories;
|
||||
|
||||
return $node_course_question_categories;
|
||||
}
|
||||
|
||||
private function create_node_course_question_categories_question_category ($instance) {
|
||||
|
||||
$sheet_question_categories_quetion_category = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY);
|
||||
|
||||
$find_tags = array('[#quiz_id#]',
|
||||
'[#quiz_name#]',
|
||||
'[#quiz_stamp#]',
|
||||
'[#node_course_question_categories_question_category_questions#]');
|
||||
|
||||
$node_course_question_categories_questions = $this->create_node_course_question_categories_question_category_question($instance);
|
||||
$node_course_question_categories_questions = empty($node_course_question_categories_questions) ? '' : $node_course_question_categories_questions;
|
||||
|
||||
$quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6);
|
||||
|
||||
$replace_values = array($instance['id'],
|
||||
$instance['title'],
|
||||
$quiz_stamp,
|
||||
$node_course_question_categories_questions);
|
||||
|
||||
$node_question_categories = str_replace($find_tags, $replace_values, $sheet_question_categories_quetion_category);
|
||||
|
||||
return $node_question_categories;
|
||||
}
|
||||
|
||||
private function create_node_course_question_categories_question_category_question ($instance) {
|
||||
|
||||
global $USER;
|
||||
|
||||
$node_course_question_categories_question = '';
|
||||
|
||||
$find_tags = array('[#question_id#]',
|
||||
'[#question_title#]',
|
||||
'[#question_text#]',
|
||||
'[#question_type#]',
|
||||
'[#question_general_feedback#]',
|
||||
'[#date_now#]',
|
||||
'[#question_type_nodes#]',
|
||||
'[#question_stamp#]',
|
||||
'[#question_version#]',
|
||||
'[#logged_user#]');
|
||||
|
||||
$sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION);
|
||||
|
||||
$questions = $instance['questions'];
|
||||
|
||||
if (!empty($questions)) {
|
||||
|
||||
foreach ($questions as $question) {
|
||||
|
||||
$quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6);
|
||||
$quiz_version = 'localhost+' . time() . '+' . $this->generate_random_string(6);
|
||||
|
||||
$question_moodle_type = $question['moodle_type'];
|
||||
$question_cc_type = $question['cc_type'];
|
||||
|
||||
$question_type_node = '';
|
||||
|
||||
$question_type_node = ($question_moodle_type == MOODLE_QUIZ_MULTIPLE_CHOICE) ? $this->create_node_course_question_categories_question_category_question_multiple_choice($question) : $question_type_node;
|
||||
$question_type_node = ($question_moodle_type == MOODLE_QUIZ_TRUE_FALSE) ? $this->create_node_course_question_categories_question_category_question_true_false($question) : $question_type_node;
|
||||
$question_type_node = ($question_moodle_type == MOODLE_QUIZ_ESSAY) ? $this->create_node_course_question_categories_question_category_question_eesay($question) : $question_type_node;
|
||||
$question_type_node = ($question_moodle_type == MOODLE_QUIZ_SHORTANSWER) ? $this->create_node_course_question_categories_question_category_question_shortanswer($question) : $question_type_node;
|
||||
|
||||
$replace_values = array($question['id'],
|
||||
$this->truncate_text($question['title'], 255, true),
|
||||
$question['title'],
|
||||
$question_moodle_type,
|
||||
$question['feedback'],
|
||||
time(),
|
||||
$question_type_node,
|
||||
$quiz_stamp,
|
||||
$quiz_version,
|
||||
$USER->id);
|
||||
|
||||
$node_course_question_categories_question .= str_replace($find_tags, $replace_values, $sheet_question_categories_question);
|
||||
}
|
||||
}
|
||||
|
||||
$node_course_question_categories_question = empty($node_course_question_categories_question) ? '' : $node_course_question_categories_question;
|
||||
|
||||
return $node_course_question_categories_question;
|
||||
}
|
||||
|
||||
private function get_questions ($assessment, &$last_question_id, &$last_answer_id, $root_path, $is_question_bank) {
|
||||
|
||||
$questions = array();
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
|
||||
if (!$is_question_bank) {
|
||||
$questions_items = $xpath->query('/xmlns:questestinterop/xmlns:assessment/xmlns:section/xmlns:item');
|
||||
} else {
|
||||
$questions_items = $xpath->query('/xmlns:questestinterop/xmlns:objectbank/xmlns:item');
|
||||
}
|
||||
|
||||
foreach ($questions_items as $question_item) {
|
||||
|
||||
$count_questions = $xpath->evaluate('count(xmlns:presentation/xmlns:flow/xmlns:material/xmlns:mattext)', $question_item);
|
||||
|
||||
if ($count_questions == 0) {
|
||||
$question_title = $xpath->query('xmlns:presentation/xmlns:material/xmlns:mattext', $question_item);
|
||||
} else {
|
||||
$question_title = $xpath->query('xmlns:presentation/xmlns:flow/xmlns:material/xmlns:mattext', $question_item);
|
||||
}
|
||||
|
||||
$question_title = !empty($question_title->item(0)->nodeValue) ? $question_title->item(0)->nodeValue : '';
|
||||
|
||||
$question_identifier = $xpath->query('@ident', $question_item);
|
||||
$question_identifier = !empty($question_identifier->item(0)->nodeValue) ? $question_identifier->item(0)->nodeValue : '';
|
||||
|
||||
if (!empty($question_identifier)) {
|
||||
|
||||
$question_type = $this->get_question_type($question_identifier, $assessment);
|
||||
|
||||
if (!empty($question_type['moodle'])) {
|
||||
|
||||
$last_question_id++;
|
||||
|
||||
$questions[$question_identifier]['id'] = $last_question_id;
|
||||
|
||||
$question_title = $this->update_sources($question_title, $root_path);
|
||||
$question_title = !empty($question_title) ? str_replace("%24", "\$", $this->include_titles($question_title)) : '';
|
||||
|
||||
$questions[$question_identifier]['title'] = $question_title;
|
||||
$questions[$question_identifier]['identifier'] = $question_identifier;
|
||||
$questions[$question_identifier]['moodle_type'] = $question_type['moodle'];
|
||||
$questions[$question_identifier]['cc_type'] = $question_type['cc'];
|
||||
$questions[$question_identifier]['feedback'] = $this->get_general_feedback($assessment, $question_identifier);
|
||||
$questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$questions = !empty($questions) ? $questions : '';
|
||||
|
||||
return $questions;
|
||||
}
|
||||
|
||||
private function str_replace_once ($search, $replace, $subject) {
|
||||
|
||||
$first_char = strpos($subject, $search);
|
||||
|
||||
if ($first_char !== false) {
|
||||
|
||||
$before_str = substr($subject, 0, $first_char);
|
||||
$after_str = substr($subject, $first_char + strlen($search));
|
||||
|
||||
return $before_str . $replace . $after_str;
|
||||
|
||||
} else {
|
||||
return $subject;
|
||||
}
|
||||
}
|
||||
|
||||
private function get_general_feedback ($assessment, $question_identifier) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
|
||||
$respconditions = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition');
|
||||
|
||||
if (!empty($respconditions)) {
|
||||
|
||||
foreach ($respconditions as $respcondition) {
|
||||
|
||||
$continue = $respcondition->getAttributeNode('continue');
|
||||
$continue = !empty($continue->nodeValue) ? strtolower($continue->nodeValue) : '';
|
||||
|
||||
if ($continue == 'yes') {
|
||||
|
||||
$display_feedback = $xpath->query('xmlns:displayfeedback', $respcondition);
|
||||
|
||||
if (!empty($display_feedback)) {
|
||||
foreach ($display_feedback as $feedback) {
|
||||
|
||||
$feedback_identifier = $feedback->getAttributeNode('linkrefid');
|
||||
$feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : '';
|
||||
|
||||
if (!empty($feedback_identifier)) {
|
||||
$feedbacks_identifiers[] = $feedback_identifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$feedback = '';
|
||||
$feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers;
|
||||
|
||||
if (!empty($feedbacks_identifiers)) {
|
||||
foreach ($feedbacks_identifiers as $feedback_identifier) {
|
||||
$feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext');
|
||||
$feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : '';
|
||||
}
|
||||
}
|
||||
|
||||
return $feedback;
|
||||
}
|
||||
|
||||
private function get_feedback ($assessment, $identifier, $item_identifier, $question_type) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
|
||||
$resource_processing = $xpath->query('//xmlns:item[@ident="' . $item_identifier . '"]/xmlns:resprocessing/xmlns:respcondition');
|
||||
|
||||
if (!empty($resource_processing)) {
|
||||
|
||||
foreach ($resource_processing as $response) {
|
||||
|
||||
$varequal = $xpath->query('xmlns:conditionvar/xmlns:varequal', $response);
|
||||
$varequal = !empty($varequal->item(0)->nodeValue) ? $varequal->item(0)->nodeValue : '';
|
||||
|
||||
if (strtolower($varequal) == strtolower($identifier) || ($question_type == CC_QUIZ_ESSAY)) {
|
||||
|
||||
$display_feedback = $xpath->query('xmlns:displayfeedback', $response);
|
||||
|
||||
if (!empty($display_feedback)) {
|
||||
foreach ($display_feedback as $feedback) {
|
||||
|
||||
$feedback_identifier = $feedback->getAttributeNode('linkrefid');
|
||||
$feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : '';
|
||||
|
||||
if (!empty($feedback_identifier)) {
|
||||
$feedbacks_identifiers[] = $feedback_identifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$feedback = '';
|
||||
$feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers;
|
||||
|
||||
if (!empty($feedbacks_identifiers)) {
|
||||
foreach ($feedbacks_identifiers as $feedback_identifier) {
|
||||
$feedbacks = $xpath->query('//xmlns:item[@ident="' . $item_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext');
|
||||
$feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : '';
|
||||
}
|
||||
}
|
||||
|
||||
return $feedback;
|
||||
}
|
||||
|
||||
private function get_answers_fib ($question_identifier, $identifier, $assessment, &$last_answer_id) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
|
||||
$answers_fib = array();
|
||||
|
||||
$response_items = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition');
|
||||
|
||||
foreach ($response_items as $response_item) {
|
||||
|
||||
$setvar = $xpath->query('xmlns:setvar', $response_item);
|
||||
$setvar = is_object($setvar->item(0)) ? $setvar->item(0)->nodeValue : '';
|
||||
|
||||
if ($setvar != '') {
|
||||
|
||||
$last_answer_id++;
|
||||
|
||||
$answer_title = $xpath->query('xmlns:conditionvar/xmlns:varequal[@respident="' . $identifier . '"]', $response_item);
|
||||
$answer_title = !empty($answer_title->item(0)->nodeValue) ? $answer_title->item(0)->nodeValue : '';
|
||||
|
||||
$case = $xpath->query('xmlns:conditionvar/xmlns:varequal/@case', $response_item);
|
||||
$case = is_object($case->item(0)) ? $case->item(0)->nodeValue : 'no'
|
||||
;
|
||||
$case = strtolower($case) == 'yes' ? 1 :
|
||||
0;
|
||||
|
||||
$display_feedback = $xpath->query('xmlns:displayfeedback', $response_item);
|
||||
|
||||
unset($feedbacks_identifiers);
|
||||
|
||||
if (!empty($display_feedback)) {
|
||||
|
||||
foreach ($display_feedback as $feedback) {
|
||||
|
||||
$feedback_identifier = $feedback->getAttributeNode('linkrefid');
|
||||
$feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : '';
|
||||
|
||||
if (!empty($feedback_identifier)) {
|
||||
$feedbacks_identifiers[] = $feedback_identifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$feedback = '';
|
||||
$feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers;
|
||||
|
||||
if (!empty($feedbacks_identifiers)) {
|
||||
foreach ($feedbacks_identifiers as $feedback_identifier) {
|
||||
$feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext');
|
||||
$feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : '';
|
||||
}
|
||||
}
|
||||
|
||||
$answers_fib[] = array('id' => $last_answer_id,
|
||||
'title' => $answer_title,
|
||||
'score' => $setvar,
|
||||
'feedback' => $feedback,
|
||||
'case' => $case);
|
||||
}
|
||||
}
|
||||
|
||||
$answers_fib = empty($answers_fib) ? '' : $answers_fib;
|
||||
|
||||
return $answers_fib;
|
||||
}
|
||||
|
||||
private function get_answers_pattern_match ($question_identifier, $identifier, $assessment, &$last_answer_id) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
|
||||
$answers_fib = array();
|
||||
|
||||
$response_items = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition');
|
||||
|
||||
foreach ($response_items as $response_item) {
|
||||
|
||||
$setvar = $xpath->query('xmlns:setvar', $response_item);
|
||||
$setvar = is_object($setvar->item(0)) ? $setvar->item(0)->nodeValue : '';
|
||||
|
||||
if ($setvar != '') {
|
||||
|
||||
$last_answer_id++;
|
||||
|
||||
$answer_title = $xpath->query('xmlns:conditionvar/xmlns:varequal[@respident="' . $identifier . '"]', $response_item);
|
||||
$answer_title = !empty($answer_title->item(0)->nodeValue) ? $answer_title->item(0)->nodeValue : '';
|
||||
|
||||
if (empty($answer_title)) {
|
||||
$answer_title = $xpath->query('xmlns:conditionvar/xmlns:varsubstring[@respident="' . $identifier . '"]', $response_item);
|
||||
$answer_title = !empty($answer_title->item(0)->nodeValue) ? '*' . $answer_title->item(0)->nodeValue . '*' : '';
|
||||
}
|
||||
|
||||
if (empty($answer_title)) {
|
||||
$answer_title = '*';
|
||||
}
|
||||
|
||||
$case = $xpath->query('xmlns:conditionvar/xmlns:varequal/@case', $response_item);
|
||||
$case = is_object($case->item(0)) ? $case->item(0)->nodeValue : 'no'
|
||||
;
|
||||
$case = strtolower($case) == 'yes' ? 1 :
|
||||
0;
|
||||
|
||||
$display_feedback = $xpath->query('xmlns:displayfeedback', $response_item);
|
||||
|
||||
unset($feedbacks_identifiers);
|
||||
|
||||
if (!empty($display_feedback)) {
|
||||
|
||||
foreach ($display_feedback as $feedback) {
|
||||
|
||||
$feedback_identifier = $feedback->getAttributeNode('linkrefid');
|
||||
$feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : '';
|
||||
|
||||
if (!empty($feedback_identifier)) {
|
||||
$feedbacks_identifiers[] = $feedback_identifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$feedback = '';
|
||||
$feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers;
|
||||
|
||||
if (!empty($feedbacks_identifiers)) {
|
||||
foreach ($feedbacks_identifiers as $feedback_identifier) {
|
||||
$feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext');
|
||||
$feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : '';
|
||||
}
|
||||
}
|
||||
|
||||
$answers_fib[] = array('id' => $last_answer_id,
|
||||
'title' => $answer_title,
|
||||
'score' => $setvar,
|
||||
'feedback' => $feedback,
|
||||
'case' => $case);
|
||||
}
|
||||
}
|
||||
|
||||
$answers_fib = empty($answers_fib) ? '' : $answers_fib;
|
||||
|
||||
return $answers_fib;
|
||||
}
|
||||
|
||||
|
||||
private function get_answers ($identifier, $assessment, &$last_answer_id) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
|
||||
$answers = array();
|
||||
|
||||
$question_cc_type = $this->get_question_type($identifier, $assessment);
|
||||
$question_cc_type = $question_cc_type['cc'];
|
||||
|
||||
if ($question_cc_type == CC_QUIZ_MULTIPLE_CHOICE || $question_cc_type == CC_QUIZ_MULTIPLE_RESPONSE || $question_cc_type == CC_QUIZ_TRUE_FALSE) {
|
||||
|
||||
$query_answers = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_lid/xmlns:render_choice/xmlns:response_label';
|
||||
$query_answers_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_lid/xmlns:render_choice/xmlns:response_label';
|
||||
|
||||
$query_indentifer = '@ident';
|
||||
$query_title = 'xmlns:material/xmlns:mattext';
|
||||
}
|
||||
|
||||
if ($question_cc_type == CC_QUIZ_ESSAY) {
|
||||
|
||||
$query_answers = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_str';
|
||||
$query_answers_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_str';
|
||||
|
||||
$query_indentifer = '@ident';
|
||||
$query_title = 'xmlns:render_fib';
|
||||
}
|
||||
|
||||
if ($question_cc_type == CC_QUIZ_FIB || $question_cc_type == CC_QUIZ_PATTERN_MACHT) {
|
||||
|
||||
$xpath_query = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_str/@ident';
|
||||
$xpath_query_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_str/@ident';
|
||||
|
||||
$count_response = $xpath->evaluate('count(' . $xpath_query_with_flow . ')');
|
||||
|
||||
if ($count_response == 0) {
|
||||
$answer_identifier = $xpath->query($xpath_query);
|
||||
} else {
|
||||
$answer_identifier = $xpath->query($xpath_query_with_flow);
|
||||
}
|
||||
|
||||
$answer_identifier = !empty($answer_identifier->item(0)->nodeValue) ? $answer_identifier->item(0)->nodeValue : '';
|
||||
|
||||
if ($question_cc_type == CC_QUIZ_FIB) {
|
||||
$answers = $this->get_answers_fib ($identifier, $answer_identifier, $assessment, $last_answer_id);
|
||||
} else {
|
||||
$answers = $this->get_answers_pattern_match ($identifier, $answer_identifier, $assessment, $last_answer_id);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$count_response = $xpath->evaluate('count(' . $query_answers_with_flow . ')');
|
||||
|
||||
if ($count_response == 0) {
|
||||
$response_items = $xpath->query($query_answers);
|
||||
} else {
|
||||
$response_items = $xpath->query($query_answers_with_flow);
|
||||
}
|
||||
|
||||
if (!empty($response_items)) {
|
||||
|
||||
foreach ($response_items as $response_item) {
|
||||
|
||||
$last_answer_id++;
|
||||
|
||||
$answer_identifier = $xpath->query($query_indentifer, $response_item);
|
||||
$answer_identifier = !empty($answer_identifier->item(0)->nodeValue) ? $answer_identifier->item(0)->nodeValue : '';
|
||||
|
||||
$answer_title = $xpath->query($query_title, $response_item);
|
||||
$answer_title = !empty($answer_title->item(0)->nodeValue) ? $answer_title->item(0)->nodeValue : '';
|
||||
|
||||
$answer_feedback = $this->get_feedback($assessment, $answer_identifier, $identifier, $question_cc_type);
|
||||
|
||||
$answer_score = $this->get_score($assessment, $answer_identifier, $identifier);
|
||||
|
||||
$answers[] = array('id' => $last_answer_id,
|
||||
'title' => $answer_title,
|
||||
'score' => $answer_score,
|
||||
'identifier' => $answer_identifier,
|
||||
'feedback' => $answer_feedback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$answers = empty($answers) ? '' : $answers;
|
||||
|
||||
return $answers;
|
||||
|
||||
}
|
||||
|
||||
private function get_score ($assessment, $identifier, $question_identifier) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
|
||||
$resource_processing = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition');
|
||||
|
||||
if (!empty($resource_processing)) {
|
||||
|
||||
foreach ($resource_processing as $response) {
|
||||
|
||||
$question_cc_type = $this->get_question_type($question_identifier, $assessment);
|
||||
$question_cc_type = $question_cc_type['cc'];
|
||||
|
||||
$varequal = $xpath->query('xmlns:conditionvar/xmlns:varequal', $response);
|
||||
$varequal = !empty($varequal->item(0)->nodeValue) ? $varequal->item(0)->nodeValue : '';
|
||||
|
||||
if (strtolower($varequal) == strtolower($identifier)) {
|
||||
$score = $xpath->query('xmlns:setvar', $response);
|
||||
$score = !empty($score->item(0)->nodeValue) ? $score->item(0)->nodeValue : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$score = empty($score) ? 0 : $score;
|
||||
|
||||
return $score;
|
||||
}
|
||||
|
||||
private function create_node_course_question_categories_question_category_question_multiple_choice ($question) {
|
||||
|
||||
$node_course_question_categories_question_answer = '';
|
||||
$sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_MULTIPLE_CHOICE);
|
||||
|
||||
if (!empty($question['answers'])) {
|
||||
foreach ($question['answers'] as $answer) {
|
||||
$node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer);
|
||||
}
|
||||
}
|
||||
|
||||
$answer_string = $this->get_answers_string($question['answers']);
|
||||
|
||||
$is_single = ($question['cc_type'] == CC_QUIZ_MULTIPLE_CHOICE) ? 1 : 0;
|
||||
|
||||
$find_tags = array('[#node_course_question_categories_question_category_question_answer#]',
|
||||
'[#answer_string#]',
|
||||
'[#is_single#]');
|
||||
|
||||
$replace_values = array($node_course_question_categories_question_answer,
|
||||
$answer_string,
|
||||
$is_single);
|
||||
|
||||
$node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question);
|
||||
|
||||
return $node_question_categories_question;
|
||||
}
|
||||
|
||||
private function create_node_course_question_categories_question_category_question_eesay ($question) {
|
||||
|
||||
$node_course_question_categories_question_answer = '';
|
||||
|
||||
$sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_EESAY);
|
||||
|
||||
if (!empty($question['answers'])) {
|
||||
foreach ($question['answers'] as $answer) {
|
||||
$node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer);
|
||||
}
|
||||
}
|
||||
|
||||
$find_tags = array('[#node_course_question_categories_question_category_question_answer#]');
|
||||
$replace_values = array($node_course_question_categories_question_answer);
|
||||
|
||||
$node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question);
|
||||
|
||||
return $node_question_categories_question;
|
||||
}
|
||||
|
||||
private function create_node_course_question_categories_question_category_question_shortanswer ($question) { //, &$fib_questions) {
|
||||
|
||||
$sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_SHORTANSWER);
|
||||
$node_course_question_categories_question_answer = '';
|
||||
|
||||
if (!empty($question['answers'])) {
|
||||
foreach ($question['answers'] as $answer) {
|
||||
$node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer);
|
||||
}
|
||||
}
|
||||
|
||||
$answers_string = $this->get_answers_string($question['answers']);
|
||||
|
||||
$use_case = 0;
|
||||
|
||||
foreach ($question['answers'] as $answer) {
|
||||
|
||||
if ($answer['case'] == 1) {
|
||||
$use_case = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$find_tags = array('[#answers_string#]',
|
||||
'[#use_case#]',
|
||||
'[#node_course_question_categories_question_category_question_answer#]');
|
||||
|
||||
$replace_values = array($answers_string,
|
||||
$use_case,
|
||||
$node_course_question_categories_question_answer);
|
||||
|
||||
|
||||
|
||||
$node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question);
|
||||
|
||||
return $node_question_categories_question;
|
||||
|
||||
}
|
||||
|
||||
private function create_node_course_question_categories_question_category_question_true_false ($question) {
|
||||
|
||||
$node_course_question_categories_question_answer = '';
|
||||
|
||||
$sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_TRUE_FALSE);
|
||||
|
||||
$max_score = 0;
|
||||
$true_answer_id = 0;
|
||||
$false_answer_id = 0;
|
||||
|
||||
if (!empty($question['answers'])) {
|
||||
|
||||
foreach ($question['answers'] as $answer) {
|
||||
if ($answer['score'] > $max_score) {
|
||||
$max_score = $answer['score'];
|
||||
$true_answer_id = $answer['id'];
|
||||
}
|
||||
|
||||
$node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer);
|
||||
}
|
||||
|
||||
foreach ($question['answers'] as $answer) {
|
||||
|
||||
if ($answer['id'] != $true_answer_id) {
|
||||
$max_score = $answer['score'];
|
||||
$false_answer_id = $answer['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$find_tags = array('[#node_course_question_categories_question_category_question_answer#]',
|
||||
'[#true_answer_id#]',
|
||||
'[#false_answer_id#]');
|
||||
|
||||
$replace_values = array($node_course_question_categories_question_answer,
|
||||
$true_answer_id,
|
||||
$false_answer_id);
|
||||
|
||||
$node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question);
|
||||
|
||||
return $node_question_categories_question;
|
||||
}
|
||||
|
||||
private function get_answers_string ($answers) {
|
||||
|
||||
$answer_string = '';
|
||||
|
||||
if (!empty($answers)) {
|
||||
foreach ($answers as $answer) {
|
||||
$answer_string .= $answer['id'] . ',';
|
||||
}
|
||||
}
|
||||
|
||||
$answer_string = !empty($answer_string) ? substr($answer_string, 0, strlen($answer_string) - 1) : '';
|
||||
|
||||
return $answer_string;
|
||||
|
||||
}
|
||||
|
||||
private function create_node_course_question_categories_question_category_question_answer ($answer) {
|
||||
|
||||
$sheet_question_categories_question_answer = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_ANSWER);
|
||||
|
||||
$find_tags = array('[#answer_id#]',
|
||||
'[#answer_text#]',
|
||||
'[#answer_score#]',
|
||||
'[#answer_feedback#]');
|
||||
|
||||
$replace_values = array($answer['id'],
|
||||
$answer['title'],
|
||||
$answer['score'],
|
||||
$answer['feedback']);
|
||||
|
||||
$node_question_categories_question_answer = str_replace($find_tags, $replace_values, $sheet_question_categories_question_answer);
|
||||
|
||||
return $node_question_categories_question_answer;
|
||||
}
|
||||
|
||||
private function get_question_type ($identifier, $assessment) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, $this->namespaces);
|
||||
|
||||
$metadata = $xpath->query('//xmlns:item[@ident="' . $identifier . '"]/xmlns:itemmetadata/xmlns:qtimetadata/xmlns:qtimetadatafield');
|
||||
|
||||
foreach ($metadata as $field) {
|
||||
|
||||
$field_label = $xpath->query('xmlns:fieldlabel', $field);
|
||||
$field_label = !empty($field_label->item(0)->nodeValue) ? $field_label->item(0)->nodeValue : '';
|
||||
|
||||
if ($field_label == 'cc_profile') {
|
||||
$field_entry = $xpath->query('xmlns:fieldentry', $field);
|
||||
$type = !empty($field_entry->item(0)->nodeValue) ? $field_entry->item(0)->nodeValue : '';
|
||||
}
|
||||
}
|
||||
|
||||
$return_type = array();
|
||||
|
||||
$return_type['moodle'] = '';
|
||||
$return_type['cc'] = $type;
|
||||
|
||||
if ($type == CC_QUIZ_MULTIPLE_CHOICE) {
|
||||
$return_type['moodle'] = MOODLE_QUIZ_MULTIPLE_CHOICE;
|
||||
}
|
||||
if ($type == CC_QUIZ_MULTIPLE_RESPONSE) {
|
||||
$return_type['moodle'] = MOODLE_QUIZ_MULTIPLE_CHOICE;
|
||||
}
|
||||
if ($type == CC_QUIZ_TRUE_FALSE) {
|
||||
$return_type['moodle'] = MOODLE_QUIZ_TRUE_FALSE;
|
||||
}
|
||||
if ($type == CC_QUIZ_ESSAY) {
|
||||
$return_type['moodle'] = MOODLE_QUIZ_ESSAY;
|
||||
}
|
||||
if ($type == CC_QUIZ_FIB) {
|
||||
$return_type['moodle'] = MOODLE_QUIZ_SHORTANSWER;
|
||||
}
|
||||
if ($type == CC_QUIZ_PATTERN_MACHT) {
|
||||
$return_type['moodle'] = MOODLE_QUIZ_SHORTANSWER;
|
||||
}
|
||||
|
||||
return $return_type;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
Executable
+104
@@ -0,0 +1,104 @@
|
||||
<?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/>.
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @subpackage backup-imscc
|
||||
* @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
class resource extends entities {
|
||||
|
||||
private $namespaces = array('wl' => 'http://www.imsglobal.org/xsd/imswl_v1p0');
|
||||
|
||||
public function generate_node () {
|
||||
|
||||
cc2moodle::log_action('Creating Resource mods');
|
||||
|
||||
$response = '';
|
||||
$sheet_mod_resource = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_RESOURCE);
|
||||
|
||||
if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_RESOURCE])) {
|
||||
foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_RESOURCE] as $instance) {
|
||||
$response .= $this->create_node_course_modules_mod_resource($sheet_mod_resource, $instance);
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
private function create_node_course_modules_mod_resource ($sheet_mod_resource, $instance) {
|
||||
|
||||
$link = '';
|
||||
$xpath = cc2moodle::newx_path(CC2Moodle::$manifest, CC2Moodle::$namespaces);
|
||||
|
||||
if ($instance['common_cartriedge_type'] == CC_TYPE_WEBCONTENT || $instance['common_cartriedge_type'] == CC_TYPE_ASSOCIATED_CONTENT) {
|
||||
$resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/@href');
|
||||
$resource = !empty($resource->item(0)->nodeValue) ? $resource->item(0)->nodeValue : '';
|
||||
|
||||
if (empty($resource)) {
|
||||
|
||||
unset($resource);
|
||||
|
||||
$resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/imscc:file/@href');
|
||||
$resource = !empty($resource->item(0)->nodeValue) ? $resource->item(0)->nodeValue : '';
|
||||
|
||||
}
|
||||
|
||||
if (!empty($resource)) {
|
||||
$link = $resource;
|
||||
}
|
||||
}
|
||||
|
||||
if ($instance['common_cartriedge_type'] == CC_TYPE_WEBLINK) {
|
||||
|
||||
$external_resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/imscc:file/@href')->item(0)->nodeValue;
|
||||
|
||||
if ($external_resource) {
|
||||
|
||||
$resource = $this->load_xml_resource(cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $external_resource);
|
||||
|
||||
if (!empty($resource)) {
|
||||
$xpath = cc2moodle::newx_path($resource, $this->namespaces);
|
||||
$resource = $xpath->query('/wl:webLink/url/@href');
|
||||
$link = $resource->item(0)->nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$find_tags = array('[#mod_instance#]',
|
||||
'[#mod_name#]',
|
||||
'[#mod_type#]',
|
||||
'[#mod_reference#]',
|
||||
'[#mod_summary#]',
|
||||
'[#mod_alltext#]',
|
||||
'[#date_now#]');
|
||||
|
||||
$replace_values = array($instance['instance'],
|
||||
$instance['title'],
|
||||
'file',
|
||||
$link,
|
||||
'',
|
||||
'',
|
||||
time());
|
||||
|
||||
return str_replace($find_tags, $replace_values, $sheet_mod_resource);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
<?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/>.
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @subpackage backup-imscc
|
||||
* @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
// GENERAL PARAMETERS ************************************************************************************************* //
|
||||
define('ROOT_DEEP', 2);
|
||||
|
||||
// PACKAGES FORMATS *************************************************************************************************** //
|
||||
define('FORMAT_UNKNOWN', 'NA');
|
||||
define('FORMAT_COMMON_CARTRIDGE', 'CC');
|
||||
define('FORMAT_BLACK_BOARD', 'BB');
|
||||
|
||||
// FORMATS NAMESPACES ************************************************************************************************* //
|
||||
define('NS_COMMON_CARTRIDGE', 'http://www.imsglobal.org/xsd/imscc/imscp_v1p1');
|
||||
define('NS_BLACK_BOARD', 'http://www.blackboard.com/content-packaging');
|
||||
|
||||
// SHEET FILES ******************************************************************************************************** //
|
||||
define('SHEET_BASE', 'cc/sheets/base.xml');
|
||||
define('SHEET_INFO_DETAILS_MOD', 'cc/sheets/info_details_mod.xml');
|
||||
define('SHEET_INFO_DETAILS_MOD_INSTANCE', 'cc/sheets/info_details_mod_instance.xml');
|
||||
define('SHEET_COURSE_BLOCKS_BLOCK', 'cc/sheets/course_blocks_block.xml');
|
||||
define('SHEET_COURSE_HEADER', 'cc/sheets/course_header.xml');
|
||||
define('SHEET_COURSE_SECTIONS_SECTION', 'cc/sheets/course_sections_section.xml');
|
||||
define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD', 'cc/sheets/course_sections_section_mods_mod.xml');
|
||||
define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_FORUM', 'cc/sheets/course_modules_mod_forum.xml');
|
||||
define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LABEL', 'cc/sheets/course_modules_mod_label.xml');
|
||||
define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_RESOURCE', 'cc/sheets/course_modules_mod_resource.xml');
|
||||
define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ', 'cc/sheets/course_modules_mod_quiz.xml');
|
||||
define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_QUESTION_INSTANCE', 'cc/sheets/course_modules_mod_quiz_question_instance.xml');
|
||||
define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_FEEDBACK', 'cc/sheets/course_modules_mod_quiz_feedback.xml');
|
||||
define('SHEET_COURSE_QUESTION_CATEGORIES', 'cc/sheets/course_question_categories.xml');
|
||||
define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY', 'cc/sheets/course_question_categories_question_category.xml');
|
||||
define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION', 'cc/sheets/course_question_categories_question_category_question.xml');
|
||||
define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_MULTIPLE_CHOICE', 'cc/sheets/course_question_categories_question_category_question_multiple_choice.xml');
|
||||
define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_TRUE_FALSE', 'cc/sheets/course_question_categories_question_category_question_true_false.xml');
|
||||
define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_EESAY', 'cc/sheets/course_question_categories_question_category_question_eesay.xml');
|
||||
define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_SHORTANSWER', 'cc/sheets/course_question_categories_question_category_question_shortanswer.xml');
|
||||
define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_ANSWER', 'cc/sheets/course_question_categories_question_category_question_answer.xml');
|
||||
|
||||
// CC RESOURCES TYPE ************************************************************************************************** //
|
||||
define('CC_TYPE_FORUM', 'imsdt_xmlv1p0');
|
||||
define('CC_TYPE_QUIZ', 'imsqti_xmlv1p2/imscc_xmlv1p0/assessment');
|
||||
define('CC_TYPE_QUESTION_BANK', 'imsqti_xmlv1p2/imscc_xmlv1p0/question-bank');
|
||||
define('CC_TYPE_WEBLINK', 'imswl_xmlv1p0');
|
||||
define('CC_TYPE_WEBCONTENT', 'webcontent');
|
||||
define('CC_TYPE_ASSOCIATED_CONTENT', 'associatedcontent/imscc_xmlv1p0/learning-application-resource');
|
||||
define('CC_TYPE_EMPTY', '');
|
||||
|
||||
// MOODLE RESOURCES TYPE ********************************************************************************************** //
|
||||
define('MOODLE_TYPE_FORUM', 'forum');
|
||||
define('MOODLE_TYPE_QUIZ', 'quiz');
|
||||
define('MOODLE_TYPE_QUESTION_BANK', 'question_bank');
|
||||
define('MOODLE_TYPE_RESOURCE', 'resource');
|
||||
define('MOODLE_TYPE_LABEL', 'label');
|
||||
|
||||
// UNKNOWN TYPE ******************************************************************************************************* //
|
||||
define('TYPE_UNKNOWN', '[UNKNOWN]');
|
||||
|
||||
// CC QUESTIONS TYPES ************************************************************************************************* //
|
||||
define('CC_QUIZ_MULTIPLE_CHOICE', 'cc.multiple_choice.v0p1');
|
||||
define('CC_QUIZ_TRUE_FALSE', 'cc.true_false.v0p1');
|
||||
define('CC_QUIZ_FIB', 'cc.fib.v0p1');
|
||||
define('CC_QUIZ_MULTIPLE_RESPONSE', 'cc.multiple_response.v0p1');
|
||||
define('CC_QUIZ_PATTERN_MACHT', 'cc.pattern_match.v0p1');
|
||||
define('CC_QUIZ_ESSAY', 'cc.essay.v0p1');
|
||||
|
||||
//MOODLE QUESTIONS TYPES ********************************************************************************************** //
|
||||
define('MOODLE_QUIZ_MULTIPLE_CHOICE', 'multichoice');
|
||||
define('MOODLE_QUIZ_TRUE_FALSE', 'truefalse');
|
||||
define('MOODLE_QUIZ_MULTIANSWER', 'multianswer');
|
||||
define('MOODLE_QUIZ_MULTIPLE_RESPONSE', 'multichoice');
|
||||
define('MOODLE_QUIZ_MACHT', 'match');
|
||||
define('MOODLE_QUIZ_ESSAY', 'essay');
|
||||
define('MOODLE_QUIZ_SHORTANSWER', 'shortanswer');
|
||||
|
||||
?>
|
||||
Executable
+142
@@ -0,0 +1,142 @@
|
||||
<?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/>.
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @subpackage backup-imscc
|
||||
* @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
require_once($CFG->dirroot . '/backup/cc/includes/constants.php');
|
||||
require_once($CFG->dirroot . '/backup/cc/cc2moodle.php');
|
||||
|
||||
function cc_convert ($dir) {
|
||||
|
||||
$manifest_file = $dir . DIRECTORY_SEPARATOR . 'imsmanifest.xml';
|
||||
$moodle_file = $dir . DIRECTORY_SEPARATOR . 'moodle.xml';
|
||||
$schema_file = 'cc' . DIRECTORY_SEPARATOR . '' . DIRECTORY_SEPARATOR . 'schemas' . DIRECTORY_SEPARATOR . 'cclibxml2validator.xsd';
|
||||
|
||||
if (is_readable($manifest_file) && !is_readable($moodle_file)) {
|
||||
|
||||
$is_cc = detect_cc_format($manifest_file);
|
||||
|
||||
if ($is_cc) {
|
||||
|
||||
$detected_requirements = detect_requirements();
|
||||
|
||||
if (!$detected_requirements["php5"]) {
|
||||
notify(get_string('cc_import_req_php5', 'imscc'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$detected_requirements["dom"]) {
|
||||
notify(get_string('cc_import_req_dom', 'imscc'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$detected_requirements["libxml"]) {
|
||||
notify(get_string('cc_import_req_libxml', 'imscc'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$detected_requirements["libxmlminversion"]) {
|
||||
notify(get_string('cc_import_req_libxmlminversion', 'imscc'));
|
||||
return false;
|
||||
}
|
||||
if (!$detected_requirements["xsl"]) {
|
||||
notify(get_string('cc_import_req_xsl', 'imscc'));
|
||||
return false;
|
||||
}
|
||||
|
||||
echo get_string('cc2moodle_checking_schema', 'imscc') . '<br />';
|
||||
|
||||
$cc_manifest = new DOMDocument();
|
||||
|
||||
if ($cc_manifest->load($manifest_file)) {
|
||||
if ($cc_manifest->schemaValidate($schema_file)) {
|
||||
|
||||
echo get_string('cc2moodle_valid_schema', 'imscc') . '<br />';
|
||||
|
||||
$cc2moodle = new cc2moodle($manifest_file);
|
||||
|
||||
if (!$cc2moodle->is_auth()) {
|
||||
return $cc2moodle->generate_moodle_xml();
|
||||
} else {
|
||||
notify(get_string('cc2moodle_req_auth', 'imscc'));
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
notify(get_string('cc2moodle_invalid_schema', 'imscc'));
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
notify(get_string('cc2moodle_manifest_dont_load', 'imscc'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function detect_requirements () {
|
||||
|
||||
if (floor(phpversion()) >= 5) {
|
||||
$detected["php5"] = true;
|
||||
} else {
|
||||
$detected["php5"] = false;
|
||||
}
|
||||
|
||||
$detected["xsl"] = extension_loaded('xsl');
|
||||
$detected['dom'] = extension_loaded('dom');
|
||||
$detected['libxml'] = extension_loaded('libxml');
|
||||
$detected['libxmlminversion'] = extension_loaded('libxml') && version_compare(LIBXML_DOTTED_VERSION, '2.6.30', '>=');
|
||||
|
||||
return $detected;
|
||||
|
||||
}
|
||||
|
||||
function detect_cc_format ($xml_file) {
|
||||
|
||||
$inpos = 0;
|
||||
$xml_snippet = file_get_contents($xml_file, 0, NULL, 0, 500);
|
||||
|
||||
if (!empty($xml_snippet)) {
|
||||
|
||||
$xml_snippet = strtolower($xml_snippet);
|
||||
$xml_snippet = preg_replace('/\s*/m', '', $xml_snippet);
|
||||
$xml_snippet = str_replace("'", '', $xml_snippet);
|
||||
$xml_snippet = str_replace('"', '', $xml_snippet);
|
||||
|
||||
$search_string = "xmlns=" . NS_COMMON_CARTRIDGE;
|
||||
|
||||
$inpos = strpos($xml_snippet, $search_string);
|
||||
|
||||
if ($inpos) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
<?xml version = "1.0" encoding = "UTF-8"?>
|
||||
<xs:schema xmlns ="http://dummy.libxml2.validator"
|
||||
targetNamespace ="http://dummy.libxml2.validator"
|
||||
xmlns:xs ="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:imscp ="http://www.imsglobal.org/xsd/imscc/imscp_v1p1"
|
||||
xmlns:imslom ="http://ltsc.ieee.org/xsd/imscc/LOM"
|
||||
xmlns:lom ="http://ltsc.ieee.org/xsd/LOM"
|
||||
xmlns:cc ="http://www.imsglobal.org/xsd/imsccauth_v1p0"
|
||||
version="1.0"
|
||||
elementFormDefault ="qualified"
|
||||
attributeFormDefault="unqualified"
|
||||
>
|
||||
|
||||
<xs:import namespace ="http://www.imsglobal.org/xsd/imscc/imscp_v1p1" schemaLocation = "imscp_v1p2_localised.xsd" />
|
||||
<xs:import namespace ="http://ltsc.ieee.org/xsd/imscc/LOM" schemaLocation = "domainProfile_1/lomLoose_localised.xsd" />
|
||||
<xs:import namespace ="http://ltsc.ieee.org/xsd/LOM" schemaLocation = "domainProfile_2/lomLoose_localised.xsd" />
|
||||
<xs:import namespace ="http://www.imsglobal.org/xsd/imsccauth_v1p0" schemaLocation = "domainProfile_0/imsccauth_v1p0_localised.xsd" />
|
||||
</xs:schema>
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config>
|
||||
<mapping>
|
||||
<namespace>http://www.imsglobal.org/xsd/imscc/imscp_v1p1</namespace>
|
||||
<path>imscp_v1p2_localised.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://www.imsglobal.org/xsd/imscp_v1p1</namespace>
|
||||
<path>imscp_v1p2.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://www.imsglobal.org/xsd/imsccauth_v1p0</namespace>
|
||||
<path>domainProfile_0/imsccauth_v1p0_localised.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://ltsc.ieee.org/xsd/imscc/LOM</namespace>
|
||||
<path>domainProfile_1/lomLoose_localised.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://ltsc.ieee.org/xsd/imscc/LOM/unique</namespace>
|
||||
<path>domainProfile_1/loose.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://ltsc.ieee.org/xsd/imscc/LOM/vocab</namespace>
|
||||
<path>domainProfile_1/vocab/loose.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://ltsc.ieee.org/xsd/imscc/LOM/extend</namespace>
|
||||
<path>domainProfile_1/extend/custom.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://ltsc.ieee.org/xsd/LOM</namespace>
|
||||
<path>domainProfile_2/lomLoose_localised.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://ltsc.ieee.org/xsd/LOM/unique</namespace>
|
||||
<path>domainProfile_2/loose.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://ltsc.ieee.org/xsd/LOM/vocab</namespace>
|
||||
<path>domainProfile_2/vocab/loose.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://ltsc.ieee.org/xsd/LOM/extend</namespace>
|
||||
<path>domainProfile_2/extend/custom.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://www.imsglobal.org/xsd/imscp_extensionv1p2</namespace>
|
||||
<path>domainProfile_3/imscp_extensionv1p2_localised.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://www.imsglobal.org/xsd/ims_qtiasiv1p2</namespace>
|
||||
<path>domainProfile_4/ims_qtiasiv1p2_localised.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://www.imsglobal.org/xsd/imswl_v1p0</namespace>
|
||||
<path>domainProfile_5/imswl_v1p0_localised.xsd</path>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<namespace>http://www.imsglobal.org/xsd/imsdt_v1p0</namespace>
|
||||
<path>domainProfile_6/imsdt_v1p0_localised.xsd</path>
|
||||
</mapping>
|
||||
</config>
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
IPR, License and Distribution Notices
|
||||
This machine readable file is derived from IMS specification IMS Common Cartridge Version 1.0 found at http://www.imsglobal.org/cc/index.html and the original IMS schema binding or code base http://www.imsglobal.org/cc/.
|
||||
|
||||
Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document.
|
||||
|
||||
IMS takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS�s procedures with respect to rights in IMS specifications can be found at the IMS Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf.
|
||||
|
||||
Copyright © IMS Global Learning Consortium 1999-2008. All Rights Reserved.
|
||||
|
||||
License Notice for Users
|
||||
Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document.
|
||||
|
||||
Distribution Notice for Developers
|
||||
Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof.
|
||||
|
||||
Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS community on the IMS website as described in the following two paragraphs:
|
||||
|
||||
- If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety.
|
||||
|
||||
- If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be revoked by IMS or its successors or assigns.
|
||||
|
||||
THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR,
|
||||
ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION
|
||||
SHALL BE MADE ENTIRELY AT THE IMPLEMENTER�S OWN RISK, AND NEITHER THE CONSORTIUM, NOR
|
||||
ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER
|
||||
OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING
|
||||
FROM THE USE OF THIS SPECIFICATION.
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.imsglobal.org/xsd/imsccauth_v1p0" targetNamespace="http://www.imsglobal.org/xsd/imsccauth_v1p0" elementFormDefault="qualified">
|
||||
|
||||
<xs:element name="authorizations" type="authorizationsType" />
|
||||
|
||||
<xs:complexType name="authorizationsType">
|
||||
<xs:sequence>
|
||||
<xs:element name="authorization" type="authorizationType" />
|
||||
<xs:group ref="grpStrict.any" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xs:sequence>
|
||||
<xs:attribute name="access" type="accessType" use="required" />
|
||||
<xs:attribute name="import" type="xs:boolean" default="false" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="authorizationType">
|
||||
<xs:sequence>
|
||||
<xs:element name="cartridgeId" type="xs:string" />
|
||||
<xs:element name="webservice" type="xs:string" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="accessType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="cartridge" />
|
||||
<xs:enumeration value="resource" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:group name="grpStrict.any">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
This group is defined exactly as in IMS Content Packaging v 1.2.
|
||||
Any namespaced element from any namespace may be included within an "any" element.
|
||||
The namespace for the imported element must be defined in the instance, and the schema must be imported.
|
||||
The extension has a definition of "strict" i.e. they must have their own namespace.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:sequence>
|
||||
<xs:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:attribute name="protected" type="xs:boolean" default="false" />
|
||||
|
||||
|
||||
</xs:schema>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user