Compare commits
2448 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43000582c0 | |||
| 9564b02393 | |||
| 92be8db8be | |||
| 1265952149 | |||
| 151ee2bc70 | |||
| 95e42912a7 | |||
| e02bd4a191 | |||
| 9421aca0cd | |||
| b4ac9780fe | |||
| 18e3b74270 | |||
| 4350202847 | |||
| 9d996871bb | |||
| 8dcd43f3fe | |||
| 9a11957599 | |||
| 0eb59ce623 | |||
| 7028b23fa3 | |||
| 39e7e1abf8 | |||
| 85334fdc0a | |||
| 65c0f4de09 | |||
| 4aa6c61150 | |||
| e7e967aef2 | |||
| 33b10c6e6c | |||
| b85806454b | |||
| ead6351e85 | |||
| d0ec93fbd6 | |||
| 8a39753a5d | |||
| 430360c8b7 | |||
| ca433c0170 | |||
| f42cd726f1 | |||
| 427fdf6669 | |||
| de861fe3cb | |||
| 6fb4ced553 | |||
| 62302b6481 | |||
| 3241e2c583 | |||
| dadbd7586b | |||
| 340ccd3e8d | |||
| 79e80e982f | |||
| 67259f1cff | |||
| 68d04a4c33 | |||
| 61b9cd063e | |||
| df849f0cd5 | |||
| 5c52c13309 | |||
| 2147cbda7e | |||
| 52248cff83 | |||
| 53f689833f | |||
| 10c6c6063b | |||
| b346b424d6 | |||
| bb978ef02f | |||
| 98bac2d044 | |||
| e80a8db7e0 | |||
| 8575cd3233 | |||
| 840c178193 | |||
| 01f2900014 | |||
| cae86de785 | |||
| 9bac9e18f9 | |||
| 3ede87d978 | |||
| 709760080f | |||
| bbc4d23fa8 | |||
| 1163776529 | |||
| 3fa7a026f7 | |||
| 2ec96b0538 | |||
| 35ed9b2f2b | |||
| 20439c700b | |||
| c8d63a00e4 | |||
| d9ed37f2f4 | |||
| 07e61bb603 | |||
| 4e66ab82c1 | |||
| e52fb99b48 | |||
| 057b5f5afa | |||
| 4e9bca6d18 | |||
| 7845101287 | |||
| 2e096fa1f9 | |||
| d2c84650ab | |||
| 47b9d48544 | |||
| 5a85115df7 | |||
| b1847bce93 | |||
| 72b7272126 | |||
| d1290a7db9 | |||
| 5eada3cef3 | |||
| 3f459f966f | |||
| 78b41e5cb3 | |||
| 4951cb3743 | |||
| 86fc8f85a5 | |||
| d79666a916 | |||
| 9ef4f2323d | |||
| e0d4440f1c | |||
| 65c56bbf53 | |||
| b7db889494 | |||
| 7d06579ea2 | |||
| 92c26858ed | |||
| e8d768968e | |||
| ba163fa231 | |||
| ee02c13d91 | |||
| 488acd1be9 | |||
| 1579586ced | |||
| 6670a7f214 | |||
| 36ec6afea6 | |||
| 4dfdf6bc6b | |||
| d5a55d2388 | |||
| d396ba798f | |||
| 5f8505882e | |||
| f31bc4d3e6 | |||
| 5a4aa257c1 | |||
| 6c2ae454a5 | |||
| 73fc8c1af7 | |||
| ae20afd889 | |||
| 75c83282ff | |||
| 86a59aa1f0 | |||
| c3996b3fd2 | |||
| 0dfd208184 | |||
| 598be1325b | |||
| ff9f2f955a | |||
| 1e77b7122e | |||
| 825c4c8878 | |||
| 63830e903d | |||
| 3a78c4785f | |||
| 723ee6a111 | |||
| bc1e9d4590 | |||
| a9c48ae08d | |||
| bf5f1e7676 | |||
| a50d60d69d | |||
| 661c23469a | |||
| fc8bc7e516 | |||
| 9fa8271283 | |||
| b3f2aad71c | |||
| d0e258b55b | |||
| 6c61fd041e | |||
| a4557331c9 | |||
| f038d9a313 | |||
| 89dfb4c1f3 | |||
| a384809295 | |||
| 34e934a97b | |||
| 13ae718937 | |||
| 0dafd031df | |||
| d28e480a7b | |||
| 69a8774592 | |||
| 6e7b4b6f04 | |||
| fca6318ce0 | |||
| 601ae6c095 | |||
| c77ce11179 | |||
| 54be24ecec | |||
| e47543451e | |||
| 2e89715bc2 | |||
| 5cc875eb9e | |||
| e2612ab906 | |||
| adb0158041 | |||
| a2a9f74092 | |||
| 68bd12a490 | |||
| 44da444d07 | |||
| 6fbfecd5e4 | |||
| 8803bbe759 | |||
| 80c115f579 | |||
| 522ed87231 | |||
| 52cf604332 | |||
| 831fbe1465 | |||
| 19a2731137 | |||
| 0be5186369 | |||
| d5a2ccadb9 | |||
| 06b1db82d2 | |||
| 38ff09a83a | |||
| b1d530d202 | |||
| 4e3a60929c | |||
| 6f5a792f1d | |||
| 60b025d1cc | |||
| a12f686b62 | |||
| fcc69042e9 | |||
| ca1388dac7 | |||
| dd050b3320 | |||
| 6d18d87382 | |||
| a30f997e4c | |||
| 5151ae66e3 | |||
| bd83d0a3a8 | |||
| 5b5f2971f1 | |||
| 0d677409d7 | |||
| a0a4a3c964 | |||
| 3e0d46ec36 | |||
| 9a91764210 | |||
| ecc8403ea2 | |||
| 9bf45e0036 | |||
| 364525e7ec | |||
| 9086aae9d4 | |||
| 7edcf6a1dc | |||
| 2de4073e85 | |||
| 87da71438e | |||
| b73854ed9a | |||
| d489165285 | |||
| 6b4c1848e8 | |||
| 8c9474844b | |||
| 44dc1d3a6d | |||
| ba2cde498d | |||
| 95c1bce09e | |||
| 3e3e3fe8da | |||
| 4a2b560257 | |||
| 4dcb35aa47 | |||
| b41bec3429 | |||
| ae913cbd01 | |||
| 046e5a0509 | |||
| f3162d71a2 | |||
| d4966ef24a | |||
| b082b2c641 | |||
| 2f39268b3d | |||
| bded7f70b5 | |||
| 8c0f49667f | |||
| 191ad6873c | |||
| 1d79bf7b37 | |||
| 5710554f12 | |||
| 2d3541895e | |||
| 1e55ed2610 | |||
| aebaf90462 | |||
| 68ddf8bc47 | |||
| 977070f9e8 | |||
| da0fe63f91 | |||
| e1fc83a0ee | |||
| f3684fd8c5 | |||
| 95b5a227e5 | |||
| b934e7a342 | |||
| b643af5900 | |||
| b10f6e7388 | |||
| 6e4c0f6164 | |||
| dc47f786f9 | |||
| 59678118dd | |||
| 4a6f5ff250 | |||
| de0c05a02c | |||
| 3cf4ab978b | |||
| d64f6001e6 | |||
| 4c4a240b43 | |||
| 39564db029 | |||
| 1a6c02faba | |||
| 063a889557 | |||
| 0c92a8656a | |||
| 2830fb92cb | |||
| 51417807ab | |||
| e9560e3f4f | |||
| 54b75c2aab | |||
| 5a8118b839 | |||
| 3cbec41b70 | |||
| 84bbca5355 | |||
| 17050991cd | |||
| 9c08ad13de | |||
| 9b8a519291 | |||
| adb979a227 | |||
| d2b75ad62b | |||
| f1b9a9e388 | |||
| 351aac92eb | |||
| abc3b857a2 | |||
| c6b456f66d | |||
| 4aa5717177 | |||
| f5a3da93f8 | |||
| 19c0e4bc61 | |||
| 108055e37c | |||
| 99674db811 | |||
| a69ffecd9c | |||
| 9a5c745d92 | |||
| 57946b6d47 | |||
| d928d9085d | |||
| 2eef791f9c | |||
| dd506ec8e5 | |||
| 82d0993215 | |||
| 52a88a8726 | |||
| 589af000f2 | |||
| db46e49c9d | |||
| 4a5644e51a | |||
| a3dac57f5c | |||
| 1fed52248e | |||
| dd780a3b4c | |||
| bdad9dbae8 | |||
| 8516afd507 | |||
| 31f9f60576 | |||
| 3beaa4b6a3 | |||
| ea5d48ee8d | |||
| 75c591dbb9 | |||
| 9c7fee6c21 | |||
| 940fca1a36 | |||
| 15ba837b5b | |||
| 4855286e27 | |||
| 3a954ad47f | |||
| dcf9cea2a1 | |||
| 13d7ed45db | |||
| f49306f136 | |||
| 097015895c | |||
| 4c65dd7fb2 | |||
| 4634e6f53b | |||
| b20ee40745 | |||
| 39f34785c8 | |||
| b7a3d3b24c | |||
| cb4287ea70 | |||
| f05070115c | |||
| e359234d0f | |||
| a9f80673b6 | |||
| a8d909c77b | |||
| f17eb3e5bd | |||
| 6a49664032 | |||
| a09e5d42d5 | |||
| 898f04d9cf | |||
| c550cf2bd4 | |||
| 80b3028ac0 | |||
| 9174b41dc6 | |||
| f662e56130 | |||
| b4443d8f34 | |||
| 4bf586673f | |||
| 7277e30684 | |||
| 3b395d7acb | |||
| dad2182e95 | |||
| e7bc78936e | |||
| 7996c056f5 | |||
| 86fb5ed596 | |||
| c3862e8fda | |||
| b88e650dff | |||
| 5d67c62017 | |||
| 20daa09bae | |||
| 58abc13554 | |||
| 5d93e4a421 | |||
| a4668b510b | |||
| 62b7ad7bf5 | |||
| 6780cb4a2b | |||
| a0db7a3dba | |||
| 85d9f6a4ff | |||
| 44cd348070 | |||
| cff6690486 | |||
| 1b899e00a2 | |||
| 645ac738f3 | |||
| 623799eb26 | |||
| fd23d4f550 | |||
| 7b9de57b1c | |||
| 3733b47cdd | |||
| 6ff27f32af | |||
| f7fcac8686 | |||
| 9ce83538eb | |||
| d91fc81766 | |||
| 0d3b6f3c4e | |||
| 7e99e2655c | |||
| e418c553a6 | |||
| f77b6706ac | |||
| c6c43ae9de | |||
| f8b2bb32ab | |||
| b3d8eda1cf | |||
| 469e3afdc6 | |||
| f9be9b8047 | |||
| 056b4085f9 | |||
| ea3cf78190 | |||
| ea512d90b6 | |||
| 972686287a | |||
| 74adc85bb4 | |||
| 2a9d1fc844 | |||
| 61703d4e21 | |||
| a528d23fc2 | |||
| 3a473e0b61 | |||
| 5f2a848914 | |||
| 6cfb7b8b3e | |||
| 70dadbc7e7 | |||
| 8e1c2e2994 | |||
| 5e576418df | |||
| 0dcd9cdeb0 | |||
| aad15755dc | |||
| 588d3bb84b | |||
| d7e22e4751 | |||
| ac30207d3f | |||
| e4669bcf10 | |||
| df56fd6837 | |||
| 80492e6072 | |||
| 1e466f029a | |||
| e30089c248 | |||
| 42655a6ace | |||
| 208fb2d327 | |||
| 337b9e6fbc | |||
| 8ec4b43554 | |||
| c253550a40 | |||
| 252b2fe126 | |||
| dbc11edaae | |||
| cda9f2b312 | |||
| c4f17346dd | |||
| 394c97c88b | |||
| a78e874f6b | |||
| 1192a9ef6f | |||
| 003c204214 | |||
| 4f682a063f | |||
| aecc779ee7 | |||
| 026d711e26 | |||
| db763c3810 | |||
| dc648d41da | |||
| 65b14fbe73 | |||
| acd4298d68 | |||
| ddca860a84 | |||
| 820c1b0ecc | |||
| 3e2ac6a050 | |||
| 499d1a4020 | |||
| cc14c8bd42 | |||
| c95ca8f034 | |||
| 7b7317232a | |||
| 89e399dcda | |||
| 7a9e8dae46 | |||
| e39a04d573 | |||
| 740f08cb01 | |||
| 32fe5d5443 | |||
| d77b492283 | |||
| e5effc413f | |||
| c837e4a577 | |||
| e553bdecf7 | |||
| 98d4782e8a | |||
| eed6ad1d15 | |||
| ba7644c64d | |||
| 862e37cd53 | |||
| b46792fe1e | |||
| 4b6d8dd545 | |||
| a43b24985f | |||
| e9a551b341 | |||
| 743a92ff49 | |||
| 84a2fdd706 | |||
| 4c17698e77 | |||
| 0b2bff196e | |||
| 55d2bbbb4b | |||
| cde82169a7 | |||
| f30823dedd | |||
| 3819ed3115 | |||
| 1e23ed0aa4 | |||
| 0186d7e0e1 | |||
| 96225787c5 | |||
| 602bde06e7 | |||
| e072c85e65 | |||
| 0f87cb1d09 | |||
| 6c90bfcc79 | |||
| 1e1df0b493 | |||
| e7bb1c8e4f | |||
| ffe58bd967 | |||
| a92624488f | |||
| 2842d324c8 | |||
| 4a9d4e041f | |||
| ead61cb9d0 | |||
| 0e60d11cdc | |||
| 7754a0df58 | |||
| 15153dc088 | |||
| 145292a6e5 | |||
| 6077ffdb23 | |||
| 198d132f90 | |||
| 00310294be | |||
| fb2c01fbb3 | |||
| 63d383336f | |||
| 036f1b884a | |||
| 08ace0d68f | |||
| 43f843d34f | |||
| 086dd78f11 | |||
| b1025d7d86 | |||
| 626daa72f7 | |||
| 63a3695bfa | |||
| 8dad6a690f | |||
| c6c8272ae7 | |||
| e8ba6e6028 | |||
| 6e773096a5 | |||
| a1a163cef1 | |||
| af648ddfec | |||
| 2d8b2369c5 | |||
| 8d311b2d48 | |||
| 995f9f86e9 | |||
| c6c93ee66e | |||
| 7d4a57f648 | |||
| 744d723c2c | |||
| a4dda51f43 | |||
| d1fd642688 | |||
| 828aeff2d6 | |||
| 677d1679fa | |||
| b17333be71 | |||
| 96d6fc8f14 | |||
| 454e72f7d4 | |||
| 522e2249c6 | |||
| ce668c6531 | |||
| 08df81a8e6 | |||
| ddea4cf070 | |||
| c9128b637b | |||
| a5e48d968d | |||
| 7a1cb2c12a | |||
| b1ffbf3e0e | |||
| e14d405263 | |||
| bf3c01535e | |||
| a87491c1d0 | |||
| e081f299f5 | |||
| 6c884b58c9 | |||
| ceafd825e2 | |||
| cd44fdcb82 | |||
| 526234384c | |||
| 27f2c52057 | |||
| f20e195fa4 | |||
| ba90d6d0d4 | |||
| 9743bb84b9 | |||
| f5ffb87d24 | |||
| ffeca1205c | |||
| 90708fc1f3 | |||
| 6a0c9cf8a3 | |||
| 587510bec5 | |||
| 08e2111bf8 | |||
| 5d31e5af40 | |||
| 77885194e3 | |||
| e86a754bab | |||
| 6361d22faf | |||
| 97375ca98e | |||
| a9ccbf60bf | |||
| 74c82136ba | |||
| 5875b7d611 | |||
| 1e03c552e3 | |||
| f96f80db5c | |||
| c0b85daf7b | |||
| 352d94cf37 | |||
| 4101e996e1 | |||
| 111980c772 | |||
| cadb96f29e | |||
| 2073bdf9ba | |||
| 8199e3f09a | |||
| 017b4cab3e | |||
| 6b0a2ff4a5 | |||
| 13112aaa35 | |||
| 6e1ee58e3f | |||
| 59c7115177 | |||
| d879ed9100 | |||
| 1ed0ba1d77 | |||
| 03cd979250 | |||
| 65a275f404 | |||
| d956341c66 | |||
| e8da8d7004 | |||
| 9cc1730595 | |||
| 9b361d24b3 | |||
| 2ab76925a2 | |||
| eb6147a8bb | |||
| 1d9fc41755 | |||
| 8e4c9ef7b1 | |||
| b14875e4a4 | |||
| 5eac36be7d | |||
| a63d7730d0 | |||
| 9f182b1046 | |||
| 004f8037f4 | |||
| 899e041895 | |||
| 94b9a1ca02 | |||
| 7279163ff2 | |||
| b92d1a68a5 | |||
| a740ff66d9 | |||
| f668898c3f | |||
| c9ec4c5557 | |||
| 4b9633290d | |||
| 7399316518 | |||
| 93766dbd6a | |||
| dc06435513 | |||
| d3acd64d59 | |||
| 2816154cd6 | |||
| 89b264c794 | |||
| fabf55e684 | |||
| f43c695e1e | |||
| 5bb661c215 | |||
| 4a4d7c5ff4 | |||
| 448acc2a51 | |||
| c6e86280f2 | |||
| ac1c2b0719 | |||
| c7901feb99 | |||
| dbb4919258 | |||
| d6021c77f6 | |||
| 7758d00f97 | |||
| b8be40ce52 | |||
| a0beda7a7a | |||
| a99008f6e1 | |||
| 71ca2a2a05 | |||
| 5794f89813 | |||
| 0c7aca91e9 | |||
| 10672458f9 | |||
| 4c918350d6 | |||
| 40c287b095 | |||
| abcc3a17b9 | |||
| 249bdbe3cf | |||
| c15ed23f52 | |||
| 4899c66789 | |||
| f8f63ecdd5 | |||
| 987ecd9806 | |||
| fc4a5a2f63 | |||
| c65e968162 | |||
| 9aba486423 | |||
| 7a38bf2836 | |||
| 609a2b13b7 | |||
| 9e353ce7e2 | |||
| 4da85078e9 | |||
| 830e238d58 | |||
| f4da2ed4d7 | |||
| ae2aa3c82c | |||
| e8e6a5602e | |||
| 1a1de46ae2 | |||
| 3ce906d64d | |||
| 652d573b5e | |||
| 6de17fde07 | |||
| aaac8ae3fa | |||
| 667c5e9199 | |||
| 4130af7552 | |||
| eaefa1c0e8 | |||
| 8f583218df | |||
| 0e27a3ae71 | |||
| 62a575d157 | |||
| 302130de75 | |||
| 1d8063adbc | |||
| f14a311ec3 | |||
| 077641504f | |||
| 5b767cb1ea | |||
| 9cf1f5a6ab | |||
| c9b1af4d42 | |||
| 7c8c335fa3 | |||
| 9be2bd0c39 | |||
| 4897d92364 | |||
| d1156ef7ec | |||
| 9232405d8a | |||
| e2e039f18b | |||
| cda397e7f3 | |||
| bd9f4bd634 | |||
| 096b5432a7 | |||
| c10a04e82d | |||
| c872bfb7b9 | |||
| 60efe6cbb3 | |||
| 23323b37b6 | |||
| 24d18e2f8e | |||
| 97e4129b73 | |||
| 7b608def7e | |||
| bbcbc0fecc | |||
| fd9521f6d4 | |||
| 36a043db25 | |||
| 49349c4916 | |||
| c5fff8a5d2 | |||
| d29d3218a2 | |||
| 4866a36714 | |||
| 0f318c26b4 | |||
| 530931dd21 | |||
| 7c11319ad7 | |||
| d09ce61d1a | |||
| 128452bbd8 | |||
| 2969a73c00 | |||
| ac8abb5f6a | |||
| e5415d580a | |||
| e1fb2e6e09 | |||
| ad0abe9d77 | |||
| a711021a75 | |||
| 60abb6a3a8 | |||
| 436a7cae88 | |||
| 83ec909837 | |||
| 3c89f9a837 | |||
| c245b6a339 | |||
| 3afe1085e2 | |||
| 2ad0d1da3c | |||
| b6ee2d82ea | |||
| 52f1b49620 | |||
| 97ea483380 | |||
| 3c0561cfe7 | |||
| ac0024f9f4 | |||
| 424aef6aef | |||
| c3cbfe7fdf | |||
| 05263aefe1 | |||
| f466c9edb6 | |||
| 740f94d8e7 | |||
| a57a7794ea | |||
| 4581271ad1 | |||
| 082e3ebc4f | |||
| 32d03b7b85 | |||
| 110a32e2ca | |||
| 41b94a4044 | |||
| ea3591e41a | |||
| 31d757129f | |||
| 088cbaab7b | |||
| 539a2da1f3 | |||
| 1d06dd30bb | |||
| 831b236f2c | |||
| a46b14ef76 | |||
| 241f6f306b | |||
| daf06e2c33 | |||
| ad50bdddee | |||
| 9867144441 | |||
| e1aaf05de9 | |||
| b7e16e6acb | |||
| 486f78b51f | |||
| aaad489149 | |||
| 0f6f62cbdb | |||
| c469a7efb6 | |||
| d2c3605c83 | |||
| 07bbc2d1c7 | |||
| f91a7bf618 | |||
| 2ecad74265 | |||
| 8d75b3b6dd | |||
| 0b6693ec7e | |||
| 4f91b2965e | |||
| f064a3dfb9 | |||
| 5cdb8a856a | |||
| 016bfc83bc | |||
| 54caa35e20 | |||
| fe412041b5 | |||
| 51a55508e6 | |||
| 11157acdf0 | |||
| a83d775a24 | |||
| e18abcc4de | |||
| 385272bd0f | |||
| 45c93e2669 | |||
| 58fcf99fa7 | |||
| 0621ba74a9 | |||
| 554143f22c | |||
| bdb03cafa8 | |||
| ddbc548d9f | |||
| c7c18a64b0 | |||
| 9d49b43016 | |||
| f1d604cbda | |||
| 65624a2821 | |||
| 2c42415b8c | |||
| d6582c7cac | |||
| 90207a06e3 | |||
| 00d727e387 | |||
| 0c29498ede | |||
| 692a13b499 | |||
| 8b9e007056 | |||
| 1cdd857ce6 | |||
| bcead64f30 | |||
| 4901562dd7 | |||
| 0d851f90a8 | |||
| 01e04d5470 | |||
| 288ffddc1e | |||
| e8fc9f954d | |||
| 80384eee21 | |||
| ac65acc89d | |||
| c49dede89d | |||
| 78b85ede6a | |||
| 546b301b44 | |||
| 9c84314ed7 | |||
| 30c9a78063 | |||
| 7721c69499 | |||
| 35067c438f | |||
| 0e2585ac0f | |||
| eea2335afe | |||
| 8eaa4c61d5 | |||
| a953edbd35 | |||
| 6af8359fc4 | |||
| c696c41b5b | |||
| c57550050f | |||
| ca31091b12 | |||
| e11dc9b682 | |||
| 875cb9fa18 | |||
| c2061f1608 | |||
| 2639d3d310 | |||
| a75082c017 | |||
| a3dec13dab | |||
| 2c7091551f | |||
| 9284861420 | |||
| d523d2ead1 | |||
| 0cbc7de6b6 | |||
| 3a4b33c3b9 | |||
| 178c952a52 | |||
| 58f2393ebf | |||
| 5b16d81510 | |||
| 246dedcf47 | |||
| e3812d2a7c | |||
| 45121ffbf3 | |||
| f0aa2fed24 | |||
| cb3a448415 | |||
| d363047eb0 | |||
| 6579224b6a | |||
| c18a62ddbd | |||
| 822e9771f2 | |||
| 5a1e63d532 | |||
| b273933f1c | |||
| 095d970dba | |||
| 0cc6fa6a1f | |||
| b3153e4b7d | |||
| e138523ff3 | |||
| 4a63f1dc6c | |||
| c812e7b78a | |||
| 2b375658ae | |||
| 9055368540 | |||
| 63349eb15c | |||
| e222ce0944 | |||
| 41fd7fe497 | |||
| 21d1d0773b | |||
| bc5bb6f8f5 | |||
| 12fb46824f | |||
| 76a5ce96fe | |||
| d6f2c959c7 | |||
| b468a22a45 | |||
| 8b7fb26f2c | |||
| 09119f3b8b | |||
| 7eac5f93cd | |||
| 952b9c07b6 | |||
| 96e8998e94 | |||
| 0708881565 | |||
| 393137e290 | |||
| 6b1ce6b2e0 | |||
| 0437ab95c6 | |||
| 80e376a20d | |||
| b53bff0767 | |||
| 2cdbaeba53 | |||
| dcf59b72f9 | |||
| b6bf48acb7 | |||
| 3b05a7f04c | |||
| 7df4d70ac0 | |||
| 27c7e17f44 | |||
| 42e49dad0e | |||
| 6a66656eb7 | |||
| 418729eb3a | |||
| f2d021b0a5 | |||
| b9dd2ed696 | |||
| a36058af51 | |||
| a6c7a9fbf8 | |||
| 1eddd0d8f5 | |||
| 8394e63f23 | |||
| 74736e4922 | |||
| 5e1aaecb20 | |||
| e1fa1667b3 | |||
| 282ddcc924 | |||
| fddab4db5a | |||
| c422f82344 | |||
| 50357f373a | |||
| 755d600fbc | |||
| 7efa3c6bed | |||
| 08fc9b7530 | |||
| 2b3cfed53b | |||
| 29fee097ad | |||
| b722a1edb9 | |||
| 016cd6af4f | |||
| 0ad4eb5f63 | |||
| 26b90e709e | |||
| bbbcfe3b53 | |||
| d92d9a22f9 | |||
| aae8c680c9 | |||
| 0eb7764d4d | |||
| c892ab3672 | |||
| e7d9c96676 | |||
| cb83c3cb4d | |||
| 898ffaf9d4 | |||
| 4da1a0a1db | |||
| 14076f3ad7 | |||
| 13bc710ffa | |||
| 34050fd84a | |||
| 9d162c650f | |||
| 54e5e3f387 | |||
| cbb60bca21 | |||
| 67fa277dd9 | |||
| 8a55b99805 | |||
| 484f723352 | |||
| af7d68413f | |||
| b44b3a9f29 | |||
| 53c02cbe53 | |||
| 4a1ac5c34e | |||
| 2dd985804f | |||
| 2e33a17229 | |||
| 865074ce71 | |||
| fdba9bb4d9 | |||
| 2bda8358da | |||
| dc6799ff22 | |||
| 9ae8a7a94b | |||
| 48adbab6bf | |||
| bd115b3f82 | |||
| 9b591be622 | |||
| f3436de6a7 | |||
| 3ed0a1c316 | |||
| b7318874b9 | |||
| 9069e60346 | |||
| 941391a4c1 | |||
| fed7c5ba94 | |||
| 5c9cbb399e | |||
| fb25ce9457 | |||
| b5abf3e824 | |||
| 31b1967fe1 | |||
| 4cf89ce3d2 | |||
| d4469f2a84 | |||
| 791b42ee1d | |||
| 06d6f733b7 | |||
| 95d4575736 | |||
| 6ba0da0289 | |||
| 35faf19e80 | |||
| 77f4ad40d9 | |||
| 63031d4ae6 | |||
| fe7424eebb | |||
| e046dcd419 | |||
| 55b5b387ba | |||
| a2b0158423 | |||
| 2a5885c432 | |||
| da9e21a407 | |||
| 6fa45f168b | |||
| 358906742c | |||
| 0180f73f48 | |||
| 612250d025 | |||
| 114c82afe5 | |||
| 573eae5aa7 | |||
| ed68c6db3d | |||
| 82f5ee2678 | |||
| a7f4452d11 | |||
| e78d197dca | |||
| 36268d0271 | |||
| 8ba911fc29 | |||
| 20144a68f0 | |||
| 077b1acf0d | |||
| b56fad0b50 | |||
| 9423833cd9 | |||
| 037f99aa2d | |||
| 69d79bc31f | |||
| bb0d4590bd | |||
| 16e962a71c | |||
| 4afe0109d1 | |||
| 86c90e4541 | |||
| b7510ce4ee | |||
| 04b113f6e1 | |||
| dad2efab6b | |||
| bd5d44fa22 | |||
| ac679ffd80 | |||
| 3d575e6f08 | |||
| 30654f8c11 | |||
| 4de2f1d6ff | |||
| de411a0595 | |||
| 6dfa062f89 | |||
| a80a772821 | |||
| 006af32664 | |||
| 2cb2ce61ad | |||
| 3d35e6b732 | |||
| 0720313b30 | |||
| 27a350e676 | |||
| 3caa089f49 | |||
| 800578b7fe | |||
| c7cdd6ec82 | |||
| 2b80c9d76a | |||
| 29856bcba0 | |||
| 3d94772d47 | |||
| 8ff79e8c5b | |||
| d98579dbc9 | |||
| 819110a116 | |||
| d3128ddf0e | |||
| 6077020a60 | |||
| 5ea64f4b2f | |||
| fcf9c45033 | |||
| e248a905b4 | |||
| 5476a93df2 | |||
| e83c419d06 | |||
| ab39445640 | |||
| cb98d3120c | |||
| 77e84a85f2 | |||
| b4e1d00641 | |||
| 2d263cd84b | |||
| 916ac02608 | |||
| 1eff7fef0c | |||
| 9fa6280580 | |||
| bb8c36313c | |||
| a698fc0e92 | |||
| 7008b03ca3 | |||
| 25be6cfff3 | |||
| 89f1cea654 | |||
| 5c09be163c | |||
| 0892f7bd01 | |||
| 66e7920caf | |||
| 99d7c97106 | |||
| 1390f203a7 | |||
| 36c23cd6a9 | |||
| ba39fa10cc | |||
| 916bb3daec | |||
| 6be18d4f75 | |||
| 50dbc51fc9 | |||
| e9163ad481 | |||
| 643cd42872 | |||
| e06a8263a1 | |||
| 279826e26f | |||
| 066af654c2 | |||
| 70812e39a0 | |||
| ad7101a17b | |||
| 73e7875705 | |||
| df7177161a | |||
| 1d1a623391 | |||
| 83f007bf39 | |||
| 6deb891b4c | |||
| b50b027b2b | |||
| 66ee479190 | |||
| 9a7f910cf8 | |||
| 899da17470 | |||
| eb74cfd05e | |||
| 4fb93b2ed2 | |||
| ece42d55fc | |||
| fd6c9e1d3a | |||
| 9785185db2 | |||
| e6ce0cb9f3 | |||
| b18077d5e3 | |||
| 8eb675a555 | |||
| 9328530195 | |||
| de7d2d5531 | |||
| 858c8a05e8 | |||
| a1a6750357 | |||
| 6a903e0e83 | |||
| 391aab5ea0 | |||
| 5604f7798f | |||
| 9586c1dd6b | |||
| ef6a649b72 | |||
| e21e20cfd7 | |||
| 6a751fca5a | |||
| 404afe6b86 | |||
| 8a2c90768f | |||
| c585ba8b14 | |||
| a0b9571f7c | |||
| 0affff5ecd | |||
| 61f95aada5 | |||
| dfa14bc98f | |||
| d7143408df | |||
| 2e39d2f810 | |||
| a4de843e15 | |||
| 09b78a6b3d | |||
| 8c0ef41d6a | |||
| 33dd9a0bcf | |||
| 9928b09e6e | |||
| 0d0e550f88 | |||
| afabdb1491 | |||
| fbe0e97ceb | |||
| 18845ac357 | |||
| 0609562b64 | |||
| 33cc423e38 | |||
| 2e855d5f05 | |||
| c0ae5fc15b | |||
| 5316939bcf | |||
| a7f5bf8575 | |||
| 2f9c977e6b | |||
| f356144c52 | |||
| 02509fe667 | |||
| d26924c4ec | |||
| 210d0f3388 | |||
| 80bc80e121 | |||
| 43e93a0756 | |||
| e695cd3f36 | |||
| 18352a55f5 | |||
| b2d594c8de | |||
| ca952b033d | |||
| facbf40f92 | |||
| 38be5e773e | |||
| 798af5b7e7 | |||
| 22592150f9 | |||
| 9748030a8f | |||
| 298698ae60 | |||
| 5e04a34404 | |||
| c6d691dc28 | |||
| 28b6f2b404 | |||
| 1ad1390857 | |||
| e08061157c | |||
| c322ecb76a | |||
| 98a45cd7e7 | |||
| 52c6d39e93 | |||
| c9b7e81ac0 | |||
| e318d18df2 | |||
| ce57cc79eb | |||
| 46d621261b | |||
| ef6b0c645e | |||
| 8d2acc5cee | |||
| 7b656c9707 | |||
| f287b42cee | |||
| b0be6c79bf | |||
| 60904615c5 | |||
| 1aaef0d086 | |||
| 79741ebe7e | |||
| 33235e53b0 | |||
| ea31ae41c7 | |||
| cab9d39e60 | |||
| 49df1a42b5 | |||
| 945e013c67 | |||
| 6b95445ac8 | |||
| 339ac7daa5 | |||
| 68cd6454aa | |||
| 88ba0fed41 | |||
| 77362fa9ce | |||
| 5fba04fba0 | |||
| e34aab0dd0 | |||
| 5f1317f88e | |||
| d8f6ab1b8a | |||
| 4fc2eb7a5e | |||
| a33ba1367e | |||
| eef16119b9 | |||
| ca3dc4c7c0 | |||
| 268e90211a | |||
| 75b2ba754f | |||
| 27ac57c086 | |||
| 94d712f197 | |||
| 0f32a7f3f9 | |||
| 218b443372 | |||
| bb95c08bc4 | |||
| 71767204c9 | |||
| c4ae4fa1a8 | |||
| a8502a18fb | |||
| f95ad4b43a | |||
| b78eabdcdd | |||
| 359c9742df | |||
| 16e45ab4c9 | |||
| 14cafbd4eb | |||
| 757720d532 | |||
| 80a51ae512 | |||
| edd962ab73 | |||
| eda0719d95 | |||
| 2d1c22bb66 | |||
| 1e80bd71a4 | |||
| c5a05b9598 | |||
| 9f39874ec5 | |||
| e2c4f8e4dc | |||
| c57e40225f | |||
| 3da4752434 | |||
| f24cffb995 | |||
| 6f01df4957 | |||
| f63823b3cc | |||
| d7df380b78 | |||
| bd9dd91015 | |||
| fabeeb627c | |||
| a2c3b87eda | |||
| 999beee0b6 | |||
| aeb23d0a02 | |||
| c3fcf3f3c5 | |||
| f52a0eb948 | |||
| d05956ac9f | |||
| da8079852c | |||
| 29aab4acda | |||
| 0a45ffe301 | |||
| f309f624ea | |||
| c7609872ca | |||
| 7d18a73462 | |||
| 413766e856 | |||
| 34a2293e08 | |||
| ecd7e49e87 | |||
| a9981ba619 | |||
| 94b27136b2 | |||
| 4aac7b8ab6 | |||
| 62f5a86963 | |||
| 127962ca2a | |||
| d57e12eb51 | |||
| cc8a82dcbe | |||
| a871ec51d0 | |||
| f4212b4f12 | |||
| b91d6dcd57 | |||
| 3fc6ae75e4 | |||
| a6c3d65039 | |||
| ec15d3e9f1 | |||
| e9089eb471 | |||
| d04d87e3bd | |||
| 91504deaee | |||
| 2aa4f4d1f4 | |||
| 2c33370ac5 | |||
| f14d97d06e | |||
| f70567fee5 | |||
| 19090101a9 | |||
| cf37cc5502 | |||
| 81cc156467 | |||
| 1e32384cc0 | |||
| 7df59158b8 | |||
| e21f6c81b5 | |||
| 1b69867429 | |||
| 9197e1472f | |||
| 0d67c51458 | |||
| ddc7afad9a | |||
| e9f289635d | |||
| 998ebd420a | |||
| 34c46c1724 | |||
| 37d67d011a | |||
| 2c4263c433 | |||
| 548ef30e8b | |||
| 499795e84d | |||
| 951b22a829 | |||
| 158d5a4f32 | |||
| 6e51e14435 | |||
| 7692b869ef | |||
| 9249e3ab4e | |||
| f301de5e9e | |||
| 29fb5974e7 | |||
| 87e6dacbdf | |||
| 4300aa4c58 | |||
| 14b54f0166 | |||
| 17c4a01172 | |||
| f0c60a8fba | |||
| c8e87ef291 | |||
| 104789e9d6 | |||
| 12c20fffc6 | |||
| 8d3f818bdd | |||
| f75b1ea426 | |||
| 0643b1db7a | |||
| 1b4ccb8a92 | |||
| 797e9e30ce | |||
| a98d00e2b0 | |||
| ca34d03f32 | |||
| 60e1ce7574 | |||
| cd71d7dcb1 | |||
| d1d124cbfb | |||
| 82fead1aa7 | |||
| ffaaf096a5 | |||
| c779f92903 | |||
| 14f3260978 | |||
| 5c27e7612c | |||
| 9aefce20af | |||
| 1cfed10bb9 | |||
| e77c81e132 | |||
| 544fe071bd | |||
| 93394a9018 | |||
| 20267252a2 | |||
| 80a78b58ba | |||
| b6da50fd63 | |||
| a63e9ffee4 | |||
| aab97b351c | |||
| ca23a9c9dc | |||
| 3e562b88f9 | |||
| 4a4b204a6a | |||
| 748fd535fe | |||
| e38015fe92 | |||
| 2abea577b6 | |||
| 5059262770 | |||
| bf7ccea05d | |||
| 8714c2cfb5 | |||
| fe20dc9679 | |||
| 13f5b23d28 | |||
| 6edf4682e6 | |||
| 481893d070 | |||
| 860a0cd028 | |||
| 2e04935a60 | |||
| ca9c070589 | |||
| b06c3ba8cf | |||
| 0a6150ca2e | |||
| f99035c299 | |||
| 84994c886e | |||
| 5de0722025 | |||
| 24c70149ad | |||
| d0f86d1654 | |||
| 282ecaf828 | |||
| 7748ddaa14 | |||
| 568d750b41 | |||
| 148b8edfca | |||
| 79619daf93 | |||
| d8e24b78ea | |||
| 1a0c9eff8e | |||
| 4f3d1a638f | |||
| f464c2757a | |||
| f15d37e068 | |||
| e9f3e715dd | |||
| deae201fc6 | |||
| dfa1fbac6d | |||
| 1cb5bf828b | |||
| 0253cd4edc | |||
| 5a2f8b8dcd | |||
| 7a55fe065d | |||
| ea229804e1 | |||
| c133989f09 | |||
| 920d44320d | |||
| 18eaa5d2ca | |||
| 431744ad94 | |||
| 7808ee76d5 | |||
| e72a2e6d63 | |||
| 5276dc4887 | |||
| 0226a97d31 | |||
| 02759cb587 | |||
| 2b9641da2f | |||
| 263a473593 | |||
| 761205376c | |||
| 3bd98ad4bc | |||
| e097165541 | |||
| 2b4287d5bc | |||
| 75194fffbf | |||
| 507407a795 | |||
| a08b9fe9d4 | |||
| f2c80965f5 | |||
| 3afbefcc09 | |||
| 07be0ed2b9 | |||
| 24c32bd668 | |||
| 6031fe85d5 | |||
| 8fcd25b850 | |||
| 3facf28fe1 | |||
| 38a8fdd790 | |||
| 15e06a2444 | |||
| 713740a044 | |||
| 27d1407c28 | |||
| 2d439c9d59 | |||
| f74959fbb6 | |||
| 0da33e07b9 | |||
| f86eb3ce12 | |||
| 3ac035a0db | |||
| f374fb1006 | |||
| ee39bbe0ee | |||
| 89b8d337da | |||
| d751243549 | |||
| 0d71d164b8 | |||
| 82ca81cf69 | |||
| 4cd327fb26 | |||
| b06021549a | |||
| 1b7d0ba271 | |||
| 4f7a557d6d | |||
| 1ae0dbd1a7 | |||
| d99315f8db | |||
| 1e669a01ea | |||
| 0f776ec0e2 | |||
| da0cd0fc56 | |||
| 29bf1ebf4d | |||
| 0ce4aa1a8a | |||
| 3fcc331fee | |||
| 3334a25495 | |||
| b35a612212 | |||
| e1518b0c1c | |||
| 0036338998 | |||
| be8148eabb | |||
| 86f4d9359b | |||
| 6087fc2062 | |||
| bdc4deaec1 | |||
| 51b468cdf0 | |||
| e82b841361 | |||
| 8c39e2740f | |||
| d642f548d2 | |||
| bf9f73f4cb | |||
| 36040ae11c | |||
| 381e9bfaef | |||
| 2003e4464c | |||
| 08481e544c | |||
| 218cb966c5 | |||
| d5ec0e19e6 | |||
| 98591c89d5 | |||
| 77c8896b6b | |||
| f43c849f7e | |||
| 7667ed702c | |||
| ae1d214cd5 | |||
| b1b589b5cc | |||
| d13a5d7f0c | |||
| dab3fc5be3 | |||
| 04304c10bc | |||
| 11126b9cf4 | |||
| cae5f003b7 | |||
| 08ff2b3027 | |||
| b5ef9489bf | |||
| 9fb9dac127 | |||
| 24157e96c0 | |||
| fbf60b0194 | |||
| a056982dc6 | |||
| 5b597be648 | |||
| 453f8ff2a1 | |||
| 5bacdab796 | |||
| 0829018167 | |||
| b3ded3a32a | |||
| 24228ffc24 | |||
| b92e1c36cb | |||
| 92d7061e22 | |||
| 0787779dad | |||
| e3b343e0e3 | |||
| b4c480c34a | |||
| cb5870c56f | |||
| e1bdace263 | |||
| c5899c7b23 | |||
| 3f052470ec | |||
| 83d8e36f15 | |||
| 54e7130ed2 | |||
| 6049fb78f2 | |||
| 4020587b9a | |||
| 64569cbb5b | |||
| 945b2b4a6e | |||
| 46bbd4b651 | |||
| aff2c394cf | |||
| 4350adc1fb | |||
| d53c70d47c | |||
| 94c2c3924b | |||
| 06ab455142 | |||
| 873efec0b7 | |||
| f1b8867491 | |||
| 94791ada75 | |||
| a6f989fc61 | |||
| 34edc3ad1b | |||
| bd741d50f8 | |||
| badec294d3 | |||
| cbf93aff2b | |||
| e6910f0a75 | |||
| 86d1f427e5 | |||
| 120bfe673e | |||
| 391fa1bb50 | |||
| aaa8642d41 | |||
| 48a5356040 | |||
| 7a2c7ce2eb | |||
| 31f5d4d1fc | |||
| e0ad04798d | |||
| c610c20d16 | |||
| eb4ad7479f | |||
| b7e82b4904 | |||
| 1a5a3ccf24 | |||
| 2860b7a5f2 | |||
| 3fb839a1e4 | |||
| a6478fdc0d | |||
| 99cb3dc887 | |||
| 19a95eb03a | |||
| f68846e3ec | |||
| 2a4253ba76 | |||
| c95d3c0fad | |||
| adcedde7d9 | |||
| f36b1996a2 | |||
| c97500720d | |||
| 6a366909c9 | |||
| cb2a3ab4b7 | |||
| 4252895a6b | |||
| 49dea6bce9 | |||
| 003296c476 | |||
| 098c476559 | |||
| b1e53f2c2d | |||
| 9bc586e097 | |||
| d997d2d44e | |||
| f273fa076f | |||
| ed99b35e06 | |||
| 60b9a5658f | |||
| fcdb4a3b15 | |||
| 4351130450 | |||
| eb87881479 | |||
| f5aa1c37c9 | |||
| 8c8c9bafa5 | |||
| 7f46857afe | |||
| e6d273ebe7 | |||
| 943eb7e150 | |||
| d47614fad2 | |||
| 32ba0b9b79 | |||
| 3851ea3fe7 | |||
| 5307a1a2bc | |||
| 69d51d3a81 | |||
| 6675f0141d | |||
| 835389b818 | |||
| 91c66d3af8 | |||
| da2ae41d3f | |||
| 54901b1c82 | |||
| c4b39dd214 | |||
| d3159192e9 | |||
| 11a13a66bc | |||
| 388a73c52a | |||
| f8029045de | |||
| 07bc723585 | |||
| 2e82fd38c1 | |||
| d39e56ede3 | |||
| 43bf9fc2d7 | |||
| c3b736a119 | |||
| bdc8431a46 | |||
| 402377c375 | |||
| 544c4b9aa3 | |||
| f1de6e874f | |||
| 404cfbb836 | |||
| e7443ea3ff | |||
| f6fb1034ce | |||
| b85bf04ba0 | |||
| 1e085edc43 | |||
| 08c80128a9 | |||
| 55030f9a41 | |||
| a61cf7e35e | |||
| 79be5e9a41 | |||
| 22311d81d4 | |||
| 60c9f51a41 | |||
| 27a2c7692f | |||
| e0920b2189 | |||
| df0628e289 | |||
| 4da57a09bd | |||
| 977862af80 | |||
| 87cfde86ba | |||
| f0abc763a3 | |||
| 3d9f49f026 | |||
| ba54365c18 | |||
| b1e820edc4 | |||
| ac80c7a338 | |||
| 05c6e5b96b | |||
| d8b7e41c87 | |||
| f0d23c6f33 | |||
| 7451d96fc1 | |||
| b95a986819 | |||
| 3007ff3e80 | |||
| 3f4b8e4214 | |||
| c0f2bc8462 | |||
| 0c3ffa2f7a | |||
| 83891eda00 | |||
| 007df43c33 | |||
| 2657d7cb46 | |||
| be3737bfc0 | |||
| c728ec734e | |||
| 6942583e02 | |||
| 04fb8cf51b | |||
| 9ce91ed13e | |||
| eb375f626f | |||
| d4b1ce148f | |||
| 4511145165 | |||
| bc56d5415b | |||
| e6618986ca | |||
| 26d2f5fb4a | |||
| 883360834f | |||
| fe428e6037 | |||
| 5a6d1a79ce | |||
| 2931ade5d7 | |||
| d6c3bebead | |||
| 74b1ef5af6 | |||
| 4a7fc30090 | |||
| 08d2504bb3 | |||
| 2646460c6e | |||
| 0705343e58 | |||
| a5abee5817 | |||
| 2a19447428 | |||
| 0c488bf830 | |||
| c30c36a352 | |||
| dc97859c78 | |||
| ee273b61a4 | |||
| e7b51a9bf0 | |||
| 6f0c8b88b4 | |||
| bfd68abc58 | |||
| 2e54fffcaa | |||
| ecdeec8e7b | |||
| 4d98562c00 | |||
| 7429c4afc4 | |||
| 07eb7fa7b8 | |||
| cf3eb7c310 | |||
| 945bb28be7 | |||
| dc610c361a | |||
| 66a7ecbe73 | |||
| 8eb50d764d | |||
| de7629503a | |||
| 67c8d5cadf | |||
| cb6424d6e8 | |||
| 7541ceed5e | |||
| c80828fe8f | |||
| d33986dbe6 | |||
| d1e5e6359e | |||
| 4b45f30023 | |||
| ba7c34fb18 | |||
| 0ad9666ffd | |||
| cdb4ca838d | |||
| 5a80fd86be | |||
| 74b9476a3a | |||
| 11797fd804 | |||
| 1e57486f11 | |||
| 3f1d9b22ba | |||
| ce24824eba | |||
| 9723c2d606 | |||
| 5b4388f305 | |||
| 072f753331 | |||
| 316ebf78a3 | |||
| 811a6f64c5 | |||
| a0e66115cd | |||
| 45a3ca96ae | |||
| 06879cb492 | |||
| a051e31700 | |||
| 1b225eaf65 | |||
| 78d4084cf1 | |||
| 97a49e63ed | |||
| 37afa39a5e | |||
| 81434da2b3 | |||
| 6a6f95c3cb | |||
| f01e4314ed | |||
| 79edc7f972 | |||
| 285b8f7fef | |||
| c2d27ab6a6 | |||
| c140dc684f | |||
| 750eeaebd5 | |||
| eb12fd50d2 | |||
| 0315927955 | |||
| a8f9baaf4e | |||
| 90471d6b0b | |||
| 2ee3c92e4a | |||
| 129cee29fc | |||
| 69c7eba733 | |||
| 87755b16cd | |||
| 43875a1069 | |||
| 6560de825e | |||
| 76e70b8732 | |||
| 50d929736e | |||
| 4e0eb3d298 | |||
| b5cbb64dc5 | |||
| d344988f0b | |||
| 270f6cf52c | |||
| e935da6f31 | |||
| f058099d78 | |||
| 086f592ebc | |||
| b405515797 | |||
| db0d033776 | |||
| 74a4505b6e | |||
| eca1c454d7 | |||
| ff0b0de96d | |||
| 9450cb6561 | |||
| 6dde8c3d39 | |||
| b3679ca436 | |||
| 7cc9a05edf | |||
| 8f6ca087e9 | |||
| 25d95b9763 | |||
| c9652d7dbd | |||
| a39b0a606c | |||
| 2c3de0f12e | |||
| 2d7607dc9d | |||
| 6f2e07e8b9 | |||
| 44e5f877b2 | |||
| 2d71e8ee23 | |||
| 627407365c | |||
| 0b4c582298 | |||
| 40387b0fc7 | |||
| d7e1bae056 | |||
| 533b7ea6d9 | |||
| 7ec60e4e7e | |||
| f5104a2b97 | |||
| 2f15e48cf6 | |||
| 939f26a96c | |||
| 8b6b50b008 | |||
| 4a6b6649b8 | |||
| 88cdb566b3 | |||
| 9aebbc40e3 | |||
| 264a173f69 | |||
| bf46cd2267 | |||
| b2b8471e63 | |||
| 0c4a0e80b7 | |||
| 3bfe3922c2 | |||
| d31a78675b | |||
| 34b1d1a41d | |||
| 2a0acc00df | |||
| 49b95c3068 | |||
| de4746a8a2 | |||
| 3968be8fce | |||
| fe27d33f4f | |||
| 8ea237e932 | |||
| 8367faba8b | |||
| b20ad90a53 | |||
| af65e103df | |||
| ef5b38b267 | |||
| 276a8df94c | |||
| ceed288505 | |||
| ae67d9cd40 | |||
| e6073312c2 | |||
| 0f23e14e27 | |||
| 3823500342 | |||
| 1bdcef1051 | |||
| 5d422d4284 | |||
| e8a5be2853 | |||
| eb5baa8a7e | |||
| c8473c36a4 | |||
| 65a6c7bb3f | |||
| 3bc5359621 | |||
| 5e91dd3f36 | |||
| 6e980cfa80 | |||
| c4a2d886e0 | |||
| facea1b341 | |||
| 5b645d97c4 | |||
| 706cf31ee1 | |||
| bbc8a2ade5 | |||
| a5d200d862 | |||
| b620a99505 | |||
| d6bbfb22fa | |||
| 5322277aa6 | |||
| 98516bb40a | |||
| 50368eea89 | |||
| 036162ea9a | |||
| 32da9038c5 | |||
| 66c2503062 | |||
| c428e8c4cb | |||
| f2d91421fd | |||
| a222541e98 | |||
| 8d5ad76244 | |||
| 63128953bd | |||
| 75547242c9 | |||
| 38f1133371 | |||
| 0c0128531c | |||
| 0b5d3ddfb9 | |||
| 02fa231515 | |||
| 4fcc1c214a | |||
| 76d91f8a41 | |||
| d60e82a4c3 | |||
| 3ba496f1ff | |||
| a0a23e48fe | |||
| 5574388a9c | |||
| e29ad7ebbe | |||
| 37d543b545 | |||
| a6d0cd987a | |||
| 01abc5e6bf | |||
| 15d6420f3d | |||
| 5e4f44b6ad | |||
| 4708a37266 | |||
| 7e0830caea | |||
| 71be7f90ac | |||
| 06e9893001 | |||
| c0542d081d | |||
| a234654021 | |||
| 6f2b3bcdd2 | |||
| a741f7eea8 | |||
| c1acb61934 | |||
| 6b36aa9396 | |||
| c4cfddf4d1 | |||
| 375c162355 | |||
| 1c1f86b7b1 | |||
| 63dd5fb281 | |||
| 21e98e21c9 | |||
| 2185622e76 | |||
| 33c1770940 | |||
| 0fd7da8138 | |||
| 7bc81aac9b | |||
| b2eda6e0a5 | |||
| 440dfec649 | |||
| 2573aaa996 | |||
| 46fd234634 | |||
| cc41c129c8 | |||
| 08ff4ca6fb | |||
| 505eec9cad | |||
| ae07873330 | |||
| 840d3ba8e3 | |||
| db87439af3 | |||
| 229ed3b57c | |||
| 7c9c2a8da6 | |||
| cc652b4d76 | |||
| b63519ebda | |||
| 565e970ee2 | |||
| 0a8d8da96a | |||
| f6b9326173 | |||
| 5ee2080112 | |||
| 513c636d94 | |||
| 38f7f44e73 | |||
| f52cdc8c43 | |||
| b6862360af | |||
| 0dafa92b4d | |||
| 1b26d5e74e | |||
| 2ac64806ff | |||
| 5fde0ca615 | |||
| e2cd50652b | |||
| a4c3ccc36a | |||
| 9c72928dc3 | |||
| fb88144ba4 | |||
| 18eebff22d | |||
| a0456978ef | |||
| f287e69c33 | |||
| 4f3e59c3a2 | |||
| b694b2bd1f | |||
| 025583cd23 | |||
| 892a80dc63 | |||
| 452c1cb363 | |||
| 66d7ae88a1 | |||
| a0d1e2bba7 | |||
| 584dcac979 | |||
| 9d12152641 | |||
| 1f8ab70281 | |||
| b191803470 | |||
| f47f90af64 | |||
| b7926afa48 | |||
| a56d226564 | |||
| 04a3c84ac7 | |||
| 8861507850 | |||
| 0756aaecac | |||
| 5e3d1f59de | |||
| dcae5a5804 | |||
| 0108633793 | |||
| f8dbffb1c0 | |||
| bae53097c9 | |||
| 73daab351c | |||
| 08ded30845 | |||
| c4a354196b | |||
| 2f23555ddd | |||
| 5020a17a85 | |||
| 7601c1f082 | |||
| 1ac87c7397 | |||
| 45376a51a9 | |||
| 02f007f45d | |||
| 6f526f7451 | |||
| 37e00f7039 | |||
| f7c225fbd4 | |||
| c0fa5540c3 | |||
| e539802dc5 | |||
| ab809cc2c0 | |||
| 6a7585f259 | |||
| 8fdd4fa419 | |||
| b6ebdaffb3 | |||
| 178761415f | |||
| a50f447b04 | |||
| 8d8deea21a | |||
| b15aadd7b5 | |||
| 939a906ec8 | |||
| c311f59944 | |||
| 959e11bf24 | |||
| 1040ea8501 | |||
| 6ee9d39b49 | |||
| 6abd1eedbf | |||
| a3ee23b115 | |||
| 4340a83ae8 | |||
| ec93fb5015 | |||
| 9d4ec48859 | |||
| f6d57b0e6a | |||
| bb8acf8844 | |||
| fdeba4eda2 | |||
| 003891b463 | |||
| cc79c31911 | |||
| 46fa359f8c | |||
| 894d86760b | |||
| 3b26f9fb20 | |||
| 794122a7b0 | |||
| c1b2d9f922 | |||
| e66c8a57f0 | |||
| c56db831c3 | |||
| 26e40578f8 | |||
| 1d7abb687c | |||
| 11beba1dcb | |||
| 7890cbe40c | |||
| 91a1cb371b | |||
| 06d0d0eb6f | |||
| 1d8cfdce7c | |||
| 835cc2f85e | |||
| f6d5ac7efc | |||
| 34fb06515c | |||
| 4403d2b89c | |||
| f26d986a17 | |||
| 1c338cdbc8 | |||
| 3c62da905c | |||
| 8dcd870756 | |||
| 88f614bf1c | |||
| 19f6a59e86 | |||
| d272a7ffd3 | |||
| 79705cb7e4 | |||
| 5b1db5f305 | |||
| 4a6817fd4a | |||
| 0075885151 | |||
| 7965be79e3 | |||
| 82196932b0 | |||
| fbfc267591 | |||
| 6476f5fca6 | |||
| 4bd91f99b8 | |||
| 4110d37f45 | |||
| 129b43ee0e | |||
| 428aaa2911 | |||
| c6927f670c | |||
| 6ff45b597e | |||
| b6c120104f | |||
| c21c48cbe6 | |||
| 955f94887e | |||
| 81d581d04b | |||
| bd17f26b48 | |||
| 046a797c1a | |||
| ab28847cc8 | |||
| 38ef098d11 | |||
| 38e7bbab8d | |||
| c0495ed519 | |||
| 7c78bf998f | |||
| 1531ab7421 | |||
| ff7f7b1028 | |||
| 7fc0f9e5e4 | |||
| 8b68eb7ebc | |||
| 43acb21fff | |||
| b5333476db | |||
| 98ba1e32cf | |||
| 0e9d1cdb1d | |||
| da440af88f | |||
| 6e1cedb5e4 | |||
| df5405996c | |||
| c2229403ae | |||
| 53bc5a9433 | |||
| 87ee1f918b | |||
| c4c2f1886d | |||
| 2abc70b558 | |||
| c7563a9c70 | |||
| cd6f0c1e28 | |||
| 81bdc9e928 | |||
| 2df00c5bad | |||
| 3c1b31d913 | |||
| 1ba2befbf1 | |||
| de1fe38401 | |||
| 17200e8f4d | |||
| 563f606731 | |||
| d69e279438 | |||
| de119da9e4 | |||
| 40b6b8d8b5 | |||
| fd9f0ec83a | |||
| 3bbde52099 | |||
| c427414996 | |||
| ba33f1dd2f | |||
| a328425d17 | |||
| 5c2766327f | |||
| 748b1932aa | |||
| 2b23eea312 | |||
| 1dc78ff52a | |||
| 61d5f1854d | |||
| 9466f50707 | |||
| 99a5970cb1 | |||
| fbaf0edb03 | |||
| 8c527924a0 | |||
| 3d24fbafb5 | |||
| c66dcab21f | |||
| 40bed9e13d | |||
| 4b00b4b34a | |||
| 126f0da58d | |||
| 1e8ac0541b | |||
| 6a1e688f83 | |||
| 06a179a75c | |||
| 983962a590 | |||
| 47037513fe | |||
| 8c8e74ae10 | |||
| 315915628d | |||
| 14b6fcdb5f | |||
| 1e16942739 | |||
| 8a55c98423 | |||
| 091333e091 | |||
| fb7a194e6b | |||
| ea14e78373 | |||
| fe98ea90f9 | |||
| ecb1b5ec7c | |||
| 7523f8a84f | |||
| 26f80c924e | |||
| c4df6e1799 | |||
| 6aa0291420 | |||
| d0e15bf61f | |||
| d8e6933f72 | |||
| 6226d47d4e | |||
| ab653b5517 | |||
| f6149b0910 | |||
| cb2f5705ec | |||
| 4f4ca7b5e1 | |||
| ec48239def | |||
| 4c0fd2d731 | |||
| c50365cd38 | |||
| 56dc5ba143 | |||
| 996f4afc1f | |||
| 34f875d829 | |||
| a0c66c2450 | |||
| ecb865400f | |||
| 60896c7667 | |||
| ff01945522 | |||
| 55d035b098 | |||
| 004c02e05c | |||
| 49210b9085 | |||
| 40c9e047e0 | |||
| 8c844d2d40 | |||
| 5eaa2d3468 | |||
| f303b365be | |||
| 17ffa1ed24 | |||
| 925711c0b3 | |||
| 4e0f8146ba | |||
| a3480d4377 | |||
| 0604ce1a32 | |||
| e49106faac | |||
| 9bbbc6700e | |||
| 7a896ffbc6 | |||
| ac234da04d | |||
| 961d2828e8 | |||
| e764aa71ef | |||
| 5d6c043a39 | |||
| 497588fe37 | |||
| 8f85017285 | |||
| 85a6e76c51 | |||
| 01f7344a40 | |||
| 3f125001bc | |||
| d94ee341e5 | |||
| dffc499b47 | |||
| 8090ace7a2 | |||
| 0d1bd24dad | |||
| 73d0da8084 | |||
| 65f19876d8 | |||
| 0de786f7da | |||
| 68e16a6f47 | |||
| b3f247e4d1 | |||
| bfdc52bd32 | |||
| 0a8ba9dd7d | |||
| e97a364475 | |||
| 7ee3031e69 | |||
| 7f0c3a44e4 | |||
| 7e224207d0 | |||
| 4ea47efb05 | |||
| 088e092db8 | |||
| d4a6788523 | |||
| 4c46c425db | |||
| a800c94891 | |||
| ba1ce4c0eb | |||
| fc881d4afc | |||
| edfc003cd0 | |||
| 1d9ddaaf2e | |||
| a49f407cc6 | |||
| 9788367bb9 | |||
| 57ef348040 | |||
| c260b07707 | |||
| cb4f77069d | |||
| 97ac9019a9 | |||
| 8094a84cad | |||
| 91c59b920c | |||
| dabf73b44a | |||
| 0f4ae874d9 | |||
| f1603208db | |||
| 937ae59c8e | |||
| 29b25b0498 | |||
| d88d693a57 | |||
| 4d744a220a | |||
| ecd25101f5 | |||
| 6951a89497 | |||
| 2f4424c352 | |||
| 1c49bffc3c | |||
| 44d7cbb3b3 | |||
| 6415638ded | |||
| a52ec9020a | |||
| d2e3fa130b | |||
| 953c64fe93 | |||
| cf2db3ab76 | |||
| 94e935e7d1 | |||
| 00af6d7e91 | |||
| 93de2fbcb6 | |||
| 9652408974 | |||
| 7829b7d98b | |||
| 8cae411fa1 | |||
| 2eea2ccedc | |||
| 55dd77620e | |||
| a92e598d2f | |||
| 60150ae1be | |||
| ffac5de76e | |||
| ce7c86e689 | |||
| 523f5da5ed | |||
| 16a1917250 | |||
| a3498659ed | |||
| a8edccefc9 | |||
| dcfa857df2 | |||
| 665ec9436d | |||
| 8a59942e4c | |||
| d89a514226 | |||
| e2d94a5f26 | |||
| 8dddba42ce | |||
| 62e0fb7989 | |||
| 06e3c5c030 | |||
| 1789e61668 | |||
| 978165545e | |||
| 9d212d8602 | |||
| b67117d848 | |||
| f91847d0c3 | |||
| c197e6070b | |||
| 841d317f4a | |||
| 290891415d | |||
| 20853eabc7 | |||
| 4d4c38f3fe | |||
| e0234384f4 | |||
| 5bc6e68fbe | |||
| 5f546a46f0 | |||
| 1b6a4b1db2 | |||
| dfe052fcfd | |||
| 7b892c8787 | |||
| 8f7bd776a9 | |||
| c76e673ab5 | |||
| 016f1bebbf | |||
| d6f73f538f | |||
| 7f98994816 | |||
| af58d5f7b5 | |||
| 677038ee7d | |||
| 54849831c2 | |||
| d1014ff79f | |||
| e425fb1621 | |||
| 710c3be112 | |||
| 48972ecf12 | |||
| f257277e11 | |||
| ba38613904 | |||
| 2a0a6f17fb | |||
| 8321a04ed9 | |||
| 199d242993 | |||
| 0abc815473 | |||
| 7480ff5f28 | |||
| c35d77229d | |||
| ab16b4ffd5 | |||
| 5e70f06961 | |||
| e8ff59d6cb | |||
| e94c179a04 | |||
| 4257e7f69e | |||
| 7df67a0dbe | |||
| 767a31c3bc | |||
| 7069af60aa | |||
| f33db1ce37 | |||
| 3dfa6ce23a | |||
| cca6f7f1bb | |||
| 2ee6608ae4 | |||
| a4c1b131c4 | |||
| 61706b0caf | |||
| d88824c4be | |||
| ad2c7282e9 | |||
| 891ae55ee4 | |||
| 9c379682aa | |||
| c7b811b14c | |||
| 2d7efab286 | |||
| fa3d376d5f | |||
| 86b68a821c | |||
| 938c2c35b2 | |||
| 5b61f5c8a0 | |||
| 9f4f8828b1 | |||
| f4a809db92 | |||
| dc04ce9547 | |||
| 855eef5d27 | |||
| b5aabd4f5f | |||
| 65ecd1c557 | |||
| e845dee27d | |||
| 482b6e6e38 | |||
| 24b8e78e2a | |||
| 23f6216b92 | |||
| c1e97fe591 | |||
| 13152b970b | |||
| 477e78b6fd | |||
| 101f330fdb | |||
| 21863a3bb4 | |||
| 7568aa033a | |||
| dc36351d8b | |||
| 09c3588446 | |||
| d8deb5db94 | |||
| 4075975c4b | |||
| fb63db2c36 | |||
| 98933e78b4 | |||
| 4442ed1169 | |||
| e08a9cd97e | |||
| 32a2b23f43 | |||
| 7c54bd509a | |||
| 30396b3e65 | |||
| e4c54c3d58 | |||
| 39dda0fc4f | |||
| 6de85459d2 | |||
| c1f5319532 | |||
| 3528bae253 | |||
| b81789c55b | |||
| 3e6525ba88 | |||
| 7ec2fc00a0 | |||
| ff6c782016 | |||
| 46fc277d38 | |||
| b93cee20be | |||
| ed0201dd7f | |||
| b16f0342a3 | |||
| 6f27717759 | |||
| 23d7c2c5a8 | |||
| 8a0e509384 | |||
| d8ff63f276 | |||
| 1a1370bb0d | |||
| 841da5f0d5 | |||
| 40c1b0f8d8 | |||
| ad70034400 | |||
| a9c4a830f7 | |||
| ce594a239c | |||
| 7dd8844764 | |||
| 108ef20260 | |||
| 7386d3d886 | |||
| 857e0dfdd5 | |||
| 72c751da80 | |||
| 06bf9b71e5 | |||
| c53be4c013 | |||
| 68b32c8cf4 | |||
| 42960e439a | |||
| 142a6a46ca | |||
| 428ab4b9bf | |||
| e3713e1a31 | |||
| 0e232d1841 | |||
| f654deea11 | |||
| abf1c6d842 | |||
| f36034bcaf | |||
| bd6ba5263c | |||
| 8231fef937 | |||
| 8dfe0fa64f | |||
| 0d4d32d183 | |||
| 63d43fa1b9 | |||
| 75f7bfe6a5 | |||
| e67b9e31e5 | |||
| 445b23013e | |||
| 27ca988aa7 | |||
| 5ff082b127 | |||
| 9b1a0374e0 | |||
| 1e18f1923c | |||
| 39b7e05e81 | |||
| ff2d03f994 | |||
| 266a416e16 | |||
| b55ff547c3 | |||
| 5ebcf7b2cb | |||
| 1ee767efc1 | |||
| efef04ff4b | |||
| 5204d8316a | |||
| 726705327f | |||
| 089ce20f37 | |||
| 408e62f865 | |||
| 6d04a477a2 | |||
| 1b4a87a780 | |||
| b896875293 | |||
| 3ca5e8bee8 | |||
| 50bdc74de2 | |||
| 35cd5f90ee | |||
| 010af7e878 | |||
| bf226d8d16 | |||
| 9630774343 | |||
| aefbd27636 | |||
| 4bb17e4bab | |||
| 8f6495804d | |||
| 6efec14518 | |||
| 701bf0bb30 | |||
| f06d1c6c66 | |||
| 8664309614 | |||
| 74f5d1e381 | |||
| be7a0ebb09 | |||
| 6bf0078f07 | |||
| c0cf7543b6 | |||
| ec2137ba49 | |||
| 95a1b0cc4e | |||
| 76e0168130 | |||
| 7e8d372a4e | |||
| 748c9b23e0 | |||
| 342b80c1bb | |||
| 942d746a1e | |||
| 9a0480fc6e | |||
| da5d1efec9 | |||
| a8d28cb932 | |||
| 1d23070249 | |||
| aa47f2710d | |||
| a52fe881d0 | |||
| c163e202c2 | |||
| 3c99a66aa9 | |||
| 08811301b8 | |||
| 6dfa542d1d | |||
| 6c18fe9715 | |||
| 852d8858c1 | |||
| 97321042a2 | |||
| 161574c331 | |||
| cd15e0cb15 | |||
| 52d409f93b | |||
| 4119844902 | |||
| af4efb1484 | |||
| 094640f170 | |||
| 8aed17838e | |||
| af4ea1a280 | |||
| 86183b0716 | |||
| 1e6e23fe93 | |||
| 69901d1994 | |||
| d8f27b7b60 | |||
| d497a2a2fb | |||
| e23defdb12 | |||
| 8c02baf617 | |||
| 9501b8f5ad | |||
| 9bc0466171 | |||
| 4a4f96bd79 | |||
| 6ecc3ea8d3 | |||
| c3235459d0 | |||
| 8e7f0d621c | |||
| 950cf40381 | |||
| 4909e17632 | |||
| e72727728c | |||
| f26f1e9491 | |||
| 2e94893668 | |||
| ebcfcf57a6 | |||
| 7f9b5bb7f6 | |||
| e0a0a1146b | |||
| 709a2e61bb | |||
| e73c9b2739 | |||
| 7b69801533 | |||
| 74ad68736c | |||
| 53a07d2a7d | |||
| 6f752861d8 | |||
| ef7d006950 | |||
| 2e217fcfc1 | |||
| 12fbf6995e | |||
| d8152d04c0 | |||
| eed655faf2 | |||
| 2b128e1979 | |||
| c1d075a0ba | |||
| 26550bcf4a | |||
| cdaaf794b1 | |||
| f6a4021073 | |||
| dcac5b4fbb | |||
| 399018a07e | |||
| ed3979a3dc | |||
| ee8b1abe65 | |||
| ec47220e87 | |||
| e7a4d829a8 | |||
| bd20496911 | |||
| b764feaa29 | |||
| 9c131dd61f | |||
| 26859ced08 | |||
| 7c897e49b6 | |||
| 927910f190 | |||
| 7631d9c355 | |||
| 329cbe682b | |||
| 768f85c43d | |||
| 5e0f9e613a | |||
| 866d33df9b | |||
| d9170c87c1 | |||
| cc25b5ef9f | |||
| 703f296be2 | |||
| 4f5c5e11a5 | |||
| 99d83573a1 | |||
| eca7d6df6e | |||
| de53b9ac25 | |||
| d8cb66a846 | |||
| f4e08011ad | |||
| 988e91df6b | |||
| 66aff5e665 | |||
| 1f32209ef1 | |||
| 466ea2349a | |||
| 0585509135 | |||
| 3122e8f391 | |||
| 60c3f4ed84 | |||
| 9313053d8c | |||
| ad58adac10 | |||
| e75547eb14 | |||
| 655841d3a1 | |||
| 08bfb7fe27 | |||
| 0d1a280055 | |||
| ddd0f4ef09 | |||
| 383b5c993c | |||
| d85ce97e99 | |||
| d061d88381 | |||
| 9ab344eebc | |||
| ea5ae1a70f | |||
| 1a2a727fd6 | |||
| 71c960d5ac | |||
| e02eea80e9 | |||
| 65a3ef30c9 | |||
| 834f1c7f6f | |||
| 6f4bfe956d | |||
| 93dcde0e53 | |||
| dfed3275e4 | |||
| 9759cb2cfb | |||
| 55522afd04 | |||
| e83068c4eb | |||
| aa3eb05096 | |||
| 5833a6c8eb | |||
| ffe242df4d | |||
| fdf4b0c1bb | |||
| 8b1fb0c66a | |||
| ec0ce75f90 | |||
| 29bd1e46c5 | |||
| 7b6d108076 | |||
| 58fb571d4d | |||
| 5c32d7258d | |||
| eab709a095 | |||
| 5edceb5b79 | |||
| 076a08c58d | |||
| 87d37868d1 | |||
| e3153bb9bf | |||
| 24d80a24d1 | |||
| ff74d85283 | |||
| 39cb14779b | |||
| 17ae02e5d6 | |||
| c5c71888bc | |||
| 861a1b96bc | |||
| 941d835248 | |||
| eb57630381 | |||
| bff1d71664 | |||
| 275b48ac2b | |||
| caf4bef130 | |||
| 96f63ba5cb | |||
| 3ba9cd9c16 | |||
| 7d53de2687 | |||
| e2d5302736 | |||
| 401a81dddf | |||
| 24604ce7fe | |||
| 519ed08a44 | |||
| 46f1f7822d | |||
| 89d7efdb13 | |||
| 914cb260dc | |||
| a1f8ff87c7 | |||
| e2b7251de9 | |||
| e1d1049893 | |||
| 57129544d1 | |||
| 7db8791cb5 | |||
| 2b696934bc | |||
| dcfb88a70a | |||
| 5afc5272f5 | |||
| 0a660b03e0 | |||
| 543e1c58b5 | |||
| ecac660cd6 | |||
| ba7166c377 | |||
| 9f798bff9f | |||
| 2e26533562 | |||
| b138512178 | |||
| bd96236e86 | |||
| 25b19994cc | |||
| 86db7a137d | |||
| 0eb61c5e87 | |||
| 615453c9c5 | |||
| 71009e400d | |||
| 50164ebaf9 | |||
| 3f46ed14b5 | |||
| 626aab5d67 | |||
| 540fa20b31 | |||
| aa1ce48512 | |||
| 5b42a6a893 | |||
| fb443f1acf | |||
| e4576482d5 | |||
| 66a51452d9 | |||
| 8bb0899949 | |||
| c18aebd06d | |||
| dde9e6ab4c | |||
| 9c2d9968d7 | |||
| 3bd4de22f5 | |||
| 2832badf38 | |||
| a9a070e0fd | |||
| 30bacddc59 | |||
| 0d5c3f158d | |||
| 254989f151 | |||
| ceb8ca87af | |||
| 95371d813b | |||
| adafc950c1 | |||
| 028776ce07 | |||
| 35b8e7c28d | |||
| 489b291962 | |||
| cddc26f6fb | |||
| 233c877c05 | |||
| 06d94a5228 | |||
| 0a855df8f0 | |||
| 0249828cf9 | |||
| 8be3ac4473 | |||
| 5dc088851c | |||
| 1becf68da2 | |||
| bb5eb662d0 | |||
| d1a551a11a | |||
| 5735794924 | |||
| 2cc4c0b4bf | |||
| 3f6cc68f6a | |||
| 11db6f92a2 | |||
| 45d525422e | |||
| dd301fb595 | |||
| 868cb96a47 | |||
| 1edaf3f6f5 | |||
| df19d0d912 | |||
| 6a22879b41 | |||
| 8202a36a21 | |||
| 3b51e7816f | |||
| 299665b644 | |||
| 160e811553 | |||
| 7a1ade1b78 | |||
| 4969ad7400 | |||
| 7c930c46b0 | |||
| 4f96d7f45e | |||
| 2fbd1b81d8 | |||
| 7c0a8a1ab6 | |||
| 3af1df1670 | |||
| eb53588cdb | |||
| 8bc37becbc | |||
| 7cab0ba37c | |||
| fa5a5b5295 | |||
| cd564e5dfc | |||
| 6ecf2e4c87 | |||
| c3e01ed20a | |||
| 46ea6d74da | |||
| b79e51b46c | |||
| e179048ec1 | |||
| 83985ddaa6 | |||
| 61323671b7 | |||
| 4e0e093696 | |||
| dc158ece12 | |||
| ce45515e7d | |||
| fdfc6269ef | |||
| ffc69cd31d | |||
| 872d7f598c | |||
| 48769c6e2d | |||
| 0784202319 | |||
| 20e62af383 | |||
| 8820896338 | |||
| 2e2e71a8da | |||
| ab2df10cc8 | |||
| da23d41a1f | |||
| b36e7694a8 | |||
| 0611af101d | |||
| 623d403c66 | |||
| 31f5cb39d2 | |||
| 0cdc9c53ea | |||
| 875ea7db1b | |||
| 809e6508db | |||
| 5704a98da7 | |||
| 30222590f7 | |||
| 567df7420a | |||
| bf1241ad96 | |||
| 892da6a051 | |||
| aac94fd0cc | |||
| 2b9f062552 | |||
| 27a026c7e8 | |||
| a90fb36bd2 | |||
| 2c5c3e62a7 | |||
| c9f6251ea8 | |||
| c7ce6d80a3 | |||
| ad410dd19b | |||
| f9efae0e40 | |||
| 18a97fd84d | |||
| 4382b8f2e3 | |||
| 07bc24351d | |||
| cabcedda58 | |||
| bb9cf93d21 | |||
| 96c1e116e6 | |||
| 1930ab3694 | |||
| 9ac796a68f | |||
| 2237c10c84 | |||
| 914b06de0a | |||
| d81a77dddf |
+2
-2
@@ -97,7 +97,7 @@
|
||||
|
||||
foreach ($admins as $admin) {
|
||||
$adminarray[] = $admin->id;
|
||||
echo "<p align=right>$admin->firstname $admin->lastname,
|
||||
echo "<p align=right>".fullname($admin, true).",
|
||||
$admin->email ";
|
||||
if ($primaryadmin->id == $admin->id){
|
||||
print_spacer(10, 9, false);
|
||||
@@ -138,7 +138,7 @@
|
||||
foreach ($users as $user) {
|
||||
echo "<p align=left><a href=\"{$_SERVER['PHP_SELF']}?add=$user->id\"".
|
||||
"title=\"$straddadmin\"><img src=\"../pix/t/left.gif\"".
|
||||
"border=0></a> $user->firstname $user->lastname, $user->email";
|
||||
"border=0></a> ".fullname($user).", $user->email";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@
|
||||
echo "<form TARGET=\"{$CFG->framename}\" NAME=\"authmenu\" method=\"post\" action=\"auth.php\">";
|
||||
print_string("chooseauthmethod","auth");
|
||||
|
||||
choose_from_menu ($options, "auth", $auth, "","top.location='auth.php?auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
|
||||
choose_from_menu ($options, "auth", $auth, "","document.location='auth.php?auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
|
||||
|
||||
echo "</B></P></CENTER>";
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?PHP // $Id$
|
||||
// backup.php - allows admin to edit all configuration variables for scheduled backups
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("../backup/lib.php");
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only an admin can use this page");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
//Initialise error variables
|
||||
$error = false;
|
||||
$sche_destination_error = "";
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
//First of all we check that everything is correct
|
||||
//Check for trailing slash and backslash in backup_sche_destination
|
||||
if (!empty($backup_sche_destination) and
|
||||
(substr($backup_sche_destination,-1) == "/" or substr($backup_sche_destination,-1) == "\\")) {
|
||||
$error = true;
|
||||
$sche_destination_error = get_string("pathslasherror");
|
||||
//Now check that backup_sche_destination dir exists
|
||||
} else if (!empty($backup_sche_destination) and
|
||||
!is_dir($backup_sche_destination)) {
|
||||
$error = true;
|
||||
$sche_destination_error = get_string("pathnotexists");
|
||||
}
|
||||
|
||||
//We need to do some weekdays conversions prior to continue
|
||||
$i = 0;
|
||||
$temp = "";
|
||||
$a_config = (array)$config;
|
||||
while ($i<7) {
|
||||
$tocheck = "dayofweek_".$i;
|
||||
if (isset($a_config[$tocheck])) {
|
||||
$temp .= "1";
|
||||
} else {
|
||||
$temp .= "0";
|
||||
}
|
||||
unset($a_config[$tocheck]);
|
||||
$i++;
|
||||
}
|
||||
$a_config['backup_sche_weekdays'] = $temp;
|
||||
$config = (object)$a_config;
|
||||
//weekdays conversions done. Continue
|
||||
|
||||
print_header();
|
||||
foreach ($config as $name => $value) {
|
||||
backup_set_config($name, $value);
|
||||
}
|
||||
if (!$error) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/index.php", get_string("changessaved"), 1);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/// Otherwise print the form.
|
||||
|
||||
$stradmin = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strbackup = get_string("backup");
|
||||
|
||||
print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
$strbackup);
|
||||
|
||||
echo "<p align=right><a href=\"../backup/log.php\">".get_string("logs")."</a></p>";
|
||||
|
||||
print_heading($strbackup);
|
||||
|
||||
print_simple_box("<center>".get_string("adminhelpbackup")."</center>", "center", "50%");
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center", "", "$THEME->cellheading");
|
||||
include("$CFG->dirroot/backup/config.html");
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
+135
-16
@@ -10,21 +10,6 @@
|
||||
<?php print_string("configlang") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>langdir:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options["LTR"] = get_string("langltr");
|
||||
$options["RTL"] = get_string("langrtl");
|
||||
|
||||
choose_from_menu ($options, "langdir", $config->langdir, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configlangdir") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>langmenu:</td>
|
||||
<td>
|
||||
@@ -58,9 +43,36 @@
|
||||
<?php print_string("configlocale") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>timezone:</td>
|
||||
<td><?php
|
||||
if (abs($config->timezone) > 13) {
|
||||
$config->timezone = 99;
|
||||
}
|
||||
$timenow = time();
|
||||
|
||||
for ($tz = -26; $tz <= 26; $tz++) {
|
||||
$zone = (float)$tz/2.0;
|
||||
$usertime = $timenow + ($tz * 1800);
|
||||
if ($tz == 0) {
|
||||
$timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT)";
|
||||
} else if ($tz < 0) {
|
||||
$timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT$zone)";
|
||||
} else {
|
||||
$timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT+$zone)";
|
||||
}
|
||||
}
|
||||
|
||||
choose_from_menu ($timezones, "timezone", $config->timezone, get_string("serverlocaltime"), "", "99");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configtimezone") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>country:</td>
|
||||
<td><?php choose_from_menu ($COUNTRIES, "country", $config->country, get_string("selectacountry"), "") ?>
|
||||
<td><?php choose_from_menu (get_list_of_countries(), "country", $config->country, get_string("selectacountry"), "") ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configcountry") ?>
|
||||
@@ -165,6 +177,30 @@
|
||||
<?php print_string("configlongtimenosee") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>deleteunconfirmed:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string("never");
|
||||
$options[168] = get_string("numdays", "", 7);
|
||||
$options[144] = get_string("numdays", "", 6);
|
||||
$options[120] = get_string("numdays", "", 5);
|
||||
$options[96] = get_string("numdays", "", 4);
|
||||
$options[72] = get_string("numdays", "", 3);
|
||||
$options[48] = get_string("numdays", "", 2);
|
||||
$options[24] = get_string("numdays", "", 1);
|
||||
$options[12] = get_string("numhours", "", 12);
|
||||
$options[6] = get_string("numhours", "", 6);
|
||||
$options[1] = get_string("numhours", "", 1);
|
||||
|
||||
choose_from_menu ($options, "deleteunconfirmed", $config->deleteunconfirmed, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configdeleteunconfirmed") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>loglifetime:</td>
|
||||
<td>
|
||||
@@ -209,6 +245,15 @@
|
||||
<?php print_string("configsessiontimeout") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>sessioncookie:</td>
|
||||
<td>
|
||||
<input name=sessioncookie type=text size=10 value="<?php p($config->sessioncookie)?>">
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configsessioncookie") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>zip:</td>
|
||||
<td>
|
||||
@@ -315,6 +360,80 @@
|
||||
<?php print_string("configteacherassignteachers") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>allowunenroll:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string("no");
|
||||
$options[1] = get_string("yes");
|
||||
|
||||
choose_from_menu ($options, "allowunenroll", $config->allowunenroll, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configallowunenroll") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>maxbytes:</td>
|
||||
<td>
|
||||
<?php
|
||||
$options = get_max_upload_sizes();
|
||||
choose_from_menu ($options, "maxbytes", $config->maxbytes, "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configmaxbytes") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>fullnamedisplay:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options['language'] = get_string('language');
|
||||
$options['firstname lastname'] = get_string('firstname') . ' + ' . get_string('lastname');
|
||||
$options['lastname firstname'] = get_string('lastname') . ' + ' . get_string('firstname');
|
||||
$options['firstname'] = get_string('firstname');
|
||||
|
||||
choose_from_menu ($options, "fullnamedisplay", $config->fullnamedisplay, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configfullnamedisplay") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>forcelogin:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string('no');
|
||||
$options[1] = get_string('yes');
|
||||
|
||||
choose_from_menu ($options, "forcelogin", $config->forcelogin, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configforcelogin") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>opentogoogle:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string("no");
|
||||
$options[1] = get_string("yes");
|
||||
|
||||
choose_from_menu ($options, "opentogoogle", $config->opentogoogle, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configopentogoogle") ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan=3 align=center>
|
||||
|
||||
+3
-1
@@ -2,7 +2,6 @@
|
||||
// config.php - allows admin to edit all configuration variables
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("../lib/countries.php");
|
||||
|
||||
|
||||
if ($site = get_site()) { // If false then this is a new installation
|
||||
@@ -28,6 +27,9 @@
|
||||
if (count($err) == 0) {
|
||||
print_header();
|
||||
foreach ($config as $name => $value) {
|
||||
if ($name == "sessioncookie") {
|
||||
$value = clean_filename($value);
|
||||
}
|
||||
unset($conf);
|
||||
$conf->name = $name;
|
||||
$conf->value = $value;
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
get_string("adminhelplanguage"));
|
||||
$table->data[] = array("<b><a href=\"modules.php\">".get_string("managemodules")."</a></b>",
|
||||
get_string("adminhelpmanagemodules"));
|
||||
$table->data[] = array("<b><a href=\"filters.php\">".get_string("managefilters")."</a></b>",
|
||||
get_string("adminhelpmanagefilters"));
|
||||
if (!isset($CFG->disablescheduledbackups)) {
|
||||
$table->data[] = array("<b><a href=\"backup.php\">".get_string("backup")."</a></b>",
|
||||
get_string("adminhelpbackup"));
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
|
||||
|
||||
+3
-3
@@ -94,8 +94,7 @@
|
||||
$creatorarray = array();
|
||||
foreach ($creators as $creator) {
|
||||
$creatorarray[] = $creator->id;
|
||||
echo "<p align=right>$creator->firstname $creator->lastname,
|
||||
$creator->email ";
|
||||
echo "<p align=right>".fullname($creator, true).", $creator->email ";
|
||||
echo "<a href=\"{$_SERVER['PHP_SELF']}?remove=$creator->id\"
|
||||
title=\"$strremovecreator\"><img src=\"../pix/t/right.gif\"
|
||||
border=0></a>";
|
||||
@@ -128,9 +127,10 @@
|
||||
}
|
||||
|
||||
foreach ($users as $user) {
|
||||
$fullname = fullname($user, TRUE);
|
||||
echo "<p align=left><a href=\"{$_SERVER['PHP_SELF']}?add=$user->id\"".
|
||||
"title=\"$straddcreator\"><img src=\"../pix/t/left.gif\"".
|
||||
"border=0></a> $user->firstname $user->lastname, $user->email";
|
||||
"border=0></a> $fullname, $user->email";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+50
-8
@@ -17,9 +17,18 @@
|
||||
|
||||
require_once("../config.php");
|
||||
|
||||
if (!$alreadyadmin = isadmin()) {
|
||||
unset($_SESSION['USER']);
|
||||
unset($USER);
|
||||
unset($_SESSION['SESSION']);
|
||||
unset($SESSION);
|
||||
$USER = get_admin(); /// Temporarily, to provide environment for this script
|
||||
}
|
||||
|
||||
echo "<pre>\n";
|
||||
|
||||
$timenow = time();
|
||||
echo "Server Time: ".date('r',$timenow)."\n\n";
|
||||
|
||||
/// Run all cron jobs for each module
|
||||
|
||||
@@ -54,23 +63,23 @@
|
||||
|
||||
if ($CFG->longtimenosee) { // value in days
|
||||
$longtime = $timenow - ($CFG->longtimenosee * 3600 * 24);
|
||||
if ($users = get_users_longtimenosee($longtime)) {
|
||||
foreach ($users as $user) {
|
||||
if (unenrol_student($user->id)) {
|
||||
echo "Deleted student enrolment for $user->firstname $user->lastname ($user->id)\n";
|
||||
if ($students = get_users_longtimenosee($longtime)) {
|
||||
foreach ($students as $student) {
|
||||
if (unenrol_student($student->userid, $student->course)) {
|
||||
echo "Deleted student enrolment for user $student->userid from course $student->course\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Delete users who haven't confirmed within seven days
|
||||
|
||||
$oneweek = $timenow - (7 * 24 * 3600);
|
||||
/// Delete users who haven't confirmed within required period
|
||||
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_unconfirmed($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records("user", "id", $user->id)) {
|
||||
echo "Deleted unconfirmed user for $user->firstname $user->lastname ($user->id)\n";
|
||||
echo "Deleted unconfirmed user for ".fullname($user, true)." ($user->id)\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +102,39 @@
|
||||
$loglifetime = $timenow - ($CFG->loglifetime * 3600 * 24);
|
||||
delete_records_select("log", "time < '$loglifetime'");
|
||||
}
|
||||
|
||||
/// Delete old cached texts
|
||||
|
||||
if (!empty($CFG->cachetext)) { // Defined in config.php
|
||||
$cachelifetime = time() - $CFG->cachetext;
|
||||
delete_records_select("cache_text", "timemodified < '$cachelifetime'");
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists("$CFG->dataroot/cronextra.php")) {
|
||||
include("$CFG->dataroot/cronextra.php");
|
||||
}
|
||||
|
||||
if (!isset($CFG->disablescheduledbackups)) { // Defined in config.php
|
||||
//Execute backup's cron
|
||||
//Perhaps a long time and memory could help in large sites
|
||||
set_time_limit(0);
|
||||
ini_set("memory_limit","56M");
|
||||
if (file_exists("$CFG->dirroot/backup/backup_scheduled.php") and
|
||||
file_exists("$CFG->dirroot/backup/backuplib.php") and
|
||||
file_exists("$CFG->dirroot/backup/lib.php")) {
|
||||
include_once("$CFG->dirroot/backup/backup_scheduled.php");
|
||||
include_once("$CFG->dirroot/backup/backuplib.php");
|
||||
include_once("$CFG->dirroot/backup/lib.php");
|
||||
echo "Running backups if required...\n";
|
||||
flush();
|
||||
|
||||
if (! schedule_backup_cron()) {
|
||||
echo "Something went wrong while performing backup tasks!!!\n";
|
||||
} else {
|
||||
echo "Backup tasks finished\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "Cron script completed correctly\n";
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?PHP // $Id$
|
||||
// dbperformance.php - shows latest ADOdb stats for the current server
|
||||
|
||||
require_once("../config.php");
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only the admin can use this page");
|
||||
}
|
||||
|
||||
$strdatabaseperformance = get_string("databaseperformance");
|
||||
$stradministration = get_string("administration");
|
||||
$site = get_site();
|
||||
|
||||
if (isset($topframe)) {
|
||||
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname",
|
||||
"<a target=\"$CFG->framename\" href=\"index.php\">$stradministration</a> -> Database performance");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($bottomframe) or isset($_GET['do'])) {
|
||||
$perf =&NewPerfMonitor($db);
|
||||
$perf->UI($pollsecs=5);
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<head>
|
||||
<title><?php echo "$site->shortname: $strdatabaseperformance" ?></title>
|
||||
</head>
|
||||
|
||||
<frameset rows="80,*">
|
||||
<frame src="dbperformance.php?topframe=true">
|
||||
<frame src="dbperformance.php?bottomframe=true">
|
||||
</frameset>
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php print_simple_box_start("center", "", "$THEME->cellheading"); ?>
|
||||
|
||||
<form name="filters" id="filters" method="post" action="filters.php">
|
||||
<table align="center" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><div align="right">
|
||||
<br />
|
||||
<input name="up" type="submit" id="up" value="↑" />
|
||||
<br />
|
||||
<input name="down" type="submit" id="down" value="↓" />
|
||||
<br />
|
||||
</div></td>
|
||||
<td valign="top">
|
||||
<?php p($stractive) ?>
|
||||
<br />
|
||||
|
||||
<select name="iselect" size="20" id="iselect"
|
||||
onclick="document.filters.add.disabled=true;
|
||||
document.filters.remove.disabled=false;
|
||||
document.filters.uselect.selectedIndex=-1;">
|
||||
<?php
|
||||
$runscript = "";
|
||||
foreach ($installedfilters as $filter) {
|
||||
if ($selectedfilter == $filter) {
|
||||
$selected = " selected ";
|
||||
$runscript = "eval(\"document.filters.add.disabled=true\");
|
||||
eval(\"document.filters.remove.disabled=false\");
|
||||
eval(\"document.filters.uselect.selectedIndex=-1\");";
|
||||
} else {
|
||||
$selected = "";
|
||||
}
|
||||
echo "<option value=\"$filter\" $selected>".$allfilters[$filter]."</option>";
|
||||
}
|
||||
?>
|
||||
</select></td>
|
||||
<td valign="top">
|
||||
<br />
|
||||
<input name="add" type="submit" id="add" value="←" />
|
||||
<br />
|
||||
<input name="remove" type="submit" id="remove" value="→" />
|
||||
<br />
|
||||
</td>
|
||||
<td valign="top">
|
||||
<?php p($strinactive) ?>
|
||||
<br />
|
||||
<select name="uselect" size="20" id="select"
|
||||
onclick="document.filters.add.disabled=false;
|
||||
document.filters.remove.disabled=true;
|
||||
document.filters.iselect.selectedIndex=-1;">
|
||||
<?php
|
||||
foreach ($uninstalledfilters as $filter) {
|
||||
if ($selectedfilter == $filter) {
|
||||
$selected = " selected ";
|
||||
$runscript = "eval(\"document.filters.add.disabled=false\");
|
||||
eval(\"document.filters.remove.disabled=true\");
|
||||
eval(\"document.filters.iselect.selectedIndex=-1\");";
|
||||
} else {
|
||||
$selected = "";
|
||||
}
|
||||
echo "<option value=\"$filter\" $selected>".$allfilters[$filter]."</option>";
|
||||
}
|
||||
?>
|
||||
</select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script language="Javascript">
|
||||
<!--
|
||||
<?php echo $runscript ?>
|
||||
|
||||
-->
|
||||
</script>
|
||||
<?php print_simple_box_end(); ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
|
||||
<?php print_simple_box_start("center", "", "$THEME->cellheading"); ?>
|
||||
|
||||
<form name="options" id="options" method="post" action="filters.php">
|
||||
<input type="hidden" name="options" value="1">
|
||||
<table cellpadding="20">
|
||||
<tr valign=top>
|
||||
<td nowrap="nowrap" align="right"><?php p($strcachetext) ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[10800] = get_string('numhours', '', 3);
|
||||
$options[7200] = get_string('numhours', '', 2);
|
||||
$options[3600] = get_string('numhours', '', 1);
|
||||
$options[2700] = get_string('numminutes', '', 45);
|
||||
$options[1800] = get_string('numminutes', '', 30);
|
||||
$options[900] = get_string('numminutes', '', 15);
|
||||
$options[600] = get_string('numminutes', '', 10);
|
||||
$options[540] = get_string('numminutes', '', 9);
|
||||
$options[480] = get_string('numminutes', '', 8);
|
||||
$options[420] = get_string('numminutes', '', 7);
|
||||
$options[360] = get_string('numminutes', '', 6);
|
||||
$options[300] = get_string('numminutes', '', 5);
|
||||
$options[240] = get_string('numminutes', '', 4);
|
||||
$options[180] = get_string('numminutes', '', 3);
|
||||
$options[120] = get_string('numminutes', '', 2);
|
||||
$options[60] = get_string('numminutes', '', 1);
|
||||
$options[30] = get_string('numseconds', '', 30);
|
||||
$options[0] = get_string('no');
|
||||
|
||||
choose_from_menu ($options, "cachetext", $CFG->cachetext, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php p($strconfigcachetext) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td nowrap="nowrap" align="right"><?php p($strfilteruploadedfiles) ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string('no');
|
||||
$options[1] = get_string('yes');
|
||||
|
||||
choose_from_menu ($options, "filteruploadedfiles", $CFG->filteruploadedfiles, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php p($strconfigfilteruploadedfiles) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td> </td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php print_simple_box_end(); ?>
|
||||
@@ -0,0 +1,169 @@
|
||||
<?PHP // $Id$
|
||||
// Allows the admin to create, delete and rename course categories
|
||||
|
||||
require_once("../config.php");
|
||||
|
||||
optional_variable($iselect);
|
||||
optional_variable($uselect);
|
||||
optional_variable($add);
|
||||
optional_variable($remove);
|
||||
optional_variable($up);
|
||||
optional_variable($down);
|
||||
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only administrators can use this page!");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
/// Print headings
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strmanagefilters = get_string("managefilters");
|
||||
$strversion = get_string("version");
|
||||
$strsettings = get_string("settings");
|
||||
$strup = get_string("up");
|
||||
$strdown = get_string("down");
|
||||
$stractive = get_string("active");
|
||||
$strinactive = get_string("inactive");
|
||||
$strcachetext = get_string("cachetext", "admin");
|
||||
$strconfigcachetext = get_string("configcachetext");
|
||||
$strfilteruploadedfiles = get_string("filteruploadedfiles", "admin");
|
||||
$strconfigfilteruploadedfiles = get_string("configfilteruploadedfiles");
|
||||
|
||||
print_header("$site->shortname: $strmanagefilters", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $strmanagefilters");
|
||||
|
||||
print_heading($strmanagefilters);
|
||||
|
||||
|
||||
/// Make a list of all available filters and the best names for them we can find
|
||||
$allfilters = array();
|
||||
|
||||
$filterlocations = array("mod", "filter");
|
||||
|
||||
foreach ($filterlocations as $filterlocation) {
|
||||
$plugins = get_list_of_plugins($filterlocation);
|
||||
foreach ($plugins as $key => $plugin) {
|
||||
if (is_readable("$CFG->dirroot/$filterlocation/$plugin/filter.php")) {
|
||||
$name = get_string("filtername", $plugin);
|
||||
if ($name == "[[filtername]]") {
|
||||
$name = $plugin;
|
||||
}
|
||||
$allfilters["$filterlocation/$plugin"] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Make an array of all the currently installed filters
|
||||
|
||||
$installedfilters = array();
|
||||
if (!empty($CFG->textfilters)) {
|
||||
$installedfilters = explode(',',$CFG->textfilters);
|
||||
|
||||
// Do a little cleanup for robustness
|
||||
foreach ($installedfilters as $key => $installedfilter) {
|
||||
if (empty($installedfilter)) {
|
||||
unset($installedfilters[$key]);
|
||||
set_config("textfilters", implode(',', $installedfilters));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$selectedfilter = "none";
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($options)) {
|
||||
if ($config = data_submitted()) {
|
||||
unset($config->options);
|
||||
foreach ($config as $name => $value) {
|
||||
set_config($name, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($add) and !empty($uselect)) {
|
||||
$selectedfilter = $uselect;
|
||||
if (!in_array($selectedfilter, $installedfilters)) {
|
||||
$installedfilters[] = $selectedfilter;
|
||||
set_config("textfilters", implode(',', $installedfilters));
|
||||
}
|
||||
|
||||
} else if (!empty($remove) and !empty($iselect)) {
|
||||
$selectedfilter = $iselect;
|
||||
foreach ($installedfilters as $key => $installedfilter) {
|
||||
if ($installedfilter == $selectedfilter) {
|
||||
unset($installedfilters[$key]);
|
||||
}
|
||||
}
|
||||
set_config("textfilters", implode(',', $installedfilters));
|
||||
|
||||
} else if ((!empty($up) or !empty($down)) and !empty($iselect)) {
|
||||
|
||||
if (!empty($up)) {
|
||||
if ($allfilters[$iselect]) {
|
||||
foreach ($installedfilters as $key => $installedfilter) {
|
||||
if ($installedfilter == $iselect) {
|
||||
$movefilter = $key;
|
||||
break;
|
||||
}
|
||||
$swapfilter = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($down)) {
|
||||
if ($allfilters[$iselect]) {
|
||||
$choosenext = false;
|
||||
foreach ($installedfilters as $key => $installedfilter) {
|
||||
if ($choosenext) {
|
||||
$swapfilter = $key;
|
||||
break;
|
||||
}
|
||||
if ($installedfilter == $iselect) {
|
||||
$movefilter = $key;
|
||||
$choosenext = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($swapfilter) and isset($movefilter)) {
|
||||
$tempfilter = $installedfilters[$swapfilter];
|
||||
$installedfilters[$swapfilter] = $installedfilters[$movefilter];
|
||||
$installedfilters[$movefilter] = $tempfilter;
|
||||
set_config("textfilters", implode(',', $installedfilters));
|
||||
}
|
||||
$selectedfilter = $iselect;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Make an array of all the currently uninstalled filters
|
||||
|
||||
$uninstalledfilters = array();
|
||||
foreach ($allfilters as $filter => $name) {
|
||||
$installed = false;
|
||||
foreach ($installedfilters as $installedfilter) {
|
||||
if ($installedfilter == $filter) {
|
||||
$installed = true;
|
||||
}
|
||||
}
|
||||
if (!$installed) {
|
||||
$uninstalledfilters[] = $filter;
|
||||
}
|
||||
}
|
||||
|
||||
/// Print the current form
|
||||
|
||||
include("filters.html");
|
||||
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
+40
-7
@@ -54,7 +54,7 @@
|
||||
|
||||
/// Check settings in config.php
|
||||
|
||||
$dirroot = dirname(realpath("../config.php"));
|
||||
$dirroot = dirname(realpath("../index.php"));
|
||||
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
|
||||
error("Please fix your settings in config.php:
|
||||
<P>You have:
|
||||
@@ -75,7 +75,9 @@
|
||||
$CFG->version = "";
|
||||
}
|
||||
|
||||
/// Turn off time limits, sometimes upgrades can be slow.
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
/// Check if the main tables have been installed yet or not.
|
||||
|
||||
@@ -115,7 +117,6 @@
|
||||
print_header($strdatabasesetup, $strdatabasesetup, $strdatabasesetup, "", "", false, " ", " ");
|
||||
if (file_exists("$CFG->libdir/db/$CFG->dbtype.sql")) {
|
||||
$db->debug = true;
|
||||
set_time_limit(0); // To allow slow databases to complete the long SQL
|
||||
if (modify_database("$CFG->libdir/db/$CFG->dbtype.sql")) {
|
||||
$db->debug = false;
|
||||
notify($strdatabasesuccess, "green");
|
||||
@@ -237,17 +238,32 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($module)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($module->requires)) {
|
||||
if ($module->requires > $CFG->version) {
|
||||
$info->modulename = $mod;
|
||||
$info->moduleversion = $module->version;
|
||||
$info->currentmoodle = $CFG->version;
|
||||
$info->requiremoodle = $module->requires;
|
||||
notify(get_string('modulerequirementsnotmet', 'error', $info));
|
||||
unset($info);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$module->name = $mod; // The name MUST match the directory
|
||||
|
||||
if ($currmodule = get_record("modules", "name", $module->name)) {
|
||||
if ($currmodule->version == $module->version) {
|
||||
// do nothing
|
||||
} else if ($currmodule->version < $module->version) {
|
||||
if (empty($updated_modules)) {
|
||||
$strmodulesetup = get_string("modulesetup");
|
||||
print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, "", "", false, " ", " ");
|
||||
}
|
||||
print_heading("$module->name module needs upgrading");
|
||||
$upgrade_function = $module->name."_upgrade";
|
||||
if (function_exists($upgrade_function)) {
|
||||
@@ -330,6 +346,8 @@
|
||||
}
|
||||
|
||||
/// Check for valid admin user
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
@@ -342,6 +360,12 @@
|
||||
print_simple_box_start("center", "100%", "$THEME->cellcontent2", 20);
|
||||
print_heading($stradministration);
|
||||
|
||||
if (!empty($CFG->upgrade)) { // Print notice about extra upgrading that needs to be done
|
||||
print_simple_box(get_string("upgrade$CFG->upgrade", "admin",
|
||||
"$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"), "center");
|
||||
print_spacer(10,10);
|
||||
}
|
||||
|
||||
$table->tablealign = "right";
|
||||
$table->align = array ("right", "left");
|
||||
$table->wrap = array ("nowrap", "nowrap");
|
||||
@@ -359,6 +383,12 @@
|
||||
get_string("adminhelplanguage")."</font><br />";
|
||||
$configdata .= "<font size=+1> </font><a href=\"modules.php\">".get_string("managemodules")."</a> - <font size=1>".
|
||||
get_string("adminhelpmanagemodules")."</font><br />";
|
||||
$configdata .= "<font size=+1> </font><a href=\"filters.php\">".get_string("managefilters")."</a> - <font size=1>".
|
||||
get_string("adminhelpmanagefilters")."</font><br />";
|
||||
if (!isset($CFG->disablescheduledbackups)) {
|
||||
$configdata .= "<font size=+1> </font><a href=\"backup.php\">".get_string("backup")."</a> - <font size=1>".
|
||||
get_string("adminhelpbackup")."</font><br />";
|
||||
}
|
||||
|
||||
$table->data[] = array("<font size=+1><b><a href=\"configure.php\">".get_string("configuration")."</a></b>",
|
||||
$configdata);
|
||||
@@ -367,10 +397,13 @@
|
||||
$userdata = "<font size=+1> </font><a href=\"auth.php\">".get_string("authentication")."</a> - <font size=1>".
|
||||
get_string("adminhelpauthentication")."</font><br />";
|
||||
|
||||
if ($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual") {
|
||||
if (is_internal_auth()) {
|
||||
$userdata .= "<font size=+1> </font><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true\">".
|
||||
get_string("addnewuser")."</a> - <font size=1>".
|
||||
get_string("adminhelpaddnewuser")."</font><br />";
|
||||
$userdata .= "<font size=+1> </font><a href=\"$CFG->wwwroot/$CFG->admin/uploaduser.php\">".
|
||||
get_string("uploadusers")."</a> - <font size=1>".
|
||||
get_string("adminhelpuploadusers")."</font><br />";
|
||||
}
|
||||
$userdata .= "<font size=+1> </font><a href=\"user.php\">".get_string("edituser")."</a> - <font size=1>".
|
||||
get_string("adminhelpedituser")."</font><br />";
|
||||
@@ -388,11 +421,11 @@
|
||||
|
||||
$table->data[] = array("<font size=+1><b><a href=\"../course/index.php?edit=on\">".get_string("courses")."</a></b>",
|
||||
"<font size=+1> </font>".get_string("adminhelpcourses"));
|
||||
$table->data[] = array("<font size=+1><b><a href=\"../course/log.php?id=$site->id.php\">".get_string("logs")."</a></b>",
|
||||
$table->data[] = array("<font size=+1><b><a href=\"../course/log.php?id=$site->id\">".get_string("logs")."</a></b>",
|
||||
"<font size=+1> </font>".get_string("adminhelplogs"));
|
||||
$table->data[] = array("<font size=+1><b><a href=\"../files/index.php?id=$site->id\">".get_string("sitefiles")."</a></b>",
|
||||
"<font size=+1> </font>".get_string("adminhelpsitefiles"));
|
||||
if (file_exists("$CFG->dirroot/admin/$CFG->dbtype")) {
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
|
||||
$table->data[] = array("<font size=+1><b><a href=\"$CFG->dbtype/frame.php\">".get_string("managedatabase")."</a></b>",
|
||||
"<font size=+1> </font>".get_string("adminhelpmanagedatabase"));
|
||||
}
|
||||
@@ -403,7 +436,7 @@
|
||||
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO REMOVE OR MODIFY THE COPYRIGHT NOTICE BELOW ////
|
||||
$copyrighttext = "<a href=\"http://moodle.org/\">Moodle</a> ".
|
||||
"<a href=\"../doc/?frame=release.html\">$CFG->release</a> ($CFG->version)<br />".
|
||||
"Copyright © 2000-2003 Martin Dougiamas<br />".
|
||||
"Copyright © 1999-2004 Martin Dougiamas<br />".
|
||||
"<a href=\"../doc/?frame=licence.html\">GNU Public License</a>";
|
||||
echo "<center><p><font size=1>$copyrighttext</font></p></center>";
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+113
-100
@@ -3,6 +3,7 @@
|
||||
require_once("../config.php");
|
||||
|
||||
optional_variable($mode, "");
|
||||
optional_variable($currentfile, "moodle.php");
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -44,7 +45,13 @@
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $navigation");
|
||||
|
||||
if (!$mode) {
|
||||
print_heading("$strcurrentlanguage: $currentlang - ".get_string("thislanguage"));
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages();
|
||||
echo "<table align=center><tr><td align=\"right\">";
|
||||
echo "<b>$strcurrentlanguage:</b>";
|
||||
echo "</td><td>";
|
||||
echo popup_form ("$CFG->wwwroot/admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
||||
echo "</td></tr></table>";
|
||||
print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>");
|
||||
print_heading("<a href=\"lang.php?mode=compare\">$strcomparelanguage</a>");
|
||||
echo "<center><hr noshade size=1>";
|
||||
@@ -65,7 +72,7 @@
|
||||
}
|
||||
|
||||
foreach ($stringfiles as $key => $file) {
|
||||
if ($file == "README" or $file == "help" or $file == "docs" or $file == "fonts") {
|
||||
if (substr($file, -4) != ".php") {
|
||||
unset($stringfiles[$key]);
|
||||
}
|
||||
}
|
||||
@@ -135,114 +142,119 @@
|
||||
|
||||
} else if ($mode == "compare") {
|
||||
|
||||
if (isset($_POST['file'])){ // Save a file
|
||||
if (isset($_POST['currentfile'])){ // Save a file
|
||||
$newstrings = $_POST;
|
||||
$file = $newstrings['file'];
|
||||
unset($newstrings['file']);
|
||||
if (lang_save_file($langdir, $file, $newstrings)) {
|
||||
notify(get_string("changessaved")." ($langdir/$file)");
|
||||
unset($newstrings['currentfile']);
|
||||
if (lang_save_file($langdir, $currentfile, $newstrings)) {
|
||||
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
|
||||
} else {
|
||||
error("Could not save the file '$file'!", "lang.php?mode=compare");
|
||||
error("Could not save the file '$currentfile'!", "lang.php?mode=compare¤tfile=$currentfile");
|
||||
}
|
||||
}
|
||||
|
||||
print_heading($strcomparelanguage);
|
||||
echo "<center>";
|
||||
helpbutton("langedit",$strcomparelanguage);
|
||||
echo "</center>";
|
||||
print_heading_with_help($strcomparelanguage, "langedit");
|
||||
|
||||
print_simple_box_start("center", "80%");
|
||||
echo '<center><font size="2">';
|
||||
foreach ($stringfiles as $file) {
|
||||
|
||||
print_heading("$file", "LEFT", 4);
|
||||
|
||||
if (!file_exists("$langdir/$file")) {
|
||||
if (!touch("$langdir/$file")) {
|
||||
echo "<p><font color=red>".get_string("filemissing", "", "$langdir/$file")."</font></p>";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
error_reporting(0);
|
||||
if ($f = fopen("$langdir/$file","r+")) {
|
||||
$editable = true;
|
||||
fclose($f);
|
||||
if ($file == $currentfile) {
|
||||
echo "<b>$file</b> ";
|
||||
} else {
|
||||
$editable = false;
|
||||
echo "<p><font size=1>".get_string("makeeditable", "", "$langdir/$file")."</font></p>";
|
||||
echo "<a href=\"lang.php?mode=compare¤tfile=$file\">$file</a> ";
|
||||
}
|
||||
error_reporting(7);
|
||||
}
|
||||
echo '</font></center>';
|
||||
print_simple_box_end();
|
||||
|
||||
|
||||
print_heading("$currentfile", "center", 4);
|
||||
|
||||
unset($string);
|
||||
include("$enlangdir/$file");
|
||||
$enstring = $string;
|
||||
ksort($enstring);
|
||||
|
||||
unset($string);
|
||||
include("$langdir/$file");
|
||||
|
||||
if ($editable) {
|
||||
echo "<form name=\"$file\" action=\"lang.php\" method=\"post\">";
|
||||
if (!file_exists("$langdir/$currentfile")) {
|
||||
if (!touch("$langdir/$currentfile")) {
|
||||
echo "<p><font color=red>".get_string("filemissing", "", "$langdir/$currentfile")."</font></p>";
|
||||
continue;
|
||||
}
|
||||
echo "<table width=\"100%\" cellpadding=2 cellspacing=3 border=0>";
|
||||
foreach ($enstring as $key => $envalue) {
|
||||
$envalue = nl2br(htmlspecialchars($envalue));
|
||||
$envalue = preg_replace('/(\$a\-\>[a-zA-Z0-9]*|\$a)/', '<b>$0</b>', $envalue); // Make variables bold.
|
||||
$envalue = str_replace("%%","%",$envalue);
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td width=20% bgcolor=\"$THEME->cellheading\" nowrap valign=top>$key</td>";
|
||||
echo "<td width=40% bgcolor=\"$THEME->cellheading\" valign=top>$envalue</td>";
|
||||
|
||||
$value = $string[$key];
|
||||
$value = str_replace("\r","",$value); // Bad character caused by Windows
|
||||
$value = str_replace("\n\n\n\n\n\n","\n",$value); // Collapse runs of blank lines
|
||||
$value = str_replace("\n\n\n\n\n","\n",$value);
|
||||
$value = str_replace("\n\n\n\n","\n",$value);
|
||||
$value = str_replace("\n\n\n","\n",$value);
|
||||
$value = str_replace("\n\n\n","\n",$value);
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
$value = str_replace("%%","%",$value);
|
||||
$value = htmlspecialchars($value);
|
||||
|
||||
$cellcolour = $value ? $THEME->cellcontent: $THEME->highlight;
|
||||
|
||||
if ($editable) {
|
||||
echo "<td width=40% bgcolor=\"$cellcolour\" valign=top>";
|
||||
if (isset($string[$key])) {
|
||||
$valuelen = strlen($value);
|
||||
} else {
|
||||
$valuelen = strlen($envalue);
|
||||
}
|
||||
$cols=50;
|
||||
if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) {
|
||||
$rows = ceil($valuelen / $cols);
|
||||
echo "<textarea name=\"string-$key\" cols=\"$cols\" rows=\"$rows\">$value</textarea>";
|
||||
} else {
|
||||
if ($valuelen) {
|
||||
$cols = $valuelen + 2;
|
||||
}
|
||||
echo "<input type=\"text\" name=\"string-$key\" value=\"$value\" size=\"$cols\"></td>";
|
||||
}
|
||||
echo "</TD>";
|
||||
|
||||
} else {
|
||||
echo "<td width=40% bgcolor=\"$cellcolour\" valign=top>$value</td>";
|
||||
}
|
||||
}
|
||||
if ($editable) {
|
||||
echo "<tr><td colspan=2> <td>";
|
||||
echo " <input type=\"hidden\" name=\"file\" value=\"$file\">";
|
||||
echo " <input type=\"hidden\" name=\"mode\" value=\"compare\">";
|
||||
echo " <input type=\"submit\" name=\"update\" value=\"".get_string("savechanges").": $file\">";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
}
|
||||
|
||||
print_continue("lang.php");
|
||||
|
||||
error_reporting(0);
|
||||
if ($f = fopen("$langdir/$currentfile","r+")) {
|
||||
$editable = true;
|
||||
fclose($f);
|
||||
} else {
|
||||
$editable = false;
|
||||
echo "<p><font size=1>".get_string("makeeditable", "", "$langdir/$currentfile")."</font></p>";
|
||||
}
|
||||
error_reporting(7);
|
||||
|
||||
|
||||
unset($string);
|
||||
include("$enlangdir/$currentfile");
|
||||
$enstring = $string;
|
||||
ksort($enstring);
|
||||
|
||||
unset($string);
|
||||
include("$langdir/$currentfile");
|
||||
|
||||
if ($editable) {
|
||||
echo "<form name=\"$currentfile\" action=\"lang.php\" method=\"post\">";
|
||||
}
|
||||
echo "<table width=\"100%\" cellpadding=2 cellspacing=3 border=0>";
|
||||
foreach ($enstring as $key => $envalue) {
|
||||
$envalue = nl2br(htmlspecialchars($envalue));
|
||||
$envalue = preg_replace('/(\$a\-\>[a-zA-Z0-9]*|\$a)/', '<b>$0</b>', $envalue); // Make variables bold.
|
||||
$envalue = str_replace("%%","%",$envalue);
|
||||
$envalue = str_replace("\\","",$envalue); // Delete all slashes
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td width=20% bgcolor=\"$THEME->cellheading\" nowrap valign=top>$key</td>";
|
||||
echo "<td width=40% bgcolor=\"$THEME->cellheading\" valign=top>$envalue</td>";
|
||||
|
||||
$value = $string[$key];
|
||||
$value = str_replace("\r","",$value); // Bad character caused by Windows
|
||||
$value = str_replace("\n\n\n\n\n\n","\n",$value); // Collapse runs of blank lines
|
||||
$value = str_replace("\n\n\n\n\n","\n",$value);
|
||||
$value = str_replace("\n\n\n\n","\n",$value);
|
||||
$value = str_replace("\n\n\n","\n",$value);
|
||||
$value = str_replace("\n\n\n","\n",$value);
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
$value = str_replace("%%","%",$value);
|
||||
$value = htmlspecialchars($value);
|
||||
|
||||
$cellcolour = $value ? $THEME->cellcontent: $THEME->highlight;
|
||||
|
||||
if ($editable) {
|
||||
echo "<td width=40% bgcolor=\"$cellcolour\" valign=top>";
|
||||
if (isset($string[$key])) {
|
||||
$valuelen = strlen($value);
|
||||
} else {
|
||||
$valuelen = strlen($envalue);
|
||||
}
|
||||
$cols=50;
|
||||
if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) {
|
||||
$rows = ceil($valuelen / $cols);
|
||||
echo "<textarea name=\"string-$key\" cols=\"$cols\" rows=\"$rows\">$value</textarea>";
|
||||
} else {
|
||||
if ($valuelen) {
|
||||
$cols = $valuelen + 2;
|
||||
}
|
||||
echo "<input type=\"text\" name=\"string-$key\" value=\"$value\" size=\"$cols\"></td>";
|
||||
}
|
||||
echo "</TD>";
|
||||
|
||||
} else {
|
||||
echo "<td width=40% bgcolor=\"$cellcolour\" valign=top>$value</td>";
|
||||
}
|
||||
}
|
||||
if ($editable) {
|
||||
echo "<tr><td colspan=2> <td><br />";
|
||||
echo " <input type=\"hidden\" name=\"currentfile\" value=\"$currentfile\">";
|
||||
echo " <input type=\"hidden\" name=\"mode\" value=\"compare\">";
|
||||
echo " <input type=\"submit\" name=\"update\" value=\"".get_string("savechanges").": $currentfile\">";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
}
|
||||
|
||||
print_footer();
|
||||
@@ -257,7 +269,7 @@ function lang_save_file($path, $file, $strings) {
|
||||
// $file is the file to overwrite.
|
||||
// $strings is an array of strings to write
|
||||
|
||||
global $CFG;
|
||||
global $CFG, $USER;
|
||||
|
||||
error_reporting(0);
|
||||
if (!$f = fopen("$path/$file","w")) {
|
||||
@@ -276,11 +288,12 @@ function lang_save_file($path, $file, $strings) {
|
||||
if ($CFG->lang != "zh_hk" and $CFG->lang != "zh_tw") { // Some MB languages include backslash bytes
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
}
|
||||
$value = str_replace("$"."a", "\\$"."a", $value); // Add slashes for $a
|
||||
$value = str_replace("\"", "\\\\\\\"", $value); // Add slashes for "
|
||||
$value = str_replace("'", "\\'", $value); // Add slashes for '
|
||||
$value = str_replace('"', "\\\"", $value); // Add slashes for "
|
||||
$value = str_replace("%","%%",$value); // Escape % characters
|
||||
$value = str_replace("\r", "",$value); // Remove linefeed characters
|
||||
if ($id == "string" and $value != ""){
|
||||
fwrite($f,"\$string['$stringname'] = \"$value\";\n");
|
||||
fwrite($f,"\$string['$stringname'] = '$value';\n");
|
||||
}
|
||||
}
|
||||
fwrite($f,"\n?>\n");
|
||||
|
||||
+2
-2
@@ -37,10 +37,10 @@
|
||||
$strmanagemodules = get_string("managemodules");
|
||||
$strmodulename = get_string("modulename", $module);
|
||||
|
||||
print_header("$site->shortname: $strconfigvariables", $site->fullname,
|
||||
print_header("$site->shortname: $strmodulename: $strconfiguration", $site->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"modules.php\">$strmanagemodules</a> -> $strmodulename", $focus);
|
||||
"<a href=\"modules.php\">$strmanagemodules</a> -> $strmodulename");
|
||||
|
||||
print_heading($strmodulename);
|
||||
|
||||
|
||||
+9
-5
@@ -24,9 +24,11 @@
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strmanagemodules = get_string("managemodules");
|
||||
$strdelete = get_string("delete");
|
||||
$strversion = get_string("version");
|
||||
$strhide = get_string("hide");
|
||||
$strshow = get_string("show");
|
||||
$strsettings = get_string("settings");
|
||||
$stractivities = get_string("activities");
|
||||
$stractivitymodule = get_string("activitymodule");
|
||||
|
||||
print_header("$site->shortname: $strmanagemodules", "$site->fullname",
|
||||
@@ -148,10 +150,10 @@
|
||||
$modpixpath = "../theme/$CFG->theme/pix/mod";
|
||||
}
|
||||
|
||||
$table->head = array ($stractivitymodule, "$strhide/$strshow", $strdelete, $strsettings);
|
||||
$table->align = array ("LEFT", "CENTER", "CENTER", "CENTER");
|
||||
$table->wrap = array ("NOWRAP", "", "","");
|
||||
$table->size = array ("100%", "10", "10","12");
|
||||
$table->head = array ($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings);
|
||||
$table->align = array ("LEFT", "RIGHT", "LEFT", "CENTER", "CENTER", "CENTER");
|
||||
$table->wrap = array ("NOWRAP", "", "", "", "","");
|
||||
$table->size = array ("100%", "10", "10", "10", "10","12");
|
||||
$table->width = "100";
|
||||
|
||||
foreach ($modulebyname as $modulename => $module) {
|
||||
@@ -166,6 +168,8 @@
|
||||
$settings = "";
|
||||
}
|
||||
|
||||
$count = count_records("$module->name");
|
||||
|
||||
if ($module->visible) {
|
||||
$visible = "<a href=\"modules.php?hide=$module->name\" title=\"$strhide\">".
|
||||
"<img src=\"$pixpath/i/hide.gif\" align=\"absmiddle\" height=16 width=16 border=0></a>";
|
||||
@@ -180,7 +184,7 @@
|
||||
$visible = "";
|
||||
$class = "";
|
||||
}
|
||||
$table->data[] = array ("<p $class>$icon $modulename</p>", $visible, $delete, $settings);
|
||||
$table->data[] = array ("<p $class>$icon $modulename</p>", $count, $module->version, $visible, $delete, $settings);
|
||||
}
|
||||
print_table($table);
|
||||
|
||||
|
||||
+2
-3
@@ -2,7 +2,6 @@
|
||||
// register.php - allows admin to register their site on moodle.org
|
||||
|
||||
include("../config.php");
|
||||
require_once("../lib/countries.php");
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -81,7 +80,7 @@
|
||||
echo "<tr valign=top>\n";
|
||||
echo "<td align=right><p>".get_string("country").":</td>\n";
|
||||
echo "<td><p>";
|
||||
choose_from_menu ($COUNTRIES, "country", $admin->country, get_string("selectacountry")."...", "", "");
|
||||
choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", "");
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
@@ -102,7 +101,7 @@
|
||||
|
||||
echo "<tr valign=top>\n";
|
||||
echo "<td align=right><p>".get_string("administrator").":</td>\n";
|
||||
echo "<td><p><input size=50 type=\"text\" name=\"adminname\" value=\"$admin->firstname $admin->lastname\"></td>\n";
|
||||
echo "<td><p><input size=50 type=\"text\" name=\"adminname\" value=\"".fullname($admin, true)."\"></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr valign=top>\n";
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
if ($site and empty($form)) {
|
||||
$form = $site;
|
||||
$course = $site;
|
||||
$firsttime = false;
|
||||
} else {
|
||||
$form->fullname = "";
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php // $Id$
|
||||
|
||||
include("../config.php");
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You must be an admin");
|
||||
}
|
||||
|
||||
$strtimezone = get_string("timezone");
|
||||
$strsavechanges = get_string("savechanges");
|
||||
$strusers = get_string("users");
|
||||
$strall = get_string("all");
|
||||
|
||||
print_header($strtimezone, $strtimezone, $strtimezone);
|
||||
|
||||
print_heading("");
|
||||
|
||||
if (isset($zone)) {
|
||||
$db->debug = true;
|
||||
echo "<center>";
|
||||
execute_sql("UPDATE {$CFG->prefix}user SET timezone = '$zone'");
|
||||
$db->debug = false;
|
||||
echo "</center>";
|
||||
|
||||
$USER->timezone = $zone;
|
||||
}
|
||||
|
||||
$user = $USER;
|
||||
|
||||
if (abs($user->timezone) > 13) {
|
||||
$user->timezone = 99;
|
||||
}
|
||||
$timenow = time();
|
||||
|
||||
for ($tz = -26; $tz <= 26; $tz++) {
|
||||
$zone = (float)$tz/2.0;
|
||||
$usertime = $timenow + ($tz * 1800);
|
||||
if ($tz == 0) {
|
||||
$timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT)";
|
||||
} else if ($tz < 0) {
|
||||
$timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT$zone)";
|
||||
} else {
|
||||
$timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT+$zone)";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<center><form action=timezone.php method=get>";
|
||||
echo "$strusers ($strall): ";
|
||||
choose_from_menu ($timezones, "zone", $user->timezone, get_string("serverlocaltime"), "", "99");
|
||||
echo "<input type=submit value=\"$strsavechanges\">";
|
||||
echo "</form>";
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,131 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
require("../config.php");
|
||||
|
||||
optional_variable($confirm);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You must be an admin to use this script");
|
||||
}
|
||||
|
||||
if ($CFG->version < 2004013101) {
|
||||
error("This script does not work with this old version of Moodle");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
/// Turn off time limits, sometimes upgrades can be slow.
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
|
||||
/// Print header
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
$strupgradinglogs = get_string("upgradinglogs", "admin");
|
||||
|
||||
print_header("$site->shortname: $stradministration: $strupgradinglogs", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> $strupgradinglogs");
|
||||
|
||||
if (empty($_GET['confirm'])) {
|
||||
notice_yesno(get_string("upgradelogsinfo", "admin"),
|
||||
"upgradelogs.php?confirm=true",
|
||||
"index.php");
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/// Try and extract as many cmids as possible from the existing logs
|
||||
|
||||
if ($coursemodules = get_records_sql("SELECT cm.*, m.name
|
||||
FROM {$CFG->prefix}course_modules cm,
|
||||
{$CFG->prefix}modules m
|
||||
WHERE cm.module = m.id")) {
|
||||
$cmcount = count($coursemodules);
|
||||
$count = 0;
|
||||
$starttime = time();
|
||||
$sleeptime = 0;
|
||||
|
||||
if ($CFG->dbtype == "mysql") {
|
||||
$LIKE = "LIKE";
|
||||
} else {
|
||||
$LIKE = "ILIKE";
|
||||
}
|
||||
|
||||
if ($cmcount > 10) {
|
||||
print_simple_box('This process may take a very long time ... please be patient and let it finish.',
|
||||
'center', '', '#ffcccc');
|
||||
$sleeptime = 1;
|
||||
}
|
||||
foreach ($coursemodules as $cm) {
|
||||
|
||||
switch ($cm->name) {
|
||||
case "forum":
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url = 'view.php?id=$cm->id'", false);
|
||||
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url = 'view.php?f=$cm->instance'", false);
|
||||
|
||||
if ($discussions = get_records("forum_discussions", "forum", $cm->instance)) {
|
||||
foreach ($discussions as $discussion) {
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url $LIKE 'discuss.php?d=$discussion->id%'", false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "glossary":
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url $LIKE 'view.php?id=$cm->id%'", false);
|
||||
break;
|
||||
|
||||
case "quiz":
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url = 'view.php?id=$cm->id'", false);
|
||||
break;
|
||||
|
||||
case "assignment":
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url = 'view.php?id=$cm->id'", false);
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url = 'view.php?a=$cm->instance'", false);
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url = 'submissions.php?id=$cm->instance'", false);
|
||||
break;
|
||||
|
||||
case "journal":
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url = 'report.php?id=$cm->id'", false);
|
||||
|
||||
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
|
||||
WHERE module = '$cm->name' AND url = 'view.php?id=$cm->id'", false);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$count++;
|
||||
$elapsedtime = time() - $starttime;
|
||||
$projectedtime = (int)(((float)$cmcount / (float)$count) * $elapsedtime) - $elapsedtime;
|
||||
|
||||
if ($cmcount > 10) {
|
||||
notify("Processed $count of $cmcount coursemodules. Estimated completion: ".format_time($projectedtime));
|
||||
flush();
|
||||
sleep($sleeptime); // To help reduce database load
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete_records("config", "name", "upgrade", "value", "logs");
|
||||
|
||||
notify("Log upgrading was successful!");
|
||||
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
Executable
+271
@@ -0,0 +1,271 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
/// Bulk user registration script from a comma separated file
|
||||
/// Returns list of users with their user ids
|
||||
|
||||
require_once("../config.php");
|
||||
|
||||
optional_variable($numusers, 0);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You must be an administrator to edit users this way.");
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
}
|
||||
|
||||
if (!$adminuser = get_admin()) {
|
||||
error("Could not find site admin");
|
||||
}
|
||||
|
||||
$streditmyprofile = get_string("editmyprofile");
|
||||
$stradministration = get_string("administration");
|
||||
$strchoose = get_string("choose");
|
||||
$struser = get_string("user");
|
||||
$strusers = get_string("users");
|
||||
$strusersnew = get_string("usersnew");
|
||||
$struploadusers = get_string("uploadusers");
|
||||
$straddnewuser = get_string("importuser");
|
||||
|
||||
|
||||
/// Print the header
|
||||
|
||||
print_header("$site->shortname: $struploadusers", $site->fullname,
|
||||
"<a href=\"index.php\">$stradministration</a> ->
|
||||
<a href=\"users.php\">$strusers</a> -> $struploadusers");
|
||||
|
||||
|
||||
/// If a file has been uploaded, then process it
|
||||
|
||||
if ($filename = valid_uploaded_file($_FILES['userfile'])) {
|
||||
|
||||
//Fix mac/dos newlines
|
||||
$text = my_file_get_contents($filename);
|
||||
$text = preg_replace('!\r\n?!',"\n",$text);
|
||||
$fp = fopen($filename, "w");
|
||||
fwrite($fp,$text);
|
||||
fclose($fp);
|
||||
|
||||
$fp = fopen($filename, "r");
|
||||
|
||||
// make arrays of valid fields for error checking
|
||||
$required = array("username" => 1,
|
||||
"password" => 1,
|
||||
"firstname" => 1,
|
||||
"lastname" => 1,
|
||||
"email" => 1);
|
||||
$optionalDefaults = array("institution" => 1,
|
||||
"department" => 1,
|
||||
"city" => 1,
|
||||
"country" => 1,
|
||||
"lang" => 1,
|
||||
"timezone" => 1);
|
||||
$optional = array("idnumber" => 1,
|
||||
"icq" => 1,
|
||||
"phone1" => 1,
|
||||
"phone2" => 1,
|
||||
"address" => 1,
|
||||
"url" => 1,
|
||||
"description" => 1,
|
||||
"mailformat" => 1,
|
||||
"maildisplay" => 1,
|
||||
"htmleditor" => 1,
|
||||
"autosubscribe" => 1,
|
||||
"idnumber" => 1,
|
||||
"icq" => 1,
|
||||
"course1" => 1,
|
||||
"course2" => 1,
|
||||
"course3" => 1,
|
||||
"course4" => 1,
|
||||
"course5" => 1,
|
||||
"group1" => 1,
|
||||
"group2" => 1,
|
||||
"group3" => 1,
|
||||
"group4" => 1,
|
||||
"group5" =>1);
|
||||
|
||||
// --- get header (field names) ---
|
||||
$header = split("\,", fgets($fp,1024));
|
||||
// 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])) {
|
||||
error(get_string('invalidfieldname', 'error', $h), 'uploaduser.php');
|
||||
}
|
||||
if ($required[$h]) {
|
||||
$required[$h] = 2;
|
||||
}
|
||||
}
|
||||
// check for required fields
|
||||
foreach ($required as $key => $value) {
|
||||
if ($value < 2) {
|
||||
error(get_string('fieldrequired', 'error', $key), 'uploaduser.php');
|
||||
}
|
||||
}
|
||||
$linenum = 2; // since header is line 1
|
||||
|
||||
while (!feof ($fp)) {
|
||||
foreach ($optionalDefaults as $key => $value) {
|
||||
$user->$key = addslashes($adminuser->$key);
|
||||
}
|
||||
//Note: commas within a field should be encoded as ,
|
||||
$line = split("\,", fgets($fp,1024));
|
||||
foreach ($line as $key => $value) {
|
||||
//decode encoded commas
|
||||
$record[$header[$key]] = preg_replace('/\&\#44/',',',trim($value));
|
||||
}
|
||||
if ($record[$header[0]]) {
|
||||
// add a new user to the database
|
||||
optional_variable($newuser, "");
|
||||
|
||||
// add fields to object $user
|
||||
foreach ($record as $name => $value) {
|
||||
// check for required values
|
||||
if ($required[$name] and !$value) {
|
||||
error(get_string('missingfield', 'error', $name). " ".
|
||||
get_string('erroronline', 'error', $linenum),
|
||||
'uploaduser.php');
|
||||
}
|
||||
// password needs to be encrypted
|
||||
else if ($name == "password") {
|
||||
$user->password = md5($value);
|
||||
}
|
||||
// normal entry
|
||||
else {
|
||||
$user->{$name} = addslashes($value);
|
||||
}
|
||||
}
|
||||
$user->confirmed = 1;
|
||||
$user->timemodified = time();
|
||||
$linenum++;
|
||||
$username = $user->username;
|
||||
$addcourse[0] = $user->course1;
|
||||
$addcourse[1] = $user->course2;
|
||||
$addcourse[2] = $user->course3;
|
||||
$addcourse[3] = $user->course4;
|
||||
$addcourse[4] = $user->course5;
|
||||
$addgroup[0] = $user->group1;
|
||||
$addgroup[1] = $user->group2;
|
||||
$addgroup[2] = $user->group3;
|
||||
$addgroup[3] = $user->group4;
|
||||
$addgroup[4] = $user->group5;
|
||||
$courses = get_courses("all");
|
||||
for ($i=0; $i<5; $i++) {
|
||||
$courseid[$i]=0;
|
||||
}
|
||||
foreach ($courses as $course) {
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($course->shortname == $addcourse[$i]) {
|
||||
$courseid[$i] = $course->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $user->id = insert_record("user", $user)) {
|
||||
if (!$user = get_record("user", "username", "changeme")) { // half finished user from another time
|
||||
//Record not added - probably because user is already registered
|
||||
//In this case, output userid from previous registration
|
||||
//This can be used to obtain a list of userids for existing users
|
||||
if ($user = get_record("user","username",$username)) {
|
||||
notify("$user->id ".get_string('usernotaddedregistered', 'error', $username));
|
||||
} else {
|
||||
notify(get_string('usernotaddederror', 'error', $username));
|
||||
}
|
||||
}
|
||||
} else if ($user->username != "changeme") {
|
||||
notify("$struser: $user->id = $user->username");
|
||||
$numusers++;
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($addcourse[$i] && !$courseid[$i]) {
|
||||
notify(get_string('unknowncourse', 'error', $addcourse[$i]));
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
$groupid[$i] = 0;
|
||||
if ($addgroup[$i]) {
|
||||
if (!$courseid[$i]) {
|
||||
notify(get_string('coursegroupunknown','error',$addgroup[$i]));
|
||||
} else {
|
||||
if ($group = get_record("groups","courseid",$courseid[$i],"name",$addgroup[$i])) {
|
||||
$groupid[$i] = $group->id;
|
||||
} else {
|
||||
notify(get_string('groupunknown','error',$addgroup[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($courseid[$i]) {
|
||||
if (enrol_student($user->id, $courseid[$i])) {
|
||||
notify('-->'. get_string('enrolledincourse', '', $addcourse[$i]));
|
||||
} else {
|
||||
notify('-->'.get_string('enrolledincoursenot', '', $addcourse[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($courseid[$i] && $groupid[$i]) {
|
||||
if (record_exists("user_students","userid",$user->id,"course",$courseid[$i])) {
|
||||
$usergroup = user_group($courseid[$i],$user->id);
|
||||
if ($usergroup) {
|
||||
notify('-->' . get_string('groupalready','error',$usergroup->name));
|
||||
} else {
|
||||
$group_member->groupid = $groupid[$i];
|
||||
$group_member->userid = $user->id;
|
||||
$group_member->timeadded = time();
|
||||
if (insert_record("groups_members",$group_member)) {
|
||||
notify('-->' . get_string('addedtogroup','',$addgroup[$i]));
|
||||
} else {
|
||||
notify('-->' . get_string('addedtogroupnot','',$addgroup[$i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
notify('-->' . get_string('addedtogroupnotenrolled','',$addgroup[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset ($user);
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
notify("$strusersnew: $numusers");
|
||||
|
||||
echo '<hr />';
|
||||
}
|
||||
|
||||
/// Print the form
|
||||
print_heading_with_help($struploadusers, 'uploadusers');
|
||||
|
||||
$maxuploadsize = get_max_upload_file_size();
|
||||
echo '<center>';
|
||||
echo '<form method="post" enctype="multipart/form-data" action="uploaduser.php">'.
|
||||
$strchoose.':<input type="hidden" name="MAX_FILE_SIZE" value="'.$maxuploadsize.'">'.
|
||||
'<input type="file" name="userfile" size=30>'.
|
||||
'<input type="submit" value="'.$struploadusers.'">'.
|
||||
'</form></br>';
|
||||
echo '</center>';
|
||||
|
||||
print_footer($course);
|
||||
|
||||
|
||||
|
||||
function my_file_get_contents($filename, $use_include_path = 0) {
|
||||
/// Returns the file as one big long string
|
||||
|
||||
$data = "";
|
||||
$file = @fopen($filename, "rb", $use_include_path);
|
||||
if ($file) {
|
||||
while (!feof($file)) {
|
||||
$data .= fread($file, 1024);
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+173
-108
@@ -1,18 +1,18 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("../user/lib.php");
|
||||
require_once("../lib/countries.php");
|
||||
|
||||
$recordsperpage = 30;
|
||||
|
||||
optional_variable($newuser, "");
|
||||
optional_variable($delete, "");
|
||||
optional_variable($confirm, "");
|
||||
optional_variable($confirmuser, "");
|
||||
optional_variable($sort, "name");
|
||||
optional_variable($dir, "ASC");
|
||||
optional_variable($page, 0);
|
||||
optional_variable($search, "");
|
||||
optional_variable($lastinitial, ""); // only show students with this last initial
|
||||
optional_variable($firstinitial, ""); // only show students with this first initial
|
||||
optional_variable($perpage, "30"); // how many per page
|
||||
|
||||
unset($user);
|
||||
unset($admin);
|
||||
@@ -106,10 +106,34 @@
|
||||
$strsearch = get_string("search");
|
||||
$strshowallusers = get_string("showallusers");
|
||||
|
||||
print_header("$site->shortname: $stredituser", $site->fullname,
|
||||
"<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> -> $stredituser");
|
||||
if ($firstinitial or $lastinitial or $search or $page) {
|
||||
print_header("$site->shortname: $stredituser", $site->fullname,
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"users.php\">$strusers</a> -> ".
|
||||
"<a href=\"user.php\">$stredituser</a>");
|
||||
} else {
|
||||
print_header("$site->shortname: $stredituser", $site->fullname,
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"users.php\">$strusers</a> -> $stredituser");
|
||||
}
|
||||
|
||||
if ($delete) { // Delete a selected user, after confirmation
|
||||
if ($confirmuser) {
|
||||
if (!$user = get_record("user", "id", "$confirmuser")) {
|
||||
error("No such user!");
|
||||
}
|
||||
|
||||
unset($confirmeduser);
|
||||
$confirmeduser->id = $confirmuser;
|
||||
$confirmeduser->confirmed = 1;
|
||||
$confirmeduser->timemodified = time();
|
||||
|
||||
if (update_record("user", $confirmeduser)) {
|
||||
notify(get_string("userconfirmed", "", fullname($user, true)) );
|
||||
} else {
|
||||
notify(get_string("usernotconfirmed", "", fullname($user, true)));
|
||||
}
|
||||
|
||||
} else if ($delete) { // Delete a selected user, after confirmation
|
||||
if (!$user = get_record("user", "id", "$delete")) {
|
||||
error("No such user!");
|
||||
}
|
||||
@@ -120,7 +144,8 @@
|
||||
}
|
||||
|
||||
if ($confirm != md5($delete)) {
|
||||
notice_yesno(get_string("deletecheckfull", "", "'$user->firstname $user->lastname'"),
|
||||
$fullname = fullname($user, true);
|
||||
notice_yesno(get_string("deletecheckfull", "", "'$fullname'"),
|
||||
"user.php?delete=$delete&confirm=".md5($delete), "user.php");
|
||||
|
||||
exit;
|
||||
@@ -135,145 +160,185 @@
|
||||
unenrol_student($user->id); // From all courses
|
||||
remove_teacher($user->id); // From all courses
|
||||
remove_admin($user->id);
|
||||
notify(get_string("deletedactivity", "", "$user->firstname $user->lastname"));
|
||||
notify(get_string("deletedactivity", "", fullname($user, true)) );
|
||||
} else {
|
||||
notify(get_string("deletednot", "", "$user->firstname $user->lastname"));
|
||||
notify(get_string("deletednot", "", fullname($user, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Carry on with the user listing
|
||||
|
||||
|
||||
$columns = array("name", "email", "city", "country", "lastaccess");
|
||||
$columns = array("firstname", "lastname", "email", "city", "country", "lastaccess");
|
||||
|
||||
foreach ($columns as $column) {
|
||||
$string[$column] = get_string("$column");
|
||||
$columnsort = "$column";
|
||||
if ($column == "lastaccess") {
|
||||
$columndir = "DESC";
|
||||
if ($sort != $column) {
|
||||
$columnicon = "";
|
||||
if ($column == "lastaccess") {
|
||||
$columndir = "DESC";
|
||||
} else {
|
||||
$columndir = "ASC";
|
||||
}
|
||||
} else {
|
||||
$columndir = "ASC";
|
||||
}
|
||||
if ($columnsort == $sort) {
|
||||
$$column = $string[$column];
|
||||
} else {
|
||||
$$column = "<A HREF=\"user.php?sort=$columnsort&dir=$columndir&search=$search\">".$string[$column]."</A>";
|
||||
$columndir = $dir == "asc" ? "desc":"asc";
|
||||
if ($column == "lastaccess") {
|
||||
$columnicon = $dir == "asc" ? "up":"down";
|
||||
} else {
|
||||
$columnicon = $dir == "asc" ? "down":"up";
|
||||
}
|
||||
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" />";
|
||||
|
||||
}
|
||||
$$column = "<a href=\"user.php?sort=$column&dir=$columndir&search=$search&firstinitial=$firstinitial&lastinitial=$lastinitial\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
|
||||
if ($sort == "name") {
|
||||
$sort = "firstname";
|
||||
}
|
||||
|
||||
if (!$users = get_users_listing($sort, $dir, $page, $recordsperpage, $search)) {
|
||||
if (!$users = get_users_listing($sort, $dir, 0, $recordsperpage)) {
|
||||
error("No users found!");
|
||||
} else {
|
||||
notify(get_string("nousersmatching", "", $search));
|
||||
$search = "";
|
||||
}
|
||||
}
|
||||
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
|
||||
|
||||
if ($search) {
|
||||
$usersearchcount = get_users(false, $search);
|
||||
if ($search or $firstinitial or $lastinitial) {
|
||||
print_heading("$usersearchcount / $usercount ".get_string("users"));
|
||||
$usercount = $usersearchcount;
|
||||
} else {
|
||||
print_heading("$usercount ".get_string("users"));
|
||||
}
|
||||
|
||||
$a->start = $page;
|
||||
$a->end = $page + $recordsperpage;
|
||||
if ($a->end > $usercount) {
|
||||
$a->end = $usercount;
|
||||
|
||||
$alphabet = explode(',', get_string('alphabet'));
|
||||
$strall = get_string("all");
|
||||
|
||||
|
||||
/// Bar of first initials
|
||||
|
||||
echo "<center><p align=\"center\">";
|
||||
echo get_string("firstname")." : ";
|
||||
if ($firstinitial) {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
echo "<TABLE align=center cellpadding=10><TR>";
|
||||
echo "<TD>";
|
||||
if ($page) {
|
||||
$prevpage = $page - $recordsperpage;
|
||||
if ($prevpage < 0) {
|
||||
$prevpage = 0;
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $firstinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial&firstinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
$options["dir"] = $dir;
|
||||
$options["page"] = 0;
|
||||
$options["sort"] = $sort;
|
||||
$options["search"] = $search;
|
||||
print_single_button("user.php", $options, " << ");
|
||||
echo "</TD><TD>";
|
||||
$options["page"] = $prevpage;
|
||||
print_single_button("user.php", $options, " < ");
|
||||
}
|
||||
echo "</TD><TD>";
|
||||
print_heading(get_string("displayingusers", "", $a));
|
||||
echo "</TD><TD>";
|
||||
$nextpage = $page + $recordsperpage;
|
||||
if ($nextpage < $usercount) {
|
||||
$options["dir"] = $dir;
|
||||
$options["page"] = $nextpage;
|
||||
$options["sort"] = $sort;
|
||||
$options["search"] = $search;
|
||||
print_single_button("user.php", $options, " > ");
|
||||
echo "</TD><TD>";
|
||||
$options["page"] = $usercount-$recordsperpage;
|
||||
print_single_button("user.php", $options, " >> ");
|
||||
echo "<br />";
|
||||
|
||||
/// Bar of last initials
|
||||
|
||||
echo get_string("lastname")." : ";
|
||||
if ($lastinitial) {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
echo "</TD></TR></TABLE>";
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $lastinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial&lastinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "</p>";
|
||||
echo "</center>";
|
||||
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=$search&");
|
||||
|
||||
flush();
|
||||
|
||||
foreach ($users as $key => $user) {
|
||||
if (!empty($user->country)) {
|
||||
$users[$key]->country = $COUNTRIES[$user->country];
|
||||
|
||||
if (!$users) {
|
||||
$match = array();
|
||||
if ($search) {
|
||||
$match[] = $search;
|
||||
}
|
||||
}
|
||||
if ($sort == "country") { // Need to resort by full country name, not code
|
||||
if ($firstinitial) {
|
||||
$match[] = get_string("firstname").": $firstinitial"."___";
|
||||
}
|
||||
if ($lastinitial) {
|
||||
$match[] = get_string("lastname").": $lastinitial"."___";
|
||||
}
|
||||
$matchstring = implode(", ", $match);
|
||||
print_heading(get_string("nousersmatching", "", $matchstring));
|
||||
|
||||
} else {
|
||||
|
||||
$countries = get_list_of_countries();
|
||||
|
||||
foreach ($users as $key => $user) {
|
||||
if (!empty($user->country)) {
|
||||
$users[$key]->country = $countries[$user->country];
|
||||
}
|
||||
}
|
||||
if ($sort == "country") { // Need to resort by full country name, not code
|
||||
foreach ($users as $user) {
|
||||
$susers[$user->id] = $user->country;
|
||||
}
|
||||
asort($susers);
|
||||
foreach ($susers as $key => $value) {
|
||||
$nusers[] = $users[$key];
|
||||
}
|
||||
$users = $nusers;
|
||||
}
|
||||
|
||||
$table->head = array ("$firstname / $lastname", $email, $city, $country, $lastaccess, "", "", "");
|
||||
$table->align = array ("left", "left", "left", "left", "left", "center", "center", "center");
|
||||
$table->width = "95%";
|
||||
foreach ($users as $user) {
|
||||
$susers[$user->id] = $user->country;
|
||||
if ($user->id == $USER->id or $user->username == "changeme") {
|
||||
$deletebutton = "";
|
||||
} else {
|
||||
$deletebutton = "<a href=\"user.php?delete=$user->id\">$strdelete</a>";
|
||||
}
|
||||
if ($user->lastaccess) {
|
||||
$strlastaccess = format_time(time() - $user->lastaccess);
|
||||
} else {
|
||||
$strlastaccess = get_string("never");
|
||||
}
|
||||
if ($user->confirmed == 0) {
|
||||
$confirmbutton = "<a href=\"user.php?confirmuser=$user->id\">" . get_string("confirm") . "</a>";
|
||||
} else {
|
||||
$confirmbutton = "";
|
||||
}
|
||||
$fullname = fullname($user, true);
|
||||
$table->data[] = array ("<a href=\"../user/view.php?id=$user->id&course=$site->id\">$fullname</a>",
|
||||
"$user->email",
|
||||
"$user->city",
|
||||
"$user->country",
|
||||
$strlastaccess,
|
||||
"<a href=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</a>",
|
||||
$deletebutton,
|
||||
$confirmbutton);
|
||||
}
|
||||
asort($susers);
|
||||
foreach ($susers as $key => $value) {
|
||||
$nusers[] = $users[$key];
|
||||
}
|
||||
$users = $nusers;
|
||||
}
|
||||
|
||||
$table->head = array ($name, $email, $city, $country, $lastaccess, "", "");
|
||||
$table->align = array ("left", "left", "left", "left", "left", "center", "center");
|
||||
$table->width = "95%";
|
||||
foreach ($users as $user) {
|
||||
if ($user->id == $USER->id or $user->username == "changeme") {
|
||||
$deletebutton = "";
|
||||
} else {
|
||||
$deletebutton = "<a href=\"user.php?delete=$user->id\">$strdelete</a>";
|
||||
echo "<table align=center cellpadding=10><tr><td>";
|
||||
echo "<form action=user.php method=post>";
|
||||
echo "<input type=text name=search value=\"$search\" size=20>";
|
||||
echo "<input type=submit value=\"$strsearch\">";
|
||||
if ($search) {
|
||||
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\">";
|
||||
}
|
||||
if ($user->lastaccess) {
|
||||
$strlastaccess = format_time(time() - $user->lastaccess);
|
||||
} else {
|
||||
$strlastaccess = get_string("never");
|
||||
}
|
||||
$table->data[] = array ("<a href=\"../user/view.php?id=$user->id&course=$site->id\">$user->firstname $user->lastname</a>",
|
||||
"$user->email",
|
||||
"$user->city",
|
||||
"$user->country",
|
||||
$strlastaccess,
|
||||
"<a href=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</a>",
|
||||
$deletebutton);
|
||||
}
|
||||
echo "</form>";
|
||||
echo "</td></tr></table>";
|
||||
|
||||
echo "<table align=center cellpadding=10><tr><td>";
|
||||
echo "<form action=user.php method=post>";
|
||||
echo "<input type=text name=search value=\"$search\" size=20>";
|
||||
echo "<input type=submit value=\"$strsearch\">";
|
||||
if ($search) {
|
||||
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\">";
|
||||
}
|
||||
echo "</form>";
|
||||
echo "</td></tr></table>";
|
||||
print_table($table);
|
||||
|
||||
print_table($table);
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage".
|
||||
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=$search&");
|
||||
|
||||
}
|
||||
|
||||
if ($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual"){
|
||||
print_heading("<a href=\"user.php?newuser=true\">".get_string("addnewuser")."</a>");
|
||||
|
||||
+4
-2
@@ -4,7 +4,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin) {
|
||||
if (!isadmin()) {
|
||||
error("Only admins can access this page");
|
||||
}
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
$table->data[] = array("<b><a href=\"auth.php\">".get_string("authentication")."</a></b>",
|
||||
get_string("adminhelpauthentication"));
|
||||
|
||||
if ($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual"){
|
||||
if (is_internal_auth()) {
|
||||
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true\">".get_string("addnewuser")."</a></b>",
|
||||
get_string("adminhelpaddnewuser"));
|
||||
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/uploaduser.php\">".get_string("uploadusers")."</a></b>",
|
||||
get_string("adminhelpuploadusers"));
|
||||
}
|
||||
$table->data[] = array("<b><a href=\"user.php\">".get_string("edituser")."</a></b>",
|
||||
get_string("adminhelpedituser"));
|
||||
|
||||
@@ -27,6 +27,8 @@ function auth_user_login ($username, $password) {
|
||||
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
|
||||
WHERE $CFG->auth_dbfielduser = '$username'
|
||||
AND $CFG->auth_dbfieldpass = '$password' ");
|
||||
$authdb->Close();
|
||||
|
||||
if (!$rs) {
|
||||
notify("Could not connect to the specified authentication database...");
|
||||
return false;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
<?php if (isset($err["auth_imaphost"])) formerr($err["auth_imaphost"]); ?>
|
||||
</TD>
|
||||
<TD>
|
||||
<?php print_string("auth_imaphost","auth") ?>
|
||||
<?php print_string("auth_imaphost","auth") ?>
|
||||
<?php print_string("auth_multiplehosts","auth") ?>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
|
||||
+29
-23
@@ -7,34 +7,40 @@ function auth_user_login ($username, $password) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
switch ($CFG->auth_imaptype) {
|
||||
case "imapssl":
|
||||
$host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl}";
|
||||
break;
|
||||
$hosts = split(';', $CFG->auth_imaphost); // Could be multiple hosts
|
||||
|
||||
case "imapcert":
|
||||
$host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl/novalidate-cert}";
|
||||
break;
|
||||
foreach ($hosts as $host) { // Try each host in turn
|
||||
|
||||
case "imaptls":
|
||||
$host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/notls}";
|
||||
break;
|
||||
$host = trim($host);
|
||||
|
||||
default:
|
||||
$host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport}";
|
||||
switch ($CFG->auth_imaptype) {
|
||||
case "imapssl":
|
||||
$host = '{'.$host.":$CFG->auth_imapport/imap/ssl}";
|
||||
break;
|
||||
|
||||
case "imapcert":
|
||||
$host = '{'.$host.":$CFG->auth_imapport/imap/ssl/novalidate-cert}";
|
||||
break;
|
||||
|
||||
case "imaptls":
|
||||
$host = '{'.$host.":$CFG->auth_imapport/imap/notls}";
|
||||
break;
|
||||
|
||||
default:
|
||||
$host = '{'.$host.":$CFG->auth_imapport}";
|
||||
}
|
||||
|
||||
error_reporting(0);
|
||||
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
if ($connection) {
|
||||
imap_close($connection);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
error_reporting(0);
|
||||
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
if ($connection) {
|
||||
imap_close($connection);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false; // No match
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
</TD>
|
||||
<TD>
|
||||
<?php print_string("auth_nntphost","auth") ?>
|
||||
<?php print_string("auth_multiplehosts","auth") ?>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
|
||||
+12
-9
@@ -8,19 +8,22 @@ function auth_user_login ($username, $password) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$host = "{".$CFG->auth_nntphost.":$CFG->auth_nntpport/nntp}";
|
||||
$hosts = split(';', $CFG->auth_nntphost); // Could be multiple hosts
|
||||
|
||||
error_reporting(0);
|
||||
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
|
||||
error_reporting($CFG->debug);
|
||||
foreach ($hosts as $host) { // Try each host in turn
|
||||
$host = '{'.trim($host).":$CFG->auth_nntpport/nntp}";
|
||||
|
||||
if ($connection) {
|
||||
imap_close($connection);
|
||||
return true;
|
||||
error_reporting(0);
|
||||
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
} else {
|
||||
return false;
|
||||
if ($connection) {
|
||||
imap_close($connection);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false; // No match
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$config->auth_pop3host = "127.0.0.1";
|
||||
}
|
||||
if (!isset($config->auth_pop3type)) {
|
||||
$config->auth_pop3type = "pop3";
|
||||
$config->auth_pop3type = "pop3notls";
|
||||
}
|
||||
if (!isset($config->auth_pop3port)) {
|
||||
$config->auth_pop3port = "110";
|
||||
@@ -17,13 +17,14 @@
|
||||
</TD>
|
||||
<TD>
|
||||
<?php print_string("auth_pop3host","auth") ?>
|
||||
<?php print_string("auth_multiplehosts","auth") ?>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
|
||||
<TD ALIGN=RIGHT><P>auth_pop3type:</TD>
|
||||
<TD>
|
||||
<?php $pop3types = array("pop3","pop3cert");
|
||||
<?php $pop3types = array("pop3","pop3cert", "pop3notls");
|
||||
foreach($pop3types as $pop3type) {
|
||||
$pop3options[$pop3type] = $pop3type;
|
||||
}
|
||||
|
||||
+27
-18
@@ -7,26 +7,35 @@ function auth_user_login ($username, $password) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
switch ($CFG->auth_pop3type) {
|
||||
case "pop3":
|
||||
$host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3/notls}INBOX";
|
||||
break;
|
||||
case "pop3cert":
|
||||
$host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3/ssl/novalidate-cert}INBOX";
|
||||
break;
|
||||
$hosts = split(';', $CFG->auth_pop3host); // Could be multiple hosts
|
||||
|
||||
foreach ($hosts as $host) { // Try each host in turn
|
||||
|
||||
$host = trim($host);
|
||||
|
||||
switch ($CFG->auth_pop3type) {
|
||||
case "pop3":
|
||||
$host = '{'.$host.":$CFG->auth_pop3port/pop3}INBOX";
|
||||
break;
|
||||
case "pop3notls":
|
||||
$host = '{'.$host.":$CFG->auth_pop3port/pop3/notls}INBOX";
|
||||
break;
|
||||
case "pop3cert":
|
||||
$host = '{'.$host.":$CFG->auth_pop3port/pop3/ssl/novalidate-cert}INBOX";
|
||||
break;
|
||||
}
|
||||
|
||||
error_reporting(0);
|
||||
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
if ($connection) {
|
||||
imap_close($connection);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
error_reporting(0);
|
||||
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
if ($connection) {
|
||||
imap_close($connection);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false; // No matches found
|
||||
}
|
||||
|
||||
|
||||
|
||||
+41
-5
@@ -5,8 +5,7 @@ This documment shows the current status of the backup/restore option.
|
||||
|
||||
Backup: WORKING. COMPLETED !!
|
||||
|
||||
Restore: WORKING. COMPLETED except logs.
|
||||
|
||||
Restore: WORKING. COMPLETED !!
|
||||
|
||||
========== ========== ========== ========== ========== ==========
|
||||
|
||||
@@ -49,6 +48,8 @@ Backup Details:
|
||||
- All..........................................DONE
|
||||
- Logs...............................................DONE
|
||||
- Scales.............................................DONE
|
||||
- Events.(course)....................................DONE
|
||||
- Groups.............................................DONE
|
||||
- Categories and Questions.(STEP 1)..................DONE
|
||||
+ categories......................................DONE
|
||||
+ questions structure.............................DONE
|
||||
@@ -57,6 +58,10 @@ Backup Details:
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files........................................DONE
|
||||
x attendances.....................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files.....(NOT EXISTS).......................DONE
|
||||
x chats...........................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
@@ -69,10 +74,18 @@ Backup Details:
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files........................................DONE
|
||||
x glosaries.......................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files........................................DONE
|
||||
x journals........................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files.(NOT EXISTS)...........................DONE
|
||||
x labels..........................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files.(NOT EXISTS)...........................DONE
|
||||
x quizzes.(STEP 2)................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
@@ -103,7 +116,16 @@ Backup Details:
|
||||
- Browse backup files........................................DONE
|
||||
- Download backup files......................................DONE
|
||||
- Delete backup files........................................DONE
|
||||
- Program automatic backups..................................NO EXISTS
|
||||
- Program scheduled backups..................................IN PROGRESS
|
||||
- Build a configuration inteface..........................DONE
|
||||
- Create the script.......................................DONE
|
||||
- Integrate it in cron....................................DONE
|
||||
- View logs...............................................IN PROGRESS
|
||||
- Send email..............................................DONE
|
||||
- Select manually the desired activities to backup...........NOT EXISTS
|
||||
- Modify the backup frontend..............................NOT EXISTS
|
||||
- Modify the backup of course_sections and course_modules.NOT EXISTS
|
||||
- Modify every module backuplib to work properly..........NOT EXISTS
|
||||
|
||||
Restore Details:
|
||||
===============
|
||||
@@ -156,6 +178,8 @@ Restore Details:
|
||||
+ categories......................................DONE
|
||||
+ questions structure.............................DONE
|
||||
- Scales.............................................DONE
|
||||
- Events.(course)....................................DONE
|
||||
- Groups.............................................DONE
|
||||
- Mods Info Prepare..................................DONE
|
||||
x read modules zone...............................DONE
|
||||
x separate every mod..............................DONE
|
||||
@@ -166,6 +190,10 @@ Restore Details:
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files........................................DONE
|
||||
x attendances.....................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files.(NOT EXISTS)...........................DONE
|
||||
x chats...........................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
@@ -178,10 +206,18 @@ Restore Details:
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files........................................DONE
|
||||
x glosaries.......................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files........................................DONE
|
||||
x journals........................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files.(NOT EXISTS)...........................DONE
|
||||
x labels..........................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
+ files.(NOT EXISTS)...........................DONE
|
||||
x quizzes.(STEP 2)................................DONE
|
||||
+ course data..................................DONE
|
||||
+ user data....................................DONE
|
||||
@@ -200,7 +236,7 @@ Restore Details:
|
||||
+ files........................................DONE
|
||||
- User files from temp.......................................DONE
|
||||
- Course files from temp.....................................DONE
|
||||
- Log entries................................................NO EXISTS
|
||||
- Log entries................................................DONE
|
||||
- Readjust instance in course_modules........................DONE
|
||||
- Readjust modinfo in course (serialize).....................DONE
|
||||
- Delete old entries at restore end. .......................DONE
|
||||
@@ -210,7 +246,7 @@ Restore Details:
|
||||
|
||||
========== ========== ========== =========== =========== =========== ===
|
||||
|
||||
This is all. It's no a little thing !!! :-)
|
||||
This is all. It isn't a little thing !!! :-)
|
||||
|
||||
Eloy (stronk7)
|
||||
29-04-2003
|
||||
|
||||
@@ -68,6 +68,8 @@
|
||||
error("Course ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
|
||||
//Print header
|
||||
if (isadmin()) {
|
||||
print_header("$site->shortname: $strcoursebackup", $site->fullname,
|
||||
|
||||
+33
-15
@@ -73,7 +73,7 @@
|
||||
}
|
||||
?>
|
||||
|
||||
<form name="form" method="post" <?php echo $onsubmit ?> action="<?php echo $ME ?>">
|
||||
<form name="form" method="post" action="<?php echo $ME ?>">
|
||||
<table cellpadding=5>
|
||||
<?php
|
||||
|
||||
@@ -83,22 +83,41 @@
|
||||
echo get_string("name").":";
|
||||
echo "</B></td><td>";
|
||||
//Calculate the backup string
|
||||
//Take off spaces in the filename !!
|
||||
$backup_name = str_replace(" ","_",strtolower(get_string("backupfilename")));
|
||||
|
||||
//Calculate the backup word
|
||||
//Take off some characters in the filename !!
|
||||
$takeoff = array(" ", ":", "/", "\\", "|");
|
||||
$backup_word = str_replace($takeoff,"_",strtolower(get_string("backupfilename")));
|
||||
//If non-translated, use "backup"
|
||||
if (substr($backup_name,0,1) == "[") {
|
||||
$backup_name = "backup";
|
||||
if (substr($backup_word,0,1) == "[") {
|
||||
$backup_word= "backup";
|
||||
}
|
||||
//Calculate the format string
|
||||
$backup_name_format = str_replace(" ","_",get_string("backupnameformat"));
|
||||
|
||||
//Calculate the date format string
|
||||
$backup_date_format = str_replace(" ","_",get_string("backupnameformat"));
|
||||
//If non-translated, use "%Y%m%d-%H%M"
|
||||
if (substr($backup_name_format,0,1) == "[") {
|
||||
$backup_name_format = "%%Y%%m%%d-%%H%%M";
|
||||
if (substr($backup_date_format,0,1) == "[") {
|
||||
$backup_date_format = "%%Y%%m%%d-%%H%%M";
|
||||
}
|
||||
$backup_name .= str_replace(" ","_","-".strtolower($course->shortname)."-".userdate(time(),$backup_name_format,99,false).".zip");
|
||||
echo $backup_name;
|
||||
//Add as hidden name
|
||||
echo "<input type=\"hidden\" name=\"backup_name\" value=\"".$backup_name."\">";
|
||||
|
||||
//Calculate the shortname
|
||||
$backup_shortname = clean_filename($course->shortname);
|
||||
if (empty($backup_shortname) or $backup_shortname == '_' ) {
|
||||
$backup_shortname = $course->id;
|
||||
}
|
||||
|
||||
//Calculate the final backup filename
|
||||
//The backup word
|
||||
$backup_name = $backup_word."-";
|
||||
//The shortname
|
||||
$backup_name .= strtolower($backup_shortname)."-";
|
||||
//The date format
|
||||
$backup_name .= userdate(time(),$backup_date_format,99,false);
|
||||
//The extension
|
||||
$backup_name .= ".zip";
|
||||
|
||||
//Add as text field
|
||||
echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backup_name."\">";
|
||||
echo "</td></tr>";
|
||||
|
||||
//Calculate the backup unique code to allow simultaneus backups (to define
|
||||
@@ -125,7 +144,7 @@
|
||||
$modbackup = $modname."_backup_mods";
|
||||
//If exists the lib & function
|
||||
$var = "exists_".$modname;
|
||||
if ($$var) {
|
||||
if (isset($$var) && $$var) {
|
||||
//Add hidden fields
|
||||
$var = "backup_".$modname;
|
||||
echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\">";
|
||||
@@ -161,7 +180,6 @@
|
||||
echo "<td colspan=\"2\"><P><B>";
|
||||
$user_options[0] = get_string("includeallusers");
|
||||
$user_options[1] = get_string("includecourseusers");
|
||||
///$user_options[2] = get_string("includeneededusers");--->NOT IMPLEMENTED
|
||||
echo "<li>".$user_options[$backup_users]."<P>";
|
||||
//Add as hidden name
|
||||
echo "<input type=\"hidden\" name=\"backup_users\" value=\"".$backup_users."\">";
|
||||
|
||||
+67
-18
@@ -136,7 +136,7 @@
|
||||
echo "<li>".get_string("deletingolddata");
|
||||
$status = backup_delete_old_data();
|
||||
if (!$status) {
|
||||
error ("An error has ocurred");
|
||||
error ("An error occurred deleting old backup data");
|
||||
}
|
||||
|
||||
//Create the moodle.xml file
|
||||
@@ -150,7 +150,9 @@
|
||||
echo "<li>".get_string("writinggeneralinfo");;
|
||||
//Prints general info about backup to file
|
||||
if ($backup_file) {
|
||||
$status = backup_general_info($backup_file,$preferences);
|
||||
if (!$status = backup_general_info($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up general info");
|
||||
}
|
||||
}
|
||||
echo "<li>".get_string("writingcoursedata");
|
||||
|
||||
@@ -160,12 +162,16 @@
|
||||
echo "<li>".get_string("courseinfo");
|
||||
//Prints course start (tag and general info)
|
||||
if ($status) {
|
||||
$status = backup_course_start($backup_file,$preferences);
|
||||
if (!$status = backup_course_start($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up course start");
|
||||
}
|
||||
}
|
||||
echo "<li>".get_string("sections");
|
||||
//Section info
|
||||
if ($status) {
|
||||
$status = backup_course_sections($backup_file,$preferences);
|
||||
if (!$status = backup_course_sections($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up course sections");
|
||||
}
|
||||
}
|
||||
|
||||
//End course contents (close ul)
|
||||
@@ -174,28 +180,52 @@
|
||||
echo "<li>".get_string("writinguserinfo");
|
||||
//User info
|
||||
if ($status) {
|
||||
$status = backup_user_info($backup_file,$preferences);
|
||||
if (!$status = backup_user_info($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up user info");
|
||||
}
|
||||
}
|
||||
|
||||
//If we have selected to backup quizzes, backup categories and
|
||||
//questions structure (step 1). See notes on mod/quiz/backuplib.php
|
||||
if ($status and $preferences->mods['quiz']->backup) {
|
||||
echo "<li>".get_string("writingcategoriesandquestions");
|
||||
$status = quiz_backup_question_categories($backup_file,$preferences);
|
||||
if (!$status = quiz_backup_question_categories($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up quiz categories");
|
||||
}
|
||||
}
|
||||
|
||||
//Print logs if selected
|
||||
if ($status) {
|
||||
if ($preferences->backup_logs) {
|
||||
echo "<li>".get_string("writingloginfo");
|
||||
$status = backup_log_info($backup_file,$preferences);
|
||||
if (!$status = backup_log_info($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up log info");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Print scales info
|
||||
if ($status) {
|
||||
echo "<li>".get_string("writingscalesinfo");
|
||||
$status = backup_scales_info($backup_file,$preferences);
|
||||
if (!$status = backup_scales_info($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up scales");
|
||||
}
|
||||
}
|
||||
|
||||
//Print groups info
|
||||
if ($status) {
|
||||
echo "<li>".get_string("writinggroupsinfo");
|
||||
if (!$status = backup_groups_info($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up groups");
|
||||
}
|
||||
}
|
||||
|
||||
//Print events info
|
||||
if ($status) {
|
||||
echo "<li>".get_string("writingeventsinfo");
|
||||
if (!$status = backup_events_info($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up events");
|
||||
}
|
||||
}
|
||||
|
||||
//Module info, this unique function makes all the work!!
|
||||
@@ -212,26 +242,34 @@
|
||||
if ($mods_to_backup) {
|
||||
echo "<li>".get_string("writingmoduleinfo");
|
||||
//Start modules tag
|
||||
$status = backup_modules_start ($backup_file,$preferences);
|
||||
if (!$status = backup_modules_start ($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up module info");
|
||||
}
|
||||
//Open ul for module list
|
||||
echo "<ul>";
|
||||
//Iterate over modules and call backup
|
||||
foreach ($preferences->mods as $module) {
|
||||
if ($module->backup and $status) {
|
||||
echo "<li>".get_string("modulenameplural",$module->name);
|
||||
$status = backup_module($backup_file,$preferences,$module->name);
|
||||
if (!$status = backup_module($backup_file,$preferences,$module->name)) {
|
||||
notify("An error occurred while backing up '$module->name'");
|
||||
}
|
||||
}
|
||||
}
|
||||
//Close ul for module list
|
||||
echo "</ul>";
|
||||
//Close modules tag
|
||||
$status = backup_modules_end ($backup_file,$preferences);
|
||||
if (!$status = backup_modules_end ($backup_file,$preferences)) {
|
||||
notify("An error occurred while finishing the module backups");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Prints course end
|
||||
if ($status) {
|
||||
$status = backup_course_end($backup_file,$preferences);
|
||||
if (!$status = backup_course_end($backup_file,$preferences)) {
|
||||
notify("An error occurred while closing the course backup");
|
||||
}
|
||||
}
|
||||
//Close the xml file and xml data
|
||||
if ($backup_file) {
|
||||
@@ -246,7 +284,9 @@
|
||||
if ($status) {
|
||||
if ($preferences->backup_user_files) {
|
||||
echo "<li>".get_string("copyinguserfiles");
|
||||
$status = backup_copy_user_files ($preferences);
|
||||
if (!$status = backup_copy_user_files ($preferences)) {
|
||||
notify("An error occurred while copying user files");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,26 +294,34 @@
|
||||
if ($status) {
|
||||
if ($preferences->backup_course_files) {
|
||||
echo "<li>".get_string("copyingcoursefiles");
|
||||
$status = backup_copy_course_files ($preferences);
|
||||
if (!$status = backup_copy_course_files ($preferences)) {
|
||||
notify("An error occurred while copying course files");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now, zip all the backup directory contents
|
||||
if ($status) {
|
||||
echo "<li>".get_string("zippingbackup");
|
||||
$status = backup_zip ($preferences);
|
||||
if (!$status = backup_zip ($preferences)) {
|
||||
notify("An error occurred while zipping the backup");
|
||||
}
|
||||
}
|
||||
|
||||
//Now, copy the zip file to course directory
|
||||
if ($status) {
|
||||
echo "<li>".get_string("copyingzipfile");
|
||||
$status = copy_zip_to_course_dir ($preferences);
|
||||
if (!$status = copy_zip_to_course_dir ($preferences)) {
|
||||
notify("An error occurred while copying the zip file to the course directory");
|
||||
}
|
||||
}
|
||||
|
||||
//Now, clean temporary data (db and filesystem)
|
||||
if ($status) {
|
||||
echo "<li>".get_string("cleaningtempdata");
|
||||
$status = clean_temp_data ($preferences);
|
||||
if (!$status = clean_temp_data ($preferences)) {
|
||||
notify("An error occurred while cleaning up temporary data");
|
||||
}
|
||||
}
|
||||
|
||||
//Ends th main ul
|
||||
@@ -286,7 +334,8 @@
|
||||
echo "</table>";
|
||||
|
||||
if (!$status) {
|
||||
error ("An error has ocurred");
|
||||
error ("The backup did not complete successfully",
|
||||
"$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
}
|
||||
|
||||
//Print final message
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
?>
|
||||
|
||||
<form name="form" method="post" <?php echo $onsubmit ?> action="<?php echo $ME ?>">
|
||||
<form name="form" method="post" action="<?php echo $ME ?>">
|
||||
<table cellpadding=5>
|
||||
<?php
|
||||
if ($allmods = get_records("modules") ) {
|
||||
@@ -83,7 +83,7 @@
|
||||
$modbackup = $modname."_backup_mods";
|
||||
//If exists the lib & function
|
||||
$var = "exists_".$modname;
|
||||
if ($$var) {
|
||||
if (isset($$var) && $$var) {
|
||||
//Print the full tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\"><P><B>";
|
||||
|
||||
@@ -0,0 +1,674 @@
|
||||
<?PHP //$Id$
|
||||
//This file contains all the code needed to execute scheduled backups
|
||||
|
||||
//This function is executed via moodle cron
|
||||
//It prepares all the info and execute backups as necessary
|
||||
function schedule_backup_cron() {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
$emailpending = false;
|
||||
|
||||
//Get now
|
||||
$now = time();
|
||||
|
||||
//First of all, we have to see if the scheduled is active and detect
|
||||
//that there isn't another cron running
|
||||
echo " Checking backup status";
|
||||
$backup_config = backup_get_config();
|
||||
if(!isset($backup_config->backup_sche_active) || !$backup_config->backup_sche_active) {
|
||||
echo "...INACTIVE\n";
|
||||
return true;
|
||||
} else if (isset($backup_config->backup_sche_running) && $backup_config->backup_sche_running) {
|
||||
echo "...RUNNING\n";
|
||||
//Now check if it's a really running task or something very old looking
|
||||
//for info in backup_logs to unlock status as necessary
|
||||
$timetosee = 1800; //Half an hour looking for activity
|
||||
$timeafter = time() - $timetosee;
|
||||
$numofrec = count_records_select ("backup_log","time > $timeafter");
|
||||
if (!$numofrec) {
|
||||
$timetoseemin = $timetosee/60;
|
||||
echo " No activity in last ".$timetoseemin." minutes. Unlocking status\n";
|
||||
} else {
|
||||
echo " Scheduled backup seems to be running. Execution delayed\n";
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
echo "...OK\n";
|
||||
//Mark backup_sche_running
|
||||
backup_set_config("backup_sche_running","1");
|
||||
}
|
||||
|
||||
//Now we get the main admin user (we'll use his timezone, mail...)
|
||||
echo " Getting admin info\n";
|
||||
$admin = get_admin();
|
||||
if (!$admin) {
|
||||
$status = false;
|
||||
}
|
||||
|
||||
//Now we get a list of courses in the server
|
||||
if ($status) {
|
||||
echo " Checking courses\n";
|
||||
$courses = get_records("course");
|
||||
//For each course, we check (insert, update) the backup_course table
|
||||
//with needed data
|
||||
foreach ($courses as $course) {
|
||||
if ($status) {
|
||||
echo " $course->fullname\n";
|
||||
//We check if the course exists in backup_course
|
||||
$backup_course = get_record("backup_courses","courseid",$course->id);
|
||||
//If it doesn't exist, create
|
||||
if (!$backup_course) {
|
||||
$temp_backup_course->courseid = $course->id;
|
||||
$newid = insert_record("backup_courses",$temp_backup_course);
|
||||
//And get it from db
|
||||
$backup_course = get_record("backup_courses","id",$newid);
|
||||
}
|
||||
//If it doesn't exist now, error
|
||||
if (!$backup_course) {
|
||||
echo " ERROR (in backup_courses detection)\n";
|
||||
$status = false;
|
||||
}
|
||||
//Now we backup every course with nextstarttime < now
|
||||
if ($backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
|
||||
//Set laststarttime
|
||||
$starttime = time();
|
||||
set_field("backup_courses","laststarttime",$starttime,"courseid",$backup_course->courseid);
|
||||
//Launch backup
|
||||
$course_status = schedule_backup_launch_backup($course,$starttime);
|
||||
//We have to send a email because we have included at least one backup
|
||||
$emailpending = true;
|
||||
//Set lastendtime
|
||||
set_field("backup_courses","lastendtime",time(),"courseid",$backup_course->courseid);
|
||||
//Set laststatus
|
||||
if ($course_status) {
|
||||
set_field("backup_courses","laststatus","1","courseid",$backup_course->courseid);
|
||||
} else {
|
||||
set_field("backup_courses","laststatus","0","courseid",$backup_course->courseid);
|
||||
}
|
||||
}
|
||||
|
||||
//Now, calculate next execution of the course
|
||||
$nextstarttime = schedule_backup_next_execution ($backup_course,$backup_config,$now,$admin->timezone);
|
||||
//Save it to db
|
||||
set_field("backup_courses","nextstarttime",$nextstarttime,"courseid",$backup_course->courseid);
|
||||
//Print it to screen as necessary
|
||||
$showtime = "undefined";
|
||||
if ($nextstarttime > 0) {
|
||||
$showtime = userdate($nextstarttime,"",$admin->timezone);
|
||||
}
|
||||
echo " Next execution: $showtime\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Delete old logs
|
||||
if (!empty($CFG->loglifetime)) {
|
||||
echo " Deleting old logs\n";
|
||||
$loglifetime = $now - ($CFG->loglifetime * 86400);
|
||||
delete_records_select("backup_log", "laststarttime < '$loglifetime'");
|
||||
}
|
||||
|
||||
//Send email to admin
|
||||
if ($emailpending) {
|
||||
echo " Sending email to admin\n";
|
||||
$message = "";
|
||||
//Build the message text (future versions should handle html messages too!!)
|
||||
$logs = get_records_select ("backup_log","laststarttime >= '$now'","id");
|
||||
if ($logs) {
|
||||
$currentcourse = 1;
|
||||
foreach ($logs as $log) {
|
||||
if ($currentcourse != $log->courseid) {
|
||||
$message .= "\n==================================================\n\n";
|
||||
$currentcourse = $log->courseid;
|
||||
}
|
||||
$message .= userdate($log->time,"%T",$admin->timezone)." ".$log->info."\n";
|
||||
}
|
||||
}
|
||||
//Send the message
|
||||
$site = get_site();
|
||||
email_to_user($admin,$admin,"$site->shortname: ".get_string("scheduledbackupstatus"),$message);
|
||||
}
|
||||
|
||||
|
||||
//Everything is finished stop backup_sche_running
|
||||
backup_set_config("backup_sche_running","0");
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
//This function executes the ENTIRE backup of a course (passed as parameter)
|
||||
//using all the scheduled backup preferences
|
||||
function schedule_backup_launch_backup($course,$starttime = 0) {
|
||||
|
||||
$preferences = false;
|
||||
$status = false;
|
||||
|
||||
echo " Executing backup\n";
|
||||
schedule_backup_log($starttime,$course->id,"Start backup course $course->fullname");
|
||||
schedule_backup_log($starttime,$course->id," Phase 1: Checking and counting:");
|
||||
$preferences = schedule_backup_course_configure($course,$starttime);
|
||||
|
||||
if ($preferences) {
|
||||
schedule_backup_log($starttime,$course->id," Phase 2: Executing and copying:");
|
||||
$status = schedule_backup_course_execute($preferences,$starttime);
|
||||
}
|
||||
if ($status && $preferences) {
|
||||
//Only if the backup_sche_keep is set
|
||||
if ($preferences->backup_keep) {
|
||||
schedule_backup_log($starttime,$course->id," Phase 3: Deleting old backup files:");
|
||||
$status = schedule_backup_course_delete_old_files($preferences,$starttime);
|
||||
}
|
||||
}
|
||||
if ($status && $preferences) {
|
||||
echo " End backup OK\n";
|
||||
schedule_backup_log($starttime,$course->id,"End backup course $course->fullname - OK");
|
||||
} else {
|
||||
echo " End backup with ERROR\n";
|
||||
schedule_backup_log($starttime,$course->id,"End backup course $course->fullname - ERROR!!");
|
||||
}
|
||||
|
||||
return $status && $preferences;
|
||||
}
|
||||
|
||||
//This function saves to backup_log all the needed process info
|
||||
//to use it later. NOTE: If $starttime = 0 no info in saved
|
||||
function schedule_backup_log($starttime,$courseid,$message) {
|
||||
|
||||
if ($starttime) {
|
||||
$log->courseid = $courseid;
|
||||
$log->time = time();
|
||||
$log->laststarttime = $starttime;
|
||||
$log->info = $message;
|
||||
|
||||
insert_record ("backup_log",$log);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//This function returns the next future GMT time to execute the course based in the
|
||||
//configuration of the scheduled backups
|
||||
function schedule_backup_next_execution ($backup_course,$backup_config,$now,$timezone) {
|
||||
|
||||
$result = -1;
|
||||
|
||||
//Get today's midnight GMT
|
||||
$midnight = usergetmidnight($now,$timezone);
|
||||
|
||||
//Get today's day of week (0=Sunday...6=Saturday)
|
||||
$date = usergetdate($now,$timezone);
|
||||
$dayofweek = $date['wday'];
|
||||
|
||||
//Get number of days (from today) to execute backups
|
||||
$scheduled_days = substr($backup_config->backup_sche_weekdays,$dayofweek).
|
||||
$backup_config->backup_sche_weekdays;
|
||||
$daysfromtoday = strpos($scheduled_days, "1");
|
||||
|
||||
//If some day has been found
|
||||
if ($daysfromtoday !== false) {
|
||||
//Calculate distance
|
||||
$dist = ($daysfromtoday * 86400) + //Days distance
|
||||
($backup_config->backup_sche_hour*3600) + //Hours distance
|
||||
($backup_config->backup_sche_minute*60); //Minutes distance
|
||||
$result = $midnight + $dist;
|
||||
}
|
||||
|
||||
//If that time is past, call the function recursively to obtain the next valid day
|
||||
if ($result > 0 && $result < time()) {
|
||||
$result = schedule_backup_next_execution ($backup_course,$backup_config,$now + 86400,$timezone);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//This function implements all the needed code to prepare a course
|
||||
//to be in backup (insert temp info into backup temp tables).
|
||||
function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
schedule_backup_log($starttime,$course->id," checking parameters");
|
||||
|
||||
//Check the required variable
|
||||
if (empty($course->id)) {
|
||||
$status = false;
|
||||
}
|
||||
//Get scheduled backup preferences
|
||||
$backup_config = backup_get_config();
|
||||
|
||||
//Checks backup_config pairs exist
|
||||
if ($status) {
|
||||
if (!isset($backup_config->backup_sche_modules)) {
|
||||
$backup_config->backup_sche_modules = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_withuserdata)) {
|
||||
$backup_config->backup_sche_withuserdata = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_users)) {
|
||||
$backup_config->backup_sche_users = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_logs)) {
|
||||
$backup_config->backup_sche_logs = 0;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_userfiles)) {
|
||||
$backup_config->backup_sche_userfiles = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_coursefiles)) {
|
||||
$backup_config->backup_sche_coursefiles = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_active)) {
|
||||
$backup_config->backup_sche_active = 0;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_weekdays)) {
|
||||
$backup_config->backup_sche_weekdays = "0000000";
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_hour)) {
|
||||
$backup_config->backup_sche_hour = 00;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_minute)) {
|
||||
$backup_config->backup_sche_minute = 00;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_destination)) {
|
||||
$backup_config->backup_sche_destination = "";
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_keep)) {
|
||||
$backup_config->backup_sche_keep = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
//Checks for the required files/functions to backup every mod
|
||||
//And check if there is data about it
|
||||
$count = 0;
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
|
||||
$modbackup = $modname."_backup_mods";
|
||||
$modcheckbackup = $modname."_check_backup_mods";
|
||||
if (file_exists($modfile)) {
|
||||
include_once($modfile);
|
||||
if (function_exists($modbackup) and function_exists($modcheckbackup)) {
|
||||
$var = "exists_".$modname;
|
||||
$$var = true;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
//Check data
|
||||
//Check module info
|
||||
$var = "backup_".$modname;
|
||||
if (!isset($$var)) {
|
||||
$$var = $backup_config->backup_sche_modules;
|
||||
}
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->backup = $$var;
|
||||
|
||||
//Check include user info
|
||||
$var = "backup_user_info_".$modname;
|
||||
if (!isset($$var)) {
|
||||
$$var = $backup_config->backup_sche_withuserdata;
|
||||
}
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->userinfo = $$var;
|
||||
//And the name of the mod
|
||||
$preferences->mods[$modname]->name = $modname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Convert other parameters
|
||||
if ($status) {
|
||||
$preferences->backup_users = $backup_config->backup_sche_users;
|
||||
$preferences->backup_logs = $backup_config->backup_sche_logs;
|
||||
$preferences->backup_user_files = $backup_config->backup_sche_userfiles;
|
||||
$preferences->backup_course_files = $backup_config->backup_sche_coursefiles;
|
||||
$preferences->backup_course = $course->id;
|
||||
$preferences->backup_destination = $backup_config->backup_sche_destination;
|
||||
$preferences->backup_keep = $backup_config->backup_sche_keep;
|
||||
}
|
||||
|
||||
//Calculate the backup string
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$course->id," calculating backup name");
|
||||
|
||||
//Calculate the backup word
|
||||
//Take off some characters in the filename !!
|
||||
$takeoff = array(" ", ":", "/", "\\", "|");
|
||||
$backup_word = str_replace($takeoff,"_",strtolower(get_string("backupfilename")));
|
||||
//If non-translated, use "backup"
|
||||
if (substr($backup_word,0,1) == "[") {
|
||||
$backup_word= "backup";
|
||||
}
|
||||
|
||||
//Calculate the date format string
|
||||
$backup_date_format = str_replace(" ","_",get_string("backupnameformat"));
|
||||
//If non-translated, use "%Y%m%d-%H%M"
|
||||
if (substr($backup_date_format,0,1) == "[") {
|
||||
$backup_date_format = "%%Y%%m%%d-%%H%%M";
|
||||
}
|
||||
|
||||
//Calculate the shortname
|
||||
$backup_shortname = clean_filename($course->shortname);
|
||||
if (empty($backup_shortname) or $backup_shortname == '_' ) {
|
||||
$backup_shortname = $course->id;
|
||||
}
|
||||
|
||||
//Calculate the final backup filename
|
||||
//The backup word
|
||||
$backup_name = $backup_word."-";
|
||||
//The shortname
|
||||
$backup_name .= strtolower($backup_shortname)."-";
|
||||
//The date format
|
||||
$backup_name .= userdate(time(),$backup_date_format,99,false);
|
||||
//The extension
|
||||
$backup_name .= ".zip";
|
||||
|
||||
//Calculate the string to match the keep preference
|
||||
$keep_name = $backup_word."-";
|
||||
//The shortname
|
||||
$keep_name .= strtolower($backup_shortname)."-";
|
||||
|
||||
$preferences->backup_name = $backup_name;
|
||||
$preferences->keep_name = $keep_name;
|
||||
}
|
||||
|
||||
//Calculate the backup unique code to allow simultaneus backups (to define
|
||||
//the temp-directory name and records in backup temp tables
|
||||
if ($status) {
|
||||
$backup_unique_code = time();
|
||||
$preferences->backup_unique_code = $backup_unique_code;
|
||||
}
|
||||
|
||||
//Calculate necesary info to backup modules
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$course->id," calculating modules data");
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modbackup = $modname."_backup_mods";
|
||||
//If exists the lib & function
|
||||
$var = "exists_".$modname;
|
||||
if (isset($$var) && $$var) {
|
||||
//Add hidden fields
|
||||
$var = "backup_".$modname;
|
||||
//Only if selected
|
||||
if ($$var == 1) {
|
||||
$var = "backup_user_info_".$modname;
|
||||
//Call the check function to show more info
|
||||
$modcheckbackup = $modname."_check_backup_mods";
|
||||
schedule_backup_log($starttime,$course->id," $modname");
|
||||
$modcheckbackup($course->id,$$var,$backup_unique_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now calculate the users
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$course->id," calculating users");
|
||||
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users);
|
||||
}
|
||||
|
||||
//Now calculate the logs
|
||||
if ($status) {
|
||||
if ($preferences->backup_logs) {
|
||||
schedule_backup_log($starttime,$course->id," calculating logs");
|
||||
log_check_backup($course->id);
|
||||
}
|
||||
}
|
||||
|
||||
//Now calculate the userfiles
|
||||
if ($status) {
|
||||
if ($preferences->backup_user_files) {
|
||||
schedule_backup_log($starttime,$course->id," calculating user files");
|
||||
user_files_check_backup($course->id,$preferences->backup_unique_code);
|
||||
}
|
||||
}
|
||||
|
||||
//Now calculate the coursefiles
|
||||
if ($status) {
|
||||
if ($preferences->backup_course_files) {
|
||||
schedule_backup_log($starttime,$course->id," calculating course files");
|
||||
course_files_check_backup($course->id,$preferences->backup_unique_code);
|
||||
}
|
||||
}
|
||||
|
||||
//If everything is ok, return calculated preferences
|
||||
if ($status) {
|
||||
$status = $preferences;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
//This function implements all the needed code to backup a course
|
||||
//copying it to the desired destination (default if not specified)
|
||||
function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
//Another Info to add
|
||||
$preferences->moodle_version = $CFG->version;
|
||||
$preferences->moodle_release = $CFG->release;
|
||||
$preferences->backup_version = $CFG->backup_version;
|
||||
$preferences->backup_release = $CFG->backup_release;
|
||||
|
||||
//Check for temp and backup and backup_unique_code directory
|
||||
//Create them as needed
|
||||
schedule_backup_log($starttime,$preferences->backup_course," checking temp structures");
|
||||
$status = check_and_create_backup_dir($preferences->backup_unique_code);
|
||||
//Empty dir
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," cleaning old data");
|
||||
$status = clear_backup_dir($preferences->backup_unique_code);
|
||||
}
|
||||
|
||||
//Delete old_entries from backup tables
|
||||
if ($status) {
|
||||
$status = backup_delete_old_data();
|
||||
}
|
||||
|
||||
//Create the moodle.xml file
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," creating backup file");
|
||||
//Obtain the xml file (create and open) and print prolog information
|
||||
$backup_file = backup_open_xml($preferences->backup_unique_code);
|
||||
//Prints general info about backup to file
|
||||
if ($backup_file) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," general info");
|
||||
$status = backup_general_info($backup_file,$preferences);
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
|
||||
//Prints course start (tag and general info)
|
||||
if ($status) {
|
||||
$status = backup_course_start($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Section info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," sections info");
|
||||
$status = backup_course_sections($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//User info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," user info");
|
||||
$status = backup_user_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//If we have selected to backup quizzes, backup categories and
|
||||
//questions structure (step 1). See notes on mod/quiz/backuplib.php
|
||||
if ($status and $preferences->mods['quiz']->backup) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," categories & questions");
|
||||
$status = quiz_backup_question_categories($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print logs if selected
|
||||
if ($status) {
|
||||
if ($preferences->backup_logs) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," logs");
|
||||
$status = backup_log_info($backup_file,$preferences);
|
||||
}
|
||||
}
|
||||
|
||||
//Print scales info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," scales");
|
||||
$status = backup_scales_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print groups info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," groups");
|
||||
$status = backup_groups_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print events info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," events");
|
||||
$status = backup_events_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Module info, this unique function makes all the work!!
|
||||
//db export and module fileis copy
|
||||
if ($status) {
|
||||
$mods_to_backup = false;
|
||||
//Check if we have any mod to backup
|
||||
foreach ($preferences->mods as $module) {
|
||||
if ($module->backup) {
|
||||
$mods_to_backup = true;
|
||||
}
|
||||
}
|
||||
//If we have to backup some module
|
||||
if ($mods_to_backup) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," modules");
|
||||
//Start modules tag
|
||||
$status = backup_modules_start ($backup_file,$preferences);
|
||||
//Iterate over modules and call backup
|
||||
foreach ($preferences->mods as $module) {
|
||||
if ($module->backup and $status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," $module->name");
|
||||
$status = backup_module($backup_file,$preferences,$module->name);
|
||||
}
|
||||
}
|
||||
//Close modules tag
|
||||
$status = backup_modules_end ($backup_file,$preferences);
|
||||
}
|
||||
}
|
||||
|
||||
//Prints course end
|
||||
if ($status) {
|
||||
$status = backup_course_end($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Close the xml file and xml data
|
||||
if ($backup_file) {
|
||||
backup_close_xml($backup_file);
|
||||
}
|
||||
}
|
||||
|
||||
//Now, if selected, copy user files
|
||||
if ($status) {
|
||||
if ($preferences->backup_user_files) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," copying user files");
|
||||
$status = backup_copy_user_files ($preferences);
|
||||
}
|
||||
}
|
||||
|
||||
//Now, if selected, copy course files
|
||||
if ($status) {
|
||||
if ($preferences->backup_course_files) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," copying course files");
|
||||
$status = backup_copy_course_files ($preferences);
|
||||
}
|
||||
}
|
||||
|
||||
//Now, zip all the backup directory contents
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," zipping files");
|
||||
$status = backup_zip ($preferences);
|
||||
}
|
||||
|
||||
//Now, copy the zip file to course directory
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," copying backup");
|
||||
$status = copy_zip_to_course_dir ($preferences);
|
||||
}
|
||||
|
||||
//Now, clean temporary data (db and filesystem)
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," cleaning temp data");
|
||||
$status = clean_temp_data ($preferences);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
//This function deletes old backup files when the "keep" limit has been reached
|
||||
//in the destination directory.
|
||||
function schedule_backup_course_delete_old_files($preferences,$starttime=0) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
//Calculate the directory to check
|
||||
$dirtocheck = "";
|
||||
//if $preferences->backup_destination isn't empty, then check that directory
|
||||
if (!empty($preferences->backup_destination)) {
|
||||
$dirtocheck = $preferences->backup_destination;
|
||||
//else calculate standard backup directory location
|
||||
} else {
|
||||
$dirtocheck = $CFG->dataroot."/".$preferences->backup_course."/backupdata";
|
||||
}
|
||||
schedule_backup_log($starttime,$preferences->backup_course," checking $dirtocheck");
|
||||
echo " Keeping backup files in $dirtocheck\n";
|
||||
|
||||
//Get all the files in $dirtocheck
|
||||
$files = get_directory_list($dirtocheck,"",false);
|
||||
//Get all matching files ($preferences->keep_name) from $files
|
||||
$matchingfiles = array();
|
||||
foreach ($files as $file) {
|
||||
if (substr($file, 0, strlen($preferences->keep_name)) == $preferences->keep_name) {
|
||||
$modifieddate = filemtime($dirtocheck."/".$file);
|
||||
$matchingfiles[$modifieddate] = $file;
|
||||
}
|
||||
}
|
||||
//Sort by key (modified date) to get the oldest first (instead of doing that by name
|
||||
//because it could give us problems in some languages with different format names).
|
||||
ksort($matchingfiles);
|
||||
|
||||
//Count matching files
|
||||
$countmatching = count($matchingfiles);
|
||||
schedule_backup_log($starttime,$preferences->backup_course," found $countmatching backup files");
|
||||
echo " found $countmatching backup files\n";
|
||||
if ($preferences->backup_keep < $countmatching) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," keep limit ($preferences->backup_keep) reached. Deleting old files");
|
||||
echo " keep limit ($preferences->backup_keep) reached. Deleting old files\n";
|
||||
$filestodelete = $countmatching - $preferences->backup_keep;
|
||||
$filesdeleted = 0;
|
||||
foreach ($matchingfiles as $matchfile) {
|
||||
if ($filesdeleted < $filestodelete) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," $matchfile deleted");
|
||||
echo " $matchfile deleted\n";
|
||||
$filetodelete = $dirtocheck."/".$matchfile;
|
||||
unlink($filetodelete);
|
||||
$filesdeleted++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
?>
|
||||
+339
-56
@@ -32,61 +32,75 @@
|
||||
//Return an array of info (name,value)
|
||||
function user_check_backup($course,$backup_unique_code,$backup_users) {
|
||||
//$backup_users=0-->all
|
||||
// 1-->course
|
||||
// 2-->needed-->NOT IMPLEMEMTED
|
||||
// 1-->course (needed + enrolled)
|
||||
|
||||
global $CFG;
|
||||
global $db;
|
||||
|
||||
$count_users = 0;
|
||||
|
||||
//Select all users from user (only id)
|
||||
//If there are a lot of users and we retrieve all the info->memory shortage !!
|
||||
$users = get_records ("user","","","","id,id");
|
||||
//If we have users
|
||||
if ($users) {
|
||||
//Calculate needed users (calling every xxxx_get_participants function + scales users)
|
||||
$needed_users = backup_get_needed_users($course);
|
||||
|
||||
//Calculate enrolled users (students + teachers)
|
||||
$enrolled_users = backup_get_enrolled_users($course);
|
||||
|
||||
//Calculate all users (every record in users table)
|
||||
$all_users = backup_get_all_users();
|
||||
|
||||
//Calculate course users (needed + enrolled)
|
||||
//First, needed
|
||||
$course_users = $needed_users;
|
||||
|
||||
//Now, enrolled
|
||||
if ($enrolled_users) {
|
||||
foreach ($enrolled_users as $enrolled_user) {
|
||||
$course_users[$enrolled_user->id]->id = $enrolled_user->id;
|
||||
}
|
||||
}
|
||||
|
||||
//Now, depending of parameters, create $backupable_users
|
||||
if ($backup_users == 0) {
|
||||
$backupable_users = $all_users;
|
||||
} else {
|
||||
$backupable_users = $course_users;
|
||||
}
|
||||
|
||||
//If we have backupable users
|
||||
if ($backupable_users) {
|
||||
//Iterate over users putting their roles
|
||||
foreach ($users as $user) {
|
||||
$user->info = "";
|
||||
foreach ($backupable_users as $backupable_user) {
|
||||
$backupable_user->info = "";
|
||||
//Is Admin in tables (not is_admin()) !!
|
||||
if (record_exists("user_admins","userid",$user->id)) {
|
||||
$user->info .= "admin";
|
||||
$user->role_admin = true;
|
||||
if (record_exists("user_admins","userid",$backupable_user->id)) {
|
||||
$backupable_user->info .= "admin";
|
||||
}
|
||||
//Is Course Creator in tables (not is_coursecreator()) !!
|
||||
if (record_exists("user_coursecreators","userid",$user->id)) {
|
||||
$user->info .= "coursecreator";
|
||||
$user->role_coursecreator = true;
|
||||
if (record_exists("user_coursecreators","userid",$backupable_user->id)) {
|
||||
$backupable_user->info .= "coursecreator";
|
||||
}
|
||||
//Is Teacher in tables (not is_teacher()) !!
|
||||
if (record_exists("user_teachers","course",$course,"userid",$user->id)) {
|
||||
$user->info .= "teacher";
|
||||
$user->role_teacher = true;
|
||||
if (record_exists("user_teachers","course",$course,"userid",$backupable_user->id)) {
|
||||
$backupable_user->info .= "teacher";
|
||||
}
|
||||
//Is Student in tables (not is_student()) !!
|
||||
if (record_exists("user_students","course",$course,"userid",$user->id)) {
|
||||
$user->info .= "student";
|
||||
$user->role_student = true;
|
||||
if (record_exists("user_students","course",$course,"userid",$backupable_user->id)) {
|
||||
$backupable_user->info .= "student";
|
||||
}
|
||||
//Is needed user (exists in needed_users)
|
||||
if (isset($needed_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
}
|
||||
//Now create the backup_id record
|
||||
$backupids_rec->backup_code = $backup_unique_code;
|
||||
$backupids_rec->table_name = "user";
|
||||
$backupids_rec->old_id = $user->id;
|
||||
$backupids_rec->info = $user->info;
|
||||
$backupids_rec->old_id = $backupable_user->id;
|
||||
$backupids_rec->info = $backupable_user->info;
|
||||
|
||||
//Insert the record id. backup_users decide it.
|
||||
//When all users
|
||||
if ($backup_users == 0) {
|
||||
$status = insert_record("backup_ids",$backupids_rec,false);
|
||||
$count_users++;
|
||||
//When course users
|
||||
} else if ($backup_users == 1) {
|
||||
//Only if user has any role
|
||||
if ($backupids_rec->info) {
|
||||
$status = insert_record("backup_ids",$backupids_rec,false);
|
||||
$count_users++;
|
||||
}
|
||||
}
|
||||
$status = insert_record("backup_ids",$backupids_rec,false,"backup_code");
|
||||
$count_users++;
|
||||
}
|
||||
//Do some output
|
||||
backup_flush(30);
|
||||
@@ -100,6 +114,117 @@
|
||||
return $info;
|
||||
}
|
||||
|
||||
//Returns every needed user (participant) in a course
|
||||
//It uses the xxxx_get_participants() function
|
||||
//plus users needed to backup scales.
|
||||
//WARNING: It returns only NEEDED users, not every
|
||||
// every student and teacher in the course, so it
|
||||
//must be merged with backup_get_enrrolled_users !!
|
||||
|
||||
function backup_get_needed_users ($courseid) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$result = false;
|
||||
|
||||
$course_modules = get_records_sql ("SELECT cm.id, m.name, cm.instance
|
||||
FROM {$CFG->prefix}modules m,
|
||||
{$CFG->prefix}course_modules cm
|
||||
WHERE m.id = cm.module and
|
||||
cm.course = '$courseid'");
|
||||
|
||||
if ($course_modules) {
|
||||
//Iterate over each module
|
||||
foreach ($course_modules as $course_module) {
|
||||
$modlib = "$CFG->dirroot/mod/$course_module->name/lib.php";
|
||||
$modgetparticipants = $course_module->name."_get_participants";
|
||||
if (file_exists($modlib)) {
|
||||
include_once($modlib);
|
||||
if (function_exists($modgetparticipants)) {
|
||||
$module_participants = $modgetparticipants($course_module->instance);
|
||||
//Add them to result
|
||||
if ($module_participants) {
|
||||
foreach ($module_participants as $module_participant) {
|
||||
$result[$module_participant->id]->id = $module_participant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now, add scales users (from site and course scales)
|
||||
//Get users
|
||||
$scaleusers = get_records_sql("SELECT DISTINCT userid,userid
|
||||
FROM {$CFG->prefix}scale
|
||||
WHERE courseid = '0' or courseid = '$courseid'");
|
||||
//Add scale users to results
|
||||
if ($scaleusers) {
|
||||
foreach ($scaleusers as $scaleuser) {
|
||||
//If userid != 0
|
||||
if ($scaleuser->userid != 0) {
|
||||
$result[$scaleuser->userid]->id = $scaleuser->userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
//Returns every enrolled user (student and teacher) in a course
|
||||
|
||||
function backup_get_enrolled_users ($courseid) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$result = false;
|
||||
|
||||
//Get teachers
|
||||
$teachers = get_records_sql("SELECT DISTINCT userid,userid
|
||||
FROM {$CFG->prefix}user_teachers
|
||||
WHERE course = '$courseid'");
|
||||
//Get students
|
||||
$students = get_records_sql("SELECT DISTINCT userid,userid
|
||||
FROM {$CFG->prefix}user_students
|
||||
WHERE course = '$courseid'");
|
||||
//Add teachers
|
||||
if ($teachers) {
|
||||
foreach ($teachers as $teacher) {
|
||||
$result[$teacher->userid]->id = $teacher->userid;
|
||||
}
|
||||
}
|
||||
//Add students
|
||||
if ($students) {
|
||||
foreach ($students as $student) {
|
||||
$result[$student->userid]->id = $student->userid;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Returns all users (every record in users table)
|
||||
|
||||
function backup_get_all_users() {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$result = false;
|
||||
|
||||
//Get users
|
||||
$users = get_records_sql("SELECT DISTINCT id,id
|
||||
FROM {$CFG->prefix}user");
|
||||
//Add users
|
||||
if ($users) {
|
||||
foreach ($users as $user) {
|
||||
$result[$user->id]->id = $user->id;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Calculate the number of log entries to backup
|
||||
//Return an array of info (name,value)
|
||||
function log_check_backup($course) {
|
||||
@@ -433,6 +558,11 @@
|
||||
fwrite ($bf,full_tag("STARTDATE",3,false,$course->startdate));
|
||||
fwrite ($bf,full_tag("NUMSECTIONS",3,false,$course->numsections));
|
||||
fwrite ($bf,full_tag("SHOWRECENT",3,false,$course->showrecent));
|
||||
fwrite ($bf,full_tag("MAXBYTES",3,false,$course->maxbytes));
|
||||
fwrite ($bf,full_tag("SHOWREPORTS",3,false,$course->showreports));
|
||||
fwrite ($bf,full_tag("GROUPMODE",3,false,$course->groupmode));
|
||||
fwrite ($bf,full_tag("GROUPMODEFORCE",3,false,$course->groupmodeforce));
|
||||
fwrite ($bf,full_tag("LANG",3,false,$course->lang));
|
||||
fwrite ($bf,full_tag("MARKER",3,false,$course->marker));
|
||||
fwrite ($bf,full_tag("VISIBLE",3,false,$course->visible));
|
||||
fwrite ($bf,full_tag("TIMECREATED",3,false,$course->timecreated));
|
||||
@@ -530,7 +660,9 @@
|
||||
fwrite ($bf,full_tag("ADDED",6,false,$course_module[$tok]->added));
|
||||
fwrite ($bf,full_tag("DELETED",6,false,$course_module[$tok]->deleted));
|
||||
fwrite ($bf,full_tag("SCORE",6,false,$course_module[$tok]->score));
|
||||
fwrite ($bf,full_tag("INDENT",6,false,$course_module[$tok]->indent));
|
||||
fwrite ($bf,full_tag("VISIBLE",6,false,$course_module[$tok]->visible));
|
||||
fwrite ($bf,full_tag("GROUPMODE",6,false,$course_module[$tok]->groupmode));
|
||||
fwrite ($bf,end_tag("MOD",5,true));
|
||||
}
|
||||
//check for next
|
||||
@@ -580,6 +712,7 @@
|
||||
fwrite ($bf,full_tag("FIRSTNAME",4,false,$user_data->firstname));
|
||||
fwrite ($bf,full_tag("LASTNAME",4,false,$user_data->lastname));
|
||||
fwrite ($bf,full_tag("EMAIL",4,false,$user_data->email));
|
||||
fwrite ($bf,full_tag("EMAILSTOP",4,false,$user_data->emailstop));
|
||||
fwrite ($bf,full_tag("ICQ",4,false,$user_data->icq));
|
||||
fwrite ($bf,full_tag("PHONE1",4,false,$user_data->phone1));
|
||||
fwrite ($bf,full_tag("PHONE2",4,false,$user_data->phone2));
|
||||
@@ -610,10 +743,12 @@
|
||||
$user->iscoursecreator = strpos($user->info,"coursecreator");
|
||||
$user->isteacher = strpos($user->info,"teacher");
|
||||
$user->isstudent = strpos($user->info,"student");
|
||||
$user->isneeded = strpos($user->info,"needed");
|
||||
if ($user->isadmin!==false or
|
||||
$user->iscoursecreator!==false or
|
||||
$user->isteacher!==false or
|
||||
$user->isstudent!==false) {
|
||||
$user->isstudent!==false or
|
||||
$user->isneeded!==false) {
|
||||
//Begin ROLES tag
|
||||
fwrite ($bf,start_tag("ROLES",4,true));
|
||||
//PRINT ROLE INFO
|
||||
@@ -647,6 +782,7 @@
|
||||
fwrite ($bf,full_tag("TEA_ROLE",6,false,$tea->role));
|
||||
fwrite ($bf,full_tag("EDITALL",6,false,$tea->editall));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$tea->timemodified));
|
||||
fwrite ($bf,full_tag("TIMEACCESS",6,false,$tea->timeaccess));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
@@ -661,13 +797,38 @@
|
||||
fwrite ($bf,full_tag("TIMESTART",6,false,$stu->timestart));
|
||||
fwrite ($bf,full_tag("TIMEEND",6,false,$stu->timeend));
|
||||
fwrite ($bf,full_tag("TIME",6,false,$stu->time));
|
||||
fwrite ($bf,full_tag("TIMEACCESS",6,false,$stu->timeaccess));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
|
||||
//Needed
|
||||
if ($user->isneeded!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"needed"));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
|
||||
//End ROLES tag
|
||||
fwrite ($bf,end_tag("ROLES",4,true));
|
||||
|
||||
//Check if we have user_preferences to backup
|
||||
if ($preferences_data = get_records("user_preferences","userid",$user->old_id)) {
|
||||
//Start USER_PREFERENCES tag
|
||||
fwrite ($bf,start_tag("USER_PREFERENCES",4,true));
|
||||
//Write each user_preference
|
||||
foreach ($preferences_data as $user_preference) {
|
||||
fwrite ($bf,start_tag("USER_PREFERENCE",5,true));
|
||||
fwrite ($bf,full_tag("NAME",6,false,$user_preference->name));
|
||||
fwrite ($bf,full_tag("VALUE",6,false,$user_preference->value));
|
||||
fwrite ($bf,end_tag("USER_PREFERENCE",5,true));
|
||||
}
|
||||
//End USER_PREFERENCES tag
|
||||
fwrite ($bf,end_tag("USER_PREFERENCES",4,true));
|
||||
}
|
||||
|
||||
}
|
||||
//End User tag
|
||||
fwrite ($bf,end_tag("USER",3,true));
|
||||
@@ -684,8 +845,8 @@
|
||||
//End Users tag
|
||||
fwrite ($bf,end_tag("USERS",2,true));
|
||||
} else {
|
||||
//There isn't users. Impossible !!
|
||||
$status = false;
|
||||
// There aren't any users.
|
||||
$status = true;
|
||||
}
|
||||
|
||||
return $status;
|
||||
@@ -732,6 +893,7 @@
|
||||
fwrite ($bf,full_tag("USERID",4,false,$log->userid));
|
||||
fwrite ($bf,full_tag("IP",4,false,$log->ip));
|
||||
fwrite ($bf,full_tag("MODULE",4,false,$log->module));
|
||||
fwrite ($bf,full_tag("CMID",4,false,$log->cmid));
|
||||
fwrite ($bf,full_tag("ACTION",4,false,$log->action));
|
||||
fwrite ($bf,full_tag("URL",4,false,$log->url));
|
||||
fwrite ($bf,full_tag("INFO",4,false,$log->info));
|
||||
@@ -799,6 +961,117 @@
|
||||
return $status;
|
||||
}
|
||||
|
||||
//Backup events info (course events)
|
||||
function backup_events_info($bf,$preferences) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
//Counter, points to current record
|
||||
$counter = 0;
|
||||
|
||||
//Get events (course events)
|
||||
$events = get_records_select("event","courseid='$preferences->backup_course' AND instance='0'","id");
|
||||
|
||||
//Pring events header
|
||||
if ($events) {
|
||||
//Pring events header
|
||||
fwrite ($bf,start_tag("EVENTS",2,true));
|
||||
//Iterate
|
||||
foreach ($events as $event) {
|
||||
//Begin event tag
|
||||
fwrite ($bf,start_tag("EVENT",3,true));
|
||||
//Output event tag
|
||||
fwrite ($bf,full_tag("ID",4,false,$event->id));
|
||||
fwrite ($bf,full_tag("NAME",4,false,$event->name));
|
||||
fwrite ($bf,full_tag("DESCRIPTION",4,false,$event->description));
|
||||
fwrite ($bf,full_tag("GROUPID",4,false,$event->groupid));
|
||||
fwrite ($bf,full_tag("USERID",4,false,$event->userid));
|
||||
fwrite ($bf,full_tag("EVENTTYPE",4,false,$event->eventtype));
|
||||
fwrite ($bf,full_tag("TIMESTART",4,false,$event->timestart));
|
||||
fwrite ($bf,full_tag("TIMEDURATION",4,false,$event->timeduration));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$event->timemodified));
|
||||
//End event tag
|
||||
fwrite ($bf,end_tag("EVENT",3,true));
|
||||
}
|
||||
//End events tag
|
||||
$status = fwrite ($bf,end_tag("EVENTS",2,true));
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
//Backup groups info
|
||||
function backup_groups_info($bf,$preferences) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
$status2 = true;
|
||||
|
||||
//Get groups
|
||||
$groups = get_records("groups","courseid",$preferences->backup_course);
|
||||
|
||||
//Pring groups header
|
||||
if ($groups) {
|
||||
//Pring groups header
|
||||
fwrite ($bf,start_tag("GROUPS",2,true));
|
||||
//Iterate
|
||||
foreach ($groups as $group) {
|
||||
//Begin group tag
|
||||
fwrite ($bf,start_tag("GROUP",3,true));
|
||||
//Output group contents
|
||||
fwrite ($bf,full_tag("ID",4,false,$group->id));
|
||||
fwrite ($bf,full_tag("COURSEID",4,false,$group->courseid));
|
||||
fwrite ($bf,full_tag("NAME",4,false,$group->name));
|
||||
fwrite ($bf,full_tag("DESCRIPTION",4,false,$group->description));
|
||||
fwrite ($bf,full_tag("LANG",4,false,$group->lang));
|
||||
fwrite ($bf,full_tag("PICTURE",4,false,$group->picture));
|
||||
fwrite ($bf,full_tag("HIDEPICTURE",4,false,$group->hidepicture));
|
||||
fwrite ($bf,full_tag("TIMECREATED",4,false,$group->timecreated));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$group->timemodified));
|
||||
|
||||
//Now, backup groups_members
|
||||
$status2 = backup_groups_members_info($bf,$preferences,$group->id);
|
||||
|
||||
//End group tag
|
||||
fwrite ($bf,end_tag("GROUP",3,true));
|
||||
}
|
||||
//End groups tag
|
||||
$status = fwrite ($bf,end_tag("GROUPS",2,true));
|
||||
}
|
||||
return ($status && $status2);
|
||||
}
|
||||
|
||||
//Backup groups_members info
|
||||
function backup_groups_members_info($bf,$preferences,$groupid) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
//Get groups_members
|
||||
$groups_members = get_records("groups_members","groupid",$groupid);
|
||||
|
||||
//Pring groups_members header
|
||||
if ($groups_members) {
|
||||
//Pring groups_members header
|
||||
fwrite ($bf,start_tag("MEMBERS",4,true));
|
||||
//Iterate
|
||||
foreach ($groups_members as $group_member) {
|
||||
//Begin group_member tag
|
||||
fwrite ($bf,start_tag("MEMBER",5,true));
|
||||
//Output group_member contents
|
||||
fwrite ($bf,full_tag("USERID",6,false,$group_member->userid));
|
||||
fwrite ($bf,full_tag("TIMEADDED",6,false,$group_member->timeadded));
|
||||
//End group_member tag
|
||||
fwrite ($bf,end_tag("MEMBER",5,true));
|
||||
}
|
||||
//End groups_members tag
|
||||
$status = fwrite ($bf,end_tag("MEMBERS",4,true));
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
//Start the modules tag
|
||||
function backup_modules_start ($bf,$preferences) {
|
||||
@@ -970,30 +1243,40 @@
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
//Define zip location (from)
|
||||
$from_zip_file = $CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/".$preferences->backup_name;
|
||||
|
||||
//Define zip destination (course dir)
|
||||
$to_zip_file = $CFG->dataroot."/".$preferences->backup_course;
|
||||
//Initialise $to_zip_file
|
||||
$to_zip_file="";
|
||||
|
||||
//echo "<p>From: ".$from_zip_file."<br>"; //Debug
|
||||
//If $preferences->backup_destination isn't empty, then copy to custom directory
|
||||
if (!empty($preferences->backup_destination)) {
|
||||
$to_zip_file = $preferences->backup_destination."/".$preferences->backup_name;
|
||||
} else {
|
||||
//Define zip destination (course dir)
|
||||
$to_zip_file = $CFG->dataroot."/".$preferences->backup_course;
|
||||
|
||||
//echo "<p>From: ".$from_zip_file."<br>"; //Debug
|
||||
|
||||
//echo "<p>Checking: ".$to_zip_file."<br>"; //Debug
|
||||
|
||||
//Checks course dir exists
|
||||
$status = check_dir_exists($to_zip_file,true);
|
||||
|
||||
//Define zip destination (backup dir)
|
||||
$to_zip_file = $to_zip_file."/backupdata";
|
||||
|
||||
//echo "<p>Checking: ".$to_zip_file."<br>"; //Debug
|
||||
|
||||
//Checks backup dir exists
|
||||
$status = check_dir_exists($to_zip_file,true);
|
||||
|
||||
//echo "<p>Checking: ".$to_zip_file."<br>"; //Debug
|
||||
//Define zip destination (zip file)
|
||||
$to_zip_file = $to_zip_file."/".$preferences->backup_name;
|
||||
}
|
||||
|
||||
//Checks course dir exists
|
||||
$status = check_dir_exists($to_zip_file,true);
|
||||
|
||||
//Define zip destination (backup dir)
|
||||
$to_zip_file = $to_zip_file."/backupdata";
|
||||
|
||||
//echo "<p>Checking: ".$to_zip_file."<br>"; //Debug
|
||||
|
||||
//Checks backup dir exists
|
||||
$status = check_dir_exists($to_zip_file,true);
|
||||
|
||||
//Define zip destination (zip file)
|
||||
$to_zip_file = $to_zip_file."/".$preferences->backup_name;
|
||||
|
||||
//echo "<p>To: ".$to_zip_file."<br>"; //Debug
|
||||
|
||||
//Copy zip file
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
//Get some strings
|
||||
|
||||
$yes = get_string("yes");
|
||||
$no = get_string("no");
|
||||
$withuserdata = get_string("withuserdata");
|
||||
$withoutuserdata = get_string("withoutuserdata");
|
||||
$course = get_string("course");
|
||||
$all = get_string("all");
|
||||
$include = get_string("include");
|
||||
$modules = get_string("modules");
|
||||
|
||||
//Get backup_config pairs
|
||||
$backup_config = backup_get_config();
|
||||
|
||||
//Checks backup_config pairs exist
|
||||
if (!isset($backup_config->backup_sche_modules)) {
|
||||
$backup_config->backup_sche_modules = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_withuserdata)) {
|
||||
$backup_config->backup_sche_withuserdata = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_users)) {
|
||||
$backup_config->backup_sche_users = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_logs)) {
|
||||
$backup_config->backup_sche_logs = 0;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_userfiles)) {
|
||||
$backup_config->backup_sche_userfiles = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_coursefiles)) {
|
||||
$backup_config->backup_sche_coursefiles = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_active)) {
|
||||
$backup_config->backup_sche_active = 0;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_weekdays)) {
|
||||
$backup_config->backup_sche_weekdays = "0000000";
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_hour)) {
|
||||
$backup_config->backup_sche_hour = 00;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_minute)) {
|
||||
$backup_config->backup_sche_minute = 00;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_destination)) {
|
||||
$backup_config->backup_sche_destination = "";
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_keep)) {
|
||||
$backup_config->backup_sche_keep = 1;
|
||||
}
|
||||
|
||||
//print_object($backup_config); //Debug
|
||||
|
||||
//Yes/no array for use in yes/no menu
|
||||
$yesno_array[0] = $no;
|
||||
$yesno_array[1] = $yes;
|
||||
|
||||
//With user data/without user data array for use in menu
|
||||
$withwithout_array[0] = $withoutuserdata;
|
||||
$withwithout_array[1] = $withuserdata;
|
||||
|
||||
//Course/alla array for use in course/all menu
|
||||
$courseall_array[0] = $all;
|
||||
$courseall_array[1] = $course;
|
||||
|
||||
//Keep array for use in keep menu
|
||||
$keep_array[0] = $all;
|
||||
$keep_array[1] = "1";
|
||||
$keep_array[2] = "2";
|
||||
$keep_array[5] = "5";
|
||||
$keep_array[10] = "10";
|
||||
$keep_array[20] = "20";
|
||||
$keep_array[30] = "30";
|
||||
$keep_array[40] = "40";
|
||||
$keep_array[50] = "50";
|
||||
$keep_array[100] = "100";
|
||||
$keep_array[200] = "200";
|
||||
$keep_array[300] = "300";
|
||||
$keep_array[400] = "400";
|
||||
$keep_array[500] = "500";
|
||||
?>
|
||||
<form method="post" action="backup.php" name="form">
|
||||
|
||||
<table cellpadding=9 cellspacing=0 >
|
||||
<tr valign=top>
|
||||
<td colspan = 3 align=center><strong><?php print_string("settings") ?></strong></td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><?php print_string("includemodules") ?>:</td>
|
||||
<td nowrap>
|
||||
<?php choose_from_menu($yesno_array, "backup_sche_modules", $backup_config->backup_sche_modules, "") ?>
|
||||
<?php choose_from_menu($withwithout_array, "backup_sche_withuserdata", $backup_config->backup_sche_withuserdata, "") ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("backupincludemoduleshelp") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><?php print_string("users") ?>:</td>
|
||||
<td>
|
||||
<?php choose_from_menu($courseall_array, "backup_sche_users", $backup_config->backup_sche_users, "") ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("backupusershelp") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><?php print_string("logs") ?>:</td>
|
||||
<td>
|
||||
<?php choose_from_menu($yesno_array, "backup_sche_logs", $backup_config->backup_sche_logs, "") ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("backuplogshelp") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><?php print_string("userfiles") ?>:</td>
|
||||
<td>
|
||||
<?php choose_from_menu($yesno_array, "backup_sche_userfiles", $backup_config->backup_sche_userfiles, "") ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("backupuserfileshelp") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><?php print_string("coursefiles") ?>:</td>
|
||||
<td>
|
||||
<?php choose_from_menu($yesno_array, "backup_sche_coursefiles", $backup_config->backup_sche_coursefiles, "") ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("backupcoursefileshelp") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><?php print_string("keep") ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($keep_array, "backup_sche_keep", $backup_config->backup_sche_keep, "");
|
||||
print_string("files");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("backupkeephelp") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td colspan = 3 align=center><strong><?php print_string("schedule") ?></strong></td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td colspan = 3 align=center>
|
||||
<?php print_string("active") ?>: <?php choose_from_menu($yesno_array, "backup_sche_active", $backup_config->backup_sche_active, "") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=3 align=center>
|
||||
<?php
|
||||
//Get first day of week from languaje files
|
||||
//after searching the web I haven't find a sytem to retrieve it in php from locale info
|
||||
$firstdayofweek = get_string("firstdayofweek");
|
||||
//If it is empty ot it is different of 1, default to 0
|
||||
if (!isset($firstdayofweek) || $firstdayofweek != 1) {
|
||||
$firstdayofweek = 0;
|
||||
}
|
||||
//Now create the timestamp of a well-know sunday (02/25/2001, my 31th birthday (stronk7) !!)
|
||||
$onesunday = make_timestamp(2001,2,25);
|
||||
$i = 0;
|
||||
$day_names = "";
|
||||
$check_names = "";
|
||||
while ($i<7) {
|
||||
$day_names[] = strftime("%A",$onesunday + (($firstdayofweek+$i)*86400));
|
||||
//Calculate standard day of week (0=Sunday......6=Saturday)
|
||||
//to store info in that exact order in DB
|
||||
$stddayofweek = ($i+$firstdayofweek) % 7;
|
||||
//Calculate the status of the checkbox
|
||||
if (substr($backup_config->backup_sche_weekdays,$stddayofweek,1) == "1") {
|
||||
$strchecked = " checked";
|
||||
} else {
|
||||
$strchecked = "";
|
||||
}
|
||||
$check_names[] = "<input type=\"checkbox\" name=\"dayofweek_$stddayofweek\" value=\"1\"$strchecked>";
|
||||
$i++;
|
||||
}
|
||||
$table->align = array("center","center","center","center","center","center","center");
|
||||
$table->head = $day_names;
|
||||
$table->data[] = $check_names;
|
||||
print_table($table);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td colspan = 3 align=center>
|
||||
<?php print_string("executeat") ?>: <?php print_time_selector("backup_sche_hour","backup_sche_minute",make_timestamp(2000,1,1,$backup_config->backup_sche_hour,$backup_config->backup_sche_minute)) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td colspan = 3 align=center>
|
||||
<?php print_string("saveto") ?>: <input name="backup_sche_destination" type="text" size="40" value="<?php p($backup_config->backup_sche_destination) ?>"><br><?php if (!empty($sche_destination_error)) { formerr($sche_destination_error); echo "<br>"; } ?><?php print_string("backupsavetohelp") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=3 align=center>
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
+35
-1
@@ -68,7 +68,41 @@ function backup_upgrade($oldversion=0) {
|
||||
|
||||
if ($oldversion < 2003082600 and $result) {
|
||||
print_simple_box("This is the first non-alpha release of the Backup/Restore module.<p>Thanks for upgrading!","center", "50%", "$THEME->cellheading", "20", "noticebox");
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2003112700 and $result) {
|
||||
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_config` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
`value` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) TYPE=MyISAM COMMENT='To store backup configuration variables'");
|
||||
}
|
||||
|
||||
if ($oldversion < 2003120800 and $result) {
|
||||
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_courses` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`courseid` int(10) unsigned NOT NULL default '0',
|
||||
`laststarttime` int(10) unsigned NOT NULL default '0',
|
||||
`lastendtime` int(10) unsigned NOT NULL default '0',
|
||||
`laststatus` varchar(1) NOT NULL default '0',
|
||||
`nextstarttime` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `courseid` (`courseid`)
|
||||
) TYPE=MyISAM COMMENT='To store every course backup status'");
|
||||
|
||||
if ($result) {
|
||||
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_log` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`courseid` int(10) unsigned NOT NULL default '0',
|
||||
`time` int(10) unsigned NOT NULL default '0',
|
||||
`laststarttime` int(10) unsigned NOT NULL default '0',
|
||||
`info` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM COMMENT='To store every course backup log info'");
|
||||
}
|
||||
}
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
|
||||
@@ -24,4 +24,48 @@ CREATE TABLE `prefix_backup_ids` (
|
||||
`info` mediumtext,
|
||||
PRIMARY KEY (`backup_code`,`table_name`,`old_id`)
|
||||
) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore';
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `prefix_backup_config`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_config` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
`value` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) TYPE=MyISAM COMMENT='To store backup configuration variables';
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `prefix_backup_courses`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_courses` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`courseid` int(10) unsigned NOT NULL default '0',
|
||||
`laststarttime` int(10) unsigned NOT NULL default '0',
|
||||
`lastendtime` int(10) unsigned NOT NULL default '0',
|
||||
`laststatus` varchar(1) NOT NULL default '0',
|
||||
`nextstarttime` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `courseid` (`courseid`)
|
||||
) TYPE=MyISAM COMMENT='To store every course backup status';
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `prefix_backup_log`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_log` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`courseid` int(10) unsigned NOT NULL default '0',
|
||||
`time` int(10) unsigned NOT NULL default '0',
|
||||
`laststarttime` int(10) unsigned NOT NULL default '0',
|
||||
`info` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM COMMENT='To store every course backup log info';
|
||||
# --------------------------------------------------------
|
||||
|
||||
Executable
+130
@@ -0,0 +1,130 @@
|
||||
rem
|
||||
rem Table structure for table prefix_backup_files
|
||||
rem
|
||||
|
||||
drop table prefix_backup_files;
|
||||
|
||||
CREATE TABLE prefix_backup_files (
|
||||
backup_code number(10) default '0' NOT NULL,
|
||||
file_type varchar2(10) default '' NOT NULL,
|
||||
path varchar2(255) default '' NOT NULL,
|
||||
old_id number(10) default NULL,
|
||||
new_id number(10) default NULL
|
||||
);
|
||||
|
||||
ALTER TABLE prefix_backup_files
|
||||
ADD CONSTRAINT pbf_pk
|
||||
PRIMARY KEY (backup_code,file_type,path);
|
||||
|
||||
COMMENT on table prefix_backup_files is 'To store and recode ids to user and course files.';
|
||||
|
||||
rem --------------------------------------------------------
|
||||
rem
|
||||
rem Table structure for table prefix_backup_ids
|
||||
rem
|
||||
|
||||
drop table prefix_backup_ids;
|
||||
|
||||
CREATE TABLE prefix_backup_ids (
|
||||
backup_code number(12) default '0' NOT NULL,
|
||||
table_name varchar2(30) default '' NOT NULL,
|
||||
old_id number(10) default '0' NOT NULL,
|
||||
new_id number(10) default NULL,
|
||||
info varchar2(20)
|
||||
);
|
||||
|
||||
ALTER TABLE prefix_backup_ids
|
||||
ADD CONSTRAINT pbi_pk
|
||||
PRIMARY KEY (backup_code,table_name,old_id);
|
||||
|
||||
COMMENT on table prefix_backup_ids is 'To store and convert ids in backup/restore';
|
||||
|
||||
rem --------------------------------------------------------
|
||||
rem
|
||||
rem Table structure for table prefix_backup_config
|
||||
rem
|
||||
|
||||
drop TABLE prefix_backup_config;
|
||||
|
||||
CREATE TABLE prefix_backup_config (
|
||||
id number(10) not null,
|
||||
name varchar2(255) not null,
|
||||
value varchar2(255) not null,
|
||||
constraint pk_baco primary key (id),
|
||||
constraint uk_baco_name unique (name)
|
||||
);
|
||||
|
||||
COMMENT on table prefix_backup_config is 'To store backup configuration variables';
|
||||
|
||||
drop sequence p_backup_config_seq;
|
||||
create sequence p_backup_config_seq;
|
||||
|
||||
create or replace trigger p_backup_config_trig
|
||||
before insert on prefix_backup_config
|
||||
referencing new as new_row
|
||||
for each row
|
||||
begin
|
||||
select p_backup_config_seq.nextval into :new_row.id from dual;
|
||||
end;
|
||||
|
||||
rem --------------------------------------------------------
|
||||
rem
|
||||
rem Table structure for table prefix_backup_courses
|
||||
rem
|
||||
|
||||
drop TABLE prefix_backup_courses;
|
||||
|
||||
CREATE TABLE prefix_backup_courses (
|
||||
id number(10) default '0' NOT NULL,
|
||||
courseid number(10) default '0' NOT NULL,
|
||||
laststarttime number(10) default '0' NOT NULL,
|
||||
lastendtime number(10) default '0' NOT NULL,
|
||||
laststatus varchar2(1) default '0' NOT NULL,
|
||||
nextstarttime number(10) default '0' NOT NULL,
|
||||
constraint pk_bacu primary key (id),
|
||||
constraint uk_bacu_courseid unique (courseid)
|
||||
);
|
||||
|
||||
COMMENT on table prefix_backup_courses is 'To store every course backup status';
|
||||
|
||||
drop sequence p_backup_courses_seq;
|
||||
create sequence p_backup_courses_seq;
|
||||
|
||||
create or replace trigger p_backup_courses_trig
|
||||
before insert on prefix_backup_courses
|
||||
referencing new as new_row
|
||||
for each row
|
||||
begin
|
||||
select p_backup_courses_seq.nextval into :new_row.id from dual;
|
||||
end;
|
||||
|
||||
rem --------------------------------------------------------
|
||||
rem
|
||||
rem Table structure for table prefix_backup_log
|
||||
rem
|
||||
|
||||
drop TABLE prefix_backup_log;
|
||||
|
||||
CREATE TABLE prefix_backup_log (
|
||||
id number(10) default '0' NOT NULL,
|
||||
courseid number(10) default '0' NOT NULL,
|
||||
time number(10) default '0' NOT NULL,
|
||||
laststarttime number(10) default '0' NOT NULL,
|
||||
info varchar2(255) default '0' NOT NULL,
|
||||
constraint pk_balo primary key (id)
|
||||
);
|
||||
|
||||
COMMENT on table prefix_backup_log is 'To store every course backup log info';
|
||||
|
||||
drop sequence p_backup_log_seq;
|
||||
create sequence p_backup_log_seq;
|
||||
|
||||
create or replace trigger p_backup_log_trig
|
||||
before insert on prefix_backup_log
|
||||
referencing new as new_row
|
||||
for each row
|
||||
begin
|
||||
select p_backup_log_seq.nextval into :new_row.id from dual;
|
||||
end;
|
||||
|
||||
/
|
||||
@@ -31,4 +31,37 @@ CREATE TABLE prefix_backup_ids (
|
||||
|
||||
CREATE INDEX prefix_backup_codenameid_idx ON prefix_backup_ids (backup_code,table_name,old_id);
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_config
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_config (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name varchar(255) UNIQUE NOT NULL default '',
|
||||
value varchar(255) NOT NULL default ''
|
||||
);
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_courses
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_courses (
|
||||
id SERIAL PRIMARY KEY,
|
||||
courseid int8 UNIQUE NOT NULL default '0',
|
||||
laststarttime int8 NOT NULL default '0',
|
||||
lastendtime int8 NOT NULL default '0',
|
||||
laststatus varchar(1) NOT NULL default '0',
|
||||
nextstarttime int8 NOT NULL default '0'
|
||||
);
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_log
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_log (
|
||||
id SERIAL PRIMARY KEY,
|
||||
courseid int8 NOT NULL default '0',
|
||||
time int8 NOT NULL default '0',
|
||||
laststarttime int8 NOT NULL default '0',
|
||||
info varchar(255) NOT NULL default ''
|
||||
);
|
||||
|
||||
+42
-7
@@ -2,6 +2,28 @@
|
||||
//This file contains all the general function needed (file manipulation...)
|
||||
//not directly part of the backup/restore utility
|
||||
|
||||
//Sets a name/value pair in backup_config table
|
||||
function backup_set_config($name, $value) {
|
||||
if (get_field("backup_config", "name", "name", $name)) {
|
||||
return set_field("backup_config", "value", $value, "name", $name);
|
||||
} else {
|
||||
$config->name = $name;
|
||||
$config->value = $value;
|
||||
return insert_record("backup_config", $config);
|
||||
}
|
||||
}
|
||||
|
||||
//Gets all the information from backup_config table
|
||||
function backup_get_config() {
|
||||
$backup_config = null;
|
||||
if ($configs = get_records("backup_config")) {
|
||||
foreach ($configs as $config) {
|
||||
$backup_config[$config->name] = $config->value;
|
||||
}
|
||||
}
|
||||
return (object)$backup_config;
|
||||
}
|
||||
|
||||
//Delete old data in backup tables (if exists)
|
||||
//Two days seems to be apropiate
|
||||
function backup_delete_old_data() {
|
||||
@@ -184,6 +206,8 @@
|
||||
//This function return the names of all directories under a give directory
|
||||
//Not recursive
|
||||
function list_directories ($rootdir) {
|
||||
|
||||
$results = null;
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
@@ -201,6 +225,8 @@
|
||||
//This function return the names of all directories and files under a give directory
|
||||
//Not recursive
|
||||
function list_directories_and_files ($rootdir) {
|
||||
|
||||
$results = "";
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
@@ -252,10 +278,15 @@
|
||||
//Little modifications done
|
||||
|
||||
function backup_copy_file ($from_file,$to_file) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
if (is_file($from_file)) {
|
||||
//echo "<br>Copying ".$from_file." to ".$to_file; //Debug
|
||||
$perms=fileperms($from_file);
|
||||
return copy($from_file,$to_file) && chmod($to_file,$perms);
|
||||
//$perms=fileperms($from_file);
|
||||
//return copy($from_file,$to_file) && chmod($to_file,$perms);
|
||||
umask(0000);
|
||||
return copy($from_file,$to_file) && chmod($to_file,$CFG->directorypermissions);
|
||||
}
|
||||
else if (is_dir($from_file)) {
|
||||
return backup_copy_dir($from_file,$to_file);
|
||||
@@ -272,6 +303,7 @@
|
||||
|
||||
if (!is_dir($to_file)) {
|
||||
//echo "<br>Creating ".$to_file; //Debug
|
||||
umask(0000);
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
}
|
||||
$dir = opendir($from_file);
|
||||
@@ -355,7 +387,6 @@
|
||||
global $CFG;
|
||||
|
||||
$max_db_storage = 128; //Max bytes to save to db, else save to file
|
||||
//MUST BE LOWER THAN 256 (VARCHAR LIMIT)
|
||||
|
||||
$status = true;
|
||||
|
||||
@@ -382,10 +413,14 @@
|
||||
|
||||
//Now, insert the record
|
||||
if ($status) {
|
||||
$status = execute_sql("INSERT INTO {$CFG->prefix}backup_ids
|
||||
(backup_code, table_name, old_id, new_id, info)
|
||||
VALUES
|
||||
($backup_unique_code, '$table', '$old_id', '$new_id', '$info_to_save')",false);
|
||||
//Build the record
|
||||
$rec->backup_code = $backup_unique_code;
|
||||
$rec->table_name = $table;
|
||||
$rec->old_id = $old_id;
|
||||
$rec->new_id =$new_id;
|
||||
$rec->info = $info_to_save;
|
||||
|
||||
$status = insert_record ("backup_ids", $rec, false,"backup_code");
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
<?PHP // $Id$
|
||||
// backup.php - allows admin to edit all configuration variables for scheduled backups
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("../backup/lib.php");
|
||||
|
||||
optional_variable($courseid);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only an admin can use this page");
|
||||
}
|
||||
|
||||
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");
|
||||
$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=\"../admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"../admin/configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"../admin/backup.php\">$strbackup</a> -> ".
|
||||
$strlogs);
|
||||
|
||||
print_heading($backuploglaststatus);
|
||||
print_simple_box_start("center", "", "$THEME->cellheading");
|
||||
//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 nowrap>";
|
||||
echo "<td nowrap align=center><font size=3>$strcourse</font></td>";
|
||||
echo "<td nowrap align=center colspan=3><font size=3>$strtimetaken</font></td>";
|
||||
echo "<td nowrap align=center><font size=3>$strstatus</font></td>";
|
||||
echo "<td nowrap align=center><font size=3>$strnext</font></td>";
|
||||
foreach ($courses as $course) {
|
||||
//Get the course shortname
|
||||
$coursename = get_field ("course","fullname","id",$course->courseid);
|
||||
if ($coursename) {
|
||||
echo "<tr nowrap>";
|
||||
echo "<td nowrap><font size=2><a href=\"log.php?courseid=$course->courseid\">".$coursename."</a></td>";
|
||||
echo "<td nowrap><font size=2>".userdate($course->laststarttime,$strftimedatetime)."</td>";
|
||||
echo "<td nowrap><font size=2> - </td>";
|
||||
echo "<td nowrap><font size=2>".userdate($course->lastendtime,$strftimedatetime)."</td>";
|
||||
if (!$course->laststatus) {
|
||||
echo "<td nowrap align=center><font size=2 color=red>".$strerror."</td>";
|
||||
} else {
|
||||
echo "<td nowrap align=center><font size=2 color=green>".$strok."</td>";
|
||||
}
|
||||
echo "<td nowrap><font size=2>".userdate($course->nextstarttime,$strftimedatetime)."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
//Detailed View !!
|
||||
} else {
|
||||
print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
|
||||
"<a href=\"../admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"../admin/configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"../admin/backup.php\">$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", "", "$THEME->cellheading");
|
||||
|
||||
//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 nowrap>";
|
||||
echo "<td 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 time");
|
||||
if ($logs) {
|
||||
foreach ($logs as $log) {
|
||||
echo "<tr nowrap>";
|
||||
echo "<td 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><font size=2>".str_replace(" "," ",$log->info)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
@@ -76,6 +76,8 @@
|
||||
error("Course ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
|
||||
//Print header
|
||||
if (isadmin()) {
|
||||
print_header("$site->shortname: $strcourserestore", $site->fullname,
|
||||
|
||||
@@ -9,12 +9,14 @@
|
||||
if ($SESSION) {
|
||||
$info = $SESSION->info;
|
||||
$course_header = $SESSION->course_header;
|
||||
$restore = $SESSION->restore;
|
||||
if (isset($SESSION->restore)) {
|
||||
$restore = $SESSION->restore;
|
||||
}
|
||||
}
|
||||
|
||||
//If restore session info exists, but we are posting parameters
|
||||
//manually, this has prioriry
|
||||
if ($restore and isset($restore_restoreto)) {
|
||||
if (isset($restore) and isset($restore_restoreto)) {
|
||||
unset($restore);
|
||||
}
|
||||
|
||||
@@ -29,7 +31,7 @@
|
||||
//If the restore object doesn't exist, we are going
|
||||
//to check every variable individually and create it
|
||||
|
||||
if (!$restore) {
|
||||
if (!isset($restore)) {
|
||||
//Check that we have all we need
|
||||
//backup_unique_code
|
||||
require_variable($backup_unique_code);
|
||||
@@ -146,7 +148,7 @@
|
||||
|
||||
//Now, select the course if needed
|
||||
if (($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id == 0) and (isadmin())) {
|
||||
if ($courses = get_courses()) {
|
||||
if ($courses = get_courses("all","c.fullname")) {
|
||||
print_heading(get_string("choosecourse"));
|
||||
print_simple_box_start("CENTER");
|
||||
foreach ($courses as $course) {
|
||||
|
||||
+23
-17
@@ -143,9 +143,6 @@
|
||||
$exists_count = 0;
|
||||
$student_count = 0;
|
||||
$teacher_count = 0;
|
||||
$coursecreator_count = 0;
|
||||
$admin_count = 0;
|
||||
$other_count = 0;
|
||||
$counter = 0;
|
||||
//Iterate, filling counters
|
||||
foreach ($recs as $rec) {
|
||||
@@ -157,16 +154,10 @@
|
||||
if (strpos($record->info,"exists") !== false) {
|
||||
$exists_count++;
|
||||
}
|
||||
if (strpos($record->info,"student")) {
|
||||
if (strpos($record->info,"student") !== false) {
|
||||
$student_count++;
|
||||
} else if (strpos($record->info,"teacher")) {
|
||||
} else if (strpos($record->info,"teacher") !== false) {
|
||||
$teacher_count++;
|
||||
} else if (strpos($record->info,"admin")) {
|
||||
$admin_count++;
|
||||
} else if (strpos($record->info,"coursecreator")) {
|
||||
$coursecreator_count++;
|
||||
} else if ($record->info == "new" or $record->info == "exists") {
|
||||
$other_count++;
|
||||
}
|
||||
//Do some output
|
||||
$counter++;
|
||||
@@ -183,13 +174,9 @@
|
||||
echo "<ul>";
|
||||
echo "<li>".get_string("students").": ".$student_count;
|
||||
echo "<li>".get_string("teachers").": ".$teacher_count;
|
||||
echo "<li>".get_string("coursecreators").": ".$coursecreator_count;
|
||||
echo "<li>".get_string("administrators").": ".$admin_count;
|
||||
echo "<li>".get_string("other").": ".$other_count;
|
||||
echo "</ul>";
|
||||
} else {
|
||||
notify("Something is wrong - no users were found!");
|
||||
$status = false;
|
||||
notify("No users were found!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,6 +227,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
//Now create groups as needed
|
||||
if ($status) {
|
||||
echo "<li>".get_string("creatinggroups");
|
||||
if (!$status = restore_create_groups($restore,$xml_file)) {
|
||||
notify("Could not restore groups!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now create events as needed
|
||||
if ($status) {
|
||||
echo "<li>".get_string("creatingevents");
|
||||
if (!$status = restore_create_events($restore,$xml_file)) {
|
||||
notify("Could not restore course events!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now create course modules as needed
|
||||
if ($status) {
|
||||
echo "<li>".get_string("creatingcoursemodules");
|
||||
@@ -250,7 +253,10 @@
|
||||
|
||||
//Now create log entries as needed
|
||||
if ($status and ($restore->logs)) {
|
||||
echo "<li>".get_string("creatinglogentries")."<b> (not implemented!!)</b>";
|
||||
echo "<li>".get_string("creatinglogentries");
|
||||
if (!$status = restore_create_logs($restore,$xml_file)) {
|
||||
notify("Could not restore logs!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now, if all is OK, adjust the instance field in course_modules !!
|
||||
|
||||
+27
-21
@@ -98,7 +98,7 @@
|
||||
|
||||
?>
|
||||
|
||||
<form name="form" method="post" <?php echo $onsubmit ?> action="<?php echo $ME ?>">
|
||||
<form name="form" method="post" action="<?php echo $ME ?>">
|
||||
<table cellpadding=5>
|
||||
<?php
|
||||
|
||||
@@ -130,29 +130,35 @@
|
||||
$exist = "exists_".$modname;
|
||||
$restore_var = "restore_".$modname;
|
||||
$user_info_var = "restore_user_info_".$modname;
|
||||
if ($$exist) {
|
||||
//Now check that we have that module info in the backup file
|
||||
if ($info->mods[$modname]->backup == "true") {
|
||||
//Print the full tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\"><P><B>";
|
||||
echo get_string("include")." ". get_string("modulenameplural",$modname).":";
|
||||
echo "</td><td>";
|
||||
$restore_options[0] = get_string("no");
|
||||
$restore_options[1] = get_string("yes");
|
||||
choose_from_menu($restore_options, $restore_var, $$restore_var, "");
|
||||
//If backup contains user data, then show menu, else fix it to
|
||||
//without user data
|
||||
if ($info->mods[$modname]->userinfo == "true") {
|
||||
$restore_user_options[0] = get_string("withoutuserdata");
|
||||
$restore_user_options[1] = get_string("withuserdata");
|
||||
choose_from_menu($restore_user_options, $user_info_var, $$user_info_var, "");
|
||||
if (isset($$exist)) {
|
||||
if ($$exist) {
|
||||
//Now check that we have that module info in the backup file
|
||||
if (isset($info->mods[$modname]) && $info->mods[$modname]->backup == "true") {
|
||||
//Print the full tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\"><P><B>";
|
||||
echo get_string("include")." ". get_string("modulenameplural",$modname).":";
|
||||
echo "</td><td>";
|
||||
$restore_options[0] = get_string("no");
|
||||
$restore_options[1] = get_string("yes");
|
||||
choose_from_menu($restore_options, $restore_var, $$restore_var, "");
|
||||
//If backup contains user data, then show menu, else fix it to
|
||||
//without user data
|
||||
if ($info->mods[$modname]->userinfo == "true") {
|
||||
$restore_user_options[0] = get_string("withoutuserdata");
|
||||
$restore_user_options[1] = get_string("withuserdata");
|
||||
choose_from_menu($restore_user_options, $user_info_var, $$user_info_var, "");
|
||||
} else {
|
||||
//Module haven't userdata
|
||||
echo get_string("withoutuserdata");
|
||||
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\">";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
} else {
|
||||
//Module haven't userdata
|
||||
echo get_string("withoutuserdata");
|
||||
//Module isn't restorable
|
||||
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\">";
|
||||
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\">";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
} else {
|
||||
//Module isn't restorable
|
||||
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\">";
|
||||
|
||||
+957
-22
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
require_once ("../config.php");
|
||||
require_once ("backup_scheduled.php");
|
||||
require_once ("lib.php");
|
||||
require_once ("backuplib.php");
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
}
|
||||
|
||||
//Check necessary functions exists. Thanks to gregb@crowncollege.edu
|
||||
backup_required_functions();
|
||||
|
||||
//Adjust some php variables to the execution of this script
|
||||
ini_set("max_execution_time","3000");
|
||||
ini_set("memory_limit","56M");
|
||||
|
||||
echo "<pre>\n";
|
||||
|
||||
$status = true;
|
||||
|
||||
$courses = get_records("course");
|
||||
foreach ($courses as $course) {
|
||||
echo "Start course ".$course->fullname;
|
||||
$preferences = schedule_backup_course_configure($course);
|
||||
if ($preferences && $status) {
|
||||
$status = schedule_backup_course_execute($preferences);
|
||||
}
|
||||
if ($status && $preferences) {
|
||||
echo "End course ".$course->fullname." OK\n\n";
|
||||
} else {
|
||||
echo "End course ".$course->fullname." FAIL\n\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
+2
-2
@@ -5,6 +5,6 @@
|
||||
// database (backup_version) to determine whether upgrades should
|
||||
// be performed (see db/backup_*.php)
|
||||
|
||||
$backup_version = 2003082800; // The current version is a date (YYYYMMDDXX)
|
||||
$backup_version = 2004032500; // The current version is a date (YYYYMMDDXX)
|
||||
|
||||
$backup_release = "1.1"; // User-friendly version number
|
||||
$backup_release = "1.2.1"; // User-friendly version number
|
||||
|
||||
+172
-144
@@ -1,144 +1,172 @@
|
||||
<?PHP // $Id$
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Moodle configuration file //
|
||||
// //
|
||||
// This file should be renamed "config.php" in the top-level directory //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 2001-2003 Martin Dougiamas http://dougiamas.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 //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
unset($CFG); // Ignore this line
|
||||
|
||||
//=========================================================================
|
||||
// 1. DATABASE SETUP
|
||||
//=========================================================================
|
||||
// First, you need to configure the database where all Moodle data //
|
||||
// will be stored. This database must already have been created //
|
||||
// and a username/password created to access it. //
|
||||
// //
|
||||
// mysql - the prefix is optional, but useful when installing //
|
||||
// into databases that already contain tables. //
|
||||
//
|
||||
// postgres7 - the prefix is REQUIRED, regardless of whether the //
|
||||
// database already contains tables. //
|
||||
|
||||
$CFG->dbtype = 'mysql'; // mysql or postgres7 (for now)
|
||||
$CFG->dbhost = 'localhost'; // eg localhost or db.isp.com
|
||||
$CFG->dbname = 'moodle'; // database name, eg moodle
|
||||
$CFG->dbuser = 'username'; // your database username
|
||||
$CFG->dbpass = 'password'; // your database password
|
||||
|
||||
$CFG->dbpersist = true; // Use persistent database connection?
|
||||
// (should be 'true' for 99% of sites)
|
||||
|
||||
$CFG->prefix = 'mdl_'; // Prefix to use for all table names
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 2. WEB SITE LOCATION
|
||||
//=========================================================================
|
||||
// Now you need to tell Moodle where it is located. Specify the full
|
||||
// web address to where moodle has been installed. If your web site
|
||||
// is accessible via multiple URLs then choose the most natural one
|
||||
// that your students would use. Do not include a trailing slash.
|
||||
|
||||
$CFG->wwwroot = 'http://example.com/moodle';
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 3. SERVER FILES LOCATION
|
||||
//=========================================================================
|
||||
// Next, specify the full OS directory path to this same location
|
||||
// Make sure the upper/lower case is correct. Some examples:
|
||||
//
|
||||
// $CFG->dirroot = 'C:\FoxServ\www\moodle'; // Windows
|
||||
// $CFG->dirroot = '/var/www/html/moodle'; // Redhat Linux
|
||||
|
||||
$CFG->dirroot = '/var/www/html/moodle';
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 4. DATA FILES LOCATION
|
||||
//=========================================================================
|
||||
// Now you need a place where Moodle can save uploaded files. This
|
||||
// directory should be readable AND WRITEABLE by the web server user
|
||||
// (usually 'nobody' or 'apache'), but it should not be accessible
|
||||
// directly via the web.
|
||||
//
|
||||
// - On hosting systems you might need to make sure that your "group" has
|
||||
// no permissions at all, but that "others" have full permissions.
|
||||
//
|
||||
// - On Windows systems you might specify something like 'C:\moodledata'
|
||||
|
||||
$CFG->dataroot = '/home/moodledata';
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 5. DATA FILES PERMISSIONS
|
||||
//=========================================================================
|
||||
// The following parameter sets the permissions of new directories
|
||||
// created by Moodle within the data directory. The format is in
|
||||
// octal format (as used by the Unix utility chmod, for example).
|
||||
// The default is usually OK, but you may want to change it to 0750
|
||||
// if you are concerned about world-access to the files (you will need
|
||||
// to make sure the web server process (eg Apache) can access the files.
|
||||
// NOTE: the prefixed 0 is important, and don't use quotes.
|
||||
|
||||
$CFG->directorypermissions = 0777;
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 6. DIRECTORY LOCATION (most people can just ignore this setting)
|
||||
//=========================================================================
|
||||
// A very few webhosts use /admin as a special URL for you to access a
|
||||
// control panel or something. Unfortunately this conflicts with the
|
||||
// standard location for the Moodle admin pages. You can fix this by
|
||||
// renaming the admin directory in your installation, and putting that
|
||||
// new name here. eg "moodleadmin". This will fix admin links in Moodle.
|
||||
|
||||
$CFG->admin = 'admin';
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// ALL DONE! To continue installation, visit your main page with a browser
|
||||
//=========================================================================
|
||||
|
||||
if (file_exists("$CFG->dirroot/lib/setup.php")) { // Do not edit
|
||||
include_once("$CFG->dirroot/lib/setup.php");
|
||||
} else {
|
||||
if ($CFG->dirroot == dirname(__FILE__)) {
|
||||
echo "<p>Could not find this file: $CFG->dirroot/lib/setup.php</p>";
|
||||
echo "<p>Are you sure all your files have been uploaded?</p>";
|
||||
} else {
|
||||
echo "<p>Error detected in config.php</p>";
|
||||
echo "<p>Error in: \$CFG->dirroot = '$CFG->dirroot';</p>";
|
||||
echo "<p>Try this: \$CFG->dirroot = '".dirname(__FILE__)."';</p>";
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
|
||||
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
|
||||
?>
|
||||
<?PHP // $Id$
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Moodle configuration file //
|
||||
// //
|
||||
// This file should be renamed "config.php" in the top-level directory //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.org //
|
||||
// //
|
||||
// Copyright (C) 1999-2004 Martin Dougiamas http://dougiamas.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 //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
unset($CFG); // Ignore this line
|
||||
|
||||
//=========================================================================
|
||||
// 1. DATABASE SETUP
|
||||
//=========================================================================
|
||||
// First, you need to configure the database where all Moodle data //
|
||||
// will be stored. This database must already have been created //
|
||||
// and a username/password created to access it. //
|
||||
// //
|
||||
// mysql - the prefix is optional, but useful when installing //
|
||||
// into databases that already contain tables. //
|
||||
//
|
||||
// postgres7 - the prefix is REQUIRED, regardless of whether the //
|
||||
// database already contains tables. //
|
||||
// //
|
||||
// A special case exists when using PostgreSQL databases via sockets. //
|
||||
// Define dbhost as follows, leaving dbname, dbuser, dbpass BLANK!: //
|
||||
// $CFG->dbhost = " user='muser' password='mpass' dbname='mdata'"; //
|
||||
//
|
||||
|
||||
$CFG->dbtype = 'mysql'; // mysql or postgres7 (for now)
|
||||
$CFG->dbhost = 'localhost'; // eg localhost or db.isp.com
|
||||
$CFG->dbname = 'moodle'; // database name, eg moodle
|
||||
$CFG->dbuser = 'username'; // your database username
|
||||
$CFG->dbpass = 'password'; // your database password
|
||||
$CFG->prefix = 'mdl_'; // Prefix to use for all table names
|
||||
|
||||
$CFG->dbpersist = false; // Should database connections be reused?
|
||||
// "false" is the most stable setting
|
||||
// "true" can improve performance sometimes
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 2. WEB SITE LOCATION
|
||||
//=========================================================================
|
||||
// Now you need to tell Moodle where it is located. Specify the full
|
||||
// web address to where moodle has been installed. If your web site
|
||||
// is accessible via multiple URLs then choose the most natural one
|
||||
// that your students would use. Do not include a trailing slash
|
||||
|
||||
$CFG->wwwroot = 'http://example.com/moodle';
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 3. SERVER FILES LOCATION
|
||||
//=========================================================================
|
||||
// Next, specify the full OS directory path to this same location
|
||||
// Make sure the upper/lower case is correct. Some examples:
|
||||
//
|
||||
// $CFG->dirroot = 'c:\FoxServ\www\moodle'; // Windows
|
||||
// $CFG->dirroot = '/var/www/html/moodle'; // Redhat Linux
|
||||
// $CFG->dirroot = '/home/example/www/moodle'; // Cpanel host
|
||||
|
||||
$CFG->dirroot = '/home/example/www/moodle';
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 4. DATA FILES LOCATION
|
||||
//=========================================================================
|
||||
// Now you need a place where Moodle can save uploaded files. This
|
||||
// directory should be readable AND WRITEABLE by the web server user
|
||||
// (usually 'nobody' or 'apache'), but it should not be accessible
|
||||
// directly via the web.
|
||||
//
|
||||
// - On hosting systems you might need to make sure that your "group" has
|
||||
// no permissions at all, but that "others" have full permissions.
|
||||
//
|
||||
// - On Windows systems you might specify something like 'c:\moodledata'
|
||||
|
||||
$CFG->dataroot = '/home/example/moodledata';
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 5. DATA FILES PERMISSIONS
|
||||
//=========================================================================
|
||||
// The following parameter sets the permissions of new directories
|
||||
// created by Moodle within the data directory. The format is in
|
||||
// octal format (as used by the Unix utility chmod, for example).
|
||||
// The default is usually OK, but you may want to change it to 0750
|
||||
// if you are concerned about world-access to the files (you will need
|
||||
// to make sure the web server process (eg Apache) can access the files.
|
||||
// NOTE: the prefixed 0 is important, and don't use quotes.
|
||||
|
||||
$CFG->directorypermissions = 0777;
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 6. DIRECTORY LOCATION (most people can just ignore this setting)
|
||||
//=========================================================================
|
||||
// A very few webhosts use /admin as a special URL for you to access a
|
||||
// control panel or something. Unfortunately this conflicts with the
|
||||
// standard location for the Moodle admin pages. You can fix this by
|
||||
// renaming the admin directory in your installation, and putting that
|
||||
// new name here. eg "moodleadmin". This will fix admin links in Moodle.
|
||||
|
||||
$CFG->admin = 'admin';
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// 7. OTHER MISCELLANEOUS SETTINGS (ignore these for new installations)
|
||||
//=========================================================================
|
||||
//
|
||||
// Prevent users from updating their profile images
|
||||
// $CFG->disableuserimages = true;
|
||||
//
|
||||
// Prevent scheduled backups from operating (and hide the GUI for them)
|
||||
// Useful for webhost operators who have alternate methods of backups
|
||||
// $CFG->disablescheduledbackups = true;
|
||||
//
|
||||
// Restrict certain usernames from doing things that may mess up a site
|
||||
// This is especially useful for demonstration teacher accounts
|
||||
// $CFG->restrictusers = 'teacher,fred,jim';
|
||||
//
|
||||
// Turning this on will make Moodle filter more than usual, including
|
||||
// forum subjects, activity names and so on (in ADDITION to the normal
|
||||
// texts like forum postings, journals etc). This is mostly only useful
|
||||
// when using the multilang filter. This feature may not be complete.
|
||||
// $CFG->filterall = true;
|
||||
//
|
||||
// Setting this to true will enable admins to edit any post at any time
|
||||
// $CFG->admineditalways = true;
|
||||
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// ALL DONE! To continue installation, visit your main page with a browser
|
||||
//=========================================================================
|
||||
if (file_exists("$CFG->dirroot/lib/setup.php")) { // Do not edit
|
||||
include_once("$CFG->dirroot/lib/setup.php");
|
||||
} else {
|
||||
if ($CFG->dirroot == dirname(__FILE__)) {
|
||||
echo "<p>Could not find this file: $CFG->dirroot/lib/setup.php</p>";
|
||||
echo "<p>Are you sure all your files have been uploaded?</p>";
|
||||
} else {
|
||||
echo "<p>Error detected in config.php</p>";
|
||||
echo "<p>Error in: \$CFG->dirroot = '$CFG->dirroot';</p>";
|
||||
echo "<p>Try this: \$CFG->dirroot = '".dirname(__FILE__)."';</p>";
|
||||
}
|
||||
die;
|
||||
}
|
||||
// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
|
||||
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
|
||||
?>
|
||||
|
||||
+51
-42
@@ -22,17 +22,20 @@
|
||||
if (iscreator()) {
|
||||
if (isset($_GET['edit'])) {
|
||||
if ($edit == "on") {
|
||||
$USER->editing = true;
|
||||
$USER->categoryediting = true;
|
||||
} else if ($edit == "off") {
|
||||
$USER->editing = false;
|
||||
$USER->categoryediting = false;
|
||||
}
|
||||
}
|
||||
$navbaritem = update_category_button($category->id);
|
||||
|
||||
$creatorediting = !empty($USER->editing);
|
||||
$creatorediting = !empty($USER->categoryediting);
|
||||
$adminediting = (isadmin() and $creatorediting);
|
||||
|
||||
} else {
|
||||
if (!$category->visible) {
|
||||
error(get_string('notavailable', 'error'));
|
||||
}
|
||||
$navbaritem = print_course_search("", true, "navbar");
|
||||
$adminediting = false;
|
||||
$creatorediting = false;
|
||||
@@ -67,17 +70,17 @@
|
||||
|
||||
if ($creatorediting) {
|
||||
if ($adminediting) {
|
||||
print_header("$site->shortname: $category->name", "$site->fullname",
|
||||
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"index.php\">$strcategories</a> -> $category->name",
|
||||
"", "", true, $navbaritem);
|
||||
} else {
|
||||
print_header("$site->shortname: $category->name", "$site->fullname",
|
||||
"<a href=\"index.php\">$strcourses</a> -> $category->name", "", "", true, $navbaritem);
|
||||
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
|
||||
"<a href=\"index.php\">$strcategories</a> -> $category->name", "", "", true, $navbaritem);
|
||||
}
|
||||
} else {
|
||||
print_header("$site->shortname: $category->name", "$site->fullname",
|
||||
"<a href=\"index.php\">$strcourses</a> -> $category->name", "", "", true, $navbaritem);
|
||||
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
|
||||
"<a href=\"index.php\">$strcategories</a> -> $category->name", "", "", true, $navbaritem);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +91,9 @@
|
||||
|
||||
make_categories_list($displaylist, $parentlist, "");
|
||||
|
||||
echo "<table align=center><tr><td>";
|
||||
echo "<table align=center><tr><td align=\"right\">";
|
||||
echo "<p>$strcategories:</p>";
|
||||
echo "</td><td>";
|
||||
popup_form("category.php?id=", $displaylist, "switchcategory", "$category->id", "", "", "", false);
|
||||
echo "</td></tr></table><br />";
|
||||
|
||||
@@ -201,14 +206,23 @@
|
||||
/// Print out all the sub-categories
|
||||
|
||||
if ($subcategories = get_records("course_categories", "parent", $category->id)) {
|
||||
echo "<table align=\"center\" border=0 cellspacing=2 cellpadding=4 class=\"generalbox\">";
|
||||
echo "<tr><th>".get_string("subcategories")."</th></tr>";
|
||||
echo "<tr><td nowrap>";
|
||||
$firstentry = true;
|
||||
foreach ($subcategories as $subcategory) {
|
||||
echo "<a href=\"category.php?id=$subcategory->id\">$subcategory->name</a><br />";
|
||||
if ($subcategory->visible or iscreator()) {
|
||||
if ($firstentry) {
|
||||
echo "<table align=\"center\" border=0 cellspacing=2 cellpadding=4 class=\"generalbox\">";
|
||||
echo "<tr><th>".get_string("subcategories")."</th></tr>";
|
||||
echo "<tr><td nowrap>";
|
||||
$firstentry = false;
|
||||
}
|
||||
$catlinkcss = $subcategory->visible ? "" : " class=\"dimmed\" ";
|
||||
echo "<a $catlinkcss href=\"category.php?id=$subcategory->id\">$subcategory->name</a><br />";
|
||||
}
|
||||
}
|
||||
if (!$firstentry) {
|
||||
echo "</td></tr></table>";
|
||||
echo "<br />";
|
||||
}
|
||||
echo "</td></tr></table>";
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +233,7 @@
|
||||
if (!$courses) {
|
||||
print_heading(get_string("nocoursesyet"));
|
||||
|
||||
} else if ($numcourses <= COURSE_MAX_SUMMARIES_PER_PAGE and !$creatorediting) {
|
||||
} else if ($numcourses <= COURSE_MAX_SUMMARIES_PER_PAGE and !$page and !$creatorediting) {
|
||||
print_courses($category, "80%");
|
||||
|
||||
} else {
|
||||
@@ -264,49 +278,44 @@
|
||||
$count = 0;
|
||||
$abletomovecourses = false; // for now
|
||||
|
||||
foreach ($courses as $course) {
|
||||
foreach ($courses as $acourse) {
|
||||
$count++;
|
||||
$up = ($count == 1) ? false : true;
|
||||
$down = ($count == $numcourses) ? false : true;
|
||||
|
||||
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
||||
$linkcss = $acourse->visible ? "" : " class=\"dimmed\" ";
|
||||
echo "<tr>";
|
||||
echo "<td><a $linkcss href=\"view.php?id=$course->id\">$course->fullname</a></td>";
|
||||
echo "<td><a $linkcss href=\"view.php?id=$acourse->id\">$acourse->fullname</a></td>";
|
||||
if ($creatorediting) {
|
||||
if ($adminediting) {
|
||||
echo "<td>";
|
||||
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/course/teacher.php?id=$course->id\"><img".
|
||||
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/course/teacher.php?id=$acourse->id\"><img".
|
||||
" src=\"$pixpath/t/user.gif\" height=11 width=11 border=0></a> ";
|
||||
echo "<a title=\"$strdelete\" href=\"delete.php?id=$course->id\"><img".
|
||||
echo "<a title=\"$strdelete\" href=\"delete.php?id=$acourse->id\"><img".
|
||||
" src=\"$pixpath/t/delete.gif\" height=11 width=11 border=0></a> ";
|
||||
if (!empty($course->visible)) {
|
||||
echo "<a title=\"$strhide\" href=\"category.php?id=$category->id&hide=$course->id\"><img".
|
||||
if (!empty($acourse->visible)) {
|
||||
echo "<a title=\"$strhide\" href=\"category.php?id=$category->id&hide=$acourse->id\"><img".
|
||||
" src=\"$pixpath/t/hide.gif\" height=11 width=11 border=0></a> ";
|
||||
} else {
|
||||
echo "<a title=\"$strshow\" href=\"category.php?id=$category->id&show=$course->id\"><img".
|
||||
echo "<a title=\"$strshow\" href=\"category.php?id=$category->id&show=$acourse->id\"><img".
|
||||
" src=\"$pixpath/t/show.gif\" height=11 width=11 border=0></a> ";
|
||||
}
|
||||
|
||||
echo "<a title=\"$strbackup\" href=\"../backup/backup.php?id=$course->id\"><img".
|
||||
echo "<a title=\"$strbackup\" href=\"../backup/backup.php?id=$acourse->id\"><img".
|
||||
" src=\"$pixpath/t/backup.gif\" height=11 width=11 border=0></a> ";
|
||||
|
||||
//Only showed if "backupdata" dir exists
|
||||
if (is_dir("$CFG->dataroot/$course->id/backupdata")) {
|
||||
echo "<a title=\"$strrestore\" href=\"../files/index.php?id=$course->id&wdir=/backupdata\"><img".
|
||||
echo "<a title=\"$strrestore\" href=\"../files/index.php?id=$acourse->id&wdir=/backupdata\"><img".
|
||||
" src=\"$pixpath/t/restore.gif\" height=11 width=11 border=0></a> ";
|
||||
} else {
|
||||
echo "<img src=\"$CFG->wwwroot/pix/spacer.gif\" height=11 width=11 border=0></a> ";
|
||||
}
|
||||
|
||||
if ($up) {
|
||||
echo "<a title=\"$strmoveup\" href=\"category.php?id=$category->id&moveup=$course->id\"><img".
|
||||
echo "<a title=\"$strmoveup\" href=\"category.php?id=$category->id&moveup=$acourse->id\"><img".
|
||||
" src=\"$pixpath/t/up.gif\" height=11 width=11 border=0></a> ";
|
||||
} else {
|
||||
echo "<img src=\"$CFG->wwwroot/pix/spacer.gif\" height=11 width=11 border=0></a> ";
|
||||
}
|
||||
|
||||
if ($down) {
|
||||
echo "<a title=\"$strmovedown\" href=\"category.php?id=$category->id&movedown=$course->id\"><img".
|
||||
echo "<a title=\"$strmovedown\" href=\"category.php?id=$category->id&movedown=$acourse->id\"><img".
|
||||
" src=\"$pixpath/t/down.gif\" height=11 width=11 border=0></a> ";
|
||||
} else {
|
||||
echo "<img src=\"$CFG->wwwroot/pix/spacer.gif\" height=11 width=11 border=0></a> ";
|
||||
@@ -314,25 +323,25 @@
|
||||
|
||||
echo "</td>";
|
||||
echo "<td align=\"center\">";
|
||||
echo "<input type=\"checkbox\" name=\"c$course->id\">";
|
||||
echo "<input type=\"checkbox\" name=\"c$acourse->id\">";
|
||||
$abletomovecourses = true;
|
||||
|
||||
} else if (isteacheredit($course->id)) {
|
||||
} else if (isteacheredit($acourse->id)) {
|
||||
echo "<td>";
|
||||
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/course/teacher.php?id=$course->id\"><img".
|
||||
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/course/teacher.php?id=$acourse->id\"><img".
|
||||
" src=\"$pixpath/t/user.gif\" height=11 width=11 border=0></a> ";
|
||||
}
|
||||
echo "</td>";
|
||||
} else {
|
||||
echo "<td align=\"right\">";
|
||||
if ($course->guest ) {
|
||||
echo "<a href=\"view.php?id=$course->id\"><img hspace=2 title=\"$strallowguests\" alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a>";
|
||||
if ($acourse->guest ) {
|
||||
echo "<a href=\"view.php?id=$acourse->id\"><img hspace=2 title=\"$strallowguests\" alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a>";
|
||||
}
|
||||
if ($course->password) {
|
||||
echo "<a href=\"view.php?id=$course->id\"><img hspace=2 title=\"$strrequireskey\" alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/key.gif\"></a>";
|
||||
if ($acourse->password) {
|
||||
echo "<a href=\"view.php?id=$acourse->id\"><img hspace=2 title=\"$strrequireskey\" alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/key.gif\"></a>";
|
||||
}
|
||||
if ($course->summary) {
|
||||
link_to_popup_window ("/course/info.php?id=$course->id", "courseinfo",
|
||||
if ($acourse->summary) {
|
||||
link_to_popup_window ("/course/info.php?id=$acourse->id", "courseinfo",
|
||||
"<img hspace=2 alt=\"info\" height=16 width=16 border=0 src=\"$pixpath/i/info.gif\">",
|
||||
400, 500, $strsummary);
|
||||
}
|
||||
|
||||
+135
-76
@@ -1,75 +1,123 @@
|
||||
<?PHP
|
||||
// Make sure all variables are defined
|
||||
if (!isset($form->showreports)) {
|
||||
$form->showreports = 0;
|
||||
}
|
||||
if (!isset($form->maxbytes)) {
|
||||
$form->maxbytes = 0;
|
||||
}
|
||||
?>
|
||||
<FORM METHOD="post" action="edit.php" NAME="form">
|
||||
<table cellpadding=9 cellspacing=0 >
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("category") ?>:</td>
|
||||
<td><?php
|
||||
<td align="right"><P><?php print_string("category") ?>:</td>
|
||||
<td><?php
|
||||
$displaylist = array();
|
||||
$parentlist = array();
|
||||
make_categories_list($displaylist, $parentlist);
|
||||
choose_from_menu($displaylist, "category", "$form->category", "");
|
||||
helpbutton("coursecategory", get_string("category"));
|
||||
?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("fullname") ?>:</td>
|
||||
<td><input type="text" name="fullname" maxlength="254" size=50 value="<?php p($form->fullname) ?>">
|
||||
<td align="right"><P><?php print_string("fullname") ?>:</td>
|
||||
<td><input type="text" name="fullname" maxlength="254" size=50 value="<?php p($form->fullname) ?>">
|
||||
<?php helpbutton("coursefullname", get_string("fullname")) ?>
|
||||
<?php if (isset($err["fullname"])) formerr($err["fullname"]); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("shortname") ?>:</td>
|
||||
<td><input type="text" name="shortname" maxlength="15" size="10" value="<?php p($form->shortname) ?>">
|
||||
<td align="right"><P><?php print_string("shortname") ?>:</td>
|
||||
<td><input type="text" name="shortname" maxlength="15" size="10" value="<?php p($form->shortname) ?>">
|
||||
<?php helpbutton("courseshortname", get_string("shortname")) ?>
|
||||
<?php if (isset($err["shortname"])) formerr($err["shortname"]); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("summary") ?>:</td>
|
||||
<td><TEXTAREA NAME=summary COLS=50 ROWS=10 WRAP=virtual><?php p($form->summary) ?></TEXTAREA>
|
||||
<?php helpbutton("text", get_string("helptext")) ?>
|
||||
<?php if (isset($err["summary"])) formerr($err["summary"]); ?>
|
||||
</td>
|
||||
<td align="right"><P><?php print_string("summary") ?>:</td>
|
||||
<td><?php
|
||||
print_textarea($usehtmleditor, 10, 50, 660, 200, "summary", $form->summary);
|
||||
helpbutton("text", get_string("helptext"));
|
||||
if (isset($err["summary"])) formerr($err["summary"]);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("availability") ?>:</td>
|
||||
<td><?php
|
||||
<td align="right"><P><?php print_string("format") ?>:</td>
|
||||
<td><?php
|
||||
choose_from_menu ($form->courseformats, "format", "$form->format", "");
|
||||
helpbutton("courseformats", get_string("courseformats"));
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("startdate") ?>:</td>
|
||||
<td><?php
|
||||
print_date_selector("startday", "startmonth", "startyear", $form->startdate);
|
||||
helpbutton("coursestartdate", get_string("startdate"));
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("numberweeks") ?>:</td>
|
||||
<td><?php
|
||||
for ($i=1; $i<=52; $i++) {
|
||||
$sectionmenu[$i] = "$i";
|
||||
}
|
||||
choose_from_menu ($sectionmenu, "numsections", "$form->numsections", "");
|
||||
helpbutton("coursenumsections", get_string("numberweeks"));
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("groupmode") ?>:</td>
|
||||
<td><?php
|
||||
unset($choices);
|
||||
$choices[NOGROUPS] = get_string("groupsnone");
|
||||
$choices[SEPARATEGROUPS] = get_string("groupsseparate");
|
||||
$choices[VISIBLEGROUPS] = get_string("groupsvisible");
|
||||
choose_from_menu ($choices, "groupmode", $form->groupmode, "");
|
||||
helpbutton("groupmode", get_string("groupmode"));
|
||||
|
||||
echo ' ';
|
||||
print_string('force');
|
||||
echo ': ';
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
choose_from_menu ($choices, "groupmodeforce", $form->groupmodeforce, "");
|
||||
helpbutton("groupmodeforce", get_string("groupmodeforce")); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("availability") ?>:</td>
|
||||
<td><?php
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("courseavailablenot");
|
||||
$choices["1"] = get_string("courseavailable");
|
||||
choose_from_menu ($choices, "visible", $form->visible, "");
|
||||
helpbutton("courseavailability", get_string("availability")); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("enrolmentkey") ?>:</td>
|
||||
<td><input type="text" name="password" size=25 value="<?php p($form->password) ?>">
|
||||
<td align="right"><P><?php print_string("enrolmentkey") ?>:</td>
|
||||
<td><input type="text" name="password" size=25 value="<?php p($form->password) ?>">
|
||||
<?php helpbutton("enrolmentkey", get_string("enrolmentkey")) ?>
|
||||
<?php if (isset($err["password"])) formerr($err["password"]); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("opentoguests") ?>:</td>
|
||||
<td><?php
|
||||
<td align="right"><P><?php print_string("opentoguests") ?>:</td>
|
||||
<td><?php
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("guestsno");
|
||||
$choices["1"] = get_string("guestsyes");
|
||||
$choices["2"] = get_string("guestskey");
|
||||
choose_from_menu ($choices, "guest", $form->guest, "");
|
||||
helpbutton("guestaccess", get_string("opentoguests")); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("format") ?>:</td>
|
||||
<td><?php
|
||||
choose_from_menu ($form->courseformats, "format", "$form->format", "");
|
||||
helpbutton("courseformats", get_string("courseformats"));
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("newsitemsnumber") ?>:</td>
|
||||
<td align="right"><P><?php print_string("newsitemsnumber") ?>:</td>
|
||||
<td><?php
|
||||
$newsitem = get_string("newsitem");
|
||||
$newsitems = get_string("newsitems");
|
||||
@@ -91,73 +139,84 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("startdate") ?>:</td>
|
||||
<td><?php
|
||||
print_date_selector("startday", "startmonth", "startyear", $form->startdate);
|
||||
helpbutton("coursestartdate", get_string("startdate"));
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("numberweeks") ?>:</td>
|
||||
<td><?php
|
||||
for ($i=1; $i<=52; $i++) {
|
||||
$sectionmenu[$i] = "$i";
|
||||
}
|
||||
choose_from_menu ($sectionmenu, "numsections", "$form->numsections", "");
|
||||
helpbutton("coursenumsections", get_string("numberweeks"));
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("showrecent") ?>:</td>
|
||||
<td><?php
|
||||
<td align="right"><P><?php print_string("showrecent") ?>:</td>
|
||||
<td><?php
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
choose_from_menu ($choices, "showrecent", $form->showrecent, "");
|
||||
helpbutton("courserecent", get_string("recentactivity")); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("showgrades") ?>:</td>
|
||||
<td><?php
|
||||
<td align="right"><P><?php print_string("showgrades") ?>:</td>
|
||||
<td><?php
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
choose_from_menu ($choices, "showgrades", $form->showgrades, "");
|
||||
helpbutton("coursegrades", get_string("grades")); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("wordforteacher") ?>:</td>
|
||||
<td><input type="text" name="teacher" maxlength="100" size=25 value="<?php p($form->teacher) ?>">
|
||||
(<?php print_string("wordforteachereg") ?>)
|
||||
<td align="right"><P><?php print_string("showreports") ?>:</td>
|
||||
<td><?php
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
choose_from_menu ($choices, "showreports", $form->showreports, "");
|
||||
helpbutton("coursereports", get_string("activityreport")); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("maximumupload") ?>:</td>
|
||||
<td><?php
|
||||
$choices = get_max_upload_sizes($CFG->maxbytes);
|
||||
choose_from_menu ($choices, "maxbytes", $form->maxbytes, "");
|
||||
helpbutton("courseuploadsize", get_string("maximumupload")); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("wordforteacher") ?>:</td>
|
||||
<td><input type="text" name="teacher" maxlength="100" size=25 value="<?php p($form->teacher) ?>">
|
||||
(<?php print_string("wordforteachereg") ?>)
|
||||
<?php if (isset($err["teacher"])) formerr($err["teacher"]); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("wordforteachers") ?>:</td>
|
||||
<td><input type="text" name="teachers" maxlength="100" size=25 value="<?php p($form->teachers) ?>">
|
||||
(<?php print_string("wordforteacherseg") ?>)
|
||||
<td align="right"><P><?php print_string("wordforteachers") ?>:</td>
|
||||
<td><input type="text" name="teachers" maxlength="100" size=25 value="<?php p($form->teachers) ?>">
|
||||
(<?php print_string("wordforteacherseg") ?>)
|
||||
<?php if (isset($err["teachers"])) formerr($err["teachers"]); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("wordforstudent") ?>:</td>
|
||||
<td><input type="text" name="student" maxlength="100" size=25 value="<?php p($form->student) ?>">
|
||||
(<?php print_string("wordforstudenteg") ?>)
|
||||
<td align="right"><P><?php print_string("wordforstudent") ?>:</td>
|
||||
<td><input type="text" name="student" maxlength="100" size=25 value="<?php p($form->student) ?>">
|
||||
(<?php print_string("wordforstudenteg") ?>)
|
||||
<?php if (isset($err["student"])) formerr($err["student"]); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td><P><?php print_string("wordforstudents") ?>:</td>
|
||||
<td><input type="text" name="students" maxlength="100" size=25 value="<?php p($form->students) ?>">
|
||||
(<?php print_string("wordforstudentseg") ?>)
|
||||
<td align="right"><P><?php print_string("wordforstudents") ?>:</td>
|
||||
<td><input type="text" name="students" maxlength="100" size=25 value="<?php p($form->students) ?>">
|
||||
(<?php print_string("wordforstudentseg") ?>)
|
||||
<?php if (isset($err["students"])) formerr($err["students"]); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("forcelanguage") ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
$languages[''] = get_string("forceno");
|
||||
$languages += get_list_of_languages();
|
||||
choose_from_menu ($languages, "lang", $form->lang, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
</TABLE>
|
||||
<INPUT type="hidden" name="id" value="<?php echo $form->id ?>">
|
||||
</FORM>
|
||||
<td></td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
</table>
|
||||
<input type="hidden" name="id" value="<?php echo $form->id ?>">
|
||||
</form>
|
||||
|
||||
+17
-6
@@ -37,6 +37,8 @@
|
||||
|
||||
if ($form = data_submitted()) {
|
||||
|
||||
check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
|
||||
$form->startdate = make_timestamp($form->startyear, $form->startmonth, $form->startday);
|
||||
|
||||
validate_form($course, $form, $err);
|
||||
@@ -116,6 +118,8 @@
|
||||
$form->newsitems = 5;
|
||||
$form->showrecent = 1;
|
||||
$form->showgrades = 1;
|
||||
$form->groupmode = 0;
|
||||
$form->groupmodeforce = 0;
|
||||
$form->category = $category;
|
||||
$form->id = "";
|
||||
$form->visible = 1;
|
||||
@@ -139,12 +143,15 @@
|
||||
}
|
||||
|
||||
$form->categories = get_records_select_menu("course_categories", "", "name", "id,name");
|
||||
|
||||
$form->courseformats = array (
|
||||
"weeks" => get_string("formatweeks"),
|
||||
"social" => get_string("formatsocial"),
|
||||
"topics" => get_string("formattopics")
|
||||
);
|
||||
|
||||
$courseformats = get_list_of_plugins("course/format");
|
||||
$form->courseformats = array();
|
||||
|
||||
foreach ($courseformats as $courseformat) {
|
||||
$form->courseformats["$courseformat"] = get_string("format$courseformat");
|
||||
}
|
||||
|
||||
$usehtmleditor = can_use_html_editor();
|
||||
|
||||
$streditcoursesettings = get_string("editcoursesettings");
|
||||
$straddnewcourse = get_string("addnewcourse");
|
||||
@@ -168,6 +175,10 @@
|
||||
|
||||
print_footer($course);
|
||||
|
||||
if ($usehtmleditor) {
|
||||
use_html_editor();
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
/// Functions /////////////////////////////////////////////////////////////////
|
||||
|
||||
+15
-23
@@ -1,35 +1,27 @@
|
||||
<center>
|
||||
<form name="theform" method="post" <?php echo $onsubmit ?> action="editsection.php">
|
||||
<table border=0 cellpadding=0 cellspacing=0>
|
||||
<tr>
|
||||
<td align=top>
|
||||
<p><b><?php print_string("summaryof", "", "$sectionname $form->section") ?></b></p>
|
||||
</td>
|
||||
<td align=top width=100>
|
||||
|
||||
</td>
|
||||
<td align=top>
|
||||
<font size=-1>
|
||||
<form name="theform" method="post" action="editsection.php">
|
||||
<table cellpadding=5>
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php print_string("summary") ?>:</b></p>
|
||||
<br />
|
||||
<font size="1">
|
||||
<?php helpbutton("summaries", get_string("helpsummaries"), "moodle", true, true);
|
||||
echo "<br />";
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
</tr></table>
|
||||
<?php print_textarea($usehtmleditor, 4, 60, 660, 200, "summary", $form->summary); ?>
|
||||
<p>
|
||||
<br />
|
||||
</font>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_textarea($usehtmleditor, 4, 60, 660, 200, "summary", $form->summary); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name=id value="<?php echo $form->id ?>">
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>">
|
||||
<input type="reset" value="<?php print_string("revert") ?>">
|
||||
</p>
|
||||
</form>
|
||||
</center>
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
print_richedit_javascript("theform", "summary", "yes");
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -43,21 +43,23 @@
|
||||
$form = $section;
|
||||
}
|
||||
|
||||
if ($usehtmleditor = can_use_richtext_editor()) {
|
||||
$onsubmit = "onsubmit=\"copyrichtext(theform.summary);\"";
|
||||
} else {
|
||||
$onsubmit = "";
|
||||
}
|
||||
$usehtmleditor = can_use_html_editor();
|
||||
|
||||
$sectionname = get_string("name$course->format");
|
||||
$stredit = get_string("edit", "", " $sectionname $section->section");
|
||||
|
||||
print_header("$course->shortname: $stredit", "$course->fullname",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
|
||||
-> $stredit", "form.summary");
|
||||
-> $stredit");
|
||||
|
||||
print_heading(get_string("summaryof", "", "$sectionname $form->section"));
|
||||
print_simple_box_start("center", "", "$THEME->cellheading");
|
||||
include("editsection.html");
|
||||
print_simple_box_end();
|
||||
|
||||
if ($usehtmleditor) {
|
||||
use_html_editor();
|
||||
}
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
|
||||
+32
-8
@@ -8,10 +8,21 @@
|
||||
|
||||
require_login();
|
||||
|
||||
$strloginto = get_string("loginto", "", $course->shortname);
|
||||
$strcourses = get_string("courses");
|
||||
|
||||
if (! $course = get_record("course", "id", $id) ) {
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Could not find a site!");
|
||||
}
|
||||
|
||||
check_for_restricted_user($USER->username);
|
||||
|
||||
/// Check the submitted enrollment key if there is one
|
||||
|
||||
if ($form = data_submitted()) {
|
||||
|
||||
if ($form->password == $course->password) {
|
||||
@@ -39,13 +50,13 @@
|
||||
add_to_log($course->id, "course", "enrol", "view.php?id=$course->id", "$USER->id");
|
||||
}
|
||||
|
||||
$USER->student["$id"] = true;
|
||||
$USER->student[$course->id] = true;
|
||||
|
||||
if ($SESSION->wantsurl) {
|
||||
$destination = $SESSION->wantsurl;
|
||||
unset($SESSION->wantsurl);
|
||||
} else {
|
||||
$destination = "$CFG->wwwroot/course/view.php?id=$id";
|
||||
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
}
|
||||
|
||||
redirect($destination);
|
||||
@@ -55,13 +66,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
$strloginto = get_string("loginto", "", $course->shortname);
|
||||
$strcourses = get_string("courses");
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Could not find a site!");
|
||||
/// Double check just in case they are actually enrolled already
|
||||
/// This might occur if they were manually enrolled during this session
|
||||
|
||||
if (record_exists("user_students", "userid", $USER->id, "course", $course->id)) {
|
||||
$USER->student[$course->id] = true;
|
||||
|
||||
if ($SESSION->wantsurl) {
|
||||
$destination = $SESSION->wantsurl;
|
||||
unset($SESSION->wantsurl);
|
||||
} else {
|
||||
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
}
|
||||
|
||||
redirect($destination);
|
||||
}
|
||||
|
||||
|
||||
/// Automatically enrol into courses without password
|
||||
|
||||
if ($course->password == "") { // no password, so enrol
|
||||
|
||||
if (isguest()) {
|
||||
@@ -82,13 +106,13 @@
|
||||
}
|
||||
add_to_log($course->id, "course", "enrol", "view.php?id=$course->id", "$USER->id");
|
||||
|
||||
$USER->student["$id"] = true;
|
||||
$USER->student[$course->id] = true;
|
||||
|
||||
if ($SESSION->wantsurl) {
|
||||
$destination = $SESSION->wantsurl;
|
||||
unset($SESSION->wantsurl);
|
||||
} else {
|
||||
$destination = "$CFG->wwwroot/course/view.php?id=$id";
|
||||
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
}
|
||||
|
||||
redirect($destination);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Course formats
|
||||
--------------
|
||||
|
||||
To add a new course format, just duplicate one of the
|
||||
existing folders in here with a new name (eg coollayout).
|
||||
Then edit lang/en/moodle and add a new string like:
|
||||
|
||||
$string['formatcoollayout'] = 'Cool Layout';
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
require_once("$CFG->dirroot/mod/resource/lib.php");
|
||||
|
||||
$leftwidth = 210;
|
||||
$strgroups = get_string("groups");
|
||||
$strgroupmy = get_string("groupmy");
|
||||
?>
|
||||
|
||||
<table width="100%" border="0" cellspacing="5" cellpadding="5">
|
||||
@@ -13,15 +15,29 @@
|
||||
<td width="<?php echo $leftwidth?>" valign="top">
|
||||
<?php
|
||||
$moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
|
||||
$modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
|
||||
$editmyprofile = "<a title=\"$USER->firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
|
||||
|
||||
if ($course->groupmode or !$course->groupmodeforce) {
|
||||
if ($course->groupmode == VISIBLEGROUPS or isteacheredit($course->id)) {
|
||||
$moddata[]="<a title=\"$strgroups\" href=\"groups.php?id=$course->id\">$strgroups</a>";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
|
||||
} else if ($course->groupmode == SEPARATEGROUPS and $course->groupmodeforce) {
|
||||
// Show nothing
|
||||
} else if ($currentgroup = get_current_group($course->id)) {
|
||||
$moddata[]="<a title=\"$strgroupmy\" href=\"group.php?id=$course->id\">$strgroupmy</a>";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
|
||||
}
|
||||
}
|
||||
|
||||
$fullname = fullname($USER, true);
|
||||
$editmyprofile = "<a title=\"$fullname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".
|
||||
get_string("editmyprofile")."</A>";
|
||||
if ($USER->description) {
|
||||
$moddata[]= $editmyprofile;
|
||||
} else {
|
||||
$moddata[]= $editmyprofile." <blink>*</blink>";
|
||||
}
|
||||
$modicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
||||
print_side_block(get_string("people"), "", $moddata, $modicon, "", $leftwidth);
|
||||
|
||||
|
||||
@@ -60,7 +76,7 @@
|
||||
} else {
|
||||
$subtext = get_string("subscribe", "forum");
|
||||
}
|
||||
$headertext = "<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td>".
|
||||
$headertext = "<table border=0 width=100% cellpadding=0 cellspacing=0 class=headingblockcontent><tr><td>".
|
||||
get_string("socialheadline").
|
||||
"</td><td align=right><font size=1>".
|
||||
"<a href=\"../mod/forum/subscribe.php?id=$social->id\">$subtext</a></td>".
|
||||
@@ -34,6 +34,8 @@
|
||||
$stractivities = get_string("activities");
|
||||
$strshowalltopics = get_string("showalltopics");
|
||||
$strtopic = get_string("topic");
|
||||
$strgroups = get_string("groups");
|
||||
$strgroupmy = get_string("groupmy");
|
||||
if (isediting($course->id)) {
|
||||
$strstudents = moodle_strtolower($course->students);
|
||||
$strtopichide = get_string("topichide", "", $strstudents);
|
||||
@@ -54,14 +56,28 @@
|
||||
|
||||
/// Links to people
|
||||
$moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
|
||||
$modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
|
||||
$editmyprofile = "<a title=\"$USER->firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
|
||||
|
||||
if ($course->groupmode or !$course->groupmodeforce) {
|
||||
if ($course->groupmode == VISIBLEGROUPS or isteacheredit($course->id)) {
|
||||
$moddata[]="<a title=\"$strgroups\" href=\"groups.php?id=$course->id\">$strgroups</a>";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
|
||||
} else if ($course->groupmode == SEPARATEGROUPS and $course->groupmodeforce) {
|
||||
// Show nothing
|
||||
} else if ($currentgroup = get_current_group($course->id)) {
|
||||
$moddata[]="<a title=\"$strgroupmy\" href=\"group.php?id=$course->id\">$strgroupmy</a>";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
|
||||
}
|
||||
}
|
||||
|
||||
$fullname = fullname($USER, true);
|
||||
$editmyprofile = "<a title=\"$fullname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
|
||||
if ($USER->description) {
|
||||
$moddata[]= $editmyprofile;
|
||||
} else {
|
||||
$moddata[]= $editmyprofile." <blink>*</blink>";
|
||||
}
|
||||
$modicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
||||
print_side_block(get_string("people"), "", $moddata, $modicon);
|
||||
|
||||
|
||||
@@ -70,8 +86,10 @@
|
||||
$modicon = array();
|
||||
if ($modnamesused) {
|
||||
foreach ($modnamesused as $modname => $modfullname) {
|
||||
$moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
|
||||
$modicon[] = "<img src=\"$modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
|
||||
if ($modname != "label") {
|
||||
$moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
|
||||
$modicon[] = "<img src=\"$CFG->modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
|
||||
}
|
||||
}
|
||||
}
|
||||
print_side_block($stractivities, "", $moddata, $modicon);
|
||||
@@ -97,7 +115,7 @@
|
||||
|
||||
/// If currently moving a file then show the current clipboard
|
||||
if (ismoving($course->id)) {
|
||||
$stractivityclipboard = get_string("activityclipboard", "", addslashes($USER->activitycopyname));
|
||||
$stractivityclipboard = strip_tags(get_string("activityclipboard", "", addslashes($USER->activitycopyname)));
|
||||
$strcancel= get_string("cancel");
|
||||
echo "<tr>";
|
||||
echo "<td colspan=3 valign=top bgcolor=\"$THEME->cellcontent\" class=\"topicoutlineclip\" width=\"100%\">";
|
||||
@@ -120,13 +138,15 @@
|
||||
echo "<td nowrap bgcolor=\"$THEME->cellheading\" class=\"topicsoutlineside\" valign=top width=20> </td>";
|
||||
echo "<td valign=top bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontent\" width=\"100%\">";
|
||||
|
||||
echo format_text($thissection->summary, FORMAT_HTML);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
$thissection->summary .= " <a title=\"$streditsummary\" ".
|
||||
"href=\"editsection.php?id=$thissection->id\"><img src=\"$pixpath/t/edit.gif\" ".
|
||||
"height=11 width=11 border=0 alt=\"$streditsummary\"></a></p>";
|
||||
echo "<a title=\"$streditsummary\" ".
|
||||
" href=\"editsection.php?id=$thissection->id\"><img src=\"$CFG->pixpath/t/edit.gif\" ".
|
||||
" height=11 width=11 border=0 alt=\"$streditsummary\"></a><br />";
|
||||
}
|
||||
|
||||
echo text_to_html($thissection->summary);
|
||||
echo '<br clear="all">';
|
||||
|
||||
print_section($course, $thissection, $mods, $modnamesused);
|
||||
|
||||
@@ -209,12 +229,14 @@
|
||||
} else {
|
||||
echo "<td valign=top $colormain width=\"100%\">";
|
||||
|
||||
echo format_text($thissection->summary, FORMAT_HTML);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
$thissection->summary .= " <a title=\"$streditsummary\" href=editsection.php?id=$thissection->id>".
|
||||
"<img src=\"$pixpath/t/edit.gif\" border=0 height=11 width=11></a>";
|
||||
echo " <a title=\"$streditsummary\" href=editsection.php?id=$thissection->id>".
|
||||
"<img src=\"$CFG->pixpath/t/edit.gif\" border=0 height=11 width=11></a><br />";
|
||||
}
|
||||
|
||||
echo text_to_html($thissection->summary);
|
||||
|
||||
echo '<br clear="all">';
|
||||
|
||||
print_section($course, $thissection, $mods, $modnamesused);
|
||||
|
||||
@@ -232,38 +254,38 @@
|
||||
|
||||
if ($displaysection == $section) { // Show the zoom boxes
|
||||
echo "<a href=\"view.php?id=$course->id&topic=all\" title=\"$strshowalltopics\">".
|
||||
"<img src=\"$pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
|
||||
} else {
|
||||
$strshowonlytopic = get_string("showonlytopic", "", $section);
|
||||
echo "<a href=\"view.php?id=$course->id&topic=$section\" title=\"$strshowonlytopic\">".
|
||||
"<img src=\"$pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
|
||||
}
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if ($course->marker == $section) { // Show the "light globe" on/off
|
||||
echo "<a href=\"view.php?id=$course->id&marker=0\" title=\"$strmarkedthistopic\">".
|
||||
"<img src=\"$pixpath/i/marked.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/marked.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
} else {
|
||||
echo "<a href=\"view.php?id=$course->id&marker=$section\" title=\"$strmarkthistopic\">".
|
||||
"<img src=\"$pixpath/i/marker.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/marker.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
}
|
||||
|
||||
if ($thissection->visible) { // Show the hide/show eye
|
||||
echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strtopichide\">".
|
||||
"<img src=\"$pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
} else {
|
||||
echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strtopicshow\">".
|
||||
"<img src=\"$pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
}
|
||||
|
||||
if ($section > 1) { // Add a arrow to move section up
|
||||
echo "<a href=\"view.php?id=$course->id§ion=$section&move=-1\" title=\"$strmoveup\">".
|
||||
"<img src=\"$pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
|
||||
}
|
||||
|
||||
if ($section < $course->numsections) { // Add a arrow to move section down
|
||||
echo "<a href=\"view.php?id=$course->id§ion=$section&move=1\" title=\"$strmovedown\">".
|
||||
"<img src=\"$pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -284,12 +306,12 @@
|
||||
}
|
||||
|
||||
|
||||
if ($news or $course->showrecent) {
|
||||
if (!empty($news) or $course->showrecent) {
|
||||
echo "</td><td width=210>";
|
||||
|
||||
/// Print all the news items.
|
||||
|
||||
if ($news) {
|
||||
if (!empty($news)) {
|
||||
print_side_block_start(get_string("latestnews"), 210, "sideblocklatestnews");
|
||||
echo "<font size=\"-2\">";
|
||||
forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "", false);
|
||||
@@ -24,6 +24,8 @@
|
||||
$stractivities = get_string("activities");
|
||||
$strshowallweeks = get_string("showallweeks");
|
||||
$strweek = get_string("week");
|
||||
$strgroups = get_string("groups");
|
||||
$strgroupmy = get_string("groupmy");
|
||||
if (isediting($course->id)) {
|
||||
$strstudents = moodle_strtolower($course->students);
|
||||
$strweekhide = get_string("weekhide", "", $strstudents);
|
||||
@@ -42,14 +44,28 @@
|
||||
|
||||
/// Links to people
|
||||
$moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
|
||||
$modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
|
||||
$editmyprofile = "<a title=\"$USER->firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
|
||||
|
||||
if ($course->groupmode or !$course->groupmodeforce) {
|
||||
if ($course->groupmode == VISIBLEGROUPS or isteacheredit($course->id)) {
|
||||
$moddata[]="<a title=\"$strgroups\" href=\"groups.php?id=$course->id\">$strgroups</a>";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
|
||||
} else if ($course->groupmode == SEPARATEGROUPS and $course->groupmodeforce) {
|
||||
// Show nothing
|
||||
} else if ($currentgroup = get_current_group($course->id)) {
|
||||
$moddata[]="<a title=\"$strgroupmy\" href=\"group.php?id=$course->id\">$strgroupmy</a>";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
|
||||
}
|
||||
}
|
||||
|
||||
$fullname = fullname($USER, true);
|
||||
$editmyprofile = "<a title=\"$fullname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
|
||||
if ($USER->description) {
|
||||
$moddata[]= $editmyprofile;
|
||||
} else {
|
||||
$moddata[]= $editmyprofile." <blink>*</blink>";
|
||||
}
|
||||
$modicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
||||
$modicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
||||
print_side_block(get_string("people"), "", $moddata, $modicon);
|
||||
|
||||
|
||||
@@ -58,8 +74,10 @@
|
||||
$modicon = array();
|
||||
if ($modnamesused) {
|
||||
foreach ($modnamesused as $modname => $modfullname) {
|
||||
$moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
|
||||
$modicon[] = "<img src=\"$modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
|
||||
if ($modname != "label") {
|
||||
$moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
|
||||
$modicon[] = "<img src=\"$CFG->modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
|
||||
}
|
||||
}
|
||||
}
|
||||
print_side_block($stractivities, "", $moddata, $modicon);
|
||||
@@ -85,7 +103,7 @@
|
||||
|
||||
/// If currently moving a file then show the current clipboard
|
||||
if (ismoving($course->id)) {
|
||||
$stractivityclipboard = get_string("activityclipboard", "", addslashes($USER->activitycopyname));
|
||||
$stractivityclipboard = strip_tags(get_string("activityclipboard", "", addslashes($USER->activitycopyname)));
|
||||
$strcancel= get_string("cancel");
|
||||
echo "<tr>";
|
||||
echo "<td colspan=3 valign=top bgcolor=\"$THEME->cellcontent\" class=\"weeklyoutlineclip\" width=\"100%\">";
|
||||
@@ -107,13 +125,15 @@
|
||||
echo "<td nowrap bgcolor=\"$THEME->cellheading\" class=\"weeklyoutlineside\" valign=top width=20> </td>";
|
||||
echo "<td valign=top bgcolor=\"$THEME->cellcontent\" class=\"weeklyoutlinecontent\" width=\"100%\">";
|
||||
|
||||
echo format_text($thissection->summary, FORMAT_HTML);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
$thissection->summary .= " <a title=\"$streditsummary\" ".
|
||||
"href=\"editsection.php?id=$thissection->id\"><img height=11 width=11 src=\"$pixpath/t/edit.gif\" ".
|
||||
"border=0 alt=\"$streditsummary\"></a></p>";
|
||||
echo " <a title=\"$streditsummary\" ".
|
||||
" href=\"editsection.php?id=$thissection->id\"><img height=11 width=11 src=\"$CFG->pixpath/t/edit.gif\" ".
|
||||
" border=0 alt=\"$streditsummary\"></a><br />";
|
||||
}
|
||||
|
||||
echo text_to_html($thissection->summary);
|
||||
|
||||
echo '<br clear="all">';
|
||||
|
||||
print_section($course, $thissection, $mods, $modnamesused);
|
||||
|
||||
@@ -199,12 +219,14 @@
|
||||
|
||||
echo "<p class=\"weeklydatetext\">$weekday - $endweekday</p>";
|
||||
|
||||
echo format_text($thissection->summary, FORMAT_HTML);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
$thissection->summary .= " <a title=\"$streditsummary\" href=\"editsection.php?id=$thissection->id\">".
|
||||
"<img src=\"$pixpath/t/edit.gif\" height=11 width=11 border=0></a></p>";
|
||||
echo " <a title=\"$streditsummary\" href=\"editsection.php?id=$thissection->id\">".
|
||||
"<img src=\"$CFG->pixpath/t/edit.gif\" height=11 width=11 border=0></a><br />";
|
||||
}
|
||||
|
||||
echo text_to_html($thissection->summary);
|
||||
echo '<br clear="all">';
|
||||
|
||||
print_section($course, $thissection, $mods, $modnamesused);
|
||||
|
||||
@@ -222,30 +244,30 @@
|
||||
|
||||
if ($displaysection == $section) {
|
||||
echo "<a href=\"view.php?id=$course->id&week=all\" title=\"$strshowallweeks\">".
|
||||
"<img src=\"$pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
|
||||
} else {
|
||||
$strshowonlyweek = get_string("showonlyweek", "", $section);
|
||||
echo "<a href=\"view.php?id=$course->id&week=$section\" title=\"$strshowonlyweek\">".
|
||||
"<img src=\"$pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
|
||||
}
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if ($thissection->visible) { // Show the hide/show eye
|
||||
echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strweekhide\">".
|
||||
"<img src=\"$pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
} else {
|
||||
echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strweekshow\">".
|
||||
"<img src=\"$pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
|
||||
}
|
||||
|
||||
if ($section > 1) { // Add a arrow to move section up
|
||||
echo "<a href=\"view.php?id=$course->id§ion=$section&move=-1\" title=\"$strmoveup\">".
|
||||
"<img src=\"$pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
|
||||
}
|
||||
|
||||
if ($section < $course->numsections) { // Add a arrow to move section down
|
||||
echo "<a href=\"view.php?id=$course->id§ion=$section&move=1\" title=\"$strmovedown\">".
|
||||
"<img src=\"$pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
|
||||
"<img src=\"$CFG->pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
|
||||
}
|
||||
|
||||
}
|
||||
+88
-40
@@ -1,9 +1,8 @@
|
||||
<?PHP // $Id$
|
||||
// Displays all grades for a course
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../lib/psxlsgen.php");
|
||||
require_once("../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
require_variable($id); // course id
|
||||
optional_variable($download, ""); // to download data
|
||||
@@ -23,11 +22,28 @@
|
||||
$strmax = get_string("maximumshort");
|
||||
$stractivityreport = get_string("activityreport");
|
||||
|
||||
/// Check to see if groups are being used in this course
|
||||
if ($groupmode = groupmode($course)) { // Groups are being used
|
||||
if (isset($_GET['group'])) {
|
||||
$changegroup = $_GET['group']; /// 0 or higher
|
||||
} else {
|
||||
$changegroup = -1; /// This means no group change was specified
|
||||
}
|
||||
|
||||
$currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
|
||||
} else {
|
||||
$currentgroup = false;
|
||||
}
|
||||
|
||||
if ($currentgroup) {
|
||||
$students = get_group_students($currentgroup, "u.lastname ASC");
|
||||
} else {
|
||||
$students = get_course_students($course->id, "u.lastname ASC");
|
||||
}
|
||||
|
||||
/// Get a list of all students
|
||||
|
||||
if (!$students = get_course_students($course->id, "u.lastname ASC")) {
|
||||
print_header("$course->shortname: $strgrades", "$course->fullname",
|
||||
if (!$students) {
|
||||
print_header("$course->shortname: $strgrades", "$course->fullname",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
|
||||
-> $strgrades");
|
||||
print_heading(get_string("nostudentsyet"));
|
||||
@@ -125,22 +141,35 @@
|
||||
|
||||
|
||||
/// OK, we have all the data, now present it to the user
|
||||
|
||||
if ($download == "xls") {
|
||||
require_once("../lib/excel/Worksheet.php");
|
||||
require_once("../lib/excel/Workbook.php");
|
||||
|
||||
$myxls = new PhpSimpleXlsGen();
|
||||
$myxls->totalcol = count($columns) + 5;
|
||||
// HTTP headers
|
||||
header("Content-type: application/vnd.ms-excel");
|
||||
header("Content-Disposition: attachment; filename=".$course->shortname."_$strgrades.xls");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control: must-revalidate,post-check=0,pre-check=0");
|
||||
header("Pragma: public");
|
||||
|
||||
/// Creating a workbook
|
||||
$workbook = new Workbook("-");
|
||||
$myxls =& $workbook->add_worksheet($strgrades);
|
||||
|
||||
/// Print names of all the fields
|
||||
|
||||
$myxls->ChangePos(0,0);
|
||||
$myxls->InsertText(get_string("firstname"));
|
||||
$myxls->InsertText(get_string("lastname"));
|
||||
$myxls->write_string(0,0,get_string("firstname"));
|
||||
$myxls->write_string(0,1,get_string("lastname"));
|
||||
$myxls->write_string(0,2,get_string("idnumber"));
|
||||
$myxls->write_string(0,3,get_string("institution"));
|
||||
$myxls->write_string(0,4,get_string("department"));
|
||||
$myxls->write_string(0,5,get_string("email"));
|
||||
$pos=6;
|
||||
foreach ($columns as $column) {
|
||||
$myxls->InsertText(strip_tags($column));
|
||||
$myxls->write_string(0,$pos++,strip_tags($column));
|
||||
}
|
||||
$myxls->InsertText(get_string("total"));
|
||||
|
||||
$myxls->write_string(0,$pos,get_string("total"));
|
||||
|
||||
|
||||
/// Print all the lines of data.
|
||||
|
||||
@@ -148,22 +177,27 @@
|
||||
foreach ($grades as $studentid => $studentgrades) {
|
||||
$i++;
|
||||
$student = $students[$studentid];
|
||||
|
||||
$myxls->ChangePos($i,0);
|
||||
$myxls->InsertText($student->firstname);
|
||||
$myxls->InsertText($student->lastname);
|
||||
|
||||
foreach ($studentgrades as $grade) {
|
||||
$myxls->InsertText(strip_tags($grade));
|
||||
if (empty($totals[$student->id])) {
|
||||
$totals[$student->id] = '';
|
||||
}
|
||||
$myxls->InsertNumber($totals[$student->id]);
|
||||
|
||||
$myxls->write_string($i,0,$student->firstname);
|
||||
$myxls->write_string($i,1,$student->lastname);
|
||||
$myxls->write_string($i,2,$student->idnumber);
|
||||
$myxls->write_string($i,3,$student->institution);
|
||||
$myxls->write_string($i,4,$student->department);
|
||||
$myxls->write_string($i,5,$student->email);
|
||||
$j=6;
|
||||
foreach ($studentgrades as $grade) {
|
||||
$myxls->write_string($i,$j++,strip_tags($grade));
|
||||
}
|
||||
$myxls->write_number($i,$j,$totals[$student->id]);
|
||||
}
|
||||
|
||||
$myxls->SendFileName("$course->shortname $strgrades");
|
||||
|
||||
|
||||
$workbook->close();
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
} else if ($download == "txt") {
|
||||
|
||||
/// Print header to force download
|
||||
@@ -173,7 +207,12 @@
|
||||
|
||||
/// Print names of all the fields
|
||||
|
||||
echo get_string("firstname")."\t".get_string("lastname");
|
||||
echo get_string("firstname")."\t".
|
||||
get_string("lastname")."\t".
|
||||
get_string("idnumber")."\t".
|
||||
get_string("institution")."\t".
|
||||
get_string("department")."\t".
|
||||
get_string("email");
|
||||
foreach ($columns as $column) {
|
||||
$column = strip_tags($column);
|
||||
echo "\t$column";
|
||||
@@ -184,7 +223,10 @@
|
||||
|
||||
foreach ($grades as $studentid => $studentgrades) {
|
||||
$student = $students[$studentid];
|
||||
echo "$student->firstname\t$student->lastname";
|
||||
if (empty($totals[$student->id])) {
|
||||
$totals[$student->id] = '';
|
||||
}
|
||||
echo "$student->firstname\t$student->lastname\t$student->idnumber\t$student->institution\t$student->department\t$student->email";
|
||||
foreach ($studentgrades as $grade) {
|
||||
$grade = strip_tags($grade);
|
||||
echo "\t$grade";
|
||||
@@ -198,12 +240,25 @@
|
||||
|
||||
} else { // Just print the web page
|
||||
|
||||
print_header("$course->shortname: $strgrades", "$course->fullname",
|
||||
print_header("$course->shortname: $strgrades", "$course->fullname",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
|
||||
-> $strgrades");
|
||||
|
||||
print_heading($strgrades);
|
||||
|
||||
setup_and_print_groups($course, $groupmode, "grades.php?id=$course->id");
|
||||
|
||||
echo "<TABLE BORDER=0 ALIGN=CENTER><TR>";
|
||||
echo "<TD>";
|
||||
$options["id"] = "$course->id";
|
||||
$options["download"] = "xls";
|
||||
print_single_button("grades.php", $options, get_string("downloadexcel"));
|
||||
echo "<TD>";
|
||||
$options["download"] = "txt";
|
||||
print_single_button("grades.php", $options, get_string("downloadtext"));
|
||||
echo "</TABLE>";
|
||||
|
||||
|
||||
$table->head = array_merge(array ("", get_string("firstname"), get_string("lastname")), $columnhtml, get_string("total"));
|
||||
$table->width = array(35, "");
|
||||
$table->align = array("LEFT", "RIGHT", "LEFT");
|
||||
@@ -216,6 +271,9 @@
|
||||
|
||||
foreach ($students as $key => $student) {
|
||||
$studentgrades = $gradeshtml[$student->id];
|
||||
if (empty($totals[$student->id])) {
|
||||
$totals[$student->id] = '';
|
||||
}
|
||||
$picture = print_user_picture($student->id, $course->id, $student->picture, false, true);
|
||||
$name = array ("$picture", "$student->firstname", "$student->lastname");
|
||||
$total = array ($totals[$student->id]);
|
||||
@@ -225,16 +283,6 @@
|
||||
|
||||
print_table($table);
|
||||
|
||||
echo "<TABLE BORDER=0 ALIGN=CENTER><TR>";
|
||||
echo "<TD>";
|
||||
$options["id"] = "$course->id";
|
||||
$options["download"] = "xls";
|
||||
print_single_button("grades.php", $options, get_string("downloadexcel"));
|
||||
echo "<TD>";
|
||||
$options["download"] = "txt";
|
||||
print_single_button("grades.php", $options, get_string("downloadtext"));
|
||||
echo "</TABLE>";
|
||||
|
||||
print_footer($course);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<form method="post" enctype="multipart/form-data" action="group.php">
|
||||
<table cellpadding=9 cellspacing="0" align="center">
|
||||
<tr valign="top">
|
||||
<td align="right"><p><?php print_string("name") ?>:</td>
|
||||
<td><input type="text" name="name" size=30 value="<?php p($group->name) ?>">
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("description") ?>:</td>
|
||||
<td><?php
|
||||
print_textarea($usehtmleditor, 10, 50, 660, 200, "description", $group->description);
|
||||
helpbutton("text", get_string("helptext"));
|
||||
if (isset($err["description"])) formerr($err["description"]);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align="right"><P><?php print_string("hidepicture") ?>:</td>
|
||||
<td><?php
|
||||
$options = NULL;
|
||||
$options[0] = get_string("no");
|
||||
$options[1] = get_string("yes");
|
||||
choose_from_menu ($options, "hidepicture", $group->hidepicture, "");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes);
|
||||
if (!empty($CFG->gdversion) and $maxbytes) {
|
||||
?>
|
||||
<tr valign=top>
|
||||
<td align="right"><p><?php print_string("newpicture") ?>:</td>
|
||||
<td>
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxbytes ?>">
|
||||
<input type="file" name="imagefile" size=40>
|
||||
<?php helpbutton("picture", get_string("helppicture"));
|
||||
print_string("maxsize", "", display_size($maxbytes));
|
||||
if (isset($err["imagefile"])) formerr($err["imagefile"]);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="group" value="<?php p($group->id) ?>">
|
||||
<input type="hidden" name="id" value="<?php p($course->id) ?>">
|
||||
</form>
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php // $Id$
|
||||
|
||||
/// Shows current group, and allows editing of the group
|
||||
/// icon and other settings related to that group
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
require_variable($id); // Course id
|
||||
optional_variable($group); // Optionally look at other groups
|
||||
optional_variable($edit); // Turn editing on and off
|
||||
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
if ($group) {
|
||||
if (isteacheredit($course->id) or $course->groupmode == VISIBLEGROUPS) {
|
||||
if (! $group = get_record("groups", "id", $group, "courseid", $course->id)) {
|
||||
error('Specified group could not be found!', "groups.php?id=$course->id");
|
||||
}
|
||||
} else {
|
||||
error('Sorry, you don\'t have access to view this group', "view.php?id=$course->id");
|
||||
}
|
||||
} else if (! $group = get_current_group($course->id, 'full')) {
|
||||
error('You are not currently in a group!', "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
if (isteacheredit($course->id) or (isteacher($course->id) and ismember($group->id) ) ) {
|
||||
$edit = isset($_GET['edit']);
|
||||
$editbutton = $edit ? "" : update_group_button($course->id, $group->id);
|
||||
} else {
|
||||
$edit = false;
|
||||
$editbutton = "";
|
||||
}
|
||||
|
||||
|
||||
/// Print the headers of the page
|
||||
|
||||
$strgroup = get_string('group');
|
||||
$strgroups = get_string('groups');
|
||||
$loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
|
||||
|
||||
if (isteacheredit($course->id) or $course->groupmode == VISIBLEGROUPS) {
|
||||
print_header("$strgroup : $group->name", "$course->fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
|
||||
-> <a href=\"groups.php?id=$course->id\">$strgroups</a> -> $group->name",
|
||||
"", "", true, $editbutton, $loggedinas);
|
||||
} else {
|
||||
print_header("$strgroup : $group->name", "$course->fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
|
||||
-> $strgroup -> $group->name", "", "", true, "", $loggedinas);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($form = data_submitted()) {
|
||||
|
||||
if (empty($form->name)) {
|
||||
$edit = true;
|
||||
$err['name'] = get_string("missingname");
|
||||
|
||||
} else {
|
||||
if (!empty($_FILES['imagefile'])) {
|
||||
require_once("$CFG->libdir/gdlib.php");
|
||||
if ($filename = valid_uploaded_file($_FILES['imagefile'])) {
|
||||
$group->picture = save_profile_image($group->id, $filename, 'groups');
|
||||
}
|
||||
}
|
||||
$group->name = $form->name;
|
||||
$group->description = $form->description;
|
||||
$group->hidepicture = $form->hidepicture;
|
||||
if (!update_record("groups", $group)) {
|
||||
notify("A strange error occurred while trying to save ");
|
||||
} else {
|
||||
redirect("group.php?id=$course->id&group=$group->id", get_string("changessaved"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Are we editing? If so, handle it.
|
||||
|
||||
if ($edit) { // We are editing a group's information
|
||||
if ($usehtmleditor = can_use_richtext_editor()) {
|
||||
$defaultformat = FORMAT_HTML;
|
||||
} else {
|
||||
$defaultformat = FORMAT_MOODLE;
|
||||
}
|
||||
|
||||
include('group-edit.html');
|
||||
|
||||
if ($usehtmleditor) {
|
||||
use_html_editor();
|
||||
}
|
||||
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
/// Just display the information
|
||||
|
||||
print_heading($group->name);
|
||||
echo '<div align="center">';
|
||||
print_group_picture($group, $course->id, true, false, false);
|
||||
echo '</div>';
|
||||
if ($group->description) {
|
||||
print_simple_box(format_text($group->description), 'center', '50%');
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
|
||||
if ($users = get_group_users($group->id)) {
|
||||
foreach ($users as $user) {
|
||||
print_user($user, $course);
|
||||
}
|
||||
} else {
|
||||
print_heading(get_string('nousersyet'));
|
||||
}
|
||||
|
||||
|
||||
/// Finish off the page
|
||||
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
Executable
+170
@@ -0,0 +1,170 @@
|
||||
<script language="JavaScript">
|
||||
<!-- Begin
|
||||
<?php
|
||||
foreach ($listmembers as $groupid => $listmember) {
|
||||
echo "group$groupid = new Object();\n";
|
||||
$useridstring = "group$groupid.userid = new Array(";
|
||||
$usernamestring = "group$groupid.username = new Array(";
|
||||
$max = count($listmember);
|
||||
$count = 0;
|
||||
foreach ($listmember as $userid => $username) {
|
||||
$count++;
|
||||
$useridstring .= "\"$userid\"";
|
||||
$usernamestring .= "\"$username\"";
|
||||
if ($count < $max) {
|
||||
$useridstring .= ', ';
|
||||
$usernamestring .= ', ';
|
||||
}
|
||||
}
|
||||
$useridstring .= ");\n";
|
||||
$usernamestring .= ");\n";
|
||||
|
||||
echo $useridstring;
|
||||
echo $usernamestring;
|
||||
}
|
||||
?>
|
||||
|
||||
function updateGroup() {
|
||||
document.form1.groupid.value = document.form2.groups.value;
|
||||
document.form3.groupid.value = document.form2.groups.value;
|
||||
}
|
||||
|
||||
|
||||
function updateMembers(selectgroup) {
|
||||
eval('group=group'+selectgroup.value);
|
||||
|
||||
username = group.username;
|
||||
userid = group.userid;
|
||||
|
||||
document.form3['members[]'].length = username.length;
|
||||
|
||||
for (i=0;i<username.length;i++) {
|
||||
document.form3['members[]'].options[i].value = userid[i];
|
||||
document.form3['members[]'].options[i].text = username[i];
|
||||
}
|
||||
|
||||
updateGroup();
|
||||
}
|
||||
|
||||
function userWindow(selectuser) {
|
||||
num = 0;
|
||||
for (var i=0; i<selectuser.options.length; i++) {
|
||||
if (selectuser.options[i].selected) {
|
||||
num++;
|
||||
user = selectuser.options[i].value;
|
||||
openpopup('/user/view.php?id='+user+'&course=<?php echo $courseid ?>','userinfo'+num,'','');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function groupWindow(selectgroup) {
|
||||
num = 0;
|
||||
for (var i=0; i<selectgroup.options.length; i++) {
|
||||
if (selectgroup.options[i].selected) {
|
||||
num++;
|
||||
group = selectgroup.options[i].value;
|
||||
openpopup('/course/group.php?id=<?php echo $courseid ?>&group='+group,'groupinfo'+num,'','');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// end hiding script -->
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<table border="0" cellspacing="2" cellpadding="10" align="center" class="generalbox">
|
||||
<tr>
|
||||
<td width="33%" align="center" class="generaltableheader"><?php p($strgroupnonmembers) ?></td>
|
||||
<td width="33%" align="center" class="generaltableheader"><?php p($strgroups) ?></td>
|
||||
<td width="33%" align="center" class="generaltableheader"><?php p($strgroupmembersselected) ?></td>
|
||||
</tr>
|
||||
<tr align="center" valign="top">
|
||||
<td class="generalboxcontent"><p>
|
||||
<form name="form1" id="form1" method="post" action="groups.php">
|
||||
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
|
||||
<input type="hidden" name="groupid" value="<?php p($selectedgroup) ?>" />
|
||||
<select name="nonmembers[]" size="15" multiple="multiple">
|
||||
<?php
|
||||
if (!empty($nonmembers)) {
|
||||
foreach ($nonmembers as $id => $nonmembername) {
|
||||
echo "<option value=\"$id\">$nonmembername</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="nonmembersadd" value="<?php p($strgroupaddusers) ?> ->"
|
||||
onclick="updateGroup()" />
|
||||
</p>
|
||||
<!--<p>
|
||||
<input type="submit" name="nonmembersrandom" value="<?php p($strgrouprandomassign) ?> ->" />
|
||||
</p> -->
|
||||
<p>
|
||||
<input type="submit" name="nonmembersinfo" value="<?php p($strgroupinfopeople) ?>"
|
||||
onclick="return userWindow(document.form1['nonmembers[]']);" />
|
||||
</p>
|
||||
</form>
|
||||
</td>
|
||||
<td class="generalboxcontent"><p>
|
||||
<form name="form2" id="form2" method="post" action="groups.php">
|
||||
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
|
||||
<select name="groups" size="15" onChange="updateMembers(this)">
|
||||
<?php
|
||||
if (!empty($listgroups)) {
|
||||
foreach ($listgroups as $id => $listgroup) {
|
||||
$selected = '';
|
||||
if ($id == $selectedgroup) {
|
||||
$selected = 'selected="selected"';
|
||||
}
|
||||
echo "<option $selected value=\"$id\">$listgroup</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="groupsinfo" value="<?php p($strgroupinfo) ?>"
|
||||
onclick="return groupWindow(document.form2.groups);"/>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="groupsremove" value="<?php p($strgroupremove) ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<input name="newgroupname" type="text" size="10" />
|
||||
<input type="submit" name="groupsadd" value="<?php p($strgroupadd) ?>" />
|
||||
</p>
|
||||
</form>
|
||||
</td>
|
||||
|
||||
|
||||
<td class="generalboxcontent"><p>
|
||||
<form name="form3" id="form3" method="post" action="groups.php">
|
||||
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
|
||||
<input type="hidden" name="groupid" value="<?php p($selectedgroup) ?>" />
|
||||
<select name="members[]" size="15" multiple="multiple">
|
||||
<?php
|
||||
if (!empty($members)) {
|
||||
foreach ($members as $id => $membername) {
|
||||
echo "<option value=\"$id\">$membername</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="membersinfo" value="<?php p($strgroupinfomembers) ?>"
|
||||
onclick="return userWindow(document.form3['members[]']);" />
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="membersremove" value="<?php p($strgroupremovemembers) ?>"
|
||||
onclick="updateGroup()" />
|
||||
</p>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,50 @@
|
||||
<table align="center" class="generalbox" width="70%">
|
||||
<tr>
|
||||
<th colspan="2"><?php echo $t->name ?></th>
|
||||
</tr>
|
||||
<tr><td class="generalboxcontent" bgcolor="<?php echo $THEME->cellcontent ?>">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td valign="top" width="120">
|
||||
<p><?php echo $t->picture ?></p>
|
||||
</td>
|
||||
<td>
|
||||
<p><?php echo $t->description ?></p>
|
||||
<?php
|
||||
if (!empty($t->linkeditprofile)) {
|
||||
echo '<p style="font-size: small" align="right"><a href="'.$t->linkeditprofile->url.'">'.$t->linkeditprofile->text.'</a>...</p>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="<?php echo $THEME->cellcontent ?>">
|
||||
<td colspan="2" align="left">
|
||||
<p style="font-size: x-small"><?php
|
||||
if ($t->users) {
|
||||
$countusers = count($t->users);
|
||||
foreach ($t->users as $user) {
|
||||
echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$t->courseid\">$user->fullname</a>";
|
||||
$countusers--;
|
||||
if ($countusers) {
|
||||
echo ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="<?php echo $THEME->cellcontent ?>">
|
||||
<td colspan="2" align="right">
|
||||
<?php
|
||||
if (!empty($t->linkfullprofile)) {
|
||||
echo '<p style="font-size: small" align="right"><a href="'.$t->linkfullprofile->url.'">'.$t->linkfullprofile->text.'</a>...</p>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php // $Id$
|
||||
|
||||
/// Shows all the groups in a course.
|
||||
/// Editing teachers see a nifty interface for defining groups
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
require_variable($id); // Course id
|
||||
optional_variable($edit); // Turn editing on and off
|
||||
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
if (!isteacheredit($course->id) and $course->groupmode != VISIBLEGROUPS) {
|
||||
redirect("group.php?id=$course->id"); // Not allowed to see all groups
|
||||
}
|
||||
|
||||
if (isteacheredit($course->id)) {
|
||||
if (isset($_GET['edit'])) {
|
||||
if ($edit == "on") {
|
||||
$USER->groupsediting = true;
|
||||
} else if ($edit == "off") {
|
||||
$USER->groupsediting = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$USER->groupsediting = false;
|
||||
}
|
||||
|
||||
|
||||
/// Print the header of the page
|
||||
|
||||
$strgroup = get_string('group');
|
||||
$strgroups = get_string('groups');
|
||||
$streditgroupprofile = get_string('editgroupprofile');
|
||||
$strgroupmemberssee = get_string('groupmemberssee');
|
||||
$loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
|
||||
|
||||
print_header("$course->shortname: $strgroups", "$course->fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
|
||||
-> $strgroups", "", "", true, update_groups_button($course->id), $loggedinas);
|
||||
|
||||
|
||||
/// Get the current list of groups
|
||||
|
||||
$groups = get_groups($course->id);
|
||||
|
||||
if (!$USER->groupsediting) { /// Display an overview of all groups
|
||||
if (!$groups) {
|
||||
print_heading(get_string('groupsnone'));
|
||||
|
||||
} else {
|
||||
$isteacher = isteacher($course->id);
|
||||
$isteacheredit = isteacheredit($course->id);
|
||||
foreach ($groups as $group) {
|
||||
$t = $group;
|
||||
$t->description = format_text($group->description);
|
||||
$t->picture = print_group_picture($group, $course->id, true, true, true);
|
||||
if ($t->users = get_group_users($group->id, 'u.lastname ASC')) {
|
||||
foreach ($t->users as $key => $user) {
|
||||
$t->users[$key]->fullname = fullname($user, $isteacher);
|
||||
}
|
||||
}
|
||||
if ($isteacheredit or ($isteacher and ismember($group->id))) {
|
||||
$t->linkeditprofile->url = "group.php?id=$course->id&group=$group->id&edit=on";
|
||||
$t->linkeditprofile->text = $streditgroupprofile;
|
||||
}
|
||||
$t->linkfullprofile->url = "group.php?id=$course->id&group=$group->id";
|
||||
$t->linkfullprofile->text = $strgroupmemberssee;
|
||||
|
||||
include('groups-summary.html');
|
||||
}
|
||||
}
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/// We are in editing mode. First, process any inputs there may be.
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
|
||||
if (!empty($data->nonmembersadd)) { /// Add people to a group
|
||||
if (!empty($data->nonmembers) and !empty($data->groupid)) {
|
||||
$groupmodified = false;
|
||||
foreach ($data->nonmembers as $userid) {
|
||||
if (!user_group($course->id, $userid)) { // Just to make sure (another teacher could be editing)
|
||||
$record->groupid = $data->groupid;
|
||||
$record->userid = $userid;
|
||||
$record->timeadded = time();
|
||||
if (!insert_record('groups_members', $record)) {
|
||||
notify("Error occurred while adding user $userid to group $data->groupid");
|
||||
}
|
||||
$groupmodified = true;
|
||||
}
|
||||
}
|
||||
if ($groupmodified) {
|
||||
set_field('groups', 'timemodified', time(), 'id', $data->groupid);
|
||||
}
|
||||
}
|
||||
$selectedgroup = $data->groupid;
|
||||
|
||||
|
||||
} else if (!empty($data->nonmembersrandom)) { /// Add all non members to groups
|
||||
notify("Random adding of people into groups is not functional yet.");
|
||||
|
||||
} else if (!empty($data->nonmembersinfo)) { /// Return info about the selected users
|
||||
notify("You must turn Javascript on");
|
||||
|
||||
} else if (!empty($data->groupsremove)) { /// Remove a group, all members become nonmembers
|
||||
if (!empty($data->groups)) {
|
||||
delete_records("groups", "id", $data->groups);
|
||||
delete_records("groups_members", "groupid", $data->groups);
|
||||
unset($groups[$data->groups]);
|
||||
}
|
||||
|
||||
|
||||
} else if (!empty($data->groupsinfo)) { /// Display full info for a group
|
||||
notify("You must turn Javascript on");
|
||||
|
||||
} else if (!empty($data->groupsadd)) { /// Create a new group
|
||||
if (!empty($data->newgroupname)) {
|
||||
$newgroup->name = $data->newgroupname;
|
||||
$newgroup->courseid = $course->id;
|
||||
$newgroup->lang = current_language();
|
||||
$newgroup->timecreated = time();
|
||||
if (!insert_record("groups", $newgroup)) {
|
||||
notify("Could not insert the new group '$newgroup->name'");
|
||||
}
|
||||
$groups = get_groups($course->id);
|
||||
}
|
||||
|
||||
} else if (!empty($data->membersremove)) { /// Remove selected people from a particular group
|
||||
|
||||
if (!empty($data->members) and !empty($data->groupid)) {
|
||||
foreach ($data->members as $userid) {
|
||||
delete_records('groups_members', 'userid', $userid, "groupid", $data->groupid);
|
||||
set_field('groups', 'timemodified', time(), 'id', $data->groupid);
|
||||
}
|
||||
}
|
||||
$selectedgroup = $data->groupid;
|
||||
|
||||
} else if (!empty($data->membersinfo)) { /// Return info about the selected users
|
||||
notify("You must turn Javascript on");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$SESSION->fullnamedisplay = 'firstname lastname';
|
||||
|
||||
|
||||
/// Calculate data ready to create the editing interface
|
||||
|
||||
$strgroupnonmembers = get_string('groupnonmembers');
|
||||
$strgroupmembersselected = get_string('groupmembersselected');
|
||||
$strgroupremovemembers = get_string('groupremovemembers');
|
||||
$strgroupinfomembers = get_string('groupinfomembers');
|
||||
$strgroupadd = get_string('groupadd');
|
||||
$strgroupremove = get_string('groupremove');
|
||||
$strgroupinfo = get_string('groupinfo');
|
||||
$strgroupinfopeople = get_string('groupinfopeople');
|
||||
$strgrouprandomassign = get_string('grouprandomassign');
|
||||
$strgroupaddusers = get_string('groupaddusers');
|
||||
$courseid = $course->id;
|
||||
$listgroups = array();
|
||||
$listmembers = array();
|
||||
$nonmembers = array();
|
||||
$groupcount = count($groups);
|
||||
|
||||
|
||||
/// First, get everyone into the nonmembers array
|
||||
|
||||
if ($students = get_course_students($course->id)) {
|
||||
foreach ($students as $student) {
|
||||
$nonmembers[$student->id] = fullname($student, true);
|
||||
}
|
||||
unset($students);
|
||||
}
|
||||
|
||||
if ($teachers = get_course_teachers($course->id)) {
|
||||
foreach ($teachers as $teacher) {
|
||||
$prefix = '- ';
|
||||
if (isteacheredit($course->id, $user->id)) {
|
||||
$prefix = '# ';
|
||||
}
|
||||
$nonmembers[$teacher->id] = $prefix.fullname($teacher, true);
|
||||
}
|
||||
unset($teachers);
|
||||
}
|
||||
|
||||
/// Pull out all the members into little arrays
|
||||
|
||||
if ($groups) {
|
||||
foreach ($groups as $group) {
|
||||
$countusers = 0;
|
||||
$listmembers[$group->id] = array();
|
||||
if ($groupusers = get_group_users($group->id)) {
|
||||
foreach ($groupusers as $groupuser) {
|
||||
$listmembers[$group->id][$groupuser->id] = $nonmembers[$groupuser->id];
|
||||
unset($nonmembers[$groupuser->id]);
|
||||
$countusers++;
|
||||
}
|
||||
natcasesort($listmembers[$group->id]);
|
||||
}
|
||||
$listgroups[$group->id] = $group->name." ($countusers)";
|
||||
}
|
||||
natcasesort($listgroups);
|
||||
}
|
||||
|
||||
natcasesort($nonmembers);
|
||||
|
||||
if (empty($selectedgroup)) { // Choose the first group by default
|
||||
if ($selectedgroup = array_shift(array_keys($listgroups))) {
|
||||
$members = $listmembers[$selectedgroup];
|
||||
}
|
||||
} else {
|
||||
$members = $listmembers[$selectedgroup];
|
||||
}
|
||||
|
||||
/// Print out the complete form
|
||||
|
||||
include('groups-edit.html');
|
||||
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
+36
-18
@@ -5,22 +5,25 @@
|
||||
require_once("../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
}
|
||||
|
||||
if (isadmin()) {
|
||||
if (isset($_GET['edit'])) {
|
||||
if ($edit == "on") {
|
||||
$USER->editing = true;
|
||||
$USER->categoriesediting = true;
|
||||
} else if ($edit == "off") {
|
||||
$USER->editing = false;
|
||||
$USER->categoriesediting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$adminediting = (isadmin() and !empty($USER->editing));
|
||||
$adminediting = (isadmin() and !empty($USER->categoriesediting));
|
||||
|
||||
|
||||
/// Unless it's an editing admin, just print the regular listing of courses/categories
|
||||
@@ -30,8 +33,10 @@
|
||||
|
||||
if ($countcategories > 1) {
|
||||
$strcourses = get_string("courses");
|
||||
print_header($strcourses, $strcourses, $strcourses, "", "", true, update_categories_button());
|
||||
print_heading(get_string("categories"));
|
||||
$strcategories = get_string("categories");
|
||||
print_header("$site->shortname: $strcategories", $strcourses,
|
||||
$strcategories, "", "", true, update_categories_button());
|
||||
print_heading($strcategories);
|
||||
print_simple_box_start("center", "50%", "#FFFFFF", 5, "categorybox");
|
||||
print_whole_category_list();
|
||||
print_simple_box_end();
|
||||
@@ -44,9 +49,7 @@
|
||||
|
||||
if (iscreator()) { // Print link to create a new course
|
||||
echo "<center><p>";
|
||||
unset($options);
|
||||
$option["category"] = $category->id;
|
||||
print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
|
||||
print_single_button("edit.php", NULL, get_string("addnewcourse"), "get");
|
||||
echo "</p></center>";
|
||||
}
|
||||
|
||||
@@ -98,18 +101,33 @@
|
||||
/// Delete a category if necessary
|
||||
|
||||
if (isset($delete)) {
|
||||
if ($tempcat = get_record("course_categories", "id", $delete)) {
|
||||
if (delete_records("course_categories", "id", $tempcat->id)) {
|
||||
notify(get_string("categorydeleted", "", $tempcat->name));
|
||||
}
|
||||
if ($children = get_records("course_categories", "parent", $tempcat->id)) {
|
||||
// Send the children to live with their grandparent
|
||||
foreach ($children as $childcat) {
|
||||
if (! set_field("course_categories", "parent", $tempcat->parent, "id", $childcat->id)) {
|
||||
notify("Could not update a child category!");
|
||||
if ($deletecat = get_record("course_categories", "id", $delete)) {
|
||||
|
||||
/// Send the children categories to live with their grandparent
|
||||
if ($childcats = get_records("course_categories", "parent", $deletecat->id)) {
|
||||
foreach ($childcats as $childcat) {
|
||||
if (! set_field("course_categories", "parent", $deletecat->parent, "id", $childcat->id)) {
|
||||
error("Could not update a child category!", "index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If the grandparent is a valid (non-zero) category, then
|
||||
/// send the children courses to live with their grandparent as well
|
||||
if ($deletecat->parent) {
|
||||
if ($childcourses = get_records("course", "category", $deletecat->id)) {
|
||||
foreach ($childcourses as $childcourse) {
|
||||
if (! set_field("course", "category", $deletecat->parent, "id", $childcourse->id)) {
|
||||
error("Could not update a child course!", "index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Finally delete the category itself
|
||||
if (delete_records("course_categories", "id", $deletecat->id)) {
|
||||
notify(get_string("categorydeleted", "", $deletecat->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@
|
||||
echo "<center>";
|
||||
if ($course->guest) {
|
||||
$strallowguests = get_string("allowguests");
|
||||
echo "<p><font size=1><img align=\"absmiddle\" alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a> $strallowguests</font></p>";
|
||||
echo "<p><font size=1><img align=\"absmiddle\" alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/guest.gif\"></a> $strallowguests</font></p>";
|
||||
}
|
||||
if ($course->password) {
|
||||
$strrequireskey = get_string("requireskey");
|
||||
@@ -66,7 +66,7 @@
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center", "100%");
|
||||
echo text_to_html($course->summary);
|
||||
echo filter_text(text_to_html($course->summary),$course->id);
|
||||
print_simple_box_end();
|
||||
|
||||
echo "<br />";
|
||||
|
||||
+574
-210
File diff suppressed because it is too large
Load Diff
+15
-11
@@ -7,6 +7,9 @@
|
||||
require_variable($id); // Course ID
|
||||
optional_variable($user, 0); // User to display
|
||||
optional_variable($date, 0); // Date to display
|
||||
optional_variable($modname, ""); // course_module->id
|
||||
optional_variable($modid, ""); // course_module->id
|
||||
optional_variable($modaction, ""); // an action as recorded in the logs
|
||||
optional_variable($page, "0"); // which page to show
|
||||
optional_variable($perpage, "100"); // how many per page
|
||||
|
||||
@@ -46,40 +49,41 @@
|
||||
|
||||
if ($course->category) {
|
||||
print_header("$course->shortname: $strlogs", "$course->fullname",
|
||||
"<A HREF=\"view.php?id=$course->id\">$course->shortname</A> ->
|
||||
<A HREF=\"log.php?id=$course->id\">$strlogs</A> -> $userinfo, $dateinfo", "");
|
||||
"<a href=\"view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"log.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", "");
|
||||
} else {
|
||||
print_header("$course->shortname: $strlogs", "$course->fullname",
|
||||
"<A HREF=\"../$CFG->admin/index.php\">$stradministration</A> ->
|
||||
<A HREF=\"log.php?id=$course->id\">$strlogs</A> -> $userinfo, $dateinfo", "");
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> ->
|
||||
<a href=\"log.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", "");
|
||||
}
|
||||
|
||||
print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
|
||||
|
||||
print_log_selector_form($course, $user, $date);
|
||||
print_log_selector_form($course, $user, $date, $modname, $modid, $modaction);
|
||||
|
||||
print_log($course, $user, $date, "l.time DESC", $page, $perpage,
|
||||
"log.php?id=$course->id&chooselog=1&user=$user&date=$date");
|
||||
"log.php?id=$course->id&chooselog=1&user=$user&date=$date&modid=$modid&modaction=$modaction",
|
||||
$modname, $modid, $modaction);
|
||||
|
||||
} else {
|
||||
if ($course->category) {
|
||||
print_header("$course->shortname: $strlogs", "$course->fullname",
|
||||
"<A HREF=\"view.php?id=$course->id\">$course->shortname</A> -> $strlogs", "");
|
||||
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strlogs", "");
|
||||
} else {
|
||||
print_header("$course->shortname: $strlogs", "$course->fullname",
|
||||
"<A HREF=\"../$CFG->admin/index.php\">$stradministration</A> -> $strlogs", "");
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strlogs", "");
|
||||
}
|
||||
|
||||
print_heading(get_string("chooselogs").":");
|
||||
|
||||
print_log_selector_form($course);
|
||||
|
||||
echo "<BR>";
|
||||
echo "<br />";
|
||||
print_heading(get_string("chooselivelogs").":");
|
||||
|
||||
echo "<CENTER><H3>";
|
||||
echo "<center><h3>";
|
||||
link_to_popup_window("/course/loglive.php?id=$course->id","livelog", get_string("livelogs"), 500, 800);
|
||||
echo "</H3></CENTER>";
|
||||
echo "</h3></center>";
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
|
||||
+12
-11
@@ -16,10 +16,8 @@
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
if (! ($type == "usercourse.png" and $user == $USER->id) ) {
|
||||
error("Sorry, you aren't allowed to see this.");
|
||||
}
|
||||
if (! (isteacher($course->id) or ($course->showreports and $USER->id == $user))) {
|
||||
error("Sorry, you aren't allowed to see this.");
|
||||
}
|
||||
|
||||
if ($user) {
|
||||
@@ -47,6 +45,14 @@
|
||||
if ($timenow - $course->startdate > $maxseconds) {
|
||||
$course->startdate = $timenow - $maxseconds;
|
||||
}
|
||||
|
||||
if (!empty($CFG->loglifetime)) {
|
||||
$maxseconds = $CFG->loglifetime * 3600 * 24; // seconds
|
||||
if ($timenow - $course->startdate > $maxseconds) {
|
||||
$course->startdate = $timenow - $maxseconds;
|
||||
}
|
||||
}
|
||||
|
||||
$timestart = $coursestart = usergetmidnight($course->startdate);
|
||||
|
||||
if ((($timenow - $timestart)/86400.0) > 40) {
|
||||
@@ -78,13 +84,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
$maxlogs = max($logs);
|
||||
|
||||
|
||||
$graph = new graph(750, 400);
|
||||
|
||||
$a->coursename = $course->shortname;
|
||||
$a->username = "$user->firstname $user->lastname";
|
||||
$a->username = fullname($user, true);
|
||||
$graph->parameter['title'] = get_string("hitsoncourse", "", $a);
|
||||
|
||||
$graph->x_data = $days;
|
||||
@@ -134,12 +137,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
$maxlogs = max($logs);
|
||||
|
||||
$graph = new graph(750, 400);
|
||||
|
||||
$a->coursename = $course->shortname;
|
||||
$a->username = "$user->firstname $user->lastname";
|
||||
$a->username = fullname($user, true);
|
||||
$graph->parameter['title'] = get_string("hitsoncoursetoday", "", $a);
|
||||
|
||||
$graph->x_data = $hours;
|
||||
|
||||
+21
-4
@@ -12,12 +12,20 @@
|
||||
error("Course ID was incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
if ($course->category) {
|
||||
require_login($course->id);
|
||||
}
|
||||
|
||||
if ($return and $USER->realuser) {
|
||||
$USER = get_user_info_from_db("id", $USER->realuser);
|
||||
$USER->loggedin = true;
|
||||
$USER->site = $CFG->wwwroot;
|
||||
|
||||
if (isset($SESSION->oldcurrentgroup)) { // Restore previous "current group"
|
||||
$SESSION->currentgroup[$course->id] = $SESSION->oldcurrentgroup;
|
||||
unset($SESSION->oldcurrentgroup);
|
||||
}
|
||||
|
||||
redirect($_SERVER["HTTP_REFERER"]);
|
||||
exit;
|
||||
}
|
||||
@@ -32,18 +40,27 @@
|
||||
error("This student is not in this course!");
|
||||
}
|
||||
|
||||
if (iscreator($user)) {
|
||||
error("You can not login as this person!");
|
||||
}
|
||||
|
||||
// Login as this student and return to course home page.
|
||||
|
||||
$teacher_name = "$USER->firstname $USER->lastname";
|
||||
$teacher_name = fullname($USER, true);
|
||||
$teacher_id = "$USER->id";
|
||||
|
||||
$USER = get_user_info_from_db("id", $user);
|
||||
$USER = get_user_info_from_db("id", $user); // Create the new USER object with all details
|
||||
$USER->loggedin = true;
|
||||
$USER->site = $CFG->wwwroot;
|
||||
$USER->realuser = $teacher_id;
|
||||
|
||||
if (isset($SESSION->currentgroup[$course->id])) { // Remember current setting for later
|
||||
$SESSION->oldcurrentgroup = $SESSION->currentgroup[$course->id];
|
||||
unset($SESSION->currentgroup[$course->id]);
|
||||
}
|
||||
|
||||
set_moodle_cookie($USER->username);
|
||||
$student_name = "$USER->firstname $USER->lastname";
|
||||
$student_name = fullname($USER, true);
|
||||
|
||||
add_to_log($course->id, "course", "loginas", "../user/view.php?id=$course->id&user=$user", "$teacher_name -> $student_name");
|
||||
|
||||
|
||||
+133
-37
@@ -27,11 +27,15 @@
|
||||
|
||||
if (isset($_POST["course"])) { // add or update form submitted
|
||||
|
||||
if (!isteacheredit($mod->course)) {
|
||||
if (!$course = get_record("course", "id", $mod->course)) {
|
||||
error("This course doesn't exist");
|
||||
}
|
||||
|
||||
if (!isteacheredit($course->id)) {
|
||||
error("You can't modify this course!");
|
||||
}
|
||||
|
||||
$modlib = "../mod/$mod->modulename/lib.php";
|
||||
$modlib = "$CFG->dirroot/mod/$mod->modulename/lib.php";
|
||||
if (file_exists($modlib)) {
|
||||
include_once($modlib);
|
||||
} else {
|
||||
@@ -40,21 +44,47 @@
|
||||
$addinstancefunction = $mod->modulename."_add_instance";
|
||||
$updateinstancefunction = $mod->modulename."_update_instance";
|
||||
$deleteinstancefunction = $mod->modulename."_delete_instance";
|
||||
$moderr = "$CFG->dirroot/mod/$mod->modulename/moderr.html";
|
||||
|
||||
switch ($mod->mode) {
|
||||
case "update":
|
||||
if (! $updateinstancefunction($mod)) {
|
||||
error("Could not update the $mod->modulename");
|
||||
$return = $updateinstancefunction($mod);
|
||||
if (!$return) {
|
||||
if (file_exists($moderr)) {
|
||||
$form = $mod;
|
||||
include_once($moderr);
|
||||
die;
|
||||
}
|
||||
error("Could not update the $mod->modulename", "view.php?id=$course->id");
|
||||
}
|
||||
add_to_log($mod->course, "course", "update mod",
|
||||
if (is_string($return)) {
|
||||
error($return, "view.php?id=$course->id");
|
||||
}
|
||||
add_to_log($course->id, "course", "update mod",
|
||||
"../mod/$mod->modulename/view.php?id=$mod->coursemodule",
|
||||
"$mod->modulename $mod->instance");
|
||||
add_to_log($course->id, $mod->modulename, "update",
|
||||
"view.php?id=$mod->coursemodule",
|
||||
"$mod->instance", $mod->coursemodule);
|
||||
break;
|
||||
|
||||
case "add":
|
||||
if (! $mod->instance = $addinstancefunction($mod)) {
|
||||
error("Could not add a new instance of $mod->modulename");
|
||||
$return = $addinstancefunction($mod);
|
||||
if (!$return) {
|
||||
if (file_exists($moderr)) {
|
||||
$form = $mod;
|
||||
include_once($moderr);
|
||||
die;
|
||||
}
|
||||
error("Could not add a new instance of $mod->modulename", "view.php?id=$course->id");
|
||||
}
|
||||
if (is_string($return)) {
|
||||
error($return, "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
$mod->groupmode = $course->groupmode; /// Default groupmode the same as course
|
||||
|
||||
$mod->instance = $return;
|
||||
// course_modules and course_sections each contain a reference
|
||||
// to each other, so we have to update one of them twice.
|
||||
|
||||
@@ -64,12 +94,22 @@
|
||||
if (! $sectionid = add_mod_to_section($mod) ) {
|
||||
error("Could not add the new course module to that section");
|
||||
}
|
||||
//We get the section's visible field status
|
||||
$visible = get_field("course_sections","visible","id",$sectionid);
|
||||
|
||||
if (! set_field("course_modules", "visible", $visible, "id", $mod->coursemodule)) {
|
||||
error("Could not update the course module with the correct visibility");
|
||||
}
|
||||
|
||||
if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
|
||||
error("Could not update the course module with the correct section");
|
||||
}
|
||||
add_to_log($mod->course, "course", "add mod",
|
||||
add_to_log($course->id, "course", "add mod",
|
||||
"../mod/$mod->modulename/view.php?id=$mod->coursemodule",
|
||||
"$mod->modulename $mod->instance");
|
||||
add_to_log($course->id, $mod->modulename, "add",
|
||||
"view.php?id=$mod->coursemodule",
|
||||
"$mod->instance", $mod->coursemodule);
|
||||
break;
|
||||
case "delete":
|
||||
if (! $deleteinstancefunction($mod->instance)) {
|
||||
@@ -81,29 +121,29 @@
|
||||
if (! delete_mod_from_section($mod->coursemodule, "$mod->section")) {
|
||||
notify("Could not delete the $mod->modulename from that section");
|
||||
}
|
||||
add_to_log($mod->course, "course", "delete mod",
|
||||
add_to_log($course->id, "course", "delete mod",
|
||||
"view.php?id=$mod->course",
|
||||
"$mod->modulename $mod->instance");
|
||||
"$mod->modulename $mod->instance", $mod->coursemodule);
|
||||
break;
|
||||
default:
|
||||
error("No mode defined");
|
||||
|
||||
}
|
||||
|
||||
rebuild_course_cache($mod->course);
|
||||
rebuild_course_cache($course->id);
|
||||
|
||||
if (!empty($SESSION->returnpage)) {
|
||||
$return = $SESSION->returnpage;
|
||||
unset($SESSION->returnpage);
|
||||
redirect($return);
|
||||
} else {
|
||||
redirect("view.php?id=$mod->course");
|
||||
redirect("view.php?id=$course->id");
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (isset($move)) {
|
||||
if (isset($_GET['move'])) {
|
||||
|
||||
require_variable($id);
|
||||
|
||||
@@ -115,7 +155,7 @@
|
||||
error("You can't modify this course!");
|
||||
}
|
||||
|
||||
move_module($cm, $move);
|
||||
move_module($cm, $_GET['move']);
|
||||
|
||||
rebuild_course_cache($cm->course);
|
||||
|
||||
@@ -127,20 +167,20 @@
|
||||
}
|
||||
exit;
|
||||
|
||||
} else if (isset($movetosection) or isset($moveto)) {
|
||||
} else if (isset($_GET['movetosection']) or isset($_GET['moveto'])) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $USER->activitycopy)) {
|
||||
error("The copied course module doesn't exist!");
|
||||
}
|
||||
|
||||
if (isset($movetosection)) {
|
||||
if (! $section = get_record("course_sections", "id", $movetosection)) {
|
||||
if (isset($_GET['movetosection'])) {
|
||||
if (! $section = get_record("course_sections", "id", $_GET['movetosection'])) {
|
||||
error("This section doesn't exist");
|
||||
}
|
||||
$beforecm = NULL;
|
||||
|
||||
} else { // normal moveto
|
||||
if (! $beforecm = get_record("course_modules", "id", $moveto)) {
|
||||
if (! $beforecm = get_record("course_modules", "id", $_GET['moveto'])) {
|
||||
error("The destination course module doesn't exist");
|
||||
}
|
||||
if (! $section = get_record("course_sections", "id", $beforecm->section)) {
|
||||
@@ -171,9 +211,35 @@
|
||||
redirect("view.php?id=$section->course");
|
||||
}
|
||||
|
||||
} else if (isset($hide)) {
|
||||
} else if (isset($_GET['indent'])) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $hide)) {
|
||||
require_variable($id);
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
$cm->indent += $_GET['indent'];
|
||||
|
||||
if ($cm->indent < 0) {
|
||||
$cm->indent = 0;
|
||||
}
|
||||
|
||||
if (!set_field("course_modules", "indent", $cm->indent, "id", $cm->id)) {
|
||||
error("Could not update the indent level on that course module");
|
||||
}
|
||||
|
||||
$site = get_site();
|
||||
if ($site->id == $cm->course) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect("view.php?id=$cm->course");
|
||||
}
|
||||
exit;
|
||||
|
||||
} else if (isset($_GET['hide'])) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $_GET['hide'])) {
|
||||
error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
@@ -193,9 +259,9 @@
|
||||
}
|
||||
exit;
|
||||
|
||||
} else if (isset($show)) {
|
||||
} else if (isset($_GET['show'])) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $show)) {
|
||||
if (! $cm = get_record("course_modules", "id", $_GET['show'])) {
|
||||
error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
@@ -225,9 +291,31 @@
|
||||
}
|
||||
exit;
|
||||
|
||||
} else if (isset($copy)) { // value = course module
|
||||
} else if (isset($_GET['groupmode'])) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $copy)) {
|
||||
if (! $cm = get_record("course_modules", "id", $_GET['id'])) {
|
||||
error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
if (!isteacheredit($cm->course)) {
|
||||
error("You can't modify this course!");
|
||||
}
|
||||
|
||||
set_groupmode_for_module($cm->id, $_GET['groupmode']);
|
||||
|
||||
rebuild_course_cache($cm->course);
|
||||
|
||||
$site = get_site();
|
||||
if ($site->id == $cm->course) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect("view.php?id=$cm->course");
|
||||
}
|
||||
exit;
|
||||
|
||||
} else if (isset($_GET['copy'])) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $_GET['copy'])) {
|
||||
error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
@@ -253,7 +341,7 @@
|
||||
|
||||
redirect("view.php?id=$cm->course");
|
||||
|
||||
} else if (isset($cancelcopy)) { // value = course module
|
||||
} else if (isset($_GET['cancelcopy'])) { // value = course module
|
||||
|
||||
$courseid = $USER->activitycopycourse;
|
||||
|
||||
@@ -263,9 +351,9 @@
|
||||
|
||||
redirect("view.php?id=$courseid");
|
||||
|
||||
} else if (isset($delete)) { // value = course module
|
||||
} else if (isset($_GET['delete'])) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $delete)) {
|
||||
if (! $cm = get_record("course_modules", "id", $_GET['delete'])) {
|
||||
error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
@@ -293,7 +381,7 @@
|
||||
"$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
}
|
||||
|
||||
$fullmodulename = strtolower(get_string("modulename", $module->name));
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
|
||||
$form->coursemodule = $cm->id;
|
||||
$form->section = $cm->section;
|
||||
@@ -319,9 +407,9 @@
|
||||
exit;
|
||||
|
||||
|
||||
} else if (isset($update)) { // value = course module
|
||||
} else if (isset($_GET['update'])) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $update)) {
|
||||
if (! $cm = get_record("course_modules", "id", $_GET['update'])) {
|
||||
error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
@@ -369,9 +457,9 @@
|
||||
}
|
||||
|
||||
|
||||
} else if (isset($add)) {
|
||||
} else if (isset($_GET['add'])) {
|
||||
|
||||
if (!$add) {
|
||||
if (empty($_GET['add'])) {
|
||||
redirect($_SERVER["HTTP_REFERER"]);
|
||||
die;
|
||||
}
|
||||
@@ -383,7 +471,7 @@
|
||||
error("This course doesn't exist");
|
||||
}
|
||||
|
||||
if (! $module = get_record("modules", "name", $add)) {
|
||||
if (! $module = get_record("modules", "name", $_GET['add'])) {
|
||||
error("This module type doesn't exist");
|
||||
}
|
||||
|
||||
@@ -396,7 +484,7 @@
|
||||
$form->mode = "add";
|
||||
|
||||
$sectionname = get_string("name$course->format");
|
||||
$fullmodulename = strtolower(get_string("modulename", $module->name));
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
|
||||
if ($form->section) {
|
||||
$heading->what = $fullmodulename;
|
||||
@@ -417,14 +505,20 @@
|
||||
$streditinga = get_string("editinga", "moodle", $fullmodulename);
|
||||
$strmodulenameplural = get_string("modulenameplural", $module->name);
|
||||
|
||||
if ($module->name == "label") {
|
||||
$focuscursor = "";
|
||||
} else {
|
||||
$focuscursor = "form.name";
|
||||
}
|
||||
|
||||
if ($course->category) {
|
||||
print_header("$course->shortname: $streditinga", "$course->fullname",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->
|
||||
<A HREF=\"$CFG->wwwroot/mod/$module->name/index.php?id=$course->id\">$strmodulenameplural</A> ->
|
||||
$streditinga", "form.name", "", false);
|
||||
$streditinga", $focuscursor, "", false);
|
||||
} else {
|
||||
print_header("$course->shortname: $streditinga", "$course->fullname",
|
||||
"$streditinga", "form.name", "", false);
|
||||
"$streditinga", $focuscursor, "", false);
|
||||
}
|
||||
|
||||
unset($SESSION->modform); // Clear any old ones that may be hanging around.
|
||||
@@ -433,7 +527,9 @@
|
||||
|
||||
if (file_exists($modform)) {
|
||||
|
||||
print_heading_with_help($pageheading, "mods", $module->name);
|
||||
$icon = "<img align=absmiddle height=16 width=16 src=\"$CFG->modpixpath/$module->name/icon.gif\"> ";
|
||||
|
||||
print_heading_with_help($pageheading, "mods", $module->name, $icon);
|
||||
print_simple_box_start("center", "", "$THEME->cellheading");
|
||||
include_once($modform);
|
||||
print_simple_box_end();
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
// Display user activity reports for a course (totals)
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$modes = array("outline", "complete", "todaylogs", "alllogs");
|
||||
|
||||
require_variable($id); // course id
|
||||
optional_variable($page, "0");
|
||||
optional_variable($perpage, "100");
|
||||
|
||||
require_login();
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course id is incorrect.");
|
||||
}
|
||||
|
||||
if (! (isteacher($course->id) or ($course->showreports and $USER->id == $user->id))) {
|
||||
error("You are not allowed to look at this page");
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "course report", "course.php?id=$course->id",$course->id);
|
||||
|
||||
$stractivityreport = get_string("activityreport");
|
||||
$strparticipants = get_string("participants");
|
||||
$stroutline = get_string("outline");
|
||||
$strcomplete = get_string("complete");
|
||||
$stralllogs = get_string("alllogs");
|
||||
$strtodaylogs = get_string("todaylogs");
|
||||
|
||||
if ($course->category) {
|
||||
print_header("$course->shortname: $stractivityreport", "$course->fullname",
|
||||
"<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> ->
|
||||
$stractivityreport");
|
||||
} else {
|
||||
print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname",
|
||||
"<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A> ->
|
||||
$stractivityreport -> $strmode");
|
||||
}
|
||||
print_heading("$course->fullname");
|
||||
|
||||
echo "<table cellpadding=10 align=center><tr>";
|
||||
echo "<td>$stractivityreport: </td>";
|
||||
echo "</tr></table>";
|
||||
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
|
||||
$sections = get_all_sections($course->id);
|
||||
|
||||
for ($i=0; $i<=$course->numsections; $i++) {
|
||||
|
||||
if (isset($sections[$i])) { // should always be true
|
||||
|
||||
$section = $sections[$i];
|
||||
|
||||
if ($section->sequence) {
|
||||
echo "<HR>";
|
||||
echo "<H2>";
|
||||
switch ($course->format) {
|
||||
case "weeks": print_string("week"); break;
|
||||
case "topics": print_string("topic"); break;
|
||||
default: print_string("section"); break;
|
||||
}
|
||||
echo " $i</H2>";
|
||||
|
||||
echo "<UL>";
|
||||
|
||||
echo "<TABLE CELLPADDING=4 CELLSPACING=0>";
|
||||
|
||||
$sectionmods = explode(",", $section->sequence);
|
||||
foreach ($sectionmods as $sectionmod) {
|
||||
if (empty($mods[$sectionmod])) {
|
||||
continue;
|
||||
}
|
||||
$mod = $mods[$sectionmod];
|
||||
$instance = get_record("$mod->modname", "id", "$mod->instance");
|
||||
$libfile = "$CFG->dirroot/mod/$mod->modname/lib.php";
|
||||
|
||||
|
||||
$result = null;
|
||||
if ($logs = get_records_select("log", "module='$mod->modname'
|
||||
AND action LIKE 'view%' AND info='$mod->instance'", "time ASC")) {
|
||||
|
||||
$numviews = count($logs);
|
||||
$lastlog = array_pop($logs);
|
||||
|
||||
$result->info = get_string("numviews", "", $numviews);
|
||||
$result->time = $lastlog->time;
|
||||
}
|
||||
print_outline_row($mod, $instance, $result);
|
||||
}
|
||||
|
||||
echo "</TABLE>";
|
||||
print_simple_box_end();
|
||||
|
||||
echo "</UL>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
|
||||
|
||||
function print_outline_row($mod, $instance, $result) {
|
||||
$image = "<IMG SRC=\"../mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
|
||||
|
||||
echo "<TR>";
|
||||
echo "<TD VALIGN=top>$image</TD>";
|
||||
echo "<TD VALIGN=top width=300>";
|
||||
echo " <A TITLE=\"$mod->modfullname\"";
|
||||
echo " HREF=\"../mod/$mod->modname/view.php?id=$mod->id\">$instance->name</A></TD>";
|
||||
echo "<TD> </TD>";
|
||||
echo "<TD VALIGN=top BGCOLOR=white>";
|
||||
if (isset($result->info)) {
|
||||
echo "$result->info";
|
||||
} else {
|
||||
echo "<P ALIGN=CENTER>-</P>";
|
||||
}
|
||||
echo "</TD>";
|
||||
echo "<TD> </TD>";
|
||||
if (isset($result->time)) {
|
||||
$timeago = format_time(time() - $result->time);
|
||||
echo "<TD VALIGN=top NOWRAP>".userdate($result->time)." ($timeago)</TD>";
|
||||
}
|
||||
echo "</TR>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+263
-57
@@ -7,6 +7,8 @@
|
||||
|
||||
require_variable($id);
|
||||
|
||||
optional_variable($user);
|
||||
|
||||
if (! $course = get_record("course", "id", $id) ) {
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
@@ -15,87 +17,291 @@
|
||||
|
||||
add_to_log($course->id, "course", "recent", "recent.php?id=$course->id", "$course->id");
|
||||
|
||||
if (empty($THEME->custompix)) {
|
||||
$pixpath = "../pix";
|
||||
$modpixpath = "../mod";
|
||||
} else {
|
||||
$pixpath = "../theme/$CFG->theme/pix";
|
||||
$modpixpath = "../theme/$CFG->theme/pix/mod";
|
||||
}
|
||||
|
||||
$strrecentactivity = get_string("recentactivity");
|
||||
|
||||
$loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
|
||||
|
||||
print_header("$course->fullname: $strrecentactivity", "$course->fullname",
|
||||
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strrecentactivity",
|
||||
"", "", true, "", $loggedinas);
|
||||
|
||||
if (!empty($_GET['chooserecent'])) {
|
||||
|
||||
$userinfo = get_string("allparticipants");
|
||||
$dateinfo = get_string("alldays");
|
||||
|
||||
if ($user) {
|
||||
if (!$u = get_record("user", "id", $user) ) {
|
||||
error("That's an invalid user!");
|
||||
}
|
||||
$userinfo = "$u->firstname $u->lastname";
|
||||
}
|
||||
if ($date)
|
||||
$dateinfo = userdate($date, get_string("strftimedaydate"));
|
||||
|
||||
if ($course->category) {
|
||||
print_header("$course->shortname: $strrecentactivity", "$course->fullname",
|
||||
"<a href=\"view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"recent.php?id=$course->id\">$strrecentactivity</a> -> $userinfo, $dateinfo", "");
|
||||
} else {
|
||||
print_header("$course->shortname: $strrecentactivity", "$course->fullname",
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> ->
|
||||
<a href=\"recent.php?id=$course->id\">$strrecentactivity</a> -> $userinfo, $dateinfo", "");
|
||||
}
|
||||
|
||||
print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
|
||||
$advancedfilter = 1;
|
||||
print_recent_selector_form($course, $advancedfilter, $user, $date, $modname, $modid, $modaction, $selectedgroup, $sortby);
|
||||
|
||||
} else {
|
||||
|
||||
if (empty($date)) { // no date picked, default to last login time
|
||||
$date = $USER->lastlogin;
|
||||
}
|
||||
|
||||
if ($course->category) {
|
||||
print_header("$course->shortname: $strrecentactivity", "$course->fullname",
|
||||
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strrecentactivity", "");
|
||||
} else {
|
||||
print_header("$course->shortname: $strrecentactivity", "$course->fullname",
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strrecentactivity", "");
|
||||
}
|
||||
|
||||
print_heading(get_string("activitysince", "", userdate($date)));
|
||||
|
||||
print_recent_selector_form($course, $advancedfilter);
|
||||
|
||||
}
|
||||
|
||||
$tmpmodid = $modid;
|
||||
|
||||
switch ($tmpmodid) {
|
||||
case "activity/Assignments" : $filter = "assignment"; break;
|
||||
case "activity/Chats" : $filter = "chat"; break;
|
||||
case "activity/Forums" : $filter = "forum"; break;
|
||||
case "activity/Quizzes" : $filter = "quiz"; break;
|
||||
case "activity/Workshops" : $filter = "workshop"; break;
|
||||
default : $filter = "";
|
||||
}
|
||||
|
||||
$activities = array();
|
||||
$sections = array();
|
||||
|
||||
switch ($course->format) {
|
||||
case "weeks": $sectiontitle = get_string("week"); break;
|
||||
case "topics": $sectiontitle = get_string("topic"); break;
|
||||
default: $sectiontitle = get_string("section"); break;
|
||||
}
|
||||
|
||||
$index = 0;
|
||||
|
||||
if (is_numeric($modid)) { // you chose a single activity
|
||||
|
||||
$sections[0]->sequence = "$modid";
|
||||
|
||||
} else { // you chose a group of activities
|
||||
|
||||
if (isteacher($user)) {
|
||||
$hiddenfilter = "";
|
||||
} else {
|
||||
$hiddenfilter = " AND cs.visible = '1' ";
|
||||
}
|
||||
|
||||
$sections = get_records_sql("SELECT cs.id, cs.section, cs.sequence, cs.summary, cs.visible
|
||||
FROM {$CFG->prefix}course_sections cs
|
||||
WHERE course = '$course->id' $hiddenfilter
|
||||
ORDER by section");
|
||||
}
|
||||
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
|
||||
print_heading("Since: Last Login | 1 day | 7 days | 14 days | 21 days | 30 days");
|
||||
if (!empty($sections)) {
|
||||
|
||||
if (empty($days)) {
|
||||
$timestart = $USER->lastlogin;
|
||||
} else {
|
||||
$timestart = time() - ($days * 3600 * 24);
|
||||
}
|
||||
echo "<hr>";
|
||||
$i = 0;
|
||||
|
||||
print_heading(get_string("activitysince", "", userdate($timestart)));
|
||||
if (!empty($filter)) {
|
||||
$activityfilter = "AND m.name = '$filter'";
|
||||
} else {
|
||||
$activityfilter = "";
|
||||
}
|
||||
|
||||
$sections = get_all_sections($course->id);
|
||||
if (isteacher($user)) {
|
||||
$hiddenfilter = "";
|
||||
} else {
|
||||
$hiddenfilter = " AND cm.visible = '1' ";
|
||||
}
|
||||
|
||||
for ($i=0; $i<=$course->numsections; $i++) {
|
||||
foreach ($sections as $section) {
|
||||
|
||||
if (isset($sections[$i])) { // should always be true
|
||||
|
||||
$section = $sections[$i];
|
||||
|
||||
if ($section->sequence) {
|
||||
echo "<hr>";
|
||||
echo "<h2>";
|
||||
switch ($course->format) {
|
||||
case "weeks": print_string("week"); break;
|
||||
case "topics": print_string("topic"); break;
|
||||
default: print_string("section"); break;
|
||||
if ($i <= $course->numsections) {
|
||||
$activity->type = "section";
|
||||
if ($i) {
|
||||
$activity->name = $sectiontitle . " $i";
|
||||
} else {
|
||||
$activity->name = '';
|
||||
}
|
||||
echo " $i</h2>";
|
||||
$activity->visible = $section->visible;
|
||||
$activities[$index] = $activity;
|
||||
}
|
||||
$index++;
|
||||
$i++;
|
||||
|
||||
echo "<ul>";
|
||||
$sectionmods = explode(",", $section->sequence);
|
||||
|
||||
$sectionmods = explode(",", $section->sequence);
|
||||
foreach ($sectionmods as $sectionmod) {
|
||||
|
||||
foreach ($sectionmods as $sectionmod) {
|
||||
if (empty($mods[$sectionmod])) {
|
||||
continue;
|
||||
}
|
||||
$mod = $mods[$sectionmod];
|
||||
if (empty($mods[$sectionmod])) {
|
||||
continue;
|
||||
}
|
||||
$mod = $mods[$sectionmod];
|
||||
$instance = get_record("$mod->modname", "id", "$mod->instance");
|
||||
|
||||
$instance = get_record("$mod->modname", "id", "$mod->instance");
|
||||
$libfile = "$CFG->dirroot/mod/$mod->modname/lib.php";
|
||||
$coursemod = get_record_sql("SELECT m.id, m.name, cm.groupmode, cm.visible
|
||||
FROM {$CFG->prefix}course_modules cm,
|
||||
{$CFG->prefix}modules m
|
||||
WHERE course = '$course->id' $hiddenfilter
|
||||
AND m.id = cm.module $activityfilter
|
||||
AND cm.id = '$sectionmod'");
|
||||
|
||||
if (file_exists($libfile)) {
|
||||
require_once($libfile);
|
||||
$print_recent_instance_activity = $mod->modname."_print_recent_instance_activity";
|
||||
if (function_exists($print_recent_instance_activity)) {
|
||||
$image = "<img src=\"$modpixpath/$mod->modname/icon.gif\" ".
|
||||
"height=16 width=16 alt=\"$mod->modfullname\">";
|
||||
echo "<h4>$image $mod->modfullname: ".
|
||||
"<a href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
|
||||
"$instance->name</a></h4>";
|
||||
echo "<ul>";
|
||||
$print_recent_instance_activity($instance, $timestart);
|
||||
echo "</ul>";
|
||||
}
|
||||
$groupmode = groupmode($course, $coursemod);
|
||||
switch ($groupmode) {
|
||||
case SEPARATEGROUPS : $groupid = mygroupid($course->id); break;
|
||||
case VISIBLEGROUPS :
|
||||
if ($selectedgroup == "allgroups") {
|
||||
$groupid = "";
|
||||
} else {
|
||||
$groupid = $selectedgroup;
|
||||
}
|
||||
break;
|
||||
case NOGROUPS :
|
||||
default : $groupid = "";
|
||||
}
|
||||
|
||||
$libfile = "$CFG->dirroot/mod/$coursemod->name/lib.php";
|
||||
|
||||
if (file_exists($libfile)) {
|
||||
require_once($libfile);
|
||||
$get_recent_mod_activity = $coursemod->name."_get_recent_mod_activity";
|
||||
|
||||
if (function_exists($get_recent_mod_activity)) {
|
||||
$activity->type = "activity";
|
||||
$activity->name = $instance->name;
|
||||
$activity->visible = $coursemod->visible;
|
||||
$activity->content->fullname = $mod->modfullname;
|
||||
$activity->content->modname = $mod->modname;
|
||||
$activity->content->modid =$mod->id;
|
||||
$activities[$index] = $activity;
|
||||
$index++;
|
||||
$get_recent_mod_activity($activities, $index, $date, $course->id, $sectionmod, $user, $groupid);
|
||||
}
|
||||
}
|
||||
|
||||
echo "</ul>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$detail = true;
|
||||
|
||||
switch ($sortby) {
|
||||
case "datedesc" : usort($activities, "compare_activities_by_time_desc"); break;
|
||||
case "dateasc" : usort($activities, "compare_activities_by_time_asc"); break;
|
||||
case "default" :
|
||||
default : $detail = false; $sortby = "default";
|
||||
|
||||
}
|
||||
|
||||
if (!empty($activities)) {
|
||||
|
||||
$newsection = true;
|
||||
$lastsection = "";
|
||||
$newinstance = true;
|
||||
$lastinstance = "";
|
||||
$inbox = false;
|
||||
|
||||
$section = 0;
|
||||
|
||||
if (isteacher($user)) {
|
||||
$teacher = true;
|
||||
} else {
|
||||
$teacher = false;
|
||||
}
|
||||
$activity_count = count($activities);
|
||||
|
||||
foreach ($activities as $key => $activity) {
|
||||
|
||||
// peak at next activity. If it's another section, don't print this one!
|
||||
// this means there are no activities in the current section
|
||||
if (($activity->type == "section") &&
|
||||
(($activity_count == ($key + 1)) ||
|
||||
($activities[$key+1]->type == "section"))) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (($activity->type == "section") && ($sortby == "default")) {
|
||||
if ($inbox) {
|
||||
print_simple_box_end();
|
||||
print_spacer(30);
|
||||
}
|
||||
print_simple_box_start("center", "90%");
|
||||
echo "<h2>$activity->name</h2>";
|
||||
$inbox = true;
|
||||
|
||||
} else if ($activity->type == "activity") {
|
||||
|
||||
if ($sortby == "default") {
|
||||
if ($teacher && $activity->visible == 0) {
|
||||
$linkformat = 'class="dimmed"';
|
||||
} else {
|
||||
$linkformat = '';
|
||||
}
|
||||
$image = "<img src=\"$CFG->modpixpath/" . $activity->content->modname . "/icon.gif\"" .
|
||||
"height=16 width=16 alt=\"" . $activity->content->modfullname . "\">";
|
||||
echo "<ul><h4>$image " . $activity->content->modfullname .
|
||||
"<a href=\"$CFG->wwwroot/mod/" . $activity->content->modname . "/view.php?" .
|
||||
"id=" . $activity->content->modid . "\" $linkformat>" .
|
||||
$activity->name . "</a></h4></ul>";
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!$inbox) {
|
||||
print_simple_box_start("center", "90%");
|
||||
$inbox = true;
|
||||
}
|
||||
|
||||
$print_recent_mod_activity = $activity->type."_print_recent_mod_activity";
|
||||
|
||||
if (function_exists($print_recent_mod_activity)) {
|
||||
echo '<ul><ul>';
|
||||
$print_recent_mod_activity($activity, $course->id, $detail);
|
||||
echo '</ul></ul>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($inbox) {
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
echo "<h4><center>" . get_string("norecentactivity") . "</center></h2>";
|
||||
|
||||
}
|
||||
// fix modid for selection form
|
||||
$modid =$tmpmodid;
|
||||
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
function compare_activities_by_time_desc($a, $b) {
|
||||
if ($a->timestamp == $b->timestamp)
|
||||
return 0;
|
||||
return ($a->timestamp > $b->timestamp) ? -1 : 1;
|
||||
}
|
||||
|
||||
function compare_activities_by_time_asc($a, $b) {
|
||||
if ($a->timestamp == $b->timestamp)
|
||||
return 0;
|
||||
return ($a->timestamp < $b->timestamp) ? -1 : 1;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -52,6 +52,13 @@
|
||||
|
||||
if ($scales = get_records("scale", "courseid", "$course->id", "name ASC")) {
|
||||
print_heading($strcustomscales);
|
||||
|
||||
if (isteacheredit($course->id)) {
|
||||
echo "<p align=\"center\">(";
|
||||
print_string("scalestip");
|
||||
echo ")</p>";
|
||||
}
|
||||
|
||||
foreach ($scales as $scale) {
|
||||
$scalemenu = make_menu_from_list($scale->scale);
|
||||
|
||||
@@ -64,6 +71,13 @@
|
||||
print_simple_box_end();
|
||||
echo "<hr />";
|
||||
}
|
||||
|
||||
} else {
|
||||
if (isteacheredit($course->id)) {
|
||||
echo "<p align=\"center\">(";
|
||||
print_string("scalestip");
|
||||
echo ")</p>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($scales = get_records("scale", "courseid", "0", "name ASC")) {
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
|
||||
$site = get_site();
|
||||
|
||||
if (empty($THEME->custompix)) {
|
||||
$pixpath = "$CFG->wwwroot/pix";
|
||||
} else {
|
||||
$pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
|
||||
}
|
||||
|
||||
$displaylist = array();
|
||||
$parentlist = array();
|
||||
make_categories_list($displaylist, $parentlist, "");
|
||||
|
||||
+9
-7
@@ -20,8 +20,8 @@
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("You must be a teacher in this course, or an admin");
|
||||
if (!isteacheredit($course->id)) {
|
||||
error("You must be an editing teacher in this course, or an admin");
|
||||
}
|
||||
|
||||
$strassignstudents = get_string("assignstudents");
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
if (!empty($remove)) {
|
||||
if (! unenrol_student($remove, $course->id)) {
|
||||
error("Could not add that student to this course!");
|
||||
error("Could not remove that student from this course!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,8 @@
|
||||
$studentarray = array();
|
||||
foreach ($students as $student) {
|
||||
$studentarray[] = $student->id;
|
||||
echo "<p align=right>$student->firstname $student->lastname, $student->email <a href=\"student.php?id=$course->id&remove=$student->id\" title=\"$strremovestudent\"><img src=\"../pix/t/right.gif\" border=0></a></p>";
|
||||
$fullname = fullname($student, true);
|
||||
echo "<p align=right>$fullname, $student->email <a href=\"student.php?id=$course->id&remove=$student->id\" title=\"$strremovestudent\"><img src=\"../pix/t/right.gif\" border=0></a></p>";
|
||||
}
|
||||
$studentlist = implode(",",$studentarray);
|
||||
unset($studentarray);
|
||||
@@ -128,14 +129,15 @@
|
||||
}
|
||||
|
||||
foreach ($users as $user) {
|
||||
echo "<p align=left><a href=\"{$_SERVER['PHP_SELF']}?id=$course->id&add=$user->id\"".
|
||||
$fullname = fullname($user, true);
|
||||
echo "<p align=left><a href=\"student.php?id=$course->id&add=$user->id\"".
|
||||
"title=\"$straddstudent\"><img src=\"../pix/t/left.gif\"".
|
||||
"border=0></a> $user->firstname $user->lastname, $user->email";
|
||||
"border=0></a> $fullname, $user->email";
|
||||
}
|
||||
}
|
||||
|
||||
if ($search or $usercount > MAX_USERS_PER_PAGE) {
|
||||
echo "<form action={$_SERVER['PHP_SELF']} method=post>";
|
||||
echo "<form action=student.php method=post>";
|
||||
echo "<input type=hidden name=id value=\"$course->id\">";
|
||||
echo "<input type=text name=search size=20>";
|
||||
echo "<input type=submit value=\"$searchstring\">";
|
||||
|
||||
+2
-2
@@ -156,7 +156,7 @@
|
||||
$teacher->role = $course->teacher;
|
||||
}
|
||||
|
||||
$table->data[] = array ($picture, "$teacher->firstname $teacher->lastname", $authority,
|
||||
$table->data[] = array ($picture, fullname($teacher, true), $authority,
|
||||
"<input type=text name=\"r$teacher->id\" value=\"$teacher->role\" size=30>",
|
||||
$editall, $removelink);
|
||||
}
|
||||
@@ -203,7 +203,7 @@
|
||||
foreach ($users as $user) {
|
||||
$addlink = "<a href=\"teacher.php?id=$course->id&add=$user->id\">$straddteacher</a>";
|
||||
$picture = print_user_picture($user->id, $course->id, $user->picture, false, true);
|
||||
$table->data[] = array ($picture, "$user->firstname $user->lastname", $user->email, $addlink);
|
||||
$table->data[] = array ($picture, fullname($user, true), $user->email, $addlink);
|
||||
}
|
||||
print_table($table);
|
||||
}
|
||||
|
||||
+5
-1
@@ -24,6 +24,10 @@
|
||||
error("You must be a teacher to do this");
|
||||
}
|
||||
|
||||
if ($user->id == $USER->id and !$CFG->allowunenroll) {
|
||||
error("You are not allowed to unenroll");
|
||||
}
|
||||
|
||||
if (isset($confirm)) {
|
||||
|
||||
if (! unenrol_student($user->id, $course->id)) {
|
||||
@@ -49,7 +53,7 @@
|
||||
if ($user->id == $USER->id) {
|
||||
$strunenrolsure = get_string("unenrolsure", "", get_string("yourself"));
|
||||
} else {
|
||||
$strunenrolsure = get_string("unenrolsure", "", "$user->firstname $user->lastname");
|
||||
$strunenrolsure = get_string("unenrolsure", "", fullname($user, true));
|
||||
}
|
||||
|
||||
notice_yesno ($strunenrolsure, "unenrol.php?id=$id&user=$user->id&confirm=yes", "$HTTP_REFERER");
|
||||
|
||||
+8
-7
@@ -19,14 +19,14 @@
|
||||
error("Course id is incorrect.");
|
||||
}
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("You are not allowed to look at this page");
|
||||
}
|
||||
|
||||
if (! $user = get_record("user", "id", $user)) {
|
||||
error("User ID is incorrect");
|
||||
}
|
||||
|
||||
if (! (isteacher($course->id) or ($course->showreports and $USER->id == $user->id))) {
|
||||
error("You are not allowed to look at this page");
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "user report", "user.php?id=$course->id&user=$user->id&mode=$mode", "$user->id");
|
||||
|
||||
$stractivityreport = get_string("activityreport");
|
||||
@@ -36,19 +36,20 @@
|
||||
$stralllogs = get_string("alllogs");
|
||||
$strtodaylogs = get_string("todaylogs");
|
||||
$strmode = get_string($mode);
|
||||
$fullname = fullname($user, true);
|
||||
|
||||
if ($course->category) {
|
||||
print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname",
|
||||
"<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> ->
|
||||
<A HREF=\"../user/index.php?id=$course->id\">$strparticipants</A> ->
|
||||
<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A> ->
|
||||
<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$fullname</A> ->
|
||||
$stractivityreport -> $strmode");
|
||||
} else {
|
||||
print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname",
|
||||
"<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A> ->
|
||||
"<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$fullname</A> ->
|
||||
$stractivityreport -> $strmode");
|
||||
}
|
||||
print_heading("$user->firstname $user->lastname");
|
||||
print_heading($fullname);
|
||||
|
||||
echo "<table cellpadding=10 align=center><tr>";
|
||||
echo "<td>$stractivityreport: </td>";
|
||||
|
||||
+6
-14
@@ -12,7 +12,7 @@
|
||||
error("Must specify course id or short name");
|
||||
}
|
||||
|
||||
if ($name) {
|
||||
if (!empty($_GET['name'])) {
|
||||
if (! $course = get_record("course", "shortname", $name) ) {
|
||||
error("That's an invalid short course name");
|
||||
}
|
||||
@@ -60,20 +60,12 @@
|
||||
redirect("$CFG->wwwroot/");
|
||||
}
|
||||
|
||||
if (empty($THEME->custompix)) {
|
||||
$pixpath = "../pix";
|
||||
$modpixpath = "../mod";
|
||||
} else {
|
||||
$pixpath = "../theme/$CFG->theme/pix";
|
||||
$modpixpath = "../theme/$CFG->theme/pix/mod";
|
||||
}
|
||||
|
||||
$courseword = get_string("course");
|
||||
$strcourse = get_string("course");
|
||||
|
||||
$loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
|
||||
|
||||
print_header("$courseword: $course->fullname", "$course->fullname", "$course->shortname", "search.search", "", true,
|
||||
update_course_icon($course->id), $loggedinas);
|
||||
print_header("$strcourse: $course->fullname", "$course->fullname", "$course->shortname",
|
||||
"", "", true, update_course_icon($course->id), $loggedinas);
|
||||
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
|
||||
@@ -97,11 +89,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists("$CFG->dirroot/course/format/$course->format.php")) { // Default format is weeks
|
||||
if (!file_exists("$CFG->dirroot/course/format/$course->format/format.php")) { // Default format is weeks
|
||||
$course->format = "weeks";
|
||||
}
|
||||
|
||||
require("$CFG->dirroot/course/format/$course->format.php"); // Include the actual course format
|
||||
require("$CFG->dirroot/course/format/$course->format/format.php"); // Include the actual course format
|
||||
|
||||
print_footer();
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
Moodle - Modular Object-Oriented Dynamic Learning Environment
|
||||
http://moodle.com
|
||||
http://moodle.org
|
||||
|
||||
Copyright (C) 2000-2002 Martin Dougiamas martin@dougiamas.com
|
||||
Copyright (C) 1999-2004 Martin Dougiamas martin@dougiamas.com
|
||||
http://dougiamas.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
||||
+6
-3
@@ -10,10 +10,13 @@
|
||||
|
||||
print_header();
|
||||
|
||||
echo "<font size=2 face=\"san-serif\">";
|
||||
foreach ($string as $file => $filename) {
|
||||
echo "<li><a target=\"main\" href=\"$CFG->wwwroot/doc/?file=$file\">$filename</a></li>";
|
||||
if (substr($file,0,1) == "-") {
|
||||
echo '<p style="font-size:small;margin-bottom:0px;font-family:Trebuchet MS, Verdana, Arial, Helvetica, sans-serif;">'.
|
||||
$filename.'</p>';
|
||||
} else {
|
||||
echo "<li style=\"font-size:small\"><a target=\"main\" href=\"$CFG->wwwroot/doc/?file=$file\">$filename</a></li>";
|
||||
}
|
||||
}
|
||||
echo "</font>";
|
||||
|
||||
?>
|
||||
|
||||
Executable
+119
@@ -0,0 +1,119 @@
|
||||
|
||||
body, td, th, li {
|
||||
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a:link {
|
||||
text-decoration: none;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
color: red;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
|
||||
li {
|
||||
margin-bottom: 10px;
|
||||
|
||||
}
|
||||
|
||||
.question {
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
|
||||
border: 1px dotted;
|
||||
padding: 10px;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
.answer {
|
||||
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: medium;
|
||||
border: none;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
.normaltext {
|
||||
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: medium;
|
||||
border: none;
|
||||
margin-left: 30px;
|
||||
|
||||
}
|
||||
|
||||
.answercode {
|
||||
font-family: "Courier New", Courier, mono;
|
||||
font-size: small;
|
||||
border: none;
|
||||
padding-left: 60px;
|
||||
}
|
||||
|
||||
.questionlink {
|
||||
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: medium;
|
||||
border: none;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
.examplecode {
|
||||
font-family: "Courier New", Courier, mono;
|
||||
font-size: small;
|
||||
border: thin dashed #999999;
|
||||
background-color: #FBFBFB;
|
||||
margin: auto;
|
||||
padding: 30px;
|
||||
height: auto;
|
||||
width: auto;
|
||||
}
|
||||
h1 {
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
background-color: #CCCCCC;
|
||||
padding: 5px;
|
||||
font-size: large;
|
||||
border-width: 1px;
|
||||
border-color: #CCCCCC;
|
||||
-moz-border-radius: 10px;
|
||||
}
|
||||
h2 {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
background-color: #666666;
|
||||
padding: 5px;
|
||||
font-size: medium;
|
||||
border-width: 1px;
|
||||
border-color: #666666;
|
||||
-moz-border-radius: 10px;
|
||||
}
|
||||
h3 {
|
||||
font-weight: normal;
|
||||
color: #FFFFFF;
|
||||
background-color: #666666;
|
||||
padding: 5px;
|
||||
font-size: medium;
|
||||
-moz-border-radius: 10px;
|
||||
}
|
||||
.spaced {
|
||||
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-top: 10px;
|
||||
|
||||
}
|
||||
@@ -17,11 +17,17 @@
|
||||
error("No file parameters!");
|
||||
}
|
||||
|
||||
$pathinfo = urldecode($pathinfo);
|
||||
|
||||
if (! $args = parse_slash_arguments($pathinfo)) {
|
||||
error("No valid arguments supplied");
|
||||
}
|
||||
|
||||
$numargs = count($args);
|
||||
if ($numargs < 2 or empty($args[1])) {
|
||||
error("No valid arguments supplied");
|
||||
}
|
||||
|
||||
$courseid = (integer)$args[0];
|
||||
|
||||
$course = get_record("course", "id", $courseid);
|
||||
@@ -35,10 +41,9 @@
|
||||
$pathname = "$CFG->dataroot$pathinfo";
|
||||
$filename = $args[$numargs-1];
|
||||
|
||||
$mimetype = mimeinfo("type", $filename);
|
||||
|
||||
if (file_exists($pathname)) {
|
||||
$lastmodified = filemtime($pathname);
|
||||
$mimetype = mimeinfo("type", $filename);
|
||||
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
|
||||
@@ -46,8 +51,29 @@
|
||||
header("Pragma: ");
|
||||
header("Content-disposition: inline; filename=$filename");
|
||||
header("Content-length: ".filesize($pathname));
|
||||
header("Content-type: $mimetype");
|
||||
readfile("$pathname");
|
||||
|
||||
|
||||
if (empty($CFG->filteruploadedfiles)) {
|
||||
header("Content-type: $mimetype");
|
||||
readfile($pathname);
|
||||
|
||||
} else { /// Try and put the file through filters
|
||||
if ($mimetype == "text/html") {
|
||||
header("Content-type: text/html");
|
||||
echo format_text(implode('', file($pathname)), FORMAT_HTML, NULL, $courseid);
|
||||
|
||||
} else if ($mimetype == "text/plain") {
|
||||
header("Content-type: text/html");
|
||||
$options->newlines = false;
|
||||
echo "<pre>";
|
||||
echo format_text(implode('', file($pathname)), FORMAT_MOODLE, $options, $courseid);
|
||||
echo "</pre>";
|
||||
|
||||
} else { /// Just send it out raw
|
||||
header("Content-type: $mimetype");
|
||||
readfile($pathname);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error("Sorry, but the file you are looking for was not found ($pathname)", "course/view.php?id=$courseid");
|
||||
}
|
||||
|
||||
+22
-16
@@ -20,8 +20,8 @@
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
if (! isteacher($course->id) ) {
|
||||
error("Only teachers can edit files");
|
||||
if (! isteacheredit($course->id) ) {
|
||||
error("You need to be a teacher with editing privileges");
|
||||
}
|
||||
|
||||
function html_footer() {
|
||||
@@ -51,12 +51,12 @@
|
||||
$numdirs = count($dirs);
|
||||
$link = "";
|
||||
$navigation = "";
|
||||
for ($i=1; $i<$numdirs; $i++) {
|
||||
for ($i=1; $i<$numdirs-1; $i++) {
|
||||
$navigation .= " -> ";
|
||||
$link .= "/".urlencode($dirs[$i]);
|
||||
$navigation .= "<a href=\"index.php?id=$course->id&wdir=$link\">".$dirs[$i]."</a>";
|
||||
}
|
||||
$fullnav = "<a href=\"index.php?id=$course->id&wdir=/\">$strfiles</a> $navigation";
|
||||
$fullnav = "<a href=\"index.php?id=$course->id&wdir=/\">$strfiles</a> $navigation -> ".$dirs[$numdirs-1];
|
||||
}
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
@@ -98,6 +98,12 @@
|
||||
$wdir="/";
|
||||
}
|
||||
|
||||
if ($wdir == "/backupdata") {
|
||||
if (! make_upload_directory("$course->id/backupdata")) { // Backup folder
|
||||
error("Could not create backupdata folder. The site administrator needs to fix the file permissions");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch ($action) {
|
||||
|
||||
@@ -129,7 +135,7 @@
|
||||
displaydir($wdir);
|
||||
|
||||
} else {
|
||||
$upload_max_filesize = get_max_upload_file_size();
|
||||
$upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); // Restricted by site setting
|
||||
$filesize = display_size($upload_max_filesize);
|
||||
|
||||
$struploadafile = get_string("uploadafile");
|
||||
@@ -329,7 +335,7 @@
|
||||
echo " <INPUT TYPE=hidden NAME=wdir VALUE=\"$wdir\">";
|
||||
echo " <INPUT TYPE=hidden NAME=file VALUE=\"$file\">";
|
||||
echo " <INPUT TYPE=hidden NAME=action VALUE=edit>";
|
||||
print_textarea($usehtmleditor, 25, 80, 680, 400, "text", $contents);
|
||||
print_textarea($usehtmleditor, 25, 80, 680, 400, "text", addslashes($contents));
|
||||
echo "</TD></TR><TR><TD>";
|
||||
echo " <INPUT TYPE=submit VALUE=\"".get_string("savechanges")."\">";
|
||||
echo "</FORM>";
|
||||
@@ -360,7 +366,7 @@
|
||||
foreach ($USER->filelist as $file) {
|
||||
$files[] = "$basedir/$file";
|
||||
}
|
||||
include_once('../lib/pclzip/pclzip.lib.php');
|
||||
include_once("$CFG->libdir/pclzip/pclzip.lib.php");
|
||||
$archive = new PclZip("$basedir/$wdir/$name");
|
||||
if (($list = $archive->create($files,'',"$basedir/$wdir/")) == 0) {
|
||||
error($archive->errorInfo(true));
|
||||
@@ -426,7 +432,7 @@
|
||||
$file = basename($file);
|
||||
|
||||
if (empty($CFG->unzip)) { // Use built-in php-based unzip function
|
||||
include_once('../lib/pclzip/pclzip.lib.php');
|
||||
include_once("$CFG->libdir/pclzip/pclzip.lib.php");
|
||||
$archive = new PclZip("$basedir/$wdir/$file");
|
||||
if (!$list = $archive->extract("$basedir/$wdir")) {
|
||||
error($archive->errorInfo(true));
|
||||
@@ -487,7 +493,7 @@
|
||||
echo "<P ALIGN=CENTER>$strlistfiles:</P>";
|
||||
$file = basename($file);
|
||||
|
||||
include_once('../lib/pclzip/pclzip.lib.php');
|
||||
include_once("$CFG->libdir/pclzip/pclzip.lib.php");
|
||||
$archive = new PclZip("$basedir/$wdir/$file");
|
||||
if (!$list = $archive->listContent("$basedir/$wdir")) {
|
||||
notify($archive->errorInfo(true));
|
||||
@@ -612,11 +618,11 @@ function clearfilelist() {
|
||||
|
||||
|
||||
function printfilelist($filelist) {
|
||||
global $basedir;
|
||||
global $CFG, $basedir;
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (is_dir($basedir.$file)) {
|
||||
echo "<IMG SRC=\"pix/folder.gif\" HEIGHT=16 WIDTH=16> $file<BR>";
|
||||
echo "<img src=\"$CFG->pixpath/f/folder.gif\" height=16 width=16> $file<br>";
|
||||
$subfilelist = array();
|
||||
$currdir = opendir($basedir.$file);
|
||||
while ($subfile = readdir($currdir)) {
|
||||
@@ -628,7 +634,7 @@ function printfilelist($filelist) {
|
||||
|
||||
} else {
|
||||
$icon = mimeinfo("icon", $file);
|
||||
echo "<IMG SRC=\"pix/$icon\" HEIGHT=16 WIDTH=16> $file<BR>";
|
||||
echo "<img src=\"$CFG->pixpath/f/$icon\" height=16 width=16> $file<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -709,12 +715,12 @@ function displaydir ($wdir) {
|
||||
$filename = $fullpath."/".$dir;
|
||||
$fileurl = rawurlencode($wdir."/".$dir);
|
||||
$filesafe = rawurlencode($dir);
|
||||
$filedate = userdate(filectime($filename), "%d %b %Y, %I:%M %p");
|
||||
$filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
|
||||
|
||||
echo "<TR>";
|
||||
|
||||
print_cell("center", "<INPUT TYPE=checkbox NAME=\"file$count\" VALUE=\"$fileurl\">");
|
||||
print_cell("left", "<A HREF=\"index.php?id=$id&wdir=$fileurl\"><IMG SRC=\"pix/folder.gif\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"Folder\"></A> <A HREF=\"index.php?id=$id&wdir=$fileurl\">".htmlspecialchars($dir)."</A>");
|
||||
print_cell("left", "<A HREF=\"index.php?id=$id&wdir=$fileurl\"><IMG SRC=\"$CFG->pixpath/f/folder.gif\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"Folder\"></A> <A HREF=\"index.php?id=$id&wdir=$fileurl\">".htmlspecialchars($dir)."</A>");
|
||||
print_cell("right", "-");
|
||||
print_cell("right", $filedate);
|
||||
print_cell("right", "<A HREF=\"index.php?id=$id&wdir=$wdir&file=$filesafe&action=rename\">$strrename</A>");
|
||||
@@ -735,7 +741,7 @@ function displaydir ($wdir) {
|
||||
$fileurl = "$wdir/$file";
|
||||
$filesafe = rawurlencode($file);
|
||||
$fileurlsafe = rawurlencode($fileurl);
|
||||
$filedate = userdate(filectime($filename), "%d %b %Y, %I:%M %p");
|
||||
$filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
|
||||
|
||||
echo "<tr>";
|
||||
|
||||
@@ -747,7 +753,7 @@ function displaydir ($wdir) {
|
||||
$ffurl = "/file.php?file=/$id$fileurl";
|
||||
}
|
||||
link_to_popup_window ($ffurl, "display",
|
||||
"<IMG SRC=\"pix/$icon\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"File\">",
|
||||
"<IMG SRC=\"$CFG->pixpath/f/$icon\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"File\">",
|
||||
480, 640);
|
||||
echo "<font size=\"-1\" face=\"Arial, Helvetica\">";
|
||||
link_to_popup_window ($ffurl, "display",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
function mimeinfo($element, $filename) {
|
||||
$mimeinfo = array (
|
||||
"xxx" => array ("type"=>"document/unknown", "icon"=>"unknown.gif"),
|
||||
"3gp" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),
|
||||
"ai" => array ("type"=>"application/postscript", "icon"=>"image.gif"),
|
||||
"aif" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),
|
||||
"aiff" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),
|
||||
@@ -67,6 +68,8 @@ function mimeinfo($element, $filename) {
|
||||
"tsv" => array ("type"=>"text/tab-separated-values", "icon"=>"text.gif"),
|
||||
"txt" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"wav" => array ("type"=>"audio/wav", "icon"=>"audio.gif"),
|
||||
"wmv" => array ("type"=>"video/x-ms-wmv", "icon"=>"avi.gif"),
|
||||
"asf" => array ("type"=>"video/x-ms-asf", "icon"=>"avi.gif"),
|
||||
"xls" => array ("type"=>"application/vnd.ms-excel", "icon"=>"excel.gif"),
|
||||
"xml" => array ("type"=>"text/xml", "icon"=>"xml.gif"),
|
||||
"xsl" => array ("type"=>"text/xml", "icon"=>"xml.gif"),
|
||||
|
||||
Executable
+651
@@ -0,0 +1,651 @@
|
||||
|
||||
|
||||
## Last modification: 8/3/00 by akp
|
||||
## Originally written by Daniel Martin, Dept of Math, John Hopkins
|
||||
## Additions and modifications were made by James Martino, Dept of Math, John Hopkins
|
||||
## Additions and modifications were made by Arnold Pizer, Dept of Math, Univ of Rochester
|
||||
|
||||
#use Data::Dumper;
|
||||
|
||||
package AlgParser;
|
||||
use HTML::Entities;
|
||||
|
||||
%close = ();
|
||||
|
||||
sub new {
|
||||
my $package = shift;
|
||||
my (%ret);
|
||||
$ret{string} = "";
|
||||
$ret{posarray} = [];
|
||||
$ret{parseerror} = "";
|
||||
$ret{parseresult} = [];
|
||||
bless \%ret, $package;
|
||||
return \%ret;
|
||||
}
|
||||
|
||||
sub inittokenizer {
|
||||
my($self, $string) = @_;
|
||||
$self->{string} =~ m/\G.*$/g;
|
||||
$self->{string} = undef;
|
||||
$self->{string} = $string;
|
||||
$self->{string} =~ m/\G.*$/g;
|
||||
$self->{string} =~ m/^/g;
|
||||
}
|
||||
|
||||
$close{'{'} = '}';
|
||||
$close{'['} = ']';
|
||||
$close{'('} = ')';
|
||||
|
||||
$binoper3 = '(?:\\^|\\*\\*)';
|
||||
$binoper2 = '[/*_,]';
|
||||
$binoper1 = '[-+=><%!#]';
|
||||
$openparen = '[{(\\[]';
|
||||
$closeparen = '[})\\]]';
|
||||
$varname = '[A-Za-z](?:_[0-9]+)?';
|
||||
$specialvalue = '(?:e|pi|da|db|dc|de|df|dg|dh|di|dj|dk|dl|dm|dn|do|dp|dq|dr|ds|dt|du|dv|dw|dx|dy|dz|infty|alpha|bita|gamma|zita|thita|iota|kappa|lambda|mu|nu|xi|rho|sigma|tau|phi|chi|psi|omega|zepslon|zdelta|xeta|zupslon)';
|
||||
$numberplain = '(?:\d+(?:\.\d*)?|\.\d+)';
|
||||
$numberE = '(?:' . $numberplain . 'E[-+]?\d+)';
|
||||
$number = '(?:' . $numberE . '|' . $numberplain . ')';
|
||||
#
|
||||
# DPVC -- 2003/03/31
|
||||
# added missing trig and inverse functions
|
||||
#
|
||||
#$trigfname = '(?:cosh|sinh|tanh|cot|(?:a(?:rc)?)?cos|(?:a(?:rc)?)?sin|' .
|
||||
# '(?:a(?:rc)?)?tan|sech?)';
|
||||
$trigfname = '(?:(?:a(?:rc)?)?(?:sin|cos|tan|sec|csc|cot)h?)';
|
||||
#
|
||||
# End DPVC
|
||||
#
|
||||
$otherfunc = '(?:exp|abs|logten|log|ln|sqrt|sgn|step|fact|int|lim|fun[a-zA-Z])';
|
||||
$funcname = '(?:' . $otherfunc . '|' . $trigfname . ')';
|
||||
|
||||
$tokenregexp = "(?:($binoper3)|($binoper2)|($binoper1)|($openparen)|" .
|
||||
"($closeparen)|($funcname)|($specialvalue)|($varname)|" .
|
||||
"($numberE)|($number))";
|
||||
|
||||
sub nexttoken {
|
||||
my($self) = shift;
|
||||
$self->{string} =~ m/\G\s+/gc;
|
||||
my($p1) = pos($self->{string}) || 0;
|
||||
if(scalar($self->{string} =~ m/\G$tokenregexp/gc)) {
|
||||
push @{$self->{posarray}}, [$p1, pos($self->{string})];
|
||||
if (defined($1)) {return ['binop3', $1];}
|
||||
if (defined($2)) {return ['binop2', $2];}
|
||||
if (defined($3)) {return ['binop1', $3];}
|
||||
if (defined($4)) {return ['openp', $4];}
|
||||
if (defined($5)) {return ['closep', $5];}
|
||||
if (defined($6)) {return ['func1', $6];}
|
||||
if (defined($7)) {return ['special', $7];}
|
||||
if (defined($8)) {return ['varname', $8];}
|
||||
if (defined($9)) {return ['numberE', $9];}
|
||||
if (defined($10)) {return ['number', $10];}
|
||||
}
|
||||
else {
|
||||
push @{$self->{posarray}}, [$p1, undef];
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
sub parse {
|
||||
my $self = shift;
|
||||
$self->{parseerror} = "";
|
||||
$self->{posarray} = [];
|
||||
$self->{parseresult} = ['top', undef];
|
||||
my (@backtrace) = (\$self->{parseresult});
|
||||
my (@pushback) = ();
|
||||
|
||||
my $currentref = \$self->{parseresult}->[1];
|
||||
my $curenttok;
|
||||
|
||||
my $sstring = shift;
|
||||
$self->inittokenizer($sstring);
|
||||
$currenttok = $self->nexttoken;
|
||||
if (!$currenttok) {
|
||||
if ($self->{string} =~ m/\G$/g) {
|
||||
return $self->error("empty");
|
||||
} else {
|
||||
my($mark) = pop @{$self->{posarray}};
|
||||
my $position = 1+$mark->[0];
|
||||
return $self->error("Illegal character at position $position", $mark);
|
||||
}
|
||||
}
|
||||
# so I can assume we got a token
|
||||
local $_;
|
||||
while ($currenttok) {
|
||||
$_ = $currenttok->[0];
|
||||
/binop1/ && do {
|
||||
# check if we have a binary or unary operation here.
|
||||
if (defined(${$currentref})) {
|
||||
# binary - walk up the tree until we hit an open paren or the top
|
||||
while (${$currentref}->[0] !~ /^(openp|top)/) {
|
||||
$currentref = pop @backtrace;
|
||||
}
|
||||
my $index = ((${$currentref}->[0] eq 'top')?1:3);
|
||||
${$currentref}->[$index] = ['binop1', $currenttok->[1],
|
||||
${$currentref}->[$index], undef];
|
||||
push @backtrace, $currentref;
|
||||
push @backtrace, \${$currentref}->[$index];
|
||||
$currentref = \${$currentref}->[$index]->[3];
|
||||
} else {
|
||||
# unary
|
||||
${$currentref} = ['unop1', $currenttok->[1], undef];
|
||||
push @backtrace, $currentref;
|
||||
$currentref = \${$currentref}->[2];
|
||||
}
|
||||
};
|
||||
/binop2/ && do {
|
||||
if (defined(${$currentref})) {
|
||||
# walk up the tree until an open paren, the top, binop1 or unop1
|
||||
# I decide arbitrarily that -3*4 should be parsed as -(3*4)
|
||||
# instead of as (-3)*4. Not that it makes a difference.
|
||||
|
||||
while (${$currentref}->[0] !~ /^(openp|top|binop1)/) {
|
||||
$currentref = pop @backtrace;
|
||||
}
|
||||
my $a = ${$currentref}->[0];
|
||||
my $index = (($a eq 'top')?1:3);
|
||||
${$currentref}->[$index] = ['binop2', $currenttok->[1],
|
||||
${$currentref}->[$index], undef];
|
||||
push @backtrace, $currentref;
|
||||
push @backtrace, \${$currentref}->[$index];
|
||||
$currentref = \${$currentref}->[$index]->[3];
|
||||
} else {
|
||||
# Error
|
||||
my($mark) = pop @{$self->{posarray}};
|
||||
my $position =1+$mark->[0];
|
||||
return $self->error("Didn't expect " . $currenttok->[1] .
|
||||
" at position $position" , $mark);
|
||||
}
|
||||
};
|
||||
/binop3/ && do {
|
||||
if (defined(${$currentref})) {
|
||||
# walk up the tree until we need to stop
|
||||
# Note that the right-associated nature of ^ means we need to
|
||||
# stop walking backwards when we hit a ^ as well.
|
||||
while (${$currentref}->[0] !~ /^(openp|top|binop[123]|unop1)/) {
|
||||
$currentref = pop @backtrace;
|
||||
}
|
||||
my $a = ${$currentref}->[0];
|
||||
my $index = ($a eq 'top')?1:($a eq 'unop1')?2:3;
|
||||
${$currentref}->[$index] = ['binop3', $currenttok->[1],
|
||||
${$currentref}->[$index], undef];
|
||||
push @backtrace, $currentref;
|
||||
push @backtrace, \${$currentref}->[$index];
|
||||
$currentref = \${$currentref}->[$index]->[3];
|
||||
} else {
|
||||
# Error
|
||||
my($mark) = pop @{$self->{posarray}};
|
||||
my $position = 1+$mark->[0];
|
||||
return $self->error("Didn't expect " . $currenttok->[1] .
|
||||
" at position $position", $mark);
|
||||
}
|
||||
};
|
||||
/openp/ && do {
|
||||
if (defined(${$currentref})) {
|
||||
# we weren't expecting this - must be implicit
|
||||
# multiplication.
|
||||
push @pushback, $currenttok;
|
||||
$currenttok = ['binop2', 'implicit'];
|
||||
next;
|
||||
} else {
|
||||
my($me) = pop @{$self->{posarray}};
|
||||
${$currentref} = [$currenttok->[0], $currenttok->[1], $me, undef];
|
||||
push @backtrace, $currentref;
|
||||
$currentref = \${$currentref}->[3];
|
||||
}
|
||||
};
|
||||
/func1/ && do {
|
||||
if (defined(${$currentref})) {
|
||||
# we weren't expecting this - must be implicit
|
||||
# multiplication.
|
||||
push @pushback, $currenttok;
|
||||
$currenttok = ['binop2', 'implicit'];
|
||||
next;
|
||||
} else {
|
||||
# just like a unary operator
|
||||
${$currentref} = [$currenttok->[0], $currenttok->[1], undef];
|
||||
push @backtrace, $currentref;
|
||||
$currentref = \${$currentref}->[2];
|
||||
}
|
||||
};
|
||||
/closep/ && do {
|
||||
if (defined(${$currentref})) {
|
||||
# walk up the tree until we need to stop
|
||||
while (${$currentref}->[0] !~ /^(openp|top)/) {
|
||||
$currentref = pop @backtrace;
|
||||
}
|
||||
my $a = ${$currentref}->[0];
|
||||
if ($a eq 'top') {
|
||||
my($mark) = pop @{$self->{posarray}};
|
||||
my $position = 1+$mark->[0];
|
||||
return $self->error("Unmatched close " . $currenttok->[1] .
|
||||
" at position $position", $mark);
|
||||
} elsif ($close{${$currentref}->[1]} ne $currenttok->[1]) {
|
||||
my($mark) = pop @{$self->{posarray}};
|
||||
my $position = 1+$mark->[0];
|
||||
return $self->error("Mismatched parens at position $position"
|
||||
, ${$currentref}->[2], $mark);
|
||||
} else {
|
||||
${$currentref}->[0] = 'closep';
|
||||
${$currentref}->[2] = pop @{${$currentref}};
|
||||
}
|
||||
} else {
|
||||
# Error - something like (3+4*)
|
||||
my($mark) = pop @{$self->{posarray}};
|
||||
my $position = 1+$mark->[0];
|
||||
return $self->error("Premature close " . $currenttok->[1] .
|
||||
" at position $position", $mark);
|
||||
}
|
||||
};
|
||||
/special|varname|numberE?/ && do {
|
||||
if (defined(${$currentref})) {
|
||||
# we weren't expecting this - must be implicit
|
||||
# multiplication.
|
||||
push @pushback, $currenttok;
|
||||
$currenttok = ['binop2', 'implicit'];
|
||||
next;
|
||||
} else {
|
||||
${$currentref} = [$currenttok->[0], $currenttok->[1]];
|
||||
}
|
||||
};
|
||||
if (@pushback) {
|
||||
$currenttok = pop @pushback;
|
||||
} else {
|
||||
$currenttok = $self->nexttoken;
|
||||
}
|
||||
}
|
||||
# ok, we stopped parsing. Now we need to see why.
|
||||
if ($self->{parseresult}->[0] eq 'top') {
|
||||
$self->{parseresult} = $self->arraytoexpr($self->{parseresult}->[1]);
|
||||
} else {
|
||||
return $self->error("Internal consistency error; not at top when done");
|
||||
}
|
||||
if ($self->{string} =~ m/\G\s*$/g) {
|
||||
if (!defined(${$currentref})) {
|
||||
$self->{string} .= " ";
|
||||
return $self->error("I was expecting more at the end of the line",
|
||||
[length($self->{string})-1, length($self->{string})]);
|
||||
} else {
|
||||
# check that all the parens were closed
|
||||
while (@backtrace) {
|
||||
$currentref = pop @backtrace;
|
||||
if (${$currentref}->[0] eq 'openp') {
|
||||
my($mark) = ${$currentref}->[2];
|
||||
my $position = 1+$mark->[0];
|
||||
return $self->error("Unclosed parentheses beginning at position $position"
|
||||
, $mark);
|
||||
}
|
||||
}
|
||||
# Ok, we must really have parsed something
|
||||
return $self->{parseresult};
|
||||
}
|
||||
} else {
|
||||
my($mark) = pop @{$self->{posarray}};
|
||||
my $position = 1+$mark->[0];
|
||||
return $self->error("Illegal character at position $position",$mark);
|
||||
}
|
||||
}
|
||||
|
||||
sub arraytoexpr {
|
||||
my ($self) = shift;
|
||||
return Expr->fromarray(@_);
|
||||
}
|
||||
|
||||
sub error {
|
||||
my($self, $errstr, @markers) = @_;
|
||||
# print STDERR Data::Dumper->Dump([\@markers],
|
||||
# ['$markers']);
|
||||
$self->{parseerror} = $errstr;
|
||||
my($htmledstring) = '<tt class="parseinput">';
|
||||
my($str) = $self->{string};
|
||||
# print STDERR Data::Dumper->Dump([$str], ['$str']);
|
||||
my($lastpos) = 0;
|
||||
$str =~ s/ /\240/g;
|
||||
while(@markers) {
|
||||
my($ref) = shift @markers;
|
||||
my($pos1) = $ref->[0];
|
||||
my($pos2) = $ref->[1];
|
||||
if (!defined($pos2)) {$pos2 = $pos1+1;}
|
||||
$htmledstring .= encode_entities(substr($str,$lastpos,$pos1-$lastpos)) .
|
||||
'<b class="parsehilight">' .
|
||||
encode_entities(substr($str,$pos1,$pos2-$pos1)) .
|
||||
'</b>';
|
||||
$lastpos = $pos2;
|
||||
}
|
||||
# print STDERR Data::Dumper->Dump([$str, $htmledstring, $lastpos],
|
||||
# ['$str', '$htmledstring', '$lastpos']);
|
||||
$htmledstring .= encode_entities(substr($str,$lastpos));
|
||||
$htmledstring .= '</tt>';
|
||||
# $self->{htmlerror} = '<p class="parseerr">' . "\n" .
|
||||
# '<span class="parsedesc">' .
|
||||
# encode_entities($errstr) . '</span><br>' . "\n" .
|
||||
# $htmledstring . "\n" . '</p>' . "\n";
|
||||
$self->{htmlerror} = $htmledstring ;
|
||||
$self->{htmlerror} = 'empty' if $errstr eq 'empty';
|
||||
$self->{error_msg} = $errstr;
|
||||
|
||||
# warn $errstr . "\n";
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub tostring {
|
||||
my ($self) = shift;
|
||||
return $self->{parseresult}->tostring(@_);
|
||||
}
|
||||
|
||||
sub tolatex {
|
||||
my ($self) = shift;
|
||||
return $self->{parseresult}->tolatex(@_);
|
||||
}
|
||||
|
||||
sub tolatexstring { return tolatex(@_);}
|
||||
|
||||
sub exprtolatexstr {
|
||||
return exprtolatex(@_);
|
||||
}
|
||||
|
||||
sub exprtolatex {
|
||||
my($expr) = shift;
|
||||
my($exprobj);
|
||||
if ((ref $expr) eq 'ARRAY') {
|
||||
$exprobj = Expr->new(@$expr);
|
||||
} else {
|
||||
$exprobj = $expr;
|
||||
}
|
||||
return $exprobj->tolatex();
|
||||
}
|
||||
|
||||
sub exprtostr {
|
||||
my($expr) = shift;
|
||||
my($exprobj);
|
||||
if ((ref $expr) eq 'ARRAY') {
|
||||
$exprobj = Expr->new(@$expr);
|
||||
} else {
|
||||
$exprobj = $expr;
|
||||
}
|
||||
return $exprobj->tostring();
|
||||
}
|
||||
|
||||
sub normalize {
|
||||
my ($self, $degree) = @_;
|
||||
$self->{parseresult} = $self->{parseresult}->normalize($degree);
|
||||
}
|
||||
|
||||
sub normalize_expr {
|
||||
my($expr, $degree) = @_;
|
||||
my($exprobj);
|
||||
if ((ref $expr) eq 'ARRAY') {
|
||||
$exprobj = Expr->new(@$expr);
|
||||
} else {
|
||||
$exprobj = $expr;
|
||||
}
|
||||
return $exprobj->normalize($degree);
|
||||
}
|
||||
|
||||
package AlgParserWithImplicitExpand;
|
||||
@ISA=qw(AlgParser);
|
||||
|
||||
sub arraytoexpr {
|
||||
my ($self) = shift;
|
||||
my ($foo) = ExprWithImplicitExpand->fromarray(@_);
|
||||
# print STDERR Data::Dumper->Dump([$foo],['retval']);
|
||||
return $foo;
|
||||
}
|
||||
|
||||
package Expr;
|
||||
|
||||
sub new {
|
||||
my($class) = shift;
|
||||
my(@args) = @_;
|
||||
my($ret) = [@args];
|
||||
return (bless $ret, $class);
|
||||
}
|
||||
|
||||
sub head {
|
||||
my($self) = shift;
|
||||
return ($self->[0]);
|
||||
}
|
||||
|
||||
|
||||
sub normalize {
|
||||
#print STDERR "normalize\n";
|
||||
#print STDERR Data::Dumper->Dump([@_]);
|
||||
|
||||
my($self, $degree) = @_;
|
||||
my($class) = ref $self;
|
||||
$degree = $degree || 0;
|
||||
my($type, @args) = @$self;
|
||||
local $_;
|
||||
$_ = $type;
|
||||
my ($ret) = [$type, @args];
|
||||
|
||||
|
||||
if(/closep/) {
|
||||
$ret = $args[1]->normalize($degree);
|
||||
} elsif (/unop1/) {
|
||||
$ret = $class->new($type, $args[0], $args[1]->normalize($degree));
|
||||
} elsif (/binop/) {
|
||||
$ret = $class->new($type, $args[0], $args[1]->normalize($degree),
|
||||
$args[2]->normalize($degree));
|
||||
} elsif (/func1/) {
|
||||
$args[0] =~ s/^arc/a/;
|
||||
$ret = $class->new($type, $args[0], $args[1]->normalize($degree));
|
||||
}
|
||||
|
||||
|
||||
if ($degree < 0) {return $ret;}
|
||||
|
||||
|
||||
($type, @args) = @$ret;
|
||||
$ret = $class->new($type, @args);
|
||||
$_ = $type;
|
||||
if (/binop1/ && ($args[2]->[0] =~ 'unop1')) {
|
||||
my($h1, $h2) = ($args[0], $args[2]->[1]);
|
||||
my($s1, $s2) = ($h1 eq '-', $h2 eq '-');
|
||||
my($eventual) = ($s1==$s2);
|
||||
if ($eventual) {
|
||||
$ret = $class->new('binop1', '+', $args[1], $args[2]->[2] );
|
||||
} else {
|
||||
$ret = $class->new('binop1', '-', $args[1], $args[2]->[2] );
|
||||
}
|
||||
} elsif (/binop2/ && ($args[1]->[0] =~ 'unop1')) {
|
||||
$ret = $class->new('unop1', '-',
|
||||
$class->new($type, $args[0], $args[1]->[2],
|
||||
$args[2])->normalize($degree) );
|
||||
} elsif (/binop[12]/ && ($args[2]->[0] eq $type) &&
|
||||
($args[0] =~ /[+*]/)) {
|
||||
# Remove frivolous right-association
|
||||
# For example, fix 3+(4-5) or 3*(4x)
|
||||
$ret = $class->new($type, $args[2]->[1],
|
||||
$class->new($type, $args[0], $args[1],
|
||||
$args[2]->[2])->normalize($degree),
|
||||
$args[2]->[3]);
|
||||
} elsif (/unop1/ && ($args[0] eq '+')) {
|
||||
$ret = $args[1];
|
||||
} elsif (/unop1/ && ($args[1]->[0] =~ 'unop1')) {
|
||||
$ret = $args[1]->[2];
|
||||
}
|
||||
if ($degree > 0) {
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub tostring {
|
||||
# print STDERR "Expr::tostring\n";
|
||||
# print STDERR Data::Dumper->Dump([@_]);
|
||||
my($self) = shift;
|
||||
my($type, @args) = @$self;
|
||||
local $_;
|
||||
$_ = $type;
|
||||
/binop1/ && do {
|
||||
my ($p1, $p2) = ('','');
|
||||
if ($args[2]->[0] eq 'binop1') {($p1,$p2)=qw{ ( ) };}
|
||||
return ($args[1]->tostring() . $args[0] . $p1 .
|
||||
$args[2]->tostring() . $p2);
|
||||
};
|
||||
/unop1/ && do {
|
||||
my ($p1, $p2) = ('','');
|
||||
if ($args[1]->[0] =~ /binop1/) {($p1,$p2)=qw{ ( ) };}
|
||||
return ($args[0] . $p1 . $args[1]->tostring() . $p2);
|
||||
};
|
||||
/binop2/ && do {
|
||||
my ($p1, $p2, $p3, $p4)=('','','','');
|
||||
if ($args[0] =~ /implicit/) {$args[0] = ' ';}
|
||||
if ($args[1]->[0] =~ /binop1/) {($p1,$p2)=qw{ ( ) };}
|
||||
# if ($args[2]->[0] =~ /binop[12]/) {($p3,$p4)=qw{ ( ) };}
|
||||
if ($args[2]->[0] =~ /binop[12]|unop1/) {($p3,$p4)=qw{ ( ) };}
|
||||
return ($p1 . $args[1]->tostring() . $p2 . $args[0] . $p3 .
|
||||
$args[2]->tostring() . $p4);
|
||||
};
|
||||
/binop3/ && do {
|
||||
my ($p1, $p2, $p3, $p4)=('','','','');
|
||||
# if ($args[1]->[0] =~ /binop[123]|numberE/) {($p1,$p2)=qw{ ( ) };}
|
||||
if ($args[1]->[0] =~ /binop[123]|unop1|numberE/) {($p1,$p2)=qw{ ( ) };}
|
||||
# if ($args[2]->[0] =~ /binop[12]|numberE/) {($p3,$p4)=qw{ ( ) };}
|
||||
if ($args[2]->[0] =~ /binop[12]|unop1|numberE/) {($p3,$p4)=qw{ ( ) };}
|
||||
return ($p1 . $args[1]->tostring() . $p2 . $args[0] . $p3 .
|
||||
$args[2]->tostring() . $p4);
|
||||
};
|
||||
/func1/ && do {
|
||||
return ($args[0] . '(' . $args[1]->tostring() . ')');
|
||||
};
|
||||
/special|varname|numberE?/ && return $args[0];
|
||||
/closep/ && do {
|
||||
my(%close) = %AlgParser::close;
|
||||
|
||||
|
||||
|
||||
return ($args[0] . $args[1]->tostring() . $close{$args[0]});
|
||||
};
|
||||
}
|
||||
|
||||
sub tolatex {
|
||||
my($self) = shift;
|
||||
my($type, @args) = @$self;
|
||||
local $_;
|
||||
$_ = $type;
|
||||
/binop1/ && do {
|
||||
my ($p1, $p2) = ('','');
|
||||
if ($args[2]->[0] eq 'binop1') {($p1,$p2)=qw{ \left( \right) };}
|
||||
return ($args[1]->tolatex() . $args[0] . $p1 .
|
||||
$args[2]->tolatex() . $p2);
|
||||
};
|
||||
/unop1/ && do {
|
||||
my ($p1, $p2) = ('','');
|
||||
if ($args[1]->[0] =~ /binop1/) {($p1,$p2)=qw{ \left( \right) };}
|
||||
return ($args[0] . $p1 . $args[1]->tolatex() . $p2);
|
||||
};
|
||||
/binop2/ && do {
|
||||
my ($p1, $p2, $p3, $p4) = ('','','','');
|
||||
if ($args[0] =~ /implicit/) {
|
||||
if ( (($args[1]->head eq qq(number)) &&
|
||||
($args[2]->head eq qq(number))) ||
|
||||
(($args[1]->head eq qq(binop2)) &&
|
||||
($args[1]->[2]->head eq qq(number))) ) {
|
||||
$args[0] = '\\,';
|
||||
} else {
|
||||
$args[0] = ' ';
|
||||
}
|
||||
}
|
||||
if ($args[1]->[0] =~ /binop1|numberE/)
|
||||
{($p1,$p2)=qw{ \left( \right) };}
|
||||
# if ($args[2]->[0] =~ /binop[12]|numberE/)
|
||||
if ($args[2]->[0] =~ /binop[12]|numberE|unop1/)
|
||||
{($p3,$p4)=qw{ \left( \right) };}
|
||||
if ($args[0] eq '/'){
|
||||
# return('\frac{' . $p1 . $args[1]->tolatex() . $p2 . '}'.
|
||||
# '{' . $p3 . $args[2]->tolatex() . $p4 . '}' );
|
||||
return('\frac{' . $args[1]->tolatex() . '}'.
|
||||
'{' . $args[2]->tolatex() . '}' );
|
||||
}
|
||||
else{
|
||||
return ($p1 . $args[1]->tolatex() . $p2 . $args[0] . $p3 .
|
||||
$args[2]->tolatex() . $p4);
|
||||
}
|
||||
};
|
||||
/binop3/ && do {
|
||||
my ($p1, $p2, $p3, $p4)=('','','','');
|
||||
# if ($args[1]->[0] =~ /binop[123]|numberE/) {($p1,$p2)=qw{ \left( \right) };}
|
||||
if ($args[1]->[0] =~ /binop[123]|unop1|numberE/) {($p1,$p2)=qw{ \left( \right) };}
|
||||
# Not necessary in latex
|
||||
# if ($args[2]->[0] =~ /binop[12]/) {($p3,$p4)=qw{ \left( \right) };}
|
||||
return ($p1 . $args[1]->tolatex() . $p2 . "^{" . $p3 .
|
||||
$args[2]->tolatex() . $p4 . "}");
|
||||
};
|
||||
/func1/ && do {
|
||||
my($p1,$p2);
|
||||
if($args[0] eq "sqrt"){($p1,$p2)=qw{ \left{ \right} };}
|
||||
else {($p1,$p2)=qw{ \left( \right) };}
|
||||
|
||||
#
|
||||
# DPVC -- 2003/03/31
|
||||
# added missing trig functions
|
||||
#
|
||||
#$specialfunc = '(?:abs|logten|asin|acos|atan|sech|sgn|step|fact)';
|
||||
$specialfunc = '(?:abs|logten|a(?:sin|cos|tan|sec|csc|cot)h?|sgn|step|fact)';
|
||||
#
|
||||
# End DPVC
|
||||
#
|
||||
|
||||
if ($args[0] =~ /$specialfunc/) {
|
||||
return ('\mbox{' . $args[0] .'}'. $p1 . $args[1]->tolatex() . $p2);
|
||||
}
|
||||
else {
|
||||
return ('\\' . $args[0] . $p1 . $args[1]->tolatex() . $p2);
|
||||
}
|
||||
};
|
||||
/special/ && do {
|
||||
if ($args[0] eq 'pi') {return '\pi';} else {return $args[0];}
|
||||
};
|
||||
/varname|(:?number$)/ && return $args[0];
|
||||
/numberE/ && do {
|
||||
$args[0] =~ m/($AlgParser::numberplain)E([-+]?\d+)/;
|
||||
return ($1 . '\times 10^{' . $2 . '}');
|
||||
};
|
||||
/closep/ && do {
|
||||
my($backslash) = '';
|
||||
my(%close) = %AlgParser::close;
|
||||
if ($args[0] eq '{') {$backslash = '\\';}
|
||||
#This is for editors to match: }
|
||||
return ('\left' . $backslash . $args[0] . $args[1]->tolatex() .
|
||||
'\right' . $backslash . $close{$args[0]});
|
||||
};
|
||||
}
|
||||
|
||||
sub fromarray {
|
||||
my($class) = shift;
|
||||
my($expr) = shift;
|
||||
if ((ref $expr) ne qq{ARRAY}) {
|
||||
die "Program error; fromarray not passed an array ref.";
|
||||
}
|
||||
my($type, @args) = @$expr;
|
||||
foreach my $i (@args) {
|
||||
if (ref $i) {
|
||||
$i = $class->fromarray($i);
|
||||
}
|
||||
}
|
||||
return $class->new($type, @args);
|
||||
}
|
||||
|
||||
package ExprWithImplicitExpand;
|
||||
@ISA=qw(Expr);
|
||||
|
||||
|
||||
sub tostring {
|
||||
# print STDERR "ExprWIE::tostring\n";
|
||||
# print STDERR Data::Dumper->Dump([@_]);
|
||||
my ($self) = shift;
|
||||
|
||||
my($type, @args) = @$self;
|
||||
|
||||
if (($type eq qq(binop2)) && ($args[0] eq qq(implicit))) {
|
||||
my ($p1, $p2, $p3, $p4)=('','','','');
|
||||
if ($args[1]->head =~ /binop1/) {($p1,$p2)=qw{ ( ) };}
|
||||
# if ($args[2]->head =~ /binop[12]/) {($p3,$p4)=qw{ ( ) };}
|
||||
if ($args[2]->head =~ /binop[12]|unop1/) {($p3,$p4)=qw{ ( ) };}
|
||||
return ($p1 . $args[1]->tostring() . $p2 . '*' . $p3 .
|
||||
$args[2]->tostring() . $p4);
|
||||
} else {
|
||||
return $self->SUPER::tostring(@_);
|
||||
}
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use lib '.';
|
||||
use AlgParser;
|
||||
|
||||
my $parser = new AlgParserWithImplicitExpand;
|
||||
my $ret;
|
||||
|
||||
$ret = $parser -> parse($ARGV[0]);
|
||||
if ( ref($ret) ) {
|
||||
$parser -> tostring();
|
||||
$parser -> normalize();
|
||||
print $parser -> tolatex();
|
||||
} else {
|
||||
print $parser->{htmlerror};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
<?PHP // $Id$
|
||||
// This function fetches math. images from the data directory
|
||||
// If not, it obtains the corresponding TeX expression from the cache_tex db table
|
||||
// and uses mimeTeX to create the image file
|
||||
|
||||
$nomoodlecookie = true; // Because it interferes with caching
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
|
||||
$CFG->texfilterdir = "filter/tex";
|
||||
$CFG->algebrafilterdir = "filter/algebra";
|
||||
$CFG->algebraimagedir = "filter/algebra";
|
||||
|
||||
$query = urldecode($_SERVER['QUERY_STRING']);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
if ($query) {
|
||||
$output = $query;
|
||||
$splitpos = strpos($query,'&')-8;
|
||||
$algebra = substr($query,8,$splitpos);
|
||||
$md5 = md5($algebra);
|
||||
if (strpos($query,'ShowDB') || strpos($query,'DeleteDB')) {
|
||||
$texcache = get_record("cache_filters","filter","algebra", "md5key", $md5);
|
||||
}
|
||||
if (strpos($query,'ShowDB')) {
|
||||
if ($texcache) {
|
||||
$output = "DB cache_filters entry for $algebra\n";
|
||||
$output .= "id = $texcache->id\n";
|
||||
$output .= "filter = $texcache->filter\n";
|
||||
$output .= "version = $texcache->version\n";
|
||||
$output .= "md5key = $texcache->md5key\n";
|
||||
$output .= "rawtext = $texcache->rawtext\n";
|
||||
$output .= "timemodified = $texcache->timemodified\n";
|
||||
} else {
|
||||
$output = "DB cache_filters entry for $algebra not found\n";
|
||||
}
|
||||
}
|
||||
if (strpos($query,'DeleteDB')) {
|
||||
if ($texcache) {
|
||||
$output = "Deleting DB cache_filters entry for $algebra\n";
|
||||
$result = delete_records("cache_filters","id",$texcache->id);
|
||||
if ($result) {
|
||||
$result = 1;
|
||||
} else {
|
||||
$result = 0;
|
||||
}
|
||||
$output .= "Number of records deleted = $result\n";
|
||||
} else {
|
||||
$output = "Could not delete DB cache_filters entry for $algebra\nbecause it could not be found.\n";
|
||||
}
|
||||
}
|
||||
if (strpos($query,'TeXStage1')) {
|
||||
$output = algebra2tex($algebra);
|
||||
}
|
||||
if (strpos($query,'TeXStage2')) {
|
||||
$output = algebra2tex($algebra);
|
||||
$output = refineTeX($output);
|
||||
}
|
||||
if (strpos($query,'ShowImage')) {
|
||||
$output = algebra2tex($algebra);
|
||||
$output = refineTeX($output);
|
||||
tex2image($output, $md5);
|
||||
} else {
|
||||
outputText($output);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
function algebra2tex($algebra) {
|
||||
Global $CFG;
|
||||
$algebra = str_replace('<','<',$algebra);
|
||||
$algebra = str_replace('>','>',$algebra);
|
||||
$algebra = str_replace('<>','#',$algebra);
|
||||
$algebra = str_replace('<=','%',$algebra);
|
||||
$algebra = str_replace('>=','!',$algebra);
|
||||
$algebra = str_replace('delta','zdelta',$algebra);
|
||||
$algebra = str_replace('beta','bita',$algebra);
|
||||
$algebra = str_replace('theta','thita',$algebra);
|
||||
$algebra = str_replace('zeta','zita',$algebra);
|
||||
$algebra = str_replace('eta','xeta',$algebra);
|
||||
$algebra = str_replace('epsilon','zepslon',$algebra);
|
||||
$algebra = str_replace('upsilon','zupslon',$algebra);
|
||||
$algebra = preg_replace('!\r\n?!',' ',$algebra);
|
||||
|
||||
if ( (PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows") ) {
|
||||
$algebra = "\"". str_replace('"','\"',$algebra) . "\"";
|
||||
$cmd = "cd $CFG->dirroot/$CFG->algebrafilterdir & algebra2tex.pl $algebra";
|
||||
} else {
|
||||
$algebra = escapeshellarg($algebra);
|
||||
$cmd = "cd $CFG->dirroot/$CFG->algebrafilterdir; ./algebra2tex.pl $algebra";
|
||||
}
|
||||
$texexp = `$cmd`;
|
||||
return $texexp;
|
||||
}
|
||||
|
||||
function refineTeX($texexp) {
|
||||
$texexp = str_replace('#','\not= ',$texexp);
|
||||
$texexp = str_replace('%','\leq ',$texexp);
|
||||
$texexp = str_replace('!','\geq ',$texexp);
|
||||
$texexp = str_replace('\left{','{',$texexp);
|
||||
$texexp = str_replace('\right}','}',$texexp);
|
||||
$texexp = str_replace('\fun',' ',$texexp);
|
||||
$texexp = str_replace('infty','\infty',$texexp);
|
||||
$texexp = str_replace('alpha','\alpha',$texexp);
|
||||
$texexp = str_replace('gamma','\gamma',$texexp);
|
||||
$texexp = str_replace('iota','\iota',$texexp);
|
||||
$texexp = str_replace('kappa','\kappa',$texexp);
|
||||
$texexp = str_replace('lambda','\lambda',$texexp);
|
||||
$texexp = str_replace('mu','\mu',$texexp);
|
||||
$texexp = str_replace('nu','\nu',$texexp);
|
||||
$texexp = str_replace('xi','\xi',$texexp);
|
||||
$texexp = str_replace('rho','\rho',$texexp);
|
||||
$texexp = str_replace('sigma','\sigma',$texexp);
|
||||
$texexp = str_replace('tau','\tau',$texexp);
|
||||
$texexp = str_replace('phi','\phi',$texexp);
|
||||
$texexp = str_replace('chi','\chi',$texexp);
|
||||
$texexp = str_replace('psi','\psi',$texexp);
|
||||
$texexp = str_replace('omega','\omega',$texexp);
|
||||
$texexp = str_replace('zdelta','\delta',$texexp);
|
||||
$texexp = str_replace('bita','\beta',$texexp);
|
||||
$texexp = str_replace('thita','\theta',$texexp);
|
||||
$texexp = str_replace('zita','\zeta',$texexp);
|
||||
$texexp = str_replace('xeta','\eta',$texexp);
|
||||
$texexp = str_replace('zepslon','\epsilon',$texexp);
|
||||
$texexp = str_replace('zupslon','\upsilon',$texexp);
|
||||
$texexp = str_replace('\mbox{logten}','\mbox{log}_{10}',$texexp);
|
||||
$texexp = str_replace('\mbox{acos}','\mbox{cos}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{asin}','\mbox{sin}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{atan}','\mbox{tan}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{asec}','\mbox{sec}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acsc}','\mbox{csc}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acot}','\mbox{cot}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acosh}','\mbox{cosh}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{asinh}','\mbox{sinh}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{atanh}','\mbox{tanh}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{asech}','\mbox{sech}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acsch}','\mbox{csch}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acoth}','\mbox{coth}^{-1}',$texexp);
|
||||
$texexp = preg_replace('/\\\sqrt{(.+?),(.+?)}/s','\sqrt['. "\$2]{\$1}",$texexp);
|
||||
$texexp = preg_replace('/\\\mbox{abs}\\\left\((.+?)\\\right\)/s',"|\$1|",$texexp);
|
||||
$texexp = preg_replace('/\\\log\\\left\((.+?),(.+?)\\\right\)/s','\log_{'. "\$2}\\left(\$1\\right)",$texexp);
|
||||
$texexp = preg_replace('/(\\\cos|\\\sin|\\\tan|\\\sec|\\\csc|\\\cot)([h]*)\\\left\((.+?),(.+?)\\\right\)/s',"\$1\$2^{". "\$4}\\left(\$3\\right)",$texexp);
|
||||
$texexp = preg_replace('/\\\int\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\int_'. "{\$2}^{\$3}\$1 ",$texexp);
|
||||
$texexp = preg_replace('/\\\int\\\left\((.+?d[a-z])\\\right\)/s','\int '. "\$1 ",$texexp);
|
||||
$texexp = preg_replace('/\\\lim\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\lim_'. "{\$2\\to \$3}\$1 ",$texexp);
|
||||
return $texexp;
|
||||
}
|
||||
|
||||
function outputText($texexp) {
|
||||
header("Content-type: text/html");
|
||||
echo "<html><body><pre>\n";
|
||||
if ($texexp) {
|
||||
$texexp = str_replace('<','<',$texexp);
|
||||
$texexp = str_replace('>','>',$texexp);
|
||||
$texexp = str_replace('"','"',$texexp);
|
||||
echo "$texexp\n\n";
|
||||
} else {
|
||||
echo "No text output available\n\n";
|
||||
}
|
||||
echo "</pre></body></html>\n";
|
||||
}
|
||||
|
||||
function tex2image($texexp, $md5) {
|
||||
global $CFG;
|
||||
$error_message1 = "Your system is not configured to run mimeTeX. ";
|
||||
$error_message1 .= "You need to download the appropriate<br> executable ";
|
||||
$error_message1 .= "from <a href=\"http://moodle.org/download/mimetex/\">";
|
||||
$error_message1 .= "http://moodle.org/download/mimetex/</a>, or obtain the ";
|
||||
$error_message1 .= "C source<br> from <a href=\"http://www.forkosh.com/mimetex.zip\">";
|
||||
$error_message1 .= "http://www.forkosh.com/mimetex.zip</a>, compile it and ";
|
||||
$error_message1 .= "put the executable into your<br> moodle/filter/tex/ directory. ";
|
||||
$error_message1 .= "You also need to edit your moodle/filter/algebra/pix.php file<br>";
|
||||
$error_message1 .= ' by adding the line<br><pre> case "' . PHP_OS . "\":\n";
|
||||
$error_message1 .= " \$cmd = \"\\\\\"\$CFG->dirroot/\$CFG->texfilterdir/";
|
||||
$error_message1 .= 'mimetex.' . strtolower(PHP_OS) . "\\\\\" -e \\\\\"\$pathname\\\\\" \". escapeshellarg(\$texexp);";
|
||||
$error_message1 .= "</pre>You also need to add this to your algebradebug.php file.";
|
||||
|
||||
if ($texexp) {
|
||||
$texexp = '\Large ' . $texexp;
|
||||
$lifetime = 86400;
|
||||
$image = $md5 . ".gif";
|
||||
$filetype = 'image/gif';
|
||||
if (!file_exists("$CFG->dataroot/$CFG->algebraimagedir")) {
|
||||
make_upload_directory($CFG->algebraimagedir);
|
||||
}
|
||||
$pathname = "$CFG->dataroot/$CFG->algebraimagedir/$image";
|
||||
if (file_exists($pathname)) {
|
||||
unlink($pathname);
|
||||
}
|
||||
$commandpath = "";
|
||||
$cmd = "";
|
||||
switch (PHP_OS) {
|
||||
case "Linux":
|
||||
$commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex.linux";
|
||||
$cmd = "\"$CFG->dirroot/$CFG->texfilterdir/mimetex.linux\" -e \"$pathname\" ". escapeshellarg($texexp);
|
||||
break;
|
||||
case "WINNT":
|
||||
case "WIN32":
|
||||
case "Windows":
|
||||
$commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex.exe";
|
||||
$texexp = str_replace('"','\"',$texexp);
|
||||
$cmd = str_replace(' ','^ ',$commandpath);
|
||||
$cmd .= " ++ -e \"$pathname\" \"$texexp\"";
|
||||
break;
|
||||
case "Darwin":
|
||||
$commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex.darwin";
|
||||
$cmd = "\"$CFG->dirroot/$CFG->texfilterdir/mimetex.darwin\" -e \"$pathname\" ". escapeshellarg($texexp);
|
||||
break;
|
||||
}
|
||||
if (!$cmd) {
|
||||
error($error_message1);
|
||||
}
|
||||
system($cmd, $status);
|
||||
}
|
||||
if ($texexp && file_exists($pathname)) {
|
||||
$lastmodified = filemtime($pathname);
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
|
||||
header("Cache-control: max_age = $lifetime"); // a day
|
||||
header("Pragma: ");
|
||||
header("Content-disposition: inline; filename=$image");
|
||||
header("Content-length: ".filesize($pathname));
|
||||
header("Content-type: $filetype");
|
||||
readfile("$pathname");
|
||||
} else {
|
||||
$ecmd = "$cmd 2>&1";
|
||||
echo `$ecmd` . "<br>\n";
|
||||
echo "The shell command<br>$cmd<br>returned status = $status<br>\n";
|
||||
if ($status == 4) {
|
||||
echo "Status corresponds to illegal instruction<br>\n";
|
||||
} else if ($status == 11) {
|
||||
echo "Status corresponds to bus error<br>\n";
|
||||
} else if ($status == 22) {
|
||||
echo "Status corresponds to abnormal termination<br>\n";
|
||||
}
|
||||
if (file_exists($commandpath)) {
|
||||
echo "File size of mimetex executable $commandpath is " . filesize($commandpath) . "<br>";
|
||||
echo "The file permissions are: " . decoct(fileperms($commandpath)) . "<br>";
|
||||
if (function_exists("md5_file")) {
|
||||
echo "The md5 checksum of the file is " . md5_file($commandpath) . "<br>";
|
||||
} else {
|
||||
$handle = fopen($commandpath,"rb");
|
||||
$contents = fread($handle,16384);
|
||||
fclose($handle);
|
||||
echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "<br>";
|
||||
}
|
||||
} else {
|
||||
echo "mimetex executable $commandpath not found!<br>";
|
||||
}
|
||||
echo "Image not found!";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head><title>Algebra Filter Debugger</title></head>
|
||||
<body>
|
||||
<p>Please enter an algebraic expression <b>without</b> any surrounding @@ into
|
||||
the text box below. (Click <a href="#help">here for help.</a>)
|
||||
<form action="algebradebug.php" method="get"
|
||||
target="inlineframe">
|
||||
<center>
|
||||
<input type="text" name="algebra" size=50
|
||||
value="sin(z)/(x^2+y^2)">
|
||||
</center>
|
||||
<ol>
|
||||
<li>First click on this button <input type="submit" name="ShowDB" value="Show DB Entry">
|
||||
to see the cache_filters database entry for this expression.</li>
|
||||
<li>If the database entry looks corrupt, click on this button to delete it:
|
||||
<input type="submit" name="DeleteDB" value="Delete DB Entry"></li>
|
||||
<li>Now click on this button <input type="submit" name="TeXStage1" value="First Stage Tex Translation">.
|
||||
A preliminary translation into TeX will appear in the box below.</li>
|
||||
<li>Next click on this button <input type="submit" name="TeXStage2" value="Second Stage Tex Translation">.
|
||||
A more refined translation into TeX will appear in the box below.</li>
|
||||
<li>Finally click on this button <input type="submit" name="ShowImage" value="Show Image">
|
||||
to show a graphic image of the algebraic expression.</li>
|
||||
</ol>
|
||||
</form> <br> <br>
|
||||
<center>
|
||||
<iframe name="inlineframe" align="middle" width="80%" height="200">
|
||||
<p>Something is wrong...</p>
|
||||
</iframe>
|
||||
</center> <br>
|
||||
<hr>
|
||||
<a name="help">
|
||||
<h2>Debugging Help</h2>
|
||||
</a>
|
||||
<p>First here is a brief overview on how the algebra filter works. It
|
||||
takes an algebra expression and first translates it into TeX. It first
|
||||
looks for the TeX translation in the Moodle database in the table cache_filters
|
||||
in the field rawtext. If not found, it passes the algebraic expression to the
|
||||
Perl script algebra2tex.pl, which also uses the Perl library AlgParser.pm.
|
||||
It then saves the TeX translation in the database for subsequent uses and
|
||||
passes the TeX to the mimetex executable to be converted to a gif image.
|
||||
Here are a few common things that can go wrong and some suggestions on how
|
||||
you might try to fix them.</p>
|
||||
<ol>
|
||||
<li>Something had gone wrong on a previous occasion when the filter tried to
|
||||
translate this expression. Then the database entry for that expression contains
|
||||
a bad TeX translation in the rawtext field (usually blank). You can fix this
|
||||
by clicking on "Delete DB Entry"</li>
|
||||
<li>The First Stage TeX Translation gives a "No text output available"
|
||||
message. If your server is running Windows, this may be due to the fact that
|
||||
you haven't installed Perl or didn't install it correctly. If your server is
|
||||
running some version of Unix (e.g. Linux), then this may be due to your Perl
|
||||
binary being installed in a nonstandard location. To fix this edit the first
|
||||
line of the algebra2tex.pl script. Another possible problem which may affect
|
||||
both Unix and Windows servers is that the web server doesn't have execute permission
|
||||
on the algebra2tex.pl script. In that case change permissions accordingly</li>
|
||||
<li>The Second Stage TeX Translation produces malformed TeX. This indicates
|
||||
a bug in the algebra filter. Post the original algebraic expression and the
|
||||
bad TeX translation in the <a href="http://moodle.org/mod/forum/view.php?id=752">
|
||||
Mathematics Tools</a> forum in the Using Moodle course on moodle.org.</li>
|
||||
<li>The TeX to gif image conversion process does not work. If your server is
|
||||
running Unix, a likely cause is that the mimetex binary you are using is
|
||||
incompatible with your operating system. You can try compiling it from the
|
||||
C sources downloaded from <a href="http://www.forkosh.com/mimetex.zip">
|
||||
http://www.forkosh.com/mimetex.zip</a>, or looking for an appropriate
|
||||
binary at <a href="http://moodle.org/download/mimetex/">
|
||||
http://moodle.org/download/mimetex/</a>. You may then also need to
|
||||
edit your moodle/filter/algebra/pix.php file to add
|
||||
<br /><?PHP echo "case "" . PHP_OS . "":" ;?><br ?> to the list of operating systems
|
||||
in the switch (PHP_OS) statement. Windows users may have a problem properly
|
||||
unzipping mimetex.exe. Make sure that mimetex.exe is is <b>PRECISELY</b>
|
||||
328192 bytes in size. If not, download fresh copy from
|
||||
<a href="http://moodle.org/download/mimetex/windows/mimetex.exe">
|
||||
http://moodle.org/download/mimetex/windows/mimetex.exe</a>. Lastly check
|
||||
the execute permissions on your mimetex binary, as outlined in item 2 above.</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,229 @@
|
||||
<?PHP
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Filter for converting simple calculator-type algebraic //
|
||||
// expressions to cached gif images //
|
||||
// //
|
||||
// Copyright (C) 2004 Zbigniew Fiedorowicz fiedorow@math.ohio-state.edu //
|
||||
// Originally based on code provided by Bruno Vernier bruno@vsbeducation.ca//
|
||||
// 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 //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//-------------------------------------------------------------------------
|
||||
// NOTE: This Moodle text filter converts algebraic expressions delimited
|
||||
// by either @@...@@ or by <algebra...>...</algebra> tags
|
||||
// first converts it to TeX using WeBWorK algebra parser Perl library
|
||||
// AlgParser.pm, part of the WeBWorK distribution obtained from
|
||||
// http://webhost.math.rochester.edu/downloadwebwork/
|
||||
// then converts the TeX to gif images using
|
||||
// mimetex.cgi obtained from http://www.forkosh.com/mimetex.html authored by
|
||||
// John Forkosh john@forkosh.com. The mimetex.cgi ELF binary compiled for Linux i386
|
||||
// as well as AlgParser.pm are included with this distribution.
|
||||
// Note that there may be patent restrictions on the production of gif images
|
||||
// in Canada and some parts of Western Europe and Japan until July 2004.
|
||||
//-------------------------------------------------------------------------
|
||||
// You will then need to edit your moodle/config.php to invoke mathml_filter.php
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
|
||||
/// Edit these lines to correspond to your installation
|
||||
// File path to the directory where mathml_filter.php resides
|
||||
$CFG->algebrafilterdir = "filter/algebra";
|
||||
|
||||
|
||||
/// These lines are important - the variable must match the name
|
||||
/// of the actual function below
|
||||
$textfilter_function='algebra_filter';
|
||||
|
||||
if (function_exists($textfilter_function)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function string_file_picture_algebra($imagefile, $tex= "", $height="", $width="") {
|
||||
// Given the path to a picture file in a course, or a URL,
|
||||
// this function includes the picture in the page.
|
||||
global $CFG;
|
||||
|
||||
$output = "";
|
||||
if ($tex) {
|
||||
$tex = str_replace('&','&',$tex);
|
||||
$tex = str_replace('<','<',$tex);
|
||||
$tex = str_replace('>','>',$tex);
|
||||
$tex = str_replace('"','"',$tex);
|
||||
$tex = str_replace("\'",''',$tex);
|
||||
$title = "title=\"$tex\"";
|
||||
}
|
||||
if ($height) {
|
||||
$height = "height=\"$height\"";
|
||||
}
|
||||
if ($width) {
|
||||
$width = "width=\"$width\"";
|
||||
}
|
||||
if ($imagefile) {
|
||||
$output .= "<img border=\"0\" $title $height $width src=\"";
|
||||
if ($CFG->slasharguments) { // Use this method if possible for better caching
|
||||
$output .= "$CFG->wwwroot/$CFG->algebrafilterdir/pix.php/$imagefile";
|
||||
} else {
|
||||
$output .= "$CFG->wwwroot/$CFG->algebrafilterdir/pix.php?file=$imagefile";
|
||||
}
|
||||
$output .= "\" />";
|
||||
} else {
|
||||
$output .= "Error: must pass URL or course";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function algebra_filter ($courseid, $text) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
/// Do a quick check using stripos to avoid unnecessary wor
|
||||
if (!preg_match('/<algebra/i',$text) && !strstr($text,'@@')) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
# //restrict filtering to forum 130 (Maths Tools on moodle.org)
|
||||
# $scriptname = $_SERVER['SCRIPT_NAME'];
|
||||
# if (!strstr($scriptname,'/forum/')) {
|
||||
# return $text;
|
||||
# }
|
||||
# if (strstr($scriptname,'post.php')) {
|
||||
# $parent = forum_get_post_full($_GET['reply']);
|
||||
# $discussion = get_record("forum_discussions","id",$parent->discussion);
|
||||
# } else if (strstr($scriptname,'discuss.php')) {
|
||||
# $discussion = get_record("forum_discussions","id",$_GET['d'] );
|
||||
# } else {
|
||||
# return $text;
|
||||
# }
|
||||
# if ($discussion->forum != 130) {
|
||||
# return $text;
|
||||
# }
|
||||
|
||||
|
||||
$text .= ' ';
|
||||
|
||||
preg_match_all('/@(@@+)([^@])/',$text,$matches);
|
||||
for ($i=0;$i<count($matches[0]);$i++) {
|
||||
$replacement = str_replace('@','@',$matches[1][$i]).$matches[2][$i];
|
||||
$text = str_replace($matches[0][$i],$replacement,$text);
|
||||
}
|
||||
|
||||
if (isadmin()) { error_reporting (E_ALL); }; //for debugging
|
||||
|
||||
// <algebra> some algebraic input expression </algebra>
|
||||
// or @@ some algebraic input expression @@
|
||||
|
||||
preg_match_all('/<algebra>(.+?)<\/algebra>|@@(.+?)@@/is', $text, $matches);
|
||||
for ($i=0; $i<count($matches[0]); $i++) {
|
||||
$algebra = $matches[1][$i] . $matches[2][$i];
|
||||
$algebra = str_replace('<nolink>','',$algebra);
|
||||
$algebra = str_replace('</nolink>','',$algebra);
|
||||
$md5 = md5($algebra);
|
||||
$filename = $md5 . ".gif";
|
||||
if (! $texcache = get_record("cache_filters","filter","algebra", "md5key", $md5)) {
|
||||
$algebra = str_replace('<','<',$algebra);
|
||||
$algebra = str_replace('>','>',$algebra);
|
||||
$algebra = str_replace('<>','#',$algebra);
|
||||
$algebra = str_replace('<=','%',$algebra);
|
||||
$algebra = str_replace('>=','!',$algebra);
|
||||
$algebra = str_replace('delta','zdelta',$algebra);
|
||||
$algebra = str_replace('beta','bita',$algebra);
|
||||
$algebra = str_replace('theta','thita',$algebra);
|
||||
$algebra = str_replace('zeta','zita',$algebra);
|
||||
$algebra = str_replace('eta','xeta',$algebra);
|
||||
$algebra = str_replace('epsilon','zepslon',$algebra);
|
||||
$algebra = str_replace('upsilon','zupslon',$algebra);
|
||||
$algebra = preg_replace('!\r\n?!',' ',$algebra);
|
||||
if ( (PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows") ) {
|
||||
$algebra = "\"". str_replace('"','\"',$algebra) . "\"";
|
||||
$cmd = "cd $CFG->dirroot/$CFG->algebrafilterdir & algebra2tex.pl $algebra";
|
||||
} else {
|
||||
$algebra = escapeshellarg($algebra);
|
||||
$cmd = "cd $CFG->dirroot/$CFG->algebrafilterdir; ./algebra2tex.pl $algebra";
|
||||
}
|
||||
$texexp = `$cmd`;
|
||||
if (preg_match('/parsehilight/',$texexp)) {
|
||||
$text = str_replace( $matches[0][$i],"<b>Syntax error:</b> " . $texexp,$text);
|
||||
} else if ($texexp) {
|
||||
$texexp = str_replace('#','\not= ',$texexp);
|
||||
$texexp = str_replace('%','\leq ',$texexp);
|
||||
$texexp = str_replace('!','\geq ',$texexp);
|
||||
$texexp = str_replace('\left{','{',$texexp);
|
||||
$texexp = str_replace('\right}','}',$texexp);
|
||||
$texexp = str_replace('\fun',' ',$texexp);
|
||||
$texexp = str_replace('infty','\infty',$texexp);
|
||||
$texexp = str_replace('alpha','\alpha',$texexp);
|
||||
$texexp = str_replace('gamma','\gamma',$texexp);
|
||||
$texexp = str_replace('iota','\iota',$texexp);
|
||||
$texexp = str_replace('kappa','\kappa',$texexp);
|
||||
$texexp = str_replace('lambda','\lambda',$texexp);
|
||||
$texexp = str_replace('mu','\mu',$texexp);
|
||||
$texexp = str_replace('nu','\nu',$texexp);
|
||||
$texexp = str_replace('xi','\xi',$texexp);
|
||||
$texexp = str_replace('rho','\rho',$texexp);
|
||||
$texexp = str_replace('sigma','\sigma',$texexp);
|
||||
$texexp = str_replace('tau','\tau',$texexp);
|
||||
$texexp = str_replace('phi','\phi',$texexp);
|
||||
$texexp = str_replace('chi','\chi',$texexp);
|
||||
$texexp = str_replace('psi','\psi',$texexp);
|
||||
$texexp = str_replace('omega','\omega',$texexp);
|
||||
$texexp = str_replace('zdelta','\delta',$texexp);
|
||||
$texexp = str_replace('bita','\beta',$texexp);
|
||||
$texexp = str_replace('thita','\theta',$texexp);
|
||||
$texexp = str_replace('zita','\zeta',$texexp);
|
||||
$texexp = str_replace('xeta','\eta',$texexp);
|
||||
$texexp = str_replace('zepslon','\epsilon',$texexp);
|
||||
$texexp = str_replace('zupslon','\upsilon',$texexp);
|
||||
$texexp = str_replace('\mbox{logten}','\mbox{log}_{10}',$texexp);
|
||||
$texexp = str_replace('\mbox{acos}','\mbox{cos}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{asin}','\mbox{sin}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{atan}','\mbox{tan}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{asec}','\mbox{sec}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acsc}','\mbox{csc}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acot}','\mbox{cot}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acosh}','\mbox{cosh}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{asinh}','\mbox{sinh}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{atanh}','\mbox{tanh}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{asech}','\mbox{sech}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acsch}','\mbox{csch}^{-1}',$texexp);
|
||||
$texexp = str_replace('\mbox{acoth}','\mbox{coth}^{-1}',$texexp);
|
||||
//$texexp = preg_replace('/\\\frac{(.+?)}{\\\left\((.+?)\\\right\)}/s','\frac{'."\$1}{\$2}",$texexp);
|
||||
$texexp = preg_replace('/\\\sqrt{(.+?),(.+?)}/s','\sqrt['. "\$2]{\$1}",$texexp);
|
||||
$texexp = preg_replace('/\\\mbox{abs}\\\left\((.+?)\\\right\)/s',"|\$1|",$texexp);
|
||||
$texexp = preg_replace('/\\\log\\\left\((.+?),(.+?)\\\right\)/s','\log_{'. "\$2}\\left(\$1\\right)",$texexp);
|
||||
$texexp = preg_replace('/(\\\cos|\\\sin|\\\tan|\\\sec|\\\csc|\\\cot)([h]*)\\\left\((.+?),(.+?)\\\right\)/s',"\$1\$2^{". "\$4}\\left(\$3\\right)",$texexp);
|
||||
$texexp = preg_replace('/\\\int\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\int_'. "{\$2}^{\$3}\$1 ",$texexp);
|
||||
$texexp = preg_replace('/\\\int\\\left\((.+?d[a-z])\\\right\)/s','\int '. "\$1 ",$texexp);
|
||||
$texexp = preg_replace('/\\\lim\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\lim_'. "{\$2\\to \$3}\$1 ",$texexp);
|
||||
$texcache->filter = 'algebra';
|
||||
$texcache->version = 1;
|
||||
$texcache->md5key = $md5;
|
||||
$texcache->rawtext = addslashes($texexp);
|
||||
$texcache->timemodified = time();
|
||||
insert_record("cache_filters",$texcache);
|
||||
$text = str_replace( $matches[0][$i], string_file_picture_algebra($filename, $texexp), $text);
|
||||
} else {
|
||||
$text = str_replace( $matches[0][$i],"<b>Undetermined error:</b> ",$text);
|
||||
}
|
||||
} else {
|
||||
$text = str_replace( $matches[0][$i], string_file_picture_algebra($filename, $texcache->rawtext), $text);
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?PHP // $Id$
|
||||
// This function fetches math. images from the data directory
|
||||
// If not, it obtains the corresponding TeX expression from the cache_tex db table
|
||||
// and uses mimeTeX to create the image file
|
||||
|
||||
$nomoodlecookie = true; // Because it interferes with caching
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
$CFG->algebrafilterdir = "filter/algebra";
|
||||
$CFG->texfilterdir = "filter/tex";
|
||||
$CFG->algebraimagedir = "filter/algebra";
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$lifetime = 86400;
|
||||
if (isset($file)) { // workaround for situations where / syntax doesn't work
|
||||
$pathinfo = '/' . $file;
|
||||
} else {
|
||||
$pathinfo = get_slash_arguments("pix.php");
|
||||
}
|
||||
|
||||
if (! $args = parse_slash_arguments($pathinfo)) {
|
||||
error("No valid arguments supplied");
|
||||
}
|
||||
|
||||
$numargs = count($args);
|
||||
|
||||
if ($numargs == 1) {
|
||||
$image = $args[0];
|
||||
$pathname = "$CFG->dataroot/$CFG->algebraimagedir/$image";
|
||||
$filetype = "image/gif";
|
||||
} else {
|
||||
error("No valid arguments supplied");
|
||||
}
|
||||
|
||||
|
||||
if (!file_exists($pathname)) {
|
||||
$md5 = str_replace('.gif','',$image);
|
||||
if ($texcache = get_record("cache_filters", "filter", "algebra", "md5key", $md5)) {
|
||||
if (!file_exists("$CFG->dataroot/$CFG->algebraimagedir")) {
|
||||
make_upload_directory($CFG->algebraimagedir);
|
||||
}
|
||||
|
||||
$texexp = $texcache->rawtext;
|
||||
$texexp = str_replace('<','<',$texexp);
|
||||
$texexp = str_replace('>','>',$texexp);
|
||||
$texexp = preg_replace('!\r\n?!',' ',$texexp);
|
||||
$texexp = '\Large ' . $texexp;
|
||||
|
||||
if ((PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows")) {
|
||||
$texexp = str_replace('"','\"',$texexp);
|
||||
$cmd = "$CFG->dirroot/$CFG->texfilterdir/mimetex.exe";
|
||||
$cmd = str_replace(' ','^ ',$cmd);
|
||||
$cmd .= " ++ -e \"$pathname\" \"$texexp\"";
|
||||
} else if (is_executable("$CFG->dirroot/$CFG->texfilterdir/mimetex")) { /// Use the custom binary
|
||||
|
||||
$cmd = "$CFG->dirroot/$CFG->texfilterdir/mimetex -e $pathname ". escapeshellarg($texexp);
|
||||
|
||||
} else { /// Auto-detect the right TeX binary
|
||||
switch (PHP_OS) {
|
||||
|
||||
case "Linux":
|
||||
$cmd = "\"$CFG->dirroot/$CFG->texfilterdir/mimetex.linux\" -e \"$pathname\" ". escapeshellarg($texexp);
|
||||
break;
|
||||
|
||||
case "Darwin":
|
||||
$cmd = "\"$CFG->dirroot/$CFG->texfilterdir/mimetex.darwin\" -e \"$pathname\" ". escapeshellarg($texexp);
|
||||
break;
|
||||
|
||||
default: /// Nothing was found, so tell them how to fix it.
|
||||
echo "Make sure you have an appropriate MimeTeX binary here:\n\n";
|
||||
echo " $CFG->dirroot/$CFG->texfilterdir/mimetex\n\n";
|
||||
echo "and that it has the right permissions set on it as executable program.\n\n";
|
||||
echo "You can get the latest binaries for your ".PHP_OS." platform from: \n\n";
|
||||
echo " http://moodle.org/download/mimetex/";
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
system($cmd, $status);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($pathname)) {
|
||||
$lastmodified = filemtime($pathname);
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
|
||||
header("Cache-control: max_age = $lifetime"); // a day
|
||||
header("Pragma: ");
|
||||
header("Content-disposition: inline; filename=$image");
|
||||
header("Content-length: ".filesize($pathname));
|
||||
header("Content-type: $filetype");
|
||||
readfile("$pathname");
|
||||
} else {
|
||||
echo "The shell command<br>$cmd<br>returned status = $status<br>\n";
|
||||
echo "Image not found!<br>";
|
||||
echo "Please try the <a href=\"$CFG->wwwroot/filter/algebra/algebradebug.php\">debugging script</a>";
|
||||
}
|
||||
|
||||
exit;
|
||||
?>
|
||||
@@ -0,0 +1,17 @@
|
||||
//////////////////////////
|
||||
// //
|
||||
// Censorship Filter //
|
||||
// //
|
||||
//////////////////////////
|
||||
|
||||
This is a very simple Text Filter that searches text
|
||||
being output to the screen, replacing "bad" words
|
||||
with other words.
|
||||
|
||||
To activate this filter, add a line like this to your
|
||||
config.php:
|
||||
|
||||
$CFG->textfilter1 = 'filter/censor/censor.php';
|
||||
|
||||
|
||||
To customise the word list, edit cursor.php.
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php // $id$
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Censorship filtering
|
||||
//
|
||||
// This very simple example of a Text Filter will parse
|
||||
// printed text, replacing words with other words
|
||||
//
|
||||
// To activate this filter, add a line like this to your
|
||||
// list of filters in your Filter configuration:
|
||||
//
|
||||
// filter/censor/filter.php
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
/// These lines are important - the variable must match the name
|
||||
/// of the actual function below
|
||||
|
||||
$textfilter_function = 'censor_filter';
|
||||
|
||||
if (function_exists($textfilter_function)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/// This is the filtering function itself. It accepts the
|
||||
/// courseid and the text to be filtered (in HTML form).
|
||||
|
||||
function censor_filter($courseid, $text) {
|
||||
|
||||
static $search = array('fuck', 'cunt', 'shit', 'wank', 'cock');
|
||||
static $replace = array('f***', 'c***', 's***', 'w***', 'c***');
|
||||
|
||||
return str_ireplace($search, $replace, $text);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php // $id$
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Media plugin filtering
|
||||
//
|
||||
// This filter will replace any links to a media file with
|
||||
// a media plugin that plays that media inline
|
||||
//
|
||||
// To activate this filter, add a line like this to your
|
||||
// list of filters in your Filter configuration:
|
||||
//
|
||||
// filter/mediaplugin/filter.php
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
/// These lines are important - the variable must match the name
|
||||
/// of the actual function below
|
||||
|
||||
$textfilter_function = 'mediaplugin_filter';
|
||||
|
||||
if (function_exists($textfilter_function)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/// This is the filtering function itself. It accepts the
|
||||
/// courseid and the text to be filtered (in HTML form).
|
||||
|
||||
function mediaplugin_filter($courseid, $text) {
|
||||
global $CFG;
|
||||
|
||||
$search = '/<a(.*?)href=\"(.*?)\.mp3\"([^>]*)>(.*?)<\/a>/i';
|
||||
|
||||
$replace = '\\0 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
|
||||
$replace .= ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
|
||||
$replace .= ' width="35" height="18" id="mp3player" align="">';
|
||||
$replace .= " <param name=movie value=\"$CFG->wwwroot/filter/mediaplugin/mp3player.swf?src=\\2.mp3\">";
|
||||
$replace .= ' <param name=quality value=high>';
|
||||
$replace .= ' <param name=bgcolor value="#333333">';
|
||||
$replace .= " <embed src=\"$CFG->wwwroot/filter/mediaplugin/mp3player.swf?src=\\2.mp3\" ";
|
||||
$replace .= " quality=high bgcolor=\"#333333\" width=\"35\" height=\"18\" name=\"mp3player\" ";
|
||||
$replace .= ' type="application/x-shockwave-flash" ';
|
||||
$replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
|
||||
$replace .= '</embed>';
|
||||
$replace .= '</object> ';
|
||||
|
||||
return preg_replace($search, $replace, $text);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Binary file not shown.
Executable
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user