Compare commits
599 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e8e1ad9100 | |||
| f84058a263 | |||
| 03e29fff56 | |||
| 3765c3f098 | |||
| 15125314eb | |||
| 44e6b8ff57 | |||
| c46c673568 | |||
| aa79f99d53 | |||
| ef65eefff8 | |||
| df390ba9f0 | |||
| 2a41529f68 | |||
| e9adc8f6eb | |||
| 22edb9944a | |||
| ceedbe876d | |||
| 213eaa94f6 | |||
| 2acfb396ec | |||
| 936f6706c2 | |||
| 2e3a96e192 | |||
| 417fdfab6b | |||
| 77c9ae457d | |||
| a8fd6146e7 | |||
| 538e680d39 | |||
| ec5f521a59 | |||
| 100308ce24 | |||
| f6fc3616de | |||
| 9a8343cdde | |||
| a4e3607a21 | |||
| 27a2c6bffd | |||
| b6481ac993 | |||
| 2abbe6e2a3 | |||
| 3687ab70bc | |||
| 201159335f | |||
| c3ceb8d218 | |||
| 9df28ce5a3 | |||
| 784c24fde1 | |||
| cf264063c1 | |||
| 3f51ad2a70 | |||
| 6b0b96c581 | |||
| 8190a2911f | |||
| ac30618786 | |||
| e9889abe38 | |||
| c0e1e425be | |||
| 517d606401 | |||
| f3cbcc623d | |||
| be36e2ad1d | |||
| aff1c65c3d | |||
| d96d964425 | |||
| 4f76e7ddf7 | |||
| 393d636e25 | |||
| 2b98c3d5e0 | |||
| 2bd3fc4d03 | |||
| 6b43f50c41 | |||
| 533a766447 | |||
| 59f3144e0a | |||
| ef5a198d1c | |||
| 60e7f2b113 | |||
| 68bc5b7b68 | |||
| 45222fc50f | |||
| 78092d6742 | |||
| a3fe5348ab | |||
| e3f6f30896 | |||
| 50296e134b | |||
| a6c44179e5 | |||
| ab93b02919 | |||
| 07ea543a1c | |||
| 768dd79e1f | |||
| c7f51d2dfe | |||
| ebbc9e717f | |||
| 617027cf84 | |||
| 21dc44b4df | |||
| 922817560c | |||
| 4b9cb37191 | |||
| a4673317a7 | |||
| deba736fbc | |||
| badddcab36 | |||
| be1f4ab759 | |||
| 01bb865997 | |||
| 79f544a45f | |||
| eadbd73918 | |||
| bf9f318ead | |||
| c015236f00 | |||
| 7a3156d001 | |||
| b22eb6a987 | |||
| c7c83663e1 | |||
| 49d85b7cfa | |||
| bc5d53c15c | |||
| 95f780c200 | |||
| 3656becc4a | |||
| 89ba1d6c2b | |||
| cca30c4795 | |||
| c78b71efb6 | |||
| 35a5d3b2fc | |||
| 40638405ea | |||
| a53760ef5a | |||
| 1193e6b023 | |||
| 8c5b86e044 | |||
| 6bc177e912 | |||
| 1f7907dac3 | |||
| 25c53e2b9f | |||
| 83fcca9346 | |||
| ab837e6113 | |||
| 96651cf9ed | |||
| 583c465a3a | |||
| 24f90eedb9 | |||
| 0d81404f9a | |||
| 7ba9375e84 | |||
| 15ffa46a1a | |||
| 38bc3c281a | |||
| 9bb6e09468 | |||
| 77de688b82 | |||
| dd8e618917 | |||
| ea819f2205 | |||
| 05deeaacdb | |||
| 19dd687377 | |||
| f2c12522c3 | |||
| 79a80529f8 | |||
| 70a649e40c | |||
| 38a94e0d39 | |||
| 327c88b76b | |||
| b229f563e5 | |||
| 7769615e76 | |||
| 056d2682a1 | |||
| a103d27e06 | |||
| d9c90952bb | |||
| 89b2800f75 | |||
| e12559481f | |||
| 6761018805 | |||
| 9948122905 | |||
| 308e53f572 | |||
| 3367e3ee1e | |||
| c1979ef02d | |||
| 25a5bd96f9 | |||
| 536c7aa882 | |||
| 534eebdd35 | |||
| e317113746 | |||
| ac473cb811 | |||
| fea115dab3 | |||
| 46306d8a25 | |||
| 2c9b8852f0 | |||
| 413b73ffe3 | |||
| 5bda351ef7 | |||
| e5180a491c | |||
| 5d7b69cd80 | |||
| 4bd293ee63 | |||
| 8252cd2848 | |||
| a35be2f5ef | |||
| 668a9eb90b | |||
| 606e175133 | |||
| 2e214b26f3 | |||
| c24ad72ba0 | |||
| ed26ad33ca | |||
| 9a380fbb53 | |||
| 6893e10840 | |||
| c18a7f9d94 | |||
| 07ca3c6816 | |||
| 9315fd7200 | |||
| 10bc60a163 | |||
| 0f9a1467e2 | |||
| 8b3405e8f2 | |||
| c5b7c1f627 | |||
| cc56539e51 | |||
| ae8da34929 | |||
| 0a6604e525 | |||
| 385e9d72ec | |||
| ae912070ea | |||
| 988f1a05e7 | |||
| b8369f5e9f | |||
| 020f0ffc5b | |||
| 087a329eef | |||
| 39025fe177 | |||
| 473afcbfec | |||
| 1dcb107bd4 | |||
| 7cf9937724 | |||
| f6c6bb4d39 | |||
| 814bce6575 | |||
| f12c714e6f | |||
| 74e78f3ad8 | |||
| 4a7e2298a3 | |||
| 910c941fa8 | |||
| bfb0183f6d | |||
| add39c57dd | |||
| 1b024a0b51 | |||
| 9d12edfcae | |||
| 746f1ac85c | |||
| 8277c39c76 | |||
| fb654f651f | |||
| 494f645bf4 | |||
| a26a8c6a6f | |||
| 27beb68c4b | |||
| 8254083dc9 | |||
| 9b7ac1ea57 | |||
| b214520d8b | |||
| abfe9dbe6e | |||
| 8c75bb5976 | |||
| e78632643c | |||
| f114cff65f | |||
| 3c18677ad1 | |||
| 1a199937f0 | |||
| b39029f718 | |||
| 7cb1a84978 | |||
| 8f7c097a09 | |||
| 5dc47fbbc6 | |||
| bac9a5e95e | |||
| 4a8d589d41 | |||
| ffd06a7394 | |||
| ba55e33828 | |||
| 3fcd1d05b9 | |||
| 29f02f10f0 | |||
| ff555b58be | |||
| 42d1a03acc | |||
| 80a90f8d71 | |||
| 4a225b69bb | |||
| 727242750d | |||
| 454efc509f | |||
| 1bef145b49 | |||
| 1a20976561 | |||
| 2558ce3593 | |||
| ab14ec06d2 | |||
| d072124ba4 | |||
| d9c19266c8 | |||
| cf93662ffe | |||
| 177f14d6f6 | |||
| bdcea1a221 | |||
| 25ebb1df63 | |||
| 39af096daf | |||
| 0ff186d7d7 | |||
| 26a92149cc | |||
| 38961259de | |||
| 528cde2db2 | |||
| 0ca33a3835 | |||
| 2a02a3f0de | |||
| 8445c4724c | |||
| 3e6c1d4d55 | |||
| 2c85a824fc | |||
| 6ce26b03e7 | |||
| ae18165edd | |||
| 5def8d573d | |||
| 41c5f54940 | |||
| 39b5360e69 | |||
| 6409d38377 | |||
| 945df69ff3 | |||
| 16aae71dcd | |||
| 371e83db2d | |||
| f4bc50d2bb | |||
| b32484d582 | |||
| 6750bec6c9 | |||
| 6a8787828e | |||
| 466b23caf7 | |||
| a4d6717aec | |||
| cc50a2fbc4 | |||
| 3345c20e29 | |||
| c06e87a410 | |||
| db005da178 | |||
| cfc9f55ca6 | |||
| 15f0d2ed37 | |||
| a370e4e4fa | |||
| a9e0bc82fb | |||
| ec05915767 | |||
| b5e8919b7c | |||
| 397262e292 | |||
| ea1e93b265 | |||
| 29e42725a4 | |||
| 91c59dbd8e | |||
| 87c8b752ca | |||
| 4fcc689dfc | |||
| 27f31cc626 | |||
| 9660303cc2 | |||
| 9abec7278b | |||
| ba7c14c1a7 | |||
| 97161e5008 | |||
| 25041083d5 | |||
| a1c5868475 | |||
| d4e94648cf | |||
| b651e7bb74 | |||
| d527599fcd | |||
| c1d93d47e9 | |||
| 6160c1721c | |||
| 71472b0a82 | |||
| ba3721d463 | |||
| 1a1f7b0eec | |||
| 0c60b1113e | |||
| 79121602c4 | |||
| ba16180449 | |||
| 01765239b0 | |||
| d65a2b2262 | |||
| 4754c0edd1 | |||
| ec441b6dd0 | |||
| df01a82082 | |||
| 00338d8b94 | |||
| 57e034c094 | |||
| c5b9fe0dda | |||
| 07511dbe6d | |||
| df70dfe4ee | |||
| f872b32778 | |||
| beb807e033 | |||
| 98d17b5bad | |||
| bca840b4bc | |||
| 80406e9dd8 | |||
| f4c5e50440 | |||
| 1382f8a549 | |||
| c372808e97 | |||
| f279137a86 | |||
| 0ad12999d7 | |||
| a390156411 | |||
| b84a272faf | |||
| f2ba68efc1 | |||
| 629ea4957b | |||
| 4c1db5b4ea | |||
| 7ea0f8e519 | |||
| ece057943d | |||
| edb8d49d35 | |||
| 8c23e3f5ff | |||
| 30a39ee2b7 | |||
| c3a68f4496 | |||
| d230fb7bcd | |||
| 0f37e97dc6 | |||
| c33e534dce | |||
| 65814f90c1 | |||
| 3a1380d81a | |||
| 743010f779 | |||
| 5a1a6fc1f0 | |||
| b0022f8d91 | |||
| 838f1bcdf4 | |||
| 014fba4928 | |||
| 32eadaf080 | |||
| dba24103ea | |||
| 0a770d5c6c | |||
| 29775a8e89 | |||
| f2855813c7 | |||
| b5e1c2e748 | |||
| 98c1207c46 | |||
| 3466a42f31 | |||
| 3fc24f1238 | |||
| 2e8ab7269c | |||
| 72ca02b0b2 | |||
| 22a7afd577 | |||
| c281550ce5 | |||
| 4a94bae470 | |||
| 92480bc82b | |||
| 2ff8943027 | |||
| da63c93657 | |||
| 4e184a9ce6 | |||
| 36420f78c1 | |||
| 93e980d52b | |||
| 9e5855cb1a | |||
| f9ba5c5222 | |||
| f79dd3b57d | |||
| f5eec88fb6 | |||
| f5a4f25375 | |||
| d714350a11 | |||
| a021f72a34 | |||
| 32af9814f1 | |||
| bcb785fa9e | |||
| 733bd07b8b | |||
| 19ab387d06 | |||
| 02a03f4fe2 | |||
| 75c92b6306 | |||
| e56ac08a5c | |||
| 0cf31e061b | |||
| 65150b26cd | |||
| e1ad9ae4f5 | |||
| ffa12b8397 | |||
| 890c7fae4e | |||
| 9f2e9b535d | |||
| c7d4a92ccf | |||
| 5bd0e7af9f | |||
| 794fb0e565 | |||
| 998b74a160 | |||
| 9ae0b69f59 | |||
| f4dc83e6e6 | |||
| ca2b2eb8af | |||
| 5399e053d1 | |||
| 6ef4ef1ee5 | |||
| f5a1b068cc | |||
| b9d64ab18f | |||
| 39d106ee76 | |||
| 07373d91a8 | |||
| 633fcef536 | |||
| dde17843e0 | |||
| 2430319b52 | |||
| adabef8bf6 | |||
| 22ea14df25 | |||
| 6867fc94b7 | |||
| 8385249f5b | |||
| 30dc7311ad | |||
| 9784520acb | |||
| d015c2352f | |||
| 35fa620a2e | |||
| 15516e6445 | |||
| 280a641232 | |||
| 14dac82376 | |||
| 06ede85e1f | |||
| 31a43cca97 | |||
| 8ad8b7dba8 | |||
| a09897b4b1 | |||
| 5e00f29019 | |||
| 36f0835e72 | |||
| 259b9d05f3 | |||
| da20cd7b43 | |||
| acb4688d29 | |||
| 471952fe82 | |||
| 0d738689bd | |||
| 7390fdde63 | |||
| 1374c61bb4 | |||
| 98d9209a34 | |||
| 8351ce1bd0 | |||
| b911ab236c | |||
| b4730465e6 | |||
| 78cc7bee62 | |||
| 5d6eafcf10 | |||
| 090e19328e | |||
| 34b5e856b0 | |||
| c44a5d5946 | |||
| b7d7679112 | |||
| 90061a6d95 | |||
| c9c031fc90 | |||
| 64a17788aa | |||
| 0baa1eee59 | |||
| 9f6eeb4abf | |||
| 6a48b42ae8 | |||
| 2dd90f136c | |||
| e6647397b9 | |||
| 07fa10d725 | |||
| 98032d512d | |||
| 389235fb00 | |||
| 656237dd55 | |||
| e3cc5b1a7f | |||
| 0742ea86b2 | |||
| 41f79b5c07 | |||
| ed85c0acd2 | |||
| 9c39028179 | |||
| 9fb4a6300b | |||
| 44c9dc6e7b | |||
| 4af7c9d188 | |||
| 847dee60ce | |||
| b7551bdf23 | |||
| e0be8fd6a3 | |||
| 55e03d1233 | |||
| e391f907af | |||
| bef867a96c | |||
| 4207d47742 | |||
| bd7193c7ac | |||
| 77e4a16c4f | |||
| 7daba2713e | |||
| 03b1be3005 | |||
| 5c8511ecf7 | |||
| 52435228c5 | |||
| c9dc3e5564 | |||
| ffaf18a8c1 | |||
| f5fddc6081 | |||
| 9d5a4e2b7c | |||
| ba9103b2c6 | |||
| 79196c9ed5 | |||
| a572cfe5bd | |||
| 92d7776478 | |||
| 2715f96932 | |||
| 6919d9f790 | |||
| 8be0517692 | |||
| a4b65c11b9 | |||
| 64e711f04b | |||
| e6cf40de78 | |||
| 174f5a0189 | |||
| dd56fd7c64 | |||
| 436f83f8ff | |||
| d03f904759 | |||
| 15a6af91f5 | |||
| 0a23dec07a | |||
| 6f8081bef4 | |||
| c643d3ae06 | |||
| 507ccf1c4b | |||
| 60bc533ee8 | |||
| 42f2b8d0dd | |||
| 84047d1fc9 | |||
| b79ac7e0d6 | |||
| 241ceba38c | |||
| 8e49e0833c | |||
| f6bf9c932d | |||
| 1fb2369b09 | |||
| 4de0925820 | |||
| 81f2a1686a | |||
| 5f509554a5 | |||
| edd5d0693d | |||
| d59a75a841 | |||
| 9b482d1cbe | |||
| ca090f3262 | |||
| 12db898084 | |||
| c79345c0f0 | |||
| d691571218 | |||
| 4e1bb6e10c | |||
| a7e920fbfb | |||
| 7a725d6b59 | |||
| 489c6ef357 | |||
| dbb6157aa1 | |||
| 50467e50c9 | |||
| 85a91fb98e | |||
| 75454e2567 | |||
| 06c09f30e3 | |||
| 26daa23d9d | |||
| 74a2ee73ed | |||
| fca41d2589 | |||
| 6de6a45a10 | |||
| 0f1fac1f1f | |||
| 692134ecd4 | |||
| d7706bac2c | |||
| 391e054c03 | |||
| 71f2316fe6 | |||
| 16d610019a | |||
| 4f5791da64 | |||
| c5e3a242b1 | |||
| 13ad1eaf37 | |||
| 7ca448fa83 | |||
| 37efb4f1ee | |||
| 81bd2292bc | |||
| 8fa13d155d | |||
| 465846f082 | |||
| f68815ffcf | |||
| 67b5d74b2c | |||
| 3d0e3ade75 | |||
| 7d1fb2f6ec | |||
| 227e54d65a | |||
| ee6181b1e7 | |||
| 3962c89bbf | |||
| 59137c2c5b | |||
| b83e494d6f | |||
| 3b2164bdca | |||
| aa54d70440 | |||
| d2d4bccec1 | |||
| f3a3c59f48 | |||
| 3d62a46b26 | |||
| 9aacfedb22 | |||
| 12b734434b | |||
| f9068e531c | |||
| 96506c474a | |||
| 0d66e33da5 | |||
| 934fa3ed6c | |||
| 6743d6c520 | |||
| cf76e10e4a | |||
| c800e31213 | |||
| 23580ddacb | |||
| 827fcdb347 | |||
| 60aaf1dc77 | |||
| fd8fa6f9d0 | |||
| 8adf19eda8 | |||
| a6e29ac6a3 | |||
| 52e184904f | |||
| b8d80c062e | |||
| eb9d692f8b | |||
| a805d653d1 | |||
| fe4a0cfe63 | |||
| d0e3447e43 | |||
| f046221272 | |||
| 42a50a0a45 | |||
| 77335e76e9 | |||
| ddf3e875f3 | |||
| 91fa7abf3d | |||
| b060e5b0b8 | |||
| f9c8746704 | |||
| c629aeabe3 | |||
| 27614a5e5d | |||
| ba32fc0042 | |||
| 87b05ba3e0 | |||
| 728f3c9d08 | |||
| d7dd177eb4 | |||
| 507de745e3 | |||
| bf8ff4889b | |||
| f9112bda35 | |||
| ba63612bfa | |||
| 408612d111 | |||
| 60e837038a | |||
| 4cb05cea9d | |||
| 0960f2f417 | |||
| 09c1e72a56 | |||
| d2455301b7 | |||
| 1be2b904ab | |||
| 337817e669 | |||
| b17a3a5591 | |||
| c44c552efa | |||
| faa297ce6f | |||
| b6225c0f2f | |||
| 50496af78b | |||
| 8fc52ccf46 | |||
| 9f9324f408 | |||
| d4dc367a5b | |||
| 3ede344b5c | |||
| 5c686792c6 | |||
| 91a4b3bd3e | |||
| 1a6a1487f4 | |||
| a5286ae4cc | |||
| 5b97bff526 | |||
| 1c4873ba1b | |||
| 9a8f8cea49 | |||
| c37f03543b | |||
| cd4ca97611 | |||
| 77bfc4ce0f | |||
| 13c53a4a2e | |||
| d3796a2c61 | |||
| 7bb8ae5911 | |||
| dbe6d9f821 | |||
| 4927443761 |
+4
-58
@@ -12,8 +12,6 @@
|
||||
$hide = optional_param('hide', 0, PARAM_INT);
|
||||
$show = optional_param('show', 0, PARAM_INT);
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
$unprotect = optional_param('unprotect', 0, PARAM_INT);
|
||||
$protect = optional_param('protect', 0, PARAM_INT);
|
||||
|
||||
/// Print headings
|
||||
|
||||
@@ -26,9 +24,6 @@
|
||||
$strcourses = get_string('blockinstances', 'admin');
|
||||
$strname = get_string('name');
|
||||
$strshowblockcourse = get_string('showblockcourse');
|
||||
$strprotecthdr = get_string('blockprotect', 'admin'). $OUTPUT->help_icon('blockprotect','admin');
|
||||
$strprotect = get_string('blockprotect', 'admin');
|
||||
$strunprotect = get_string('blockunprotect', 'admin');
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
@@ -48,36 +43,6 @@
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!isset($CFG->undeletableblocktypes) || (!is_array($CFG->undeletableblocktypes) && !is_string($CFG->undeletableblocktypes))) {
|
||||
$undeletableblocktypes = array('navigation', 'settings');
|
||||
} else if (is_string($CFG->undeletableblocktypes)) {
|
||||
$undeletableblocktypes = explode(',', $CFG->undeletableblocktypes);
|
||||
} else {
|
||||
$undeletableblocktypes = $CFG->undeletableblocktypes;
|
||||
}
|
||||
|
||||
if (!empty($protect) && confirm_sesskey()) {
|
||||
if (!$block = $DB->get_record('block', array('id'=>$protect))) {
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
if (!in_array($block->name, $undeletableblocktypes)) {
|
||||
$undeletableblocktypes[] = $block->name;
|
||||
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
|
||||
}
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($unprotect) && confirm_sesskey()) {
|
||||
if (!$block = $DB->get_record('block', array('id'=>$unprotect))) {
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
if (in_array($block->name, $undeletableblocktypes)) {
|
||||
$undeletableblocktypes = array_diff($undeletableblocktypes, array($block->name));
|
||||
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
|
||||
}
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($delete) && confirm_sesskey()) {
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strmanageblocks);
|
||||
@@ -126,7 +91,6 @@
|
||||
// Remove event handlers and dequeue pending events
|
||||
events_uninstall('block/'.$block->name);
|
||||
|
||||
$a = new stdClass();
|
||||
$a->block = $strblockname;
|
||||
$a->directory = $CFG->dirroot.'/blocks/'.$block->name;
|
||||
notice(get_string('blockdeletefiles', '', $a), 'blocks.php');
|
||||
@@ -150,12 +114,11 @@
|
||||
|
||||
$table = new flexible_table('admin-blocks-compatible');
|
||||
|
||||
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'delete', 'settings'));
|
||||
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $strdelete, $strsettings));
|
||||
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'delete', 'settings'));
|
||||
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strdelete, $strsettings));
|
||||
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
|
||||
$table->set_attribute('class', 'compatibleblockstable blockstable generaltable');
|
||||
$table->setup();
|
||||
$tablerows = array();
|
||||
|
||||
foreach ($blocks as $blockid=>$block) {
|
||||
$blockname = $block->name;
|
||||
@@ -228,32 +191,15 @@
|
||||
$version = "$block->version ($plugin->version)";
|
||||
}
|
||||
|
||||
if (!$blockobject) {
|
||||
// ignore
|
||||
$undeletable = '';
|
||||
} else if (in_array($blockname, $undeletableblocktypes)) {
|
||||
$undeletable = '<a href="blocks.php?unprotect='.$blockid.'&sesskey='.sesskey().'" title="'.$strunprotect.'">'.
|
||||
'<img src="'.$OUTPUT->pix_url('t/unlock') . '" class="icon" alt="'.$strunprotect.'" /></a>';
|
||||
} else {
|
||||
$undeletable = '<a href="blocks.php?protect='.$blockid.'&sesskey='.sesskey().'" title="'.$strprotect.'">'.
|
||||
'<img src="'.$OUTPUT->pix_url('t/unlock_gray') . '" class="icon" alt="'.$strprotect.'" /></a>';
|
||||
}
|
||||
|
||||
$row = array(
|
||||
$table->add_data(array(
|
||||
'<span'.$class.'>'.$strblockname.'</span>',
|
||||
$blocklist,
|
||||
'<span'.$class.'>'.$version.'</span>',
|
||||
$visible,
|
||||
$undeletable,
|
||||
$delete,
|
||||
$settings
|
||||
);
|
||||
$tablerows[] = array(strip_tags($strblockname), $row); // first element will be used for sorting
|
||||
}
|
||||
|
||||
textlib_get_instance()->asort($tablerows);
|
||||
foreach ($tablerows as $row) {
|
||||
$table->add_data($row[1]);
|
||||
));
|
||||
}
|
||||
|
||||
$table->print_html();
|
||||
|
||||
@@ -99,7 +99,7 @@ function bloglevelupgrade_entries($blogentries, $forum, $cm, $groupid=-1) {
|
||||
$discussion->groupid = $groupid;
|
||||
$message = '';
|
||||
|
||||
$discussionid = forum_add_discussion($discussion, null, $message, $blogentry->userid);
|
||||
$discussionid = forum_add_discussion($discussion, null, $message);
|
||||
|
||||
// Copy file attachment records
|
||||
$fs = get_file_storage();
|
||||
|
||||
+30
-34
@@ -79,16 +79,6 @@ Example:
|
||||
"; //TODO: localize, mark as needed in install - to be translated later when everything is finished
|
||||
|
||||
|
||||
// distro specific customisation
|
||||
$distrolibfile = dirname(dirname(dirname(__FILE__))).'/install/distrolib.php';
|
||||
$distro = null;
|
||||
if (file_exists($distrolibfile)) {
|
||||
require_once($distrolibfile);
|
||||
if (function_exists('distro_get_config')) {
|
||||
$distro = distro_get_config();
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing to do if config.php exists
|
||||
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
|
||||
if (file_exists($configfile)) {
|
||||
@@ -106,7 +96,7 @@ if (file_exists($configfile)) {
|
||||
|
||||
$olddir = getcwd();
|
||||
|
||||
// change directory so that includes below work properly
|
||||
// change directory so that includes bellow work properly
|
||||
chdir(dirname($_SERVER['argv'][0]));
|
||||
|
||||
// Servers should define a default timezone in php.ini, but if they don't then make sure something is defined.
|
||||
@@ -125,12 +115,12 @@ if (function_exists('date_default_timezone_set') and function_exists('date_defau
|
||||
define('MOODLE_INTERNAL', true);
|
||||
|
||||
// Check that PHP is of a sufficient version
|
||||
if (version_compare(phpversion(), "5.3.2") < 0) {
|
||||
if (version_compare(phpversion(), "5.2.8") < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
|
||||
fwrite(STDERR, "Moodle 2.1 or later requires at least PHP 5.3.2 (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
|
||||
exit(1);
|
||||
echo "Sorry, Moodle 2.0 requires PHP 5.2.8 or later (currently using version $phpversion).\n";
|
||||
echo "Please upgrade your server software or install latest Moodle 1.9.x instead.";
|
||||
die;
|
||||
}
|
||||
|
||||
// set up configuration
|
||||
@@ -140,7 +130,7 @@ $CFG->dirroot = dirname(dirname(dirname(__FILE__)));
|
||||
$CFG->libdir = "$CFG->dirroot/lib";
|
||||
$CFG->wwwroot = "http://localhost";
|
||||
$CFG->httpswwwroot = $CFG->wwwroot;
|
||||
$CFG->dataroot = empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata'): $distro->dataroot; // initialised later after including libs or by distro
|
||||
$CFG->dataroot = str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata');
|
||||
$CFG->docroot = 'http://docs.moodle.org';
|
||||
$CFG->running_installer = true;
|
||||
$CFG->early_install_lang = true;
|
||||
@@ -188,14 +178,14 @@ if (empty($databases)) {
|
||||
// now get cli options
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'chmod' => isset($distro->directorypermissions) ? sprintf('%04o',$distro->directorypermissions) : '2777', // let distros set dir permissions
|
||||
'chmod' => '2777',
|
||||
'lang' => $CFG->lang,
|
||||
'wwwroot' => '',
|
||||
'dataroot' => $CFG->dataroot,
|
||||
'dbtype' => empty($distro->dbtype) ? $defaultdb : $distro->dbtype, // let distro skip dbtype selection
|
||||
'dbhost' => empty($distro->dbhost) ? 'localhost' : $distro->dbhost, // let distros set dbhost
|
||||
'dbtype' => $defaultdb,
|
||||
'dbhost' => 'localhost',
|
||||
'dbname' => 'moodle',
|
||||
'dbuser' => empty($distro->dbuser) ? 'root' : $distro->dbuser, // let distros set dbuser
|
||||
'dbuser' => 'root',
|
||||
'dbpass' => '',
|
||||
'dbsocket' => false,
|
||||
'prefix' => 'mdl_',
|
||||
@@ -275,7 +265,7 @@ if ($interactive) {
|
||||
$chmod = octdec(clean_param($options['chmod'], PARAM_INT));
|
||||
if ($interactive) {
|
||||
cli_separator();
|
||||
cli_heading(get_string('datarootpermission', 'install'));
|
||||
cli_heading('Data directories permission'); // todo localize
|
||||
$prompt = get_string('clitypevaluedefault', 'admin', decoct($chmod));
|
||||
$error = '';
|
||||
do {
|
||||
@@ -386,16 +376,25 @@ if ($interactive) {
|
||||
}
|
||||
}
|
||||
|
||||
// download required lang packs
|
||||
if ($CFG->lang !== 'en') {
|
||||
$installer = new lang_installer($CFG->lang);
|
||||
$results = $installer->run();
|
||||
foreach ($results as $langcode => $langstatus) {
|
||||
if ($langstatus === lang_installer::RESULT_DOWNLOADERROR) {
|
||||
$a = new stdClass();
|
||||
$a->url = $installer->lang_pack_url($langcode);
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
cli_problem(get_string('remotedownloaderror', 'error', $a));
|
||||
//download lang pack with optional notification
|
||||
if ($CFG->lang != 'en') {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
|
||||
if ($cd->install() == COMPONENT_ERROR) {
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/langpack/2.0/'.$CFG->lang.'.zip';
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
cli_problem(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
cli_problem(get_string($cd->get_error(), 'error'));
|
||||
}
|
||||
} else {
|
||||
// install parent lang if defined
|
||||
if ($parentlang = get_parent_language()) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
$cd->install();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -526,9 +525,6 @@ if ($interactive) {
|
||||
}
|
||||
|
||||
$CFG->dbpass = cli_input($prompt, $options['dbpass']);
|
||||
if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation
|
||||
$distro = distro_pre_create_db($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']), $distro);
|
||||
}
|
||||
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']));
|
||||
} while ($hint_database !== '');
|
||||
|
||||
|
||||
@@ -46,8 +46,6 @@ Options:
|
||||
--adminuser=USERNAME Username for the moodle admin account. Default is admin.
|
||||
--adminpass=PASSWORD Password for the moodle admin account.
|
||||
--agree-license Indicates agreement with software license.
|
||||
--fullname=STRING Name of the site
|
||||
--shortname=STRING Name of the site
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
@@ -55,12 +53,12 @@ Example:
|
||||
";
|
||||
|
||||
// Check that PHP is of a sufficient version
|
||||
if (version_compare(phpversion(), "5.3.2") < 0) {
|
||||
if (version_compare(phpversion(), "5.2.8") < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
|
||||
fwrite(STDERR, "Moodle 2.1 or later requires at least PHP 5.3.2 (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
|
||||
exit(1);
|
||||
fwrite(STDERR, "Sorry, Moodle 2.0 requires PHP 5.2.8 or later (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Please upgrade your server software or install latest Moodle 1.9.x instead.\n");
|
||||
die(1);
|
||||
}
|
||||
|
||||
// Nothing to do if config.php does not exist
|
||||
@@ -68,7 +66,7 @@ $configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
|
||||
if (!file_exists($configfile)) {
|
||||
fwrite(STDERR, 'config.php does not exist, can not continue'); // do not localize
|
||||
fwrite(STDERR, "\n");
|
||||
exit(1);
|
||||
die(1);
|
||||
}
|
||||
|
||||
// Include necessary libs
|
||||
@@ -95,8 +93,6 @@ list($options, $unrecognized) = cli_get_params(
|
||||
'lang' => 'en',
|
||||
'adminuser' => 'admin',
|
||||
'adminpass' => '',
|
||||
'fullname' => '',
|
||||
'shortname' => '',
|
||||
'agree-license' => false,
|
||||
'help' => false
|
||||
),
|
||||
@@ -125,17 +121,26 @@ if (!file_exists($CFG->dirroot.'/install/lang/'.$options['lang'])) {
|
||||
}
|
||||
$CFG->lang = $options['lang'];
|
||||
|
||||
// download required lang packs
|
||||
if ($CFG->lang !== 'en') {
|
||||
//download lang pack with optional notification
|
||||
if ($CFG->lang != 'en') {
|
||||
make_upload_directory('lang');
|
||||
$installer = new lang_installer($CFG->lang);
|
||||
$results = $installer->run();
|
||||
foreach ($results as $langcode => $langstatus) {
|
||||
if ($langstatus === lang_installer::RESULT_DOWNLOADERROR) {
|
||||
$a = new stdClass();
|
||||
$a->url = $installer->lang_pack_url($langcode);
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
cli_problem(get_string('remotedownloaderror', 'error', $a));
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
|
||||
if ($cd->install() == COMPONENT_ERROR) {
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/langpack/2.0/'.$CFG->lang.'.zip';
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
cli_problem(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
cli_problem(get_string($cd->get_error(), 'error'));
|
||||
}
|
||||
} else {
|
||||
// install parent lang if defined
|
||||
if ($parentlang = get_parent_language()) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
$cd->install();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ if (!empty($options['engine'])) {
|
||||
}
|
||||
echo str_pad($table->name, 40). " - ";
|
||||
|
||||
$DB->change_database_structure("ALTER TABLE {$table->name} ENGINE = $engine");
|
||||
$DB->change_database_structure("ALTER TABLE {$table->name} TYPE = $engine");
|
||||
echo "DONE\n";
|
||||
$converted++;
|
||||
}
|
||||
|
||||
@@ -93,10 +93,6 @@ if ($version < $CFG->version) {
|
||||
$oldversion = "$CFG->release ($CFG->version)";
|
||||
$newversion = "$release ($version)";
|
||||
|
||||
if (!moodle_needs_upgrading()) {
|
||||
cli_error(get_string('cliupgradenoneed', 'core_admin', $newversion), 0);
|
||||
}
|
||||
|
||||
// test environment first
|
||||
if (!check_moodle_environment(normalize_version($release), $environment_results, false, ENV_SELECT_RELEASE)) {
|
||||
$errors = environment_get_errors($environment_results);
|
||||
|
||||
@@ -36,12 +36,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
if (defined('STDIN')) {
|
||||
fwrite(STDERR, "ERROR: This script no longer supports CLI, please use admin/cli/cron.php instead\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// This is a fake CLI script, it is a really ugly hack which emulates
|
||||
// CLI via web interface, please do not use this hack elsewhere
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
@@ -13,7 +13,7 @@ TODO:
|
||||
(user would need file access to dataroot which might prevent various "accidents")
|
||||
- implement "Export/import running" notification in lib/setup.php (similar to new upgrade flag in config table)
|
||||
- gzip compression when storing xml file - the xml is very verbose and full of repeated tags (zip is not suitable here at all)
|
||||
this could help us keep the files below 2G (expected ratio is > 10:1)
|
||||
this could help us keep the files bellow 2G (expected ratio is > 10:1)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
+1
-3
@@ -31,7 +31,6 @@ $enrol = required_param('enrol', PARAM_SAFEDIR);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$PAGE->set_url('/admin/enrol.php');
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
@@ -108,7 +107,6 @@ switch ($action) {
|
||||
} else { // Delete everything!!
|
||||
uninstall_plugin('enrol', $enrol);
|
||||
|
||||
$a = new stdClass();
|
||||
$a->plugin = $strplugin;
|
||||
$a->directory = "$CFG->dirroot/enrol/$enrol";
|
||||
echo $OUTPUT->notification(get_string('uninstalldeletefiles', 'enrol', $a), 'notifysuccess');
|
||||
@@ -119,4 +117,4 @@ switch ($action) {
|
||||
}
|
||||
|
||||
|
||||
redirect($return);
|
||||
redirect($return);
|
||||
+10
-223
@@ -214,7 +214,11 @@
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="5.0.25" />
|
||||
<VENDOR name="mysql" version="5.0.25">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.3" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
@@ -331,7 +335,11 @@
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="5.0.25" />
|
||||
<VENDOR name="mysql" version="5.0.25">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.3" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
@@ -434,225 +442,4 @@
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.2" requires="1.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="5.0.25" />
|
||||
<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.2" />
|
||||
<VENDOR name="sqlite" version="2.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.3.2" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="gdrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="40M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="safe_mode" value="0" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingsafemode" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.3" requires="2.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="5.1.33" />
|
||||
<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.2" />
|
||||
<VENDOR name="sqlite" version="2.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.3.2" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="gdrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="40M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="safe_mode" value="0" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingsafemode" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+1
-1
@@ -622,7 +622,7 @@ class generator {
|
||||
require_once($CFG->libdir .'/questionlib.php');
|
||||
require_once($CFG->dirroot .'/mod/quiz/editlib.php');
|
||||
$questions = array();
|
||||
$questionsmenu = question_bank::get_creatable_qtypes();
|
||||
$questionsmenu = question_type_menu();
|
||||
$questiontypes = array();
|
||||
foreach ($questionsmenu as $qtype => $qname) {
|
||||
$questiontypes[] = $qtype;
|
||||
|
||||
@@ -39,17 +39,13 @@ while(!feof($fd)) {
|
||||
$action = clam_handle_infected_file($file,$log->userid,true);
|
||||
clam_replace_infected_file($file);
|
||||
|
||||
list($ctxselect, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
|
||||
$sql = "SELECT c.id, c.fullname $ctxselect FROM {course} c $ctxjoin WHERE c.id = :courseid";
|
||||
$course = $DB->get_record_sql($sql, array('courseid' => $log->course));
|
||||
context_instance_preload($course);
|
||||
|
||||
$user = $DB->get_record("user", array("id"=>$log->userid));
|
||||
$course = $DB->get_record("course", array("id"=>$log->course));
|
||||
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
|
||||
$a->date = userdate($log->time);
|
||||
|
||||
$a->action = $action;
|
||||
$a->course = format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
|
||||
$a->course = $course->fullname;
|
||||
$a->user = fullname($user);
|
||||
|
||||
notify_user($user,$subject,$a);
|
||||
|
||||
+7
-1
@@ -2,7 +2,13 @@
|
||||
|
||||
ob_start(); //for whitespace test
|
||||
require_once('../config.php');
|
||||
$extraws = ob_get_clean();
|
||||
|
||||
// extra whitespace test - intentionally breaks cookieless mode
|
||||
$extraws = '';
|
||||
while (ob_get_level()) {
|
||||
$extraws .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
|
||||
+25
-41
@@ -30,11 +30,11 @@ if (!file_exists('../config.php')) {
|
||||
}
|
||||
|
||||
// Check that PHP is of a sufficient version as soon as possible
|
||||
if (version_compare(phpversion(), '5.3.2') < 0) {
|
||||
if (version_compare(phpversion(), '5.2.0') < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it to later place
|
||||
echo "Moodle 2.1 or later requires at least PHP 5.3.2 (currently using version $phpversion).<br />";
|
||||
echo "Please upgrade your server software or install older Moodle version.";
|
||||
echo "Sorry, Moodle 2.0 requires PHP 5.2.8 or later (currently using version $phpversion). ";
|
||||
echo "Please upgrade your server software or use latest Moodle 1.9.x instead.";
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ $id = optional_param('id', '', PARAM_TEXT);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
||||
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
||||
$showallplugins = optional_param('showallplugins', 0, PARAM_BOOL);
|
||||
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
||||
|
||||
// Check some PHP server settings
|
||||
@@ -124,7 +123,7 @@ if (!core_tables_exist()) {
|
||||
echo $OUTPUT->box($copyrightnotice, 'copyrightnotice');
|
||||
echo '<br />';
|
||||
$continue = new single_button(new moodle_url('/admin/index.php', array('lang'=>$CFG->lang, 'agreelicense'=>1)), get_string('continue'), 'get');
|
||||
echo $OUTPUT->confirm(get_string('doyouagree'), $continue, "http://docs.moodle.org/dev/License");
|
||||
echo $OUTPUT->confirm(get_string('doyouagree'), $continue, "http://docs.moodle.org/en/License");
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
}
|
||||
@@ -194,7 +193,6 @@ if (empty($CFG->version)) {
|
||||
}
|
||||
|
||||
if ($version > $CFG->version) { // upgrade
|
||||
purge_all_caches();
|
||||
$PAGE->set_pagelayout('maintenance');
|
||||
$PAGE->set_popup_notification_allowed(false);
|
||||
|
||||
@@ -257,19 +255,17 @@ if ($version > $CFG->version) { // upgrade
|
||||
$PAGE->set_title($strplugincheck);
|
||||
$PAGE->set_heading($strplugincheck);
|
||||
$PAGE->set_cacheable(false);
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->container(get_string('pluginchecknotice', 'core_plugin'), 'generalbox', 'notice');
|
||||
echo $output->plugins_check($pluginman->get_plugins(), array('full' => $showallplugins));
|
||||
echo $output->box_end();
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strplugincheck);
|
||||
echo $OUTPUT->box_start('generalbox', 'notice');
|
||||
print_string('pluginchecknotice');
|
||||
echo $OUTPUT->box_end();
|
||||
print_plugin_tables();
|
||||
print_upgrade_reload('index.php?confirmupgrade=1&confirmrelease=1');
|
||||
$button = new single_button(new moodle_url('index.php', array('confirmupgrade'=>1, 'confirmrelease'=>1, 'confirmplugincheck'=>1)), get_string('upgradestart', 'admin'), 'get');
|
||||
$button->class = 'continuebutton';
|
||||
echo $output->render($button);
|
||||
echo $output->footer();
|
||||
echo $OUTPUT->render($button);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
|
||||
} else {
|
||||
@@ -297,19 +293,17 @@ if (moodle_needs_upgrading()) {
|
||||
$PAGE->set_title($strplugincheck);
|
||||
$PAGE->set_heading($strplugincheck);
|
||||
$PAGE->set_cacheable(false);
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->container(get_string('pluginchecknotice', 'core_plugin'), 'generalbox', 'notice');
|
||||
echo $output->plugins_check($pluginman->get_plugins(), array('full' => $showallplugins));
|
||||
echo $output->box_end();
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strplugincheck);
|
||||
echo $OUTPUT->box_start('generalbox', 'notice');
|
||||
print_string('pluginchecknotice');
|
||||
echo $OUTPUT->box_end();
|
||||
print_plugin_tables();
|
||||
print_upgrade_reload('index.php');
|
||||
$button = new single_button(new moodle_url('index.php', array('confirmplugincheck'=>1)), get_string('upgradestart', 'admin'), 'get');
|
||||
$button->class = 'continuebutton';
|
||||
echo $output->render($button);
|
||||
echo $output->footer();
|
||||
echo $OUTPUT->render($button);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
}
|
||||
@@ -345,8 +339,8 @@ if (during_initial_install()) {
|
||||
}
|
||||
}
|
||||
|
||||
// at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that
|
||||
$adminuser = get_complete_user_data('id', reset(explode(',', $CFG->siteadmins)));
|
||||
// at this stage there can be only one admin - users may change username, so do not rely on that
|
||||
$adminuser = get_complete_user_data('id', $CFG->siteadmins);
|
||||
|
||||
if ($adminuser->password === 'adminsetuppending') {
|
||||
// prevent installation hijacking
|
||||
@@ -355,6 +349,7 @@ if (during_initial_install()) {
|
||||
}
|
||||
// login user and let him set password and admin details
|
||||
$adminuser->newadminuser = 1;
|
||||
message_set_default_message_preferences($adminuser);
|
||||
complete_user_login($adminuser, false);
|
||||
redirect("$CFG->wwwroot/user/editadvanced.php?id=$adminuser->id"); // Edit thyself
|
||||
|
||||
@@ -407,17 +402,6 @@ if (any_new_admin_settings($adminroot)){
|
||||
admin_externalpage_setup('adminnotifications');
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Unstable code warning
|
||||
if (isset($maturity)) {
|
||||
if ($maturity < MATURITY_STABLE) {
|
||||
$maturitylevel = get_string('maturity'.$maturity, 'admin');
|
||||
echo $OUTPUT->box(
|
||||
get_string('maturitycoreinfo', 'admin', $maturitylevel) . ' ' .
|
||||
$OUTPUT->doc_link('admin/versions', get_string('morehelp')),
|
||||
'generalbox adminwarning maturityinfo');
|
||||
}
|
||||
}
|
||||
|
||||
if ($insecuredataroot == INSECURE_DATAROOT_WARNING) {
|
||||
echo $OUTPUT->box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
|
||||
} else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
|
||||
@@ -458,8 +442,8 @@ if (!empty($CFG->maintenance_enabled)) {
|
||||
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
|
||||
'<a href="http://docs.moodle.org/dev/Releases" title="'.$CFG->version.'">'.$CFG->release.'</a><br />'.
|
||||
'Copyright © 1999 onwards, Martin Dougiamas<br />'.
|
||||
'and <a href="http://docs.moodle.org/dev/Credits">many other contributors</a>.<br />'.
|
||||
'<a href="http://docs.moodle.org/dev/License">GNU Public License</a>';
|
||||
'and <a href="http://docs.moodle.org/en/Credits">many other contributors</a>.<br />'.
|
||||
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
|
||||
echo $OUTPUT->box($copyrighttext, 'copyright');
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
$DB->set_debug(true);
|
||||
foreach ($tables as $table) {
|
||||
$fulltable = $DB->get_prefix().$table;
|
||||
$DB->change_database_structure("ALTER TABLE $fulltable ENGINE=INNODB");
|
||||
$DB->change_database_structure("ALTER TABLE $fulltable TYPE=INNODB");
|
||||
}
|
||||
$DB->set_debug(false);
|
||||
}
|
||||
|
||||
+91
-50
@@ -18,7 +18,7 @@
|
||||
/**
|
||||
* Fetches language packages from download.moodle.org server
|
||||
*
|
||||
* Language packages are available at http://download.moodle.org/langpack/
|
||||
* Language packages are available at http://download.moodle.org/langpack/2.0/
|
||||
* in ZIP format together with a file languages.md5 containing their hashes
|
||||
* and meta info.
|
||||
* Locally, language packs are saved into $CFG->dataroot/lang/
|
||||
@@ -33,6 +33,8 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
|
||||
$thisversion = '2.0'; // TODO this information should be taken from version.php or similar source
|
||||
|
||||
admin_externalpage_setup('langimport');
|
||||
|
||||
if (!empty($CFG->skiplangupgrade)) {
|
||||
@@ -61,22 +63,41 @@ if (($mode == INSTALLATION_OF_SELECTED_LANG) and confirm_sesskey() and !empty($p
|
||||
make_upload_directory('temp');
|
||||
make_upload_directory('lang');
|
||||
|
||||
$installer = new lang_installer($pack);
|
||||
$results = $installer->run();
|
||||
foreach ($results as $langcode => $langstatus) {
|
||||
switch ($langstatus) {
|
||||
case lang_installer::RESULT_DOWNLOADERROR:
|
||||
$a = new stdClass();
|
||||
$a->url = $installer->lang_pack_url($langcode);
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
print_error('remotedownloaderror', 'error', 'langimport.php', $a);
|
||||
break;
|
||||
case lang_installer::RESULT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackinstalled', 'admin', $langcode);
|
||||
break;
|
||||
case lang_installer::RESULT_UPTODATE:
|
||||
$notice_ok[] = get_string('langpackuptodate', 'admin', $langcode);
|
||||
break;
|
||||
if (is_array($pack)) {
|
||||
$packs = $pack;
|
||||
} else {
|
||||
$packs = array($pack);
|
||||
}
|
||||
|
||||
foreach ($packs as $pack) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion, $pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install();
|
||||
switch ($status) {
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/langpack/'.$thisversion.'/'.$pack.'.zip';
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
print_error($cd->get_error(), 'error', 'langimport.php', $a);
|
||||
} else {
|
||||
print_error($cd->get_error(), 'error', 'langimport.php');
|
||||
}
|
||||
break;
|
||||
case COMPONENT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
|
||||
if ($parentlang = get_parent_language($pack)) {
|
||||
// install also parent pack if specified
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion,
|
||||
$parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
$cd->install();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case COMPONENT_UPTODATE:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
echo $OUTPUT->notification('Had an unspecified error with the component installer, sorry.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,9 +136,7 @@ if ($mode == DELETION_OF_SELECTED_LANG and !empty($uninstalllang)) {
|
||||
if ($mode == UPDATE_ALL_LANG) {
|
||||
set_time_limit(0);
|
||||
|
||||
$installer = new lang_installer();
|
||||
|
||||
if (!$availablelangs = $installer->get_remote_list_of_languages()) {
|
||||
if (!$availablelangs = get_remote_list_of_languages()) {
|
||||
print_error('cannotdownloadlanguageupdatelist', 'error');
|
||||
}
|
||||
$md5array = array(); // (string)langcode => (string)md5
|
||||
@@ -152,8 +171,8 @@ if ($mode == UPDATE_ALL_LANG) {
|
||||
make_upload_directory('temp');
|
||||
make_upload_directory('lang');
|
||||
|
||||
// clean-up currently installed versions of the packs
|
||||
foreach ($neededlangs as $packindex => $pack) {
|
||||
$updated = false; // any packs updated?
|
||||
foreach ($neededlangs as $pack) {
|
||||
if ($pack == 'en') {
|
||||
continue;
|
||||
}
|
||||
@@ -166,38 +185,41 @@ if ($mode == UPDATE_ALL_LANG) {
|
||||
if (file_exists($dest1)) {
|
||||
if (!remove_dir($dest1)) {
|
||||
$notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.';
|
||||
unset($neededlangs[$packindex]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (file_exists($dest2)) {
|
||||
if (!remove_dir($dest2)) {
|
||||
$notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.';
|
||||
unset($neededlangs[$packindex]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// install all needed language packs
|
||||
$installer->set_queue($neededlangs);
|
||||
$results = $installer->run();
|
||||
$updated = false; // any packs updated?
|
||||
foreach ($results as $langcode => $langstatus) {
|
||||
switch ($langstatus) {
|
||||
case lang_installer::RESULT_DOWNLOADERROR:
|
||||
$a = new stdClass();
|
||||
$a->url = $installer->lang_pack_url($langcode);
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
print_error('remotedownloaderror', 'error', 'langimport.php', $a);
|
||||
break;
|
||||
case lang_installer::RESULT_INSTALLED:
|
||||
$updated = true;
|
||||
$notice_ok[] = get_string('langpackinstalled', 'admin', $langcode);
|
||||
break;
|
||||
case lang_installer::RESULT_UPTODATE:
|
||||
$notice_ok[] = get_string('langpackuptodate', 'admin', $langcode);
|
||||
break;
|
||||
// copy and unzip new version
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion, $pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install();
|
||||
switch ($status) {
|
||||
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/langpack/'.$thisversion.'/'.$pack.'.zip';
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
print_error($cd->get_error(), 'error', 'langimport.php', $a);
|
||||
} else {
|
||||
print_error($cd->get_error(), 'error', 'langimport.php');
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_UPTODATE:
|
||||
// should not get here
|
||||
break;
|
||||
|
||||
case COMPONENT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackupdated', 'admin', $pack);
|
||||
$updated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,8 +228,6 @@ if ($mode == UPDATE_ALL_LANG) {
|
||||
} else {
|
||||
$notice_ok[] = get_string('nolangupdateneeded','admin');
|
||||
}
|
||||
|
||||
unset($installer);
|
||||
}
|
||||
get_string_manager()->reset_caches();
|
||||
|
||||
@@ -219,7 +239,7 @@ $installedlangs = get_string_manager()->get_list_of_translations(true);
|
||||
$missingparents = array();
|
||||
foreach ($installedlangs as $installedlang => $unused) {
|
||||
$parent = get_parent_language($installedlang);
|
||||
if (empty($parent)) {
|
||||
if (empty($parent) or ($parent === 'en')) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($installedlangs[$parent])) {
|
||||
@@ -227,9 +247,7 @@ foreach ($installedlangs as $installedlang => $unused) {
|
||||
}
|
||||
}
|
||||
|
||||
$installer = new lang_installer();
|
||||
|
||||
if ($availablelangs = $installer->get_remote_list_of_languages()) {
|
||||
if ($availablelangs = get_remote_list_of_languages()) {
|
||||
$remote = true;
|
||||
} else {
|
||||
$remote = false;
|
||||
@@ -339,3 +357,26 @@ function is_installed_lang($lang, $md5check) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available language packs from download.moodle.org
|
||||
*
|
||||
* @return array|bool false if can not download
|
||||
*/
|
||||
function get_remote_list_of_languages() {
|
||||
$source = 'http://download.moodle.org/langpack/2.0/languages.md5';
|
||||
$availablelangs = array();
|
||||
|
||||
if ($content = download_file_content($source)) {
|
||||
$alllines = explode("\n", $content);
|
||||
foreach($alllines as $line) {
|
||||
if (!empty($line)){
|
||||
$availablelangs[] = explode(',', $line);
|
||||
}
|
||||
}
|
||||
return $availablelangs;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This file contains functions used by the admin pages
|
||||
*
|
||||
* @since 2.1
|
||||
* @package admin
|
||||
* @copyright 2011 Andrew Davis
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return a list of page types
|
||||
* @param string $pagetype current page type
|
||||
* @param stdClass $parentcontext Block's parent context
|
||||
* @param stdClass $currentcontext Current context of block
|
||||
*/
|
||||
function admin_page_type_list($pagetype, $parentcontext, $currentcontext) {
|
||||
$array = array(
|
||||
'admin-*' => get_string('page-admin-x', 'pagetype'),
|
||||
$pagetype => get_string('page-admin-current', 'pagetype')
|
||||
);
|
||||
// Add the missing * (any page) option for them. MDL-30340
|
||||
// TODO: These pages are really 'pagetype-varying' - MDL-30564 -
|
||||
// and some day we should stop behaving that way, so proper pagetypes
|
||||
// can be specified for it (like course-category-* or so).
|
||||
// Luckly... the option we are introducing '*' is independent
|
||||
// of that varying behavior, so will work.
|
||||
if ($pagetype == 'admin-course-category') {
|
||||
$array += array(
|
||||
'*' => get_string('page-x', 'pagetype')
|
||||
);
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Message outputs configuration page
|
||||
*
|
||||
* @package message
|
||||
* @copyright 2011 Lancaster University Network Services Limited
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->dirroot . '/message/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
// This is an admin page
|
||||
admin_externalpage_setup('managemessageoutputs');
|
||||
|
||||
// Require site configuration capability
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
// Get the submitted params
|
||||
$disable = optional_param('disable', 0, PARAM_INT);
|
||||
$enable = optional_param('enable', 0, PARAM_INT);
|
||||
|
||||
if (!empty($disable) && confirm_sesskey()) {
|
||||
if (!$processor = $DB->get_record('message_processors', array('id'=>$disable))) {
|
||||
print_error('outputdoesnotexist', 'message');
|
||||
}
|
||||
$DB->set_field('message_processors', 'enabled', '0', array('id'=>$processor->id)); // Disable output
|
||||
}
|
||||
|
||||
if (!empty($enable) && confirm_sesskey() ) {
|
||||
if (!$processor = $DB->get_record('message_processors', array('id'=>$enable))) {
|
||||
print_error('outputdoesnotexist', 'message');
|
||||
}
|
||||
$DB->set_field('message_processors', 'enabled', '1', array('id'=>$processor->id)); // Enable output
|
||||
}
|
||||
|
||||
if ($disable || $enable) {
|
||||
$url = new moodle_url('message.php');
|
||||
redirect($url);
|
||||
}
|
||||
// Page settings
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
// Grab the renderer
|
||||
$renderer = $PAGE->get_renderer('core', 'message');
|
||||
|
||||
// Display the manage message outputs interface
|
||||
$processors = get_message_processors();
|
||||
$messageoutputs = $renderer->manage_messageoutputs($processors);
|
||||
|
||||
// Display the page
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('managemessageoutputs', 'message'));
|
||||
echo $messageoutputs;
|
||||
echo $OUTPUT->footer();
|
||||
+16
-25
@@ -38,10 +38,9 @@ class mnet_simple_host_form extends moodleform {
|
||||
|
||||
$mform = $this->_form;
|
||||
|
||||
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'), array('maxlength' => 255, 'size' => 50));
|
||||
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
|
||||
$mform->setType('wwwroot', PARAM_URL);
|
||||
$mform->addRule('wwwroot', null, 'required', null, 'client');
|
||||
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
|
||||
$mform->addElement('select', 'applicationid', get_string('applicationtype', 'mnet'),
|
||||
$DB->get_records_menu('mnet_application', array(), 'id,display_name'));
|
||||
@@ -50,7 +49,7 @@ class mnet_simple_host_form extends moodleform {
|
||||
$this->add_action_buttons(false, get_string('addhost', 'mnet'));
|
||||
}
|
||||
|
||||
function validation($data, $files) {
|
||||
function validation($data) {
|
||||
global $DB;
|
||||
|
||||
$wwwroot = $data['wwwroot'];
|
||||
@@ -82,13 +81,11 @@ class mnet_review_host_form extends moodleform {
|
||||
$mform->addElement('hidden', 'applicationid');
|
||||
$mform->addElement('hidden', 'oldpublickey');
|
||||
|
||||
$mform->addElement('text', 'name', get_string('site'), array('maxlength' => 80, 'size' => 50));
|
||||
$mform->addElement('text', 'name', get_string('site'));
|
||||
$mform->setType('name', PARAM_NOTAGS);
|
||||
$mform->addRule('name', get_string('maximumchars', '', 80), 'maxlength', 80, 'client');
|
||||
|
||||
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'), array('maxlength' => 255, 'size' => 50));
|
||||
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
|
||||
$mform->setType('wwwroot', PARAM_URL);
|
||||
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
|
||||
$themes = array('' => get_string('forceno'));
|
||||
foreach (array_keys(get_plugin_list('theme')) as $themename) {
|
||||
@@ -98,7 +95,15 @@ class mnet_review_host_form extends moodleform {
|
||||
|
||||
$mform->addElement('textarea', 'public_key', get_string('publickey', 'mnet'), array('rows' => 17, 'cols' => 100, 'class' => 'smalltext'));
|
||||
$mform->setType('public_key', PARAM_PEM);
|
||||
$mform->addRule('public_key', get_string('required'), 'required');
|
||||
|
||||
if ($mnet_peer && !empty($mnet_peer->deleted)) {
|
||||
$radioarray = array();
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1);
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0);
|
||||
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' '), false);
|
||||
} else {
|
||||
$mform->addElement('hidden', 'deleted');
|
||||
}
|
||||
|
||||
// finished with form controls, now the static informational stuff
|
||||
if ($mnet_peer && !empty($mnet_peer->bootstrapped)) {
|
||||
@@ -135,35 +140,21 @@ class mnet_review_host_form extends moodleform {
|
||||
}
|
||||
}
|
||||
|
||||
$mform->addElement('static', 'certdetails', get_string('certdetails', 'mnet'),
|
||||
$OUTPUT->box('<pre>' . $credstr . '</pre>', 'generalbox certdetails'));
|
||||
}
|
||||
|
||||
if ($mnet_peer && !empty($mnet_peer->deleted)) {
|
||||
$radioarray = array();
|
||||
$radioarray[] = MoodleQuickForm::createElement('static', 'deletedinfo', '',
|
||||
$OUTPUT->container(get_string('deletedhostinfo', 'mnet'), 'deletedhostinfo'));
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1);
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0);
|
||||
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' ', ' '), false);
|
||||
} else {
|
||||
$mform->addElement('hidden', 'deleted');
|
||||
$mform->addElement('static', 'certdetails', get_string('certdetails', 'mnet'), $OUTPUT->box('<pre>' . $credstr . '</pre>'));
|
||||
}
|
||||
|
||||
// finished with static stuff, print save button
|
||||
$this->add_action_buttons(false);
|
||||
}
|
||||
|
||||
function validation($data, $files) {
|
||||
function validation($data) {
|
||||
$errors = array();
|
||||
if ($data['oldpublickey'] == $data['public_key']) {
|
||||
return;
|
||||
}
|
||||
$mnet_peer = new mnet_peer(); // idiotic api
|
||||
$mnet_peer->wwwroot = $data['wwwroot']; // just hard-set this rather than bootstrap the object
|
||||
if (empty($data['public_key'])) {
|
||||
$errors['public_key'] = get_string('publickeyrequired', 'mnet');
|
||||
} else if (!$credentials = $mnet_peer->check_credentials($data['public_key'])) {
|
||||
if (!$credentials = $mnet_peer->check_credentials($data['public_key'])) {
|
||||
$errmsg = '';
|
||||
foreach ($mnet_peer->error as $err) {
|
||||
$errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
|
||||
|
||||
+4
-19
@@ -190,7 +190,7 @@ if ($formdata = $reviewform->get_data()) {
|
||||
|
||||
// normal flow - just display all hosts with links
|
||||
echo $OUTPUT->header();
|
||||
$hosts = mnet_get_hosts(true);
|
||||
$hosts = mnet_get_hosts();
|
||||
|
||||
// print the table to display the register all hosts setting
|
||||
$table = new html_table();
|
||||
@@ -231,43 +231,28 @@ $table->head = array(
|
||||
);
|
||||
$table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap');
|
||||
$baseurl = new moodle_url('/admin/mnet/peers.php');
|
||||
$deleted = array();
|
||||
foreach($hosts as $host) {
|
||||
$hosturl = new moodle_url($baseurl, array('hostid' => $host->id));
|
||||
if (trim($host->name) === '') {
|
||||
// should not happen but...
|
||||
$host->name = '???';
|
||||
}
|
||||
// process all hosts first since it's the easiest
|
||||
if ($host->id == $CFG->mnet_all_hosts_id) {
|
||||
$table->data[] = array(html_writer::link($hosturl, get_string('allhosts', 'core_mnet')), '*', '', '');
|
||||
continue;
|
||||
}
|
||||
|
||||
// populate the list of deleted hosts
|
||||
if ($host->deleted) {
|
||||
$deleted[] = html_writer::link($hosturl, $host->name);
|
||||
$table->data[] = array(html_writer::tag('a', $host->name, array('href'=>$hosturl)), '', '', '');
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($host->last_connect_time == 0) {
|
||||
$last_connect = get_string('never');
|
||||
} else {
|
||||
$last_connect = userdate($host->last_connect_time, get_string('strftimedatetime', 'core_langconfig'));
|
||||
$last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
|
||||
}
|
||||
$table->data[] = array(
|
||||
html_writer::link($hosturl, $host->name),
|
||||
html_writer::link($host->wwwroot, $host->wwwroot),
|
||||
html_writer::link($hosturl, $host->wwwroot),
|
||||
$last_connect,
|
||||
$OUTPUT->single_button(new moodle_url('/admin/mnet/delete.php', array('hostid' => $host->id)), get_string('delete'))
|
||||
);
|
||||
}
|
||||
echo html_writer::table($table);
|
||||
|
||||
if ($deleted) {
|
||||
echo $OUTPUT->box(get_string('deletedhosts', 'core_mnet', join(', ', $deleted)), 'deletedhosts');
|
||||
}
|
||||
|
||||
// finally, print the initial form to add a new host
|
||||
echo $OUTPUT->box_start();
|
||||
echo $OUTPUT->heading(get_string('addnewhost', 'mnet'), 3);
|
||||
|
||||
@@ -39,15 +39,6 @@ class mnet_profile_form extends moodleform {
|
||||
global $CFG;
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mnetprofileimportfields = '';
|
||||
if (isset($CFG->mnetprofileimportfields)) {
|
||||
$mnetprofileimportfields = str_replace(',', ', ', $CFG->mnetprofileimportfields);
|
||||
}
|
||||
|
||||
$mnetprofileexportfields = '';
|
||||
if (isset($CFG->mnetprofileexportfields)) {
|
||||
$mnetprofileexportfields = str_replace(',', ', ', $CFG->mnetprofileexportfields);
|
||||
}
|
||||
|
||||
$mform->addElement('hidden', 'hostid', $this->_customdata['hostid']);
|
||||
$fields = mnet_profile_field_options();
|
||||
@@ -58,7 +49,7 @@ class mnet_profile_form extends moodleform {
|
||||
$select = $mform->addElement('select', 'importfields', get_string('importfields', 'mnet'), $fields['optional']);
|
||||
$select->setMultiple(true);
|
||||
|
||||
$mform->addElement('checkbox', 'importdefault', get_string('leavedefault', 'mnet'), $mnetprofileimportfields);
|
||||
$mform->addElement('checkbox', 'importdefault', get_string('leavedefault', 'mnet'), str_replace(',', ', ', $CFG->mnetprofileimportfields));
|
||||
|
||||
// Fields to export ----------------------------------------------------
|
||||
$mform->addElement('header', 'export', get_string('exportfields', 'mnet'));
|
||||
@@ -66,7 +57,7 @@ class mnet_profile_form extends moodleform {
|
||||
$select = $mform->addElement('select', 'exportfields', get_string('exportfields', 'mnet'), $fields['optional']);
|
||||
$select->setMultiple(true);
|
||||
|
||||
$mform->addElement('checkbox', 'exportdefault', get_string('leavedefault', 'mnet'), $mnetprofileexportfields);
|
||||
$mform->addElement('checkbox', 'exportdefault', get_string('leavedefault', 'mnet'), str_replace(',', ', ', $CFG->mnetprofileexportfields));
|
||||
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class mnet_services_form extends moodleform {
|
||||
function definition() {
|
||||
$mform =& $this->_form;
|
||||
$mnet_peer =& $this->_customdata['peer'];
|
||||
$myservices = mnet_get_service_info($mnet_peer);
|
||||
$myservices =& mnet_get_service_info($mnet_peer);
|
||||
|
||||
$mform->addElement('hidden', 'hostid', $mnet_peer->id);
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@
|
||||
}
|
||||
|
||||
uninstall_plugin('mod', $delete);
|
||||
$a = new stdClass();
|
||||
$a->module = $strmodulename;
|
||||
$a->directory = "$CFG->dirroot/mod/$delete";
|
||||
echo $OUTPUT->notification(get_string("moduledeletefiles", "", $a), 'notifysuccess');
|
||||
|
||||
+4
-14
@@ -42,20 +42,12 @@ function online_assignment_cleanup($output=false) {
|
||||
|
||||
|
||||
/// get a list of all courses on this site
|
||||
list($ctxselect, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
|
||||
$sql = "SELECT c.* $ctxselect FROM {course} c $ctxjoin";
|
||||
$courses = $DB->get_records_sql($sql);
|
||||
$courses = $DB->get_records('course');
|
||||
|
||||
/// cycle through each course
|
||||
foreach ($courses as $course) {
|
||||
context_instance_preload($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
if (empty($course->fullname)) {
|
||||
$fullname = get_string('course').': '.$course->id;
|
||||
} else {
|
||||
$fullname = format_string($course->fullname, true, array('context' => $context));
|
||||
}
|
||||
$fullname = empty($course->fullname) ? 'Course: '.$course->id : $course->fullname;
|
||||
if ($output) echo $OUTPUT->heading($fullname);
|
||||
|
||||
/// retrieve a list of sections beyond what is currently being shown
|
||||
@@ -104,9 +96,7 @@ function online_assignment_cleanup($output=false) {
|
||||
|
||||
/// grab the section record
|
||||
if (!($section = $DB->get_record('course_sections', array('id'=>$newsection)))) {
|
||||
if ($output) {
|
||||
echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. $fullname .'<br />';
|
||||
}
|
||||
if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. format_string($course->fullname) .'<br />';
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -127,7 +117,7 @@ function online_assignment_cleanup($output=false) {
|
||||
|
||||
/// grab the old section record
|
||||
if (!($section = $DB->get_record('course_sections', array('id'=>$xsection->id)))) {
|
||||
if ($output) echo 'Serious error: Cannot retrieve old section: '.$xsection->id.' for course: '.$fullname.'<br />';
|
||||
if ($output) echo 'Serious error: Cannot retrieve old section: '.$xsection->id.' for course: '.$course->fullname.'<br />';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* UI for general plugins management
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @copyright 2011 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(dirname(dirname(__FILE__)) . '/config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->libdir . '/pluginlib.php');
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
admin_externalpage_setup('pluginsoverview');
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->heading(get_string('pluginsoverview', 'core_admin'));
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->plugins_control_panel($pluginman->get_plugins());
|
||||
echo $output->box_end();
|
||||
echo $output->footer();
|
||||
@@ -1,304 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Allows the admin to manage question behaviours.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionengine
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->libdir . '/questionlib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->libdir . '/tablelib.php');
|
||||
|
||||
// Check permissions.
|
||||
require_login();
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
require_capability('moodle/question:config', $systemcontext);
|
||||
|
||||
admin_externalpage_setup('manageqbehaviours');
|
||||
$thispageurl = new moodle_url('/admin/qbehaviours.php');
|
||||
|
||||
$behaviours = get_plugin_list('qbehaviour');
|
||||
|
||||
// Get some data we will need - question counts and which types are needed.
|
||||
$counts = $DB->get_records_sql_menu("
|
||||
SELECT behaviour, COUNT(1)
|
||||
FROM {question_attempts} GROUP BY behaviour");
|
||||
$needed = array();
|
||||
$archetypal = array();
|
||||
foreach ($behaviours as $behaviour => $notused) {
|
||||
if (!array_key_exists($behaviour, $counts)) {
|
||||
$counts[$behaviour] = 0;
|
||||
}
|
||||
$needed[$behaviour] = $counts[$behaviour] > 0;
|
||||
$archetypal[$behaviour] = question_engine::is_behaviour_archetypal($behaviour);
|
||||
}
|
||||
|
||||
foreach ($behaviours as $behaviour => $notused) {
|
||||
foreach (question_engine::get_behaviour_required_behaviours($behaviour) as $reqbehaviour) {
|
||||
$needed[$reqbehaviour] = true;
|
||||
}
|
||||
}
|
||||
foreach ($counts as $behaviour => $count) {
|
||||
if (!array_key_exists($behaviour, $behaviours)) {
|
||||
$counts['missing'] += $count;
|
||||
}
|
||||
}
|
||||
$needed['missing'] = true;
|
||||
|
||||
// Work of the correct sort order.
|
||||
$config = get_config('question');
|
||||
$sortedbehaviours = array();
|
||||
foreach ($behaviours as $behaviour => $notused) {
|
||||
$sortedbehaviours[$behaviour] = question_engine::get_behaviour_name($behaviour);
|
||||
}
|
||||
if (!empty($config->behavioursortorder)) {
|
||||
$sortedbehaviours = question_engine::sort_behaviours($sortedbehaviours,
|
||||
$config->behavioursortorder, '');
|
||||
}
|
||||
|
||||
if (!empty($config->disabledbehaviours)) {
|
||||
$disabledbehaviours = explode(',', $config->disabledbehaviours);
|
||||
} else {
|
||||
$disabledbehaviours = array();
|
||||
}
|
||||
|
||||
// Process actions ============================================================
|
||||
|
||||
// Disable.
|
||||
if (($disable = optional_param('disable', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($behaviours[$disable])) {
|
||||
print_error('unknownbehaviour', 'question', $thispageurl, $disable);
|
||||
}
|
||||
|
||||
if (array_search($disable, $disabledbehaviours) === false) {
|
||||
$disabledbehaviours[] = $disable;
|
||||
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
|
||||
}
|
||||
redirect($thispageurl);
|
||||
}
|
||||
|
||||
// Enable.
|
||||
if (($enable = optional_param('enable', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($behaviours[$enable])) {
|
||||
print_error('unknownbehaviour', 'question', $thispageurl, $enable);
|
||||
}
|
||||
|
||||
if (!$archetypal[$enable]) {
|
||||
print_error('cannotenablebehaviour', 'question', $thispageurl, $enable);
|
||||
}
|
||||
|
||||
if (($key = array_search($enable, $disabledbehaviours)) !== false) {
|
||||
unset($disabledbehaviours[$key]);
|
||||
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
|
||||
}
|
||||
redirect($thispageurl);
|
||||
}
|
||||
|
||||
// Move up in order.
|
||||
if (($up = optional_param('up', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($behaviours[$up])) {
|
||||
print_error('unknownbehaviour', 'question', $thispageurl, $up);
|
||||
}
|
||||
|
||||
// This function works fine for behaviours, as well as qtypes.
|
||||
$neworder = question_reorder_qtypes($sortedbehaviours, $up, -1);
|
||||
set_config('behavioursortorder', implode(',', $neworder), 'question');
|
||||
redirect($thispageurl);
|
||||
}
|
||||
|
||||
// Move down in order.
|
||||
if (($down = optional_param('down', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($behaviours[$down])) {
|
||||
print_error('unknownbehaviour', 'question', $thispageurl, $down);
|
||||
}
|
||||
|
||||
// This function works fine for behaviours, as well as qtypes.
|
||||
$neworder = question_reorder_qtypes($sortedbehaviours, $down, +1);
|
||||
set_config('behavioursortorder', implode(',', $neworder), 'question');
|
||||
redirect($thispageurl);
|
||||
}
|
||||
|
||||
// Delete.
|
||||
if (($delete = optional_param('delete', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
// Check it is OK to delete this question type.
|
||||
if ($delete == 'missing') {
|
||||
print_error('cannotdeletemissingbehaviour', 'question', $thispageurl);
|
||||
}
|
||||
|
||||
if (!isset($behaviours[$delete])) {
|
||||
print_error('unknownbehaviour', 'question', $thispageurl, $delete);
|
||||
}
|
||||
|
||||
$behaviourname = $sortedbehaviours[$delete];
|
||||
if ($counts[$delete] > 0) {
|
||||
print_error('cannotdeletebehaviourinuse', 'question', $thispageurl, $behaviourname);
|
||||
}
|
||||
if ($needed[$delete] > 0) {
|
||||
print_error('cannotdeleteneededbehaviour', 'question', $thispageurl, $behaviourname);
|
||||
}
|
||||
|
||||
// If not yet confirmed, display a confirmation message.
|
||||
if (!optional_param('confirm', '', PARAM_BOOL)) {
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('deletebehaviourareyousure', 'question', $behaviourname));
|
||||
echo $OUTPUT->confirm(
|
||||
get_string('deletebehaviourareyousuremessage', 'question', $behaviourname),
|
||||
new moodle_url($thispageurl, array('delete' => $delete, 'confirm' => 1)),
|
||||
$thispageurl);
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Do the deletion.
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('deletingbehaviour', 'question', $behaviourname));
|
||||
|
||||
// Delete any configuration records.
|
||||
if (!unset_all_config_for_plugin('qbehaviour_' . $delete)) {
|
||||
echo $OUTPUT->notification(get_string('errordeletingconfig', 'admin', 'qbehaviour_' . $delete));
|
||||
}
|
||||
if (($key = array_search($delete, $disabledbehaviours)) !== false) {
|
||||
unset($disabledbehaviours[$key]);
|
||||
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
|
||||
}
|
||||
$behaviourorder = array_keys($sortedbehaviours);
|
||||
if (($key = array_search($delete, $behaviourorder)) !== false) {
|
||||
unset($behaviourorder[$key]);
|
||||
set_config('behavioursortorder', implode(',', $behaviourorder), 'question');
|
||||
}
|
||||
|
||||
// Then the tables themselves
|
||||
drop_plugin_tables($delete, get_plugin_directory('qbehaviour', $delete) . '/db/install.xml', false);
|
||||
|
||||
// Remove event handlers and dequeue pending events
|
||||
events_uninstall('qbehaviour_' . $delete);
|
||||
|
||||
$a = new stdClass();
|
||||
$a->behaviour = $behaviourname;
|
||||
$a->directory = get_plugin_directory('qbehaviour', $delete);
|
||||
echo $OUTPUT->box(get_string('qbehaviourdeletefiles', 'question', $a), 'generalbox', 'notice');
|
||||
echo $OUTPUT->continue_button($thispageurl);
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
// End of process actions ==================================================
|
||||
|
||||
// Print the page heading.
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('manageqbehaviours', 'admin'));
|
||||
|
||||
// Set up the table.
|
||||
$table = new flexible_table('qbehaviouradmintable');
|
||||
$table->define_baseurl($thispageurl);
|
||||
$table->define_columns(array('behaviour', 'numqas', 'version', 'requires',
|
||||
'available', 'delete'));
|
||||
$table->define_headers(array(get_string('behaviour', 'question'), get_string('numqas', 'question'),
|
||||
get_string('version'), get_string('requires', 'admin'),
|
||||
get_string('availableq', 'question'), get_string('delete')));
|
||||
$table->set_attribute('id', 'qbehaviours');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
// Add a row for each question type.
|
||||
foreach ($sortedbehaviours as $behaviour => $behaviourname) {
|
||||
$row = array();
|
||||
|
||||
// Question icon and name.
|
||||
$row[] = $behaviourname;
|
||||
|
||||
// Count
|
||||
$row[] = $counts[$behaviour];
|
||||
|
||||
// Question version number.
|
||||
$version = get_config('qbehaviour_' . $behaviour, 'version');
|
||||
if ($version) {
|
||||
$row[] = $version;
|
||||
} else {
|
||||
$row[] = html_writer::tag('span', get_string('nodatabase', 'admin'), array('class' => 'disabled'));
|
||||
}
|
||||
|
||||
// Other question types required by this one.
|
||||
$requiredbehaviours = question_engine::get_behaviour_required_behaviours($behaviour);
|
||||
if (!empty($requiredbehaviours)) {
|
||||
$strrequiredbehaviours = array();
|
||||
foreach ($requiredbehaviours as $required) {
|
||||
$strrequiredbehaviours[] = $sortedbehaviours[$required];
|
||||
}
|
||||
$row[] = implode(', ', $strrequiredbehaviours);
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
|
||||
// Are people allowed to select this behaviour?
|
||||
$rowclass = '';
|
||||
if ($archetypal[$behaviour]) {
|
||||
$enabled = array_search($behaviour, $disabledbehaviours) === false;
|
||||
$icons = question_behaviour_enable_disable_icons($behaviour, $enabled);
|
||||
if (!$enabled) {
|
||||
$rowclass = 'dimmed_text';
|
||||
}
|
||||
} else {
|
||||
$icons = $OUTPUT->spacer() . ' ';
|
||||
}
|
||||
|
||||
// Move icons.
|
||||
$icons .= question_behaviour_icon_html('up', $behaviour, 't/up', get_string('up'), null);
|
||||
$icons .= question_behaviour_icon_html('down', $behaviour, 't/down', get_string('down'), null);
|
||||
$row[] = $icons;
|
||||
|
||||
// Delete link, if available.
|
||||
if ($needed[$behaviour]) {
|
||||
$row[] = '';
|
||||
} else {
|
||||
$row[] = html_writer::link(new moodle_url($thispageurl,
|
||||
array('delete' => $behaviour, 'sesskey' => sesskey())), get_string('delete'),
|
||||
array('title' => get_string('uninstallbehaviour', 'question')));
|
||||
}
|
||||
|
||||
$table->add_data($row, $rowclass);
|
||||
}
|
||||
|
||||
$table->finish_output();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
function question_behaviour_enable_disable_icons($behaviour, $enabled) {
|
||||
if ($enabled) {
|
||||
return question_behaviour_icon_html('disable', $behaviour, 'i/hide',
|
||||
get_string('enabled', 'question'), get_string('disable'));
|
||||
} else {
|
||||
return question_behaviour_icon_html('enable', $behaviour, 'i/show',
|
||||
get_string('disabled', 'question'), get_string('enable'));
|
||||
}
|
||||
}
|
||||
|
||||
function question_behaviour_icon_html($action, $behaviour, $icon, $alt, $tip) {
|
||||
global $OUTPUT;
|
||||
return $OUTPUT->action_icon(new moodle_url('/admin/qbehaviours.php',
|
||||
array($action => $behaviour, 'sesskey' => sesskey())),
|
||||
new pix_icon($icon, $alt, 'moodle', array('title' => '')),
|
||||
null, array('title' => $tip)) . ' ';
|
||||
}
|
||||
|
||||
+247
-267
@@ -1,313 +1,293 @@
|
||||
<?php
|
||||
// Allows the admin to manage question types.
|
||||
|
||||
// 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/>.
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->libdir . '/questionlib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->libdir . '/tablelib.php');
|
||||
|
||||
/**
|
||||
* Allows the admin to manage question types.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
/// Check permissions.
|
||||
require_login();
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
require_capability('moodle/question:config', $systemcontext);
|
||||
$canviewreports = has_capability('report/questioninstances:view', $systemcontext);
|
||||
|
||||
admin_externalpage_setup('manageqtypes');
|
||||
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->libdir . '/questionlib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->libdir . '/tablelib.php');
|
||||
|
||||
// Check permissions.
|
||||
require_login();
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
require_capability('moodle/question:config', $systemcontext);
|
||||
$canviewreports = has_capability('report/questioninstances:view', $systemcontext);
|
||||
|
||||
admin_externalpage_setup('manageqtypes');
|
||||
$thispageurl = new moodle_url('/admin/qtypes.php');
|
||||
|
||||
$qtypes = question_bank::get_all_qtypes();
|
||||
|
||||
// Get some data we will need - question counts and which types are needed.
|
||||
$counts = $DB->get_records_sql("
|
||||
SELECT qtype, COUNT(1) as numquestions, SUM(hidden) as numhidden
|
||||
FROM {question} GROUP BY qtype", array());
|
||||
$needed = array();
|
||||
foreach ($qtypes as $qtypename => $qtype) {
|
||||
if (!isset($counts[$qtypename])) {
|
||||
$counts[$qtypename] = new stdClass;
|
||||
$counts[$qtypename]->numquestions = 0;
|
||||
$counts[$qtypename]->numhidden = 0;
|
||||
/// Get some data we will need - question counts and which types are needed.
|
||||
$counts = $DB->get_records_sql("
|
||||
SELECT qtype, COUNT(1) as numquestions, SUM(hidden) as numhidden
|
||||
FROM {question} GROUP BY qtype", array());
|
||||
$needed = array();
|
||||
foreach ($QTYPES as $qtypename => $qtype) {
|
||||
if (!isset($counts[$qtypename])) {
|
||||
$counts[$qtypename] = new stdClass;
|
||||
$counts[$qtypename]->numquestions = 0;
|
||||
$counts[$qtypename]->numhidden = 0;
|
||||
}
|
||||
$needed[$qtypename] = $counts[$qtypename]->numquestions > 0;
|
||||
$counts[$qtypename]->numquestions -= $counts[$qtypename]->numhidden;
|
||||
}
|
||||
$needed[$qtypename] = $counts[$qtypename]->numquestions > 0;
|
||||
$counts[$qtypename]->numquestions -= $counts[$qtypename]->numhidden;
|
||||
}
|
||||
$needed['missingtype'] = true; // The system needs the missing question type.
|
||||
foreach ($qtypes as $qtypename => $qtype) {
|
||||
foreach ($qtype->requires_qtypes() as $reqtype) {
|
||||
$needed[$reqtype] = true;
|
||||
$needed['missingtype'] = true; // The system needs the missing question type.
|
||||
foreach ($QTYPES as $qtypename => $qtype) {
|
||||
foreach ($qtype->requires_qtypes() as $reqtype) {
|
||||
$needed[$reqtype] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($counts as $qtypename => $count) {
|
||||
if (!isset($qtypes[$qtypename])) {
|
||||
$counts['missingtype']->numquestions += $count->numquestions - $count->numhidden;
|
||||
$counts['missingtype']->numhidden += $count->numhidden;
|
||||
}
|
||||
}
|
||||
|
||||
// Work of the correct sort order.
|
||||
$config = get_config('question');
|
||||
$sortedqtypes = array();
|
||||
foreach ($qtypes as $qtypename => $qtype) {
|
||||
$sortedqtypes[$qtypename] = $qtype->local_name();
|
||||
}
|
||||
$sortedqtypes = question_bank::sort_qtype_array($sortedqtypes, $config);
|
||||
|
||||
// Process actions ============================================================
|
||||
|
||||
// Disable.
|
||||
if (($disable = optional_param('disable', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($qtypes[$disable])) {
|
||||
print_error('unknownquestiontype', 'question', $thispageurl, $disable);
|
||||
foreach ($counts as $qtypename => $count) {
|
||||
if (!isset($QTYPES[$qtypename])) {
|
||||
$counts['missingtype']->numquestions += $count->numquestions - $count->numhidden;
|
||||
$counts['missingtype']->numhidden += $count->numhidden;
|
||||
}
|
||||
}
|
||||
|
||||
set_config($disable . '_disabled', 1, 'question');
|
||||
redirect($thispageurl);
|
||||
}
|
||||
/// Work of the correct sort order.
|
||||
$config = get_config('question');
|
||||
$sortedqtypes = array();
|
||||
foreach ($QTYPES as $qtypename => $qtype) {
|
||||
$sortedqtypes[$qtypename] = $qtype->local_name();
|
||||
}
|
||||
$sortedqtypes = question_sort_qtype_array($sortedqtypes, $config);
|
||||
|
||||
// Enable.
|
||||
if (($enable = optional_param('enable', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($qtypes[$enable])) {
|
||||
print_error('unknownquestiontype', 'question', $thispageurl, $enable);
|
||||
/// Process actions ============================================================
|
||||
|
||||
// Disable.
|
||||
if (($disable = optional_param('disable', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($QTYPES[$disable])) {
|
||||
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $disable);
|
||||
}
|
||||
|
||||
set_config($disable . '_disabled', 1, 'question');
|
||||
redirect(admin_url('qtypes.php'));
|
||||
}
|
||||
|
||||
if (!$qtypes[$enable]->menu_name()) {
|
||||
print_error('cannotenable', 'question', $thispageurl, $enable);
|
||||
// Enable.
|
||||
if (($enable = optional_param('enable', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($QTYPES[$enable])) {
|
||||
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $enable);
|
||||
}
|
||||
|
||||
if (!$QTYPES[$enable]->menu_name()) {
|
||||
print_error('cannotenable', 'question', admin_url('qtypes.php'), $enable);
|
||||
}
|
||||
|
||||
unset_config($enable . '_disabled', 'question');
|
||||
redirect(admin_url('qtypes.php'));
|
||||
}
|
||||
|
||||
unset_config($enable . '_disabled', 'question');
|
||||
redirect($thispageurl);
|
||||
}
|
||||
// Move up in order.
|
||||
if (($up = optional_param('up', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($QTYPES[$up])) {
|
||||
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $up);
|
||||
}
|
||||
|
||||
// Move up in order.
|
||||
if (($up = optional_param('up', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($qtypes[$up])) {
|
||||
print_error('unknownquestiontype', 'question', $thispageurl, $up);
|
||||
$neworder = question_reorder_qtypes($sortedqtypes, $up, -1);
|
||||
question_save_qtype_order($neworder, $config);
|
||||
redirect(admin_url('qtypes.php'));
|
||||
}
|
||||
|
||||
$neworder = question_reorder_qtypes($sortedqtypes, $up, -1);
|
||||
question_save_qtype_order($neworder, $config);
|
||||
redirect($thispageurl);
|
||||
}
|
||||
// Move down in order.
|
||||
if (($down = optional_param('down', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($QTYPES[$down])) {
|
||||
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $down);
|
||||
}
|
||||
|
||||
// Move down in order.
|
||||
if (($down = optional_param('down', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
if (!isset($qtypes[$down])) {
|
||||
print_error('unknownquestiontype', 'question', $thispageurl, $down);
|
||||
$neworder = question_reorder_qtypes($sortedqtypes, $down, +1);
|
||||
question_save_qtype_order($neworder, $config);
|
||||
redirect(admin_url('qtypes.php'));
|
||||
}
|
||||
|
||||
$neworder = question_reorder_qtypes($sortedqtypes, $down, +1);
|
||||
question_save_qtype_order($neworder, $config);
|
||||
redirect($thispageurl);
|
||||
}
|
||||
// Delete.
|
||||
if (($delete = optional_param('delete', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
// Check it is OK to delete this question type.
|
||||
if ($delete == 'missingtype') {
|
||||
print_error('cannotdeletemissingqtype', 'admin', admin_url('qtypes.php'));
|
||||
}
|
||||
|
||||
// Delete.
|
||||
if (($delete = optional_param('delete', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
|
||||
// Check it is OK to delete this question type.
|
||||
if ($delete == 'missingtype') {
|
||||
print_error('cannotdeletemissingqtype', 'question', $thispageurl);
|
||||
}
|
||||
if (!isset($QTYPES[$delete])) {
|
||||
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $delete);
|
||||
}
|
||||
|
||||
if (!isset($qtypes[$delete])) {
|
||||
print_error('unknownquestiontype', 'question', $thispageurl, $delete);
|
||||
}
|
||||
$qtypename = $QTYPES[$delete]->local_name();
|
||||
if ($counts[$delete]->numquestions + $counts[$delete]->numhidden > 0) {
|
||||
print_error('cannotdeleteqtypeinuse', 'admin', admin_url('qtypes.php'), $qtypename);
|
||||
}
|
||||
|
||||
$qtypename = $qtypes[$delete]->local_name();
|
||||
if ($counts[$delete]->numquestions + $counts[$delete]->numhidden > 0) {
|
||||
print_error('cannotdeleteqtypeinuse', 'question', $thispageurl, $qtypename);
|
||||
}
|
||||
if ($needed[$delete] > 0) {
|
||||
print_error('cannotdeleteqtypeneeded', 'admin', admin_url('qtypes.php'), $qtypename);
|
||||
}
|
||||
|
||||
if ($needed[$delete] > 0) {
|
||||
print_error('cannotdeleteqtypeneeded', 'question', $thispageurl, $qtypename);
|
||||
}
|
||||
// If not yet confirmed, display a confirmation message.
|
||||
if (!optional_param('confirm', '', PARAM_BOOL)) {
|
||||
$qtypename = $QTYPES[$delete]->local_name();
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('deleteqtypeareyousure', 'admin', $qtypename));
|
||||
echo $OUTPUT->confirm(get_string('deleteqtypeareyousuremessage', 'admin', $qtypename),
|
||||
admin_url('qtypes.php?delete=' . $delete . '&confirm=1'),
|
||||
admin_url('qtypes.php'));
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
// If not yet confirmed, display a confirmation message.
|
||||
if (!optional_param('confirm', '', PARAM_BOOL)) {
|
||||
$qtypename = $qtypes[$delete]->local_name();
|
||||
// Do the deletion.
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('deleteqtypeareyousure', 'question', $qtypename));
|
||||
echo $OUTPUT->confirm(get_string('deleteqtypeareyousuremessage', 'question', $qtypename),
|
||||
new moodle_url($thispageurl, array('delete' => $delete, 'confirm' => 1)),
|
||||
$thispageurl);
|
||||
echo $OUTPUT->heading(get_string('deletingqtype', 'admin', $qtypename));
|
||||
|
||||
// Delete any configuration records.
|
||||
if (!unset_all_config_for_plugin('qtype_' . $delete)) {
|
||||
echo $OUTPUT->notification(get_string('errordeletingconfig', 'admin', 'qtype_' . $delete));
|
||||
}
|
||||
unset_config($delete . '_disabled', 'question');
|
||||
unset_config($delete . '_sortorder', 'question');
|
||||
|
||||
// Then the tables themselves
|
||||
drop_plugin_tables($delete, $QTYPES[$delete]->plugin_dir() . '/db/install.xml', false);
|
||||
|
||||
// Remove event handlers and dequeue pending events
|
||||
events_uninstall('qtype/' . $delete);
|
||||
|
||||
$a->qtype = $qtypename;
|
||||
$a->directory = $QTYPES[$delete]->plugin_dir();
|
||||
echo $OUTPUT->box(get_string('qtypedeletefiles', 'admin', $a), 'generalbox', 'notice');
|
||||
echo $OUTPUT->continue_button(admin_url('qtypes.php'));
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Do the deletion.
|
||||
// End of process actions ==================================================
|
||||
|
||||
/// Print the page heading.
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('deletingqtype', 'question', $qtypename));
|
||||
echo $OUTPUT->heading(get_string('manageqtypes', 'admin'));
|
||||
|
||||
// Delete any configuration records.
|
||||
if (!unset_all_config_for_plugin('qtype_' . $delete)) {
|
||||
echo $OUTPUT->notification(get_string('errordeletingconfig', 'admin', 'qtype_' . $delete));
|
||||
/// Set up the table.
|
||||
$table = new flexible_table('qtypeadmintable');
|
||||
$table->define_columns(array('questiontype', 'numquestions', 'version', 'requires',
|
||||
'availableto', 'delete', 'settings'));
|
||||
$table->define_headers(array(get_string('questiontype', 'admin'), get_string('numquestions', 'admin'),
|
||||
get_string('version'), get_string('requires', 'admin'), get_string('availableq', 'question'),
|
||||
get_string('delete'), get_string('settings')));
|
||||
$table->set_attribute('id', 'qtypes');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
/// Add a row for each question type.
|
||||
$createabletypes = question_type_menu();
|
||||
foreach ($sortedqtypes as $qtypename => $localname) {
|
||||
$qtype = $QTYPES[$qtypename];
|
||||
$row = array();
|
||||
|
||||
// Question icon and name.
|
||||
$fakequestion = new stdClass;
|
||||
$fakequestion->qtype = $qtypename;
|
||||
$icon = print_question_icon($fakequestion, true);
|
||||
$row[] = $icon . ' ' . $localname;
|
||||
|
||||
// Number of questions of this type.
|
||||
if ($counts[$qtypename]->numquestions + $counts[$qtypename]->numhidden > 0) {
|
||||
if ($counts[$qtypename]->numhidden > 0) {
|
||||
$strcount = get_string('numquestionsandhidden', 'admin', $counts[$qtypename]);
|
||||
} else {
|
||||
$strcount = $counts[$qtypename]->numquestions;
|
||||
}
|
||||
if ($canviewreports) {
|
||||
$row[] = '<a href="' . admin_url('/report/questioninstances/index.php?qtype=' . $qtypename) .
|
||||
'" title="' . get_string('showdetails', 'admin') . '">' . $strcount . '</a>';
|
||||
} else {
|
||||
$strcount;
|
||||
}
|
||||
} else {
|
||||
$row[] = 0;
|
||||
}
|
||||
|
||||
// Question version number.
|
||||
$version = get_config('qtype_' . $qtypename, 'version');
|
||||
if ($version) {
|
||||
$row[] = $version;
|
||||
} else {
|
||||
$row[] = '<span class="disabled">' . get_string('nodatabase', 'admin') . '</span>';
|
||||
}
|
||||
|
||||
// Other question types required by this one.
|
||||
$requiredtypes = $qtype->requires_qtypes();
|
||||
$strtypes = array();
|
||||
if (!empty($requiredtypes)) {
|
||||
foreach ($requiredtypes as $required) {
|
||||
$strtypes[] = $QTYPES[$required]->local_name();
|
||||
}
|
||||
$row[] = implode(', ', $strtypes);
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
|
||||
// Are people allowed to create new questions of this type?
|
||||
$rowclass = '';
|
||||
if ($qtype->menu_name()) {
|
||||
$createable = isset($createabletypes[$qtypename]);
|
||||
$icons = enable_disable_button($qtypename, $createable);
|
||||
if (!$createable) {
|
||||
$rowclass = 'dimmed_text';
|
||||
}
|
||||
} else {
|
||||
$icons = '<img src="' . $OUTPUT->pix_url('spacer') . '" alt="" class="spacer" />';
|
||||
}
|
||||
|
||||
// Move icons.
|
||||
$icons .= icon_html('up', $qtypename, 't/up', get_string('up'), '');
|
||||
$icons .= icon_html('down', $qtypename, 't/down', get_string('down'), '');
|
||||
$row[] = $icons;
|
||||
|
||||
// Delete link, if available.
|
||||
if ($needed[$qtypename]) {
|
||||
$row[] = '';
|
||||
} else {
|
||||
$row[] = '<a href="' . admin_url('qtypes.php?delete=' . $qtypename .
|
||||
'&sesskey=' . sesskey()) . '" title="' .
|
||||
get_string('uninstallqtype', 'admin') . '">' . get_string('delete') . '</a>';
|
||||
}
|
||||
|
||||
// Settings link, if available.
|
||||
$settings = admin_get_root()->locate('qtypesetting' . $qtypename);
|
||||
if ($settings instanceof admin_externalpage) {
|
||||
$row[] = '<a href="' . $settings->url .
|
||||
'">' . get_string('settings') . '</a>';
|
||||
} else if ($settings instanceof admin_settingpage) {
|
||||
$row[] = '<a href="' . admin_url('settings.php?section=qtypesetting' . $qtypename) .
|
||||
'">' . get_string('settings') . '</a>';
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
|
||||
$table->add_data($row, $rowclass);
|
||||
}
|
||||
unset_config($delete . '_disabled', 'question');
|
||||
unset_config($delete . '_sortorder', 'question');
|
||||
|
||||
// Then the tables themselves
|
||||
drop_plugin_tables($delete, $qtypes[$delete]->plugin_dir() . '/db/install.xml', false);
|
||||
$table->finish_output();
|
||||
|
||||
// Remove event handlers and dequeue pending events
|
||||
events_uninstall('qtype_' . $delete);
|
||||
|
||||
$a = new stdClass();
|
||||
$a->qtype = $qtypename;
|
||||
$a->directory = $qtypes[$delete]->plugin_dir();
|
||||
echo $OUTPUT->box(get_string('qtypedeletefiles', 'question', $a), 'generalbox', 'notice');
|
||||
echo $OUTPUT->continue_button($thispageurl);
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
|
||||
function admin_url($endbit) {
|
||||
global $CFG;
|
||||
return $CFG->wwwroot . '/' . $CFG->admin . '/' . $endbit;
|
||||
}
|
||||
|
||||
// End of process actions ==================================================
|
||||
|
||||
// Print the page heading.
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('manageqtypes', 'admin'));
|
||||
|
||||
// Set up the table.
|
||||
$table = new flexible_table('qtypeadmintable');
|
||||
$table->define_baseurl($thispageurl);
|
||||
$table->define_columns(array('questiontype', 'numquestions', 'version', 'requires',
|
||||
'availableto', 'delete', 'settings'));
|
||||
$table->define_headers(array(get_string('questiontype', 'question'), get_string('numquestions', 'question'),
|
||||
get_string('version'), get_string('requires', 'admin'), get_string('availableq', 'question'),
|
||||
get_string('delete'), get_string('settings')));
|
||||
$table->set_attribute('id', 'qtypes');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
// Add a row for each question type.
|
||||
$createabletypes = question_bank::get_creatable_qtypes();
|
||||
foreach ($sortedqtypes as $qtypename => $localname) {
|
||||
$qtype = $qtypes[$qtypename];
|
||||
$row = array();
|
||||
|
||||
// Question icon and name.
|
||||
$fakequestion = new stdClass;
|
||||
$fakequestion->qtype = $qtypename;
|
||||
$icon = print_question_icon($fakequestion, true);
|
||||
$row[] = $icon . ' ' . $localname;
|
||||
|
||||
// Number of questions of this type.
|
||||
if ($counts[$qtypename]->numquestions + $counts[$qtypename]->numhidden > 0) {
|
||||
if ($counts[$qtypename]->numhidden > 0) {
|
||||
$strcount = get_string('numquestionsandhidden', 'question', $counts[$qtypename]);
|
||||
} else {
|
||||
$strcount = $counts[$qtypename]->numquestions;
|
||||
}
|
||||
if ($canviewreports) {
|
||||
$row[] = html_writer::link(new moodle_url('/admin/report/questioninstances/index.php',
|
||||
array('qtype' => $qtypename)), $strcount, array('title' => get_string('showdetails', 'admin')));
|
||||
} else {
|
||||
$strcount;
|
||||
}
|
||||
} else {
|
||||
$row[] = 0;
|
||||
}
|
||||
|
||||
// Question version number.
|
||||
$version = get_config('qtype_' . $qtypename, 'version');
|
||||
if ($version) {
|
||||
$row[] = $version;
|
||||
} else {
|
||||
$row[] = html_writer::tag('span', get_string('nodatabase', 'admin'), array('class' => 'disabled'));
|
||||
}
|
||||
|
||||
// Other question types required by this one.
|
||||
$requiredtypes = $qtype->requires_qtypes();
|
||||
$strtypes = array();
|
||||
if (!empty($requiredtypes)) {
|
||||
foreach ($requiredtypes as $required) {
|
||||
$strtypes[] = $qtypes[$required]->local_name();
|
||||
}
|
||||
$row[] = implode(', ', $strtypes);
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
|
||||
// Are people allowed to create new questions of this type?
|
||||
$rowclass = '';
|
||||
if ($qtype->menu_name()) {
|
||||
$createable = isset($createabletypes[$qtypename]);
|
||||
$icons = question_types_enable_disable_icons($qtypename, $createable);
|
||||
if (!$createable) {
|
||||
$rowclass = 'dimmed_text';
|
||||
}
|
||||
} else {
|
||||
$icons = $OUTPUT->spacer() . ' ';
|
||||
}
|
||||
|
||||
// Move icons.
|
||||
$icons .= question_type_icon_html('up', $qtypename, 't/up', get_string('up'), '');
|
||||
$icons .= question_type_icon_html('down', $qtypename, 't/down', get_string('down'), '');
|
||||
$row[] = $icons;
|
||||
|
||||
// Delete link, if available.
|
||||
if ($needed[$qtypename]) {
|
||||
$row[] = '';
|
||||
} else {
|
||||
$row[] = html_writer::link(new moodle_url($thispageurl,
|
||||
array('delete' => $qtypename, 'sesskey' => sesskey())), get_string('delete'),
|
||||
array('title' => get_string('uninstallqtype', 'question')));
|
||||
}
|
||||
|
||||
// Settings link, if available.
|
||||
$settings = admin_get_root()->locate('qtypesetting' . $qtypename);
|
||||
if ($settings instanceof admin_externalpage) {
|
||||
$row[] = html_writer::link($settings->url, get_string('settings'));
|
||||
} else if ($settings instanceof admin_settingpage) {
|
||||
$row[] = html_writer::link(new moodle_url('/admin/settings.php',
|
||||
array('section' => 'qtypesetting' . $qtypename)), get_string('settings'));
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
|
||||
$table->add_data($row, $rowclass);
|
||||
}
|
||||
|
||||
$table->finish_output();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
function question_types_enable_disable_icons($qtypename, $createable) {
|
||||
function enable_disable_button($qtypename, $createable) {
|
||||
if ($createable) {
|
||||
return question_type_icon_html('disable', $qtypename, 'i/hide',
|
||||
get_string('enabled', 'question'), get_string('disable'));
|
||||
return icon_html('disable', $qtypename, 'i/hide', get_string('enabled', 'question'), get_string('disable'));
|
||||
} else {
|
||||
return question_type_icon_html('enable', $qtypename, 'i/show',
|
||||
get_string('disabled', 'question'), get_string('enable'));
|
||||
return icon_html('enable', $qtypename, 'i/show', get_string('disabled', 'question'), get_string('enable'));
|
||||
}
|
||||
}
|
||||
|
||||
function question_type_icon_html($action, $qtypename, $icon, $alt, $tip) {
|
||||
function icon_html($action, $qtypename, $icon, $alt, $tip) {
|
||||
global $OUTPUT;
|
||||
return $OUTPUT->action_icon(new moodle_url('/admin/qtypes.php',
|
||||
array($action => $qtypename, 'sesskey' => sesskey())),
|
||||
new pix_icon($icon, $alt, 'moodle', array('title' => '')),
|
||||
null, array('title' => $tip)) . ' ';
|
||||
if ($tip) {
|
||||
$tip = 'title="' . $tip . '" ';
|
||||
}
|
||||
$html = ' <form action="' . admin_url('qtypes.php') . '" method="post"><div>';
|
||||
$html .= '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
$html .= '<input type="image" name="' . $action . '" value="' . $qtypename .
|
||||
'" src="' . $OUTPUT->pix_url($icon) . '" alt="' . $alt . '" ' . $tip . '/>';
|
||||
$html .= '</div></form>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ class site_registration_form extends moodleform {
|
||||
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
|
||||
$sitename = get_config('hub', 'site_name_' . $cleanhuburl);
|
||||
if ($sitename === false) {
|
||||
$sitename = format_string($site->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
|
||||
$sitename = $site->fullname;
|
||||
}
|
||||
$sitedescription = get_config('hub', 'site_description_' . $cleanhuburl);
|
||||
if ($sitedescription === false) {
|
||||
|
||||
@@ -1,296 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Renderer for core_admin subsystem
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @copyright 2011 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/pluginlib.php');
|
||||
|
||||
/**
|
||||
* Standard HTML output renderer for core_admin subsystem
|
||||
*/
|
||||
class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Displays all known plugins and information about their installation or upgrade
|
||||
*
|
||||
* This default implementation renders all plugins into one big table. The rendering
|
||||
* options support:
|
||||
* (bool)full = false: whether to display up-to-date plugins, too
|
||||
*
|
||||
* @param array $plugininfo as returned by {@see plugin_manager::get_plugins()}
|
||||
* @param array $options rendering options
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function plugins_check(array $plugininfo, array $options = null) {
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (empty($options)) {
|
||||
$options = array(
|
||||
'full' => false,
|
||||
);
|
||||
}
|
||||
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
$table = new html_table();
|
||||
$table->id = 'plugins-check';
|
||||
$table->head = array(
|
||||
get_string('displayname', 'core_plugin'),
|
||||
get_string('rootdir', 'core_plugin'),
|
||||
get_string('source', 'core_plugin'),
|
||||
get_string('versiondb', 'core_plugin'),
|
||||
get_string('versiondisk', 'core_plugin'),
|
||||
get_string('status', 'core_plugin'),
|
||||
);
|
||||
$table->colclasses = array(
|
||||
'displayname', 'rootdir', 'source', 'versiondb', 'versiondisk', 'status',
|
||||
);
|
||||
$table->data = array();
|
||||
|
||||
$numofhighlighted = array(); // number of highlighted rows per this subsection
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
|
||||
$header = new html_table_cell($pluginman->plugintype_name_plural($type));
|
||||
$header->header = true;
|
||||
$header->colspan = count($table->head);
|
||||
$header = new html_table_row(array($header));
|
||||
$header->attributes['class'] = 'plugintypeheader type-' . $type;
|
||||
|
||||
$numofhighlighted[$type] = 0;
|
||||
|
||||
if (empty($plugins) and $options['full']) {
|
||||
$msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
|
||||
$msg->colspan = count($table->head);
|
||||
$row = new html_table_row(array($msg));
|
||||
$row->attributes['class'] .= 'msg msg-noneinstalled';
|
||||
$table->data[] = $header;
|
||||
$table->data[] = $row;
|
||||
continue;
|
||||
}
|
||||
|
||||
$plugintyperows = array();
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
$row = new html_table_row();
|
||||
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
|
||||
|
||||
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
|
||||
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'smallicon pluginicon'));
|
||||
} else {
|
||||
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'smallicon pluginicon noicon'));
|
||||
}
|
||||
$displayname = $icon . ' ' . $plugin->displayname;
|
||||
$displayname = new html_table_cell($displayname);
|
||||
|
||||
$rootdir = new html_table_cell($plugin->get_dir());
|
||||
|
||||
if ($isstandard = $plugin->is_standard()) {
|
||||
$row->attributes['class'] .= ' standard';
|
||||
$source = new html_table_cell(get_string('sourcestd', 'core_plugin'));
|
||||
} else {
|
||||
$row->attributes['class'] .= ' extension';
|
||||
$source = new html_table_cell(get_string('sourceext', 'core_plugin'));
|
||||
}
|
||||
|
||||
$versiondb = new html_table_cell($plugin->versiondb);
|
||||
$versiondisk = new html_table_cell($plugin->versiondisk);
|
||||
|
||||
$statuscode = $plugin->get_status();
|
||||
$row->attributes['class'] .= ' status-' . $statuscode;
|
||||
|
||||
$status = new html_table_cell(get_string('status_' . $statuscode, 'core_plugin'));
|
||||
|
||||
if ($isstandard and in_array($statuscode, array(plugin_manager::PLUGIN_STATUS_NODB, plugin_manager::PLUGIN_STATUS_UPTODATE))) {
|
||||
if (empty($options['full'])) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$numofhighlighted[$type]++;
|
||||
}
|
||||
|
||||
$row->cells = array($displayname, $rootdir, $source, $versiondb, $versiondisk, $status);
|
||||
$plugintyperows[] = $row;
|
||||
}
|
||||
|
||||
if (empty($numofhighlighted[$type]) and empty($options['full'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$table->data[] = $header;
|
||||
$table->data = array_merge($table->data, $plugintyperows);
|
||||
}
|
||||
|
||||
$sumofhighlighted = array_sum($numofhighlighted);
|
||||
|
||||
if ($sumofhighlighted == 0) {
|
||||
$out = $this->output->container_start('nonehighlighted', 'plugins-check-info');
|
||||
$out .= $this->output->heading(get_string('nonehighlighted', 'core_plugin'));
|
||||
if (empty($options['full'])) {
|
||||
$out .= html_writer::link(new moodle_url('/admin/index.php',
|
||||
array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1)),
|
||||
get_string('nonehighlightedinfo', 'core_plugin'));
|
||||
}
|
||||
$out .= $this->output->container_end();
|
||||
|
||||
} else {
|
||||
$out = $this->output->container_start('somehighlighted', 'plugins-check-info');
|
||||
$out .= $this->output->heading(get_string('somehighlighted', 'core_plugin', $sumofhighlighted));
|
||||
if (empty($options['full'])) {
|
||||
$out .= html_writer::link(new moodle_url('/admin/index.php',
|
||||
array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1)),
|
||||
get_string('somehighlightedinfo', 'core_plugin'));
|
||||
}
|
||||
$out .= $this->output->container_end();
|
||||
}
|
||||
|
||||
if ($sumofhighlighted > 0 or $options['full']) {
|
||||
$out .= html_writer::table($table);
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all known plugins and links to manage them
|
||||
*
|
||||
* This default implementation renders all plugins into one big table.
|
||||
*
|
||||
* @param array $plugininfo as returned by {@see plugin_manager::get_plugins()}
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function plugins_control_panel(array $plugininfo) {
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
$table = new html_table();
|
||||
$table->id = 'plugins-control-panel';
|
||||
$table->head = array(
|
||||
get_string('displayname', 'core_plugin'),
|
||||
get_string('systemname', 'core_plugin'),
|
||||
get_string('source', 'core_plugin'),
|
||||
get_string('version', 'core_plugin'),
|
||||
get_string('availability', 'core_plugin'),
|
||||
get_string('settings', 'core_plugin'),
|
||||
get_string('uninstall','core_plugin'),
|
||||
);
|
||||
$table->colclasses = array(
|
||||
'displayname', 'systemname', 'source', 'version', 'availability', 'settings', 'uninstall',
|
||||
);
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
|
||||
$header = new html_table_cell($pluginman->plugintype_name_plural($type));
|
||||
$header->header = true;
|
||||
$header->colspan = count($table->head);
|
||||
$header = new html_table_row(array($header));
|
||||
$header->attributes['class'] = 'plugintypeheader type-' . $type;
|
||||
$table->data[] = $header;
|
||||
|
||||
if (empty($plugins)) {
|
||||
$msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
|
||||
$msg->colspan = count($table->head);
|
||||
$row = new html_table_row(array($msg));
|
||||
$row->attributes['class'] .= 'msg msg-noneinstalled';
|
||||
$table->data[] = $row;
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
$row = new html_table_row();
|
||||
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
|
||||
|
||||
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
|
||||
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'smallicon pluginicon'));
|
||||
} else {
|
||||
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'smallicon pluginicon noicon'));
|
||||
}
|
||||
if ($plugin->get_status() === plugin_manager::PLUGIN_STATUS_MISSING) {
|
||||
$msg = html_writer::tag('span', get_string('status_missing', 'core_plugin'), array('class' => 'notifyproblem'));
|
||||
$row->attributes['class'] .= ' missingfromdisk';
|
||||
} else {
|
||||
$msg = '';
|
||||
}
|
||||
$displayname = $icon . ' ' . $plugin->displayname . ' ' . $msg;
|
||||
$displayname = new html_table_cell($displayname);
|
||||
|
||||
$systemname = new html_table_cell($plugin->type . '_' . $plugin->name);
|
||||
|
||||
if ($plugin->is_standard()) {
|
||||
$row->attributes['class'] .= ' standard';
|
||||
$source = new html_table_cell(get_string('sourcestd', 'core_plugin'));
|
||||
} else {
|
||||
$row->attributes['class'] .= ' extension';
|
||||
$source = new html_table_cell(get_string('sourceext', 'core_plugin'));
|
||||
}
|
||||
|
||||
$version = new html_table_cell($plugin->versiondb);
|
||||
|
||||
$isenabled = $plugin->is_enabled();
|
||||
if (is_null($isenabled)) {
|
||||
$availability = new html_table_cell('');
|
||||
} else if ($isenabled) {
|
||||
$row->attributes['class'] .= ' enabled';
|
||||
$icon = $this->output->pix_icon('i/hide', get_string('pluginenabled', 'core_plugin'));
|
||||
$availability = new html_table_cell($icon . ' ' . get_string('pluginenabled', 'core_plugin'));
|
||||
} else {
|
||||
$row->attributes['class'] .= ' disabled';
|
||||
$icon = $this->output->pix_icon('i/show', get_string('plugindisabled', 'core_plugin'));
|
||||
$availability = new html_table_cell($icon . ' ' . get_string('plugindisabled', 'core_plugin'));
|
||||
}
|
||||
|
||||
$settingsurl = $plugin->get_settings_url();
|
||||
if (is_null($settingsurl)) {
|
||||
$settings = new html_table_cell('');
|
||||
} else {
|
||||
$settings = html_writer::link($settingsurl, get_string('settings', 'core_plugin'));
|
||||
$settings = new html_table_cell($settings);
|
||||
}
|
||||
|
||||
$uninstallurl = $plugin->get_uninstall_url();
|
||||
if (is_null($uninstallurl)) {
|
||||
$uninstall = new html_table_cell('');
|
||||
} else {
|
||||
$uninstall = html_writer::link($uninstallurl, get_string('uninstall', 'core_plugin'));
|
||||
$uninstall = new html_table_cell($uninstall);
|
||||
}
|
||||
|
||||
$row->cells = array(
|
||||
$displayname, $systemname, $source, $version, $availability, $settings, $uninstall
|
||||
);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return html_writer::table($table);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
|
||||
admin_externalpage_setup('reportbackups', '', null, '', array('pagelayout'=>'report'));
|
||||
admin_externalpage_setup('reportbackups');
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/// Automated backups aren't active by the site admin
|
||||
|
||||
@@ -9,7 +9,7 @@ $perpage = optional_param('perpage', 30, PARAM_INT); // how many per page
|
||||
$sort = optional_param('sort', 'timemodified', PARAM_ALPHA);
|
||||
$dir = optional_param('dir', 'DESC', PARAM_ALPHA);
|
||||
|
||||
admin_externalpage_setup('reportconfiglog', '', null, '', array('pagelayout'=>'report'));
|
||||
admin_externalpage_setup('reportconfiglog');
|
||||
echo $OUTPUT->header();
|
||||
|
||||
echo $OUTPUT->heading(get_string('configlog', 'report_configlog'));
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
admin_externalpage_setup('reportcourseoverview', '', null, '', array('pagelayout'=>'report'));
|
||||
admin_externalpage_setup('reportcourseoverview');
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$course = get_site();
|
||||
|
||||
@@ -26,36 +26,36 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$string['checkin'] = 'Save strings to language pack';
|
||||
$string['checkout'] = 'Open language pack for editing';
|
||||
$string['checkoutdone'] = 'Language pack loaded';
|
||||
$string['checkoutinprogress'] = 'Loading language pack';
|
||||
$string['confirmcheckin'] = 'You are about to save modifications to your local language pack. This will export the customised strings from the translator into you Moodle data directory and Moodle will start using the modified strings. Press \'Continue\' to proceed with saving.';
|
||||
$string['checkin'] = 'Check in strings into disk';
|
||||
$string['checkout'] = 'Check out strings into the translator';
|
||||
$string['checkoutdone'] = 'Strings checked out successfully into the translator';
|
||||
$string['checkoutinprogress'] = 'Checking out strings into the translator';
|
||||
$string['confirmcheckin'] = 'You are about to check in modified strings into your local language pack. This will export the customized strings from the translator into the data directory and Moodle will start using the modified strings. Press \'Continue\' button to proceed check in.';
|
||||
$string['customlang:edit'] = 'Edit local translation';
|
||||
$string['customlang:view'] = 'View local translation';
|
||||
$string['filter'] = 'Filter strings';
|
||||
$string['filtercomponent'] = 'Show strings of these components';
|
||||
$string['filtercustomized'] = 'Customised only';
|
||||
$string['filtercustomized'] = 'Customized only';
|
||||
$string['filtermodified'] = 'Modified only';
|
||||
$string['filteronlyhelps'] = 'Help only';
|
||||
$string['filtershowstrings'] = 'Show strings';
|
||||
$string['filterstringid'] = 'String identifier';
|
||||
$string['filtersubstring'] = 'Only strings containing';
|
||||
$string['headingcomponent'] = 'Component';
|
||||
$string['headinglocal'] = 'Local customisation';
|
||||
$string['headinglocal'] = 'Local customization';
|
||||
$string['headingstandard'] = 'Standard text';
|
||||
$string['headingstringid'] = 'String';
|
||||
$string['markinguptodate'] = 'Marking the customisation as up-to-date';
|
||||
$string['markinguptodate_help'] = 'The customised translation may get outdated if either the English original or the master translation has modified since the string was customised on your site. Review the customised translation. If you find it up-to-date, click the checkbox. Edit it otherwise.';
|
||||
$string['markinguptodate'] = 'Marking the customization as up-to-date';
|
||||
$string['markinguptodate_help'] = 'The customized translation may get outdated if either the English original or the master translation has modified since the string was customized on your site. Review the customized translation. If you find it up-to-date, click the checkbox. Edit it otherwise.';
|
||||
$string['markuptodate'] = 'mark as up-to-date';
|
||||
$string['modifiedno'] = 'There are no modified strings to save.';
|
||||
$string['modifiednum'] = 'There are {$a} modified strings. Do you wish to save these changes to your local language pack?';
|
||||
$string['modifiedno'] = 'There are no modified strings to check in.';
|
||||
$string['modifiednum'] = 'There are {$a} modified strings. You must check in them into disk to store them permanently.';
|
||||
$string['nostringsfound'] = 'No strings found, please modify the filter settings';
|
||||
$string['placeholder'] = 'Placeholders';
|
||||
$string['placeholder_help'] = 'Placeholders are special statements like `{$a}` or `{$a->something}` within the string. They are replaced with a value when the string is actually printed.
|
||||
|
||||
It is important to copy them exactly as they are in the original string. Do not translate them nor change their left-to-right orientation.';
|
||||
$string['placeholderwarning'] = 'string contains a placeholder';
|
||||
$string['pluginname'] = 'Language customisation';
|
||||
$string['savecheckin'] = 'Save changes to the language pack';
|
||||
$string['savecontinue'] = 'Apply changes and continue editing';
|
||||
$string['pluginname'] = 'Language customization';
|
||||
$string['savecheckin'] = 'Save and check in strings into files';
|
||||
$string['savecontinue'] = 'Save and continue editing';
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
// profiling report, added to development
|
||||
if (extension_loaded('xhprof') && function_exists('xhprof_enable') && (!empty($CFG->profilingenabled) || !empty($CFG->earlyprofilingenabled))) {
|
||||
if (extension_loaded('xhprof') && function_exists('xhprof_enable') && !empty($CFG->profilingenabled)) {
|
||||
$ADMIN->add('development', new admin_externalpage('reportprofiling', get_string('pluginname', 'report_profiling'), "$CFG->wwwroot/$CFG->admin/report/profiling/index.php", 'moodle/site:config'));
|
||||
}
|
||||
|
||||
@@ -15,16 +15,15 @@ require_once($CFG->libdir.'/questionlib.php');
|
||||
$requestedqtype = optional_param('qtype', '', PARAM_SAFEDIR);
|
||||
|
||||
// Print the header & check permissions.
|
||||
admin_externalpage_setup('reportquestioninstances', '', null, '', array('pagelayout'=>'report'));
|
||||
admin_externalpage_setup('reportquestioninstances');
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Log.
|
||||
add_to_log(SITEID, "admin", "report questioninstances", "report/questioninstances/index.php?qtype=$requestedqtype", $requestedqtype);
|
||||
|
||||
// Prepare the list of capabilities to choose from
|
||||
$qtypes = question_bank::get_all_qtypes();
|
||||
$qtypechoices = array();
|
||||
foreach ($qtypes as $qtype) {
|
||||
foreach ($QTYPES as $qtype) {
|
||||
$qtypechoices[$qtype->name()] = $qtype->local_name();
|
||||
}
|
||||
|
||||
@@ -46,7 +45,7 @@ if ($requestedqtype) {
|
||||
|
||||
// Work out the bits needed for the SQL WHERE clauses.
|
||||
if ($requestedqtype == 'missingtype') {
|
||||
$othertypes = array_keys($qtypes);
|
||||
$othertypes = array_keys($QTYPES);
|
||||
$key = array_search('missingtype', $othertypes);
|
||||
unset($othertypes[$key]);
|
||||
list($sqlqtypetest, $params) = $DB->get_in_or_equal($othertypes, SQL_PARAMS_QM, '', false);
|
||||
@@ -59,8 +58,7 @@ if ($requestedqtype) {
|
||||
} else {
|
||||
$sqlqtypetest = 'WHERE qtype = ?';
|
||||
$params = array($requestedqtype);
|
||||
$title = get_string('reportforqtype', 'report_questioninstances',
|
||||
question_bank::get_qtype($requestedqtype)->local_name());
|
||||
$title = get_string('reportforqtype', 'report_questioninstances', $QTYPES[$requestedqtype]->local_name());
|
||||
}
|
||||
|
||||
// Get the question counts, and all the context information, for each
|
||||
|
||||
@@ -45,7 +45,7 @@ raise_memory_limit(MEMORY_EXTRA);
|
||||
@set_time_limit(0);
|
||||
|
||||
// Print the header.
|
||||
admin_externalpage_setup('reportsecurity', '', null, '', array('pagelayout'=>'report'));
|
||||
admin_externalpage_setup('reportsecurity');
|
||||
echo $OUTPUT->header();
|
||||
|
||||
echo $OUTPUT->heading(get_string('pluginname', 'report_security'));
|
||||
|
||||
@@ -40,7 +40,7 @@ $reset = optional_param('reset', '', PARAM_RAW);
|
||||
$id = optional_param('id', '', PARAM_INT);
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('reportspamcleaner', '', null, '', array('pagelayout'=>'report'));
|
||||
admin_externalpage_setup('reportspamcleaner');
|
||||
|
||||
// Delete one user
|
||||
if (!empty($del) && confirm_sesskey() && ($id != $USER->id)) {
|
||||
@@ -157,54 +157,21 @@ function search_spammers($keywords) {
|
||||
$params['descpat'.$i] = "%$keyword%";
|
||||
$keywordfull2[] = $DB->sql_like('p.summary', ':sumpat'.$i, false);
|
||||
$params['sumpat'.$i] = "%$keyword%";
|
||||
$keywordfull3[] = $DB->sql_like('p.subject', ':subpat'.$i, false);
|
||||
$params['subpat'.$i] = "%$keyword%";
|
||||
$keywordfull4[] = $DB->sql_like('c.content', ':contpat'.$i, false);
|
||||
$params['contpat'.$i] = "%$keyword%";
|
||||
$keywordfull5[] = $DB->sql_like('m.fullmessage', ':msgpat'.$i, false);
|
||||
$params['msgpat'.$i] = "%$keyword%";
|
||||
$keywordfull6[] = $DB->sql_like('fp.message', ':forumpostpat'.$i, false);
|
||||
$params['forumpostpat'.$i] = "%$keyword%";
|
||||
$keywordfull7[] = $DB->sql_like('fp.subject', ':forumpostsubpat'.$i, false);
|
||||
$params['forumpostsubpat'.$i] = "%$keyword%";
|
||||
$i++;
|
||||
}
|
||||
$conditions = '( '.implode(' OR ', $keywordfull).' )';
|
||||
$conditions2 = '( '.implode(' OR ', $keywordfull2).' )';
|
||||
$conditions3 = '( '.implode(' OR ', $keywordfull3).' )';
|
||||
$conditions4 = '( '.implode(' OR ', $keywordfull4).' )';
|
||||
$conditions5 = '( '.implode(' OR ', $keywordfull5).' )';
|
||||
$conditions6 = '( '.implode(' OR ', $keywordfull6).' )';
|
||||
$conditions7 = '( '.implode(' OR ', $keywordfull7).' )';
|
||||
|
||||
$sql = "SELECT * FROM {user} WHERE deleted = 0 AND id <> :userid AND $conditions"; // Exclude oneself
|
||||
$sql2 = "SELECT u.*, p.summary FROM {user} AS u, {post} AS p WHERE $conditions2 AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
|
||||
$sql3 = "SELECT u.*, p.subject as postsubject FROM {user} AS u, {post} AS p WHERE $conditions3 AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
|
||||
$sql4 = "SELECT u.*, c.content FROM {user} AS u, {comments} AS c WHERE $conditions4 AND u.deleted = 0 AND u.id=c.userid AND u.id <> :userid";
|
||||
$sql5 = "SELECT u.*, m.fullmessage FROM {user} AS u, {message} AS m WHERE $conditions5 AND u.deleted = 0 AND u.id=m.useridfrom AND u.id <> :userid";
|
||||
$sql6 = "SELECT u.*, fp.message FROM {user} AS u, {forum_posts} AS fp WHERE $conditions6 AND u.deleted = 0 AND u.id=fp.userid AND u.id <> :userid";
|
||||
$sql7 = "SELECT u.*, fp.subject FROM {user} AS u, {forum_posts} AS fp WHERE $conditions7 AND u.deleted = 0 AND u.id=fp.userid AND u.id <> :userid";
|
||||
|
||||
$spamusers_desc = $DB->get_recordset_sql($sql, $params);
|
||||
$spamusers_blog = $DB->get_recordset_sql($sql2, $params);
|
||||
$spamusers_blogsub = $DB->get_recordset_sql($sql3, $params);
|
||||
$spamusers_comment = $DB->get_recordset_sql($sql4, $params);
|
||||
$spamusers_message = $DB->get_recordset_sql($sql5, $params);
|
||||
$spamusers_forumpost = $DB->get_recordset_sql($sql6, $params);
|
||||
$spamusers_forumpostsub = $DB->get_recordset_sql($sql7, $params);
|
||||
|
||||
$keywordlist = implode(', ', $keywords);
|
||||
echo $OUTPUT->box(get_string('spamresult', 'report_spamcleaner').s($keywordlist)).' ...';
|
||||
|
||||
print_user_list(array($spamusers_desc,
|
||||
$spamusers_blog,
|
||||
$spamusers_blogsub,
|
||||
$spamusers_comment,
|
||||
$spamusers_message,
|
||||
$spamusers_forumpost,
|
||||
$spamusers_forumpostsub
|
||||
),
|
||||
$keywords);
|
||||
print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -245,23 +212,7 @@ function filter_user($user, $keywords, $count) {
|
||||
if (isset($user->summary)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'report_spamcleaner').'</h3>'.$user->summary;
|
||||
unset($user->summary);
|
||||
} else if (isset($user->postsubject)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'report_spamcleaner').'</h3>'.$user->postsubject;
|
||||
unset($user->postsubject);
|
||||
} else if (isset($user->content)) {
|
||||
$user->description = '<h3>'.get_string('spamfromcomments', 'report_spamcleaner').'</h3>'.$user->content;
|
||||
unset($user->content);
|
||||
} else if (isset($user->fullmessage)) {
|
||||
$user->description = '<h3>'.get_string('spamfrommessages', 'report_spamcleaner').'</h3>'.$user->fullmessage;
|
||||
unset($user->fullmessage);
|
||||
} else if (isset($user->message)) {
|
||||
$user->description = '<h3>'.get_string('spamfromforumpost', 'report_spamcleaner').'</h3>'.$user->message;
|
||||
unset($user->message);
|
||||
} else if (isset($user->subject)) {
|
||||
$user->description = '<h3>'.get_string('spamfromforumpost', 'report_spamcleaner').'</h3>'.$user->subject;
|
||||
unset($user->subject);
|
||||
}
|
||||
|
||||
if (preg_match('#<img.*src=[\"\']('.$CFG->wwwroot.')#', $user->description, $matches)
|
||||
&& $image_search) {
|
||||
$result = false;
|
||||
|
||||
@@ -34,9 +34,6 @@ $string['spamdeleteconfirm'] = 'Are you sure you want to delete this entry? You
|
||||
$string['spamdesc'] = 'Description';
|
||||
$string['spameg'] = 'eg: casino, porn, xxx';
|
||||
$string['spamfromblog'] = 'From blog post:';
|
||||
$string['spamfromcomments'] = 'From comments:';
|
||||
$string['spamfrommessages'] = 'From messages:';
|
||||
$string['spamfromforumpost'] = 'From forum post:';
|
||||
$string['spaminvalidresult'] = 'Unknown but invalid result';
|
||||
$string['spamoperation'] = 'Operation';
|
||||
$string['spamresult'] = 'Results of searching user profiles containing:';
|
||||
|
||||
@@ -273,9 +273,4 @@ class ExHtmlReporter extends HtmlReporter {
|
||||
function get_string($identifier, $a = NULL) {
|
||||
return get_string($identifier, 'simpletest', $a);
|
||||
}
|
||||
|
||||
function _htmlEntities($message) {
|
||||
// Override subclass message that breaks UTF8.
|
||||
return s($message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,10 +50,8 @@ if ($course) {
|
||||
|
||||
// security first
|
||||
require_login($course, false, $cm);
|
||||
$safeoverridesonly = false;
|
||||
if (!has_capability('moodle/role:override', $context)) {
|
||||
require_capability('moodle/role:safeoverride', $context);
|
||||
$safeoverridesonly = true;
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_context($context);
|
||||
@@ -121,7 +119,7 @@ if (empty($overridableroles[$roleid])) {
|
||||
}
|
||||
|
||||
// If we are actually overriding a role, create the table object, and save changes if appropriate.
|
||||
$overridestable = new override_permissions_table_advanced($context, $roleid, $safeoverridesonly);
|
||||
$overridestable = new override_permissions_table_advanced($context, $roleid, false);
|
||||
$overridestable->read_submitted_permissions();
|
||||
|
||||
if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
|
||||
|
||||
@@ -54,17 +54,6 @@ if (!$canview) {
|
||||
print_error('nopermissions', 'error', '', get_string('checkpermissions', 'role'));
|
||||
}
|
||||
|
||||
if ($userid != $USER->id) {
|
||||
// If its not the current user we need to extend the navigation for that user to ensure
|
||||
// their navigation is loaded and this page found upon it.
|
||||
$PAGE->navigation->extend_for_user($user);
|
||||
}
|
||||
if ($course->id != $SITE->id || $userid != $USER->id) {
|
||||
// If we're within a course OR if we're viewing another user then we need to include the
|
||||
// settings base on the navigation to ensure that the navbar will contain the users name.
|
||||
$PAGE->navbar->includesettingsbase = true;
|
||||
}
|
||||
|
||||
/// Now get the role assignments for this user.
|
||||
$sql = "SELECT
|
||||
ra.id, ra.userid, ra.contextid, ra.roleid, ra.component, ra.itemid,
|
||||
@@ -130,9 +119,14 @@ $title = get_string('xroleassignments', 'role', $fullname);
|
||||
$PAGE->set_title($title);
|
||||
if ($courseid != SITEID) {
|
||||
$PAGE->set_heading($fullname);
|
||||
if (has_capability('moodle/course:viewparticipants', $coursecontext)) {
|
||||
$PAGE->navbar->add(get_string('participants'),new moodle_url('/user/index.php', array('id'=>$courseid)));
|
||||
}
|
||||
} else {
|
||||
$PAGE->set_heading($course->fullname);
|
||||
}
|
||||
$PAGE->navbar->add($fullname, new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
|
||||
$PAGE->navbar->add($straction);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($title, 3);
|
||||
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal');
|
||||
|
||||
+1
-1
@@ -98,13 +98,13 @@ if (empty($SITE->fullname)) {
|
||||
$url->param('adminedit', 'on');
|
||||
}
|
||||
$buttons = $OUTPUT->single_button($url, $caption, 'get');
|
||||
$PAGE->set_button($buttons);
|
||||
}
|
||||
|
||||
$visiblepathtosection = array_reverse($settingspage->visiblepath);
|
||||
|
||||
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
$PAGE->set_button($buttons);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($errormsg !== '') {
|
||||
|
||||
@@ -18,8 +18,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('allowblockstodock', get_string('allowblockstodock', 'admin'), get_string('configallowblockstodock', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtextarea('custommenuitems', get_string('custommenuitems', 'admin'), get_string('configcustommenuitems', 'admin'), '', PARAM_TEXT, '50', '10'));
|
||||
$temp->add(new admin_setting_configcheckbox('enabledevicedetection', get_string('enabledevicedetection', 'admin'), get_string('configenabledevicedetection', 'admin'), 1));
|
||||
$temp->add(new admin_setting_devicedetectregex('devicedetectregex', get_string('devicedetectregex', 'admin'), get_string('devicedetectregex_desc', 'admin'), ''));
|
||||
$ADMIN->add('themes', $temp);
|
||||
$ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
|
||||
|
||||
@@ -56,16 +54,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
6 => get_string('saturday', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_special_calendar_weekend());
|
||||
$options = array();
|
||||
for ($i=1; $i<=99; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('calendar_lookahead',get_string('configlookahead','admin'),get_string('helpupcominglookahead', 'admin'),21,$options));
|
||||
$options = array();
|
||||
for ($i=1; $i<=20; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('calendar_maxevents',get_string('configmaxevents','admin'),get_string('helpupcomingmaxevents', 'admin'),10,$options));
|
||||
$temp->add(new admin_setting_configtext('calendar_lookahead',get_string('configlookahead','admin'),get_string('helpupcominglookahead', 'admin'),21,PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('calendar_maxevents',get_string('configmaxevents','admin'),get_string('helpupcomingmaxevents', 'admin'),10,PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('enablecalendarexport', get_string('enablecalendarexport', 'admin'), get_string('configenablecalendarexport','admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('calendar_exportsalt', get_string('calendarexportsalt','admin'), get_string('configcalendarexportsalt', 'admin'), random_string(60)));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
+13
-35
@@ -21,11 +21,10 @@ if ($hassiteconfig
|
||||
$formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat");
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/format', get_string('format'), get_string('coursehelpformat'), 'weeks',$formcourseformats));
|
||||
|
||||
$temp->add(new admin_setting_configtext('moodlecourse/maxsections', get_string('maxnumberweeks'), get_string('maxnumberweeks_desc'), 52));
|
||||
|
||||
$temp->add(new admin_settings_num_course_sections('moodlecourse/numsections', get_string('numberweeks'), get_string('coursehelpnumberweeks'), 10));
|
||||
|
||||
for ($i=1; $i<=52; $i++) {
|
||||
$sectionmenu[$i] = "$i";
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/numsections', get_string('numberweeks'), get_string('coursehelpnumberweeks'), 10,$sectionmenu));
|
||||
$choices = array();
|
||||
$choices['0'] = get_string('hiddensectionscollapsed');
|
||||
$choices['1'] = get_string('hiddensectionsinvisible');
|
||||
@@ -34,14 +33,15 @@ if ($hassiteconfig
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/newsitems', get_string('newsitemsnumber'), get_string('coursehelpnewsitemsnumber'), 5,$options));
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/showgrades', get_string('showgrades'), get_string('coursehelpshowgrades'), 1,array(0 => get_string('no'), 1 => get_string('yes'))));
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/showreports', get_string('showreports'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
|
||||
|
||||
if (isset($CFG->maxbytes)) {
|
||||
$choices = get_max_upload_sizes($CFG->maxbytes);
|
||||
} else {
|
||||
$choices = get_max_upload_sizes();
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/maxbytes', get_string('maximumupload'), get_string('coursehelpmaximumupload'), key($choices), $choices));
|
||||
|
||||
|
||||
if (!empty($CFG->legacyfilesinnewcourses)) {
|
||||
$choices = array('0'=>get_string('no'), '2'=>get_string('yes'));
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', get_string('courselegacyfiles'), get_string('courselegacyfiles_help'), key($choices), $choices));
|
||||
@@ -92,32 +92,12 @@ if ($hassiteconfig
|
||||
// Add a category for backups
|
||||
$ADMIN->add('courses', new admin_category('backups', get_string('backups','admin')));
|
||||
|
||||
// Create a page for general backups configuration and defaults.
|
||||
// Create a page for general backup defaults
|
||||
$temp = new admin_settingpage('backupgeneralsettings', get_string('generalbackdefaults', 'backup'), 'moodle/backup:backupcourse');
|
||||
|
||||
// General configuration section.
|
||||
$temp->add(new admin_setting_configselect('backup/loglifetime', get_string('loglifetime', 'backup'), get_string('configloglifetime', 'backup'), 30, array(
|
||||
1 => get_string('numdays', '', 1),
|
||||
2 => get_string('numdays', '', 2),
|
||||
3 => get_string('numdays', '', 3),
|
||||
5 => get_string('numdays', '', 5),
|
||||
7 => get_string('numdays', '', 7),
|
||||
10 => get_string('numdays', '', 10),
|
||||
14 => get_string('numdays', '', 14),
|
||||
20 => get_string('numdays', '', 20),
|
||||
30 => get_string('numdays', '', 30),
|
||||
60 => get_string('numdays', '', 60),
|
||||
90 => get_string('numdays', '', 90),
|
||||
120 => get_string('numdays', '', 120),
|
||||
180 => get_string('numdays', '', 180),
|
||||
365 => get_string('numdays', '', 365)
|
||||
)));
|
||||
|
||||
// General defaults section.
|
||||
$temp->add(new admin_setting_heading('generalsettings', get_string('generalsettings', 'backup'), ''));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_users', get_string('generalusers','backup'), get_string('configgeneralusers','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_anonymize', get_string('generalanonymize','backup'), get_string('configgeneralanonymize','backup'), array('value'=>0, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', get_string('generalroleassignments','backup'), get_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_user_files', get_string('generaluserfiles','backup'), get_string('configgeneraluserfiles','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_activities', get_string('generalactivities','backup'), get_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_blocks', get_string('generalblocks','backup'), get_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_filters', get_string('generalfilters','backup'), get_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
|
||||
@@ -127,10 +107,8 @@ if ($hassiteconfig
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_histories', get_string('generalhistories','backup'), get_string('configgeneralhistories','backup'), array('value'=>0, 'locked'=>0)));
|
||||
$ADMIN->add('backups', $temp);
|
||||
|
||||
// Create a page for automated backups configuration and defaults.
|
||||
/// "backups" settingpage
|
||||
$temp = new admin_settingpage('automated', get_string('automatedsetup','backup'), 'moodle/backup:backupcourse');
|
||||
|
||||
// Automated configuration section.
|
||||
$temp->add(new admin_setting_configselect('backup/backup_auto_active', get_string('active'), get_string('autoactivedescription', 'backup'), 0, array(
|
||||
0 => get_string('autoactivedisabled', 'backup'),
|
||||
1 => get_string('autoactiveenabled', 'backup'),
|
||||
@@ -161,18 +139,18 @@ if ($hassiteconfig
|
||||
400 => '400',
|
||||
500 => '500');
|
||||
$temp->add(new admin_setting_configselect('backup/backup_auto_keep', get_string('keep'), get_string('backupkeephelp'), 1, $keepoptoins));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_shortname', get_string('backup_shortname', 'admin'), get_string('backup_shortnamehelp', 'admin'), 0));
|
||||
|
||||
// Automated defaults section.
|
||||
|
||||
$temp->add(new admin_setting_heading('automatedsettings', get_string('automatedsettings','backup'), ''));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', get_string('generalusers', 'backup'), get_string('configgeneralusers', 'backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', get_string('users'), get_string('backupusershelp'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_role_assignments', get_string('generalroleassignments','backup'), get_string('configgeneralroleassignments','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_user_files', get_string('generaluserfiles', 'backup'), get_string('configgeneraluserfiles','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_activities', get_string('generalactivities','backup'), get_string('configgeneralactivities','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blocks', get_string('generalblocks','backup'), get_string('configgeneralblocks','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_filters', get_string('generalfilters','backup'), get_string('configgeneralfilters','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_comments', get_string('generalcomments','backup'), get_string('configgeneralcomments','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_userscompletion', get_string('generaluserscompletion','backup'), get_string('configgeneraluserscompletion','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_logs', get_string('generallogs', 'backup'), get_string('configgenerallogs', 'backup'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_logs', get_string('logs'), get_string('backuplogshelp'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_histories', get_string('generalhistories','backup'), get_string('configgeneralhistories','backup'), 0));
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ if (!during_initial_install()) { //do not use during installation
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/backup:backupcourse', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/backup/restorefile.php?contextid='.$frontpagecontext->id, 'moodle/restore:restorecourse', false, $frontpagecontext));
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&wdir=/backupdata', 'moodle/restore:restorecourse', false, $frontpagecontext));
|
||||
|
||||
$questioncapabilities = array(
|
||||
'moodle/question:add',
|
||||
|
||||
@@ -22,9 +22,6 @@ if (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode !== 'off')
|
||||
|
||||
$hosts = mnet_get_hosts();
|
||||
foreach ($hosts as $host) {
|
||||
if ($host->id == $CFG->mnet_all_hosts_id) {
|
||||
$host->name = get_string('allhosts', 'core_mnet');
|
||||
}
|
||||
$ADMIN->add('mnetpeercat',
|
||||
new admin_externalpage(
|
||||
'mnetpeer' . $host->id,
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_page_pluginsoverview());
|
||||
$ADMIN->add('modules', new admin_category('modsettings', get_string('activitymodules')));
|
||||
$ADMIN->add('modsettings', new admin_page_managemods());
|
||||
$modules = $DB->get_records('modules', array(), "name ASC");
|
||||
@@ -46,27 +45,6 @@ if ($hassiteconfig) {
|
||||
}
|
||||
}
|
||||
|
||||
// message outputs
|
||||
$ADMIN->add('modules', new admin_category('messageoutputs', get_string('messageoutputs', 'message')));
|
||||
$ADMIN->add('messageoutputs', new admin_page_managemessageoutputs());
|
||||
$ADMIN->add('messageoutputs', new admin_page_defaultmessageoutputs());
|
||||
require_once($CFG->dirroot.'/message/lib.php');
|
||||
$processors = get_message_processors();
|
||||
foreach ($processors as $processor) {
|
||||
$processorname = $processor->name;
|
||||
if (!$processor->available) {
|
||||
continue;
|
||||
}
|
||||
if ($processor->hassettings) {
|
||||
$strprocessorname = get_string('pluginname', 'message_'.$processorname);
|
||||
$settings = new admin_settingpage('messagesetting'.$processorname, $strprocessorname, 'moodle/site:config', !$processor->enabled);
|
||||
include($CFG->dirroot.'/message/output/'.$processor->name.'/settings.php');
|
||||
if ($settings) {
|
||||
$ADMIN->add('messageoutputs', $settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// authentication plugins
|
||||
$ADMIN->add('modules', new admin_category('authsettings', get_string('authentication', 'admin')));
|
||||
|
||||
@@ -74,8 +52,6 @@ if ($hassiteconfig) {
|
||||
$temp->add(new admin_setting_manageauths());
|
||||
$temp->add(new admin_setting_heading('manageauthscommonheading', get_string('commonsettings', 'admin'), ''));
|
||||
$temp->add(new admin_setting_special_registerauth());
|
||||
$temp->add(new admin_setting_configcheckbox('authpreventaccountcreation', get_string('authpreventaccountcreation', 'admin'), get_string('authpreventaccountcreation_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('loginpageautofocus', get_string('loginpageautofocus', 'admin'), get_string('loginpageautofocus_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('guestloginbutton', get_string('guestloginbutton', 'auth'),
|
||||
get_string('showguestlogin', 'auth'), '1', array('0'=>get_string('hide'), '1'=>get_string('show'))));
|
||||
$temp->add(new admin_setting_configtext('alternateloginurl', get_string('alternateloginurl', 'auth'),
|
||||
@@ -345,13 +321,8 @@ if ($hassiteconfig) {
|
||||
$temp = new admin_settingpage('webservicesoverview', get_string('webservicesoverview', 'webservice'));
|
||||
$temp->add(new admin_setting_webservicesoverview());
|
||||
$ADMIN->add('webservicesettings', $temp);
|
||||
//API documentation
|
||||
$ADMIN->add('webservicesettings', new admin_externalpage('webservicedocumentation', get_string('wsdocapi', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/documentation.php", 'moodle/site:config', false));
|
||||
/// manage service
|
||||
$temp = new admin_settingpage('externalservices', get_string('externalservices', 'webservice'));
|
||||
$enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services'));
|
||||
$enablemobiledoclink = html_writer::link($enablemobiledocurl, get_string('documentation'));
|
||||
$temp->add(new admin_setting_enablemobileservice('enablemobilewebservice', get_string('enablemobilewebservice', 'admin'), get_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), 0));
|
||||
$temp->add(new admin_setting_heading('manageserviceshelpexplaination', get_string('information', 'webservice'), get_string('servicehelpexplanation', 'webservice')));
|
||||
$temp->add(new admin_setting_manageexternalservices());
|
||||
$ADMIN->add('webservicesettings', $temp);
|
||||
@@ -398,10 +369,6 @@ if ($hassiteconfig) {
|
||||
|
||||
// Question type settings
|
||||
if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {
|
||||
// Question behaviour settings.
|
||||
$ADMIN->add('modules', new admin_category('qbehavioursettings', get_string('questionbehaviours', 'admin')));
|
||||
$ADMIN->add('qbehavioursettings', new admin_page_manageqbehaviours());
|
||||
|
||||
// Question type settings.
|
||||
$ADMIN->add('modules', new admin_category('qtypesettings', get_string('questiontypes', 'admin')));
|
||||
$ADMIN->add('qtypesettings', new admin_page_manageqtypes());
|
||||
|
||||
@@ -16,7 +16,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', get_string('forceloginforprofileimage', 'admin'), get_string('forceloginforprofileimage_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
|
||||
$temp->add(new admin_setting_pickroles('profileroles',
|
||||
get_string('profileroles','admin'),
|
||||
@@ -72,7 +71,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('groupenrolmentkeypolicy', get_string('groupenrolmentkeypolicy', 'admin'), get_string('groupenrolmentkeypolicy_desc', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('disableuserimages', get_string('disableuserimages', 'admin'), get_string('configdisableuserimages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', get_string('emailchangeconfirmation', 'admin'), get_string('configemailchangeconfirmation', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('strictformsrequired', get_string('strictformsrequired', 'admin'), get_string('configstrictformsrequired', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
@@ -84,7 +82,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$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_configtext('excludeoldflashclients', get_string('excludeoldflashclients', 'admin'), get_string('configexcludeoldflashclients', 'admin'), '10.0.12', PARAM_TEXT));
|
||||
$temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', get_string('loginpasswordautocomplete', 'admin'), get_string('loginpasswordautocomplete_help', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
@@ -94,9 +91,14 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
'all' => get_string('fulllistofcourses'),
|
||||
'requested' => get_string('requestedcourses'))));
|
||||
$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configmultiselect_modules('defaultallowedmodules',
|
||||
get_string('defaultallowedmodules', 'admin'),
|
||||
get_string('configdefaultallowedmodules', 'admin')));
|
||||
if (!$options = $DB->get_records('modules')) {
|
||||
$options = array();
|
||||
}
|
||||
$options2 = array();
|
||||
foreach ($options as $option) {
|
||||
$options2[$option->id] = $option->name;
|
||||
}
|
||||
$temp->add(new admin_setting_configmultiselect('defaultallowedmodules', get_string('defaultallowedmodules', 'admin'), get_string('configdefaultallowedmodules', 'admin'), array(), $options2));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,46 @@ $ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
|
||||
// "supportcontact" settingpage
|
||||
$temp = new admin_settingpage('supportcontact', get_string('supportcontact','admin'));
|
||||
// "email" settingpage
|
||||
$temp = new admin_settingpage('mail', get_string('mail','admin'));
|
||||
$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configtext('smtpmaxbulk', get_string('smtpmaxbulk', 'admin'), get_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00',
|
||||
'01' => '01',
|
||||
'02' => '02',
|
||||
'03' => '03',
|
||||
'04' => '04',
|
||||
'05' => '05',
|
||||
'06' => '06',
|
||||
'07' => '07',
|
||||
'08' => '08',
|
||||
'09' => '09',
|
||||
'10' => '10',
|
||||
'11' => '11',
|
||||
'12' => '12',
|
||||
'13' => '13',
|
||||
'14' => '14',
|
||||
'15' => '15',
|
||||
'16' => '16',
|
||||
'17' => '17',
|
||||
'18' => '18',
|
||||
'19' => '19',
|
||||
'20' => '20',
|
||||
'21' => '21',
|
||||
'22' => '22',
|
||||
'23' => '23')));
|
||||
$charsets = get_list_of_charsets();
|
||||
unset($charsets['UTF-8']); // not needed here
|
||||
$options = array();
|
||||
$options['0'] = 'UTF-8';
|
||||
$options = array_merge($options, $charsets);
|
||||
$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '0', $options));
|
||||
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
|
||||
$options = array('LF'=>'LF', 'CRLF'=>'CRLF');
|
||||
$temp->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'admin'), get_string('configmailnewline','admin'), 'LF', $options));
|
||||
if (isloggedin()) {
|
||||
global $USER;
|
||||
$primaryadminemail = $USER->email;
|
||||
@@ -35,6 +73,17 @@ $temp->add(new admin_setting_configtext('supportpage', get_string('supportpage',
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
// Jabber settingpage
|
||||
$temp = new admin_settingpage('jabber', get_string('jabber', 'admin'));
|
||||
$temp->add(new admin_setting_configtext('jabberhost', get_string('jabberhost', 'admin'), get_string('configjabberhost', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('jabberserver', get_string('jabberserver', 'admin'), get_string('configjabberserver', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('jabberusername', get_string('jabberusername', 'admin'), get_string('configjabberusername', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configpasswordunmask('jabberpassword', get_string('jabberpassword', 'admin'), get_string('configjabberpassword', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configtext('jabberport', get_string('jabberport', 'admin'), get_string('configjabberport', 'admin'), 5222, PARAM_INT));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
|
||||
// "sessionhandling" settingpage
|
||||
$temp = new admin_settingpage('sessionhandling', get_string('sessionhandling', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('dbsessions', get_string('dbsessions', 'admin'), get_string('configdbsessions', 'admin'), 1));
|
||||
|
||||
+1
-3
@@ -9,9 +9,6 @@
|
||||
$zone = clean_param($zone, PARAM_PATH);
|
||||
}
|
||||
|
||||
$PAGE->set_url('/admin/timezone.php');
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
@@ -21,6 +18,7 @@
|
||||
$strusers = get_string("users");
|
||||
$strall = get_string("all");
|
||||
|
||||
$PAGE->set_url('/admin/timezone.php');
|
||||
$PAGE->set_title($strtimezone);
|
||||
$PAGE->set_heading($strtimezone);
|
||||
$PAGE->navbar->add($strtimezone);
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
/// That's it!
|
||||
|
||||
if ($importdone) {
|
||||
$a = new stdClass();
|
||||
$a = null;
|
||||
$a->count = count($timezones);
|
||||
$a->source = $importdone;
|
||||
echo $OUTPUT->heading(get_string('importtimezonescount', 'admin', $a), 3);
|
||||
|
||||
@@ -231,7 +231,7 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
}
|
||||
}
|
||||
if (!isset($user->username)) {
|
||||
// prevent warnings below
|
||||
// prevent warnings bellow
|
||||
$user->username = '';
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@
|
||||
list($extrasql, $params) = $ufiltering->get_sql_filter();
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, '', '', '', $extrasql, $params);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, '', false, null, "", '', '', '', '', '*', $extrasql, $params);
|
||||
$usersearchcount = get_users(false, '', true, null, "", '', '', '', '', '*', $extrasql, $params);
|
||||
|
||||
if ($extrasql !== '') {
|
||||
echo $OUTPUT->heading("$usersearchcount / $usercount ".get_string('users'));
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Web services API documentation
|
||||
*
|
||||
* @package webservice
|
||||
* @copyright 2011 Moodle Pty Ltd (http://moodle.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Jerome Mouneyrac
|
||||
*/
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require($CFG->dirroot . '/webservice/lib.php');
|
||||
|
||||
admin_externalpage_setup('webservicedocumentation');
|
||||
|
||||
// get all the function descriptions
|
||||
$functions = $DB->get_records('external_functions', array(), 'name');
|
||||
$functiondescs = array();
|
||||
foreach ($functions as $function) {
|
||||
$functiondescs[$function->name] = external_function_info($function);
|
||||
}
|
||||
|
||||
//display the documentation for all documented protocols,
|
||||
//regardless if they are activated or not
|
||||
$protocols = array();
|
||||
$protocols['rest'] = true;
|
||||
$protocols['xmlrpc'] = true;
|
||||
|
||||
/// Check if we are in printable mode
|
||||
$printableformat = optional_param('print', false, PARAM_BOOL);
|
||||
|
||||
/// OUTPUT
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$renderer = $PAGE->get_renderer('core', 'webservice');
|
||||
echo $renderer->documentation_html($functiondescs,
|
||||
$printableformat, $protocols, array(), $PAGE->url);
|
||||
|
||||
/// trigger browser print operation
|
||||
if (!empty($printableformat)) {
|
||||
$PAGE->requires->js_function_call('window.print', array());
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
+13
-62
@@ -63,7 +63,6 @@ class external_service_form extends moodleform {
|
||||
|
||||
$mform->addElement('text', 'name', get_string('name'));
|
||||
$mform->addRule('name', get_string('required'), 'required', null, 'client');
|
||||
$mform->setType('name', PARAM_TEXT);
|
||||
$mform->addElement('advcheckbox', 'enabled', get_string('enabled', 'webservice'));
|
||||
$mform->addElement('advcheckbox', 'restrictedusers',
|
||||
get_string('restrictedusers', 'webservice'));
|
||||
@@ -108,7 +107,7 @@ class external_service_form extends moodleform {
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
if (!empty($service->id)) {
|
||||
$buttonlabel = get_string('savechanges');
|
||||
$buttonlabel = get_string('editaservice', 'webservice');
|
||||
} else {
|
||||
$buttonlabel = get_string('addaservice', 'webservice');
|
||||
}
|
||||
@@ -156,7 +155,7 @@ class external_service_functions_form extends moodleform {
|
||||
$functions[$functionid] = $function->name . ':' . $function->description;
|
||||
}
|
||||
|
||||
$mform->addElement('searchableselector', 'fids', get_string('name'),
|
||||
$mform->addElement('searchableselector', 'fid', get_string('name'),
|
||||
$functions, array('multiple'));
|
||||
|
||||
$mform->addElement('hidden', 'id');
|
||||
@@ -175,7 +174,7 @@ class external_service_functions_form extends moodleform {
|
||||
class web_service_token_form extends moodleform {
|
||||
|
||||
function definition() {
|
||||
global $USER, $DB, $CFG;
|
||||
global $USER, $DB;
|
||||
|
||||
$mform = $this->_form;
|
||||
$data = $this->_customdata;
|
||||
@@ -183,28 +182,16 @@ class web_service_token_form extends moodleform {
|
||||
$mform->addElement('header', 'token', get_string('token', 'webservice'));
|
||||
|
||||
if (empty($data->nouserselection)) {
|
||||
|
||||
//check if the number of user is reasonable to be displayed in a select box
|
||||
$usertotal = $DB->count_records('user',
|
||||
array('deleted' => 0, 'suspended' => 0, 'confirmed' => 1));
|
||||
|
||||
if ($usertotal < 500) {
|
||||
//user searchable selector - get all users (admin and guest included)
|
||||
//user must be confirmed, not deleted, not suspended, not guest
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname
|
||||
FROM {user} u
|
||||
WHERE u.deleted = 0 AND u.confirmed = 1 AND u.suspended = 0 AND u.id != ?
|
||||
ORDER BY u.lastname";
|
||||
$users = $DB->get_records_sql($sql, array($CFG->siteguest));
|
||||
$options = array();
|
||||
foreach ($users as $userid => $user) {
|
||||
$options[$userid] = $user->firstname . " " . $user->lastname;
|
||||
}
|
||||
$mform->addElement('searchableselector', 'user', get_string('user'), $options);
|
||||
} else {
|
||||
//simple text box for username or user id (if two username exists, a form error is displayed)
|
||||
$mform->addElement('text', 'user', get_string('usernameorid', 'webservice'));
|
||||
//user searchable selector - get all users (admin and guest included)
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname
|
||||
FROM {user} u
|
||||
ORDER BY u.lastname";
|
||||
$users = $DB->get_records_sql($sql, array());
|
||||
$options = array();
|
||||
foreach ($users as $userid => $user) {
|
||||
$options[$userid] = $user->firstname . " " . $user->lastname;
|
||||
}
|
||||
$mform->addElement('searchableselector', 'user', get_string('user'), $options);
|
||||
$mform->addRule('user', get_string('required'), 'required', null, 'client');
|
||||
}
|
||||
|
||||
@@ -238,44 +225,8 @@ class web_service_token_form extends moodleform {
|
||||
$this->set_data($data);
|
||||
}
|
||||
|
||||
function get_data() {
|
||||
global $DB;
|
||||
$data = parent::get_data();
|
||||
|
||||
if (!empty($data) && !is_numeric($data->user)) {
|
||||
//retrieve username
|
||||
$user = $DB->get_record('user', array('username' => $data->user), 'id');
|
||||
$data->user = $user->id;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function validation(&$data, $files) {
|
||||
global $DB;
|
||||
|
||||
function validation($data, $files) {
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
if (is_numeric($data['user'])) {
|
||||
$searchtype = 'id';
|
||||
} else {
|
||||
$searchtype = 'username';
|
||||
//check the username is valid
|
||||
if (clean_param($data['user'], PARAM_USERNAME) != $data['user']) {
|
||||
$errors['user'] = get_string('invalidusername');
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($errors['user'])) {
|
||||
$users = $DB->get_records('user', array($searchtype => $data['user']), '', 'id');
|
||||
|
||||
//check that the user exists in the database
|
||||
if (count($users) == 0) {
|
||||
$errors['user'] = get_string('usernameoridnousererror', 'webservice');
|
||||
} else if (count($users) > 1) { //can only be a username search as id are unique
|
||||
$errors['user'] = get_string('usernameoridoccurenceerror', 'webservice');
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
admin_externalpage_setup('externalservicefunctions');
|
||||
|
||||
//define nav bar
|
||||
$PAGE->set_url('/' . $CFG->admin . '/webservice/service_functions.php', array('id' => $serviceid));
|
||||
$PAGE->set_url('/' . $CFG->admin . '/websevice/service_functions.php', array('id' => $serviceid));
|
||||
$node = $PAGE->settingsnav->find('externalservices', navigation_node::TYPE_SETTING);
|
||||
if ($node) {
|
||||
$node->make_active();
|
||||
@@ -67,7 +67,7 @@ switch ($action) {
|
||||
//add the function to the service then redirect to function list page
|
||||
if ($data = $mform->get_data()) {
|
||||
ignore_user_abort(true); // no interruption here!
|
||||
foreach ($data->fids as $fid) {
|
||||
foreach ($data->fid as $fid) {
|
||||
$function = $webservicemanager->get_external_function_by_id(
|
||||
$fid, MUST_EXIST);
|
||||
// make sure the function is not there yet
|
||||
|
||||
@@ -98,7 +98,7 @@ $usersmissingcaps = $webservicemanager->get_missing_capabilities_by_users($allow
|
||||
//add the missing capabilities to the allowed users object to be displayed by renderer
|
||||
foreach ($allowedusers as &$alloweduser) {
|
||||
if (!is_siteadmin($alloweduser->id) and key_exists($alloweduser->id, $usersmissingcaps)) {
|
||||
$alloweduser->missingcapabilities = implode(', ', $usersmissingcaps[$alloweduser->id]);
|
||||
$alloweduser->missingcapabilities = implode(',', $usersmissingcaps[$alloweduser->id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,12 +71,6 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
|
||||
//check if the user is deleted. unconfirmed, suspended or guest
|
||||
$user = $DB->get_record('user', array('id' => $data->user));
|
||||
if ($user->id == $CFG->siteguest or $user->deleted or !$user->confirmed or $user->suspended) {
|
||||
throw new moodle_exception('forbiddenwsuser', 'webservice');
|
||||
}
|
||||
|
||||
//process the creation
|
||||
if (empty($errormsg)) {
|
||||
//TODO improvement: either move this function from externallib.php to webservice/lib.php
|
||||
|
||||
@@ -66,7 +66,6 @@ class create_xml_file extends XMLDBAction {
|
||||
|
||||
/// Get the dir containing the file
|
||||
$dirpath = required_param('dir', PARAM_PATH);
|
||||
$plugintype = $this->get_plugin_type($dirpath);
|
||||
$dirpath = $CFG->dirroot . $dirpath;
|
||||
$file = $dirpath . '/install.xml';
|
||||
|
||||
@@ -76,9 +75,6 @@ class create_xml_file extends XMLDBAction {
|
||||
$xmlcomment = 'XMLDB file for Moodle ' . dirname($xmlpath);
|
||||
|
||||
$xmltable = strtolower(basename(dirname($xmlpath)));
|
||||
if ($plugintype && $plugintype != 'mod') {
|
||||
$xmltable = $plugintype.'_'.$xmltable;
|
||||
}
|
||||
|
||||
/// Initial contents
|
||||
$c = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
|
||||
@@ -108,23 +104,5 @@ class create_xml_file extends XMLDBAction {
|
||||
/// Return ok if arrived here
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* From a given path, work out what type of plugin
|
||||
* this belongs to
|
||||
* @param string $dirpath Path to the db file for this plugin
|
||||
* @return string the type of the plugin or null if not found
|
||||
*/
|
||||
function get_plugin_type($dirpath) {
|
||||
global $CFG;
|
||||
$dirpath = $CFG->dirroot.$dirpath;
|
||||
$plugintypes = get_plugin_types();
|
||||
foreach ($plugintypes as $plugintype => $pluginbasedir) {
|
||||
if (substr($dirpath, 0, strlen($pluginbasedir)) == $pluginbasedir) {
|
||||
return $plugintype;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<div class="loginbox clearfix">
|
||||
<div class="loginpanel">
|
||||
<div>
|
||||
<a href="<?php echo get_login_url() . '?authCAS=CAS';?>"><?php print_string('accesCAS', 'auth_cas');?></a>
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=CAS';?>"><?php print_string('accesCAS', 'auth_cas');?></a>
|
||||
</div>
|
||||
<br/>
|
||||
<div>
|
||||
<a href="<?php echo get_login_url() . '?authCAS=NOCAS';?>"><?php print_string('accesNOCAS', 'auth_cas');?></a>
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=NOCAS';?>"><?php print_string('accesNOCAS', 'auth_cas');?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,8 +30,8 @@ $string['auth_cas_baseuri'] = 'URI of the server (nothing if no baseUri)<br />Fo
|
||||
$string['auth_cas_baseuri_key'] = 'Base URI';
|
||||
$string['auth_cas_broken_password'] = 'You cannot proceed without changing your password, however there is no available page for changing it. Please contact your Moodle Administrator.';
|
||||
$string['auth_cas_cantconnect'] = 'LDAP part of CAS-module cannot connect to server: {$a}';
|
||||
$string['auth_cas_casversion'] = 'CAS protocol version';
|
||||
$string['auth_cas_certificate_check'] = 'Select \'yes\' if you want to validate the server certificate';
|
||||
$string['auth_cas_casversion'] = 'Version';
|
||||
$string['auth_cas_certificate_check'] = 'Turn this to \'yes\' if you want to validate the server certificate';
|
||||
$string['auth_cas_certificate_path_empty'] = 'If you turn on Server validation, you need to specify a certificate path';
|
||||
$string['auth_cas_certificate_check_key'] = 'Server validation';
|
||||
$string['auth_cas_certificate_path'] = 'Path of the CA chain file (PEM Format) to validate the server certificate';
|
||||
@@ -44,22 +44,22 @@ $string['auth_cas_hostname'] = 'Hostname of the CAS server <br />eg: host.domain
|
||||
$string['auth_cas_hostname_key'] = 'Hostname';
|
||||
$string['auth_cas_changepasswordurl'] = 'Password-change URL';
|
||||
$string['auth_cas_invalidcaslogin'] = 'Sorry, your login has failed - you could not be authorised';
|
||||
$string['auth_cas_language'] = 'Select language for authentication pages';
|
||||
$string['auth_cas_language'] = 'Selected language';
|
||||
$string['auth_cas_language_key'] = 'Language';
|
||||
$string['auth_cas_logincas'] = 'Secure connection access';
|
||||
$string['auth_cas_logoutcas'] = 'Select \'yes\' if you want to logout from CAS when you disconnect from Moodle';
|
||||
$string['auth_cas_logoutcas_key'] = 'CAS logout option';
|
||||
$string['auth_cas_multiauth'] = 'Select \'yes\' if you want to have multi-authentication (CAS + other authentication)';
|
||||
$string['auth_cas_logoutcas'] = 'Turn this to \'yes\' if you want to logout from CAS when you disconnect from Moodle';
|
||||
$string['auth_cas_logoutcas_key'] = 'Logout CAS';
|
||||
$string['auth_cas_multiauth'] = 'Turn this to \'yes\' if you want to have multi-authentication (CAS + other authentication)';
|
||||
$string['auth_cas_multiauth_key'] = 'Multi-authentication';
|
||||
$string['auth_casnotinstalled'] = 'Cannot use CAS authentication. The PHP LDAP module is not installed.';
|
||||
$string['auth_cas_port'] = 'Port of the CAS server';
|
||||
$string['auth_cas_port_key'] = 'Port';
|
||||
$string['auth_cas_proxycas'] = 'Select \'yes\' if you use CAS in proxy-mode';
|
||||
$string['auth_cas_proxycas'] = 'Turn this to \'yes\' if you use CASin proxy-mode';
|
||||
$string['auth_cas_proxycas_key'] = 'Proxy mode';
|
||||
$string['auth_cas_server_settings'] = 'CAS server configuration';
|
||||
$string['auth_cas_text'] = 'Secure connection';
|
||||
$string['auth_cas_use_cas'] = 'Use CAS';
|
||||
$string['auth_cas_version'] = 'CAS protocol version to use';
|
||||
$string['auth_cas_version'] = 'Version of CAS';
|
||||
$string['CASform'] = 'Authentication choice';
|
||||
$string['noldapserver'] = 'No LDAP server configured for CAS! Syncing disabled.';
|
||||
$string['pluginname'] = 'CAS server (SSO)';
|
||||
|
||||
+5
-13
@@ -256,7 +256,6 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
$updateuser = new stdClass();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->auth = 'nologin';
|
||||
$updateuser->timemodified = time();
|
||||
$DB->update_record('user', $updateuser);
|
||||
echo "\t"; print_string('auth_dbsuspenduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
}
|
||||
@@ -344,6 +343,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
|
||||
// prep a few params
|
||||
$user->username = $username;
|
||||
$user->modified = time();
|
||||
$user->confirmed = 1;
|
||||
$user->auth = $this->authtype;
|
||||
$user->mnethostid = $CFG->mnet_localhost_id;
|
||||
@@ -352,15 +352,12 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
}
|
||||
|
||||
// maybe the user has been deleted before
|
||||
if ($old_user = $DB->get_record('user', array('username'=>$user->username, 'deleted'=>1, 'mnethostid'=>$user->mnethostid, 'auth'=>$user->auth))) {
|
||||
// note: this undeleting is deprecated and will be eliminated soon
|
||||
$DB->set_field('user', 'deleted', 0, array('id'=>$old_user->id));
|
||||
$DB->set_field('user', 'timemodified', time(), array('id'=>$old_user->id));
|
||||
echo "\t"; print_string('auth_dbreviveduser', 'auth_db', array('name'=>$old_user->username, 'id'=>$old_user->id)); echo "\n";
|
||||
if ($old_user = $DB->get_record('user', array('username'=>$user->username, 'deleted'=>1, 'mnethostid'=>$user->mnethostid))) {
|
||||
$user->id = $old_user->id;
|
||||
$DB->set_field('user', 'deleted', 0, array('username'=>$user->username));
|
||||
echo "\t"; print_string('auth_dbreviveduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
|
||||
} else {
|
||||
$user->timecreated = time();
|
||||
$user->timemodified = $user->timecreated;
|
||||
$id = $DB->insert_record ('user',$user); // it is truly a new user
|
||||
echo "\t"; print_string('auth_dbinsertuser','auth_db',array('name'=>$user->username, 'id'=>$id)); echo "\n";
|
||||
// if relevant, tag for password generation
|
||||
@@ -466,7 +463,6 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
|
||||
// Ensure userid is not overwritten
|
||||
$userid = $user->id;
|
||||
$updated = false;
|
||||
|
||||
if ($newinfo = $this->get_userinfo($username)) {
|
||||
$newinfo = truncate_userinfo($newinfo);
|
||||
@@ -485,14 +481,10 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
if (!empty($this->config->{'field_updatelocal_' . $key})) {
|
||||
if (isset($user->{$key}) and $user->{$key} != $value) { // only update if it's changed
|
||||
$DB->set_field('user', $key, $value, array('id'=>$userid));
|
||||
$updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($updated) {
|
||||
$DB->set_field('user', 'timemodified', time(), array('id'=>$userid));
|
||||
}
|
||||
return $DB->get_record('user', array('id'=>$userid, 'deleted'=>0));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ $string['auth_dbsybasequoting'] = 'Use sybase quotes';
|
||||
$string['auth_dbsybasequotinghelp'] = 'Sybase style single quote escaping - needed for Oracle, MS SQL and some other databases. Do not use for MySQL!';
|
||||
$string['auth_dbtable'] = 'Name of the table in the database';
|
||||
$string['auth_dbtable_key'] = 'Table';
|
||||
$string['auth_dbtype'] = 'The database type (See the <a href="http://phplens.com/adodb/supported.databases.html" target="_blank">ADOdb documentation</a> for details)';
|
||||
$string['auth_dbtype'] = 'The database type (See the <a href="../lib/adodb/readme.htm#drivers">ADOdb documentation</a> for details)';
|
||||
$string['auth_dbtype_key'] = 'Database';
|
||||
$string['auth_dbupdatinguser'] = 'Updating user {$a->name} id {$a->id}';
|
||||
$string['auth_dbuser'] = 'Username with read access to the database';
|
||||
|
||||
@@ -24,8 +24,23 @@
|
||||
*/
|
||||
|
||||
$string['auth_emaildescription'] = 'Email confirmation is the default authentication method. When the user signs up, choosing their own new username and password, a confirmation email is sent to the user\'s email address. This email contains a secure link to a page where the user can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.';
|
||||
$string['auth_emailchangecancel'] = 'Cancel email change';
|
||||
$string['auth_emailchangepending'] = 'Change pending. Open the link sent to you at {$a->preference_newemail}.';
|
||||
$string['auth_emailnoemail'] = 'Tried to send you an email but failed!';
|
||||
$string['auth_emailnoinsert'] = 'Could not add your record to the database!';
|
||||
$string['auth_emailnowexists'] = 'The email address you tried to assign to your profile has been assigned to someone else since your original request. Your request for change of email address is hereby cancelled, but you may try again with a different address.';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://www.google.com/recaptcha/learnmore for more details. <br /><em>PHP cURL extension is required.</em>';
|
||||
$string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element';
|
||||
$string['auth_emailsettings'] = 'Settings';
|
||||
$string['auth_emailupdate'] = 'Email address update';
|
||||
$string['auth_emailupdatemessage'] = 'Dear {$a->fullname},
|
||||
|
||||
You have requested a change of your email address for your user account at {$a->site}. Please open the following URL in your browser in order to confirm this change.
|
||||
|
||||
{$a->url}';
|
||||
$string['auth_emailupdatesuccess'] = 'Email address of user <em>{$a->fullname}</em> was successfully updated to <em>{$a->email}</em>.';
|
||||
$string['auth_emailupdatetitle'] = 'Confirmation of email update at {$a->site}';
|
||||
$string['auth_changingemailaddress'] = 'You have requested a change of email address, from {$a->oldemail} to {$a->newemail}. For security reasons, we are sending you an email message at the new address to confirm that it belongs to you. Your email address will be updated as soon as you open the URL sent to you in that message.';
|
||||
$string['auth_invalidnewemailkey'] = 'Error: if you are trying to confirm a change of email address, you may have made a mistake in copying the URL we sent you by email. Please copy the address and try again.';
|
||||
$string['auth_outofnewemailupdateattempts'] = 'You have run out of allowed attempts to update your email address. Your update request has been cancelled.';
|
||||
$string['pluginname'] = 'Email-based self-registration';
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
LDAP-module README
|
||||
|
||||
Please read comments from auth.php in this directory.
|
||||
Please read comments from lib.php
|
||||
|
||||
+11
-12
@@ -502,7 +502,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
events_trigger('user_created', $user);
|
||||
|
||||
if (! send_confirmation_email($user)) {
|
||||
print_error('noemail', 'auth_ldap');
|
||||
print_error('auth_emailnoemail', 'auth_email');
|
||||
}
|
||||
|
||||
if ($notify) {
|
||||
@@ -579,17 +579,16 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$sr = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
|
||||
if ($sr) {
|
||||
$info = ldap_get_entries_moodle($ldapconnection, $sr);
|
||||
if (!empty ($info)) {
|
||||
$info = array_change_key_case($info[0], CASE_LOWER);
|
||||
if (!empty($info[$this->config->expireattr][0])) {
|
||||
$expiretime = $this->ldap_expirationtime2unix($info[$this->config->expireattr][0], $ldapconnection, $user_dn);
|
||||
if ($expiretime != 0) {
|
||||
$now = time();
|
||||
if ($expiretime > $now) {
|
||||
$result = ceil(($expiretime - $now) / DAYSECS);
|
||||
} else {
|
||||
$result = floor(($expiretime - $now) / DAYSECS);
|
||||
}
|
||||
$info = array_change_key_case($info, CASE_LOWER);
|
||||
if (!empty ($info) and !empty($info[0][$this->config->expireattr][0])) {
|
||||
$expiretime = $this->ldap_expirationtime2unix($info[0][$this->config->expireattr][0], $ldapconnection, $user_dn);
|
||||
if ($expiretime != 0) {
|
||||
$now = time();
|
||||
if ($expiretime > $now) {
|
||||
$result = ceil(($expiretime - $now) / DAYSECS);
|
||||
}
|
||||
else {
|
||||
$result = floor(($expiretime - $now) / DAYSECS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ $yesno = array(get_string('no'), get_string('yes'));
|
||||
<?php echo html_writer::select($yesno, 'ntlmsso_ie_fastpath', $config->ntlmsso_ie_fastpath, false); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
|
||||
<?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
|
||||
@@ -114,7 +114,6 @@ $string['morethanoneuser'] = 'Strange! More than one user record found in ldap.
|
||||
$string['needbcmath'] = 'You need the BCMath extension to use grace logins with Active Directory';
|
||||
$string['needmbstring'] = 'You need the mbstring extension to change passwords in Active Directory';
|
||||
$string['nodnforusername'] = 'Error in user_update_password(). No DN for: {$a->username}';
|
||||
$string['noemail'] = 'Tried to send you an email but failed!';
|
||||
$string['notcalledfromserver'] = 'Should not be called from the web server!';
|
||||
$string['noupdatestobedone'] = "No updates to be done\n";
|
||||
$string['nouserentriestoremove'] = "No user entries to be removed\n";
|
||||
|
||||
@@ -33,9 +33,8 @@ $PAGE->set_title("$site->fullname: $loginsite");
|
||||
$PAGE->set_heading($site->fullname);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be.
|
||||
$msg = '<p>'.get_string('ntlmsso_attempting', 'auth_ldap').'</p>'
|
||||
. '<img width="1", height="1" '
|
||||
. ' src="' . $CFG->httpswwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
|
||||
. ' src="' . $CFG->wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
|
||||
. $sesskey . '" />';
|
||||
redirect($CFG->httpswwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
|
||||
redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
|
||||
|
||||
@@ -29,8 +29,7 @@ $file = $CFG->dirroot.'/pix/spacer.gif';
|
||||
if ($authplugin->ntlmsso_magic($sesskey) && file_exists($file)) {
|
||||
if (!empty($authplugin->config->ntlmsso_ie_fastpath)) {
|
||||
if (check_browser_version('MSIE')) {
|
||||
// $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be.
|
||||
redirect($CFG->httpswwwroot.'/auth/ldap/ntlmsso_finish.php');
|
||||
redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,5 @@ function xmldb_auth_manual_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2011022700, 'auth', 'manual');
|
||||
}
|
||||
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-5
@@ -132,10 +132,6 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
global $CFG, $USER, $DB;
|
||||
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
|
||||
|
||||
if (session_is_loggedinas()) {
|
||||
print_error('notpermittedtojumpas', 'mnet');
|
||||
}
|
||||
|
||||
// check remote login permissions
|
||||
if (! has_capability('moodle/site:mnetlogintoremote', get_system_context())
|
||||
or is_mnet_remote_user($USER)
|
||||
@@ -280,7 +276,6 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
*/
|
||||
$remoteuser->mnethostid = $remotehost->id;
|
||||
$remoteuser->firstaccess = time(); // First time user in this server, grab it here
|
||||
$remoteuser->confirmed = 1;
|
||||
|
||||
$remoteuser->id = $DB->insert_record('user', $remoteuser);
|
||||
$firsttime = true;
|
||||
@@ -894,6 +889,8 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
global $CFG, $DB;
|
||||
$remoteclient = get_mnet_remote_client();
|
||||
|
||||
$CFG->usesid = true;
|
||||
|
||||
// We don't want to output anything to the client machine
|
||||
$start = ob_start();
|
||||
|
||||
|
||||
@@ -43,8 +43,5 @@ function xmldb_auth_mnet_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2010071300, 'auth', 'mnet');
|
||||
}
|
||||
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,13 +37,6 @@ if (!is_enabled_auth('mnet')) {
|
||||
|
||||
// If hostid hasn't been specified, try getting it using wwwroot
|
||||
if (!$hostid) {
|
||||
$hostwwwroot = trim($hostwwwroot);
|
||||
$hostwwwroot = rtrim($hostwwwroot, '/');
|
||||
|
||||
// ensure the wwwroot starts with a http or https prefix
|
||||
if (strtolower(substr($hostwwwroot, 0, 4)) != 'http') {
|
||||
$hostwwwroot = 'http://'.$hostwwwroot;
|
||||
}
|
||||
$hostid = $DB->get_field('mnet_host', 'id', array('wwwroot' => $hostwwwroot));
|
||||
}
|
||||
|
||||
|
||||
@@ -278,8 +278,8 @@ just before the <MetadataProvider> element.
|
||||
|
||||
--
|
||||
<Notify
|
||||
Channel="back"
|
||||
Location="https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php" />
|
||||
Channel="back"
|
||||
Location="https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php" />
|
||||
--
|
||||
|
||||
Then restart the Shibboleth daemon and check the log file for errors. If there
|
||||
@@ -300,9 +300,9 @@ Requirements:
|
||||
|
||||
--
|
||||
<Directory /path/to/moodle/auth/shibboleth/logout.php>
|
||||
AuthType shibboleth
|
||||
ShibRequireSession Off
|
||||
require shibboleth
|
||||
AuthType shibboleth
|
||||
ShibRequireSession Off
|
||||
require shibboleth
|
||||
</Directory>
|
||||
--
|
||||
When using IIS, the same can be achieved by something like:
|
||||
|
||||
@@ -193,13 +193,18 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
*
|
||||
*/
|
||||
function logoutpage_hook() {
|
||||
global $SESSION, $redirect;
|
||||
global $redirect;
|
||||
|
||||
// Only do this if logout handler is defined, and if the user is actually logged in via Shibboleth
|
||||
$logouthandlervalid = isset($this->config->logout_handler) && !empty($this->config->logout_handler);
|
||||
if (isset($SESSION->shibboleth_session_id) && $logouthandlervalid ) {
|
||||
// Only do this if logout handler is defined
|
||||
if (
|
||||
isset($this->config->logout_handler)
|
||||
&& !empty($this->config->logout_handler)
|
||||
){
|
||||
// Check if there is an alternative logout return url defined
|
||||
if (isset($this->config->logout_return_url) && !empty($this->config->logout_return_url)) {
|
||||
if (
|
||||
isset($this->config->logout_return_url)
|
||||
&& !empty($this->config->logout_return_url)
|
||||
){
|
||||
// Set temp_redirect to alternative return url
|
||||
$temp_redirect = $this->config->logout_return_url;
|
||||
} else {
|
||||
|
||||
@@ -42,19 +42,19 @@ $PAGE->https_required();
|
||||
set_saml_cookie($selectedIdP);
|
||||
|
||||
// Redirect to SessionInitiator with entityID as argument
|
||||
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])) {
|
||||
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])){
|
||||
// For Shibbolet 1.x Service Providers
|
||||
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
|
||||
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->httpswwwroot.'/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 {
|
||||
// For Shibbolet 1.x Service Providers
|
||||
header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
|
||||
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->httpswwwroot.'/auth/shibboleth/index.php'));
|
||||
// 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_shibboleth');
|
||||
|
||||
@@ -54,7 +54,6 @@ abstract class backup implements checksumable {
|
||||
const MODE_HUB = 30;
|
||||
const MODE_SAMESITE = 40;
|
||||
const MODE_AUTOMATED = 50;
|
||||
const MODE_CONVERTED = 60;
|
||||
|
||||
// Target (new/existing/current/adding/deleting)
|
||||
const TARGET_CURRENT_DELETING = 0;
|
||||
@@ -108,8 +107,8 @@ abstract class backup implements checksumable {
|
||||
const OPERATION_RESTORE ='restore';// We are performing one restore
|
||||
|
||||
// Version (to keep CFG->backup_version (and release) updated automatically)
|
||||
const VERSION = 2011063000;
|
||||
const RELEASE = '2.1';
|
||||
const VERSION = 2010111800;
|
||||
const RELEASE = '2.0';
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -118,6 +117,6 @@ abstract class backup implements checksumable {
|
||||
abstract class backup_exception extends moodle_exception {
|
||||
|
||||
public function __construct($errorcode, $a=NULL, $debuginfo=null) {
|
||||
parent::__construct($errorcode, 'error', '', $a, $debuginfo);
|
||||
parent::__construct($errorcode, 'error', '', $a, null, $debuginfo);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -60,12 +60,10 @@ switch ($type) {
|
||||
$heading = get_string('backupcourse', 'backup', $course->shortname);
|
||||
break;
|
||||
case backup::TYPE_1SECTION :
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_capability('moodle/backup:backupsection', $coursecontext);
|
||||
if ((string)$section->name !== '') {
|
||||
$sectionname = format_string($section->name, true, array('context' => $coursecontext));
|
||||
$heading = get_string('backupsection', 'backup', $sectionname);
|
||||
$PAGE->navbar->add($sectionname);
|
||||
require_capability('moodle/backup:backupsection', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
if (!empty($section->name)) {
|
||||
$heading = get_string('backupsection', 'backup', $section->name);
|
||||
$PAGE->navbar->add($section->name);
|
||||
} else {
|
||||
$heading = get_string('backupsection', 'backup', $section->section);
|
||||
$PAGE->navbar->add(get_string('section').' '.$section->section);
|
||||
|
||||
@@ -194,7 +194,7 @@ function schedule_backup_cron() {
|
||||
|
||||
//Build the message subject
|
||||
$site = get_site();
|
||||
$prefix = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))).": ";
|
||||
$prefix = $site->shortname.": ";
|
||||
if ($count_error != 0 || $count_unfinished != 0) {
|
||||
$prefix .= "[".strtoupper(get_string('error'))."] ";
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ class cc2moodle {
|
||||
if (!empty($CFG->defaultblocks)) {
|
||||
$blocknames = $CFG->defaultblocks;
|
||||
} else {
|
||||
$blocknames = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
$blocknames = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,3 +92,5 @@ define('MOODLE_QUIZ_MULTIPLE_RESPONSE', 'multichoice');
|
||||
define('MOODLE_QUIZ_MACHT', 'match');
|
||||
define('MOODLE_QUIZ_ESSAY', 'essay');
|
||||
define('MOODLE_QUIZ_SHORTANSWER', 'shortanswer');
|
||||
|
||||
?>
|
||||
|
||||
@@ -170,22 +170,17 @@ class backup_controller extends backup implements loggable {
|
||||
}
|
||||
|
||||
public function set_status($status) {
|
||||
// Note: never save_controller() with the object info after STATUS_EXECUTING or the whole controller,
|
||||
// containing all the steps will be sent to DB. 100% (monster) useless.
|
||||
$this->log('setting controller status to', backup::LOG_DEBUG, $status);
|
||||
// TODO: Check it's a correct status.
|
||||
// TODO: Check it's a correct status
|
||||
$this->status = $status;
|
||||
// Ensure that, once set to backup::STATUS_AWAITING, controller is stored in DB.
|
||||
// Ensure that, once set to backup::STATUS_AWAITING, controller is stored in DB
|
||||
// Note: never save_controller() after STATUS_EXECUTING or the whole controller,
|
||||
// containing all the steps will be sent to DB. 100% (monster) useless.
|
||||
if ($status == backup::STATUS_AWAITING) {
|
||||
$this->save_controller();
|
||||
$tbc = self::load_controller($this->backupid);
|
||||
$this->logger = $tbc->logger; // wakeup loggers
|
||||
$tbc->destroy(); // Clean temp controller structures
|
||||
|
||||
} else if ($status == backup::STATUS_FINISHED_OK) {
|
||||
// If the operation has ended without error (backup::STATUS_FINISHED_OK)
|
||||
// proceed by cleaning the object from database. MDL-29262.
|
||||
$this->save_controller(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,14 +293,6 @@ class backup_controller extends backup implements loggable {
|
||||
// Basic/initial prevention against time/memory limits
|
||||
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
// If this is not a course backup, inform the plan we are not
|
||||
// including all the activities for sure. This will affect any
|
||||
// task/step executed conditionally to stop including information
|
||||
// for section and activity backup. MDL-28180.
|
||||
if ($this->get_type() !== backup::TYPE_1COURSE) {
|
||||
$this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
|
||||
$this->plan->set_excluding_activities();
|
||||
}
|
||||
return $this->plan->execute();
|
||||
}
|
||||
|
||||
@@ -317,20 +304,12 @@ class backup_controller extends backup implements loggable {
|
||||
backup_helper::log($message, $level, $a, $depth, $display, $this->logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save controller information
|
||||
*
|
||||
* @param bool $includeobj to decide if the object itself must be updated (true) or no (false)
|
||||
* @param bool $cleanobj to decide if the object itself must be cleaned (true) or no (false)
|
||||
*/
|
||||
public function save_controller($includeobj = true, $cleanobj = false) {
|
||||
public function save_controller() {
|
||||
// Going to save controller to persistent storage, calculate checksum for later checks and save it
|
||||
// TODO: flag the controller as NA. Any operation on it should be forbidden util loaded back
|
||||
$this->log('saving controller to db', backup::LOG_DEBUG);
|
||||
if ($includeobj ) { // Only calculate checksum if we are going to include the object.
|
||||
$this->checksum = $this->calculate_checksum();
|
||||
}
|
||||
backup_controller_dbops::save_controller($this, $this->checksum, $includeobj, $cleanobj);
|
||||
$this->checksum = $this->calculate_checksum();
|
||||
backup_controller_dbops::save_controller($this, $this->checksum);
|
||||
}
|
||||
|
||||
public static function load_controller($backupid) {
|
||||
@@ -360,7 +339,7 @@ class backup_controller extends backup implements loggable {
|
||||
|
||||
protected function apply_defaults() {
|
||||
$this->log('applying plan defaults', backup::LOG_DEBUG);
|
||||
backup_controller_dbops::apply_config_defaults($this);
|
||||
backup_controller_dbops::apply_general_config_defaults($this);
|
||||
$this->set_status(backup::STATUS_CONFIGURED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,22 +166,17 @@ class restore_controller extends backup implements loggable {
|
||||
}
|
||||
|
||||
public function set_status($status) {
|
||||
// Note: never save_controller() with the object info after STATUS_EXECUTING or the whole controller,
|
||||
// containing all the steps will be sent to DB. 100% (monster) useless.
|
||||
$this->log('setting controller status to', backup::LOG_DEBUG, $status);
|
||||
// TODO: Check it's a correct status.
|
||||
// TODO: Check it's a correct status
|
||||
$this->status = $status;
|
||||
// Ensure that, once set to backup::STATUS_AWAITING | STATUS_NEED_PRECHECK, controller is stored in DB.
|
||||
// Ensure that, once set to backup::STATUS_AWAITING | STATUS_NEED_PRECHECK, controller is stored in DB
|
||||
// Note: never save_controller() after STATUS_EXECUTING or the whole controller,
|
||||
// containing all the steps will be sent to DB. 100% (monster) useless.
|
||||
if ($status == backup::STATUS_AWAITING || $status == backup::STATUS_NEED_PRECHECK) {
|
||||
$this->save_controller();
|
||||
$tbc = self::load_controller($this->restoreid);
|
||||
$this->logger = $tbc->logger; // wakeup loggers
|
||||
$tbc->destroy(); // Clean temp controller structures
|
||||
|
||||
} else if ($status == backup::STATUS_FINISHED_OK) {
|
||||
// If the operation has ended without error (backup::STATUS_FINISHED_OK)
|
||||
// proceed by cleaning the object from database. MDL-29262.
|
||||
$this->save_controller(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,14 +299,6 @@ class restore_controller extends backup implements loggable {
|
||||
// Basic/initial prevention against time/memory limits
|
||||
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
// If this is not a course restore, inform the plan we are not
|
||||
// including all the activities for sure. This will affect any
|
||||
// task/step executed conditionally to stop processing information
|
||||
// for section and activity restore. MDL-28180.
|
||||
if ($this->get_type() !== backup::TYPE_1COURSE) {
|
||||
$this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
|
||||
$this->plan->set_excluding_activities();
|
||||
}
|
||||
return $this->plan->execute();
|
||||
}
|
||||
|
||||
@@ -368,20 +355,12 @@ class restore_controller extends backup implements loggable {
|
||||
backup_helper::log($message, $level, $a, $depth, $display, $this->logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save controller information
|
||||
*
|
||||
* @param bool $includeobj to decide if the object itself must be updated (true) or no (false)
|
||||
* @param bool $cleanobj to decide if the object itself must be cleaned (true) or no (false)
|
||||
*/
|
||||
public function save_controller($includeobj = true, $cleanobj = false) {
|
||||
public function save_controller() {
|
||||
// Going to save controller to persistent storage, calculate checksum for later checks and save it
|
||||
// TODO: flag the controller as NA. Any operation on it should be forbidden util loaded back
|
||||
$this->log('saving controller to db', backup::LOG_DEBUG);
|
||||
if ($includeobj ) { // Only calculate checksum if we are going to include the object.
|
||||
$this->checksum = $this->calculate_checksum();
|
||||
}
|
||||
restore_controller_dbops::save_controller($this, $this->checksum, $includeobj, $cleanobj);
|
||||
$this->checksum = $this->calculate_checksum();
|
||||
restore_controller_dbops::save_controller($this, $this->checksum);
|
||||
}
|
||||
|
||||
public static function load_controller($restoreid) {
|
||||
@@ -401,44 +380,38 @@ class restore_controller extends backup implements loggable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts from current format to backup::MOODLE format
|
||||
* convert from current format to backup::MOODLE format
|
||||
*/
|
||||
public function convert() {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/backup/util/helper/convert_helper.class.php');
|
||||
|
||||
// Basic/initial prevention against time/memory limits
|
||||
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
|
||||
if ($this->status != backup::STATUS_REQUIRE_CONV) {
|
||||
throw new restore_controller_exception('cannot_convert_not_required_status');
|
||||
}
|
||||
|
||||
$this->log('backup format conversion required', backup::LOG_INFO);
|
||||
|
||||
// Run conversion to the proper format
|
||||
if (!convert_helper::to_moodle2_format($this->get_tempdir(), $this->format, $this->get_logger())) {
|
||||
// todo - unable to find the conversion path, what to do now?
|
||||
// throwing the exception as a temporary solution
|
||||
throw new restore_controller_exception('unable_to_find_conversion_path');
|
||||
if ($this->format == backup::FORMAT_UNKNOWN) {
|
||||
throw new restore_controller_exception('cannot_convert_from_unknown_format');
|
||||
}
|
||||
if ($this->format == backup::FORMAT_MOODLE1) {
|
||||
// TODO: Implement moodle1 => moodle2 conversion
|
||||
throw new restore_controller_exception('cannot_convert_yet_from_moodle1_format');
|
||||
}
|
||||
|
||||
$this->log('backup format conversion successful', backup::LOG_INFO);
|
||||
// Once conversions have finished, we check again the format
|
||||
$newformat = backup_general_helper::detect_backup_format($tempdir);
|
||||
|
||||
// If no exceptions were thrown, then we are in the proper format
|
||||
$this->format = backup::FORMAT_MOODLE;
|
||||
// If format is moodle2, load plan, apply security and set status based on interactivity
|
||||
if ($newformat === backup::FORMAT_MOODLE) {
|
||||
// Load plan
|
||||
$this->load_plan();
|
||||
|
||||
// Load plan, apply security and set status based on interactivity
|
||||
$this->load_plan();
|
||||
// Perform all initial security checks and apply (2nd param) them to settings automatically
|
||||
restore_check::check_security($this, true);
|
||||
|
||||
// Perform all initial security checks and apply (2nd param) them to settings automatically
|
||||
restore_check::check_security($this, true);
|
||||
|
||||
if ($this->interactive == backup::INTERACTIVE_YES) {
|
||||
$this->set_status(backup::STATUS_SETTING_UI);
|
||||
if ($this->interactive == backup::INTERACTIVE_YES) {
|
||||
$this->set_status(backup::STATUS_SETTING_UI);
|
||||
} else {
|
||||
$this->set_status(backup::STATUS_NEED_PRECHECK);
|
||||
}
|
||||
} else {
|
||||
$this->set_status(backup::STATUS_NEED_PRECHECK);
|
||||
throw new restore_controller_exception('conversion_ended_with_wrong_format', $newformat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ class backup_controller_test extends UnitTestCase {
|
||||
*/
|
||||
class mock_backup_controller extends backup_controller {
|
||||
|
||||
public function save_controller($includeobj = true, $cleanobj = false) {
|
||||
parent::save_controller($includeobj, $cleanobj);
|
||||
public function save_controller() {
|
||||
parent::save_controller();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,286 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Provides base converter classes
|
||||
*
|
||||
* @package core
|
||||
* @subpackage backup-convert
|
||||
* @copyright 2011 Mark Nielsen <mark@moodlerooms.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot . '/backup/util/includes/convert_includes.php');
|
||||
|
||||
/**
|
||||
* Base converter class
|
||||
*
|
||||
* All Moodle backup converters are supposed to extend this base class.
|
||||
*
|
||||
* @throws convert_exception
|
||||
*/
|
||||
abstract class base_converter implements loggable {
|
||||
|
||||
/** @var string unique identifier of this converter instance */
|
||||
protected $id;
|
||||
|
||||
/** @var string the name of the directory containing the unpacked backup being converted */
|
||||
protected $tempdir;
|
||||
|
||||
/** @var string the name of the directory where the backup is converted to */
|
||||
protected $workdir;
|
||||
|
||||
/** @var null|base_logger logger to use during the conversion */
|
||||
protected $logger = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $tempdir the relative path to the directory containing the unpacked backup to convert
|
||||
* @param null|base_logger logger to use during the conversion
|
||||
*/
|
||||
public function __construct($tempdir, $logger = null) {
|
||||
|
||||
$this->tempdir = $tempdir;
|
||||
$this->id = convert_helper::generate_id($tempdir);
|
||||
$this->workdir = $tempdir . '_' . $this->get_name() . '_' . $this->id;
|
||||
$this->set_logger($logger);
|
||||
$this->log('instantiating '.$this->get_name().' converter '.$this->get_id(), backup::LOG_DEBUG);
|
||||
$this->log('conversion source directory', backup::LOG_DEBUG, $this->tempdir);
|
||||
$this->log('conversion target directory', backup::LOG_DEBUG, $this->workdir);
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the logger to use during the conversion
|
||||
*
|
||||
* @param null|base_logger $logger
|
||||
*/
|
||||
public function set_logger($logger) {
|
||||
if (is_null($logger) or ($logger instanceof base_logger)) {
|
||||
$this->logger = $logger;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the logger was set for the converter, log the message
|
||||
*
|
||||
* If the $display is enabled, the spaces in the $message text are removed
|
||||
* and the text is used as a string identifier in the core_backup language file.
|
||||
*
|
||||
* @see backup_helper::log()
|
||||
* @param string $message message text
|
||||
* @param int $level message level {@example backup::LOG_WARNING}
|
||||
* @param null|mixed $a additional information
|
||||
* @param null|int $depth the message depth
|
||||
* @param bool $display whether the message should be sent to the output, too
|
||||
*/
|
||||
public function log($message, $level, $a = null, $depth = null, $display = false) {
|
||||
if ($this->logger instanceof base_logger) {
|
||||
backup_helper::log($message, $level, $a, $depth, $display, $this->logger);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get instance identifier
|
||||
*
|
||||
* @return string the unique identifier of this converter instance
|
||||
*/
|
||||
public function get_id() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get converter name
|
||||
*
|
||||
* @return string the system name of the converter
|
||||
*/
|
||||
public function get_name() {
|
||||
return array_shift(explode('_', get_class($this)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the backup directory
|
||||
*/
|
||||
public function convert() {
|
||||
|
||||
try {
|
||||
$this->log('creating the target directory', backup::LOG_DEBUG);
|
||||
$this->create_workdir();
|
||||
|
||||
$this->log('executing the conversion', backup::LOG_DEBUG);
|
||||
$this->execute();
|
||||
|
||||
$this->log('replacing the source directory with the converted version', backup::LOG_DEBUG);
|
||||
$this->replace_tempdir();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
// clean-up stuff if needed
|
||||
$this->destroy();
|
||||
|
||||
// eventually re-throw the execution exception
|
||||
if (isset($e) and ($e instanceof Exception)) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the full path to the working directory
|
||||
*/
|
||||
public function get_workdir_path() {
|
||||
global $CFG;
|
||||
|
||||
return "$CFG->dataroot/temp/backup/$this->workdir";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the full path to the directory with the source backup
|
||||
*/
|
||||
public function get_tempdir_path() {
|
||||
global $CFG;
|
||||
|
||||
return "$CFG->dataroot/temp/backup/$this->tempdir";
|
||||
}
|
||||
|
||||
/// public static methods //////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Makes sure that this converter is available at this site
|
||||
*
|
||||
* This is intended for eventual PHP extensions check, environment check etc.
|
||||
* All checks that do not depend on actual backup data should be done here.
|
||||
*
|
||||
* @return boolean true if this converter should be considered as available
|
||||
*/
|
||||
public static function is_available() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects the format of the backup directory
|
||||
*
|
||||
* Moodle 2.x format is being detected by the core itself. The converters are
|
||||
* therefore supposed to detect the source format. Eventually, if the target
|
||||
* format os not {@link backup::FORMAT_MOODLE} then they should be able to
|
||||
* detect both source and target formats.
|
||||
*
|
||||
* @param string $tempdir the name of the backup directory
|
||||
* @return null|string null if not recognized, backup::FORMAT_xxx otherwise
|
||||
*/
|
||||
public static function detect_format($tempdir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the basic information about the converter
|
||||
*
|
||||
* The returned array must contain the following keys:
|
||||
* 'from' - the supported source format, eg. backup::FORMAT_MOODLE1
|
||||
* 'to' - the supported target format, eg. backup::FORMAT_MOODLE
|
||||
* 'cost' - the cost of the conversion, non-negative non-zero integer
|
||||
*/
|
||||
public static function description() {
|
||||
|
||||
return array(
|
||||
'from' => null,
|
||||
'to' => null,
|
||||
'cost' => null,
|
||||
);
|
||||
}
|
||||
|
||||
/// end of public API //////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Initialize the instance if needed, called by the constructor
|
||||
*/
|
||||
protected function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the contents of the tempdir into the target format in the workdir
|
||||
*/
|
||||
protected abstract function execute();
|
||||
|
||||
/**
|
||||
* Prepares a new empty working directory
|
||||
*/
|
||||
protected function create_workdir() {
|
||||
|
||||
fulldelete($this->get_workdir_path());
|
||||
if (!check_dir_exists($this->get_workdir_path())) {
|
||||
throw new convert_exception('failed_create_workdir');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the source backup directory with the converted version
|
||||
*
|
||||
* If $CFG->keeptempdirectoriesonbackup is defined, the original source
|
||||
* source backup directory is kept for debugging purposes.
|
||||
*/
|
||||
protected function replace_tempdir() {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->keeptempdirectoriesonbackup)) {
|
||||
fulldelete($this->get_tempdir_path());
|
||||
} else {
|
||||
if (!rename($this->get_tempdir_path(), $this->get_tempdir_path() . '_' . $this->get_name() . '_' . $this->id . '_source')) {
|
||||
throw new convert_exception('failed_rename_source_tempdir');
|
||||
}
|
||||
}
|
||||
|
||||
if (!rename($this->get_workdir_path(), $this->get_tempdir_path())) {
|
||||
throw new convert_exception('failed_move_converted_into_place');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up stuff after the execution
|
||||
*
|
||||
* Note that we do not know if the execution was successful or not.
|
||||
* An exception might have been thrown.
|
||||
*/
|
||||
protected function destroy() {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->keeptempdirectoriesonbackup)) {
|
||||
fulldelete($this->get_workdir_path());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* General convert-related exception
|
||||
*
|
||||
* @author David Mudrak <david@moodle.com>
|
||||
*/
|
||||
class convert_exception extends moodle_exception {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $errorcode key for the corresponding error string
|
||||
* @param object $a extra words and phrases that might be required in the error string
|
||||
* @param string $debuginfo optional debugging information
|
||||
*/
|
||||
public function __construct($errorcode, $a = null, $debuginfo = null) {
|
||||
parent::__construct($errorcode, '', '', $a, $debuginfo);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 127 B |
@@ -1,602 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MOODLE_BACKUP>
|
||||
<INFO>
|
||||
<NAME>restore.zip</NAME>
|
||||
<MOODLE_VERSION>2007101520</MOODLE_VERSION>
|
||||
<MOODLE_RELEASE>1.9.2 (Build: 20080711)</MOODLE_RELEASE>
|
||||
<BACKUP_VERSION>2008030300</BACKUP_VERSION>
|
||||
<BACKUP_RELEASE>1.9</BACKUP_RELEASE>
|
||||
<DATE>1299774017</DATE>
|
||||
<ORIGINAL_WWWROOT>http://elearning-testadam.uss.lsu.edu/moodle</ORIGINAL_WWWROOT>
|
||||
<ZIP_METHOD>internal</ZIP_METHOD>
|
||||
<DETAILS>
|
||||
<MOD>
|
||||
<NAME>forum</NAME>
|
||||
<INCLUDED>true</INCLUDED>
|
||||
<USERINFO>false</USERINFO>
|
||||
<INSTANCES>
|
||||
<INSTANCE>
|
||||
<ID>57</ID>
|
||||
<NAME>News forum</NAME>
|
||||
<INCLUDED>true</INCLUDED>
|
||||
<USERINFO>false</USERINFO>
|
||||
</INSTANCE>
|
||||
</INSTANCES>
|
||||
</MOD>
|
||||
<METACOURSE>false</METACOURSE>
|
||||
<USERS>course</USERS>
|
||||
<LOGS>false</LOGS>
|
||||
<USERFILES>true</USERFILES>
|
||||
<COURSEFILES>true</COURSEFILES>
|
||||
<SITEFILES>true</SITEFILES>
|
||||
<GRADEBOOKHISTORIES>false</GRADEBOOKHISTORIES>
|
||||
<MESSAGES>false</MESSAGES>
|
||||
<BLOGS>false</BLOGS>
|
||||
<BLOCKFORMAT>instances</BLOCKFORMAT>
|
||||
</DETAILS>
|
||||
</INFO>
|
||||
<ROLES>
|
||||
</ROLES>
|
||||
<COURSE>
|
||||
<HEADER>
|
||||
<ID>33</ID>
|
||||
<CATEGORY>
|
||||
<ID>1</ID>
|
||||
<NAME>Miscellaneous</NAME>
|
||||
</CATEGORY>
|
||||
<PASSWORD></PASSWORD>
|
||||
<FULLNAME>Moodle 2.0 Test Restore</FULLNAME>
|
||||
<SHORTNAME>M2TR</SHORTNAME>
|
||||
<IDNUMBER></IDNUMBER>
|
||||
<SUMMARY>Cazzin'</SUMMARY>
|
||||
<FORMAT>weeks</FORMAT>
|
||||
<SHOWGRADES>1</SHOWGRADES>
|
||||
<NEWSITEMS>5</NEWSITEMS>
|
||||
<TEACHER>Teacher</TEACHER>
|
||||
<TEACHERS>Teachers</TEACHERS>
|
||||
<STUDENT>Student</STUDENT>
|
||||
<STUDENTS>Students</STUDENTS>
|
||||
<GUEST>0</GUEST>
|
||||
<STARTDATE>1299823200</STARTDATE>
|
||||
<NUMSECTIONS>10</NUMSECTIONS>
|
||||
<MAXBYTES>52428800</MAXBYTES>
|
||||
<SHOWREPORTS>0</SHOWREPORTS>
|
||||
<GROUPMODE>0</GROUPMODE>
|
||||
<GROUPMODEFORCE>0</GROUPMODEFORCE>
|
||||
<DEFAULTGROUPINGID>0</DEFAULTGROUPINGID>
|
||||
<LANG></LANG>
|
||||
<THEME></THEME>
|
||||
<COST></COST>
|
||||
<CURRENCY>USD</CURRENCY>
|
||||
<MARKER>0</MARKER>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<HIDDENSECTIONS>0</HIDDENSECTIONS>
|
||||
<TIMECREATED>1299773769</TIMECREATED>
|
||||
<TIMEMODIFIED>1299773769</TIMEMODIFIED>
|
||||
<METACOURSE>0</METACOURSE>
|
||||
<EXPIRENOTIFY>0</EXPIRENOTIFY>
|
||||
<NOTIFYSTUDENTS>0</NOTIFYSTUDENTS>
|
||||
<EXPIRYTHRESHOLD>864000</EXPIRYTHRESHOLD>
|
||||
<ENROLLABLE>1</ENROLLABLE>
|
||||
<ENROLSTARTDATE>0</ENROLSTARTDATE>
|
||||
<ENROLENDDATE>0</ENROLENDDATE>
|
||||
<ENROLPERIOD>0</ENROLPERIOD>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</HEADER>
|
||||
<BLOCKS>
|
||||
<BLOCK>
|
||||
<ID>314</ID>
|
||||
<NAME>participants</NAME>
|
||||
<PAGEID>33</PAGEID>
|
||||
<PAGETYPE>course-view</PAGETYPE>
|
||||
<POSITION>l</POSITION>
|
||||
<WEIGHT>0</WEIGHT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<CONFIGDATA>Tjs=</CONFIGDATA>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</BLOCK>
|
||||
<BLOCK>
|
||||
<ID>315</ID>
|
||||
<NAME>activity_modules</NAME>
|
||||
<PAGEID>33</PAGEID>
|
||||
<PAGETYPE>course-view</PAGETYPE>
|
||||
<POSITION>l</POSITION>
|
||||
<WEIGHT>1</WEIGHT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<CONFIGDATA>Tjs=</CONFIGDATA>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</BLOCK>
|
||||
<BLOCK>
|
||||
<ID>316</ID>
|
||||
<NAME>search_forums</NAME>
|
||||
<PAGEID>33</PAGEID>
|
||||
<PAGETYPE>course-view</PAGETYPE>
|
||||
<POSITION>l</POSITION>
|
||||
<WEIGHT>2</WEIGHT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<CONFIGDATA>Tjs=</CONFIGDATA>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</BLOCK>
|
||||
<BLOCK>
|
||||
<ID>317</ID>
|
||||
<NAME>admin</NAME>
|
||||
<PAGEID>33</PAGEID>
|
||||
<PAGETYPE>course-view</PAGETYPE>
|
||||
<POSITION>l</POSITION>
|
||||
<WEIGHT>3</WEIGHT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<CONFIGDATA>Tjs=</CONFIGDATA>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</BLOCK>
|
||||
<BLOCK>
|
||||
<ID>318</ID>
|
||||
<NAME>course_list</NAME>
|
||||
<PAGEID>33</PAGEID>
|
||||
<PAGETYPE>course-view</PAGETYPE>
|
||||
<POSITION>l</POSITION>
|
||||
<WEIGHT>4</WEIGHT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<CONFIGDATA>Tjs=</CONFIGDATA>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</BLOCK>
|
||||
<BLOCK>
|
||||
<ID>319</ID>
|
||||
<NAME>news_items</NAME>
|
||||
<PAGEID>33</PAGEID>
|
||||
<PAGETYPE>course-view</PAGETYPE>
|
||||
<POSITION>r</POSITION>
|
||||
<WEIGHT>0</WEIGHT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<CONFIGDATA>Tjs=</CONFIGDATA>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</BLOCK>
|
||||
<BLOCK>
|
||||
<ID>320</ID>
|
||||
<NAME>calendar_upcoming</NAME>
|
||||
<PAGEID>33</PAGEID>
|
||||
<PAGETYPE>course-view</PAGETYPE>
|
||||
<POSITION>r</POSITION>
|
||||
<WEIGHT>1</WEIGHT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<CONFIGDATA>Tjs=</CONFIGDATA>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</BLOCK>
|
||||
<BLOCK>
|
||||
<ID>321</ID>
|
||||
<NAME>recent_activity</NAME>
|
||||
<PAGEID>33</PAGEID>
|
||||
<PAGETYPE>course-view</PAGETYPE>
|
||||
<POSITION>r</POSITION>
|
||||
<WEIGHT>2</WEIGHT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<CONFIGDATA>Tjs=</CONFIGDATA>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</BLOCK>
|
||||
</BLOCKS>
|
||||
<SECTIONS>
|
||||
<SECTION>
|
||||
<ID>436</ID>
|
||||
<NUMBER>0</NUMBER>
|
||||
<SUMMARY>$@NULL@$</SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<MODS>
|
||||
<MOD>
|
||||
<ID>250</ID>
|
||||
<TYPE>forum</TYPE>
|
||||
<INSTANCE>57</INSTANCE>
|
||||
<ADDED>1299773780</ADDED>
|
||||
<SCORE>0</SCORE>
|
||||
<INDENT>0</INDENT>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
<GROUPMODE>0</GROUPMODE>
|
||||
<GROUPINGID>0</GROUPINGID>
|
||||
<GROUPMEMBERSONLY>0</GROUPMEMBERSONLY>
|
||||
<IDNUMBER>$@NULL@$</IDNUMBER>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</MOD>
|
||||
</MODS>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>437</ID>
|
||||
<NUMBER>1</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>438</ID>
|
||||
<NUMBER>2</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>439</ID>
|
||||
<NUMBER>3</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>440</ID>
|
||||
<NUMBER>4</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>441</ID>
|
||||
<NUMBER>5</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>442</ID>
|
||||
<NUMBER>6</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>443</ID>
|
||||
<NUMBER>7</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>444</ID>
|
||||
<NUMBER>8</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>445</ID>
|
||||
<NUMBER>9</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
<ID>446</ID>
|
||||
<NUMBER>10</NUMBER>
|
||||
<SUMMARY></SUMMARY>
|
||||
<VISIBLE>1</VISIBLE>
|
||||
</SECTION>
|
||||
</SECTIONS>
|
||||
<USERS>
|
||||
<USER>
|
||||
<ID>2</ID>
|
||||
<AUTH>manual</AUTH>
|
||||
<CONFIRMED>1</CONFIRMED>
|
||||
<POLICYAGREED>0</POLICYAGREED>
|
||||
<DELETED>0</DELETED>
|
||||
<USERNAME>admin</USERNAME>
|
||||
<PASSWORD>ea557cf33bda866d97b07465f1ea3867</PASSWORD>
|
||||
<IDNUMBER>891220979</IDNUMBER>
|
||||
<FIRSTNAME>Admin</FIRSTNAME>
|
||||
<LASTNAME>User</LASTNAME>
|
||||
<EMAIL>adamzap@gmail.com</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
<YAHOO></YAHOO>
|
||||
<AIM></AIM>
|
||||
<MSN></MSN>
|
||||
<PHONE1></PHONE1>
|
||||
<PHONE2></PHONE2>
|
||||
<INSTITUTION></INSTITUTION>
|
||||
<DEPARTMENT></DEPARTMENT>
|
||||
<ADDRESS></ADDRESS>
|
||||
<CITY>br</CITY>
|
||||
<COUNTRY>US</COUNTRY>
|
||||
<LANG>en_utf8</LANG>
|
||||
<THEME></THEME>
|
||||
<TIMEZONE>99</TIMEZONE>
|
||||
<FIRSTACCESS>0</FIRSTACCESS>
|
||||
<LASTACCESS>1265755409</LASTACCESS>
|
||||
<LASTLOGIN>1265658108</LASTLOGIN>
|
||||
<CURRENTLOGIN>1265741271</CURRENTLOGIN>
|
||||
<LASTIP>130.39.194.172</LASTIP>
|
||||
<SECRET>lknsJoSw0S6myJA</SECRET>
|
||||
<PICTURE>1</PICTURE>
|
||||
<URL></URL>
|
||||
<DESCRIPTION></DESCRIPTION>
|
||||
<MAILFORMAT>1</MAILFORMAT>
|
||||
<MAILDIGEST>0</MAILDIGEST>
|
||||
<MAILDISPLAY>1</MAILDISPLAY>
|
||||
<HTMLEDITOR>1</HTMLEDITOR>
|
||||
<AJAX>1</AJAX>
|
||||
<AUTOSUBSCRIBE>1</AUTOSUBSCRIBE>
|
||||
<TRACKFORUMS>0</TRACKFORUMS>
|
||||
<TIMEMODIFIED>1265216036</TIMEMODIFIED>
|
||||
<ROLES>
|
||||
<ROLE>
|
||||
<TYPE>needed</TYPE>
|
||||
</ROLE>
|
||||
</ROLES>
|
||||
<USER_PREFERENCES>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>email_bounce_count</NAME>
|
||||
<VALUE>1</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>email_send_count</NAME>
|
||||
<VALUE>1</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>user_editadvanced_form_showadvanced</NAME>
|
||||
<VALUE>1</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
</USER_PREFERENCES>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</USER>
|
||||
<USER>
|
||||
<ID>3</ID>
|
||||
<AUTH>cas</AUTH>
|
||||
<CONFIRMED>1</CONFIRMED>
|
||||
<POLICYAGREED>0</POLICYAGREED>
|
||||
<DELETED>0</DELETED>
|
||||
<USERNAME>azaple1</USERNAME>
|
||||
<PASSWORD>fb005bdc5fb1b23ea95d238fb5ecb9e2</PASSWORD>
|
||||
<IDNUMBER>891111111</IDNUMBER>
|
||||
<FIRSTNAME>Adam</FIRSTNAME>
|
||||
<LASTNAME>Zapletal</LASTNAME>
|
||||
<EMAIL>azaple1@lsu.edu</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
<YAHOO></YAHOO>
|
||||
<AIM></AIM>
|
||||
<MSN></MSN>
|
||||
<PHONE1></PHONE1>
|
||||
<PHONE2></PHONE2>
|
||||
<INSTITUTION></INSTITUTION>
|
||||
<DEPARTMENT></DEPARTMENT>
|
||||
<ADDRESS></ADDRESS>
|
||||
<CITY>asdf</CITY>
|
||||
<COUNTRY>AL</COUNTRY>
|
||||
<LANG>en_utf8</LANG>
|
||||
<THEME></THEME>
|
||||
<TIMEZONE>99</TIMEZONE>
|
||||
<FIRSTACCESS>0</FIRSTACCESS>
|
||||
<LASTACCESS>1299774054</LASTACCESS>
|
||||
<LASTLOGIN>1297979000</LASTLOGIN>
|
||||
<CURRENTLOGIN>1299773727</CURRENTLOGIN>
|
||||
<LASTIP>173.253.129.223</LASTIP>
|
||||
<SECRET></SECRET>
|
||||
<PICTURE>1</PICTURE>
|
||||
<URL></URL>
|
||||
<DESCRIPTION></DESCRIPTION>
|
||||
<MAILFORMAT>1</MAILFORMAT>
|
||||
<MAILDIGEST>0</MAILDIGEST>
|
||||
<MAILDISPLAY>2</MAILDISPLAY>
|
||||
<HTMLEDITOR>1</HTMLEDITOR>
|
||||
<AJAX>1</AJAX>
|
||||
<AUTOSUBSCRIBE>1</AUTOSUBSCRIBE>
|
||||
<TRACKFORUMS>0</TRACKFORUMS>
|
||||
<TIMEMODIFIED>1288033285</TIMEMODIFIED>
|
||||
<ROLES>
|
||||
<ROLE>
|
||||
<TYPE>needed</TYPE>
|
||||
</ROLE>
|
||||
</ROLES>
|
||||
<USER_PREFERENCES>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>assignment_mailinfo</NAME>
|
||||
<VALUE>1</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>assignment_perpage</NAME>
|
||||
<VALUE>10</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>assignment_quickgrade</NAME>
|
||||
<VALUE>0</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>auth_forcepasswordchange</NAME>
|
||||
<VALUE>0</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>forum_displaymode</NAME>
|
||||
<VALUE>3</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>grader_report_preferences_form_showadvanced</NAME>
|
||||
<VALUE>1</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>grade_report_simple_aggregationview51</NAME>
|
||||
<VALUE>0</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>grade_report_simple_grader_collapsed_categories</NAME>
|
||||
<VALUE>a:2:{s:14:"aggregatesonly";a:4:{i:0;s:2:"70";i:1;s:2:"71";i:2;s:2:"72";i:3;s:2:"73";}s:10:"gradesonly";a:0:{}}</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>grade_report_simple_meanselection</NAME>
|
||||
<VALUE>2</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>grade_report_simple_showranges</NAME>
|
||||
<VALUE>1</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>grade_report_simple_showstickytab</NAME>
|
||||
<VALUE>0</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>lesson_view</NAME>
|
||||
<VALUE>collapsed</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>mod_resource_mod_form_showadvanced</NAME>
|
||||
<VALUE>1</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
<USER_PREFERENCE>
|
||||
<NAME>user_editadvanced_form_showadvanced</NAME>
|
||||
<VALUE>1</VALUE>
|
||||
</USER_PREFERENCE>
|
||||
</USER_PREFERENCES>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</USER>
|
||||
<USER>
|
||||
<ID>6</ID>
|
||||
<AUTH>cas</AUTH>
|
||||
<CONFIRMED>1</CONFIRMED>
|
||||
<POLICYAGREED>0</POLICYAGREED>
|
||||
<DELETED>0</DELETED>
|
||||
<USERNAME>pcali1</USERNAME>
|
||||
<PASSWORD>fb005bdc5fb1b23ea95d238fb5ecb9e2</PASSWORD>
|
||||
<IDNUMBER></IDNUMBER>
|
||||
<FIRSTNAME>Philip</FIRSTNAME>
|
||||
<LASTNAME>Cali</LASTNAME>
|
||||
<EMAIL>pcali1@lsu.edu</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
<YAHOO></YAHOO>
|
||||
<AIM></AIM>
|
||||
<MSN></MSN>
|
||||
<PHONE1></PHONE1>
|
||||
<PHONE2></PHONE2>
|
||||
<INSTITUTION></INSTITUTION>
|
||||
<DEPARTMENT></DEPARTMENT>
|
||||
<ADDRESS></ADDRESS>
|
||||
<CITY></CITY>
|
||||
<COUNTRY></COUNTRY>
|
||||
<LANG>en_utf8</LANG>
|
||||
<THEME></THEME>
|
||||
<TIMEZONE>99</TIMEZONE>
|
||||
<FIRSTACCESS>0</FIRSTACCESS>
|
||||
<LASTACCESS>1268662392</LASTACCESS>
|
||||
<LASTLOGIN>0</LASTLOGIN>
|
||||
<CURRENTLOGIN>1268662284</CURRENTLOGIN>
|
||||
<LASTIP>68.105.37.237</LASTIP>
|
||||
<SECRET></SECRET>
|
||||
<PICTURE>1</PICTURE>
|
||||
<URL></URL>
|
||||
<DESCRIPTION>$@NULL@$</DESCRIPTION>
|
||||
<MAILFORMAT>1</MAILFORMAT>
|
||||
<MAILDIGEST>0</MAILDIGEST>
|
||||
<MAILDISPLAY>2</MAILDISPLAY>
|
||||
<HTMLEDITOR>1</HTMLEDITOR>
|
||||
<AJAX>1</AJAX>
|
||||
<AUTOSUBSCRIBE>1</AUTOSUBSCRIBE>
|
||||
<TRACKFORUMS>0</TRACKFORUMS>
|
||||
<TIMEMODIFIED>1268662284</TIMEMODIFIED>
|
||||
<ROLES>
|
||||
<ROLE>
|
||||
<TYPE>needed</TYPE>
|
||||
</ROLE>
|
||||
</ROLES>
|
||||
<ROLES_OVERRIDES>
|
||||
</ROLES_OVERRIDES>
|
||||
<ROLES_ASSIGNMENTS>
|
||||
</ROLES_ASSIGNMENTS>
|
||||
</USER>
|
||||
</USERS>
|
||||
<GRADEBOOK>
|
||||
<GRADE_CATEGORIES>
|
||||
<GRADE_CATEGORY>
|
||||
<ID>90</ID>
|
||||
<PARENT>$@NULL@$</PARENT>
|
||||
<FULLNAME>?</FULLNAME>
|
||||
<AGGREGATION>11</AGGREGATION>
|
||||
<KEEPHIGH>0</KEEPHIGH>
|
||||
<DROPLOW>0</DROPLOW>
|
||||
<AGGREGATEONLYGRADED>1</AGGREGATEONLYGRADED>
|
||||
<AGGREGATEOUTCOMES>0</AGGREGATEOUTCOMES>
|
||||
<AGGREGATESUBCATS>0</AGGREGATESUBCATS>
|
||||
<TIMECREATED>1299774068</TIMECREATED>
|
||||
<TIMEMODIFIED>1299774068</TIMEMODIFIED>
|
||||
</GRADE_CATEGORY>
|
||||
</GRADE_CATEGORIES>
|
||||
<GRADE_ITEMS>
|
||||
<GRADE_ITEM>
|
||||
<ID>410</ID>
|
||||
<CATEGORYID>$@NULL@$</CATEGORYID>
|
||||
<ITEMNAME>$@NULL@$</ITEMNAME>
|
||||
<ITEMTYPE>course</ITEMTYPE>
|
||||
<ITEMMODULE>$@NULL@$</ITEMMODULE>
|
||||
<ITEMINSTANCE>90</ITEMINSTANCE>
|
||||
<ITEMNUMBER>$@NULL@$</ITEMNUMBER>
|
||||
<ITEMINFO>$@NULL@$</ITEMINFO>
|
||||
<IDNUMBER>$@NULL@$</IDNUMBER>
|
||||
<CALCULATION>$@NULL@$</CALCULATION>
|
||||
<GRADETYPE>1</GRADETYPE>
|
||||
<GRADEMAX>100.00000</GRADEMAX>
|
||||
<GRADEMIN>0.00000</GRADEMIN>
|
||||
<SCALEID>$@NULL@$</SCALEID>
|
||||
<OUTCOMEID>$@NULL@$</OUTCOMEID>
|
||||
<GRADEPASS>0.00000</GRADEPASS>
|
||||
<MULTFACTOR>1.00000</MULTFACTOR>
|
||||
<PLUSFACTOR>0.00000</PLUSFACTOR>
|
||||
<AGGREGATIONCOEF>1.00000</AGGREGATIONCOEF>
|
||||
<DISPLAY>0</DISPLAY>
|
||||
<DECIMALS>$@NULL@$</DECIMALS>
|
||||
<HIDDEN>0</HIDDEN>
|
||||
<LOCKED>0</LOCKED>
|
||||
<LOCKTIME>0</LOCKTIME>
|
||||
<NEEDSUPDATE>0</NEEDSUPDATE>
|
||||
<TIMECREATED>1299774068</TIMECREATED>
|
||||
<TIMEMODIFIED>1299774068</TIMEMODIFIED>
|
||||
</GRADE_ITEM>
|
||||
</GRADE_ITEMS>
|
||||
</GRADEBOOK>
|
||||
<MODULES>
|
||||
<MOD>
|
||||
<ID>57</ID>
|
||||
<MODTYPE>forum</MODTYPE>
|
||||
<TYPE>news</TYPE>
|
||||
<NAME>News forum</NAME>
|
||||
<INTRO>General news and announcements</INTRO>
|
||||
<ASSESSED>0</ASSESSED>
|
||||
<ASSESSTIMESTART>0</ASSESSTIMESTART>
|
||||
<ASSESSTIMEFINISH>0</ASSESSTIMEFINISH>
|
||||
<MAXBYTES>0</MAXBYTES>
|
||||
<SCALE>0</SCALE>
|
||||
<FORCESUBSCRIBE>1</FORCESUBSCRIBE>
|
||||
<TRACKINGTYPE>1</TRACKINGTYPE>
|
||||
<RSSTYPE>0</RSSTYPE>
|
||||
<RSSARTICLES>0</RSSARTICLES>
|
||||
<TIMEMODIFIED>1299773780</TIMEMODIFIED>
|
||||
<WARNAFTER>0</WARNAFTER>
|
||||
<BLOCKAFTER>0</BLOCKAFTER>
|
||||
<BLOCKPERIOD>0</BLOCKPERIOD>
|
||||
</MOD>
|
||||
</MODULES>
|
||||
<FORMATDATA>
|
||||
</FORMATDATA>
|
||||
</COURSE>
|
||||
</MOODLE_BACKUP>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,476 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Unit tests for the moodle1 converter
|
||||
*
|
||||
* @package core
|
||||
* @subpackage backup-convert
|
||||
* @copyright 2011 Mark Nielsen <mark@moodlerooms.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot . '/backup/converter/moodle1/lib.php');
|
||||
|
||||
class moodle1_converter_test extends UnitTestCase {
|
||||
|
||||
public static $includecoverage = array();
|
||||
|
||||
/** @var string the name of the directory containing the unpacked Moodle 1.9 backup */
|
||||
protected $tempdir;
|
||||
|
||||
public function setUp() {
|
||||
global $CFG;
|
||||
|
||||
$this->tempdir = convert_helper::generate_id('simpletest');
|
||||
check_dir_exists("$CFG->dataroot/temp/backup/$this->tempdir/course_files/sub1");
|
||||
check_dir_exists("$CFG->dataroot/temp/backup/$this->tempdir/moddata/unittest/4/7");
|
||||
copy(
|
||||
"$CFG->dirroot/backup/converter/moodle1/simpletest/files/moodle.xml",
|
||||
"$CFG->dataroot/temp/backup/$this->tempdir/moodle.xml"
|
||||
);
|
||||
copy(
|
||||
"$CFG->dirroot/backup/converter/moodle1/simpletest/files/icon.gif",
|
||||
"$CFG->dataroot/temp/backup/$this->tempdir/course_files/file1.gif"
|
||||
);
|
||||
copy(
|
||||
"$CFG->dirroot/backup/converter/moodle1/simpletest/files/icon.gif",
|
||||
"$CFG->dataroot/temp/backup/$this->tempdir/course_files/sub1/file2.gif"
|
||||
);
|
||||
copy(
|
||||
"$CFG->dirroot/backup/converter/moodle1/simpletest/files/icon.gif",
|
||||
"$CFG->dataroot/temp/backup/$this->tempdir/moddata/unittest/4/file1.gif"
|
||||
);
|
||||
copy(
|
||||
"$CFG->dirroot/backup/converter/moodle1/simpletest/files/icon.gif",
|
||||
"$CFG->dataroot/temp/backup/$this->tempdir/moddata/unittest/4/icon.gif"
|
||||
);
|
||||
copy(
|
||||
"$CFG->dirroot/backup/converter/moodle1/simpletest/files/icon.gif",
|
||||
"$CFG->dataroot/temp/backup/$this->tempdir/moddata/unittest/4/7/icon.gif"
|
||||
);
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
global $CFG;
|
||||
if (empty($CFG->keeptempdirectoriesonbackup)) {
|
||||
fulldelete("$CFG->dataroot/temp/backup/$this->tempdir");
|
||||
}
|
||||
}
|
||||
|
||||
public function test_detect_format() {
|
||||
$detected = moodle1_converter::detect_format($this->tempdir);
|
||||
$this->assertEqual(backup::FORMAT_MOODLE1, $detected);
|
||||
}
|
||||
|
||||
public function test_convert_factory() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$this->assertIsA($converter, 'moodle1_converter');
|
||||
}
|
||||
|
||||
public function test_stash_storage_not_created() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$this->expectException('moodle1_convert_storage_exception');
|
||||
$converter->set_stash('tempinfo', 12);
|
||||
}
|
||||
|
||||
public function test_stash_requiring_empty_stash() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->create_stash_storage();
|
||||
$converter->set_stash('tempinfo', 12);
|
||||
$this->expectException('moodle1_convert_empty_storage_exception');
|
||||
try {
|
||||
$converter->get_stash('anothertempinfo');
|
||||
|
||||
} catch (moodle1_convert_empty_storage_exception $e) {
|
||||
// we must drop the storage here so we are able to re-create it in the next test
|
||||
$converter->drop_stash_storage();
|
||||
throw new moodle1_convert_empty_storage_exception('rethrowing');
|
||||
}
|
||||
}
|
||||
|
||||
public function test_stash_storage() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->create_stash_storage();
|
||||
|
||||
// no implicit stashes
|
||||
$stashes = $converter->get_stash_names();
|
||||
$this->assertIsA($stashes, 'array');
|
||||
$this->assertTrue(empty($stashes));
|
||||
|
||||
// test stashes without itemid
|
||||
$converter->set_stash('tempinfo1', 12);
|
||||
$converter->set_stash('tempinfo2', array('a' => 2, 'b' => 3));
|
||||
$stashes = $converter->get_stash_names();
|
||||
$this->assertIsA($stashes, 'array');
|
||||
$this->assertEqual(2, count($stashes));
|
||||
$this->assertTrue(in_array('tempinfo1', $stashes));
|
||||
$this->assertTrue(in_array('tempinfo2', $stashes));
|
||||
$this->assertIdentical(12, $converter->get_stash('tempinfo1'));
|
||||
$this->assertIdentical(array('a' => 2, 'b' => 3), $converter->get_stash('tempinfo2'));
|
||||
|
||||
// overwriting a stashed value is allowed
|
||||
$converter->set_stash('tempinfo1', '13');
|
||||
$this->assertNotIdentical(13, $converter->get_stash('tempinfo1'));
|
||||
$this->assertIdentical('13', $converter->get_stash('tempinfo1'));
|
||||
|
||||
// repeated reading is allowed
|
||||
$this->assertIdentical('13', $converter->get_stash('tempinfo1'));
|
||||
|
||||
// storing empty array
|
||||
$converter->set_stash('empty_array_stash', array());
|
||||
$restored = $converter->get_stash('empty_array_stash');
|
||||
//$this->assertIsA($restored, 'array'); // todo return null now, this needs MDL-27713 to be fixed, then uncomment
|
||||
$this->assertTrue(empty($restored));
|
||||
|
||||
// test stashes with itemid
|
||||
$converter->set_stash('tempinfo', 'Hello', 1);
|
||||
$converter->set_stash('tempinfo', 'World', 2);
|
||||
$this->assertIdentical('Hello', $converter->get_stash('tempinfo', 1));
|
||||
$this->assertIdentical('World', $converter->get_stash('tempinfo', 2));
|
||||
|
||||
// test get_stash_itemids()
|
||||
$ids = $converter->get_stash_itemids('course_fileref');
|
||||
$this->assertIsA($ids, 'array');
|
||||
$this->assertTrue(empty($ids));
|
||||
|
||||
$converter->set_stash('course_fileref', null, 34);
|
||||
$converter->set_stash('course_fileref', null, 52);
|
||||
$ids = $converter->get_stash_itemids('course_fileref');
|
||||
$this->assertEqual(2, count($ids));
|
||||
$this->assertTrue(in_array(34, $ids));
|
||||
$this->assertTrue(in_array(52, $ids));
|
||||
|
||||
$converter->drop_stash_storage();
|
||||
}
|
||||
|
||||
public function test_get_stash_or_default() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->create_stash_storage();
|
||||
|
||||
$this->assertTrue(is_null($converter->get_stash_or_default('stashname')));
|
||||
$this->assertTrue(is_null($converter->get_stash_or_default('stashname', 7)));
|
||||
$this->assertTrue('default' === $converter->get_stash_or_default('stashname', 0, 'default'));
|
||||
$this->assertTrue(array('foo', 'bar') === $converter->get_stash_or_default('stashname', 42, array('foo', 'bar')));
|
||||
|
||||
//$converter->set_stash('stashname', 0);
|
||||
//$this->assertFalse(is_null($converter->get_stash_or_default('stashname'))); // todo returns true now, this needs MDL-27713 to be fixed
|
||||
|
||||
//$converter->set_stash('stashname', '');
|
||||
//$this->assertFalse(is_null($converter->get_stash_or_default('stashname'))); // todo returns true now, this needs MDL-27713 to be fixed
|
||||
|
||||
//$converter->set_stash('stashname', array());
|
||||
//$this->assertFalse(is_null($converter->get_stash_or_default('stashname'))); // todo returns true now, this needs MDL-27713 to be fixed
|
||||
|
||||
$converter->set_stash('stashname', 42);
|
||||
$this->assertTrue(42 === $converter->get_stash_or_default('stashname'));
|
||||
$this->assertTrue(is_null($converter->get_stash_or_default('stashname', 1)));
|
||||
$this->assertTrue(42 === $converter->get_stash_or_default('stashname', 0, 61));
|
||||
|
||||
$converter->set_stash('stashname', array(42 => (object)array('id' => 42)), 18);
|
||||
$stashed = $converter->get_stash_or_default('stashname', 18, 1984);
|
||||
$this->assertIsA($stashed, 'array');
|
||||
$this->assertTrue(is_object($stashed[42]));
|
||||
$this->assertTrue($stashed[42]->id === 42);
|
||||
|
||||
$converter->drop_stash_storage();
|
||||
}
|
||||
|
||||
public function test_get_contextid() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
|
||||
// stash storage must be created in advance
|
||||
$converter->create_stash_storage();
|
||||
|
||||
// ids are generated on the first call
|
||||
$id1 = $converter->get_contextid(CONTEXT_BLOCK, 10);
|
||||
$id2 = $converter->get_contextid(CONTEXT_BLOCK, 11);
|
||||
$id3 = $converter->get_contextid(CONTEXT_MODULE, 10);
|
||||
|
||||
$this->assertNotEqual($id1, $id2);
|
||||
$this->assertNotEqual($id1, $id3);
|
||||
$this->assertNotEqual($id2, $id3);
|
||||
|
||||
// and then re-used if called with the same params
|
||||
$this->assertEqual($id1, $converter->get_contextid(CONTEXT_BLOCK, 10));
|
||||
$this->assertEqual($id2, $converter->get_contextid(CONTEXT_BLOCK, 11));
|
||||
$this->assertEqual($id3, $converter->get_contextid(CONTEXT_MODULE, 10));
|
||||
|
||||
// for system and course level, the instance is irrelevant
|
||||
// as we need only one system and one course
|
||||
$id1 = $converter->get_contextid(CONTEXT_COURSE);
|
||||
$id2 = $converter->get_contextid(CONTEXT_COURSE, 10);
|
||||
$id3 = $converter->get_contextid(CONTEXT_COURSE, 14);
|
||||
|
||||
$this->assertEqual($id1, $id2);
|
||||
$this->assertEqual($id1, $id3);
|
||||
|
||||
$id1 = $converter->get_contextid(CONTEXT_SYSTEM);
|
||||
$id2 = $converter->get_contextid(CONTEXT_SYSTEM, 11);
|
||||
$id3 = $converter->get_contextid(CONTEXT_SYSTEM, 15);
|
||||
|
||||
$this->assertEqual($id1, $id2);
|
||||
$this->assertEqual($id1, $id3);
|
||||
|
||||
$converter->drop_stash_storage();
|
||||
}
|
||||
|
||||
public function test_get_nextid() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
|
||||
$id1 = $converter->get_nextid();
|
||||
$id2 = $converter->get_nextid();
|
||||
$id3 = $converter->get_nextid();
|
||||
|
||||
$this->assertTrue(0 < $id1);
|
||||
$this->assertTrue($id1 < $id2);
|
||||
$this->assertTrue($id2 < $id3);
|
||||
}
|
||||
|
||||
public function test_migrate_file() {
|
||||
// set-up the file manager
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->create_stash_storage();
|
||||
$contextid = $converter->get_contextid(CONTEXT_MODULE, 32);
|
||||
$fileman = $converter->get_file_manager($contextid, 'mod_unittest', 'testarea');
|
||||
// this fileman has not converted anything yet
|
||||
$fileids = $fileman->get_fileids();
|
||||
$this->assertIsA($fileids, 'array');
|
||||
$this->assertEqual(0, count($fileids));
|
||||
// try to migrate a non-existing directory
|
||||
$returned = $fileman->migrate_directory('not/existing/directory');
|
||||
$this->assertIsA($returned, 'array');
|
||||
$this->assertEqual(0, count($returned));
|
||||
$fileids = $fileman->get_fileids();
|
||||
$this->assertIsA($fileids, 'array');
|
||||
$this->assertEqual(0, count($fileids));
|
||||
// try to migrate an invalid file
|
||||
$fileman->itemid = 1;
|
||||
$thrown = false;
|
||||
try {
|
||||
$fileman->migrate_file('/../../../../../../../../../../../../../../etc/passwd');
|
||||
} catch (moodle1_convert_exception $e) {
|
||||
$thrown = true;
|
||||
}
|
||||
$this->assertTrue($thrown);
|
||||
// migrate a single file
|
||||
$fileman->itemid = 4;
|
||||
$fileman->migrate_file('moddata/unittest/4/icon.gif');
|
||||
$this->assertTrue(is_file($converter->get_workdir_path().'/files/4e/4ea114b0558f53e3af8dd9afc0e0810a95c2a724'));
|
||||
// get the file id
|
||||
$fileids = $fileman->get_fileids();
|
||||
$this->assertIsA($fileids, 'array');
|
||||
$this->assertEqual(1, count($fileids));
|
||||
// migrate another single file into another file area
|
||||
$fileman->filearea = 'anotherarea';
|
||||
$fileman->itemid = 7;
|
||||
$fileman->migrate_file('moddata/unittest/4/7/icon.gif', '/', 'renamed.gif');
|
||||
// get the file records
|
||||
$filerecordids = $converter->get_stash_itemids('files');
|
||||
foreach ($filerecordids as $filerecordid) {
|
||||
$filerecord = $converter->get_stash('files', $filerecordid);
|
||||
$this->assertEqual('4ea114b0558f53e3af8dd9afc0e0810a95c2a724', $filerecord['contenthash']);
|
||||
$this->assertEqual($contextid, $filerecord['contextid']);
|
||||
$this->assertEqual('mod_unittest', $filerecord['component']);
|
||||
if ($filerecord['filearea'] === 'testarea') {
|
||||
$this->assertEqual(4, $filerecord['itemid']);
|
||||
$this->assertEqual('icon.gif', $filerecord['filename']);
|
||||
}
|
||||
}
|
||||
// explicitly clear the list of migrated files
|
||||
$this->assertTrue(count($fileman->get_fileids()) > 0);
|
||||
$fileman->reset_fileids();
|
||||
$this->assertTrue(count($fileman->get_fileids()) == 0);
|
||||
$converter->drop_stash_storage();
|
||||
}
|
||||
|
||||
public function test_convert_path() {
|
||||
$path = new convert_path('foo_bar', '/ROOT/THINGS/FOO/BAR');
|
||||
$this->assertEqual('foo_bar', $path->get_name());
|
||||
$this->assertEqual('/ROOT/THINGS/FOO/BAR', $path->get_path());
|
||||
$this->assertEqual('process_foo_bar', $path->get_processing_method());
|
||||
$this->assertEqual('on_foo_bar_start', $path->get_start_method());
|
||||
$this->assertEqual('on_foo_bar_end', $path->get_end_method());
|
||||
}
|
||||
|
||||
public function test_convert_path_implicit_recipes() {
|
||||
$path = new convert_path('foo_bar', '/ROOT/THINGS/FOO/BAR');
|
||||
$data = array(
|
||||
'ID' => 76,
|
||||
'ELOY' => 'stronk7',
|
||||
'MARTIN' => 'moodler',
|
||||
'EMPTY' => null,
|
||||
);
|
||||
// apply default recipes (converting keys to lowercase)
|
||||
$data = $path->apply_recipes($data);
|
||||
$this->assertEqual(4, count($data));
|
||||
$this->assertEqual(76, $data['id']);
|
||||
$this->assertEqual('stronk7', $data['eloy']);
|
||||
$this->assertEqual('moodler', $data['martin']);
|
||||
$this->assertIdentical(null, $data['empty']);
|
||||
}
|
||||
|
||||
public function test_convert_path_explicit_recipes() {
|
||||
$path = new convert_path(
|
||||
'foo_bar', '/ROOT/THINGS/FOO/BAR',
|
||||
array(
|
||||
'newfields' => array(
|
||||
'david' => 'mudrd8mz',
|
||||
'petr' => 'skodak',
|
||||
),
|
||||
'renamefields' => array(
|
||||
'empty' => 'nothing',
|
||||
),
|
||||
'dropfields' => array(
|
||||
'id'
|
||||
),
|
||||
)
|
||||
);
|
||||
$data = array(
|
||||
'ID' => 76,
|
||||
'ELOY' => 'stronk7',
|
||||
'MARTIN' => 'moodler',
|
||||
'EMPTY' => null,
|
||||
);
|
||||
$data = $path->apply_recipes($data);
|
||||
|
||||
$this->assertEqual(5, count($data));
|
||||
$this->assertFalse(array_key_exists('id', $data));
|
||||
$this->assertEqual('stronk7', $data['eloy']);
|
||||
$this->assertEqual('moodler', $data['martin']);
|
||||
$this->assertEqual('mudrd8mz', $data['david']);
|
||||
$this->assertEqual('skodak', $data['petr']);
|
||||
$this->assertIdentical(null, $data['nothing']);
|
||||
}
|
||||
|
||||
public function test_grouped_data_on_nongrouped_convert_path() {
|
||||
// prepare some grouped data
|
||||
$data = array(
|
||||
'ID' => 77,
|
||||
'NAME' => 'Pale lagers',
|
||||
'BEERS' => array(
|
||||
array(
|
||||
'BEER' => array(
|
||||
'ID' => 67,
|
||||
'NAME' => 'Pilsner Urquell',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'BEER' => array(
|
||||
'ID' => 34,
|
||||
'NAME' => 'Heineken',
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// declare a non-grouped path
|
||||
$path = new convert_path('beer_style', '/ROOT/BEER_STYLES/BEER_STYLE');
|
||||
|
||||
// an attempt to apply recipes throws exception because we do not expect grouped data
|
||||
$this->expectException('convert_path_exception');
|
||||
$data = $path->apply_recipes($data);
|
||||
}
|
||||
|
||||
public function test_grouped_convert_path_with_recipes() {
|
||||
// prepare some grouped data
|
||||
$data = array(
|
||||
'ID' => 77,
|
||||
'NAME' => 'Pale lagers',
|
||||
'BEERS' => array(
|
||||
array(
|
||||
'BEER' => array(
|
||||
'ID' => 67,
|
||||
'NAME' => 'Pilsner Urquell',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'BEER' => array(
|
||||
'ID' => 34,
|
||||
'NAME' => 'Heineken',
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// implict recipes work for grouped data if the path is declared as grouped
|
||||
$path = new convert_path('beer_style', '/ROOT/BEER_STYLES/BEER_STYLE', array(), true);
|
||||
$data = $path->apply_recipes($data);
|
||||
$this->assertEqual('Heineken', $data['beers'][1]['beer']['name']);
|
||||
|
||||
// an attempt to provide explicit recipes on grouped elements throws exception
|
||||
$this->expectException('convert_path_exception');
|
||||
$path = new convert_path(
|
||||
'beer_style', '/ROOT/BEER_STYLES/BEER_STYLE',
|
||||
array(
|
||||
'renamefields' => array(
|
||||
'name' => 'beername', // note this is confusing recipe because the 'name' is used for both
|
||||
// beer-style name ('Pale lagers') and beer name ('Pilsner Urquell')
|
||||
)
|
||||
), true);
|
||||
}
|
||||
|
||||
public function test_referenced_course_files() {
|
||||
|
||||
$text = 'This is a text containing links to file.php
|
||||
as it is parsed from the backup file. <br /><br /><img border="0" width="110" vspace="0" hspace="0" height="92" title="News" alt="News" src="$@FILEPHP@$$@SLASH@$pics$@SLASH@$news.gif" /><a href="$@FILEPHP@$$@SLASH@$pics$@SLASH@$news.gif$@FORCEDOWNLOAD@$">download image</a><br />
|
||||
<div><a href=\'$@FILEPHP@$/../../../../../../../../../../../../../../../etc/passwd\'>download passwords</a></div>
|
||||
<div><a href=\'$@FILEPHP@$$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$etc$@SLASH@$shadow\'>download shadows</a></div>
|
||||
<br /><a href=\'$@FILEPHP@$$@SLASH@$MANUAL.DOC$@FORCEDOWNLOAD@$\'>download manual</a><br />';
|
||||
|
||||
$files = moodle1_converter::find_referenced_files($text);
|
||||
$this->assertIsA($files, 'array');
|
||||
$this->assertEqual(2, count($files));
|
||||
$this->assertTrue(in_array('/pics/news.gif', $files));
|
||||
$this->assertTrue(in_array('/MANUAL.DOC', $files));
|
||||
|
||||
$text = moodle1_converter::rewrite_filephp_usage($text, array('/pics/news.gif', '/another/file/notused.txt'), $files);
|
||||
$this->assertEqual($text, 'This is a text containing links to file.php
|
||||
as it is parsed from the backup file. <br /><br /><img border="0" width="110" vspace="0" hspace="0" height="92" title="News" alt="News" src="@@PLUGINFILE@@/pics/news.gif" /><a href="@@PLUGINFILE@@/pics/news.gif?forcedownload=1">download image</a><br />
|
||||
<div><a href=\'$@FILEPHP@$/../../../../../../../../../../../../../../../etc/passwd\'>download passwords</a></div>
|
||||
<div><a href=\'$@FILEPHP@$$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$..$@SLASH@$etc$@SLASH@$shadow\'>download shadows</a></div>
|
||||
<br /><a href=\'$@FILEPHP@$$@SLASH@$MANUAL.DOC$@FORCEDOWNLOAD@$\'>download manual</a><br />');
|
||||
}
|
||||
|
||||
public function test_question_bank_conversion() {
|
||||
global $CFG;
|
||||
|
||||
copy(
|
||||
"$CFG->dirroot/backup/converter/moodle1/simpletest/files/questions.xml",
|
||||
"$CFG->dataroot/temp/backup/$this->tempdir/moodle.xml"
|
||||
);
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->convert();
|
||||
}
|
||||
|
||||
public function test_convert_run_convert() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->convert();
|
||||
}
|
||||
|
||||
public function test_inforef_manager() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$inforef = $converter->get_inforef_manager('unittest');
|
||||
$inforef->add_ref('file', 45);
|
||||
$inforef->add_refs('file', array(46, 47));
|
||||
// todo test the write_refs() via some dummy xml_writer
|
||||
$this->expectException('coding_exception');
|
||||
$inforef->add_ref('unknown_referenced_item_name', 76);
|
||||
}
|
||||
}
|
||||
@@ -142,11 +142,6 @@ abstract class backup_activity_task extends backup_task {
|
||||
$this->add_step(new backup_activity_logs_structure_step('activity_logs', 'logs.xml'));
|
||||
}
|
||||
|
||||
// Generate the calendar events file (conditionally)
|
||||
if ($this->get_setting_value('calendarevents')) {
|
||||
$this->add_step(new backup_calendarevents_structure_step('activity_calendar', 'calendar.xml'));
|
||||
}
|
||||
|
||||
// Fetch all the activity grade items and put them to backup_ids
|
||||
$this->add_step(new backup_activity_grade_items_to_ids('fetch_activity_grade_items'));
|
||||
|
||||
|
||||
@@ -72,10 +72,8 @@ class backup_course_task extends backup_task {
|
||||
// annotating some bits, tags and module restrictions
|
||||
$this->add_step(new backup_course_structure_step('course_info', 'course.xml'));
|
||||
|
||||
// Generate the enrolment file (conditionally, prevent it in any IMPORT/HUB operation)
|
||||
if ($this->plan->get_mode() != backup::MODE_IMPORT && $this->plan->get_mode() != backup::MODE_HUB) {
|
||||
$this->add_step(new backup_enrolments_structure_step('course_enrolments', 'enrolments.xml'));
|
||||
}
|
||||
// Generate the enrolment file
|
||||
$this->add_step(new backup_enrolments_structure_step('course_enrolments', 'enrolments.xml'));
|
||||
|
||||
// Annotate all the groups and groupings belonging to the course
|
||||
$this->add_step(new backup_annotate_course_groups_and_groupings('annotate_course_groups'));
|
||||
@@ -103,11 +101,6 @@ class backup_course_task extends backup_task {
|
||||
$this->add_step(new backup_comments_structure_step('course_comments', 'comments.xml'));
|
||||
}
|
||||
|
||||
// Generate the calender events file (conditionally)
|
||||
if ($this->get_setting_value('calendarevents')) {
|
||||
$this->add_step(new backup_calendarevents_structure_step('course_calendar', 'calendar.xml'));
|
||||
}
|
||||
|
||||
// Generate the logs file (conditionally)
|
||||
if ($this->get_setting_value('logs')) {
|
||||
$this->add_step(new backup_course_logs_structure_step('course_logs', 'logs.xml'));
|
||||
|
||||
@@ -58,7 +58,7 @@ class backup_final_task extends backup_task {
|
||||
// done in a single pass
|
||||
$this->add_step(new backup_annotate_all_question_files('question_files'));
|
||||
|
||||
// Annotate all the user files (conditionally) (profile and icon files)
|
||||
// Annotate all the user files (conditionally) (private, profile and icon files)
|
||||
// Because each user has its own context, we need a separate/specialised step here
|
||||
// This step also ensures that the contexts for all the users exist, so next
|
||||
// step can be safely executed (join between users and contexts)
|
||||
|
||||
@@ -121,23 +121,12 @@ abstract class backup_plan_builder {
|
||||
|
||||
// Add the activity task, responsible for outputting
|
||||
// all the module related information
|
||||
try {
|
||||
$plan->add_task(backup_factory::get_backup_activity_task($controller->get_format(), $id));
|
||||
$plan->add_task(backup_factory::get_backup_activity_task($controller->get_format(), $id));
|
||||
|
||||
// For the given activity, add as many block tasks as necessary
|
||||
$blockids = backup_plan_dbops::get_blockids_from_moduleid($id);
|
||||
foreach ($blockids as $blockid) {
|
||||
try {
|
||||
$plan->add_task(backup_factory::get_backup_block_task($controller->get_format(), $blockid, $id));
|
||||
} catch (backup_task_exception $e) {
|
||||
$a = stdClass();
|
||||
$a->mid = $id;
|
||||
$a->bid = $blockid;
|
||||
$controller->log(get_string('error_block_for_module_not_found', 'backup', $a), backup::LOG_WARNING);
|
||||
}
|
||||
}
|
||||
} catch (backup_task_exception $e) {
|
||||
$controller->log(get_string('error_course_module_not_found', 'backup', $id), backup::LOG_WARNING);
|
||||
// For the given activity, add as many block tasks as necessary
|
||||
$blockids = backup_plan_dbops::get_blockids_from_moduleid($id);
|
||||
foreach ($blockids as $blockid) {
|
||||
$plan->add_task(backup_factory::get_backup_block_task($controller->get_format(), $blockid, $id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,8 @@ abstract class backup_qtype_plugin extends backup_plugin {
|
||||
// Define the elements
|
||||
$options = new backup_nested_element('numerical_options');
|
||||
$option = new backup_nested_element('numerical_option', array('id'), array(
|
||||
'showunits', 'unitsleft', 'unitgradingtype', 'unitpenalty'));
|
||||
'instructions', 'instructionsformat', 'showunits', 'unitsleft',
|
||||
'unitgradingtype', 'unitpenalty'));
|
||||
|
||||
// Build the tree
|
||||
$element->add_child($options);
|
||||
|
||||
@@ -69,6 +69,13 @@ class backup_root_task extends backup_task {
|
||||
$this->add_setting($roleassignments);
|
||||
$users->add_dependency($roleassignments);
|
||||
|
||||
// Define user_files (dependent of users and anonymize)
|
||||
$userfiles = new backup_user_files_setting('user_files', base_setting::IS_BOOLEAN, true);
|
||||
$userfiles->set_ui(new backup_setting_ui_checkbox($userfiles, get_string('rootsettinguserfiles', 'backup')));
|
||||
$this->add_setting($userfiles);
|
||||
$users->add_dependency($userfiles);
|
||||
$anonymize->add_dependency($userfiles, setting_dependency::DISABLED_TRUE);
|
||||
|
||||
// Define activities
|
||||
$activities = new backup_activities_setting('activities', base_setting::IS_BOOLEAN, true);
|
||||
$activities->set_ui(new backup_setting_ui_checkbox($activities, get_string('rootsettingactivities', 'backup')));
|
||||
@@ -90,12 +97,6 @@ class backup_root_task extends backup_task {
|
||||
$this->add_setting($comments);
|
||||
$users->add_dependency($comments);
|
||||
|
||||
// Define calendar events (dependent of users)
|
||||
$events = new backup_calendarevents_setting('calendarevents', base_setting::IS_BOOLEAN, true);
|
||||
$events->set_ui(new backup_setting_ui_checkbox($events, get_string('rootsettingcalendarevents', 'backup')));
|
||||
$this->add_setting($events);
|
||||
$users->add_dependency($events);
|
||||
|
||||
// Define completion (dependent of users)
|
||||
$completion = new backup_userscompletion_setting('userscompletion', base_setting::IS_BOOLEAN, true);
|
||||
$completion->set_ui(new backup_setting_ui_checkbox($completion, get_string('rootsettinguserscompletion', 'backup')));
|
||||
|
||||
@@ -68,6 +68,13 @@ class backup_activities_setting extends backup_generic_setting {}
|
||||
*/
|
||||
class backup_anonymize_setting extends root_backup_setting {}
|
||||
|
||||
/**
|
||||
* root setting to control if backup will include
|
||||
* user files or no (images, local storage), depends of @backup_users_setting
|
||||
* exactly in the same way than @backup_anonymize_setting so we extend from it
|
||||
*/
|
||||
class backup_user_files_setting extends backup_anonymize_setting {}
|
||||
|
||||
/**
|
||||
* root setting to control if backup will include
|
||||
* role assignments or no (any level), depends of @backup_users_setting
|
||||
@@ -89,13 +96,6 @@ class backup_logs_setting extends backup_anonymize_setting {}
|
||||
*/
|
||||
class backup_comments_setting extends backup_anonymize_setting {}
|
||||
|
||||
/**
|
||||
* root setting to control if backup will include
|
||||
* calender events or no (any level), depends of @backup_users_setting
|
||||
* exactly in the same way than @backup_anonymize_setting so we extend from it
|
||||
*/
|
||||
class backup_calendarevents_setting extends backup_anonymize_setting {}
|
||||
|
||||
/**
|
||||
* root setting to control if backup will include
|
||||
* users completion data or no (any level), depends of @backup_users_setting
|
||||
|
||||
@@ -174,76 +174,78 @@ abstract class backup_questions_activity_structure_step extends backup_activity_
|
||||
|
||||
/**
|
||||
* Attach to $element (usually attempts) the needed backup structures
|
||||
* for question_usages and all the associated data.
|
||||
* for question_states for a given question_attempt
|
||||
*/
|
||||
protected function add_question_usages($element, $usageidname) {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/question/engine/lib.php');
|
||||
|
||||
protected function add_question_attempts_states($element, $questionattemptname) {
|
||||
// Check $element is one nested_backup_element
|
||||
if (! $element instanceof backup_nested_element) {
|
||||
throw new backup_step_exception('question_states_bad_parent_element', $element);
|
||||
}
|
||||
if (! $element->get_final_element($usageidname)) {
|
||||
throw new backup_step_exception('question_states_bad_question_attempt_element', $usageidname);
|
||||
// Check that the $questionattemptname is final element in $element
|
||||
if (! $element->get_final_element($questionattemptname)) {
|
||||
throw new backup_step_exception('question_states_bad_question_attempt_element', $questionattemptname);
|
||||
}
|
||||
|
||||
$quba = new backup_nested_element('question_usage', array('id'),
|
||||
array('component', 'preferredbehaviour'));
|
||||
// TODO: Some day we should stop these "encrypted" state->answers and
|
||||
// TODO: delegate to qtypes plugin to proper XML writting the needed info on each question
|
||||
|
||||
$qas = new backup_nested_element('question_attempts');
|
||||
$qa = new backup_nested_element('question_attempt', array('id'), array(
|
||||
'slot', 'behaviour', 'questionid', 'maxmark', 'minfraction',
|
||||
'flagged', 'questionsummary', 'rightanswer', 'responsesummary',
|
||||
'timemodified'));
|
||||
// TODO: Should be doing here some introspection in the "answer" element, based on qtype,
|
||||
// TODO: to know which real questions are being used (for randoms and other qtypes...)
|
||||
// TODO: Not needed if consistency is guaranteed, but it isn't right now :-(
|
||||
|
||||
$steps = new backup_nested_element('steps');
|
||||
$step = new backup_nested_element('step', array('id'), array(
|
||||
'sequencenumber', 'state', 'fraction', 'timecreated', 'userid'));
|
||||
|
||||
$response = new backup_nested_element('response');
|
||||
$variable = new backup_nested_element('variable', null, array('name', 'value'));
|
||||
// Define the elements
|
||||
$states = new backup_nested_element('states');
|
||||
$state = new backup_nested_element('state', array('id'), array(
|
||||
'question', 'seq_number', 'answer', 'timestamp',
|
||||
'event', 'grade', 'raw_grade', 'penalty'));
|
||||
|
||||
// Build the tree
|
||||
$element->add_child($quba);
|
||||
$quba->add_child($qas);
|
||||
$qas->add_child($qa);
|
||||
$qa->add_child($steps);
|
||||
$steps->add_child($step);
|
||||
$step->add_child($response);
|
||||
$response->add_child($variable);
|
||||
$element->add_child($states);
|
||||
$states->add_child($state);
|
||||
|
||||
// Set the sources
|
||||
$quba->set_source_table('question_usages',
|
||||
array('id' => '../' . $usageidname));
|
||||
$qa->set_source_sql('
|
||||
SELECT *
|
||||
FROM {question_attempts}
|
||||
WHERE questionusageid = :questionusageid
|
||||
ORDER BY slot',
|
||||
array('questionusageid' => backup::VAR_PARENTID));
|
||||
$step->set_source_sql('
|
||||
SELECT *
|
||||
FROM {question_attempt_steps}
|
||||
WHERE questionattemptid = :questionattemptid
|
||||
ORDER BY sequencenumber',
|
||||
array('questionattemptid' => backup::VAR_PARENTID));
|
||||
$variable->set_source_table('question_attempt_step_data',
|
||||
array('attemptstepid' => backup::VAR_PARENTID));
|
||||
$state->set_source_table('question_states', array('attempt' => '../../' . $questionattemptname));
|
||||
|
||||
// Annotate ids
|
||||
$qa->annotate_ids('question', 'questionid');
|
||||
$step->annotate_ids('user', 'userid');
|
||||
$state->annotate_ids('question', 'question');
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach to $element (usually attempts) the needed backup structures
|
||||
* for question_sessions for a given question_attempt
|
||||
*/
|
||||
protected function add_question_attempts_sessions($element, $questionattemptname) {
|
||||
// Check $element is one nested_backup_element
|
||||
if (! $element instanceof backup_nested_element) {
|
||||
throw new backup_step_exception('question_sessions_bad_parent_element', $element);
|
||||
}
|
||||
// Check that the $questionattemptname is final element in $element
|
||||
if (! $element->get_final_element($questionattemptname)) {
|
||||
throw new backup_step_exception('question_sessions_bad_question_attempt_element', $questionattemptname);
|
||||
}
|
||||
|
||||
// Define the elements
|
||||
$sessions = new backup_nested_element('sessions');
|
||||
$session = new backup_nested_element('session', array('id'), array(
|
||||
'questionid', 'newest', 'newgraded', 'sumpenalty',
|
||||
'manualcomment', 'manualcommentformat', 'flagged'));
|
||||
|
||||
// Build the tree
|
||||
$element->add_child($sessions);
|
||||
$sessions->add_child($session);
|
||||
|
||||
// Set the sources
|
||||
$session->set_source_table('question_sessions', array('attemptid' => '../../' . $questionattemptname));
|
||||
|
||||
// Annotate ids
|
||||
$session->annotate_ids('question', 'questionid');
|
||||
|
||||
// Annotate files
|
||||
$fileareas = question_engine::get_all_response_file_areas();
|
||||
foreach ($fileareas as $filearea) {
|
||||
$step->annotate_files('question', $filearea, 'id');
|
||||
}
|
||||
// Note: question_sessions haven't files associated. On purpose manualcomment is lacking
|
||||
// support for them, so we don't need to annotated them here.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* backup structure step in charge of calculating the categories to be
|
||||
* included in backup, based in the context being backuped (module/course)
|
||||
@@ -319,9 +321,8 @@ class backup_module_structure_step extends backup_structure_step {
|
||||
// attach format plugin structure to $module element, only one allowed
|
||||
$this->add_plugin_structure('format', $module, false);
|
||||
|
||||
// attach plagiarism plugin structure to $module element, there can be potentially
|
||||
// many plagiarism plugins storing information about this course
|
||||
$this->add_plugin_structure('plagiarism', $module, true);
|
||||
// attach plagiarism plugin structure to $module element, only one allowed
|
||||
$this->add_plugin_structure('plagiarism', $module, false);
|
||||
|
||||
// Define the tree
|
||||
$module->add_child($availinfo);
|
||||
@@ -422,9 +423,8 @@ class backup_course_structure_step extends backup_structure_step {
|
||||
// course reports can save course data if required
|
||||
$this->add_plugin_structure('coursereport', $course, true);
|
||||
|
||||
// attach plagiarism plugin structure to $course element, there can be potentially
|
||||
// many plagiarism plugins storing information about this course
|
||||
$this->add_plugin_structure('plagiarism', $course, true);
|
||||
// attach plagiarism plugin structure to $course element, only one allowed
|
||||
$this->add_plugin_structure('plagiarism', $course, false);
|
||||
|
||||
// Build the tree
|
||||
|
||||
@@ -763,48 +763,6 @@ class backup_comments_structure_step extends backup_structure_step {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* structure step in charge of constructing the calender.xml file for all the events found
|
||||
* in a given context
|
||||
*/
|
||||
class backup_calendarevents_structure_step extends backup_structure_step {
|
||||
|
||||
protected function define_structure() {
|
||||
|
||||
// Define each element separated
|
||||
|
||||
$events = new backup_nested_element('events');
|
||||
|
||||
$event = new backup_nested_element('event', array('id'), array(
|
||||
'name', 'description', 'format', 'courseid', 'groupid', 'userid',
|
||||
'repeatid', 'modulename', 'instance', 'eventtype', 'timestart',
|
||||
'timeduration', 'visible', 'uuid', 'sequence', 'timemodified'));
|
||||
|
||||
// Build the tree
|
||||
$events->add_child($event);
|
||||
|
||||
// Define sources
|
||||
if ($this->name == 'course_calendar') {
|
||||
$calendar_items_sql ="SELECT * FROM {event}
|
||||
WHERE courseid = :courseid
|
||||
AND (eventtype = 'course' OR eventtype = 'group')";
|
||||
$calendar_items_params = array('courseid'=>backup::VAR_COURSEID);
|
||||
$event->set_source_sql($calendar_items_sql, $calendar_items_params);
|
||||
} else {
|
||||
$event->set_source_table('event', array('courseid' => backup::VAR_COURSEID, 'instance' => backup::VAR_ACTIVITYID, 'modulename' => backup::VAR_MODNAME));
|
||||
}
|
||||
|
||||
// Define id annotations
|
||||
|
||||
$event->annotate_ids('user', 'userid');
|
||||
$event->annotate_ids('group', 'groupid');
|
||||
$event->annotate_files('calendar', 'event_description', 'id');
|
||||
|
||||
// Return the root element (events)
|
||||
return $events;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* structure step in charge of constructing the gradebook.xml file for all the gradebook config in the course
|
||||
* NOTE: the backup of the grade items themselves is handled by backup_activity_grades_structure_step
|
||||
@@ -1738,25 +1696,19 @@ class backup_questions_structure_step extends backup_structure_step {
|
||||
|
||||
$question = new backup_nested_element('question', array('id'), array(
|
||||
'parent', 'name', 'questiontext', 'questiontextformat',
|
||||
'generalfeedback', 'generalfeedbackformat', 'defaultmark', 'penalty',
|
||||
'generalfeedback', 'generalfeedbackformat', 'defaultgrade', 'penalty',
|
||||
'qtype', 'length', 'stamp', 'version',
|
||||
'hidden', 'timecreated', 'timemodified', 'createdby', 'modifiedby'));
|
||||
|
||||
// attach qtype plugin structure to $question element, only one allowed
|
||||
$this->add_plugin_structure('qtype', $question, false);
|
||||
|
||||
$qhints = new backup_nested_element('question_hints');
|
||||
|
||||
$qhint = new backup_nested_element('question_hint', array('id'), array(
|
||||
'hint', 'hintformat', 'shownumcorrect', 'clearwrong', 'options'));
|
||||
|
||||
// Build the tree
|
||||
|
||||
$qcategories->add_child($qcategory);
|
||||
$qcategory->add_child($questions);
|
||||
|
||||
$questions->add_child($question);
|
||||
$question->add_child($qhints);
|
||||
$qhints->add_child($qhint);
|
||||
|
||||
// Define the sources
|
||||
|
||||
@@ -1770,13 +1722,6 @@ class backup_questions_structure_step extends backup_structure_step {
|
||||
|
||||
$question->set_source_table('question', array('category' => backup::VAR_PARENTID));
|
||||
|
||||
$qhint->set_source_sql('
|
||||
SELECT *
|
||||
FROM {question_hints}
|
||||
WHERE questionid = :questionid
|
||||
ORDER BY id',
|
||||
array('questionid' => backup::VAR_PARENTID));
|
||||
|
||||
// don't need to annotate ids nor files
|
||||
// (already done by {@link backup_annotate_all_question_files}
|
||||
|
||||
@@ -1801,6 +1746,10 @@ class backup_annotate_all_user_files extends backup_execution_step {
|
||||
// List of fileareas we are going to annotate
|
||||
$fileareas = array('profile', 'icon');
|
||||
|
||||
if ($this->get_setting_value('user_files')) { // private files only if enabled in settings
|
||||
$fileareas[] = 'private';
|
||||
}
|
||||
|
||||
// Fetch all annotated (final) users
|
||||
$rs = $DB->get_recordset('backup_ids_temp', array(
|
||||
'backupid' => $this->get_backupid(), 'itemname' => 'userfinal'));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user