Compare commits
548 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d78ec260b2 | |||
| 0572e4291d | |||
| 8bc1d327c2 | |||
| e0f57f0d56 | |||
| 6886503616 | |||
| bc93860e9f | |||
| 1ffd2c0ac6 | |||
| e1be60d66c | |||
| 727031451d | |||
| 947d3349ab | |||
| 2bb9c62bf8 | |||
| b65f805a91 | |||
| 4bc522672d | |||
| 1bb56f97c5 | |||
| a11b2d8e72 | |||
| 5a1920568c | |||
| dd85612a17 | |||
| 7e2aced51d | |||
| fe6e5f35b5 | |||
| de3499d458 | |||
| 26b131922b | |||
| f67882c305 | |||
| eed1c7ca5b | |||
| 34a2acfc72 | |||
| bb0aa83341 | |||
| dfae0ffa1b | |||
| c194ca1c70 | |||
| 90b52b9486 | |||
| b0e29954ae | |||
| ebd7bc06ce | |||
| 167a831615 | |||
| efedb70895 | |||
| 3f9fd1987c | |||
| 048373691e | |||
| baa0b3ceae | |||
| e289bd8030 | |||
| 509f876de8 | |||
| 6e21779482 | |||
| b65a82e1a4 | |||
| f6fc4e1891 | |||
| a4bc586138 | |||
| f0bcc27f90 | |||
| 75bbcfb74f | |||
| 014c522eb8 | |||
| f99f716464 | |||
| b1b4cdb7d8 | |||
| dda3fc5779 | |||
| 4e557706d3 | |||
| 0556edaf60 | |||
| 231e409849 | |||
| e7c9105d26 | |||
| 8323fb4279 | |||
| 28e95b14e2 | |||
| df4847fc1b | |||
| e0e0c00e94 | |||
| e19f5f4ce5 | |||
| f5f696be2a | |||
| 36d38823c0 | |||
| fadd42e097 | |||
| 23ae278546 | |||
| f86c86269e | |||
| 89eccbccb2 | |||
| 5d88d553ef | |||
| caba817fe7 | |||
| 419b95d2ad | |||
| 61bb817fd2 | |||
| a186848393 | |||
| 66738744f5 | |||
| 961ffe486f | |||
| 04bb266b3f | |||
| d672ecf8e8 | |||
| 4f4f20e7fb | |||
| b424feb1cd | |||
| 78ed8710e6 | |||
| 5ff601c49e | |||
| 186b0a1537 | |||
| f99ed7c86d | |||
| bdbb8f02b2 | |||
| 0c08447833 | |||
| c6b4a16884 | |||
| f5446711d2 | |||
| 919352d80a | |||
| 57c9510f1b | |||
| edf9554096 | |||
| 874833bf64 | |||
| aac5f17176 | |||
| 725685f9fb | |||
| cfbd464c72 | |||
| 1a730605aa | |||
| f33f60f78e | |||
| 2b33092aba | |||
| b874e680dc | |||
| aa604cfa06 | |||
| af8288c0e6 | |||
| 0920afeddc | |||
| 1ad377cf12 | |||
| e9ba213148 | |||
| 3fc8fbccd6 | |||
| eebb9e840d | |||
| d7ced1eca3 | |||
| cbcae60bb4 | |||
| cf71b80e65 | |||
| dc1a8255ba | |||
| 0b58276ad0 | |||
| 5d27c224dd | |||
| 015edfa92e | |||
| c0b9b34aea | |||
| c54982c11b | |||
| 1714e789f4 | |||
| 91d44be7b0 | |||
| edd33b96b3 | |||
| df63d62031 | |||
| ae066f4cae | |||
| fc1981bb71 | |||
| 3404e92ced | |||
| e2e41efc2a | |||
| 0e92e35575 | |||
| eb2a551ce4 | |||
| 82cb40f813 | |||
| dbc6368462 | |||
| f4afcf7efa | |||
| 05c7e459ac | |||
| 7608d5ccab | |||
| c798b55df4 | |||
| 5a9528b959 | |||
| 45d99c3807 | |||
| d26e72d1b2 | |||
| 2baa6afc82 | |||
| 0fcad934b6 | |||
| 9bee6187e4 | |||
| 4764cb3ee8 | |||
| f2614f737b | |||
| b7f2b64f2f | |||
| 3b53ec29f8 | |||
| 0498a4d517 | |||
| 7d0ffb0fe6 | |||
| d3564a90ad | |||
| d3ad764373 | |||
| 8a9febcdb0 | |||
| 0a78a5c67d | |||
| 16ce3928cc | |||
| 08c28a96f7 | |||
| 1ba840fdbb | |||
| cfca081765 | |||
| f6297ede8e | |||
| 50a79cfecc | |||
| 133f457cdc | |||
| 8f56f9d9a3 | |||
| 1c632b934d | |||
| 12b7c16ffc | |||
| 3580ad8ee1 | |||
| 5c6a0bad7b | |||
| 697463d868 | |||
| 8d20f40cb9 | |||
| 347f90e704 | |||
| b533156097 | |||
| 22bf0fd32c | |||
| 2c4f2d4004 | |||
| a2ed173893 | |||
| ec6b89399a | |||
| e2d52b4b88 | |||
| c8733890c3 | |||
| 5d72dbbe9d | |||
| b214c00f01 | |||
| c223acda18 | |||
| 41fe0508eb | |||
| 6673f18b1c | |||
| 97bc9f4934 | |||
| 07893c5239 | |||
| 4bedc06d42 | |||
| 93d8244508 | |||
| 77b7083885 | |||
| a9fce7695e | |||
| bf4c59aa42 | |||
| 6255297f0b | |||
| 6164fc9080 | |||
| a0d692e925 | |||
| 1bc5e06312 | |||
| eb6591ca8b | |||
| f005a30c52 | |||
| 73083f1705 | |||
| 2712b7f2dc | |||
| b9e6a03e3e | |||
| cd93c36de6 | |||
| 69e5b55d03 | |||
| e0a8a35867 | |||
| a34487e2e5 | |||
| bc1d20eea9 | |||
| 7efe75fcc4 | |||
| 1f7790ffe5 | |||
| c15b5c3c96 | |||
| 03648520cc | |||
| ea6f1fd569 | |||
| d6c42bb205 | |||
| e3128055a2 | |||
| 52c72b0079 | |||
| e5d17c3450 | |||
| ee0875740d | |||
| ec5a8430eb | |||
| 3fdb68a838 | |||
| 1ebce948ec | |||
| 8841cecde3 | |||
| aa4be76082 | |||
| af191f3be2 | |||
| 4cd5906993 | |||
| 907e4a312d | |||
| 8eda8b6521 | |||
| 16c5052e79 | |||
| c6144706fb | |||
| 8ab04045ff | |||
| a280860c4e | |||
| 5c8faf4728 | |||
| 9b71941eba | |||
| 45e27a011b | |||
| 53f6ee19bd | |||
| 42e28aa6ca | |||
| 0d8b628813 | |||
| 3f22efa141 | |||
| 2142a30406 | |||
| 1d671e8e4a | |||
| 211a42594f | |||
| 041396c760 | |||
| dadcf5cc42 | |||
| 0337694a7d | |||
| a936d39aed | |||
| f5c39e0b23 | |||
| 53aab8ffd4 | |||
| bc8f835f0d | |||
| b05c975e30 | |||
| 908a8949b3 | |||
| dc4495783d | |||
| 75ca3e0d01 | |||
| 49b5de5ae4 | |||
| 9725881e50 | |||
| 3b817c7251 | |||
| acb9bb129a | |||
| 480e735763 | |||
| 6b94ff60e6 | |||
| 6214b779ff | |||
| 9ce40f4de1 | |||
| c72a4079b1 | |||
| 8f5b6a9308 | |||
| 1138529ffa | |||
| 80289b2543 | |||
| 71f9356394 | |||
| dd48dfc480 | |||
| 95dfead3b1 | |||
| 22c22fe17c | |||
| 6e4dbffd0a | |||
| 6339452c3e | |||
| ffeb631f28 | |||
| a44ce185fa | |||
| 1c5d61d928 | |||
| b766a48f3f | |||
| eac3f48ca7 | |||
| 581ca3d354 | |||
| 6ac9c77179 | |||
| 31682b1276 | |||
| daf3c36c51 | |||
| 0ab95f8bf6 | |||
| 295ce0c81e | |||
| dda4bbbf25 | |||
| eee45d7fe6 | |||
| 838e92f788 | |||
| a904349624 | |||
| bfbe9c52c1 | |||
| 2e5815427b | |||
| 1c2d58cc99 | |||
| ebecdf8d14 | |||
| 82cb7fe78c | |||
| 9b2aa32147 | |||
| 196684087f | |||
| d86d8f5a99 | |||
| 4514f4bf4b | |||
| 4bcf2c2122 | |||
| ed4fd6c492 | |||
| 809651502d | |||
| ab717a9c26 | |||
| 9ffa6198f3 | |||
| 62ec0b2bd4 | |||
| c6b2e4fce9 | |||
| 82ad3312a7 | |||
| ca2af27934 | |||
| 19ec0f2df2 | |||
| 4adbf6cf72 | |||
| 91cee36fe6 | |||
| 0c93bd7340 | |||
| 4be4e29a3b | |||
| 8cd6f2b347 | |||
| 87aa917219 | |||
| 1221d87de8 | |||
| caa413ece1 | |||
| 4fb68891b0 | |||
| acd404e309 | |||
| 1f31378d11 | |||
| 273c8bf204 | |||
| db8a7ac9d1 | |||
| ef9b262c7c | |||
| 5ce8c064dd | |||
| 37c023fb5c | |||
| 2ac86cbd24 | |||
| 5573a51843 | |||
| f4f534c675 | |||
| aa34400457 | |||
| 8ebd0d9f4d | |||
| 1880a55e53 | |||
| 4fadd52878 | |||
| 87b9156edb | |||
| 39bf0df228 | |||
| 27a78fcd2d | |||
| 45debd50c5 | |||
| a4f3137661 | |||
| 1002d7e22a | |||
| 587813b713 | |||
| c21899e0dd | |||
| bcfbd8cbdf | |||
| 304182d210 | |||
| f4c0f3d062 | |||
| a871e630b2 | |||
| 5ceecdaaff | |||
| 964b1bb8c5 | |||
| 5aada1957d | |||
| 6e0c3e4e4d | |||
| 1e6eb9da35 | |||
| 960192ec0e | |||
| 66f8778519 | |||
| da30f2babd | |||
| 9ff3b4ab32 | |||
| f97583af41 | |||
| dfb723b481 | |||
| f40f3604c7 | |||
| 6483b3b16c | |||
| a3daa6c40d | |||
| bb9950d1cc | |||
| 4fb30fc90b | |||
| 50ae935fd6 | |||
| 3fcf436c16 | |||
| aa86e60148 | |||
| 529c18df40 | |||
| 88f3ed390f | |||
| 5008d3951f | |||
| 247879d0f3 | |||
| 3708bfc599 | |||
| 59d1acce89 | |||
| e95c8bc282 | |||
| c7ff87ee13 | |||
| 520b973c8d | |||
| f76a2d832d | |||
| 18e1b648b9 | |||
| b30533ad22 | |||
| 8e797520d7 | |||
| b552ea3586 | |||
| bc898bed7b | |||
| 13f4d81384 | |||
| 12fa8f82fc | |||
| cf5bb676dc | |||
| 02e7dadc05 | |||
| 439d39348d | |||
| 69860d5d10 | |||
| 84345a1d0d | |||
| 41617e6525 | |||
| 864fbeda4b | |||
| 748d925acb | |||
| f352ff4b83 | |||
| 3dc450db90 | |||
| 11bf8a95e2 | |||
| 6a219918c2 | |||
| 6f6506058f | |||
| cccd285acf | |||
| 14f42baf18 | |||
| 0dc4f14a26 | |||
| 3dbdd5caa3 | |||
| 38048ab4eb | |||
| 2329052916 | |||
| d715f651f4 | |||
| 597abe1a2c | |||
| 9a1dd76cfa | |||
| 488fec2e70 | |||
| ece92348bf | |||
| cf3ccea5e5 | |||
| ee87411fa9 | |||
| b8f8058211 | |||
| 29b30932c9 | |||
| 02bfbf0518 | |||
| 9d46c8fbbf | |||
| b77a1c30bd | |||
| 49240e1503 | |||
| 7ea370a056 | |||
| 323871cbf3 | |||
| d7fd82a2ca | |||
| 6794ccb2b3 | |||
| 392e59c88e | |||
| fdfe84df84 | |||
| dc751c555e | |||
| ef9e26dd33 | |||
| 28b9086750 | |||
| 85b70ad4f6 | |||
| 1110888aee | |||
| 43a8efaadc | |||
| 71ad20a5ca | |||
| ca133f6ec3 | |||
| c69e712116 | |||
| ce52f7c68c | |||
| 1aca4eeaf0 | |||
| 3e57e4b578 | |||
| d10350ce83 | |||
| e0fdaa9de0 | |||
| 2da97a4f23 | |||
| 5097b7269b | |||
| f88c5b545d | |||
| be8963b70c | |||
| 9bea47311f | |||
| be76a35ac3 | |||
| eceb6476e1 | |||
| b0cd3f5453 | |||
| 24c07163d0 | |||
| b95233e1e1 | |||
| ba1b4cd1ef | |||
| 21e00abf42 | |||
| 9c257d8057 | |||
| d0b9615cff | |||
| fcbae39803 | |||
| 25e5ce9a5f | |||
| 611e9f2a67 | |||
| 7936d32cf6 | |||
| bc8f1674e9 | |||
| 5d29fd70a3 | |||
| 6c8a956d90 | |||
| 1aee1e5a27 | |||
| 5e8255d651 | |||
| 6f8489e13d | |||
| b19909d9ae | |||
| 9084681497 | |||
| 305726a6a2 | |||
| 62f3bee984 | |||
| 0183e41239 | |||
| 3b5d49f20c | |||
| bdf5dce110 | |||
| c278e8bc8f | |||
| ed200fd420 | |||
| 44a718e930 | |||
| 5e4098df22 | |||
| 300ade82c4 | |||
| 275b342ce2 | |||
| 84d7815107 | |||
| cd1aa3bb76 | |||
| 4b70ac02cd | |||
| 2ad92ce59b | |||
| bdf0b64635 | |||
| fba486beb4 | |||
| 40bb4f3941 | |||
| f5084fcf1f | |||
| 75f97e398e | |||
| 450eb77b78 | |||
| 4caf41a177 | |||
| d9a1a6f021 | |||
| 880ae97916 | |||
| d10fd935b9 | |||
| d205581b9e | |||
| e3c424e08c | |||
| fa21044e08 | |||
| 5b696e30cc | |||
| 5c03a7d201 | |||
| 55c59f5050 | |||
| c9c54db3d8 | |||
| 826b485ce1 | |||
| bbbba10d73 | |||
| 493ac92129 | |||
| 084712eadc | |||
| 22f3e58605 | |||
| dc6ef09c49 | |||
| 3f9156bf56 | |||
| 52dce7612b | |||
| 552ae418de | |||
| 4db3f36034 | |||
| 9259bf1c0e | |||
| 9407c07c61 | |||
| 0b6c589f21 | |||
| 9da6b30269 | |||
| 5046d2353b | |||
| 81f99d24f7 | |||
| a80094eff3 | |||
| f4921fb310 | |||
| 6c709360f5 | |||
| 8969caa059 | |||
| 226c671af7 | |||
| ca8c7dbc52 | |||
| 1239139dd3 | |||
| fc1bdd6e88 | |||
| b207f15ca2 | |||
| 9dd4a457c8 | |||
| ea86a3aa8d | |||
| e33fc5a3ee | |||
| 1cbf76c5fb | |||
| 06d11b581a | |||
| c519c19ab8 | |||
| 357d918295 | |||
| 173e8c5dfb | |||
| 50e7e04949 | |||
| e1e9407acb | |||
| 3f7cc1f861 | |||
| 6a51d6a786 | |||
| 8c36f3b9a9 | |||
| 2da68b0b32 | |||
| 55005a51ce | |||
| c92d8dd677 | |||
| e1e7d03480 | |||
| 7ee50b87b8 | |||
| 687ce1c4e0 | |||
| 3db1ddedd3 | |||
| fc2df8c889 | |||
| 60a66a2bef | |||
| f7d555d577 | |||
| 974762e6f5 | |||
| ab5642fe19 | |||
| b1b45674dd | |||
| dee89d7ecc | |||
| 32caf9d6d9 | |||
| 91c6c3dc85 | |||
| 331ecbe5b6 | |||
| 46a4dde38c | |||
| 9b7d5f1aa8 | |||
| 706ea2faf3 | |||
| f8128f42a9 | |||
| 234e96d185 | |||
| 01b1fab671 | |||
| 61d29b99d8 | |||
| 8054e9aaad | |||
| ee4848432c | |||
| d3d4f4936e | |||
| d799be5424 | |||
| f24e0da312 | |||
| a8fbb9b4cd | |||
| cfc673c112 | |||
| 6dfe1cc67c | |||
| e796e306f8 | |||
| a7adb64678 | |||
| bfd12c4dd5 | |||
| 8eede3f475 | |||
| 9267fe2f43 | |||
| 1c09e6fe0c | |||
| 62fc4a966f | |||
| 7ba648a011 | |||
| 19798dc28d | |||
| 08f5787e35 | |||
| 5b99950ef1 | |||
| 21cd4715de | |||
| 9a9446e5b4 |
+16
-4
@@ -140,9 +140,15 @@ $registrationauths = array();
|
||||
$registrationauths[''] = $txt->disable;
|
||||
foreach ($authsenabled as $auth) {
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$displayauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Apply titles
|
||||
$displayauths[$auth] = $authtitle;
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
$registrationauths[$auth] = $authtitle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,9 +157,15 @@ foreach ($authsavailable as $auth) {
|
||||
continue; //already in the list
|
||||
}
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$displayauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Apply titles
|
||||
$displayauths[$auth] = $authtitle;
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
$registrationauths[$auth] = $authtitle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-8
@@ -52,11 +52,16 @@ if ($frm = data_submitted()) {
|
||||
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
|
||||
$modules = get_list_of_plugins('auth');
|
||||
foreach ($modules as $module) {
|
||||
$options[$module] = get_string("auth_{$module}title", 'auth');
|
||||
}
|
||||
asort($options);
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Get the auth descriptions (from core or own auth lang files)
|
||||
$authdescription = get_string("auth_{$auth}description", "auth");
|
||||
if ($authdescription == "[[auth_{$auth}description]]") {
|
||||
$authdescription = get_string("auth_{$auth}description", "auth_{$auth}");
|
||||
}
|
||||
|
||||
// output configuration form
|
||||
admin_externalpage_print_header($adminroot);
|
||||
@@ -69,9 +74,9 @@ echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
|
||||
|
||||
// auth plugin description
|
||||
print_simple_box_start('center', '80%');
|
||||
print_heading($options[$auth]);
|
||||
print_simple_box_start('center', '60%', '', 5, 'informationbox');
|
||||
print_string("auth_{$auth}description", 'auth');
|
||||
print_heading($authtitle);
|
||||
print_simple_box_start('center', '80%', '', 5, 'informationbox');
|
||||
echo $authdescription;
|
||||
print_simple_box_end();
|
||||
echo "<hr />\n";
|
||||
$authplugin->config_form($frm, $err, $user_fields);
|
||||
|
||||
+32
-7
@@ -98,11 +98,21 @@
|
||||
$cron_function = $mod->name."_cron";
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing module function $cron_function ...", '');
|
||||
if (!empty($PERF->dbqueries)) {
|
||||
$pre_dbqueries = $PERF->dbqueries;
|
||||
$pre_time = microtime(1);
|
||||
}
|
||||
if ($cron_function()) {
|
||||
if (! set_field("modules", "lastcron", $timenow, "id", $mod->id)) {
|
||||
mtrace("Error: could not update timestamp for $mod->fullname");
|
||||
}
|
||||
}
|
||||
if (isset($pre_dbqueries)) {
|
||||
mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
|
||||
mtrace("... used " . (microtime(1) - $pre_time) . " seconds");
|
||||
}
|
||||
/// Reset possible changes by modules to time_limit. MDL-11597
|
||||
@set_time_limit(0);
|
||||
mtrace("done.");
|
||||
}
|
||||
}
|
||||
@@ -127,6 +137,8 @@
|
||||
mtrace('Error: could not update timestamp for '.$block->name);
|
||||
}
|
||||
}
|
||||
/// Reset possible changes by blocks to time_limit. MDL-11597
|
||||
@set_time_limit(0);
|
||||
mtrace('done.');
|
||||
}
|
||||
}
|
||||
@@ -142,13 +154,26 @@
|
||||
|
||||
mtrace('Removing expired enrolments ...', ''); // See MDL-8785
|
||||
$timenow = time();
|
||||
if ($oldenrolments = get_records_select('role_assignments', "timeend > 0 AND timeend < '$timenow'")) {
|
||||
mtrace(count($oldenrolments).' to delete');
|
||||
foreach ($oldenrolments as $oldenrolment) {
|
||||
if (role_unassign($oldenrolment->roleid, $oldenrolment->userid, 0, $oldenrolment->contextid)) {
|
||||
mtrace("Deleted expired role assignment $oldenrolment->roleid for user $oldenrolment->userid from context $oldenrolment->contextid");
|
||||
}
|
||||
}
|
||||
$somefound = false;
|
||||
// The preferred way saves memory, dmllib.php
|
||||
// find courses where limited enrolment is enabled
|
||||
global $CFG;
|
||||
$rs_enrol = get_recordset_sql("SELECT ra.roleid, ra.userid, ra.contextid
|
||||
FROM {$CFG->prefix}course c
|
||||
INNER JOIN {$CFG->prefix}context cx ON cx.instanceid = c.id
|
||||
INNER JOIN {$CFG->prefix}role_assignments ra ON ra.contextid = cx.id
|
||||
WHERE cx.contextlevel = '".CONTEXT_COURSE."'
|
||||
AND ra.timeend > 0
|
||||
AND ra.timeend < '$timenow'
|
||||
AND c.enrolperiod > 0
|
||||
");
|
||||
mtrace($rs_enrol->RecordCount().' to delete');
|
||||
while ($oldenrolment = rs_fetch_next_record($rs_enrol)) {
|
||||
role_unassign($oldenrolment->roleid, $oldenrolment->userid, 0, $oldenrolment->contextid);
|
||||
$somefound = true;
|
||||
}
|
||||
rs_close($rs_enrol);
|
||||
if($somefound) {
|
||||
mtrace('Done');
|
||||
} else {
|
||||
mtrace('none found');
|
||||
|
||||
@@ -119,4 +119,124 @@
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.0" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="4.3.0" level="required">
|
||||
<RESTRICT function="restrict_php50_version" message="php50restricted" />
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrecommended" />
|
||||
</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_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="qtyperqpwillberemovedanyway" />
|
||||
<ON_OK message="qtyperqpwillberemoved" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_random_check" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_OK message="questioncwqpfsok" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.0" requires="1.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.0" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.2.0" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrecommended" />
|
||||
</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_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="qtyperqpwillberemovedanyway" />
|
||||
<ON_OK message="qtyperqpwillberemoved" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+8
-18
@@ -190,8 +190,9 @@
|
||||
$db->debug = false;
|
||||
if ($status) {
|
||||
//ugly hack - install new groups: MDL-9217
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
install_group_db();
|
||||
require("$CFG->dirroot/group/version.php");
|
||||
set_config('group_version', $group_version);
|
||||
//install_group_db();
|
||||
|
||||
// Install the roles system.
|
||||
moodle_install_roles();
|
||||
@@ -325,9 +326,10 @@
|
||||
/// If successful, continue upgrading roles and setting everything properly
|
||||
if ($status) {
|
||||
if (empty($CFG->rolesactive)) {
|
||||
//ugly hack - upgrade to new groups (from 1.6) : MDL-9217
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
install_group_db();
|
||||
// ugly hack - upgrade to new groups (from 1.6) : MDL-9217
|
||||
// require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
// MDL-11062, proper group upgrade code is done in lib/db/upgrade.php
|
||||
// install_group_db();
|
||||
// Upgrade to the roles system.
|
||||
moodle_install_roles();
|
||||
set_config('rolesactive', 1);
|
||||
@@ -488,19 +490,7 @@
|
||||
|
||||
/// Check if the guest user exists. If not, create one.
|
||||
if (! record_exists("user", "username", "guest")) {
|
||||
$guest->auth = "manual";
|
||||
$guest->username = "guest";
|
||||
$guest->password = md5("guest");
|
||||
$guest->firstname = addslashes(get_string("guestuser"));
|
||||
$guest->lastname = " ";
|
||||
$guest->email = "root@localhost";
|
||||
$guest->description = addslashes(get_string("guestuserinfo"));
|
||||
$guest->mnethostid = $CFG->mnet_localhost_id;
|
||||
$guest->confirmed = 1;
|
||||
$guest->lang = $CFG->lang;
|
||||
$guest->timemodified= time();
|
||||
|
||||
if (! $guest->id = insert_record("user", $guest)) {
|
||||
if (! $guest = create_guest_record()) {
|
||||
notify("Could not create guest user record !!!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,6 +583,9 @@ function lang_fix_value_before_save($value='') {
|
||||
if ($CFG->lang != "zh_hk" and $CFG->lang != "zh_tw") { // Some MB languages include backslash bytes
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
}
|
||||
if (ini_get_bool('magic_quotes_sybase')) { // Unescape escaped sybase quotes
|
||||
$value = str_replace("''", "'", $value);
|
||||
}
|
||||
$value = str_replace("'", "\\'", $value); // Add slashes for '
|
||||
$value = str_replace('"', "\\\"", $value); // Add slashes for "
|
||||
$value = str_replace("%","%%",$value); // Escape % characters
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="← '.get_string('install','admin').'" />';
|
||||
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
@@ -29,7 +29,7 @@ function mnet_get_functions($type, $parentname) {
|
||||
$docname = 'rpclib.php';
|
||||
$relname = '/mod/'.$parentname.'/'.$docname;
|
||||
$filename = $CFG->dirroot.$relname;
|
||||
if (file_exists($filename)) include $filename;
|
||||
if (file_exists($filename)) include_once $filename;
|
||||
$mnet_publishes = $parentname.'_mnet_publishes';
|
||||
if (function_exists($mnet_publishes)) {
|
||||
(array)$publishes = $mnet_publishes();
|
||||
@@ -38,7 +38,7 @@ function mnet_get_functions($type, $parentname) {
|
||||
// auth or enrol
|
||||
$relname = '/'.$type.'/'.$parentname.'/'.$docname;
|
||||
$filename = $CFG->dirroot.$relname;
|
||||
if (file_exists($filename)) include $filename;
|
||||
if (file_exists($filename)) include_once $filename;
|
||||
$class = $type.($type=='enrol'? 'ment':'').'_plugin_'.$parentname;
|
||||
if (class_exists($class)) {
|
||||
$object = new $class();
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/// If data submitted, process and store
|
||||
if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
if (!empty($form->submit) && $form->submit == get_string('savechanges')) {
|
||||
if (in_array($form->mode, array("off", "strict", "promiscuous"))) {
|
||||
if (in_array($form->mode, array("off", "strict", "dangerous"))) {
|
||||
if (set_config('mnet_dispatcher_mode', $form->mode)) {
|
||||
redirect('index.php', get_string('changessaved'));
|
||||
} else {
|
||||
|
||||
+36
-19
@@ -34,29 +34,45 @@
|
||||
|
||||
print_heading($stractivities);
|
||||
|
||||
$coursesaffected = false;
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($hide) and confirm_sesskey()) {
|
||||
if (!$module = get_record("modules", "name", $hide)) {
|
||||
error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
|
||||
set_field('course_modules', 'visibleold', '1', 'visible' ,'1', 'module', $module->id); // Remember the previous visible state so we can toggle this back if the module is unhidden.
|
||||
set_field('course_modules', 'visibleold', '0', 'visible' ,'0', 'module', $module->id);
|
||||
set_field("course_modules", "visible", "0", "module", $module->id); // Hide all related activity modules
|
||||
$coursesaffected = true;
|
||||
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
|
||||
// Remember the visibility status in visibleold
|
||||
// and hide...
|
||||
$sql = "UPDATE {$CFG->prefix}course_modules
|
||||
SET visibleold=visible,
|
||||
visible=0
|
||||
WHERE module={$module->id}";
|
||||
execute_sql($sql, false);
|
||||
// clear the course modinfo cache for courses
|
||||
// where we just deleted something
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE visibleold=1 AND module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
}
|
||||
|
||||
if (!empty($show) and confirm_sesskey()) {
|
||||
if (!$module = get_record("modules", "name", $show)) {
|
||||
error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "1", "id", $module->id); // Show main module
|
||||
set_field('course_modules', 'visible', '1', 'visibleold', '1', 'module', $module->id); // Get the previous saved visible state for the course module.
|
||||
$coursesaffected = true;
|
||||
set_field("modules", "visible", "1", "id", $module->id); // Show main module
|
||||
set_field('course_modules', 'visible', '1', 'visibleold',
|
||||
'1', 'module', $module->id); // Get the previous saved visible state for the course module.
|
||||
// clear the course modinfo cache for courses
|
||||
// where we just made something visible
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE visible=1 AND module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
}
|
||||
|
||||
if (!empty($delete) and confirm_sesskey()) {
|
||||
@@ -89,6 +105,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
// clear course.modinfo for courses
|
||||
// that used this module...
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
|
||||
// Now delete all the course module records
|
||||
if (!delete_records("course_modules", "module", $module->id)) {
|
||||
notify("Error occurred while deleting all $strmodulename records in course_modules table");
|
||||
@@ -124,20 +149,12 @@
|
||||
// Delete the capabilities that were defined by this module
|
||||
capabilities_cleanup('mod/'.$module->name);
|
||||
|
||||
// rebuild_course_cache(); // Because things have changed
|
||||
$coursesaffected = true;
|
||||
|
||||
$a->module = $strmodulename;
|
||||
$a->directory = "$CFG->dirroot/mod/$delete";
|
||||
notice(get_string("moduledeletefiles", "", $a), "modules.php");
|
||||
}
|
||||
}
|
||||
|
||||
if ($coursesaffected) {
|
||||
rebuild_course_cache(); // Because things have changed
|
||||
}
|
||||
|
||||
|
||||
/// Get and sort the existing modules
|
||||
|
||||
if (!$modules = get_records("modules")) {
|
||||
|
||||
@@ -42,7 +42,7 @@ while(@ob_end_flush());
|
||||
|
||||
echo '<strong>Progress:</strong>';
|
||||
$i = 0;
|
||||
$skiptables = array($CFG->prefix.'config');//, $CFG->prefix.'sessions2');
|
||||
$skiptables = array($CFG->prefix.'config', $CFG->prefix.'user_students', $CFG->prefix.'user_teachers');//, $CFG->prefix.'sessions2');
|
||||
|
||||
foreach ($tables as $table) {
|
||||
if (($CFG->prefix && strpos($table, $CFG->prefix) !== 0)
|
||||
@@ -63,12 +63,8 @@ foreach ($tables as $table) {
|
||||
if ($rs and $rs->RecordCount() > 0) {
|
||||
while (!$rs->EOF) {
|
||||
$text = $rs->fields[$column];
|
||||
$search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
|
||||
$newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
|
||||
if ($newtext != $text) {
|
||||
$newtext = addslashes($newtext);
|
||||
execute_sql("UPDATE $table SET $column='$newtext' WHERE id=".$rs->fields['id'], false);
|
||||
}
|
||||
$id = $rs->fields['id'];
|
||||
|
||||
if ($i % 600 == 0) {
|
||||
echo '<br />';
|
||||
}
|
||||
@@ -77,6 +73,22 @@ foreach ($tables as $table) {
|
||||
}
|
||||
$i++;
|
||||
$rs->MoveNext();
|
||||
|
||||
if (empty($text) or is_numeric($text)) {
|
||||
continue; // nothing to do
|
||||
}
|
||||
|
||||
$search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
|
||||
$newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
|
||||
|
||||
if (is_null($newtext)) {
|
||||
continue; // regex error
|
||||
}
|
||||
|
||||
if ($newtext != $text) {
|
||||
$newtext = addslashes($newtext);
|
||||
execute_sql("UPDATE $table SET $column='$newtext' WHERE id=$id", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php // $Id$
|
||||
// index.php - scheduled backup logs
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/backup/lib.php');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_setup('reportbackups', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
/// Scheduled backups are disabled by the server admin
|
||||
if (!empty($CFG->disablescheduledbackups)) {
|
||||
print_error('scheduledbackupsdisabled', '', '', NULL, true);
|
||||
}
|
||||
|
||||
/// Scheduled backups aren't active by the site admin
|
||||
$backup_config = backup_get_config();
|
||||
if (empty($backup_config->backup_sche_active)) {
|
||||
notify(get_string('scheduledbackupsinactive'));
|
||||
}
|
||||
|
||||
/// Get needed strings
|
||||
$backuploglaststatus = get_string("backuploglaststatus");
|
||||
$backuplogdetailed = get_string("backuplogdetailed");
|
||||
$stradmin = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strbackup = get_string("backup");
|
||||
$strbackupdetails = get_string("backupdetails");
|
||||
$strlogs = get_string("logs");
|
||||
$strftimedatetime = get_string("strftimerecent");
|
||||
$strftimetime = get_string("strftimetime").":%S";
|
||||
$strerror = get_string("error");
|
||||
$strok = get_string("ok");
|
||||
$strunfinished = get_string("unfinished");
|
||||
$strskipped = get_string("skipped");
|
||||
$strcourse = get_string("course");
|
||||
$strtimetaken = get_string("timetaken","quiz");
|
||||
$strstatus = get_string("status");
|
||||
$strnext = get_string("next");
|
||||
|
||||
/// Decide when to show last execution logs or detailed logs
|
||||
/// Lastlog view
|
||||
if (!$courseid) {
|
||||
print_heading($backuploglaststatus);
|
||||
print_simple_box_start('center');
|
||||
/// Now, get every record from backup_courses
|
||||
$courses = get_records("backup_courses");
|
||||
|
||||
if (!$courses) {
|
||||
notify(get_string('nologsfound'));
|
||||
} else {
|
||||
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
|
||||
//Print table header
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strcourse</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\"><font size=\"3\">$strtimetaken</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strstatus</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strnext</font></td></tr>";
|
||||
foreach ($courses as $course) {
|
||||
/// Get the course shortname
|
||||
$coursename = get_field ("course","fullname","id",$course->courseid);
|
||||
if ($coursename) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\"><a href=\"index.php?courseid=$course->courseid\">".$coursename."</a></font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->laststarttime,$strftimedatetime)."</font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\"> - </font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->lastendtime,$strftimedatetime)."</font></td>";
|
||||
if ($course->laststatus == 1) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
|
||||
} else if ($course->laststatus == 2) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
|
||||
} else if ($course->laststatus == 3) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strskipped."</font></td>";
|
||||
} else {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
|
||||
}
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->nextstarttime,$strftimedatetime)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
/// Detailed View !!
|
||||
} else {
|
||||
print_heading($backuplogdetailed);
|
||||
|
||||
$coursename = get_field("course","fullname","id","$courseid");
|
||||
print_heading("$strcourse: $coursename");
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
||||
/// First, me get all the distinct backups for that course in backup_log
|
||||
$executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime
|
||||
FROM {$CFG->prefix}backup_log
|
||||
WHERE courseid = '$courseid'
|
||||
ORDER BY laststarttime DESC");
|
||||
|
||||
/// Iterate over backup executions
|
||||
if (!$executions) {
|
||||
notify(get_string('nologsfound'));
|
||||
} else {
|
||||
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
|
||||
foreach($executions as $execution) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\">";
|
||||
print_simple_box("<center>".userdate($execution->laststarttime)."</center>", "center");
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
$logs = get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}backup_log
|
||||
WHERE courseid = '$courseid' AND
|
||||
laststarttime = '$execution->laststarttime'
|
||||
ORDER BY id");
|
||||
if ($logs) {
|
||||
foreach ($logs as $log) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($log->time,$strftimetime)."</font></td>";
|
||||
$log->info = str_replace("- ERROR!!","- <font color=\"red\">ERROR!!</font>",$log->info);
|
||||
$log->info = str_replace("- OK","- <font color=\"green\">OK</font>",$log->info);
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".str_replace(" "," ",$log->info)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
stats_check_uptodate($course->id);
|
||||
stats_check_uptodate();
|
||||
|
||||
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->dirroot.'/question/upgrade.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportquestion', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading(page_doc_link(get_string('adminreport', 'question')));
|
||||
|
||||
$probstr = '';
|
||||
$contextupgradeversion = 2007081000;
|
||||
if ($CFG->version < $contextupgradeversion){
|
||||
///cwrqpfs issue
|
||||
$probstr = print_heading(get_string('cwrqpfs', 'question'), '', 3, 'main', true);
|
||||
|
||||
if ($updates = question_cwqpfs_to_update()){
|
||||
|
||||
$probstr .=get_string('cwrqpfsinfo', 'question');
|
||||
$probstr .= '<ul>';
|
||||
$catlist = join(array_keys($updates), ',');
|
||||
//get info about cateogries and no of questions used outside category's course
|
||||
$categories = get_records_sql('SELECT qc.*, c.fullname as coursename FROM '.$CFG->prefix.'question_categories as qc, '
|
||||
.$CFG->prefix.'course as c WHERE qc.course = c.id AND qc.id IN ('.$catlist.')');
|
||||
foreach ($updates as $id => $publish){
|
||||
$categories[$id]->caturl = "$CFG->wwwroot/question/category.php?sesskey=".sesskey().
|
||||
"&edit=$id&id=".$categories[$id]->course;
|
||||
if ($categories[$id]->publish){
|
||||
$categories[$id]->changefrom = get_string('published', 'question');
|
||||
$categories[$id]->changeto = get_string('unpublished', 'question');
|
||||
} else {
|
||||
$categories[$id]->changefrom = get_string('unpublished', 'question');
|
||||
$categories[$id]->changeto = get_string('published', 'question');
|
||||
}
|
||||
$probstr .= '<li>'.get_string('changepublishstatuscat', 'question', $categories[$id]);
|
||||
if ($questions = get_records_sql('SELECT q.*, qui.id as quizid, qui.name as quizname, cm.id as cmid, '
|
||||
.'qui.course, c.fullname as coursename FROM '.$CFG->prefix.'question q, '
|
||||
.$CFG->prefix.'quiz_question_instances qqi, '
|
||||
.$CFG->prefix.'quiz qui, '
|
||||
.$CFG->prefix.'course_modules cm, '
|
||||
.$CFG->prefix.'modules m, '
|
||||
.$CFG->prefix.'course c '
|
||||
.'WHERE (q.category = '.$id.' AND qqi.question = q.id '
|
||||
.'AND qqi.quiz = qui.id '
|
||||
.'AND qui.course = c.id '
|
||||
.'AND cm.instance = qui.id '
|
||||
.'AND cm.module = m.id '
|
||||
.'AND m.name = \'quiz\''
|
||||
.'AND ('.$categories[$id]->course.' <> qui.course)) ORDER BY qui.id ASC')){
|
||||
|
||||
$probstr .= '<ul>';
|
||||
foreach ($questions as $question){
|
||||
$question->quizurl = "$CFG->wwwroot/mod/quiz/edit.php?cmid=".$question->cmid;
|
||||
$question->qurl = "$CFG->wwwroot/question/question.php?cmid={$question->cmid}&id={$question->id}&returnurl=".urlencode($FULLME);
|
||||
$probstr .= '<li>'.get_string('questionaffected', 'question', $question).'</li>';
|
||||
}
|
||||
$probstr .= '</ul>';
|
||||
}
|
||||
$probstr .= '</li>';
|
||||
}
|
||||
$probstr .= '</ul>';
|
||||
} else {
|
||||
$probstr .=('<p>'.get_string('cwrqpfsnoprob', 'question').'</p>');
|
||||
}
|
||||
}
|
||||
if ($probstr) {
|
||||
print_box($probstr);
|
||||
} else {
|
||||
print_box(get_string('noprobs', 'question'), 'boxwidthnarrow boxaligncenter generalbox');
|
||||
}
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
+6
-10
@@ -60,11 +60,9 @@
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
if (!isset($contextusers[$user->id])) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
|
||||
@@ -74,11 +72,9 @@
|
||||
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
|
||||
} else {
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
if (!isset($contextusers[$user->id])) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+87
-6
@@ -233,16 +233,97 @@
|
||||
$LIKE = sql_ilike();
|
||||
$FULLNAME = sql_fullname();
|
||||
|
||||
$select .= " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
|
||||
$selectsql = " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
|
||||
$select .= $selectsql;
|
||||
} else {
|
||||
$selectsql = "";
|
||||
}
|
||||
|
||||
$availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
|
||||
FROM '.$CFG->prefix.'user
|
||||
WHERE '.$select.'
|
||||
ORDER BY lastname ASC, firstname ASC');
|
||||
if ($context->contextlevel > CONTEXT_COURSE) { // mod or block (or group?)
|
||||
|
||||
/// In the .html file below we loop through these results and exclude any in $contextusers
|
||||
/************************************************************************
|
||||
* *
|
||||
* context level is above or equal course context level *
|
||||
* in this case we pull out all users matching search criteria (if any) *
|
||||
* *
|
||||
* MDL-11324 *
|
||||
* a mini get_users_by_capability() call here, this is done instead of *
|
||||
* get_users_by_capability() because *
|
||||
* 1) get_users_by_capability() does not deal with searching by name *
|
||||
* 2) exceptions array can be potentially large for large courses *
|
||||
* 3) get_recordset_sql() is more efficient *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
if ($possibleroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context)) {
|
||||
|
||||
$doanythingroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$validroleids = array();
|
||||
foreach ($possibleroles as $possiblerole) {
|
||||
if (isset($doanythingroles[$possiblerole->id])) { // We don't want these included
|
||||
continue;
|
||||
}
|
||||
if ($caps = role_context_capabilities($possiblerole->id, $context, 'moodle/course:view')) { // resolved list
|
||||
if (isset($caps['moodle/course:view']) && $caps['moodle/course:view'] > 0) { // resolved capability > 0
|
||||
$validroleids[] = $possiblerole->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($validroleids) {
|
||||
$roleids = '('.implode(',', $validroleids).')';
|
||||
|
||||
$select = " SELECT u.id, u.firstname, u.lastname, u.email";
|
||||
$countselect = "SELECT COUNT(u.id)";
|
||||
$from = " FROM {$CFG->prefix}user u
|
||||
INNER JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
|
||||
INNER JOIN {$CFG->prefix}role r ON r.id = ra.roleid";
|
||||
$where = " WHERE ra.contextid ".get_related_contexts_string($context)."
|
||||
AND u.deleted = 0
|
||||
AND ra.roleid in $roleids";
|
||||
$excsql = " AND u.id NOT IN (
|
||||
SELECT u.id
|
||||
FROM {$CFG->prefix}role_assignments r,
|
||||
{$CFG->prefix}user u
|
||||
WHERE r.contextid = $contextid
|
||||
AND u.id = r.userid
|
||||
AND r.roleid = $roleid
|
||||
$selectsql)";
|
||||
|
||||
$availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);
|
||||
}
|
||||
|
||||
$usercount = count_records_sql($countselect . $from . $where) - count($contextusers);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* context level is above or equal course context level *
|
||||
* in this case we pull out all users matching search criteria (if any) *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/// MDL-11111 do not include user already assigned this role in this context as available users
|
||||
/// so that the number of available users is right and we save time looping later
|
||||
$availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
|
||||
FROM '.$CFG->prefix.'user
|
||||
WHERE '.$select.'
|
||||
AND id NOT IN (
|
||||
SELECT u.id
|
||||
FROM '.$CFG->prefix.'role_assignments r,
|
||||
'.$CFG->prefix.'user u
|
||||
WHERE r.contextid = '.$contextid.'
|
||||
AND u.id = r.userid
|
||||
AND r.roleid = '.$roleid.'
|
||||
'.$selectsql.')
|
||||
ORDER BY lastname ASC, firstname ASC');
|
||||
$usercount = count_records_select('user', $select) - count($contextusers);
|
||||
|
||||
}
|
||||
|
||||
echo '<div style="text-align:center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
$assignableroles = array('0'=>get_string('listallroles', 'role').'...') + $assignableroles;
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/roles/assign.php?userid=$userid&courseid=$courseid&contextid=$contextid&roleid=",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// This file defines settingpages and externalpages under the "courses" category
|
||||
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on'));
|
||||
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on','moodle/category:update'));
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('enrolment', get_string('enrolments'), $CFG->wwwroot . '/'.$CFG->admin.'/enrol.php'));
|
||||
|
||||
@@ -17,7 +17,7 @@ $ADMIN->add('courses', $temp);
|
||||
|
||||
|
||||
// "backups" settingpage
|
||||
$temp = new admin_settingpage('backups', get_string('backups','admin'));
|
||||
$temp = new admin_settingpage('backups', get_string('backups','admin'),'moodle/site:backup');
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0));
|
||||
|
||||
@@ -5,7 +5,6 @@ $temp = new admin_settingpage('locationsettings', get_string('locationsettings',
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('serverlocaltime');
|
||||
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_countries();
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
if (!empty($pt)) {
|
||||
echo '</td>';
|
||||
echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="right-column">';
|
||||
blocks_print_group($PAGE, $blocks, BLOCK_POS_RIGHT);
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
|
||||
@@ -421,4 +421,3 @@ function my_file_get_contents($filename, $use_include_path = 0) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
<?php // $Id$
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 2001-3001 Martin Dougiamas http://dougiamas.com //
|
||||
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
|
||||
// //
|
||||
// This program 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 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program 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: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// This class will compare all the indexes found in the XMLDB definitions
|
||||
/// with the phisical DB implementation, reporting about all the missing
|
||||
/// indexes to be created to be 100% ok.
|
||||
|
||||
class check_indexes extends XMLDBAction {
|
||||
|
||||
/**
|
||||
* Init method, every subclass will have its own
|
||||
*/
|
||||
function init() {
|
||||
parent::init();
|
||||
|
||||
/// Set own core attributes
|
||||
|
||||
/// Set own custom attributes
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
'confirmcheckindexes' => 'xmldb',
|
||||
'ok' => '',
|
||||
'missing' => 'xmldb',
|
||||
'table' => 'xmldb',
|
||||
'key' => 'xmldb',
|
||||
'index' => 'xmldb',
|
||||
'searchresults' => 'xmldb',
|
||||
'missingindexes' => 'xmldb',
|
||||
'completelogbelow' => 'xmldb',
|
||||
'nomissingindexesfound' => 'xmldb',
|
||||
'yesmissingindexesfound' => 'xmldb',
|
||||
'yes' => '',
|
||||
'no' => '',
|
||||
'back' => 'xmldb'
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke method, every class will have its own
|
||||
* returns true/false on completion, setting both
|
||||
* errormsg and output as necessary
|
||||
*/
|
||||
function invoke() {
|
||||
parent::invoke();
|
||||
|
||||
$result = true;
|
||||
|
||||
/// Set own core attributes
|
||||
$this->does_generate = ACTION_GENERATE_HTML;
|
||||
|
||||
/// These are always here
|
||||
global $CFG, $XMLDB;
|
||||
|
||||
/// And we nedd some ddl suff
|
||||
require_once ($CFG->libdir . '/ddllib.php');
|
||||
|
||||
/// Here we'll acummulate all the missing indexes found
|
||||
$missing_indexes = array();
|
||||
|
||||
/// Do the job, setting $result as needed
|
||||
|
||||
/// Get the confirmed to decide what to do
|
||||
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmcheckindexes'] . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=check_indexes&confirmed=yes" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=main_view" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= '</table>';
|
||||
|
||||
$this->output = $o;
|
||||
} else {
|
||||
/// The back to edit table button
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b .= '<a href="index.php">[' . $this->str['back'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
|
||||
/// Iterate over $XMLDB->dbdirs, loading their XML data to memory
|
||||
if ($XMLDB->dbdirs) {
|
||||
$dbdirs =& $XMLDB->dbdirs;
|
||||
$o='<ul>';
|
||||
foreach ($dbdirs as $dbdir) {
|
||||
/// Only if the directory exists
|
||||
if (!$dbdir->path_exists) {
|
||||
continue;
|
||||
}
|
||||
/// Load the XML file
|
||||
$xmldb_file = new XMLDBFile($dbdir->path . '/install.xml');
|
||||
/// Load the needed XMLDB generator
|
||||
$classname = 'XMLDB' . $CFG->dbtype;
|
||||
$generator = new $classname();
|
||||
$generator->setPrefix($CFG->prefix);
|
||||
|
||||
/// Only if the file exists
|
||||
if (!$xmldb_file->fileExists()) {
|
||||
continue;
|
||||
}
|
||||
/// Load the XML contents to structure
|
||||
$loaded = $xmldb_file->loadXMLStructure();
|
||||
if (!$loaded || !$xmldb_file->isLoaded()) {
|
||||
notify('Errors found in XMLDB file: '. $dbdir->path . '/install.xml');
|
||||
continue;
|
||||
}
|
||||
/// Arriving here, everything is ok, get the XMLDB structure
|
||||
$structure = $xmldb_file->getStructure();
|
||||
$o.=' <li>' . str_replace($CFG->dirroot . '/', '', $dbdir->path . '/install.xml');
|
||||
/// Getting tables
|
||||
if ($xmldb_tables = $structure->getTables()) {
|
||||
$o.=' <ul>';
|
||||
/// Foreach table, process its indexes and keys
|
||||
foreach ($xmldb_tables as $xmldb_table) {
|
||||
/// Skip table if not exists
|
||||
if (!table_exists($xmldb_table)) {
|
||||
continue;
|
||||
}
|
||||
$o.=' <li>' . $xmldb_table->getName();
|
||||
/// Keys
|
||||
if ($xmldb_keys = $xmldb_table->getKeys()) {
|
||||
$o.=' <ul>';
|
||||
foreach ($xmldb_keys as $xmldb_key) {
|
||||
$o.=' <li>' . $this->str['key'] . ': ' . $xmldb_key->readableInfo() . ' ';
|
||||
/// Primaries are skipped
|
||||
if ($xmldb_key->getType() == XMLDB_KEY_PRIMARY) {
|
||||
$o.='<font color="green">' . $this->str['ok'] . '</font></li>';
|
||||
continue;
|
||||
}
|
||||
/// If we aren't creating the keys or the key is a XMLDB_KEY_FOREIGN (not underlying index generated
|
||||
/// automatically by the RDBMS) create the underlying (created by us) index (if doesn't exists)
|
||||
if (!$generator->getKeySQL($xmldb_table, $xmldb_key) || $xmldb_key->getType() == XMLDB_KEY_FOREIGN) {
|
||||
/// Create the interim index
|
||||
$xmldb_index = new XMLDBIndex('anyname');
|
||||
$xmldb_index->setFields($xmldb_key->getFields());
|
||||
switch ($xmldb_key->getType()) {
|
||||
case XMLDB_KEY_UNIQUE:
|
||||
case XMLDB_KEY_FOREIGN_UNIQUE:
|
||||
$xmldb_index->setUnique(true);
|
||||
break;
|
||||
case XMLDB_KEY_FOREIGN:
|
||||
$xmldb_index->setUnique(false);
|
||||
break;
|
||||
}
|
||||
/// Check if the index exists in DB
|
||||
if (index_exists($xmldb_table, $xmldb_index)) {
|
||||
$o.='<font color="green">' . $this->str['ok'] . '</font>';
|
||||
} else {
|
||||
$o.='<font color="red">' . $this->str['missing'] . '</font>';
|
||||
/// Add the missing index to the list
|
||||
$obj = new object;
|
||||
$obj->table = $xmldb_table;
|
||||
$obj->index = $xmldb_index;
|
||||
$missing_indexes[] = $obj;
|
||||
}
|
||||
}
|
||||
$o.='</li>';
|
||||
}
|
||||
$o.=' </ul>';
|
||||
}
|
||||
/// Indexes
|
||||
if ($xmldb_indexes = $xmldb_table->getIndexes()) {
|
||||
$o.=' <ul>';
|
||||
foreach ($xmldb_indexes as $xmldb_index) {
|
||||
$o.=' <li>' . $this->str['index'] . ': ' . $xmldb_index->readableInfo() . ' ';
|
||||
/// Check if the index exists in DB
|
||||
if (index_exists($xmldb_table, $xmldb_index)) {
|
||||
$o.='<font color="green">' . $this->str['ok'] . '</font>';
|
||||
} else {
|
||||
$o.='<font color="red">' . $this->str['missing'] . '</font>';
|
||||
/// Add the missing index to the list
|
||||
$obj = new object;
|
||||
$obj->table = $xmldb_table;
|
||||
$obj->index = $xmldb_index;
|
||||
$missing_indexes[] = $obj;
|
||||
}
|
||||
$o.='</li>';
|
||||
}
|
||||
$o.=' </ul>';
|
||||
}
|
||||
$o.=' </li>';
|
||||
}
|
||||
$o.=' </ul>';
|
||||
}
|
||||
$o.=' </li>';
|
||||
}
|
||||
$o.='</ul>';
|
||||
}
|
||||
|
||||
/// We have finished, let's show the results of the search
|
||||
$s = '';
|
||||
$r = '<table class="generalbox boxaligncenter boxwidthwide" border="0" cellpadding="5" cellspacing="0" id="results">';
|
||||
$r.= ' <tr><td class="generalboxcontent">';
|
||||
$r.= ' <h2 class="main">' . $this->str['searchresults'] . '</h2>';
|
||||
$r.= ' <p class="centerpara">' . $this->str['missingindexes'] . ': ' . count($missing_indexes) . '</p>';
|
||||
$r.= ' </td></tr>';
|
||||
$r.= ' <tr><td class="generalboxcontent">';
|
||||
|
||||
/// If we have found missing indexes inform about them
|
||||
if (count($missing_indexes)) {
|
||||
$r.= ' <p class="centerpara">' . $this->str['yesmissingindexesfound'] . '</p>';
|
||||
$r.= ' <ul>';
|
||||
foreach ($missing_indexes as $obj) {
|
||||
$xmldb_table = $obj->table;
|
||||
$xmldb_index = $obj->index;
|
||||
$sqlarr = $xmldb_table->getAddIndexSQL($CFG->dbtype, $CFG->prefix, $xmldb_index, true);
|
||||
$r.= ' <li>' . $this->str['table'] . ': ' . $xmldb_table->getName() . '. ' .
|
||||
$this->str['index'] . ': ' . $xmldb_index->readableInfo() . '</li>';
|
||||
$s.= '<code>' . str_replace("\n", '<br />', implode('<br />', $sqlarr)) . '</code><br />';
|
||||
|
||||
}
|
||||
$r.= ' </ul>';
|
||||
/// Add the SQL statements (all together)
|
||||
$r.= '<hr />' . $s;
|
||||
} else {
|
||||
$r.= ' <p class="centerpara">' . $this->str['nomissingindexesfound'] . '</p>';
|
||||
}
|
||||
$r.= ' </td></tr>';
|
||||
$r.= ' <tr><td class="generalboxcontent">';
|
||||
/// Add the complete log message
|
||||
$r.= ' <p class="centerpara">' . $this->str['completelogbelow'] . '</p>';
|
||||
$r.= ' </td></tr>';
|
||||
$r.= '</table>';
|
||||
|
||||
$this->output = $b . $r . $o;
|
||||
}
|
||||
|
||||
/// Launch postaction if exists (leave this here!)
|
||||
if ($this->getPostAction() && $result) {
|
||||
return $this->launch($this->getPostAction());
|
||||
}
|
||||
|
||||
/// Return ok if arrived here
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -47,7 +47,8 @@ class main_view extends XMLDBAction {
|
||||
'delete' => 'xmldb',
|
||||
'reservedwords' => 'xmldb',
|
||||
'test' => 'xmldb',
|
||||
'gotolastused' => 'xmldb'
|
||||
'gotolastused' => 'xmldb',
|
||||
'checkindexes' => 'xmldb'
|
||||
));
|
||||
}
|
||||
|
||||
@@ -84,6 +85,8 @@ class main_view extends XMLDBAction {
|
||||
$b .= ' <a href="index.php?action=view_reserved_words">[' . $this->str['reservedwords'] . ']</a>';
|
||||
/// The test button
|
||||
$b .= ' <a href="index.php?action=test">[' . $this->str['test'] . ']</a>';
|
||||
/// The check indexes button
|
||||
$b .= ' <a href="index.php?action=check_indexes">[' . $this->str['checkindexes'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
/// Send buttons to output
|
||||
$o .= $b;
|
||||
|
||||
@@ -88,6 +88,7 @@ class new_table extends XMLDBAction {
|
||||
$field->setType(XMLDB_TYPE_INTEGER);
|
||||
$field->setLength(10);
|
||||
$field->setNotNull(true);
|
||||
$field->setUnsigned(true);
|
||||
$field->setSequence(true);
|
||||
$field->setComment('id of the table, please edit me');
|
||||
$field->setLoaded(true);
|
||||
|
||||
@@ -88,7 +88,7 @@ class new_table_from_mysql extends XMLDBAction {
|
||||
$dbtables = $db->MetaTables('TABLES');
|
||||
$selecttables = array();
|
||||
foreach ($dbtables as $dbtable) {
|
||||
$dbtable = str_replace($CFG->prefix, '', $dbtable);
|
||||
$dbtable = strtolower(str_replace($CFG->prefix, '', $dbtable));
|
||||
$i = $structure->findTableInArray($dbtable);
|
||||
if ($i === NULL) {
|
||||
$selecttables[$dbtable] = $dbtable;
|
||||
|
||||
@@ -92,7 +92,7 @@ class test extends XMLDBAction {
|
||||
$table->addFieldInfo('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('type', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, XMLDB_ENUM, array('single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda'), 'general');
|
||||
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, '');
|
||||
$table->addFieldInfo('intro', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, '');
|
||||
$table->addFieldInfo('intro', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->addFieldInfo('logo', XMLDB_TYPE_BINARY, 'big', null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('assessed', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('assesstimestart', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
@@ -378,7 +378,22 @@ class test extends XMLDBAction {
|
||||
$tests['change field precision (number)'] = $test;
|
||||
}
|
||||
|
||||
/// 18th test. Change the sign of one numeric field to unsigned
|
||||
/// 18th test. Change the precision of one integer field to a smaller one
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
$field = new XMLDBField('course');
|
||||
$field->setAttributes(XMLDB_TYPE_INTEGER, '5', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
|
||||
$test->sql = $table->getAlterFieldSQL($CFG->dbtype, $CFG->prefix, $field, true);
|
||||
$test->status = change_field_precision($table, $field, false, false);
|
||||
if (!$test->status) {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['change field precision (integer) to smaller one'] = $test;
|
||||
}
|
||||
|
||||
/// 19th test. Change the sign of one numeric field to unsigned
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -393,7 +408,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field sign (unsigned)'] = $test;
|
||||
}
|
||||
|
||||
/// 19th test. Change the sign of one numeric field to signed
|
||||
/// 20th test. Change the sign of one numeric field to signed
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -408,7 +423,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field sign (signed)'] = $test;
|
||||
}
|
||||
|
||||
/// 20th test. Change the nullability of one char field to not null
|
||||
/// 21th test. Change the nullability of one char field to not null
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -423,7 +438,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field nullability (not null)'] = $test;
|
||||
}
|
||||
|
||||
/// 21th test. Change the nullability of one char field to null
|
||||
/// 22th test. Change the nullability of one char field to null
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -438,7 +453,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field nullability (null)'] = $test;
|
||||
}
|
||||
|
||||
/// 22th test. Dropping the default of one field
|
||||
/// 23th test. Dropping the default of one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -453,7 +468,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop field default of NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 23th test. Creating the default for one field
|
||||
/// 24th test. Creating the default for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -468,7 +483,7 @@ class test extends XMLDBAction {
|
||||
$tests['add field default of NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 24th test. Creating the default for one field
|
||||
/// 25th test. Creating the default for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -484,7 +499,7 @@ class test extends XMLDBAction {
|
||||
}
|
||||
|
||||
|
||||
/// 25th test. Dropping the default of one NOT NULL field
|
||||
/// 26th test. Dropping the default of one NOT NULL field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -499,7 +514,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop field default of NOT NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 26th test. Adding one unique index to the table
|
||||
/// 27th test. Adding one unique index to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -514,7 +529,7 @@ class test extends XMLDBAction {
|
||||
$tests['add unique index'] = $test;
|
||||
}
|
||||
|
||||
/// 27th test. Adding one not unique index to the table
|
||||
/// 28th test. Adding one not unique index to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -529,7 +544,7 @@ class test extends XMLDBAction {
|
||||
$tests['add not unique index'] = $test;
|
||||
}
|
||||
|
||||
/// 28th test. Re-add the same index than previous test. Check find_index_name() works.
|
||||
/// 29th test. Re-add the same index than previous test. Check find_index_name() works.
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -548,7 +563,7 @@ class test extends XMLDBAction {
|
||||
$tests['check find_index_name()'] = $test;
|
||||
}
|
||||
|
||||
/// 29th test. Dropping one index from the table
|
||||
/// 30th test. Dropping one index from the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -563,7 +578,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop index'] = $test;
|
||||
}
|
||||
|
||||
/// 30th test. Adding one unique key to the table
|
||||
/// 31th test. Adding one unique key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -578,7 +593,7 @@ class test extends XMLDBAction {
|
||||
$tests['add unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 31th test. Adding one foreign+unique key to the table
|
||||
/// 32th test. Adding one foreign+unique key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -593,7 +608,7 @@ class test extends XMLDBAction {
|
||||
$tests['add foreign+unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 32th test. Drop one key
|
||||
/// 33th test. Drop one key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -608,7 +623,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop foreign+unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 33th test. Adding one foreign key to the table
|
||||
/// 34th test. Adding one foreign key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -623,7 +638,7 @@ class test extends XMLDBAction {
|
||||
$tests['add foreign key'] = $test;
|
||||
}
|
||||
|
||||
/// 34th test. Drop one foreign key
|
||||
/// 35th test. Drop one foreign key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -638,7 +653,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop foreign key'] = $test;
|
||||
}
|
||||
|
||||
/// 35th test. Adding one complex enum field
|
||||
/// 36th test. Adding one complex enum field
|
||||
if ($test->status) {
|
||||
/// Create a new field with complex specs (enums are good candidates)
|
||||
$field = new XMLDBField('type');
|
||||
@@ -653,7 +668,7 @@ class test extends XMLDBAction {
|
||||
$tests['add field with enum'] = $test;
|
||||
}
|
||||
|
||||
/// 36th test. Dropping the enum of one field
|
||||
/// 37th test. Dropping the enum of one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -668,7 +683,7 @@ class test extends XMLDBAction {
|
||||
$tests['delete enumlist from one field'] = $test;
|
||||
}
|
||||
|
||||
/// 37th test. Creating the enum for one field
|
||||
/// 38th test. Creating the enum for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -682,7 +697,7 @@ class test extends XMLDBAction {
|
||||
$tests['add enumlist to one field'] = $test;
|
||||
}
|
||||
|
||||
/// 38th test. Renaming one index
|
||||
/// 39th test. Renaming one index
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -697,7 +712,7 @@ class test extends XMLDBAction {
|
||||
$tests['rename index (experimental. DO NOT USE IT)'] = $test;
|
||||
}
|
||||
|
||||
/// 39th test. Renaming one key
|
||||
/// 40th test. Renaming one key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -712,13 +727,13 @@ class test extends XMLDBAction {
|
||||
$tests['rename key (experimental. DO NOT USE IT)'] = $test;
|
||||
}
|
||||
|
||||
/// 40th test. Renaming one field
|
||||
/// 41th test. Renaming one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
$field = new XMLDBField('type');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, XMLDB_ENUM, array('single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda'), 'general', 'course');
|
||||
|
||||
|
||||
$test->sql = $table->getRenameFieldSQL($CFG->dbtype, $CFG->prefix, $field, 'newnameforthefield', true);
|
||||
$test->status = rename_field($table, $field, 'newnameforthefield', false, false);
|
||||
if (!$test->status) {
|
||||
@@ -727,11 +742,11 @@ class test extends XMLDBAction {
|
||||
$tests['rename field'] = $test;
|
||||
}
|
||||
|
||||
/// 41th test. Renaming one table
|
||||
/// 42th test. Renaming one table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
|
||||
|
||||
$test->sql = $table->getRenameTableSQL($CFG->dbtype, $CFG->prefix, 'newnameforthetable', true);
|
||||
$test->status = rename_table($table, 'newnameforthetable', false, false);
|
||||
if (!$test->status) {
|
||||
@@ -740,7 +755,7 @@ class test extends XMLDBAction {
|
||||
$tests['rename table'] = $test;
|
||||
}
|
||||
|
||||
/// 42th test. Getting the PK sequence name for one table
|
||||
/// 43th test. Getting the PK sequence name for one table
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$table->setName('newnameforthetable');
|
||||
@@ -755,13 +770,13 @@ class test extends XMLDBAction {
|
||||
$tests['find sequence name'] = $test;
|
||||
}
|
||||
|
||||
/// 43th test. Inserting TEXT contents
|
||||
/// 44th test. Inserting TEXT contents
|
||||
$textlib = textlib_get_instance();
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
$test->sql = array();
|
||||
$basetext = '日本語 • Русский • Deutsch • English • Español • Français • Italiano • Nederlands • Polski • Português • Svenska • العربية • فارسی 한국어 • עברית • ไทย中文 Ελληνικά • Български • Српски • Українська • Bosanski • Català • Česky • Dansk • Eesti • Simple English • Esperanto • Euskara • Galego • Hrvatski • Ido • Bahasa Indonesia • Íslenska • Lëtzebuergesch • Lietuvių • Magyar • Bahasa Melayu اردو • ئۇيغۇرچه • हिन्दी • नेपाल भाषा मराठी • தமிழ் Հայերեն • Беларуская • Чăваш • Ирон æвзаг • Македонски • Сибирской говор • Afrikaans • Aragonés • Arpitan • Asturianu • Kreyòl Ayisyen • Azərbaycan • Bân-lâm-gú • Basa Banyumasan • Brezhoneg • Corsu • Cymraeg • Deitsch • Føroyskt • Frysk • Furlan • Gaeilge • Gàidhlig • Ilokano • Interlingua • Basa Jawa • Kapampangan • Kernewek • Kurdî كوردی • Ladino לאדינו • Latina • Latviešu • Limburgs • Lumbaart • Nedersaksisch • Nouormand • Occitan • O‘zbek • Piemontèis • Plattdüütsch • Ripoarisch • Sámegiella • Scots • Shqip • Sicilianu • Sinugboanon • Srpskohrvatski / Српскохрватски • Basa Sunda • Kiswahili • Tagalog • Tatarça • Walon • Winaray Авар • Башҡорт • Кыргызча Монгол • Қазақша • Тоҷикӣ • Удмурт • Armãneashce • Bamanankan • Eald Englisc • Gaelg • Interlingue • Kaszëbsczi • Kongo • Ligure • Lingála • lojban • Malagasy • Malti • Māori • Nāhuatl • Ekakairũ Naoero • Novial • Pangasinán • Tok Pisin • Romani / रोमानी • Rumantsch • Runa Simi • Sardu • Tetun • Türkmen / تركمن / Туркмен • Vèneto • Volapük • Võro • West-Vlaoms • Wollof • Zazaki • Žemaitėška';
|
||||
$basetext = "\\ ''語 • Русский • Deutsch • English • Español • Français • Italiano • Nederlands • Polski • Português • Svenska • العربية • فارسی 한국어 • עברית • ไทย中文 Ελληνικά • Български • Српски • Українська • Bosanski • Català • Česky • Dansk • Eesti • Simple English • Esperanto • Euskara • Galego • Hrvatski • Ido • Bahasa Indonesia • Íslenska • Lëtzebuergesch • Lietuvių • Magyar • Bahasa Melayu اردو • ئۇيغۇرچه • हिन्दी • नेपाल भाषा मराठी • தமிழ் Հայերեն • Беларуская • Чăваш • Ирон æвзаг • Македонски • Сибирской говор • Afrikaans • Aragonés • Arpitan • Asturianu • Kreyòl Ayisyen • Azərbaycan • Bân-lâm-gú • Basa Banyumasan • Brezhoneg • Corsu • Cymraeg • Deitsch • Føroyskt • Frysk • Furlan • Gaeilge • Gàidhlig • Ilokano • Interlingua • Basa Jawa • Kapampangan • Kernewek • Kurdî كوردی • Ladino לאדינו • Latina • Latviešu • Limburgs • Lumbaart • Nedersaksisch • Nouormand • Occitan • O‘zbek • Piemontèis • Plattdüütsch • Ripoarisch • Sámegiella • Scots • Shqip • Sicilianu • Sinugboanon • Srpskohrvatski / Српскохрватски • Basa Sunda • Kiswahili • Tagalog • Tatarça • Walon • Winaray Авар • Башҡорт • Кыргызча Монгол • Қазақша • Тоҷикӣ • Удмурт • Armãneashce • Bamanankan • Eald Englisc • Gaelg • Interlingue • Kaszëbsczi • Kongo • Ligure • Lingála • lojban • Malagasy • Malti • Māori • Nāhuatl • Ekakairũ Naoero • Novial • Pangasinán • Tok Pisin • Romani / रोमानी • Rumantsch • Runa Simi • Sardu • Tetun • Türkmen / تركمن / Туркмен • Vèneto • Volapük • Võro • West-Vlaoms • Wollof • Zazaki • Žemaitėška";
|
||||
/// Create one big text (1.500.000 chars)
|
||||
$fulltext = '';
|
||||
for ($i=0; $i<1000; $i++) { //1500 * 1000 chars
|
||||
@@ -794,7 +809,7 @@ class test extends XMLDBAction {
|
||||
$tests['insert record '. $textlen . ' cc. (text)'] = $test;
|
||||
}
|
||||
|
||||
/// 44th test. Inserting BINARY contents
|
||||
/// 45th test. Inserting BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
@@ -823,7 +838,7 @@ class test extends XMLDBAction {
|
||||
$tests['insert record '. $textlen . ' bytes (binary)'] = $test;
|
||||
}
|
||||
|
||||
/// 45th test. update_record with TEXT and BINARY contents
|
||||
/// 46th test. update_record with TEXT and BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
@@ -863,7 +878,7 @@ class test extends XMLDBAction {
|
||||
$tests['update record '. $textlen . ' cc. (text) and ' . $imglen . ' bytes (binary)'] = $test;
|
||||
}
|
||||
|
||||
/// 46th test. set_field with TEXT contents
|
||||
/// 47th test. set_field with TEXT contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
@@ -893,7 +908,7 @@ class test extends XMLDBAction {
|
||||
$tests['set field '. $textlen . ' cc. (text)'] = $test;
|
||||
}
|
||||
|
||||
/// 47th test. set_field with BINARY contents
|
||||
/// 48th test. set_field with BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
|
||||
+3850
-1284
File diff suppressed because it is too large
Load Diff
+567
-189
@@ -1,190 +1,568 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-db.php
|
||||
* Basic class for PGT database storage
|
||||
*/
|
||||
|
||||
// include phpDB library (the test was introduced in release 0.4.8 for
|
||||
// the integration into Tikiwiki).
|
||||
if (!class_exists('DB')) {
|
||||
@include_once('DB.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @class PGTStorageDB
|
||||
* The PGTStorageDB class is a class for PGT database storage. An instance of
|
||||
* this class is returned by CASClient::SetPGTStorageDB().
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorageDB
|
||||
*/
|
||||
|
||||
class PGTStorageDB extends PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorageDB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* a string representing a PEAR DB URL to connect to the database. Written by
|
||||
* PGTStorageDB::PGTStorageDB(), read by getURL().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_url='';
|
||||
|
||||
/**
|
||||
* This method returns the PEAR DB URL to use to connect to the database.
|
||||
*
|
||||
* @return a PEAR DB URL
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getURL()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* The handle of the connection to the database where PGT's are stored. Written by
|
||||
* PGTStorageDB::init(), read by getLink().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_link = null;
|
||||
|
||||
/**
|
||||
* This method returns the handle of the connection to the database where PGT's are
|
||||
* stored.
|
||||
*
|
||||
* @return a handle of connection.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getLink()
|
||||
{
|
||||
return $this->_link;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the table where PGT's are stored. Written by
|
||||
* PGTStorageDB::PGTStorageDB(), read by getTable().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_table = '';
|
||||
|
||||
/**
|
||||
* This method returns the name of the table where PGT's are stored.
|
||||
*
|
||||
* @return the name of a table.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
return "database";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The class constructor, called by CASClient::SetPGTStorageDB().
|
||||
*
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
* @param $user the user to access the data with
|
||||
* @param $password the user's password
|
||||
* @param $database_type the type of the database hosting the data
|
||||
* @param $hostname the server hosting the database
|
||||
* @param $port the port the server is listening on
|
||||
* @param $database the name of the database
|
||||
* @param $table the name of the table storing the data
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
|
||||
// call the ancestor's constructor
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
|
||||
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
|
||||
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
|
||||
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
|
||||
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
|
||||
|
||||
// build and store the PEAR DB URL
|
||||
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
|
||||
|
||||
// XXX should use setURL and setTable
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// if the storage has already been initialized, return immediatly
|
||||
if ( $this->isInitialized() )
|
||||
return;
|
||||
// call the ancestor's method (mark as initialized)
|
||||
parent::init();
|
||||
|
||||
// try to connect to the database
|
||||
$this->_link = DB::connect($this->getURL());
|
||||
if ( DB::isError($this->_link) ) {
|
||||
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
|
||||
}
|
||||
var_dump($this->_link);
|
||||
phpCAS::traceBEnd();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file CAS/PGTStorage/pgt-db.php
|
||||
|
||||
|
||||
* Basic class for PGT database storage
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// include phpDB library (the test was introduced in release 0.4.8 for
|
||||
|
||||
|
||||
// the integration into Tikiwiki).
|
||||
|
||||
|
||||
if (!class_exists('DB')) {
|
||||
|
||||
|
||||
@include_once('DB.php');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @class PGTStorageDB
|
||||
|
||||
|
||||
* The PGTStorageDB class is a class for PGT database storage. An instance of
|
||||
|
||||
|
||||
* this class is returned by CASClient::SetPGTStorageDB().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @ingroup internalPGTStorageDB
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class PGTStorageDB extends PGTStorage
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @addtogroup internalPGTStorageDB
|
||||
|
||||
|
||||
* @{
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* a string representing a PEAR DB URL to connect to the database. Written by
|
||||
|
||||
|
||||
* PGTStorageDB::PGTStorageDB(), read by getURL().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @hideinitializer
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_url='';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the PEAR DB URL to use to connect to the database.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return a PEAR DB URL
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getURL()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_url;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* The handle of the connection to the database where PGT's are stored. Written by
|
||||
|
||||
|
||||
* PGTStorageDB::init(), read by getLink().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @hideinitializer
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_link = null;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the handle of the connection to the database where PGT's are
|
||||
|
||||
|
||||
* stored.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return a handle of connection.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getLink()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_link;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* The name of the table where PGT's are stored. Written by
|
||||
|
||||
|
||||
* PGTStorageDB::PGTStorageDB(), read by getTable().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @hideinitializer
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_table = '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the name of the table where PGT's are stored.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return the name of a table.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getTable()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_table;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// DEBUGGING
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns an informational string giving the type of storage
|
||||
|
||||
|
||||
* used by the object (used for debugging purposes).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return an informational string.
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getStorageType()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return "database";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns an informational string giving informations on the
|
||||
|
||||
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getStorageInfo()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// CONSTRUCTOR
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* The class constructor, called by CASClient::SetPGTStorageDB().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
|
||||
|
||||
* @param $user the user to access the data with
|
||||
|
||||
|
||||
* @param $password the user's password
|
||||
|
||||
|
||||
* @param $database_type the type of the database hosting the data
|
||||
|
||||
|
||||
* @param $hostname the server hosting the database
|
||||
|
||||
|
||||
* @param $port the port the server is listening on
|
||||
|
||||
|
||||
* @param $database the name of the database
|
||||
|
||||
|
||||
* @param $table the name of the table storing the data
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// call the ancestor's constructor
|
||||
|
||||
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
|
||||
|
||||
|
||||
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
|
||||
|
||||
|
||||
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
|
||||
|
||||
|
||||
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
|
||||
|
||||
|
||||
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// build and store the PEAR DB URL
|
||||
|
||||
|
||||
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// XXX should use setURL and setTable
|
||||
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// INITIALIZATION
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function init()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
// if the storage has already been initialized, return immediatly
|
||||
|
||||
|
||||
if ( $this->isInitialized() )
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
// call the ancestor's method (mark as initialized)
|
||||
|
||||
|
||||
parent::init();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// try to connect to the database
|
||||
|
||||
|
||||
$this->_link = DB::connect($this->getURL());
|
||||
|
||||
|
||||
if ( DB::isError($this->_link) ) {
|
||||
|
||||
|
||||
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
var_dump($this->_link);
|
||||
|
||||
|
||||
phpCAS::traceBEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,240 +1,718 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-file.php
|
||||
* Basic class for PGT file storage
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class PGTStorageFile
|
||||
* The PGTStorageFile class is a class for PGT file storage. An instance of
|
||||
* this class is returned by CASClient::SetPGTStorageFile().
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorageFile
|
||||
*/
|
||||
|
||||
class PGTStorageFile extends PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorageFile
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* a string telling where PGT's should be stored on the filesystem. Written by
|
||||
* PGTStorageFile::PGTStorageFile(), read by getPath().
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var $_path;
|
||||
|
||||
/**
|
||||
* This method returns the name of the directory where PGT's should be stored
|
||||
* on the filesystem.
|
||||
*
|
||||
* @return the name of a directory (with leading and trailing '/')
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getPath()
|
||||
{
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* a string telling the format to use to store PGT's (plain or xml). Written by
|
||||
* PGTStorageFile::PGTStorageFile(), read by getFormat().
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var $_format;
|
||||
|
||||
/**
|
||||
* This method returns the format to use when storing PGT's on the filesystem.
|
||||
*
|
||||
* @return a string corresponding to the format used (plain or xml).
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getFormat()
|
||||
{
|
||||
return $this->_format;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
return "file";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The class constructor, called by CASClient::SetPGTStorageFile().
|
||||
*
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
|
||||
* @param $path the path where the PGT's should be stored
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function PGTStorageFile($cas_parent,$format,$path)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// call the ancestor's constructor
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
|
||||
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
|
||||
|
||||
// check that the path is an absolute path
|
||||
if ( $path[0] != '/' ) {
|
||||
phpCAS::error('an absolute path is needed for PGT storage to file');
|
||||
}
|
||||
|
||||
// store the path (with a leading and trailing '/')
|
||||
$path = preg_replace('|[/]*$|','/',$path);
|
||||
$path = preg_replace('|^[/]*|','/',$path);
|
||||
$this->_path = $path;
|
||||
|
||||
// check the format and store it
|
||||
switch ($format) {
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
|
||||
$this->_format = $format;
|
||||
break;
|
||||
default:
|
||||
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// if the storage has already been initialized, return immediatly
|
||||
if ( $this->isInitialized() )
|
||||
return;
|
||||
// call the ancestor's method (mark as initialized)
|
||||
parent::init();
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// PGT I/O
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns the filename corresponding to a PGT Iou.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou.
|
||||
*
|
||||
* @return a filename
|
||||
* @private
|
||||
*/
|
||||
function getPGTIouFilename($pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
|
||||
|
||||
phpCAS::traceEnd($filename);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
|
||||
* warning on error.
|
||||
*
|
||||
* @param $pgt the PGT
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function write($pgt,$pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
if ( $f=fopen($fname,"w") ) {
|
||||
if ( fputs($f,$pgt) === FALSE ) {
|
||||
phpCAS::error('could not write PGT to `'.$fname.'\'');
|
||||
}
|
||||
fclose($f);
|
||||
} else {
|
||||
phpCAS::error('could not open `'.$fname.'\'');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method reads a PGT corresponding to a PGT Iou and deletes the
|
||||
* corresponding file.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @return the corresponding PGT, or FALSE on error
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function read($pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$pgt = FALSE;
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
|
||||
if ( !($f=fopen($fname,"r")) ) {
|
||||
phpCAS::trace('could not open `'.$fname.'\'');
|
||||
} else {
|
||||
if ( ($pgt=fgets($f)) === FALSE ) {
|
||||
phpCAS::trace('could not read PGT from `'.$fname.'\'');
|
||||
}
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
// delete the PGT file
|
||||
@unlink($fname);
|
||||
|
||||
phpCAS::traceEnd($pgt);
|
||||
return $pgt;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file CAS/PGTStorage/pgt-file.php
|
||||
|
||||
|
||||
* Basic class for PGT file storage
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @class PGTStorageFile
|
||||
|
||||
|
||||
* The PGTStorageFile class is a class for PGT file storage. An instance of
|
||||
|
||||
|
||||
* this class is returned by CASClient::SetPGTStorageFile().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @ingroup internalPGTStorageFile
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class PGTStorageFile extends PGTStorage
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @addtogroup internalPGTStorageFile
|
||||
|
||||
|
||||
* @{
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* a string telling where PGT's should be stored on the filesystem. Written by
|
||||
|
||||
|
||||
* PGTStorageFile::PGTStorageFile(), read by getPath().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_path;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the name of the directory where PGT's should be stored
|
||||
|
||||
|
||||
* on the filesystem.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return the name of a directory (with leading and trailing '/')
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getPath()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_path;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* a string telling the format to use to store PGT's (plain or xml). Written by
|
||||
|
||||
|
||||
* PGTStorageFile::PGTStorageFile(), read by getFormat().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_format;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the format to use when storing PGT's on the filesystem.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return a string corresponding to the format used (plain or xml).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getFormat()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_format;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// DEBUGGING
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns an informational string giving the type of storage
|
||||
|
||||
|
||||
* used by the object (used for debugging purposes).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return an informational string.
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getStorageType()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return "file";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns an informational string giving informations on the
|
||||
|
||||
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return an informational string.
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getStorageInfo()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// CONSTRUCTOR
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* The class constructor, called by CASClient::SetPGTStorageFile().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
|
||||
|
||||
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
|
||||
|
||||
|
||||
* @param $path the path where the PGT's should be stored
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function PGTStorageFile($cas_parent,$format,$path)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
// call the ancestor's constructor
|
||||
|
||||
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
|
||||
|
||||
|
||||
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// check that the path is an absolute path
|
||||
|
||||
|
||||
if ( $path[0] != '/' ) {
|
||||
|
||||
|
||||
phpCAS::error('an absolute path is needed for PGT storage to file');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// store the path (with a leading and trailing '/')
|
||||
|
||||
|
||||
$path = preg_replace('|[/]*$|','/',$path);
|
||||
|
||||
|
||||
$path = preg_replace('|^[/]*|','/',$path);
|
||||
|
||||
|
||||
$this->_path = $path;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// check the format and store it
|
||||
|
||||
|
||||
switch ($format) {
|
||||
|
||||
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
|
||||
|
||||
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
|
||||
|
||||
|
||||
$this->_format = $format;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// INITIALIZATION
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function init()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
// if the storage has already been initialized, return immediatly
|
||||
|
||||
|
||||
if ( $this->isInitialized() )
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
// call the ancestor's method (mark as initialized)
|
||||
|
||||
|
||||
parent::init();
|
||||
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// PGT I/O
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the filename corresponding to a PGT Iou.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $pgt_iou the PGT iou.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return a filename
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getPGTIouFilename($pgt_iou)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
$filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
phpCAS::traceEnd($filename);
|
||||
|
||||
|
||||
return $filename;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
|
||||
|
||||
|
||||
* warning on error.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $pgt the PGT
|
||||
|
||||
|
||||
* @param $pgt_iou the PGT iou
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function write($pgt,$pgt_iou)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
|
||||
|
||||
if ( $f=fopen($fname,"w") ) {
|
||||
|
||||
|
||||
if ( fputs($f,$pgt) === FALSE ) {
|
||||
|
||||
|
||||
phpCAS::error('could not write PGT to `'.$fname.'\'');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose($f);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
phpCAS::error('could not open `'.$fname.'\'');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method reads a PGT corresponding to a PGT Iou and deletes the
|
||||
|
||||
|
||||
* corresponding file.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $pgt_iou the PGT iou
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return the corresponding PGT, or FALSE on error
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function read($pgt_iou)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
$pgt = FALSE;
|
||||
|
||||
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( !($f=fopen($fname,"r")) ) {
|
||||
|
||||
|
||||
phpCAS::trace('could not open `'.$fname.'\'');
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if ( ($pgt=fgets($f)) === FALSE ) {
|
||||
|
||||
|
||||
phpCAS::trace('could not read PGT from `'.$fname.'\'');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose($f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// delete the PGT file
|
||||
|
||||
|
||||
@unlink($fname);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
phpCAS::traceEnd($pgt);
|
||||
|
||||
|
||||
return $pgt;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,188 +1,188 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-main.php
|
||||
* Basic class for PGT storage
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class PGTStorage
|
||||
* The PGTStorage class is a generic class for PGT storage. This class should
|
||||
* not be instanciated itself but inherited by specific PGT storage classes.
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorage
|
||||
*/
|
||||
|
||||
class PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorage
|
||||
* @{
|
||||
*/
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The constructor of the class, should be called only by inherited classes.
|
||||
*
|
||||
* @param $cas_parent the CASclient instance that creates the current object.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function PGTStorage($cas_parent)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
if ( !$cas_parent->isProxy() ) {
|
||||
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This virtual method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// ERROR HANDLING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
|
||||
* read by PGTStorage::getErrorMessage().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
* @deprecated not used.
|
||||
*/
|
||||
var $_error_message=FALSE;
|
||||
|
||||
/**
|
||||
* This method sets en error message, which can be read later by
|
||||
* PGTStorage::getErrorMessage().
|
||||
*
|
||||
* @param $error_message an error message
|
||||
*
|
||||
* @protected
|
||||
* @deprecated not used.
|
||||
*/
|
||||
function setErrorMessage($error_message)
|
||||
{
|
||||
$this->_error_message = $error_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an error message set by PGTStorage::setErrorMessage().
|
||||
*
|
||||
* @return an error message when set by PGTStorage::setErrorMessage(), FALSE
|
||||
* otherwise.
|
||||
*
|
||||
* @public
|
||||
* @deprecated not used.
|
||||
*/
|
||||
function getErrorMessage()
|
||||
{
|
||||
return $this->_error_message;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* a boolean telling if the storage has already been initialized. Written by
|
||||
* PGTStorage::init(), read by PGTStorage::isInitialized().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_initialized = FALSE;
|
||||
|
||||
/**
|
||||
* This method tells if the storage has already been intialized.
|
||||
*
|
||||
* @return a boolean
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function isInitialized()
|
||||
{
|
||||
return $this->_initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method initializes the object.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$this->_initialized = TRUE;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// PGT I/O
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This virtual method stores a PGT and its corresponding PGT Iuo.
|
||||
* @note Should never be called.
|
||||
*
|
||||
* @param $pgt the PGT
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function write($pgt,$pgt_iou)
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method reads a PGT corresponding to a PGT Iou and deletes
|
||||
* the corresponding storage entry.
|
||||
* @note Should never be called.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function read($pgt_iou)
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
}
|
||||
|
||||
// include specific PGT storage classes
|
||||
include_once(dirname(__FILE__).'/pgt-file.php');
|
||||
include_once(dirname(__FILE__).'/pgt-db.php');
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* @file CAS/PGTStorage/pgt-main.php
|
||||
|
||||
* Basic class for PGT storage
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* @class PGTStorage
|
||||
|
||||
* The PGTStorage class is a generic class for PGT storage. This class should
|
||||
|
||||
* not be instanciated itself but inherited by specific PGT storage classes.
|
||||
|
||||
*
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
*
|
||||
|
||||
* @ingroup internalPGTStorage
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class PGTStorage
|
||||
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
* @addtogroup internalPGTStorage
|
||||
|
||||
* @{
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
// CONSTRUCTOR
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* The constructor of the class, should be called only by inherited classes.
|
||||
|
||||
*
|
||||
|
||||
* @param $cas_parent the CASclient instance that creates the current object.
|
||||
|
||||
*
|
||||
|
||||
* @protected
|
||||
|
||||
*/
|
||||
|
||||
function PGTStorage($cas_parent)
|
||||
|
||||
{
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
if ( !$cas_parent->isProxy() ) {
|
||||
|
||||
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
|
||||
|
||||
}
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
// DEBUGGING
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* This virtual method returns an informational string giving the type of storage
|
||||
|
||||
* used by the object (used for debugging purposes).
|
||||
|
||||
*
|
||||
|
||||
* @public
|
||||
|
||||
*/
|
||||
|
||||
function getStorageType()
|
||||
|
||||
{
|
||||
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* This virtual method returns an informational string giving informations on the
|
||||
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
|
||||
*
|
||||
|
||||
* @public
|
||||
|
||||
*/
|
||||
|
||||
function getStorageInfo()
|
||||
|
||||
{
|
||||
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
// ERROR HANDLING
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
|
||||
|
||||
* read by PGTStorage::getErrorMessage().
|
||||
|
||||
*
|
||||
|
||||
* @hideinitializer
|
||||
|
||||
* @private
|
||||
|
||||
* @deprecated not used.
|
||||
|
||||
*/
|
||||
|
||||
var $_error_message=FALSE;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* This method sets en error message, which can be read later by
|
||||
|
||||
* PGTStorage::getErrorMessage().
|
||||
|
||||
*
|
||||
|
||||
* @param $error_message an error message
|
||||
|
||||
*
|
||||
|
||||
* @protected
|
||||
|
||||
* @deprecated not used.
|
||||
|
||||
*/
|
||||
|
||||
function setErrorMessage($error_message)
|
||||
|
||||
+6232
-2078
File diff suppressed because it is too large
Load Diff
+828
-276
File diff suppressed because it is too large
Load Diff
@@ -1,27 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/english.php
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'using server',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'CAS Authentication wanted!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'CAS logout wanted!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'CAS Authentication failed!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/english.php
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
|
||||
=> 'using server',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
|
||||
=> 'CAS Authentication wanted!',
|
||||
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
|
||||
=> 'CAS logout wanted!',
|
||||
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
|
||||
=> 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
|
||||
=> 'CAS Authentication failed!',
|
||||
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
|
||||
=> '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
|
||||
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
=> 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,28 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/english.php
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'utilisant le serveur',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'Authentication CAS nécessaire !',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'Déconnexion demandée !',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'Vous auriez du etre redirigé(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'Authentification CAS infructueuse !',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Vous n\'avez pas été authentifié(e).</p><p>Vous pouvez soumettre votre requete à nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le problème persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
|
||||
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/english.php
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
|
||||
=> 'utilisant le serveur',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
|
||||
=> 'Authentication CAS nécessaire !',
|
||||
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
|
||||
=> 'Déconnexion demandée !',
|
||||
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
|
||||
=> 'Vous auriez du etre redirigé(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
|
||||
=> 'Authentification CAS infructueuse !',
|
||||
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
|
||||
=> '<p>Vous n\'avez pas été authentifié(e).</p><p>Vous pouvez soumettre votre requete à nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le problème persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
|
||||
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
=> 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,27 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/german.php
|
||||
* @author Henrik Genssen <hg at mediafactory.de>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'via Server',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'CAS Authentifizierung erforderlich!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'CAS Abmeldung!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'eigentlich häten Sie zum CAS Server weitergeleitet werden sollen. Drücken Sie <a href="%s">hier</a> um fortzufahren.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'CAS Anmeldung fehlgeschlagen!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Der Dienst `<b>%s</b>\' ist nicht verfügbar (<b>%s</b>).'
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/german.php
|
||||
|
||||
|
||||
* @author Henrik Genssen <hg at mediafactory.de>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
|
||||
=> 'via Server',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
|
||||
=> 'CAS Authentifizierung erforderlich!',
|
||||
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
|
||||
=> 'CAS Abmeldung!',
|
||||
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
|
||||
=> 'eigentlich häten Sie zum CAS Server weitergeleitet werden sollen. Drücken Sie <a href="%s">hier</a> um fortzufahren.',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
|
||||
=> 'CAS Anmeldung fehlgeschlagen!',
|
||||
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
|
||||
=> '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
|
||||
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
=> 'Der Dienst `<b>%s</b>\' ist nicht verfügbar (<b>%s</b>).'
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,27 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/greek.php
|
||||
* @author Vangelis Haniotakis <haniotak at ucnet.uoc.gr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> '÷ñçóéìïðïéåßôáé ï åîõðçñåôçôÞò',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'Áðáéôåßôáé ç ôáõôïðïßçóç CAS!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'Áðáéôåßôáé ç áðïóýíäåóç áðü CAS!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'Èá Ýðñåðå íá åß÷áôå áíáêáôåõèõíèåß óôïí åîõðçñåôçôÞ CAS. ÊÜíôå êëßê <a href="%s">åäþ</a> ãéá íá óõíå÷ßóåôå.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'Ç ôáõôïðïßçóç CAS áðÝôõ÷å!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Äåí ôáõôïðïéçèÞêáôå.</p><p>Ìðïñåßôå íá îáíáðñïóðáèÞóåôå, êÜíïíôáò êëßê <a href="%s">åäþ</a>.</p><p>Åáí ôï ðñüâëçìá åðéìåßíåé, åëÜôå óå åðáöÞ ìå ôïí <a href="mailto:%s">äéá÷åéñéóôÞ</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Ç õðçñåóßá `<b>%s</b>\' äåí åßíáé äéáèÝóéìç (<b>%s</b>).'
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/greek.php
|
||||
|
||||
|
||||
* @author Vangelis Haniotakis <haniotak at ucnet.uoc.gr>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
|
||||
=> '÷ñçóéìïðïéåßôáé ï åîõðçñåôçôÞò',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
|
||||
=> 'Áðáéôåßôáé ç ôáõôïðïßçóç CAS!',
|
||||
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
|
||||
=> 'Áðáéôåßôáé ç áðïóýíäåóç áðü CAS!',
|
||||
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
|
||||
=> 'Èá Ýðñåðå íá åß÷áôå áíáêáôåõèõíèåß óôïí åîõðçñåôçôÞ CAS. ÊÜíôå êëßê <a href="%s">åäþ</a> ãéá íá óõíå÷ßóåôå.',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
|
||||
=> 'Ç ôáõôïðïßçóç CAS áðÝôõ÷å!',
|
||||
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
|
||||
=> '<p>Äåí ôáõôïðïéçèÞêáôå.</p><p>Ìðïñåßôå íá îáíáðñïóðáèÞóåôå, êÜíïíôáò êëßê <a href="%s">åäþ</a>.</p><p>Åáí ôï ðñüâëçìá åðéìåßíåé, åëÜôå óå åðáöÞ ìå ôïí <a href="mailto:%s">äéá÷åéñéóôÞ</a>.</p>',
|
||||
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
=> 'Ç õðçñåóßá `<b>%s</b>\' äåí åßíáé äéáèÝóéìç (<b>%s</b>).'
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,27 +1,53 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* @file languages/japanese.php
|
||||
|
||||
* @author fnorif (fnorif@yahoo.co.jp)
|
||||
|
||||
*
|
||||
|
||||
* Now Encoding is EUC-JP and LF
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
=> 'using server',
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
=> 'CASによる認証を行います',
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
=> 'CASからログアウトします!',
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
=> 'CASサーバに行く必要があります。自動的に転送されない場合は <a href="%s">こちら</a> をクリックして続行します。',
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
=> 'CASによる認証に失敗しました',
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
=> '<p>認証できませんでした.</p><p>もう一度リクエストを送信する場合は<a href="%s">こちら</a>をクリック.</p><p>問題が解決しない場合は <a href="mailto:%s">このサイトの管理者</a>に問い合わせてください.</p>',
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
=> 'サービス `<b>%s</b>\' は利用できません (<b>%s</b>).'
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,24 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/languages.php
|
||||
* Internationalization constants
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
//@{
|
||||
/**
|
||||
* a phpCAS string index
|
||||
*/
|
||||
define("CAS_STR_USING_SERVER", 1);
|
||||
define("CAS_STR_AUTHENTICATION_WANTED", 2);
|
||||
define("CAS_STR_LOGOUT", 3);
|
||||
define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
|
||||
define("CAS_STR_AUTHENTICATION_FAILED", 5);
|
||||
define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
|
||||
define("CAS_STR_SERVICE_UNAVAILABLE", 7);
|
||||
//@}
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/languages.php
|
||||
|
||||
|
||||
* Internationalization constants
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//@{
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* a phpCAS string index
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
define("CAS_STR_USING_SERVER", 1);
|
||||
|
||||
|
||||
define("CAS_STR_AUTHENTICATION_WANTED", 2);
|
||||
|
||||
|
||||
define("CAS_STR_LOGOUT", 3);
|
||||
|
||||
|
||||
define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
|
||||
|
||||
|
||||
define("CAS_STR_AUTHENTICATION_FAILED", 5);
|
||||
|
||||
|
||||
define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
|
||||
|
||||
|
||||
define("CAS_STR_SERVICE_UNAVAILABLE", 7);
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
+8
-4
@@ -1,4 +1,8 @@
|
||||
CAS-module README
|
||||
|
||||
|
||||
|
||||
CAS-module README
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+1126
-1258
File diff suppressed because it is too large
Load Diff
+24
-12
@@ -1,12 +1,24 @@
|
||||
|
||||
<div class="loginbox clearfix">
|
||||
<div class="loginpanel">
|
||||
<div>
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=CAS';?>"><?php print_string("accesCAS","auth");?></a>
|
||||
</div>
|
||||
<br/>
|
||||
<div>
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=NOCAS';?>"><?php print_string("accesNOCAS","auth");?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="loginbox clearfix">
|
||||
|
||||
<div class="loginpanel">
|
||||
|
||||
<div>
|
||||
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=CAS';?>"><?php print_string("accesCAS","auth");?></a>
|
||||
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=NOCAS';?>"><?php print_string("accesNOCAS","auth");?></a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
+828
-434
File diff suppressed because it is too large
Load Diff
+17
-9
@@ -1,9 +1,17 @@
|
||||
<?PHP
|
||||
// version $Id$
|
||||
// List of CAS langages.
|
||||
// You can add langages in /CAS/langage.
|
||||
// Please send them to http://esup-phpcas.sourceforge.net
|
||||
$CASLANGUAGES = array (
|
||||
"english" => "English",
|
||||
"french" => "French");
|
||||
?>
|
||||
<?PHP
|
||||
|
||||
// version $Id$
|
||||
|
||||
// List of CAS langages.
|
||||
|
||||
// You can add langages in /CAS/langage.
|
||||
|
||||
// Please send them to http://esup-phpcas.sourceforge.net
|
||||
|
||||
$CASLANGUAGES = array (
|
||||
|
||||
"english" => "English",
|
||||
|
||||
"french" => "French");
|
||||
|
||||
?>
|
||||
|
||||
+3
-3
@@ -88,7 +88,7 @@ class auth_plugin_fc extends auth_plugin_base {
|
||||
|
||||
$userinfo = array();
|
||||
|
||||
$fpp = new fcFPP($this->config->host, $this->config->port);
|
||||
$fpp = new fcFPP($this->config->host, $this->config->fppport);
|
||||
if ($fpp->open()) {
|
||||
if ($fpp->login($this->config->userid, $this->config->passwd)) {
|
||||
$userinfo['firstname'] = $fpp->getUserInfo($username,"1202");
|
||||
@@ -121,7 +121,7 @@ class auth_plugin_fc extends auth_plugin_base {
|
||||
|
||||
$fcgroups = array();
|
||||
|
||||
$fpp = new fcFPP($this->config->host, $this->config->port);
|
||||
$fpp = new fcFPP($this->config->host, $this->config->fppport);
|
||||
if ($fpp->open()) {
|
||||
if ($fpp->login($this->config->userid, $this->config->passwd)) {
|
||||
$fcgroups = $fpp->getGroups($username);
|
||||
@@ -224,7 +224,7 @@ class auth_plugin_fc extends auth_plugin_base {
|
||||
}
|
||||
|
||||
// save settings
|
||||
set_config('host', $config->user, 'auth/fc');
|
||||
set_config('host', $config->host, 'auth/fc');
|
||||
set_config('fppport', $config->fppport, 'auth/fc');
|
||||
set_config('userid', $config->userid, 'auth/fc');
|
||||
set_config('passwd', $config->passwd, 'auth/fc');
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ class fcFPP
|
||||
$conn = fsockopen($host, $port, $errno, $errstr, 5);
|
||||
if (!$conn)
|
||||
{
|
||||
print_error('auth_fcconnfail','auth', array($errno, $errstr));
|
||||
print_error('auth_fcconnfail','auth', '', array($errno, $errstr));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -48,7 +48,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
//hack prefix to objectclass
|
||||
if (empty($this->config->objectclass)) { // Can't send empty filter
|
||||
$this->config->objectclass='objectClass=*';
|
||||
} else if (strpos($this->config->objectclass, 'objectClass=') !== 0) {
|
||||
} else if (stripos($this->config->objectclass, 'objectClass=') !== 0) {
|
||||
$this->config->objectclass = 'objectClass='.$this->config->objectclass;
|
||||
}
|
||||
|
||||
@@ -1216,7 +1216,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$sec=substr($time,12,2);
|
||||
$result = mktime($hr,$min,$sec,$mo,$dt,$yr);
|
||||
break;
|
||||
case 'posix':
|
||||
case 'rfc2307':
|
||||
case 'rfc2307bis':
|
||||
$result = $time * DAYSECS; //The shadowExpire contains the number of DAYS between 01/01/1970 and the actual expiration date
|
||||
break;
|
||||
case 'ad':
|
||||
@@ -1239,7 +1240,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
case 'edir':
|
||||
$result=date('YmdHis', $time).'Z';
|
||||
break;
|
||||
case 'posix':
|
||||
case 'rfc2307':
|
||||
case 'rfc2307bis':
|
||||
$result = $time ; //Already in correct format
|
||||
break;
|
||||
default:
|
||||
@@ -1338,6 +1340,11 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
ldap_set_option($connresult, LDAP_OPT_PROTOCOL_VERSION, $this->config->version);
|
||||
}
|
||||
|
||||
// Fix MDL-10921
|
||||
if ($this->config->user_type == 'ad') {
|
||||
ldap_set_option($connresult, LDAP_OPT_REFERRALS, 0);
|
||||
}
|
||||
|
||||
if (!empty($binddn)) {
|
||||
//bind with search-user
|
||||
//$debuginfo .= 'Using bind user'.$binddn.'and password:'.$bindpwd;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php // $Id$
|
||||
|
||||
/**
|
||||
* @author Martin Dougiamas
|
||||
@@ -285,7 +285,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$firsttime = false;
|
||||
|
||||
// get the local record for the remote user
|
||||
$localuser = get_record('user', 'username', $remoteuser->username, 'mnethostid', $remotehost->id);
|
||||
$localuser = get_record('user', 'username', addslashes($remoteuser->username), 'mnethostid', $remotehost->id);
|
||||
|
||||
// add the remote user to the database if necessary, and if allowed
|
||||
// TODO: refactor into a separate function
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class auth_plugin_pam extends auth_plugin_base {
|
||||
|
||||
// call_time_pass_reference of errormessage is deprecated - throws warnings in multiauth
|
||||
//if (pam_auth($username, $password, &$errormessage)) {
|
||||
if (pam_auth(stripslashes($username), strislashes($password))) {
|
||||
if (pam_auth(stripslashes($username), stripslashes($password))) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -16,6 +16,8 @@ Changes:
|
||||
Added instructions for IIS
|
||||
- 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+
|
||||
- 03. 2007: Adapted authentication method to Moodle 1.8
|
||||
- 10. 2007: Removed the requirement for email address, surname and given name
|
||||
attributes on request of Markus Hagman
|
||||
|
||||
Moodle Configuration with Dual login
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* 2006-08-28 File created, code imported from lib.php
|
||||
* 2006-10-27 Upstream 1.7 changes merged in, added above credits from lib.php :-)
|
||||
* 2007-03-09 Fixed authentication but may need some other changes
|
||||
* 2007-10-03 Removed requirement for email address, surname and given name on request of Markus Hagman
|
||||
*/
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
@@ -51,7 +52,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
|
||||
// If we are in the shibboleth directory then we trust the server var
|
||||
if (!empty($_SERVER[$this->config->user_attribute])) {
|
||||
return ($_SERVER[$this->config->user_attribute] == $username);
|
||||
return (strtolower($_SERVER[$this->config->user_attribute]) == strtolower($username));
|
||||
} else {
|
||||
// If we are not, the user has used the manual login and the login name is
|
||||
// unknown, so we return false.
|
||||
@@ -72,12 +73,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
global $CFG;
|
||||
|
||||
// Check whether we have got all the essential attributes
|
||||
if (
|
||||
empty($_SERVER[$this->config->user_attribute])
|
||||
|| empty($_SERVER[$this->config->field_map_firstname])
|
||||
|| empty($_SERVER[$this->config->field_map_lastname])
|
||||
|| empty($_SERVER[$this->config->field_map_email])
|
||||
) {
|
||||
if ( empty($_SERVER[$this->config->user_attribute]) ) {
|
||||
error(get_string( 'shib_not_all_attributes_error', 'auth' , "'".$this->config->user_attribute."' ('".$_SERVER[$this->config->user_attribute]."'), '".$this->config->field_map_firstname."' ('".$_SERVER[$this->config->field_map_firstname]."'), '".$this->config->field_map_lastname."' ('".$_SERVER[$this->config->field_map_lastname]."') and '".$this->config->field_map_email."' ('".$_SERVER[$this->config->field_map_email]."')"));
|
||||
}
|
||||
|
||||
@@ -87,7 +83,18 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
$search_attribs = array();
|
||||
|
||||
foreach ($attrmap as $key=>$value) {
|
||||
$result[$key] = $this->get_first_string($_SERVER[$value]);
|
||||
// Check if attribute is present
|
||||
if (!isset($_SERVER[$value])){
|
||||
$result[$key] = '';
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make usename lowercase
|
||||
if ($key == 'username'){
|
||||
$result[$key] = strtolower($this->get_first_string($_SERVER[$value]));
|
||||
} else {
|
||||
$result[$key] = $this->get_first_string($_SERVER[$value]);
|
||||
}
|
||||
}
|
||||
|
||||
// Provide an API to modify the information to fit the Moodle internal
|
||||
@@ -118,7 +125,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
|
||||
$moodleattributes = array();
|
||||
foreach ($fields as $field) {
|
||||
if ($configarray["field_map_$field"]) {
|
||||
if (isset($configarray["field_map_$field"])) {
|
||||
$moodleattributes[$field] = $configarray["field_map_$field"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/// If we can find the Shibboleth attribute, save it in session and return to main login page
|
||||
if (!empty($_SERVER[$pluginconfig->user_attribute])) { // Shibboleth auto-login
|
||||
$frm->username = $_SERVER[$pluginconfig->user_attribute];
|
||||
$frm->username = strtolower($_SERVER[$pluginconfig->user_attribute]);
|
||||
$frm->password = substr(base64_encode($_SERVER[$pluginconfig->user_attribute]),0,8);
|
||||
// The random password consists of the first 8 letters of the base 64 encoded user ID
|
||||
// This password is never used unless the user account is converted to manual
|
||||
|
||||
+2
-1
@@ -14,13 +14,14 @@
|
||||
$cancel = optional_param( 'cancel' );
|
||||
$launch = optional_param( 'launch' );
|
||||
|
||||
require_login();
|
||||
|
||||
if (!empty($id)) {
|
||||
require_login($id);
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
require_login();
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
|
||||
+14
-8
@@ -115,6 +115,8 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
<form id="form1" method="post" action="backup.php">
|
||||
<table cellpadding="5" style="margin-left:auto;margin-right:auto;">
|
||||
<?php
|
||||
/// Acummulator for hidden options and proper XHTML output
|
||||
$hidden_options = '';
|
||||
//Now, check modules and info and show posibilities
|
||||
if ($allmods = get_records("modules") ) {
|
||||
//Print option to select/deselect everything with 1 click.
|
||||
@@ -189,8 +191,8 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
}
|
||||
//Line
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>\n";
|
||||
|
||||
if (empty($to)) {
|
||||
|
||||
if (empty($to) && !empty($course->metacourse)) {
|
||||
//Now print the Metacourse tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
@@ -202,7 +204,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_metacourse" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_metacourse" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
@@ -218,7 +220,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_users" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_users" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
@@ -233,7 +235,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_logs" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_logs" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
@@ -248,7 +250,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_user_files" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_user_files" value="0" />';
|
||||
}
|
||||
//Now print the Course Files tr
|
||||
echo "<tr>";
|
||||
@@ -272,7 +274,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_messages" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_messages" value="0" />';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,6 +320,10 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//the temp-directory name and records in backup temp tables
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
/// Print captured hidden options, now that we have closed the table
|
||||
echo $hidden_options;
|
||||
?>
|
||||
|
||||
<div style="text-align:center;margin-left:auto;margin-right:auto">
|
||||
<input type="hidden" name="id" value="<?php p($id) ?>" />
|
||||
@@ -328,4 +334,4 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
<input type="submit" value="<?php print_string("continue") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
@@ -177,7 +177,7 @@ function schedule_backup_cron() {
|
||||
//Reference
|
||||
if ($count_error != 0 || $count_unfinished != 0) {
|
||||
$message .= " ".get_string('backupfailed')."\n\n";
|
||||
$dest_url = $CFG->wwwroot.'/backup/log.php';
|
||||
$dest_url = $CFG->wwwroot.'/admin/report/backups/index.php';
|
||||
$message .= " ".get_string('backuptakealook','',$dest_url)."\n\n";
|
||||
//Set message priority
|
||||
$admin->priority = 1;
|
||||
@@ -192,7 +192,7 @@ function schedule_backup_cron() {
|
||||
$prefix = $site->shortname.": ";
|
||||
if ($count_error != 0 || $count_unfinished != 0) {
|
||||
$prefix .= "[".strtoupper(get_string('error'))."] ";
|
||||
}
|
||||
}
|
||||
$subject = $prefix.get_string("scheduledbackupstatus");
|
||||
|
||||
//Send the message
|
||||
|
||||
@@ -634,7 +634,6 @@
|
||||
fwrite ($bf,full_tag("STUDENTS",3,false,$course->students));
|
||||
fwrite ($bf,full_tag("GUEST",3,false,$course->guest));
|
||||
fwrite ($bf,full_tag("STARTDATE",3,false,$course->startdate));
|
||||
fwrite ($bf,full_tag("ENROLPERIOD",3,false,$course->enrolperiod));
|
||||
fwrite ($bf,full_tag("NUMSECTIONS",3,false,$course->numsections));
|
||||
//fwrite ($bf,full_tag("SHOWRECENT",3,false,$course->showrecent)); INFO: This is out in 1.3
|
||||
fwrite ($bf,full_tag("MAXBYTES",3,false,$course->maxbytes));
|
||||
@@ -657,6 +656,13 @@
|
||||
} else {
|
||||
$status = fwrite ($bf,full_tag("METACOURSE",3,false,$course->metacourse));
|
||||
}
|
||||
fwrite ($bf,full_tag("EXPIRENOTIFY",3,false,$course->expirynotify));
|
||||
fwrite ($bf,full_tag("NOTIFYSTUDENTS",3,false,$course->notifystudents));
|
||||
fwrite ($bf,full_tag("EXPIRYTHRESHOLD",3,false,$course->expirythreshold));
|
||||
fwrite ($bf,full_tag("ENROLLABLE",3,false,$course->enrollable));
|
||||
fwrite ($bf,full_tag("ENROLSTARTDATE",3,false,$course->enrolstartdate));
|
||||
fwrite ($bf,full_tag("ENROLENDDATE",3,false,$course->enrolenddate));
|
||||
fwrite ($bf,full_tag("ENROLPERIOD",3,false,$course->enrolperiod));
|
||||
|
||||
/// write local course overrides here?
|
||||
write_role_overrides_xml($bf, $context, 3);
|
||||
|
||||
+3
-132
@@ -1,142 +1,13 @@
|
||||
<?php // $Id$
|
||||
// backup.php - allows admin to edit all configuration variables for scheduled backups
|
||||
// log.php - old scheduled backups report. Now redirecting
|
||||
// to the new admin one
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("../backup/lib.php");
|
||||
|
||||
$courseid = optional_param('courseid',0,PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
//Get needed strings
|
||||
$backuploglaststatus = get_string("backuploglaststatus");
|
||||
$backuplogdetailed = get_string("backuplogdetailed");
|
||||
$stradmin = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strbackup = get_string("backup");
|
||||
$strbackupdetails = get_string("backupdetails");
|
||||
$strlogs = get_string("logs");
|
||||
$strftimedatetime = get_string("strftimerecent");
|
||||
$strftimetime = get_string("strftimetime").":%S";
|
||||
$strerror = get_string("error");
|
||||
$strok = get_string("ok");
|
||||
$strunfinished = get_string("unfinished");
|
||||
$strskipped = get_string("skipped");
|
||||
$strcourse = get_string("course");
|
||||
$strtimetaken = get_string("timetaken","quiz");
|
||||
$strstatus = get_string("status");
|
||||
$strnext = get_string("next");
|
||||
|
||||
//Decide when to show last execution logs or detailed logs
|
||||
//Lastlog view
|
||||
if (!$courseid) {
|
||||
print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"../$CFG->admin/configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"../$CFG->admin/backup.php?sesskey=$USER->sesskey\">$strbackup</a> -> ".
|
||||
$strlogs);
|
||||
|
||||
print_heading($backuploglaststatus);
|
||||
print_simple_box_start('center');
|
||||
//Now, get every record from backup_courses
|
||||
$courses = get_records("backup_courses");
|
||||
|
||||
if (!$courses) {
|
||||
notify("No logs found!");
|
||||
} else {
|
||||
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
|
||||
//Print table header
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strcourse</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\"><font size=\"3\">$strtimetaken</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strstatus</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strnext</font></td></tr>";
|
||||
foreach ($courses as $course) {
|
||||
//Get the course shortname
|
||||
$coursename = get_field ("course","fullname","id",$course->courseid);
|
||||
if ($coursename) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\"><a href=\"log.php?courseid=$course->courseid\">".$coursename."</a></font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->laststarttime,$strftimedatetime)."</font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\"> - </font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->lastendtime,$strftimedatetime)."</font></td>";
|
||||
if ($course->laststatus == 1) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
|
||||
} else if ($course->laststatus == 2) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
|
||||
} else if ($course->laststatus == 3) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strskipped."</font></td>";
|
||||
} else {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
|
||||
}
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->nextstarttime,$strftimedatetime)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
//Detailed View !!
|
||||
} else {
|
||||
print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"../$CFG->admin/configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"../$CFG->admin/backup.php?sesskey=$USER->sesskey\">$strbackup</a> -> ".
|
||||
"<a href=\"log.php\">$strlogs</a> -> ".
|
||||
$strbackupdetails);
|
||||
|
||||
print_heading($backuplogdetailed);
|
||||
|
||||
$coursename = get_field("course","fullname","id","$courseid");
|
||||
print_heading("$strcourse: $coursename");
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
||||
//First, me get all the distinct backups for that course in backup_log
|
||||
$executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime
|
||||
FROM {$CFG->prefix}backup_log
|
||||
WHERE courseid = '$courseid'
|
||||
ORDER BY laststarttime DESC");
|
||||
|
||||
//Iterate over backup executions
|
||||
if (!$executions) {
|
||||
notify("No logs found!");
|
||||
} else {
|
||||
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
|
||||
foreach($executions as $execution) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\">";
|
||||
print_simple_box("<center>".userdate($execution->laststarttime)."</center>", "center");
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
$logs = get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}backup_log
|
||||
WHERE courseid = '$courseid' AND
|
||||
laststarttime = '$execution->laststarttime'
|
||||
ORDER BY id");
|
||||
if ($logs) {
|
||||
foreach ($logs as $log) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($log->time,$strftimetime)."</font></td>";
|
||||
$log->info = str_replace("- ERROR!!","- <font color=\"red\">ERROR!!</font>",$log->info);
|
||||
$log->info = str_replace("- OK","- <font color=\"green\">OK</font>",$log->info);
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".str_replace(" "," ",$log->info)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
|
||||
print_footer();
|
||||
redirect("$CFG->wwwroot/$CFG->admin/report/backups/index.php", '', 'admin', 1);
|
||||
|
||||
?>
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
}
|
||||
|
||||
if (!empty($id)) {
|
||||
require_login($id);
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
|
||||
+28
-11
@@ -18,13 +18,21 @@
|
||||
|
||||
if ($form1 = data_submitted()) {
|
||||
$currentcourseshortname = $course_header->course_shortname; //"store_ShortName";
|
||||
$course_header->course_shortname = $form1->shortname; //"update_ShortName";
|
||||
$course_header->course_fullname = $form1->fullname; //"update_FullName";
|
||||
$form1->startdate = make_timestamp($form1->startyear, $form1->startmonth, $form1->startday);
|
||||
$currentcoursestartdate = $course_header->course_startdate;
|
||||
$coursestartdatedateoffset = $form1->startdate - $currentcoursestartdate;
|
||||
$restore->course_startdateoffset = $coursestartdatedateoffset; //change to restore
|
||||
}
|
||||
$course_header->course_shortname = stripslashes_safe($form1->shortname); //"update_ShortName";
|
||||
$course_header->course_fullname = stripslashes_safe($form1->fullname); //"update_FullName";
|
||||
/// Roll dates only if the backup course has a start date
|
||||
/// (some formats like main page, social..., haven't it and rolling dates
|
||||
/// from 0 produces crazy dates. MDL-10125
|
||||
if ($course_header->course_startdate) {
|
||||
$form1->startdate = make_timestamp($form1->startyear, $form1->startmonth, $form1->startday);
|
||||
$currentcoursestartdate = $course_header->course_startdate;
|
||||
$coursestartdatedateoffset = $form1->startdate - $currentcoursestartdate;
|
||||
$restore->course_startdateoffset = $coursestartdatedateoffset; //change to restore
|
||||
} else { // don't roll if the course hasn't start date
|
||||
$coursestartdatedateoffset = 0;
|
||||
$restore->course_startdateoffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
///Enforce SESSION->course_header rewrite (PHP 4.x needed because assigns are by value) MDL-8298
|
||||
$SESSION->course_header = $course_header;
|
||||
@@ -153,6 +161,13 @@
|
||||
$restore->course_id=$course_id;
|
||||
}
|
||||
}
|
||||
|
||||
// pass in the course category param
|
||||
$cat_id = optional_param('restore_restorecatto', 0, PARAM_INT);
|
||||
if ($cat_id) {
|
||||
$restore->restore_restorecatto = $cat_id;
|
||||
}
|
||||
|
||||
//We have the object with data, put it in the session
|
||||
$SESSION->restore = $restore;
|
||||
|
||||
@@ -189,7 +204,7 @@
|
||||
// 2-New course: Create the restore object and launch the execute.
|
||||
|
||||
//If the user is a teacher and not a creator
|
||||
if (!has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!user_can_create_courses()) {
|
||||
$restore->course_id = $id;
|
||||
if ($restore->restoreto == 0) {
|
||||
$restore->deleting = true;
|
||||
@@ -199,7 +214,8 @@
|
||||
}
|
||||
|
||||
//If the user is a creator (or admin)
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
//if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (user_can_create_courses()) {
|
||||
//Set restore->deleting as needed
|
||||
if ($restore->restoreto == 0) {
|
||||
$restore->deleting = true;
|
||||
@@ -209,7 +225,8 @@
|
||||
}
|
||||
|
||||
//Now, select the course if needed
|
||||
if (($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id == 0) and has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
//if (($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id == 0) and get_capability_courses('moodle/site:restore')) {
|
||||
if (($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id == 0)) {
|
||||
if ($courses = get_courses("all","c.fullname","c.id,c.fullname,c.shortname,c.visible")) {
|
||||
print_heading(get_string("choosecourse"));
|
||||
print_simple_box_start("center");
|
||||
@@ -232,7 +249,7 @@
|
||||
//Checks everything and execute restore
|
||||
} else if ((($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id != 0)) or ($restore->restoreto == 2)) {
|
||||
//Final access control check
|
||||
if ($restore->course_id == 0 and !has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if ($restore->course_id == 0 and !user_can_create_courses()) {
|
||||
error("You need to be a creator or admin to restore into new course!");
|
||||
} else if ($restore->course_id != 0 and !has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $restore->course_id))) {
|
||||
error("You need to be an edit teacher or admin to restore into selected course!");
|
||||
|
||||
+143
-23
@@ -92,14 +92,17 @@
|
||||
}
|
||||
|
||||
if (!isset($restore_restoreto)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!user_can_create_courses()) {
|
||||
$restore_restoreto = 1;
|
||||
}
|
||||
if (has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
} else {
|
||||
$restore_restoreto = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($course_header->category->id)) {
|
||||
$course_header->category->id = 0;
|
||||
}
|
||||
|
||||
if(!isset($form1->startdate)) {
|
||||
$form1->startdate = $course_header->course_startdate; //$course_header->course_startdate;
|
||||
}
|
||||
@@ -171,25 +174,61 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo get_string("restoreto").":</b>";
|
||||
echo "</td><td colspan=\"3\">";
|
||||
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
// permission should have been checked already
|
||||
|
||||
/**
|
||||
* if user has manageactivities in any course, we show
|
||||
* existingcoursedeleting
|
||||
* existingcourseadding
|
||||
* else we show
|
||||
* currentcoursedeleting
|
||||
* currentcourse
|
||||
* if user has course:create in any category, we show
|
||||
* newcourse
|
||||
*/
|
||||
|
||||
$mycourses = get_capability_courses('moodle/site:restore');
|
||||
// if the user can manage 2 or more courses,
|
||||
// or if the only course the user can manage is not the current course
|
||||
// we show options for existing courses
|
||||
if (count($mycourses) > 1 || !in_array($id, $mycourses)) {
|
||||
// if user can manage more than 1 course, or if user can restore to a single different course
|
||||
$restore_restoreto_options[0] = get_string("existingcoursedeleting");
|
||||
$restore_restoreto_options[1] = get_string("existingcourseadding");
|
||||
$restore_restoreto_options[2] = get_string("newcourse");
|
||||
} else { // fix for MDL-7773
|
||||
// else if the user can write to current course
|
||||
} else if (has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))){
|
||||
$restore_restoreto_options[0] = get_string("currentcoursedeleting");
|
||||
$restore_restoreto_options[1] = get_string("currentcourseadding");
|
||||
$restore_restoreto_options[1] = get_string("currentcourseadding");
|
||||
}
|
||||
|
||||
// if user can create any course at all, give the option
|
||||
if (user_can_create_courses()) {
|
||||
$restore_restoreto_options[2] = get_string("newcourse");
|
||||
}
|
||||
|
||||
choose_from_menu($restore_restoreto_options, "restore_restoreto", $restore_restoreto, "");
|
||||
echo "</td></tr>";
|
||||
if (iscreator()) { //display these fields conditionally
|
||||
if (user_can_create_courses()) { //display these fields conditionally
|
||||
|
||||
// find the list of cates user can edit
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string('category');
|
||||
echo " :</td>";
|
||||
echo "<td>";
|
||||
choose_from_menu(get_creatable_categories(), "restore_restorecatto", $course_header->category->id, "");
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string("shortname");
|
||||
echo " :</td>";
|
||||
echo "<td><input type=\"text\" name=\"shortname\" maxlength=\"15\" size=\"10\" value=\"$form1->shortname\" alt=\"".get_string("shortname")."\" />" ;
|
||||
helpbutton("courseshortname", get_string("shortname")) ;
|
||||
if (isset($err["shortname"])) formerr($err["shortname"]);
|
||||
if (isset($err["shortname"])) formerr($err["shortname"]);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string("fullname");
|
||||
@@ -200,9 +239,19 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo"</td></tr>";
|
||||
echo "<tr valign=\"top\"> ";
|
||||
echo "<td align=\"right\"> ";
|
||||
print_string("startdate");
|
||||
echo ":</td><td>";
|
||||
print_date_selector("startday", "startmonth", "startyear", $form1->startdate);
|
||||
print_string("startdate");
|
||||
echo ":</td><td>";
|
||||
/// Show the roll dates option only if the backup course has a start date
|
||||
/// (some formats like main page, social..., haven't it and rolling dates
|
||||
/// from 0 produces crazy dates. MDL-10125
|
||||
if ($form1->startdate) {
|
||||
print_date_selector("startday", "startmonth", "startyear", $form1->startdate);
|
||||
} else {
|
||||
print_string('notavailable');
|
||||
echo '<input type="hidden" name="startyear" value="0" />';
|
||||
echo '<input type="hidden" name="startmonth" value="0" />';
|
||||
echo '<input type="hidden" name="startday" value="0" />';
|
||||
}
|
||||
helpbutton("coursestartdate", get_string("startdate"));
|
||||
echo "</td></tr>";
|
||||
}
|
||||
@@ -231,6 +280,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</tr>";
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
$currentrow = 0;
|
||||
$nonrestmod = '';
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modrestore = $modname."_restore_mods";
|
||||
@@ -429,6 +479,7 @@ $info = restore_read_xml_info($xml_file);
|
||||
// fix for MDL-9068, front page course is just a normal course
|
||||
$siterolesarray = get_assignable_roles (get_context_instance(CONTEXT_COURSE, $course->id), "shortname");
|
||||
$siterolesnamearray = get_assignable_roles (get_context_instance(CONTEXT_COURSE, $course->id), "name");
|
||||
$allroles = get_records('role');
|
||||
|
||||
echo ('<table width="100%" class="restore-form-instances">');
|
||||
echo ('<tr><td align="right" style="width:50%"><b>'.get_string('sourcerole').'</b></td><td align="left" style="width:50%"><b>'.get_string('targetrole').'</b></td></tr>');
|
||||
@@ -483,21 +534,34 @@ if ($info->backup_moodle_version < 2006092801) {
|
||||
}
|
||||
|
||||
foreach ($roles->roles as $roleid=>$role) {
|
||||
|
||||
$mappableroles = $siteroleschoicearray;
|
||||
|
||||
echo ('<tr><td align="right">');
|
||||
echo $role->name." (".($role->shortname).")";
|
||||
echo ('</td><td align="left">');
|
||||
|
||||
// see if any short name match
|
||||
$matchrole = 0;
|
||||
foreach ($siterolesarray as $siteroleid=>$siteroleshortname) {
|
||||
if ($siteroleshortname == $role->shortname) {
|
||||
$matchrole = $siteroleid;
|
||||
break;
|
||||
}
|
||||
|
||||
/// first, we see if any exact role definition is found
|
||||
/// if found, that is the only option of restoring to
|
||||
|
||||
if ($samerole = restore_samerole($roleid, $role)) {
|
||||
$matchrole = $samerole->id;
|
||||
// if an exact role is found, it does not matter whether this user can assign this role or not,
|
||||
// this will be presented as a valid option regardless
|
||||
$mappableroles[$samerole->id] = $allroles[$samerole->id]->name." (". $allroles[$samerole->id]->shortname.")";
|
||||
} else {
|
||||
// no exact role found, let's try to match shortname
|
||||
// this is useful in situations where basic roles differ slightly in definition
|
||||
$matchrole = 0;
|
||||
foreach ($siterolesarray as $siteroleid=>$siteroleshortname) {
|
||||
if ($siteroleshortname == $role->shortname) {
|
||||
$matchrole = $siteroleid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
choose_from_menu ($siteroleschoicearray, "roles_".$roleid, $matchrole, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
choose_from_menu ($mappableroles, "roles_".$roleid, $matchrole, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,3 +580,59 @@ echo ('</table>'); // end of role mappings table
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
/*
|
||||
* If there is a role with exactly the same definition, we pull it out from db
|
||||
*/
|
||||
function restore_samerole($roleid, $role) {
|
||||
global $CFG;
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
// first let's use the id
|
||||
|
||||
if ($trole = get_records_sql("SELECT roleid,capability,permission
|
||||
FROM {$CFG->prefix}role_capabilities
|
||||
WHERE roleid = $roleid")) {
|
||||
|
||||
if (restore_is_samerole($trole, $role)) {
|
||||
$firstcap = array_shift($trole);
|
||||
return get_record('role', 'id', $firstcap->roleid);
|
||||
}
|
||||
}
|
||||
|
||||
// unfortunately then we have to loop all roles with the same number of capabiltiies
|
||||
if ($proles = get_records_sql("SELECT roleid, roleid
|
||||
FROM {$CFG->prefix}role_capabilities
|
||||
GROUP BY roleid
|
||||
HAVING COUNT(capability) = ".count($role->capabilities))) {
|
||||
foreach ($proles as $proleid=>$proleobj) {
|
||||
if ($prole = get_records('role_capabilities', 'roleid', $proleid)) {
|
||||
if (restore_is_samerole($prole, $role)) {
|
||||
return get_record('role', 'id', $proleid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* rolea from db, roleb from xml
|
||||
*/
|
||||
function restore_is_samerole($rolea, $roleb) {
|
||||
|
||||
if (count($rolea) != count($roleb->capabilities)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($rolea as $cap) {
|
||||
if ($cap->permission != $roleb->capabilities[$cap->capability]->permission) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
?>
|
||||
+82
-27
@@ -533,8 +533,18 @@
|
||||
$course_header->course_shortname = $currentshortname;
|
||||
|
||||
//Now calculate the category
|
||||
$category = get_record("course_categories","id",$course_header->category->id,
|
||||
"name",addslashes($course_header->category->name));
|
||||
|
||||
// first try to get it from restore
|
||||
if ($restore->restore_restorecatto) {
|
||||
$category = get_record('course_categories', 'id', $restore->restore_restorecatto);
|
||||
}
|
||||
|
||||
// else we try to get it from the xml file
|
||||
//Now calculate the category
|
||||
if (!$category) {
|
||||
$category = get_record("course_categories","id",$course_header->category->id,
|
||||
"name",addslashes($course_header->category->name));
|
||||
}
|
||||
//If no exists, try by name only
|
||||
if (!$category) {
|
||||
$category = get_record("course_categories","name",addslashes($course_header->category->name));
|
||||
@@ -585,7 +595,6 @@
|
||||
$course->guest = addslashes($course_header->course_guest);
|
||||
$course->startdate = addslashes($course_header->course_startdate);
|
||||
$course->startdate += $restore->course_startdateoffset;
|
||||
$course->enrolperiod = addslashes($course_header->course_enrolperiod);
|
||||
$course->numsections = addslashes($course_header->course_numsections);
|
||||
//$course->showrecent = addslashes($course_header->course_showrecent); INFO: This is out in 1.3
|
||||
$course->maxbytes = addslashes($course_header->course_maxbytes);
|
||||
@@ -606,6 +615,19 @@
|
||||
$course->timecreated = addslashes($course_header->course_timecreated);
|
||||
$course->timemodified = addslashes($course_header->course_timemodified);
|
||||
$course->metacourse = addslashes($course_header->course_metacourse);
|
||||
$course->expirynotify = isset($course_header->course_expirynotify) ? addslashes($course_header->course_expirynotify):0;
|
||||
$course->notifystudents = isset($course_header->course_notifystudents) ? addslashes($course_header->course_notifystudents) : 0;
|
||||
$course->expirythreshold = isset($course_header->course_expirythreshold) ? addslashes($course_header->course_expirythreshold) : 0;
|
||||
$course->enrollable = isset($course_header->course_enrollable) ? addslashes($course_header->course_enrollable) : 1;
|
||||
$course->enrolstartdate = isset($course_header->course_enrolstartdate) ? addslashes($course_header->course_enrolstartdate) : 0;
|
||||
if ($course->enrolstartdate) { //Roll course dates
|
||||
$course->enrolstartdate += $restore->course_startdateoffset;
|
||||
}
|
||||
$course->enrolenddate = isset($course_header->course_enrolenddate) ? addslashes($course_header->course_enrolenddate) : 0;
|
||||
if ($course->enrolenddate) { //Roll course dates
|
||||
$course->enrolenddate += $restore->course_startdateoffset;
|
||||
}
|
||||
$course->enrolperiod = addslashes($course_header->course_enrolperiod);
|
||||
//Calculate sortorder field
|
||||
$sortmax = get_record_sql('SELECT MAX(sortorder) AS max
|
||||
FROM ' . $CFG->prefix . 'course
|
||||
@@ -935,14 +957,18 @@
|
||||
// Yu: This part is called repeatedly for every instance,
|
||||
// so it is necessary to set the granular flag and check isset()
|
||||
// when the first instance of this type of mod is processed.
|
||||
if (!isset($restore->mods[$mod->type]->granular) && isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
// This defines whether we want to restore specific
|
||||
// instances of the modules (granular restore), or
|
||||
// whether we don't care and just want to restore
|
||||
// all module instances (non-granular).
|
||||
$restore->mods[$mod->type]->granular = true;
|
||||
} else {
|
||||
$restore->mods[$mod->type]->granular = false;
|
||||
//if (!isset($restore->mods[$mod->type]->granular) && isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
|
||||
if (!isset($restore->mods[$mod->type]->granular)) {
|
||||
if (isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
// This defines whether we want to restore specific
|
||||
// instances of the modules (granular restore), or
|
||||
// whether we don't care and just want to restore
|
||||
// all module instances (non-granular).
|
||||
$restore->mods[$mod->type]->granular = true;
|
||||
} else {
|
||||
$restore->mods[$mod->type]->granular = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if we've to restore this module (and instance)
|
||||
@@ -1181,7 +1207,7 @@
|
||||
if (!$preferencescount) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grade').'</li>';
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grades').'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1192,7 +1218,7 @@
|
||||
if ($pref_rec->value == 0) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('respectingcurrentdata','grade').'</li>';
|
||||
echo '<li>'.get_string('respectingcurrentdata','grades').'</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1208,7 +1234,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_preferences' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$counter,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1262,7 +1288,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_letter' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$counter,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1312,7 +1338,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_category' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$countercat,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1790,7 +1816,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $unreadcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -1855,7 +1881,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $readcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_read' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_read' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -1922,7 +1948,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $contactcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_contacts' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_contacts' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -2182,10 +2208,21 @@
|
||||
$gro->hidepicture = backup_todb($info['GROUP']['#']['HIDEPICTURE']['0']['#']);
|
||||
$gro->timecreated = backup_todb($info['GROUP']['#']['TIMECREATED']['0']['#']);
|
||||
$gro->timemodified = backup_todb($info['GROUP']['#']['TIMEMODIFIED']['0']['#']);
|
||||
|
||||
//Now search if that group exists (by name and description field) in
|
||||
|
||||
//Now search if that group exists (by name and description field) in
|
||||
//restore->course_id course
|
||||
$gro_db = groups_group_matches($restore->course_id, $gro->name, $gro->description);
|
||||
//Going to compare LOB columns so, use the cross-db sql_compare_text() in both sides.
|
||||
$description_clause = '';
|
||||
if (!empty($gro->description)) { /// Only for groups having a description
|
||||
$literal_description = "'" . $gro->description . "'";
|
||||
$description_clause = " AND " .
|
||||
sql_compare_text('description') . " = " .
|
||||
sql_compare_text($literal_description);
|
||||
}
|
||||
$gro_db = get_record_sql("SELECT *
|
||||
FROM {$CFG->prefix}groups
|
||||
WHERE courseid = $restore->course_id AND
|
||||
name = '{$gro->name}'" . $description_clause);
|
||||
//If it doesn't exist, create
|
||||
if (!$gro_db) {
|
||||
$create_group = true;
|
||||
@@ -2817,7 +2854,7 @@
|
||||
while ($counter < $count_logs) {
|
||||
//Get a chunk of records
|
||||
//Take old_id twice to avoid adodb limitation
|
||||
$logs = get_records_select("backup_ids","table_name = 'log' AND backup_code = '$restore->backup_unique_code'","old_id","old_id,old_id",$counter,$recordset_size);
|
||||
$logs = get_records_select("backup_ids","table_name = 'log' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
//We have logs
|
||||
if ($logs) {
|
||||
//Iterate
|
||||
@@ -3831,9 +3868,6 @@
|
||||
case "STARTDATE":
|
||||
$this->info->course_startdate = $this->getContents();
|
||||
break;
|
||||
case "ENROLPERIOD":
|
||||
$this->info->course_enrolperiod = $this->getContents();
|
||||
break;
|
||||
case "NUMSECTIONS":
|
||||
$this->info->course_numsections = $this->getContents();
|
||||
break;
|
||||
@@ -3882,6 +3916,27 @@
|
||||
case "METACOURSE":
|
||||
$this->info->course_metacourse = $this->getContents();
|
||||
break;
|
||||
case "EXPIRENOTIFY":
|
||||
$this->info->course_expirynotify = $this->getContents();
|
||||
break;
|
||||
case "NOTIFYSTUDENTS":
|
||||
$this->info->course_notifystudents = $this->getContents();
|
||||
break;
|
||||
case "EXPIRYTHRESHOLD":
|
||||
$this->info->course_expirythreshold = $this->getContents();
|
||||
break;
|
||||
case "ENROLLABLE":
|
||||
$this->info->course_enrollable = $this->getContents();
|
||||
break;
|
||||
case "ENROLSTARTDATE":
|
||||
$this->info->course_enrolstartdate = $this->getContents();
|
||||
break;
|
||||
case "ENROLENDDATE":
|
||||
$this->info->course_enrolenddate = $this->getContents();
|
||||
break;
|
||||
case "ENROLPERIOD":
|
||||
$this->info->course_enrolperiod = $this->getContents();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($this->tree[4] == "CATEGORY") {
|
||||
@@ -6687,7 +6742,7 @@
|
||||
$newcontext = get_context_instance($contextlevel, $oldinstance->new_id);
|
||||
$assignment->contextid = $newcontext->id; // new context id
|
||||
// might already have same assignment
|
||||
role_assign($assignment->roleid, $assignment->userid, 0, $assignment->contextid, $assignment->timestart, $assignment->timeend, $assignment->hidden, $assignment->enrol);
|
||||
role_assign($assignment->roleid, $assignment->userid, 0, $assignment->contextid, $assignment->timestart, $assignment->timeend, $assignment->hidden, $assignment->enrol, $assignment->timemodified);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,6 +324,15 @@ class block_base {
|
||||
$this->str->assignroles = get_string('assignroles', 'role');
|
||||
}
|
||||
|
||||
// RTL support - exchange right and left arrows
|
||||
if (right_to_left()) {
|
||||
$rightarrow = 'left.gif';
|
||||
$leftarrow = 'right.gif';
|
||||
} else {
|
||||
$rightarrow = 'right.gif';
|
||||
$leftarrow = 'left.gif';
|
||||
}
|
||||
|
||||
$movebuttons = '<div class="commands">';
|
||||
|
||||
if ($this->instance->visible) {
|
||||
@@ -344,9 +353,10 @@ class block_base {
|
||||
}
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey));
|
||||
|
||||
// place holder for roles button
|
||||
$movebuttons .= '<a class="icon roles" title="'. $this->str->assignroles .'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$blockcontext->id.'">' .
|
||||
'<img src="'.$CFG->pixpath.'/i/roles.gif" alt="'.$this->str->assignroles.'" /></a>';
|
||||
if (empty($this->instance->pinned)) {
|
||||
$movebuttons .= '<a class="icon roles" title="'. $this->str->assignroles .'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$blockcontext->id.'">' .
|
||||
'<img src="'.$CFG->pixpath.'/i/roles.gif" alt="'.$this->str->assignroles.'" /></a>';
|
||||
}
|
||||
|
||||
$movebuttons .= '<a class="icon hide" title="'. $title .'" href="'.$script.'&blockaction=toggle">' .
|
||||
'<img src="'. $CFG->pixpath.$icon .'" alt="'.$title.'" /></a>';
|
||||
@@ -361,7 +371,7 @@ class block_base {
|
||||
|
||||
if ($options & BLOCK_MOVE_LEFT) {
|
||||
$movebuttons .= '<a class="icon left" title="'. $this->str->moveleft .'" href="'.$script.'&blockaction=moveleft">' .
|
||||
'<img src="'. $CFG->pixpath .'/t/left.gif" alt="'. $this->str->moveleft .'" /></a>';
|
||||
'<img src="'. $CFG->pixpath .'/t/'.$leftarrow.'" alt="'. $this->str->moveleft .'" /></a>';
|
||||
}
|
||||
if ($options & BLOCK_MOVE_UP) {
|
||||
$movebuttons .= '<a class="icon up" title="'. $this->str->moveup .'" href="'.$script.'&blockaction=moveup">' .
|
||||
@@ -373,7 +383,7 @@ class block_base {
|
||||
}
|
||||
if ($options & BLOCK_MOVE_RIGHT) {
|
||||
$movebuttons .= '<a class="icon right" title="'. $this->str->moveright .'" href="'.$script.'&blockaction=moveright">' .
|
||||
'<img src="'. $CFG->pixpath .'/t/right.gif" alt="'. $this->str->moveright .'" /></a>';
|
||||
'<img src="'. $CFG->pixpath .'/t/'.$rightarrow.'" alt="'. $this->str->moveright .'" /></a>';
|
||||
}
|
||||
|
||||
$movebuttons .= '</div>';
|
||||
|
||||
@@ -55,29 +55,31 @@ class block_online_users extends block_base {
|
||||
}
|
||||
|
||||
if ($COURSE->id == SITEID) { // Site-level
|
||||
$courseselect = '';
|
||||
$timeselect = "AND (ul.timeaccess > $timefrom OR u.lastaccess > $timefrom)";
|
||||
} else {
|
||||
$select = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, max(u.lastaccess) as lastaccess ";
|
||||
$from = "FROM {$CFG->prefix}user u
|
||||
$groupmembers ";
|
||||
$where = "WHERE u.lastaccess > $timefrom
|
||||
$groupselect ";
|
||||
$order = "ORDER BY lastaccess DESC ";
|
||||
|
||||
} else { // Course-level
|
||||
$courseselect = "AND ul.courseid = '".$COURSE->id."'";
|
||||
$timeselect = "AND ul.timeaccess > $timefrom";
|
||||
$select = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, max(ul.timeaccess) as lastaccess ";
|
||||
$from = "FROM {$CFG->prefix}user_lastaccess ul,
|
||||
{$CFG->prefix}user u
|
||||
$groupmembers ";
|
||||
$where = "WHERE ul.timeaccess > $timefrom
|
||||
AND u.id = ul.userid
|
||||
AND ul.courseid = $COURSE->id
|
||||
$groupselect ";
|
||||
$order = "ORDER BY lastaccess DESC ";
|
||||
}
|
||||
|
||||
$groupby = "GROUP BY u.id, u.username, u.firstname, u.lastname, u.picture ";
|
||||
|
||||
$SQL = $select . $from . $where . $groupby . $order;
|
||||
|
||||
$users = array();
|
||||
|
||||
$SQL = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess, ul.timeaccess
|
||||
FROM {$CFG->prefix}user_lastaccess ul,
|
||||
{$CFG->prefix}user u
|
||||
$groupmembers
|
||||
WHERE
|
||||
ul.userid = u.id
|
||||
$courseselect
|
||||
$timeselect
|
||||
$groupselect
|
||||
GROUP BY u.id
|
||||
ORDER BY ul.timeaccess DESC";
|
||||
|
||||
|
||||
|
||||
$users = array();
|
||||
$pcontext = get_related_contexts_string($context);
|
||||
|
||||
if ($pusers = get_records_sql($SQL, 0, 50)) { // We'll just take the most recent 50 maximum
|
||||
@@ -116,7 +118,7 @@ class block_online_users extends block_base {
|
||||
$this->content->text .= "<ul class='list'>\n";
|
||||
foreach ($users as $user) {
|
||||
$this->content->text .= '<li class="listentry">';
|
||||
$timeago = format_time(time() - max($user->timeaccess, $user->lastaccess)); //bruno to calculate correctly on frontpage
|
||||
$timeago = format_time(time() - $user->lastaccess); //bruno to calculate correctly on frontpage
|
||||
if ($user->username == 'guest') {
|
||||
$this->content->text .= '<div class="user">'.print_user_picture($user->id, $COURSE->id, $user->picture, 16, true, false, '', false);
|
||||
$this->content->text .= get_string('guestuser').'</div>';
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
$numids = count($rssidarray);
|
||||
$count = 0;
|
||||
foreach ($rssidarray as $rssid) {
|
||||
$output .= clean_text($this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false), FORMAT_HTML);
|
||||
$output .= $this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false);
|
||||
if ($numids > 1 && $count != $numids -1 && !empty($rssfeedstring)) {
|
||||
$output .= '<hr style="width=:80%" />';
|
||||
}
|
||||
@@ -197,11 +197,14 @@
|
||||
} else {
|
||||
$feedtitle = $this->format_title($rss_record->preferredtitle);
|
||||
}
|
||||
// print_object($rss);
|
||||
|
||||
if (isset($this->config) &&
|
||||
isset($this->config->block_rss_client_show_channel_image) &&
|
||||
$this->config->block_rss_client_show_channel_image &&
|
||||
isset($rss->image) && isset($rss->image['link']) && isset($rss->image['title']) && isset($rss->image['url']) ) {
|
||||
|
||||
$rss->image['title'] = s($rss->image['title']);
|
||||
|
||||
$returnstring .= "\n".'<div class="image" title="'. $rss->image['title'] .'"><a href="'. $rss->image['link'] .'"><img src="'. $rss->image['url'] .'" alt="'. $rss->image['title'] .'" /></a></div>';
|
||||
}
|
||||
|
||||
@@ -235,7 +238,7 @@
|
||||
|
||||
$item['link'] = str_replace('&', '&', $item['link']);
|
||||
|
||||
$returnstring .= '<li><div class="link"><a href="'. $item['link'] .'">'. $item['title'] . "</a></div>\n";
|
||||
$returnstring .= '<li><div class="link"><a href="'. $item['link'] .'" onclick="this.target=\'_blank\'" >'. $item['title'] . "</a></div>\n";
|
||||
|
||||
if ($display_description && !empty($item['description'])) {
|
||||
$item['description'] = break_up_long_words($item['description'], 30);
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ $id = optional_param('id', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tab - does nothing here
|
||||
|
||||
require_login();
|
||||
require_login($courseid);
|
||||
|
||||
if (empty($CFG->bloglevel)) {
|
||||
error('Blogging is disabled!');
|
||||
@@ -361,4 +361,4 @@ function add_tags_info($postid) {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
+6
-2
@@ -74,7 +74,7 @@ switch ($filtertype) {
|
||||
}
|
||||
$courseid = $course->id;
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_login($course->id);
|
||||
require_login($course);
|
||||
if (!has_capability('moodle/blog:view', $coursecontext)) {
|
||||
error('You do not have the required permissions to view blogs in this course');
|
||||
}
|
||||
@@ -94,7 +94,7 @@ switch ($filtertype) {
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$courseid = $course->id;
|
||||
require_login($course->id);
|
||||
require_login($course);
|
||||
if (!has_capability('moodle/blog:view', $coursecontext)) {
|
||||
error('You do not have the required permissions to view blogs in this course/group');
|
||||
}
|
||||
@@ -131,6 +131,10 @@ switch ($filtertype) {
|
||||
}
|
||||
$userid = $filterselect;
|
||||
|
||||
if (!empty($courseid)) {
|
||||
require_login($courseid);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
+10
-3
@@ -433,7 +433,7 @@
|
||||
break;
|
||||
|
||||
case BLOG_COURSE_LEVEL:
|
||||
$mycourses = array_keys(get_my_courses($targetuserid));
|
||||
$mycourses = array_keys(get_my_courses($USER->id));
|
||||
$usercourses = array_keys(get_my_courses($targetuserid));
|
||||
$shared = array_intersect($mycourses, $usercourses);
|
||||
if (!empty($shared)) {
|
||||
@@ -443,7 +443,7 @@
|
||||
break;
|
||||
|
||||
case BLOG_GROUP_LEVEL:
|
||||
$mycourses = array_keys(get_my_courses($targetuserid));
|
||||
$mycourses = array_keys(get_my_courses($USER->id));
|
||||
$usercourses = array_keys(get_my_courses($targetuserid));
|
||||
$shared = array_intersect($mycourses, $usercourses);
|
||||
foreach ($shared as $courseid) {
|
||||
@@ -568,13 +568,20 @@
|
||||
// all users with a role assigned
|
||||
$context = get_context_instance(CONTEXT_COURSE, $filterselect);
|
||||
|
||||
// MDL-10037, hidden users' blogs should not appear
|
||||
if (has_capability('moodle/role:viewhiddenassigns', $context)) {
|
||||
$hiddensql = '';
|
||||
} else {
|
||||
$hiddensql = ' AND ra.hidden = 0 ';
|
||||
}
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'role_assignments ra, '.$CFG->prefix.'user u
|
||||
WHERE p.userid = ra.userid '.$tagquerysql.'
|
||||
AND ra.contextid '.get_related_contexts_string($context).'
|
||||
AND u.id = p.userid
|
||||
AND u.deleted = 0
|
||||
'.$permissionsql.$typesql;
|
||||
'.$hiddensql.$permissionsql.$typesql;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
+12
-28
@@ -70,7 +70,7 @@
|
||||
calendar_session_vars();
|
||||
|
||||
$now = usergetdate(time());
|
||||
$nav = calendar_get_link_tag($strcalendar, CALENDAR_URL.'view.php?view=upcoming&', $now['mday'], $now['mon'], $now['year']);
|
||||
$nav = calendar_get_link_tag($strcalendar, CALENDAR_URL.'view.php?view=upcoming&course='.$urlcourse.'&', $now['mday'], $now['mon'], $now['year']);
|
||||
$day = intval($now['mday']);
|
||||
$mon = intval($now['mon']);
|
||||
$yr = intval($now['year']);
|
||||
@@ -175,7 +175,7 @@
|
||||
}
|
||||
|
||||
// OK, now redirect to day view
|
||||
redirect(CALENDAR_URL.'view.php?view=day&cal_d='.$form->startday.'&cal_m='.$form->startmon.'&cal_y='.$form->startyr);
|
||||
redirect(CALENDAR_URL.'view.php?view=day&course='.$urlcourse.'&cal_d='.$form->startday.'&cal_m='.$form->startmon.'&cal_y='.$form->startyr);
|
||||
}
|
||||
else {
|
||||
foreach ($err as $key => $value) {
|
||||
@@ -241,7 +241,7 @@
|
||||
}
|
||||
}
|
||||
// OK, now redirect to day view
|
||||
redirect(CALENDAR_URL.'view.php?view=day&cal_d='.$form->startday.'&cal_m='.$form->startmon.'&cal_y='.$form->startyr);
|
||||
redirect(CALENDAR_URL.'view.php?view=day&course='.$urlcourse.'&cal_d='.$form->startday.'&cal_m='.$form->startmon.'&cal_y='.$form->startyr);
|
||||
}
|
||||
else {
|
||||
foreach ($err as $key => $value) {
|
||||
@@ -297,7 +297,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
redirect(CALENDAR_URL.'view.php?view=day&cal_d='.$_REQUEST['d'].'&cal_m='.$_REQUEST['m'].'&cal_y='.$_REQUEST['y']);
|
||||
redirect(CALENDAR_URL.'view.php?view=day&course='.$urlcourse.'&cal_d='.$_REQUEST['d'].'&cal_m='.$_REQUEST['m'].'&cal_y='.$_REQUEST['y']);
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -530,7 +530,11 @@
|
||||
// START: Last column (3-month display)
|
||||
|
||||
$defaultcourses = calendar_get_default_courses();
|
||||
calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
|
||||
//calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
|
||||
|
||||
// when adding an event you can not be a guest, so I think it's reasonalbe to ignore defaultcourses
|
||||
// MDL-10353
|
||||
calendar_set_filters($courses, $groups, $users);
|
||||
list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
|
||||
list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
|
||||
|
||||
@@ -541,13 +545,13 @@
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $prevmon, 'y' => $prevyr));
|
||||
echo calendar_top_controls('display', array('id' => $urlcourse, 'm' => $prevmon, 'y' => $prevyr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
|
||||
echo '</div><div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $mon, 'y' => $yr));
|
||||
echo calendar_top_controls('display', array('id' => $urlcourse, 'm' => $mon, 'y' => $yr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $mon, $yr);
|
||||
echo '</div><div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $nextmon, 'y' => $nextyr));
|
||||
echo calendar_top_controls('display', array('id' => $urlcourse, 'm' => $nextmon, 'y' => $nextyr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
|
||||
echo '</div>';
|
||||
|
||||
@@ -633,24 +637,4 @@ function calendar_add_event_allowed($event) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function calendar_get_allowed_types(&$allowed) {
|
||||
global $USER, $CFG, $SESSION;
|
||||
|
||||
$allowed->user = true; // User events always allowed
|
||||
$allowed->groups = false; // This may change just below
|
||||
$allowed->courses = false; // This may change just below
|
||||
$allowed->site = has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, SITEID));
|
||||
|
||||
if(!empty($SESSION->cal_course_referer) && $SESSION->cal_course_referer != SITEID && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $SESSION->cal_course_referer))) {
|
||||
$course = get_record('course', 'id', $SESSION->cal_course_referer);
|
||||
|
||||
$allowed->courses = array($course->id => 1);
|
||||
|
||||
if($course->groupmode != NOGROUPS || !$course->groupmodeforce) {
|
||||
$allowed->groups = get_groups($SESSION->cal_course_referer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<input type="hidden" name="y" value="<?php echo $y; ?>" />
|
||||
<input type="hidden" name="confirm" value="1" />
|
||||
<input type="hidden" name="repeats" value="0" />
|
||||
<input type="hidden" name="course" value="<?php p($urlcourse); ?>" />
|
||||
|
||||
</p>
|
||||
</form>
|
||||
@@ -29,6 +30,7 @@
|
||||
<input type="hidden" name="y" value="<?php echo $y; ?>" />
|
||||
<input type="hidden" name="confirm" value="1" />
|
||||
<input type="hidden" name="repeats" value="1" />
|
||||
<input type="hidden" name="course" value="<?php p($urlcourse); ?>" />
|
||||
|
||||
</p>
|
||||
</form>
|
||||
@@ -43,6 +45,7 @@
|
||||
<input type="hidden" name="cal_m" value="<?php echo $m; ?>" />
|
||||
<input type="hidden" name="cal_d" value="<?php echo $d; ?>" />
|
||||
<input type="hidden" name="cal_y" value="<?php echo $y; ?>" />
|
||||
<input type="hidden" name="course" value="<?php p($urlcourse); ?>" />
|
||||
|
||||
</p>
|
||||
</form>
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<input type="hidden" name="courseid" value="<?php echo $form->courseid; ?>" />
|
||||
<input type="hidden" name="format" value="<?php echo $form->format; ?>" />
|
||||
<input type="hidden" name="action" value="edit" />
|
||||
<input type="hidden" name="course" value="<?php p($urlcourse); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
<input type="hidden" name="format" value="<?php echo $form->format; ?>" />
|
||||
<input type="hidden" name="action" value="new" />
|
||||
<input type="hidden" name="type" value="<?php echo $form->type; ?>" />
|
||||
<input type="hidden" name="course" value="<?php p($urlcourse); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -31,5 +31,6 @@
|
||||
<p>
|
||||
<input type="hidden" name="action" value="new" />
|
||||
<input type="hidden" name="timestart" value="<?php echo $form->timestart; ?>" />
|
||||
<input type="hidden" name="course" value="<?php p($urlcourse); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
+19
-9
@@ -6,11 +6,11 @@ require_once($CFG->dirroot.'/calendar/lib.php');
|
||||
//require_once($CFG->libdir.'/bennu/bennu.inc.php');
|
||||
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$course = optional_param('course', 0);
|
||||
$day = optional_param('cal_d', 0, PARAM_INT);
|
||||
$mon = optional_param('cal_m', 0, PARAM_INT);
|
||||
$yr = optional_param('cal_y', 0, PARAM_INT);
|
||||
|
||||
$courseid = optional_param('course', 0, PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
if(!$site = get_site()) {
|
||||
@@ -22,7 +22,7 @@ calendar_session_vars();
|
||||
|
||||
$pagetitle = get_string('export', 'calendar');
|
||||
$now = usergetdate(time());
|
||||
$nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&', $now['mday'], $now['mon'], $now['year']).' -> '.$pagetitle;
|
||||
$nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&course='.$courseid.'&', $now['mday'], $now['mon'], $now['year']).' -> '.$pagetitle;
|
||||
|
||||
if(!checkdate($mon, $day, $yr)) {
|
||||
$day = intval($now['mday']);
|
||||
@@ -31,13 +31,23 @@ if(!checkdate($mon, $day, $yr)) {
|
||||
}
|
||||
$time = make_timestamp($yr, $mon, $day);
|
||||
|
||||
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
|
||||
calendar_set_referring_course(0);
|
||||
if ($courseid) {
|
||||
if ($course = get_record('course', 'id', $courseid)) {
|
||||
if ($course->id == SITEID) {
|
||||
// If coming from the home page, show all courses
|
||||
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
|
||||
calendar_set_referring_course(0);
|
||||
} else {
|
||||
// Otherwise show just this one
|
||||
$SESSION->cal_courses_shown = $course->id;
|
||||
calendar_set_referring_course($SESSION->cal_courses_shown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($USER->id) or isguest()) {
|
||||
$defaultcourses = calendar_get_default_courses();
|
||||
calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
|
||||
|
||||
} else {
|
||||
calendar_set_filters($courses, $groups, $users);
|
||||
}
|
||||
@@ -94,13 +104,13 @@ list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
|
||||
$getvars = 'cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr; // For filtering
|
||||
|
||||
echo '<div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $prevmon, 'y' => $prevyr));
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $prevmon, 'y' => $prevyr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
|
||||
echo '</div><div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $mon, 'y' => $yr));
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $mon, 'y' => $yr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $mon, $yr);
|
||||
echo '</div><div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $nextmon, 'y' => $nextyr));
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $nextmon, 'y' => $nextyr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
|
||||
echo '</div>';
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
<form method="get" action="export_execute.php">
|
||||
<?php print_string('iwanttoexport', 'calendar'); ?>:
|
||||
<div class="indent">
|
||||
<input type="radio" name="preset_what" id="pw_all" value="all" /><label for="pw_all"><?php print_string('eventsall', 'calendar'); ?></label><br />
|
||||
<input type="radio" name="preset_what" id="pw_all" value="all" checked="checked"/><label for="pw_all"><?php print_string('eventsall', 'calendar'); ?></label><br />
|
||||
<input type="radio" name="preset_what" id="pw_course" value="courses" /><label for="pw_course"><?php print_string('eventsrelatedtocourses', 'calendar'); ?></label><br />
|
||||
</div>
|
||||
<?php print_string('for', 'calendar'); ?>:
|
||||
<div class="indent">
|
||||
<?php if($allowthisweek) { ?>
|
||||
<input type="radio" name="preset_time" id="pt_wknow" value="weeknow" /><label for="pt_wknow"><?php print_string('weekthis', 'calendar'); ?></label><br />
|
||||
<input type="radio" name="preset_time" id="pt_wknow" value="weeknow" checked="checked"/><label for="pt_wknow"><?php print_string('weekthis', 'calendar'); ?></label><br />
|
||||
<?php } ?>
|
||||
<?php if($allownextweek) { ?>
|
||||
<input type="radio" name="preset_time" id="pt_wknext" value="weeknext" /><label for="pt_wknext"><?php print_string('weeknext', 'calendar'); ?></label><br />
|
||||
|
||||
@@ -19,8 +19,8 @@ if ($authtoken != sha1($username . $user->password)) {
|
||||
die('Invalid authentication token');
|
||||
}
|
||||
|
||||
$what = optional_param('preset_what', '', PARAM_ALPHA);
|
||||
$time = optional_param('preset_time', '', PARAM_ALPHA);
|
||||
$what = optional_param('preset_what', 'all', PARAM_ALPHA);
|
||||
$time = optional_param('preset_time', 'weeknow', PARAM_ALPHA);
|
||||
|
||||
$now = usergetdate(time());
|
||||
// Let's see if we have sufficient and correct data
|
||||
@@ -29,7 +29,7 @@ $allowed_time = array('weeknow', 'weeknext', 'monthnow', 'monthnext', 'recentupc
|
||||
|
||||
if(!empty($what) && !empty($time)) {
|
||||
if(in_array($what, $allowed_what) && in_array($time, $allowed_time)) {
|
||||
$courses = get_my_courses($user->id);
|
||||
$courses = get_my_courses($user->id, NULL, 'id, visible, shortname');
|
||||
|
||||
$include_user = ($what == 'all');
|
||||
if ($include_user) {
|
||||
@@ -37,7 +37,7 @@ if(!empty($what) && !empty($time)) {
|
||||
$courses[SITEID] = new stdClass;
|
||||
$courses[SITEID]->shortname = get_string('globalevents', 'calendar');
|
||||
}
|
||||
|
||||
|
||||
switch($time) {
|
||||
case 'weeknow':
|
||||
$startweekday = get_user_preferences('calendar_startwday', CALENDAR_STARTING_WEEKDAY);
|
||||
@@ -99,7 +99,6 @@ if(!empty($what) && !empty($time)) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$whereclause = calendar_sql_where($timestart, $timeend, $include_user ? array($user->id) : false, false, array_keys($courses), false);
|
||||
if($whereclause === false) {
|
||||
$events = array();
|
||||
|
||||
+56
-15
@@ -191,7 +191,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
|
||||
|
||||
// Paddding (the first week may have blank days in the beginning)
|
||||
for($i = $display->minwday; $i < $startwday; ++$i) {
|
||||
$content .= '<td> </td>'."\n";
|
||||
$content .= '<td class="day"> </td>'."\n";
|
||||
}
|
||||
|
||||
// Now display all the calendar
|
||||
@@ -306,7 +306,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
|
||||
|
||||
// Paddding (the last week may have blank days at the end)
|
||||
for($i = $dayweek; $i <= $display->maxwday; ++$i) {
|
||||
$content .= '<td> </td>';
|
||||
$content .= '<td class="day"> </td>';
|
||||
}
|
||||
$content .= '</tr>'; // Last row ends
|
||||
|
||||
@@ -485,9 +485,15 @@ function calendar_print_event($event) {
|
||||
echo format_text($event->description, FORMAT_HTML);
|
||||
if (calendar_edit_event_allowed($event)) {
|
||||
echo '<div class="commands">';
|
||||
|
||||
$calendarcourseid = '';
|
||||
if (!empty($event->calendarcourseid)) {
|
||||
$calendarcourseid = '&course='.$event->calendarcourseid;
|
||||
}
|
||||
|
||||
if (empty($event->cmid)) {
|
||||
$editlink = CALENDAR_URL.'event.php?action=edit&id='.$event->id;
|
||||
$deletelink = CALENDAR_URL.'event.php?action=delete&id='.$event->id;
|
||||
$editlink = CALENDAR_URL.'event.php?action=edit&id='.$event->id.$calendarcourseid;
|
||||
$deletelink = CALENDAR_URL.'event.php?action=delete&id='.$event->id.$calendarcourseid;
|
||||
} else {
|
||||
$editlink = $CFG->wwwroot.'/course/mod.php?update='.$event->cmid.'&return=true&sesskey='.$USER->sesskey;
|
||||
$deletelink = $CFG->wwwroot.'/course/mod.php?delete='.$event->cmid.'&sesskey='.$USER->sesskey;;
|
||||
@@ -608,6 +614,13 @@ function calendar_top_controls($type, $data) {
|
||||
$data['d'] = 1;
|
||||
}
|
||||
|
||||
// Ensure course id passed if relevant
|
||||
// Required due to changes in view/lib.php mainly (calendar_session_vars())
|
||||
$courseid = '';
|
||||
if (!empty($data['id'])) {
|
||||
$courseid = '&course='.$data['id'];
|
||||
}
|
||||
|
||||
if(!checkdate($data['m'], $data['d'], $data['y'])) {
|
||||
$time = time();
|
||||
}
|
||||
@@ -630,7 +643,7 @@ function calendar_top_controls($type, $data) {
|
||||
$nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'index.php?', 0, $nextmonth, $nextyear, $accesshide=true);
|
||||
$prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'index.php?', 0, $prevmonth, $prevyear, true);
|
||||
$content .= "\n".'<div class="calendar-controls">'. $prevlink;
|
||||
$content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month&', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
|
||||
$content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month'.$courseid.'&', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
|
||||
$content .= '<span class="hide"> | </span>'. $nextlink ."\n";
|
||||
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
|
||||
break;
|
||||
@@ -640,15 +653,15 @@ function calendar_top_controls($type, $data) {
|
||||
$nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'view.php?id='.$data['id'].'&', 0, $nextmonth, $nextyear, $accesshide=true);
|
||||
$prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'view.php?id='.$data['id'].'&', 0, $prevmonth, $prevyear, true);
|
||||
$content .= "\n".'<div class="calendar-controls">'. $prevlink;
|
||||
$content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month&course='.$data['id'].'&', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
|
||||
$content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month'.$courseid.'&', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
|
||||
$content .= '<span class="hide"> | </span>'. $nextlink ."\n";
|
||||
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
|
||||
break;
|
||||
case 'upcoming':
|
||||
$content .= '<div style="text-align: center;"><a href="'.CALENDAR_URL.'view.php?view=upcoming">'.userdate($time, get_string('strftimemonthyear'))."</a></div>\n";
|
||||
$content .= '<div style="text-align: center;"><a href="'.CALENDAR_URL.'view.php?view=upcoming"'.$courseid.'>'.userdate($time, get_string('strftimemonthyear'))."</a></div>\n";
|
||||
break;
|
||||
case 'display':
|
||||
$content .= '<div style="text-align: center;"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month&', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear'))."</a></div>\n";
|
||||
$content .= '<div style="text-align: center;"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month'.$courseid.'&', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear'))."</a></div>\n";
|
||||
break;
|
||||
case 'month':
|
||||
list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
|
||||
@@ -656,9 +669,9 @@ function calendar_top_controls($type, $data) {
|
||||
$prevdate = make_timestamp($prevyear, $prevmonth, 1);
|
||||
$nextdate = make_timestamp($nextyear, $nextmonth, 1);
|
||||
$content .= "\n".'<div class="calendar-controls">';
|
||||
$content .= calendar_get_link_previous(userdate($prevdate, get_string('strftimemonthyear')), 'view.php?view=month&', 1, $prevmonth, $prevyear);
|
||||
$content .= calendar_get_link_previous(userdate($prevdate, get_string('strftimemonthyear')), 'view.php?view=month'.$courseid.'&', 1, $prevmonth, $prevyear);
|
||||
$content .= '<span class="hide"> | </span><span class="current">'.userdate($time, get_string('strftimemonthyear'))."</span>\n";
|
||||
$content .= '<span class="hide"> | </span>'.calendar_get_link_next(userdate($nextdate, get_string('strftimemonthyear')), 'view.php?view=month&', 1, $nextmonth, $nextyear);
|
||||
$content .= '<span class="hide"> | </span>'.calendar_get_link_next(userdate($nextdate, get_string('strftimemonthyear')), 'view.php?view=month'.$courseid.'&', 1, $nextmonth, $nextyear);
|
||||
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
|
||||
break;
|
||||
case 'day':
|
||||
@@ -668,8 +681,8 @@ function calendar_top_controls($type, $data) {
|
||||
$prevname = calendar_wday_name($CALENDARDAYS[$prevdate['wday']]);
|
||||
$nextname = calendar_wday_name($CALENDARDAYS[$nextdate['wday']]);
|
||||
$content .= "\n".'<div class="calendar-controls">';
|
||||
$content .= calendar_get_link_previous($prevname, 'view.php?view=day&', $prevdate['mday'], $prevdate['mon'], $prevdate['year']);
|
||||
|
||||
$content .= calendar_get_link_previous($prevname, 'view.php?view=day'.$courseid.'&', $prevdate['mday'], $prevdate['mon'], $prevdate['year']);
|
||||
|
||||
// Get the format string
|
||||
$text = get_string('strftimedaydate');
|
||||
/*
|
||||
@@ -682,7 +695,7 @@ function calendar_top_controls($type, $data) {
|
||||
// Print the actual thing
|
||||
$content .= '<span class="hide"> | </span><span class="current">'.$text.'</span>';
|
||||
|
||||
$content .= '<span class="hide"> | </span>'. calendar_get_link_next($nextname, 'view.php?view=day&', $nextdate['mday'], $nextdate['mon'], $nextdate['year']);
|
||||
$content .= '<span class="hide"> | </span>'. calendar_get_link_next($nextname, 'view.php?view=day'.$courseid.'&', $nextdate['mday'], $nextdate['mon'], $nextdate['year']);
|
||||
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
|
||||
break;
|
||||
}
|
||||
@@ -1272,10 +1285,10 @@ function calendar_get_default_courses($ignoreref = false) {
|
||||
}
|
||||
|
||||
if (isset($CFG->adminseesall)) {
|
||||
$courses = get_my_courses($USER->id, 'visible DESC', null, $CFG->adminseesall);
|
||||
$courses = get_my_courses($USER->id, null, null, $CFG->adminseesall);
|
||||
}
|
||||
else {
|
||||
$courses = get_my_courses($USER->id, 'visible DESC', null, false);
|
||||
$courses = get_my_courses($USER->id, null, null, false);
|
||||
}
|
||||
|
||||
return $courses;
|
||||
@@ -1401,4 +1414,32 @@ function calendar_set_filters_status($packed_bitfield) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function calendar_get_allowed_types(&$allowed) {
|
||||
global $USER, $CFG, $SESSION;
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$allowed->user = has_capability('moodle/calendar:manageownentries', $sitecontext);
|
||||
$allowed->groups = false; // This may change just below
|
||||
$allowed->courses = false; // This may change just below
|
||||
$allowed->site = has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, SITEID));
|
||||
|
||||
if(!empty($SESSION->cal_course_referer) && $SESSION->cal_course_referer != SITEID && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $SESSION->cal_course_referer))) {
|
||||
$course = get_record('course', 'id', $SESSION->cal_course_referer);
|
||||
|
||||
$allowed->courses = array($course->id => 1);
|
||||
|
||||
if($course->groupmode != NOGROUPS || !$course->groupmodeforce) {
|
||||
$allowed->groups = get_groups($SESSION->cal_course_referer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* see if user can add calendar entries at all
|
||||
* used to print the "New Event" button
|
||||
* @return bool
|
||||
*/
|
||||
function calendar_user_can_add_event() {
|
||||
calendar_get_allowed_types($allowed);
|
||||
return (bool)($allowed->user || $allowed->groups || $allowed->courses || $allowed->site);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
redirect('view.php', get_string('changessaved'), 1);
|
||||
redirect('view.php?course='.$course->id, get_string('changessaved'), 1);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -52,6 +52,13 @@
|
||||
// Initialize the session variables
|
||||
calendar_session_vars();
|
||||
|
||||
// Ensure course id passed if relevant
|
||||
// Required due to changes in view/lib.php mainly (calendar_session_vars())
|
||||
$courseid = '';
|
||||
if (!empty($id)) {
|
||||
$courseid = '&course='.$id;
|
||||
}
|
||||
|
||||
switch($var) {
|
||||
case 'setuser':
|
||||
// Not implemented yet (or possibly at all)
|
||||
@@ -101,13 +108,13 @@
|
||||
redirect(CALENDAR_URL.'event.php?action='.$action.'&type='.$type.'&id='.intval($id));
|
||||
break;
|
||||
case 'month':
|
||||
redirect(CALENDAR_URL.'view.php?view=month&cal_d='.$cal_d.'&cal_m='.$cal_m.'&cal_y='.$cal_y);
|
||||
redirect(CALENDAR_URL.'view.php?view=month'.$courseid.'&cal_d='.$cal_d.'&cal_m='.$cal_m.'&cal_y='.$cal_y);
|
||||
break;
|
||||
case 'upcoming':
|
||||
redirect(CALENDAR_URL.'view.php?view=upcoming');
|
||||
redirect(CALENDAR_URL.'view.php?view=upcoming'.$courseid);
|
||||
break;
|
||||
case 'day':
|
||||
redirect(CALENDAR_URL.'view.php?view=day&cal_d='.$cal_d.'&cal_m='.$cal_m.'&cal_y='.$cal_y);
|
||||
redirect(CALENDAR_URL.'view.php?view=day'.$courseid.'&cal_d='.$cal_d.'&cal_m='.$cal_m.'&cal_y='.$cal_y);
|
||||
break;
|
||||
case 'course':
|
||||
redirect($CFG->wwwroot.'/course/view.php?id='.intval($id));
|
||||
|
||||
+26
-19
@@ -67,7 +67,7 @@
|
||||
$now = usergetdate(time());
|
||||
$pagetitle = '';
|
||||
|
||||
$nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&', $now['mday'], $now['mon'], $now['year']);
|
||||
$nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&course='.$courseid.'&', $now['mday'], $now['mon'], $now['year']);
|
||||
|
||||
|
||||
if(!checkdate($mon, $day, $yr)) {
|
||||
@@ -149,19 +149,19 @@
|
||||
|
||||
switch($view) {
|
||||
case 'day':
|
||||
calendar_show_day($day, $mon, $yr, $courses, $groups, $users);
|
||||
calendar_show_day($day, $mon, $yr, $courses, $groups, $users, $courseid);
|
||||
break;
|
||||
case 'month':
|
||||
calendar_show_month_detailed($mon, $yr, $courses, $groups, $users);
|
||||
calendar_show_month_detailed($mon, $yr, $courses, $groups, $users, $courseid);
|
||||
break;
|
||||
case 'upcoming':
|
||||
calendar_show_upcoming_events($courses, $groups, $users, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
|
||||
calendar_show_upcoming_events($courses, $groups, $users, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS), $courseid);
|
||||
break;
|
||||
}
|
||||
|
||||
//Link to calendar export page
|
||||
echo '<div class="bottom">';
|
||||
print_single_button('export.php', false, get_string('exportcalendar', 'calendar'));
|
||||
print_single_button('export.php', array('course'=>$courseid), get_string('exportcalendar', 'calendar'));
|
||||
|
||||
if (!empty($USER->id)) {
|
||||
$authtoken = sha1($USER->username . $USER->password);
|
||||
@@ -186,20 +186,20 @@
|
||||
|
||||
list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
|
||||
list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
|
||||
$getvars = 'cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr; // For filtering
|
||||
$getvars = 'id='.$courseid.'&cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr; // For filtering
|
||||
|
||||
echo '<div class="filters">';
|
||||
echo calendar_filter_controls($view, $getvars);
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $prevmon, 'y' => $prevyr));
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $prevmon, 'y' => $prevyr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
|
||||
echo '</div><div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $mon, 'y' => $yr));
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $mon, 'y' => $yr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $mon, $yr);
|
||||
echo '</div><div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('m' => $nextmon, 'y' => $nextyr));
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $nextmon, 'y' => $nextyr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
|
||||
echo '</div>';
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
|
||||
|
||||
|
||||
function calendar_show_day($d, $m, $y, $courses, $groups, $users) {
|
||||
function calendar_show_day($d, $m, $y, $courses, $groups, $users, $courseid) {
|
||||
global $CFG, $USER;
|
||||
|
||||
if (!checkdate($m, $d, $y)) {
|
||||
@@ -227,11 +227,12 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) {
|
||||
$events = calendar_get_upcoming($courses, $groups, $users, 1, 100, $starttime);
|
||||
|
||||
$text = '';
|
||||
if (!isguest() && !empty($USER->id)) {
|
||||
if (!isguest() && !empty($USER->id) && calendar_user_can_add_event()) {
|
||||
$text.= '<div class="buttons">';
|
||||
$text.= '<form action="'.CALENDAR_URL.'event.php" method="get">';
|
||||
$text.= '<div>';
|
||||
$text.= '<input type="hidden" name="action" value="new" />';
|
||||
$text.= '<input type="hidden" name="course" value="'.$courseid.'" />';
|
||||
$text.= '<input type="hidden" name="cal_d" value="'.$d.'" />';
|
||||
$text.= '<input type="hidden" name="cal_m" value="'.$m.'" />';
|
||||
$text.= '<input type="hidden" name="cal_y" value="'.$y.'" />';
|
||||
@@ -243,8 +244,8 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) {
|
||||
|
||||
echo '<div class="header">'.$text.'</div>';
|
||||
|
||||
echo '<div class="controls">'.calendar_top_controls('day', array('d' => $d, 'm' => $m, 'y' => $y)).'</div>';
|
||||
|
||||
echo '<div class="controls">'.calendar_top_controls('day', array('id' => $courseid, 'd' => $d, 'm' => $m, 'y' => $y)).'</div>';
|
||||
|
||||
if (empty($events)) {
|
||||
// There is nothing to display today.
|
||||
echo '<h3>'.get_string('daywithnoevents', 'calendar').'</h3>';
|
||||
@@ -257,6 +258,9 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) {
|
||||
|
||||
// First, print details about events that start today
|
||||
foreach ($events as $event) {
|
||||
|
||||
$event->calendarcourseid = $courseid;
|
||||
|
||||
if ($event->timestart >= $starttime && $event->timestart <= $endtime) { // Print it now
|
||||
|
||||
|
||||
@@ -290,7 +294,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) {
|
||||
}
|
||||
}
|
||||
|
||||
function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
function calendar_show_month_detailed($m, $y, $courses, $groups, $users, $courseid) {
|
||||
global $CFG, $SESSION, $USER, $CALENDARDAYS;
|
||||
global $day, $mon, $yr;
|
||||
|
||||
@@ -359,10 +363,11 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
calendar_events_by_day($events, $m, $y, $eventsbyday, $durationbyday, $typesbyday);
|
||||
|
||||
$text = '';
|
||||
if(!isguest() && !empty($USER->id)) {
|
||||
if(!isguest() && !empty($USER->id) && calendar_user_can_add_event()) {
|
||||
$text.= '<div class="buttons"><form action="'.CALENDAR_URL.'event.php" method="get">';
|
||||
$text.= '<div>';
|
||||
$text.= '<input type="hidden" name="action" value="new" />';
|
||||
$text.= '<input type="hidden" name="course" value="'.$courseid.'" />';
|
||||
$text.= '<input type="hidden" name="cal_m" value="'.$m.'" />';
|
||||
$text.= '<input type="hidden" name="cal_y" value="'.$y.'" />';
|
||||
$text.= '<input type="submit" value="'.get_string('newevent', 'calendar').'" />';
|
||||
@@ -374,7 +379,7 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
echo '<div class="header">'.$text.'</div>';
|
||||
|
||||
echo '<div class="controls">';
|
||||
echo calendar_top_controls('month', array('m' => $m, 'y' => $y));
|
||||
echo calendar_top_controls('month', array('id' => $courseid, 'm' => $m, 'y' => $y));
|
||||
echo '</div>';
|
||||
|
||||
// Start calendar display
|
||||
@@ -409,7 +414,7 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
|
||||
// Reset vars
|
||||
$cell = '';
|
||||
$dayhref = calendar_get_link_href(CALENDAR_URL.'view.php?view=day&', $day, $m, $y);
|
||||
$dayhref = calendar_get_link_href(CALENDAR_URL.'view.php?view=day&course='.$courseid.'&', $day, $m, $y);
|
||||
|
||||
if(CALENDAR_WEEKEND & (1 << ($dayweek % 7))) {
|
||||
// Weekend. This is true no matter what the exact range is.
|
||||
@@ -547,18 +552,19 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
echo '</table></div>';
|
||||
}
|
||||
|
||||
function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $maxevents) {
|
||||
function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $maxevents, $courseid) {
|
||||
global $USER;
|
||||
|
||||
$events = calendar_get_upcoming($courses, $groups, $users, $futuredays, $maxevents);
|
||||
|
||||
$text = '';
|
||||
|
||||
if(!isguest() && !empty($USER->id)) {
|
||||
if(!isguest() && !empty($USER->id) && calendar_user_can_add_event()) {
|
||||
$text.= '<div class="buttons">';
|
||||
$text.= '<form action="'.CALENDAR_URL.'event.php" method="get">';
|
||||
$text.= '<div>';
|
||||
$text.= '<input type="hidden" name="action" value="new" />';
|
||||
$text.= '<input type="hidden" name="course" value="'.$courseid.'" />';
|
||||
/*
|
||||
$text.= '<input type="hidden" name="cal_m" value="'.$m.'" />';
|
||||
$text.= '<input type="hidden" name="cal_y" value="'.$y.'" />';
|
||||
@@ -574,6 +580,7 @@ function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $
|
||||
if ($events) {
|
||||
echo '<div class="eventlist">';
|
||||
foreach ($events as $event) {
|
||||
$event->calendarcourseid = $courseid;
|
||||
calendar_print_event($event);
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
+36
-4
@@ -15,8 +15,9 @@
|
||||
$moveup = optional_param('moveup', 0, PARAM_INT);
|
||||
$movedown = optional_param('movedown', 0, PARAM_INT);
|
||||
$moveto = optional_param('moveto', 0, PARAM_INT);
|
||||
$rename = optional_param('rename', '', PARAM_NOTAGS);
|
||||
$rename = optional_param('rename', '', PARAM_TEXT);
|
||||
$resort = optional_param('resort', 0, PARAM_BOOL);
|
||||
$addsubcategory=optional_param('addsubcategory', '', PARAM_NOTAGS);
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
@@ -50,6 +51,18 @@
|
||||
}
|
||||
|
||||
|
||||
if (has_capability('moodle/category:create', $context)) {
|
||||
if (!empty($addsubcategory) and confirm_sesskey()) {
|
||||
$subcategory = new stdClass;
|
||||
$subcategory->name = $addsubcategory;
|
||||
$subcategory->sortorder = 999;
|
||||
$subcategory->parent = $id;
|
||||
if (!insert_record('course_categories', $subcategory )) {
|
||||
notify( "Could not insert the new subcategory '$addsubcategory' " );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (has_capability('moodle/category:update', $context)) {
|
||||
/// Rename the category if requested
|
||||
if (!empty($rename) and confirm_sesskey()) {
|
||||
@@ -238,6 +251,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// print option to add a subcategory
|
||||
if (has_capability('moodle/category:create', $context)) {
|
||||
$straddsubcategory = get_string('addsubcategory');
|
||||
echo '<div class="addcategory">';
|
||||
echo '<form id="addform" action="category.php" method="post">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input type="text" size="30" alt="'.$straddsubcategory.'" name="addsubcategory" />';
|
||||
echo '<input type="submit" value="'.$straddsubcategory.'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="id" value="'.$id.'" />';
|
||||
// echo '<input type="hidden" name="categoryedit" value="'.$categoryedit.'" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/// Print out all the courses
|
||||
unset($course); // To avoid unwanted language effects later
|
||||
@@ -300,7 +328,11 @@
|
||||
// be moved up and down beyond the paging border
|
||||
if ($totalcount > $perpage) {
|
||||
$atfirstpage = ($page == 0);
|
||||
$atlastpage = (($page + 1) == ceil($totalcount / $perpage));
|
||||
if ($perpage > 0) {
|
||||
$atlastpage = (($page + 1) == ceil($totalcount / $perpage));
|
||||
} else {
|
||||
$atlastpage = true;
|
||||
}
|
||||
} else {
|
||||
$atfirstpage = true;
|
||||
$atlastpage = true;
|
||||
@@ -416,7 +448,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
choose_from_menu ($displaylist, "moveto", "", get_string("moveselectedcoursesto"), "javascript: getElementById('movecourses').submit()");
|
||||
choose_from_menu ($displaylist, "moveto", "", get_string("moveselectedcoursesto"), "javascript: submitFormById('movecourses')");
|
||||
echo '<input type="hidden" name="id" value="'.$category->id.'" />';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
@@ -446,7 +478,7 @@
|
||||
echo '<form id="renameform" action="category.php" method="post"><div>';
|
||||
echo '<input type="hidden" name="id" value="'.$category->id.'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo '<input type="text" size="30" name="rename" value="'.format_string($category->name).'" alt="'.$strrename.'" />';
|
||||
echo '<input type="text" size="30" name="rename" value="'.htmlspecialchars($category->name).'" alt="'.$strrename.'" />';
|
||||
echo '<input type="submit" value="'.$strrename.'" />';
|
||||
echo '</div></form>';
|
||||
echo '<br />';
|
||||
|
||||
+3
-1
@@ -10,23 +10,25 @@
|
||||
$id = optional_param('id', 0, PARAM_INT); // course id
|
||||
$categoryid = optional_param('category', 0, PARAM_INT); // course category - can be changed in edit form
|
||||
|
||||
require_login();
|
||||
|
||||
/// basic access control checks
|
||||
if ($id) { // editing course
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
error('Course ID was incorrect');
|
||||
}
|
||||
require_login($course->id);
|
||||
$category = get_record('course_categories', 'id', $course->category);
|
||||
require_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
|
||||
} else if ($categoryid) { // creating new course in this category
|
||||
$course = null;
|
||||
require_login();
|
||||
if (!$category = get_record('course_categories', 'id', $categoryid)) {
|
||||
error('Category ID was incorrect');
|
||||
}
|
||||
require_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id));
|
||||
} else {
|
||||
require_login();
|
||||
error('Either course id or category must be specified');
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class course_edit_form extends moodleform {
|
||||
$mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
|
||||
$mform->setType('fullname', PARAM_MULTILANG);
|
||||
|
||||
$mform->addElement('text','shortname', get_string('shortname'),'maxlength="15" size="10"');
|
||||
$mform->addElement('text','shortname', get_string('shortname'),'maxlength="100" size="10"');
|
||||
$mform->setHelpButton('shortname', array('courseshortname', get_string('shortname')), true);
|
||||
$mform->setDefault('shortname', get_string('defaultcourseshortname'));
|
||||
$mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
|
||||
@@ -293,7 +293,7 @@ class course_edit_form extends moodleform {
|
||||
// If we are creating a course, its enrol method isn't yet chosen, BUT the site has a default enrol method which we can use here
|
||||
$enrol_object = $CFG;
|
||||
if (!empty($course)) {
|
||||
$enrol_oject = $course;
|
||||
$enrol_object = $course;
|
||||
}
|
||||
if (method_exists(enrolment_factory::factory($enrol_object->enrol), 'print_entry') && $enrol_object->enrol != 'manual'){
|
||||
$costgroup=array();
|
||||
|
||||
@@ -242,17 +242,19 @@ while ($section <= $course->numsections) {
|
||||
|
||||
$currenttopic = ($course->marker == $section);
|
||||
|
||||
$currenttext = '';
|
||||
if (!$thissection->visible) {
|
||||
$sectionstyle = ' hidden';
|
||||
} else if ($currenttopic) {
|
||||
$sectionstyle = ' current';
|
||||
$currenttext = get_accesshide(get_string('currenttopic','access'));
|
||||
} else {
|
||||
$sectionstyle = '';
|
||||
}
|
||||
|
||||
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
|
||||
|
||||
echo '<td class="left side"> </td>';
|
||||
echo '<td class="left side"> '.$currenttext.'</td>';
|
||||
|
||||
echo '<td class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
|
||||
@@ -192,16 +192,18 @@
|
||||
|
||||
$currenttopic = ($course->marker == $section);
|
||||
|
||||
$currenttext = '';
|
||||
if (!$thissection->visible) {
|
||||
$sectionstyle = ' hidden';
|
||||
} else if ($currenttopic) {
|
||||
$sectionstyle = ' current';
|
||||
$currenttext = get_accesshide(get_string('currenttopic','access'));
|
||||
} else {
|
||||
$sectionstyle = '';
|
||||
}
|
||||
|
||||
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
|
||||
echo '<td class="left side">'.$section.'</td>';
|
||||
echo '<td class="left side">'.$currenttext.$section.'</td>';
|
||||
|
||||
echo '<td class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
|
||||
@@ -187,28 +187,20 @@
|
||||
|
||||
$currentweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate));
|
||||
|
||||
$currenttext = '';
|
||||
if (!$thissection->visible) {
|
||||
$sectionstyle = ' hidden';
|
||||
} else if ($currentweek) {
|
||||
$sectionstyle = ' current';
|
||||
$currenttext = get_accesshide(get_string('currentweek','access'));
|
||||
} else {
|
||||
$sectionstyle = '';
|
||||
}
|
||||
|
||||
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
|
||||
echo '<td class="left side"> </td>';
|
||||
|
||||
|
||||
if (ajaxenabled() && $editing) {
|
||||
// Temporarily hide the dates for the weeks. We do it this way
|
||||
// for now. Eventually, we'll have to modify the javascript code
|
||||
// to handle re-calculation of dates when sections are moved
|
||||
// around. For now, just hide all the dates to avoid confusion.
|
||||
$weekperiod = '';
|
||||
} else {
|
||||
$weekperiod = $weekday.' '.$endweekday;
|
||||
}
|
||||
echo '<td class="left side"> '.$currenttext.'</td>';
|
||||
|
||||
$weekperiod = $weekday.' - '.$endweekday;
|
||||
|
||||
echo '<td class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
|
||||
@@ -184,10 +184,12 @@
|
||||
|
||||
$currentweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate));
|
||||
|
||||
$currenttext = '';
|
||||
if (!$thissection->visible) {
|
||||
$sectionstyle = ' hidden';
|
||||
} else if ($currentweek) {
|
||||
$sectionstyle = ' current';
|
||||
$currenttext = get_accesshide(get_string('currentweek','access'));
|
||||
} else {
|
||||
$sectionstyle = '';
|
||||
}
|
||||
@@ -228,10 +230,10 @@
|
||||
|
||||
echo '<div class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
echo '<div class="weekdates">'.$weekday.' - '.$endweekday.' ('.get_string('notavailable').')</div>';
|
||||
echo '<div class="weekdates">'.$currenttext.$weekday.' - '.$endweekday.' ('.get_string('notavailable').')</div>';
|
||||
|
||||
} else {
|
||||
echo '<div class="weekdates">'.$weekday.' - '.$endweekday.'</div>';
|
||||
echo '<div class="weekdates">'.$currenttext.$weekday.' - '.$endweekday.'</div>';
|
||||
|
||||
echo '<div class="summary">';
|
||||
$summaryformatoptions->noclean = true;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
require_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $id));
|
||||
|
||||
/// Always we begin an import, we delete all backup/restore/import session structures
|
||||
|
||||
@@ -4,15 +4,16 @@
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once('../../lib.php');
|
||||
require_once($CFG->dirroot . '/group/lib/basicgrouplib.php');
|
||||
|
||||
$mycourseid = required_param('id', PARAM_INT); // Course id
|
||||
$id = required_param('id', PARAM_INT); // Course id
|
||||
|
||||
if (! $course = get_record('course', 'id', $mycourseid) ) {
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $mycourseid);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
|
||||
|
||||
if (!has_capability('moodle/course:managegroups', $context)) {
|
||||
@@ -67,9 +68,9 @@
|
||||
$optional = array("coursename" => 1,
|
||||
"idnumber" =>1,
|
||||
"description" => 1,
|
||||
"password" => 1,
|
||||
"enrolmentkey" => 1,
|
||||
"theme" => 1,
|
||||
"picture" => 1,
|
||||
"picture" => 1,
|
||||
"hidepicture" => 1, );
|
||||
|
||||
// --- get header (field names) ---
|
||||
@@ -77,10 +78,12 @@
|
||||
// check for valid field names
|
||||
foreach ($header as $i => $h) {
|
||||
$h = trim($h); $header[$i] = $h; // remove whitespace
|
||||
if (!($required[$h] or $optionalDefaults[$h] or $optional[$h])) {
|
||||
if ( !(isset($required[$h]) or
|
||||
isset($optionalDefaults[$h]) or
|
||||
isset($optional[$h])) ) {
|
||||
error(get_string('invalidfieldname', 'error', $h), 'index.php?id='.$id.'&sesskey='.$USER->sesskey);
|
||||
}
|
||||
if ($required[$h]) {
|
||||
if ( isset($required[$h]) ) {
|
||||
$required[$h] = 2;
|
||||
}
|
||||
}
|
||||
@@ -111,16 +114,12 @@
|
||||
// add fields to object $user
|
||||
foreach ($record as $name => $value) {
|
||||
// check for required values
|
||||
if ($required[$name] and !$value) {
|
||||
if (isset($required[$name]) and !$value) {
|
||||
error(get_string('missingfield', 'error', $name). " ".
|
||||
get_string('erroronline', 'error', $linenum) .". ".
|
||||
get_string('processingstops', 'error'),
|
||||
'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
}
|
||||
// password needs to be encrypted
|
||||
else if ($name == "password") {
|
||||
$newgroup->password = md5($value);
|
||||
}
|
||||
else if ($name == "groupname") {
|
||||
$newgroup->name = addslashes($value);
|
||||
}
|
||||
@@ -133,7 +132,7 @@
|
||||
|
||||
//if idnumber is set, we use that.
|
||||
//unset invalid courseid
|
||||
if ($newgroup->idnumber){
|
||||
if (isset($newgroup->idnumber)){
|
||||
if (!$mycourse = get_record('course', 'idnumber',$newgroup->idnumber)){
|
||||
notify(get_string('unknowncourseidnumber', 'error', $newgroup->idnumber));
|
||||
unset($newgroup->courseid);//unset so 0 doesnt' get written to database
|
||||
@@ -143,7 +142,7 @@
|
||||
//else use course short name to look up
|
||||
//unset invalid coursename (if no id)
|
||||
|
||||
else if ($newgroup->coursename){
|
||||
else if (isset($newgroup->coursename)){
|
||||
if (!$mycourse = get_record('course', 'shortname',$newgroup->coursename)){
|
||||
notify(get_string('unknowncourse', 'error', $newgroup->coursename));
|
||||
unset($newgroup->courseid);//unset so 0 doesnt' get written to database
|
||||
@@ -152,7 +151,7 @@
|
||||
}
|
||||
//else juse use current id
|
||||
else{
|
||||
$newgroup->courseid = $mycourseid;
|
||||
$newgroup->courseid = $id;
|
||||
}
|
||||
|
||||
//if courseid is set
|
||||
@@ -165,20 +164,20 @@
|
||||
|
||||
///Users cannot upload groups in courses they cannot update.
|
||||
if (!has_capability('moodle/course:managegroups', $newgrpcoursecontext)){
|
||||
notify("$newgroup->name ".get_string('notaddedto').$newgroup->coursename.get_string('notinyourcapacity'));
|
||||
notify( get_string('nopermissionforcreation','group',$newgroup->name) );
|
||||
} else {
|
||||
if (get_record("groups","name",$groupname,"courseid",$newgroup->courseid) || !($newgroup->id = insert_record("groups", $newgroup))) {
|
||||
if ( $group = groups_group_name_exists($newgroup->courseid, $groupname) || !($newgroup->id = groups_create_group($newgroup->courseid, $newgroup)) ) {
|
||||
|
||||
//Record not added - probably because group is already registered
|
||||
//In this case, output groupname from previous registration
|
||||
if ($group = get_record("groups","name",$groupname)) {
|
||||
notify("$newgroup->name ".get_string('groupexistforcourse', 'error', $groupname));
|
||||
if ($group) {
|
||||
notify("$newgroup->name :".get_string('groupexistforcourse', 'error', $groupname));
|
||||
} else {
|
||||
notify(get_string('groupnotaddederror', 'error', $groupname));
|
||||
}
|
||||
}
|
||||
else {
|
||||
notify(get_string('group')." $newgroup->name ".get_string('addedsuccessfully'));
|
||||
notify( get_string('groupaddedsuccesfully', 'group', $newgroup->name) );
|
||||
}
|
||||
}
|
||||
} //close courseid validity check
|
||||
@@ -210,4 +209,3 @@ function my_file_get_contents($filename, $use_include_path = 0) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+3
-17
@@ -264,24 +264,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// Find the default category (the one with the lowest ID)
|
||||
$categories = get_categories();
|
||||
$default = 99999;
|
||||
foreach ($categories as $category) {
|
||||
if ($category->id < $default) {
|
||||
$default = $category->id;
|
||||
}
|
||||
}
|
||||
|
||||
/// Find any orphan courses that don't yet have a valid category and set to default
|
||||
if ($courses = get_courses(NULL,NULL,'c.id, c.category, c.sortorder, c.visible')) {
|
||||
foreach ($courses as $course) {
|
||||
if ($course->category and !isset($categories[$course->category])) {
|
||||
set_field('course', 'category', $default, 'id', $course->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fix_coursecategory_orphans();
|
||||
|
||||
/// Should be a no-op 99% of the cases
|
||||
fix_course_sortorder();
|
||||
|
||||
/// Print form for creating new categories
|
||||
|
||||
+74
-32
@@ -246,6 +246,9 @@ function make_log_url($module, $url) {
|
||||
case 'blog':
|
||||
return "/$module/$url";
|
||||
break;
|
||||
case 'mnet course':
|
||||
return "/course/$url";
|
||||
break;
|
||||
case 'upload':
|
||||
return $url;
|
||||
break;
|
||||
@@ -503,12 +506,16 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
|
||||
|
||||
$log->url = strip_tags(urldecode($log->url)); // Some XSS protection
|
||||
$log->info = strip_tags(urldecode($log->info)); // Some XSS protection
|
||||
$log->url = str_replace('&', '&', $log->url); /// XHTML compatibility
|
||||
$log->url = s($log->url); /// XSS protection and XHTML compatibility - should be in link_to_popup_window() instead!!
|
||||
|
||||
echo '<tr class="r'.$row.'">';
|
||||
if ($course->id == SITEID) {
|
||||
echo "<td class=\"cell c0\">\n";
|
||||
echo " <a href=\"{$CFG->wwwroot}/course/view.php?id={$log->course}\">". format_string($courses[$log->course])."</a>\n";
|
||||
if (empty($log->course)) {
|
||||
echo get_string('site') . "\n";
|
||||
} else {
|
||||
echo " <a href=\"{$CFG->wwwroot}/course/view.php?id={$log->course}\">". format_string($courses[$log->course])."</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
}
|
||||
echo "<td class=\"cell c1\" align=\"right\">".userdate($log->time, '%a').
|
||||
@@ -944,12 +951,16 @@ function print_log_ods($course, $user, $date, $order='l.time DESC', $modname,
|
||||
|
||||
|
||||
function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
|
||||
global $CFG;
|
||||
global $CFG, $USER;
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo "(".get_string("gdneed").")";
|
||||
} else {
|
||||
echo '<img src="'.$CFG->wwwroot.'/course/report/log/graph.php?id='.$course->id.
|
||||
'&user='.$userid.'&type='.$type.'&date='.$date.'" alt="" />';
|
||||
// MDL-10818, do not display broken graph when user has no permission to view graph
|
||||
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id)) ||
|
||||
($course->showreports and $USER->id == $userid)) {
|
||||
echo '<img src="'.$CFG->wwwroot.'/course/report/log/graph.php?id='.$course->id.
|
||||
'&user='.$userid.'&type='.$type.'&date='.$date.'" alt="" />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1321,7 +1332,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||
if (!empty($section->sequence)) {
|
||||
|
||||
// Fix bug #5027, don't want style=\"width:$width\".
|
||||
echo "<ul class=\"section\">\n";
|
||||
echo "<ul class=\"section img-text\">\n";
|
||||
$sectionmods = explode(",", $section->sequence);
|
||||
|
||||
foreach ($sectionmods as $modnumber) {
|
||||
@@ -1372,19 +1383,35 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||
}
|
||||
|
||||
} else { // Normal activity
|
||||
|
||||
if (!empty($USER->screenreader)) {
|
||||
$typestring = '('.get_string('modulename',$mod->modname).') ';
|
||||
|
||||
//Accessibility: for files get description via icon.
|
||||
$altname = '';
|
||||
if ('resource'==$mod->modname) {
|
||||
if (!empty($modinfo[$modnumber]->icon)) {
|
||||
$possaltname = $modinfo[$modnumber]->icon;
|
||||
|
||||
$mimetype = mimeinfo_from_icon('type', $possaltname);
|
||||
$altname = get_mimetype_description($mimetype); //get_string($mimetype, 'mimetypes');
|
||||
} else {
|
||||
$altname = $mod->modfullname;
|
||||
}
|
||||
} else {
|
||||
$typestring = '';
|
||||
$altname = $mod->modfullname;
|
||||
}
|
||||
|
||||
// Avoid unnecessary duplication.
|
||||
if (false!==stripos($instancename, $altname)) {
|
||||
$altname = '';
|
||||
}
|
||||
// File type after name, for alphabetic lists.
|
||||
if ($altname) {
|
||||
$altname = get_accesshide(' '.$altname);
|
||||
}
|
||||
|
||||
$linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
|
||||
echo '<img src="'.$icon.'"'.
|
||||
' class="activityicon" alt="'.$mod->modfullname.'" />'.
|
||||
' <a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
|
||||
echo '<a '.$linkcss.' '.$extra. // Title unnecessary!
|
||||
' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
|
||||
$typestring.$instancename.'</a>';
|
||||
'<img src="'.$icon.'" class="activityicon" alt="" /> <span>'.
|
||||
$instancename.$altname.'</span></a>';
|
||||
}
|
||||
if ($usetracking && $mod->modname == 'forum') {
|
||||
$groupmode = groupmode($course, $mod);
|
||||
@@ -1518,6 +1545,7 @@ function rebuild_course_cache($courseid=0) {
|
||||
$select = "id = '$courseid'";
|
||||
} else {
|
||||
$select = "";
|
||||
@set_time_limit(0); // this could take a while! MDL-10954
|
||||
}
|
||||
|
||||
if ($courses = get_records_select("course", $select,'','id,fullname')) {
|
||||
@@ -1786,15 +1814,17 @@ function print_course($course) {
|
||||
/// first find all roles that are supposed to be displayed
|
||||
if ($managerroles = get_config('', 'coursemanager')) {
|
||||
$coursemanagerroles = split(',', $managerroles);
|
||||
foreach ($coursemanagerroles as $roleid) {
|
||||
$role = get_record('role','id',$roleid);
|
||||
if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', true)) {
|
||||
foreach ($users as $teacher) {
|
||||
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
|
||||
$namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
|
||||
$roles = get_records_select( 'role', '', 'sortorder' );
|
||||
foreach ($roles as $role) {
|
||||
if (in_array( $role->id, $coursemanagerroles )) {
|
||||
if ($users = get_role_users($role->id, $context, true, '', 'u.lastname ASC', true)) {
|
||||
foreach ($users as $teacher) {
|
||||
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
|
||||
$namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
|
||||
$teacher->id.'&course='.SITEID.'">'.$fullname.'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($namesarray)) {
|
||||
@@ -1901,20 +1931,23 @@ function print_course_search($value="", $return=false, $format="plain") {
|
||||
if ($format == 'plain') {
|
||||
$output = '<form id="'.$id.'" action="'.$CFG->wwwroot.'/course/search.php" method="get">';
|
||||
$output .= '<fieldset class="coursesearchbox invisiblefieldset">';
|
||||
$output .= '<input type="text" size="30" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<input type="submit" value="'.s($strsearchcourses).'" />';
|
||||
$output .= '<label for="coursesearchbox">'.$strsearchcourses.': </label>';
|
||||
$output .= '<input type="text" id="coursesearchbox" size="30" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<input type="submit" value="'.get_string('go').'" />';
|
||||
$output .= '</fieldset></form>';
|
||||
} else if ($format == 'short') {
|
||||
$output = '<form id="'.$id.'" action="'.$CFG->wwwroot.'/course/search.php" method="get">';
|
||||
$output .= '<fieldset class="coursesearchbox invisiblefieldset">';
|
||||
$output .= '<input type="text" size="12" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<input type="submit" value="'.s($strsearchcourses).'" />';
|
||||
$output .= '<label for="coursesearchbox">'.$strsearchcourses.': </label>';
|
||||
$output .= '<input type="text" id="coursesearchbox" size="12" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<input type="submit" value="'.get_string('go').'" />';
|
||||
$output .= '</fieldset></form>';
|
||||
} else if ($format == 'navbar') {
|
||||
$output = '<form id="coursesearchnavbar" action="'.$CFG->wwwroot.'/course/search.php" method="get">';
|
||||
$output .= '<fieldset class="coursesearchbox invisiblefieldset">';
|
||||
$output .= '<input type="text" size="20" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<input type="submit" value="'.s($strsearchcourses).'" />';
|
||||
$output .= '<label for="coursesearchbox">'.$strsearchcourses.': </label>';
|
||||
$output .= '<input type="text" id="coursesearchbox" size="20" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<input type="submit" value="'.get_string('go').'" />';
|
||||
$output .= '</fieldset></form>';
|
||||
}
|
||||
|
||||
@@ -2077,7 +2110,7 @@ function delete_course_module($id) {
|
||||
$modulename = get_field('modules', 'name', 'id', $cm->module);
|
||||
if ($events = get_records_select('event', "instance = '$cm->instance' AND modulename = '$modulename'")) {
|
||||
foreach($events as $event) {
|
||||
delete_event($event);
|
||||
delete_event($event->id);
|
||||
}
|
||||
}
|
||||
return delete_records('course_modules', 'id', $cm->id);
|
||||
@@ -2292,16 +2325,25 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
|
||||
}
|
||||
|
||||
$leftright = "";
|
||||
|
||||
if (right_to_left()) { // Exchange arrows on RTL
|
||||
$rightarrow = 'left.gif';
|
||||
$leftarrow = 'right.gif';
|
||||
} else {
|
||||
$rightarrow = 'right.gif';
|
||||
$leftarrow = 'left.gif';
|
||||
}
|
||||
|
||||
if ($indent > 0) {
|
||||
$leftright .= '<a class="editing_moveleft" title="'.$str->moveleft.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
'&indent=-1&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/left.gif" class="iconsmall" '.
|
||||
' src="'.$CFG->pixpath.'/t/'.$leftarrow.'" class="iconsmall" '.
|
||||
' alt="'.$str->moveleft.'" /></a>'."\n";
|
||||
}
|
||||
if ($indent >= 0) {
|
||||
$leftright .= '<a class="editing_moveright" title="'.$str->moveright.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
'&indent=1&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/right.gif" class="iconsmall" '.
|
||||
' src="'.$CFG->pixpath.'/t/'.$rightarrow.'" class="iconsmall" '.
|
||||
' alt="'.$str->moveright.'" /></a>'."\n";
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -9,7 +9,9 @@
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $id));
|
||||
require_login($course->id);
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
|
||||
$strreports = get_string('reports');
|
||||
|
||||
|
||||
+10
-10
@@ -33,25 +33,25 @@
|
||||
$chooselog = optional_param('chooselog', 0, PARAM_INT);
|
||||
$logformat = optional_param('logformat', 'showashtml', PARAM_ALPHA);
|
||||
|
||||
require_login();
|
||||
|
||||
if ($hostid == $CFG->mnet_localhost_id) {
|
||||
if (!$course = get_record('course', 'id', $id) ) {
|
||||
error('That\'s an invalid course id'.$id);
|
||||
}
|
||||
require_login($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_capability('moodle/site:viewreports', $context);
|
||||
add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id);
|
||||
} else {
|
||||
$course_stub = array_pop(get_records_select('mnet_log', " hostid='$hostid' AND course='$id' ", '', '*', '', '1'));
|
||||
$course->id = $id;
|
||||
$course->shortname = $course_stub->coursename;
|
||||
$course->fullname = $course_stub->coursename;
|
||||
require_login($course);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
require_capability('moodle/site:viewreports', $context);
|
||||
add_to_log(0, "mnet course", "report log", "report/log/index.php?chooselog=1&host_course=".urlencode($host_course), $course->fullname);
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
require_capability('moodle/site:viewreports', $context);
|
||||
|
||||
add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id);
|
||||
|
||||
$strlogs = get_string('logs');
|
||||
$stradministration = get_string('administration');
|
||||
$strreports = get_string('reports');
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
switch ($logformat) {
|
||||
case 'showashtml':
|
||||
if ($hostid != $CFG->mnet_localhost_id || $course->id == SITEID) {
|
||||
if ($hostid != $CFG->mnet_localhost_id || ($hostid == $CFG->mnet_localhost_id && $course->id == SITEID)) {
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportlog', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
|
||||
} else {
|
||||
if ($hostid != $CFG->mnet_localhost_id || $course->id == SITEID) {
|
||||
if ($hostid != $CFG->mnet_localhost_id || ($hostid == $CFG->mnet_localhost_id && $course->id == SITEID)) {
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportlog', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
+14
-13
@@ -85,6 +85,9 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
|
||||
order by
|
||||
h.name";
|
||||
|
||||
$hostarray = array();
|
||||
$dropdown = array();
|
||||
|
||||
if ($hosts = get_records_sql($sql)) {
|
||||
foreach($hosts as $host) {
|
||||
$hostarray[$host->id] = $host->name;
|
||||
@@ -94,36 +97,34 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
|
||||
$hostarray[$CFG->mnet_localhost_id] = $SITE->fullname;
|
||||
asort($hostarray);
|
||||
|
||||
foreach($hostarray as $hostid => $name) {
|
||||
// $hostid already exists
|
||||
foreach($hostarray as $hostid_ => $name) {
|
||||
$courses = array();
|
||||
$sites = array();
|
||||
if ($CFG->mnet_localhost_id == $hostid) {
|
||||
if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) {
|
||||
if (has_capability('moodle/site:viewreports', $context) && $showcourses) {
|
||||
if ($CFG->mnet_localhost_id == $hostid_) {
|
||||
if ($ccc = get_records("course", "", "", "fullname","id,fullname,category")) {
|
||||
foreach ($ccc as $cc) {
|
||||
if ($cc->id == SITEID) {
|
||||
$sites["$hostid/$cc->id"] = format_string($cc->fullname).' ('.get_string('site').')';
|
||||
$sites["$hostid_/$cc->id"] = format_string($cc->fullname).' ('.get_string('site').')';
|
||||
} else {
|
||||
$courses["$hostid/$cc->id"] = format_string($cc->fullname);
|
||||
$courses["$hostid_/$cc->id"] = format_string($cc->fullname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) {
|
||||
$sql = "select distinct course, coursename from mdl_mnet_log where hostid = '$hostid'";
|
||||
} else {
|
||||
$sql = "select distinct course, coursename from {$CFG->prefix}mnet_log where hostid = '$hostid_'";
|
||||
if ($ccc = get_records_sql($sql)) {
|
||||
foreach ($ccc as $cc) {
|
||||
if (1 == $cc->course) { // TODO: this might be wrong - site course may have another id
|
||||
$sites["$hostid/$cc->course"] = $cc->coursename.' ('.get_string('site').')';
|
||||
if (1 == $cc->course) { // TODO: MDL-8187 : this might be wrong - site course may have another id
|
||||
$sites["$hostid_/$cc->course"] = $cc->coursename.' ('.get_string('site').')';
|
||||
} else {
|
||||
$courses["$hostid/$cc->course"] = $cc->coursename;
|
||||
$courses["$hostid_/$cc->course"] = $cc->coursename;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
asort($courses);
|
||||
$dropdown[$name] = $sites + $courses;
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$page = optional_param('page', 0, PARAM_INT); // which page to show
|
||||
|
||||
require_login();
|
||||
|
||||
if (! $course = get_record("course", "id", $id) ) {
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if (!has_capability('moodle/site:viewreports', $context)) {
|
||||
error('You need do not have the required permission to view this report');
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
$page = optional_param('page', 0, PARAM_INT);
|
||||
$perpage = optional_param('perpage', 100, PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course id is incorrect.");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
|
||||
add_to_log($course->id, "course", "report outline", "report/outline/index.php?id=$course->id", $course->id);
|
||||
@@ -119,4 +119,4 @@ function print_outline_row($mod, $instance, $result) {
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
require_login();
|
||||
require_login($course->id);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
if (!has_capability('moodle/site:viewreports', $context)) {
|
||||
|
||||
@@ -10,7 +10,7 @@ class course_request_form extends moodleform {
|
||||
$mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
|
||||
$mform->setType('fullname', PARAM_TEXT);
|
||||
|
||||
$mform->addElement('text', 'shortname', get_string('shortname'), 'maxlength="15" size="10"');
|
||||
$mform->addElement('text', 'shortname', get_string('shortname'), 'maxlength="100" size="10"');
|
||||
$mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
|
||||
$mform->setType('shortname', PARAM_TEXT);
|
||||
|
||||
|
||||
+3
-1
@@ -15,6 +15,8 @@ The feature will also reset the start date of the course if necessary.
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
require_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
|
||||
$strreset = get_string('reset');
|
||||
@@ -60,8 +62,8 @@ The feature will also reset the start date of the course if necessary.
|
||||
|
||||
echo '<div class="courseinfo">';
|
||||
echo $strremove.':<br />';
|
||||
print_checkbox('reset_teachers', 1, false, get_string('teachers'), '', ''); echo '<br />';
|
||||
print_checkbox('reset_students', 1, true, get_string('students'), '', ''); echo '<br />';
|
||||
print_checkbox('reset_teachers', 1, true, get_string('teachers'), '', ''); echo '<br />';
|
||||
print_checkbox('reset_events', 1, true, get_string('courseevents', 'calendar'), '', ''); echo '<br />';
|
||||
print_checkbox('reset_logs', 1, true, get_string('logs'), '', ''); echo '<br />';
|
||||
print_checkbox('reset_groups', 1, true, get_string('groups'), '', ''); echo '<br />';
|
||||
|
||||
+20
-20
@@ -146,15 +146,15 @@
|
||||
$scale->description = "";
|
||||
}
|
||||
|
||||
//Calculate the uses
|
||||
//Check if the scale is in use
|
||||
if ($scale->courseid == 0) {
|
||||
$scale_uses = site_scale_used($scale->id,$courses);
|
||||
$scale_used = site_scale_used($scale->id,$courses);
|
||||
} else {
|
||||
$scale_uses = course_scale_used($course->id,$scale->id);
|
||||
$scale_used = course_scale_used($course->id,$scale->id);
|
||||
}
|
||||
|
||||
//Check for scale_uses
|
||||
if (!empty($scale_uses)) {
|
||||
//Check for scale use
|
||||
if ($scale_used) {
|
||||
error("Scale is in use and cannot be modified",$CFG->wwwroot.'/course/scales.php?id='.$course->id);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
echo "<tr valign=\"top\">";
|
||||
echo "<td align=\"right\">";
|
||||
echo "</td>";
|
||||
echo "<td>".get_string("usedinnplaces","",$scale_uses);
|
||||
echo "<td>$stractivities: ".($scale_used ? get_string("yes") : get_string("no"));
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
@@ -240,15 +240,15 @@
|
||||
error("Scale ID was incorrect");
|
||||
}
|
||||
|
||||
//Calculate the uses
|
||||
//Check if the scale is in use
|
||||
if ($scale->courseid == 0) {
|
||||
$scale_uses = site_scale_used($scale->id,$courses);
|
||||
$scale_used = site_scale_used($scale->id,$courses);
|
||||
} else {
|
||||
$scale_uses = course_scale_used($course->id,$scale->id);
|
||||
$scale_used = course_scale_used($course->id,$scale->id);
|
||||
}
|
||||
|
||||
//Check for scale_uses
|
||||
if (!empty($scale_uses)) {
|
||||
//Check for scale use
|
||||
if ($scale_used) {
|
||||
error("Scale is in use and cannot be deleted",$CFG->wwwroot.'/course/scales.php?id='.$course->id);
|
||||
}
|
||||
|
||||
@@ -271,15 +271,15 @@
|
||||
error("Scale ID was incorrect");
|
||||
}
|
||||
|
||||
//Calculate the uses
|
||||
//Check if the scale is in use
|
||||
if ($scale->courseid == 0) {
|
||||
$scale_uses = site_scale_used($scale->id,$courses);
|
||||
$scale_used = site_scale_used($scale->id,$courses);
|
||||
} else {
|
||||
$scale_uses = course_scale_used($course->id,$scale->id);
|
||||
$scale_used = course_scale_used($course->id,$scale->id);
|
||||
}
|
||||
|
||||
//Check for scale_uses
|
||||
if (!empty($scale_uses)) {
|
||||
//Check for scale use
|
||||
if ($scale_used) {
|
||||
error("Scale is in use and cannot be moved",$CFG->wwwroot.'/course/scales.php?id='.$course->id);
|
||||
}
|
||||
|
||||
@@ -424,18 +424,18 @@
|
||||
$line = array();
|
||||
$line[] = "<a target=\"scale\" title=\"$scale->name\" href=\"$CFG->wwwroot/course/scales.php?id=$course->id&scaleid=$scale->id&action=details\" "."onclick=\"return openpopup('/course/scales.php?id=$course->id\&scaleid=$scale->id&action=details', 'scale', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">".$scale->name."</a><br /><font size=\"-1\">".str_replace(",",", ",$scale->scale)."</font>";
|
||||
if (!empty($scale->courseid)) {
|
||||
$scales_uses = course_scale_used($course->id,$scale->id);
|
||||
$scale_used = course_scale_used($course->id,$scale->id);
|
||||
} else {
|
||||
$scales_uses = site_scale_used($scale->id,$courses);
|
||||
$scale_used = site_scale_used($scale->id,$courses);
|
||||
}
|
||||
$line[] = $scales_uses;
|
||||
$line[] = $scale_used ? get_string("yes") : get_string("no");
|
||||
if ($incustom) {
|
||||
$line[] = $strcustomscale;
|
||||
} else {
|
||||
$line[] = $strstandardscale;
|
||||
}
|
||||
$buttons = "";
|
||||
if (empty($scales_uses) && ($incustom || has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM, SITEID)))) {
|
||||
if (!$scale_used && ($incustom || has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM, SITEID)))) {
|
||||
$buttons .= "<a title=\"$stredit\" href=\"$path/scales.php?id=$course->id&scaleid=$scale->id&action=edit\"><img".
|
||||
" src=\"$CFG->pixpath/t/edit.gif\" class=\"iconsmall\" alt=\"$stredit\" /></a> ";
|
||||
if ($incustom && has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
|
||||
@@ -327,4 +327,3 @@
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+7
-4
@@ -13,12 +13,12 @@
|
||||
$page = optional_param('page', 0, PARAM_INT);
|
||||
$perpage = optional_param('perpage', 100, PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course id is incorrect.");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
||||
if (! $user = get_record("user", "id", $user)) {
|
||||
error("User ID is incorrect");
|
||||
}
|
||||
@@ -140,7 +140,11 @@
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode=outline');
|
||||
}
|
||||
|
||||
echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.STATS_MODE_DETAILED.'&course='.$course->id.'&time='.$time.'&report='.STATS_REPORT_USER_VIEW.'&userid='.$user->id.'" alt="'.get_string('statisticsgraph').'" /></center>';
|
||||
// MDL-10818, do not display broken graph when user has no permission to view graph
|
||||
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $id)) ||
|
||||
($course->showreports and $USER->id == $user->id)) {
|
||||
echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.STATS_MODE_DETAILED.'&course='.$course->id.'&time='.$time.'&report='.STATS_REPORT_USER_VIEW.'&userid='.$user->id.'" alt="'.get_string('statisticsgraph').'" /></center>';
|
||||
}
|
||||
|
||||
// What the heck is this about? -- MD
|
||||
$stats = stats_fix_zeros($stats,$param->timeafter,$param->table,(!empty($param->line2)),(!empty($param->line3)));
|
||||
@@ -285,4 +289,3 @@ function print_outline_row($mod, $instance, $result) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user