Compare commits
1238 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cb6d0894c3 | |||
| 6686945ee3 | |||
| 1743d9399b | |||
| 9cd6ebbe55 | |||
| 72f8b520a1 | |||
| 621c41ae2b | |||
| 7e8d9a721a | |||
| ea17a9c8f2 | |||
| 593dc76c1a | |||
| 08a43cac5e | |||
| faf5d6b33d | |||
| c5adf8f923 | |||
| ed0868c364 | |||
| 6f424c1824 | |||
| b5cba5dd13 | |||
| 12d2ff509c | |||
| ea3d671a33 | |||
| c39885e2f7 | |||
| 4635f0ecd8 | |||
| ad1afa2d02 | |||
| e5161d5770 | |||
| 95069438b4 | |||
| 93e9a93cae | |||
| 0530299688 | |||
| 9936a2ecf4 | |||
| 56673355ca | |||
| 4d0348583a | |||
| 49de1ac0b6 | |||
| 055f532221 | |||
| 92cc4862ab | |||
| 6169da991c | |||
| 22cb3c80a0 | |||
| a1cec1a1cc | |||
| e15a93cf8c | |||
| ef1857c333 | |||
| fd8821b455 | |||
| 924df0e6c8 | |||
| 9a33c51dec | |||
| e0799ca496 | |||
| ca8bce95b8 | |||
| 290f9067d0 | |||
| 85fcc67e01 | |||
| 30c9b8eb50 | |||
| ab18857b08 | |||
| 4dd5053fe1 | |||
| 904da0086f | |||
| bb970e231e | |||
| d8b67539cd | |||
| 2664066699 | |||
| 7d7ca8e169 | |||
| 2f33962df9 | |||
| 035699d459 | |||
| fb59fff8d0 | |||
| 898267d8e7 | |||
| 376454ea6b | |||
| e69fb98dbc | |||
| 14420c8aaf | |||
| faaf4b4b4d | |||
| 14054e093c | |||
| ff7f3a8880 | |||
| 233101c5a4 | |||
| 8215f4b97d | |||
| 98efc065d4 | |||
| a973dea1bc | |||
| 51dcac7ccc | |||
| 82fbdcd19c | |||
| e4b44f2b28 | |||
| 6fc7f7dde3 | |||
| 63ebcf17fe | |||
| 726295fb6c | |||
| 30ef17c443 | |||
| 63443e197a | |||
| 1e0d95e9c5 | |||
| c5090097f4 | |||
| c983949fa5 | |||
| 6d8fc58dec | |||
| b54a4b0d76 | |||
| 329aced2bb | |||
| 7c2a1dfa15 | |||
| f4fca14fe6 | |||
| 92e387abbc | |||
| 7bf643ec7e | |||
| 8406cf8ca8 | |||
| 0fb9aeb3a6 | |||
| 5e2f637d4e | |||
| 3330322360 | |||
| dc1e4157ea | |||
| 58c748b355 | |||
| da24670d05 | |||
| 29249d96dc | |||
| 3ac1efe7fc | |||
| 2207d52d32 | |||
| 772b9415e9 | |||
| 35d34756ce | |||
| 75f9079d78 | |||
| 6f147be325 | |||
| d4e98fcfbd | |||
| 7d145624ae | |||
| 9e8f86699e | |||
| 32a73b3b64 | |||
| 6bdd68053a | |||
| 228835fecf | |||
| 0d1060f4bb | |||
| df09bb83a1 | |||
| 9173d81bbc | |||
| 702498fae7 | |||
| 45cdeb0565 | |||
| 0750703375 | |||
| e37e029ff2 | |||
| 1b93204ec8 | |||
| 8d1b8b2ab4 | |||
| 7c09e5d507 | |||
| ca8123897e | |||
| 501cdba3a7 | |||
| c85e70f08c | |||
| 4ca712272c | |||
| 2631a4f3e9 | |||
| 780a3237ac | |||
| 2885b6246c | |||
| e045c25873 | |||
| 9fb9a19634 | |||
| ac45cb6868 | |||
| d6398c1aa7 | |||
| b959c6e367 | |||
| c2a020b29c | |||
| 979078fd7e | |||
| 5cb0b4571b | |||
| 3e91a8c1c6 | |||
| 947398763d | |||
| eb09bdfc8f | |||
| 80f906ef5b | |||
| df5fd088ce | |||
| a7b41a3858 | |||
| 8729b26e66 | |||
| 4c01616d7e | |||
| d7a113ccf6 | |||
| 16cebcc326 | |||
| 01642a7176 | |||
| fb24b67aa0 | |||
| faf39f00fc | |||
| eeb562d148 | |||
| b3c5d55d51 | |||
| e0c4317044 | |||
| 2abc0d001d | |||
| f285be0eaf | |||
| 55954755f4 | |||
| cdeb1274c4 | |||
| d658317313 | |||
| 297c72fd2f | |||
| ef40013c24 | |||
| 9ed313978a | |||
| 2caa535789 | |||
| e38099e42d | |||
| 579ef29363 | |||
| 321cc00de4 | |||
| 66a1817c9c | |||
| 0561809c5d | |||
| 863b73aff3 | |||
| 14439b54d0 | |||
| ecbd19b23a | |||
| bf5ee9d9d6 | |||
| 00e1dce31e | |||
| a7f0a47456 | |||
| 3e4fae4d8d | |||
| 84ca389754 | |||
| 4874505398 | |||
| c1dcb5d292 | |||
| ce4c57764c | |||
| d46a3b303d | |||
| 66ef299f5e | |||
| 603cf45886 | |||
| 81a74ce130 | |||
| bf1e6b85f5 | |||
| 7055e88f97 | |||
| 7d8c97dcc4 | |||
| 2d60f585aa | |||
| 95416b9889 | |||
| 6649c902cd | |||
| 2fd1b1a9a3 | |||
| 1e5575ae9e | |||
| 41f7e89fb6 | |||
| e6da58fb3c | |||
| 81590f6553 | |||
| 30c6a88aee | |||
| cd4a340157 | |||
| 7446f0d0ff | |||
| 478503ba0f | |||
| ec573b8969 | |||
| 886ef74dff | |||
| 860a2858f4 | |||
| 06ecd61c8b | |||
| 88010c44ce | |||
| fc7de9bb75 | |||
| 70484742a9 | |||
| 52b6a471c5 | |||
| e7288e1e7e | |||
| e487fa20dc | |||
| 92bb71dcec | |||
| 21a6060f3d | |||
| 3a5677d49c | |||
| 6494eb8fe0 | |||
| 1b8dbf5466 | |||
| aafb64be36 | |||
| dfd00d9d32 | |||
| 0c76f8bc3a | |||
| e1ecf0a918 | |||
| 4f75c6c949 | |||
| d02317b6da | |||
| 9ba3aacb99 | |||
| fb6099f56d | |||
| 45e83c7913 | |||
| 895ac595b7 | |||
| 34710324e5 | |||
| eed364d080 | |||
| 2422634052 | |||
| 4340e07b2c | |||
| 468eff4e21 | |||
| fc74c5674a | |||
| dc8320a6f8 | |||
| 6b7b9ad10c | |||
| e18bc77b56 | |||
| 8440f947ca | |||
| 11abfe0569 | |||
| ad08d64332 | |||
| f468c0e4c1 | |||
| 1c8e6588aa | |||
| 443fd25436 | |||
| 3c956dbd60 | |||
| bdda301ebf | |||
| fbdc843096 | |||
| 7f3c24f40b | |||
| 5834d7813a | |||
| ca0908b961 | |||
| d40e15ee7a | |||
| 207c5454b9 | |||
| 0875ca82c2 | |||
| a1a85b1779 | |||
| f15a666f64 | |||
| 1b81ef9090 | |||
| 4b0ce9f3b7 | |||
| cca8a446da | |||
| db3568deb4 | |||
| 2240b6c451 | |||
| ebe6a497eb | |||
| b7b280b44c | |||
| 7da25cbffe | |||
| 817a4d47b1 | |||
| 9609d14e81 | |||
| 13b8d2e6eb | |||
| 9228301b3f | |||
| b6630ed3dc | |||
| d0f3b3f6fc | |||
| 42e5c3de66 | |||
| 70efd67049 | |||
| 7e836fe858 | |||
| 328f98af9b | |||
| 5a045ae328 | |||
| a45e386284 | |||
| e5375362ac | |||
| 052547f2e7 | |||
| ff29df4190 | |||
| b02d7ca8fd | |||
| 1a38880ad2 | |||
| 03ccee2431 | |||
| f4f3ac35a5 | |||
| 02bbdb1a05 | |||
| b055ae802b | |||
| e3ce6d9434 | |||
| ae933e4f1f | |||
| 0b920406c8 | |||
| d1620b4c11 | |||
| 3abe79ff52 | |||
| 7614a54d59 | |||
| c617406e19 | |||
| 58d2845b5c | |||
| 2bff64d017 | |||
| 678165c2f5 | |||
| 2b298ce72c | |||
| 9a3bb4366c | |||
| 85ca3686cb | |||
| 84620a0041 | |||
| 95fcbce2a1 | |||
| 40777e9fd0 | |||
| 26c2a9b587 | |||
| 68d87c70d4 | |||
| da837fdb78 | |||
| 162e13cc89 | |||
| 59d4af490e | |||
| 7e555c8958 | |||
| becdc870ed | |||
| ebf2deff6a | |||
| 75407fe763 | |||
| 7c437a57e0 | |||
| a8a80afccd | |||
| 23c58c6375 | |||
| 8d45fcc505 | |||
| 70e1cd76c8 | |||
| 79c57d1b99 | |||
| 70c7e67dcb | |||
| ff073582cf | |||
| 1d3318d93f | |||
| 39ca046247 | |||
| fb0d5a229e | |||
| 0ff0cbe326 | |||
| cdae66cbad | |||
| f639d4fdae | |||
| 85c62f1c93 | |||
| a0f6fa7987 | |||
| 4a1cbc606d | |||
| 5c457d48e9 | |||
| 509f1f07a9 | |||
| 8885b483cb | |||
| 773242671f | |||
| 47cc17f258 | |||
| 6450b75034 | |||
| e4cfa65450 | |||
| 3b798d4e6c | |||
| 6253ee1ef2 | |||
| cda4480961 | |||
| 94fdd21d38 | |||
| 77aafcbbfb | |||
| 137c04383f | |||
| 00a2ce3bf9 | |||
| a789bed6ef | |||
| 897e6a3507 | |||
| a49d9fe97f | |||
| ec5e9fc647 | |||
| 4abc7c0630 | |||
| 528ddea1b3 | |||
| a9608e5795 | |||
| e8b2de8d18 | |||
| abc597e27b | |||
| 296f1fc6c3 | |||
| ccf77fbe00 | |||
| a5db1182c4 | |||
| ce4da52bb8 | |||
| 2f2dafc16a | |||
| e21492da15 | |||
| 34ca70feba | |||
| c83adc965f | |||
| d5c871bbd0 | |||
| 2bbe9bcb1c | |||
| 3e2d9e9567 | |||
| 40beb0f097 | |||
| 1bc05922bc | |||
| fb18d9cab7 | |||
| 4520a06ef1 | |||
| 3514c326aa | |||
| 93bb63f06f | |||
| 8d43fd582f | |||
| 5ce3dfb28e | |||
| e76d70aaef | |||
| 1910bda1d6 | |||
| 8d81931a47 | |||
| f37cb203d8 | |||
| 3f5c88c898 | |||
| a85da4da7e | |||
| 0c412f3b3c | |||
| e0d2d6ec88 | |||
| 9d9a65e9af | |||
| 845df47c11 | |||
| abe9371c58 | |||
| 3e79f5f4f9 | |||
| 8fefbc38ad | |||
| 7c534ccd8a | |||
| d8c68f7860 | |||
| 2dbe84a629 | |||
| 9a94ae5494 | |||
| 3af6627e64 | |||
| 8d9e5477a4 | |||
| 0e3dd76c50 | |||
| 0820aedbf7 | |||
| ce26bd19ea | |||
| 691d35efc2 | |||
| a0a1aeb694 | |||
| cb1113b7c8 | |||
| d36088f711 | |||
| 40cc3341ad | |||
| d7414e9068 | |||
| f5563d1efd | |||
| 67e9830697 | |||
| d01b47381b | |||
| c6a10296eb | |||
| 3674039ca0 | |||
| f0417bf3cb | |||
| 13e60ec63c | |||
| 07cd3ecabd | |||
| 1d68f3cd73 | |||
| 23290eea4d | |||
| f050e82eb6 | |||
| 8aa669ca72 | |||
| 8abba9e902 | |||
| 023dc2c338 | |||
| 11db0ce1ec | |||
| c9379ddbaa | |||
| 2bd2bb878d | |||
| fe8aad143d | |||
| cae4cdb309 | |||
| 8809ff2b35 | |||
| 6bea13a914 | |||
| 0e04dc36c2 | |||
| 68d924ce8a | |||
| bf5cc256fd | |||
| 247958fbe9 | |||
| bf4fe92223 | |||
| 9bcbf6a743 | |||
| 7c84c844f9 | |||
| 676dbd7285 | |||
| 81ac2c8630 | |||
| 55f9f1432f | |||
| 9f476e5fe2 | |||
| 4663bd9f09 | |||
| bde6d304f9 | |||
| 764d44c11e | |||
| c2c3f6e885 | |||
| 22f8303fc7 | |||
| b0cfc7cbd5 | |||
| 118a639ff3 | |||
| f4989ae561 | |||
| 4ff82c1505 | |||
| e2a7235da8 | |||
| 062c59e346 | |||
| 3cc55cab9e | |||
| 3742f86ac1 | |||
| 9a28eacb84 | |||
| 446b5e025c | |||
| 5c89371717 | |||
| 2b27d0a946 | |||
| 15ef45da52 | |||
| 3444317011 | |||
| e17d507d5a | |||
| 7db37fd580 | |||
| 6497764c84 | |||
| 37829534f6 | |||
| 554fbddf7d | |||
| 529d7f47bf | |||
| 45b3a8554a | |||
| 8f3d4e4ef5 | |||
| a067240cbf | |||
| ef2f763ee8 | |||
| 56d3da5a01 | |||
| 1aa8ff170f | |||
| 8ec088f738 | |||
| e7c13fcb46 | |||
| 343a1ea8e0 | |||
| 216237369e | |||
| 10fc5f6e22 | |||
| 462f360429 | |||
| c0ea84fbf3 | |||
| 3a6b6c0d74 | |||
| 64aa333345 | |||
| ea41587638 | |||
| fbadfe0295 | |||
| 4b1edf80c1 | |||
| 1286c71e5a | |||
| 62eefc5487 | |||
| aafc01514e | |||
| 671b83e238 | |||
| 0197c39ba1 | |||
| 40168efe75 | |||
| dfa4162d8a | |||
| 0c05267ff4 | |||
| 992c135e19 | |||
| b3c7ea0c94 | |||
| 1e281f706a | |||
| 9ae0b39497 | |||
| 137fcd2015 | |||
| 7ccfee94ad | |||
| 5e7ee078a9 | |||
| 28dcf434c6 | |||
| 0042320984 | |||
| 8da1406e3a | |||
| 0ef8d9cab6 | |||
| d55f1be549 | |||
| d4097a429c | |||
| 9b4327c71d | |||
| 097eb89c65 | |||
| 8c21e87a7b | |||
| 253f9eee33 | |||
| bb803227f1 | |||
| f0d60d1631 | |||
| 99c4cc6fdf | |||
| 58e24e2f1a | |||
| bca26abf4c | |||
| 9241a50fb7 | |||
| 6d1bb31cda | |||
| 661406a466 | |||
| cd57295a36 | |||
| 6acef6e30b | |||
| 1610eb0f85 | |||
| 6cf7303684 | |||
| 4ed23b4f9e | |||
| fabdbdb3f6 | |||
| 43e2896e63 | |||
| 025451ff7d | |||
| cafaa207ef | |||
| e59461215d | |||
| 0ebee25007 | |||
| ce197abbef | |||
| 9036033b8a | |||
| 81bf069328 | |||
| 9ff8ae7953 | |||
| 4527713fdc | |||
| ae4dc90cb7 | |||
| 7ab78c274b | |||
| 20f08456a8 | |||
| 94bbc1f5e2 | |||
| 4610edf1b6 | |||
| 847da17ddb | |||
| f3fa18a199 | |||
| 8b85c2cf5d | |||
| c309cf8612 | |||
| 2685a2eee1 | |||
| 416622f005 | |||
| 8f95983a3e | |||
| 0a16e0f268 | |||
| 37646f6f0e | |||
| aa7b876f03 | |||
| 16f89f2ccf | |||
| 524e369670 | |||
| c72ab7a328 | |||
| c74677ca95 | |||
| 0f8c983585 | |||
| 59a6d971a4 | |||
| 45e948f87e | |||
| c0226d096a | |||
| aaf3348589 | |||
| 158c4b5c80 | |||
| a3eba6f2d2 | |||
| 8d7e790de7 | |||
| ed289f97e5 | |||
| 5d7ce9bf29 | |||
| fbb5ad35e7 | |||
| 9e2df8519a | |||
| e4cc5dbc7f | |||
| 34e92f9b8b | |||
| 6e2284138b | |||
| 73a4864b82 | |||
| 1a6a597fff | |||
| 9df49de633 | |||
| 404d380856 | |||
| cbc0bc50b1 | |||
| ae767e7bd3 | |||
| 2ccbd6ccf1 | |||
| 8dbf6bb9e0 | |||
| 652fab8576 | |||
| 31942aff61 | |||
| 5006792896 | |||
| 786542c572 | |||
| edaaa46655 | |||
| c0bea40aaf | |||
| 7dd535056e | |||
| 555bfa16d0 | |||
| 470be2688b | |||
| 135d93ec9e | |||
| 75943600ed | |||
| 7fd3f594da | |||
| 55904e49dc | |||
| 4c5da8022e | |||
| 2f47a361ff | |||
| 9197627ade | |||
| 4b168cfabc | |||
| ffa6c35826 | |||
| b0e924a51e | |||
| 58a9623c54 | |||
| 1bde9b823c | |||
| 76eea68b9e | |||
| 8c0a6839f2 | |||
| a1f951f3a4 | |||
| 72449953e4 | |||
| f359daab58 | |||
| b33888d124 | |||
| 1a5e85a22c | |||
| 0dd1becdc7 | |||
| 61e35a87da | |||
| 0c34a17b09 | |||
| 52f24bfec6 | |||
| b2787982b7 | |||
| 8f4c3dae23 | |||
| a8c2fc5dee | |||
| a3b2f4cbeb | |||
| 1e066cbf29 | |||
| 79dd326093 | |||
| 1f775e8c46 | |||
| 7b6c65a560 | |||
| c935b991a1 | |||
| 28ca56c93d | |||
| ec3200262d | |||
| 8539018ed4 | |||
| 245de1a597 | |||
| 3fdd49a75a | |||
| 3ff6c931ee | |||
| c7da0d864e | |||
| e97c7b28c5 | |||
| 2ffbe91234 | |||
| 4f3835b601 | |||
| 445a3c1233 | |||
| 4989bc7951 | |||
| 8eb102ff1c | |||
| 9b6cf38c96 | |||
| 203743c638 | |||
| c691deff3a | |||
| bf01ed8211 | |||
| 93cc66aeae | |||
| f103bb199e | |||
| 476f7cc8ee | |||
| e9a1bffc8f | |||
| 377d7c7515 | |||
| 7bc643ebaf | |||
| 184f9c2b66 | |||
| 93fa4ca922 | |||
| 552de335d0 | |||
| 9e6e743dfc | |||
| f9bbb1031e | |||
| 290b74fd49 | |||
| 7122026066 | |||
| 70cade16e3 | |||
| 9146dd83de | |||
| 9e162a23da | |||
| 3df033ca4a | |||
| 5241345d02 | |||
| 62cf504bdd | |||
| cf47a79c1d | |||
| 12e91437f3 | |||
| a065fdd6f9 | |||
| e0ddea8b8f | |||
| d7df238204 | |||
| db2105c889 | |||
| 367dfbd905 | |||
| b17e52001c | |||
| 153fd875b5 | |||
| a43dc9df02 | |||
| f9f150290f | |||
| 8779cb8b46 | |||
| d7378d19ec | |||
| 6219022575 | |||
| d9ec40f57f | |||
| ea790c7db1 | |||
| f0403cbba2 | |||
| 88b5f9b726 | |||
| 4d0ec2a375 | |||
| 7cb4fb6a88 | |||
| 504317a519 | |||
| 110351a2a6 | |||
| 9599ee24b9 | |||
| 78baa1aaad | |||
| 1f4025a70e | |||
| 7e147392e1 | |||
| b7f0d27621 | |||
| 0428d11d76 | |||
| b5a5a482bd | |||
| 699768ebbc | |||
| 6bd9066b7f | |||
| 6af4e1c8c4 | |||
| a5c41b6a5a | |||
| 0bffc5576e | |||
| 21982b71a6 | |||
| 41a5c34f91 | |||
| d08b6757e6 | |||
| dfeb385672 | |||
| b36064f742 | |||
| 3dfb5e4379 | |||
| 7f9f7ec944 | |||
| 1828849b1e | |||
| ff7253c2c1 | |||
| 52257f15d7 | |||
| 4c1af19cf6 | |||
| 48a2b5ad42 | |||
| 9e8cabd7eb | |||
| e28cc09b24 | |||
| 6282be2fd9 | |||
| e6b8565063 | |||
| bce83e8c76 | |||
| e2bf5eec99 | |||
| 87ab475575 | |||
| 9022696d6d | |||
| 418cc2032b | |||
| 25769ccd61 | |||
| d0e6183436 | |||
| ca3c1ddf40 | |||
| ec9f7c117e | |||
| 7f0984c1f3 | |||
| dc8207c52a | |||
| 4419fe33a5 | |||
| ba0dabcc31 | |||
| 3810ca294d | |||
| f493763e04 | |||
| 3140dc600d | |||
| 30739f6651 | |||
| 071d36c917 | |||
| 0540d3479c | |||
| 721a2de984 | |||
| 78d68eb5b2 | |||
| 5c5cb3ec7e | |||
| b06855297c | |||
| dbd0f586a2 | |||
| eb2a36fb55 | |||
| a45296043e | |||
| 4bf57cbfa6 | |||
| 43d78a231d | |||
| 45d44e7e80 | |||
| ff6bc9fbc2 | |||
| 4bdf76ae71 | |||
| 97feab527e | |||
| 903f3f54ed | |||
| a1fec0e3ce | |||
| e07f4ac436 | |||
| 25a37d70ff | |||
| 5446beaa73 | |||
| cb6281b339 | |||
| 3696a3723e | |||
| 8fa821d514 | |||
| 9bb4b97e3d | |||
| 87c39bf549 | |||
| 91f54796bd | |||
| fd52f257ff | |||
| 94c9630d78 | |||
| 84718c0056 | |||
| 0a16d1722a | |||
| abb8f34ecf | |||
| 8af16cbfdb | |||
| 54c5ce36db | |||
| 0b17d072cf | |||
| cd4469af52 | |||
| 01d0a4f289 | |||
| 8f8f6e7c92 | |||
| 90fe299739 | |||
| bceb6eb9d8 | |||
| 7989f2ee28 | |||
| 78a0f36730 | |||
| b2a48214f8 | |||
| 76d9513015 | |||
| 4d89cba698 | |||
| e8189c3074 | |||
| af17ae8a1b | |||
| 8626d4bc24 | |||
| f0b99a9fec | |||
| fcb9e23701 | |||
| ab496d313c | |||
| 0e53408ad7 | |||
| 4b1f48e2ae | |||
| 5530732c16 | |||
| 5b4e26864a | |||
| 1081ccc99b | |||
| c0ad0e5a98 | |||
| b6db8ab49d | |||
| ce455a9a79 | |||
| b6d3fccd59 | |||
| 78be3cdb8b | |||
| 837588a772 | |||
| f398c77963 | |||
| 2fd2fdbdb9 | |||
| 92d3d576fb | |||
| ef06f7f85b | |||
| e7a5ad8da9 | |||
| d8882ec822 | |||
| e21f0b1042 | |||
| b6057d4afa | |||
| bf18b2aa09 | |||
| db365a121d | |||
| d243cd17c5 | |||
| 01be5c29cc | |||
| 1ac2df9163 | |||
| 800fa68224 | |||
| 4876f94726 | |||
| c5c47d0c43 | |||
| 731f877fdb | |||
| acb417721d | |||
| 60f8f5bf42 | |||
| df18c3141e | |||
| 4edc434002 | |||
| 3ce66e9f7b | |||
| fb3501f935 | |||
| 757d66b504 | |||
| 9861a3997a | |||
| e05e5d132e | |||
| 6488b3be2e | |||
| 748e20f006 | |||
| da0dcaef1b | |||
| 9babd808f8 | |||
| 57c07037a7 | |||
| 2eb862ba18 | |||
| e5c482b517 | |||
| 61c7621b80 | |||
| 595687a2f1 | |||
| 6e2e65e499 | |||
| 997a36bb09 | |||
| 8b03cdac79 | |||
| 6b0bfc914c | |||
| 9f5ceda372 | |||
| d550a1409b | |||
| e56a129d56 | |||
| 9a8d870765 | |||
| be724f381e | |||
| c6a0fc48df | |||
| 61e6471fce | |||
| 3ad11e88b2 | |||
| 156f63c804 | |||
| ca9de648a8 | |||
| 66d6716a02 | |||
| 19906f7074 | |||
| b8dececceb | |||
| 068be51fa0 | |||
| 85a430d5be | |||
| 3b00cdbff0 | |||
| 9e0bad4909 | |||
| b430f84c4c | |||
| 014161956c | |||
| 5f842b21bd | |||
| ca3a97b8c1 | |||
| 5b6af116c1 | |||
| a9fd5db642 | |||
| 2f26b36af3 | |||
| c2fe49c5e7 | |||
| 7df5ccc871 | |||
| cf507be4c0 | |||
| 9e8bc0e590 | |||
| b50965414e | |||
| f2592eb65e | |||
| e9d837a1a2 | |||
| a650e7bb3a | |||
| 974dde3777 | |||
| 0ba544e97d | |||
| 72395f4d2a | |||
| 74780decb8 | |||
| f167056a18 | |||
| 375016e822 | |||
| ec6c6dae3f | |||
| 463b6cbe64 | |||
| 08f4e03f53 | |||
| 593d5992c0 | |||
| 671a35735b | |||
| c7bbf43c12 | |||
| 8dd4116941 | |||
| 821a2a750b | |||
| 4351ce8a6b | |||
| d97feb678a | |||
| 1f49b80193 | |||
| 2edb2fbaf1 | |||
| 7aa8c1329f | |||
| 04f64ffbe0 | |||
| bdc1bb3358 | |||
| 8e42353e0e | |||
| 1ab3830750 | |||
| 45ce915b79 | |||
| 2a28db59c3 | |||
| f18d2309fb | |||
| bc516d11c1 | |||
| 75ee3dfa69 | |||
| 7dac46e80c | |||
| 23cbd7e82b | |||
| e2612a5522 | |||
| 41fd2c3924 | |||
| 7020a2ac33 | |||
| cf3f87a641 | |||
| 2500eb7ead | |||
| 0115262560 | |||
| 7c944b7cbe | |||
| e264752381 | |||
| 075f61025c | |||
| 085fecaf86 | |||
| 970d2432d7 | |||
| 0d8057b119 | |||
| 2786c8fd73 | |||
| e1555199db | |||
| 6defede491 | |||
| 47e1151f92 | |||
| e8dc4c6cb1 | |||
| db8598ca48 | |||
| b0252a5c00 | |||
| 47cc07674c | |||
| 29f26fd747 | |||
| 9c336062b7 | |||
| 594f4f574a | |||
| 3802128b59 | |||
| 657ed64b03 | |||
| b39a349ec4 | |||
| 8c30f7fc26 | |||
| 81de99d733 | |||
| 7235680eed | |||
| ce5a0d7b65 | |||
| 89719f7030 | |||
| 1d03d41680 | |||
| de161d3c49 | |||
| 509b0c983d | |||
| 877d109b01 | |||
| dc5ea21614 | |||
| 4a08d3bac9 | |||
| f555bfac15 | |||
| 5fb8a656c1 | |||
| bfc8a717df | |||
| b65b99cab8 | |||
| 296f9b6a82 | |||
| 7409a0e99a | |||
| f08318d7fb | |||
| 890cdce488 | |||
| 5a739340da | |||
| 751ad21e9c | |||
| a9a72d76f9 | |||
| 31e0c05036 | |||
| 2a0d5695b3 | |||
| cf9281719f | |||
| 8cde300d8c | |||
| 50d1bd1c2a | |||
| 58cac329b7 | |||
| 011dd960f4 | |||
| 0389288693 | |||
| e5b094bed6 | |||
| 4a0d23143a | |||
| bdd5bba791 | |||
| 1159927f08 | |||
| b9a69f5b1f | |||
| 947e63afb8 | |||
| d221dc7482 | |||
| 14da408e08 | |||
| 4ca9e54f7f | |||
| 154877b2ff | |||
| 303c064224 | |||
| e521d0f799 | |||
| 4d4b237efb | |||
| 727929f1fa | |||
| 26e8b7a96e | |||
| 4d59b9d9fa | |||
| 7c018f428c | |||
| 3c3ff8ace3 | |||
| 70c6b92b97 | |||
| b27229da41 | |||
| 0801278026 | |||
| d9bda8a421 | |||
| 42f8e247d2 | |||
| ed3ee5e357 | |||
| 8b4a8f616f | |||
| f470cf47b7 | |||
| e43202e7a3 | |||
| e70d37080c | |||
| 98d6d9288b | |||
| 1c2ecdd3dd | |||
| 1d94add47e | |||
| dd1ac4af5c | |||
| 9982cf19c9 | |||
| 7d72568ba9 | |||
| 2ad6c7b8fe | |||
| c73628d1dc | |||
| d976a7d9dc | |||
| 2683c51739 | |||
| 7262b0c5a9 | |||
| 26be3a96c4 | |||
| 33ca51fbdf | |||
| 642a7105e5 | |||
| 4233e8b7b6 | |||
| f7352c8340 | |||
| 90b7248055 | |||
| 3c13c14e59 | |||
| 0cf15fb3e6 | |||
| c966aa2c71 | |||
| d367b64be3 | |||
| 862dd9d01a | |||
| 675c2419d1 | |||
| 3453faf411 | |||
| 9fcb7001e6 | |||
| 6a9c63b3c4 | |||
| f248698fed | |||
| 5510929c42 | |||
| 8cbaea4f7a | |||
| bb52c312de | |||
| 152fa94009 | |||
| a59462f1a4 | |||
| 8f08bf55d9 | |||
| 85c23c24f6 | |||
| 174e5dfc05 | |||
| 3ed3433efd | |||
| 6cb344928f | |||
| 2c56bea007 | |||
| 6ac70d87d4 | |||
| e58d9e9f8e | |||
| 80f91aad31 | |||
| fa1df4db7b | |||
| ce499284a0 | |||
| 5359b97581 | |||
| f3f60456ff | |||
| e0e1d29889 | |||
| 42ce3dfc9f | |||
| 71338fc369 | |||
| 7aae797ec1 | |||
| c5749e312f | |||
| 17f32ca725 | |||
| 7648eae997 | |||
| 62a29aa8e0 | |||
| 93727c9b8e | |||
| b2681766d7 | |||
| afd38cb133 | |||
| d3fcae7237 | |||
| 6b66913982 | |||
| 68875532e6 | |||
| 519c36a6fb | |||
| 93f30556b3 | |||
| b3f180f91b | |||
| ac76e8c5bf | |||
| 3c4e7ea962 | |||
| 3d83f4255a | |||
| 21e5dd9414 | |||
| 9b6b1f3afa | |||
| 148c0decf6 | |||
| 0df7a3d616 | |||
| 46385c64bd | |||
| 91b890f705 | |||
| 683b038d09 | |||
| a04aa7c7df | |||
| 8e2958d1a1 | |||
| 39d860b52d | |||
| 7c37e6755c | |||
| d21dbfd55d | |||
| 723a084744 | |||
| 1ace15420e | |||
| 1df5e775ff | |||
| b547c1396f | |||
| ffbbe44116 | |||
| 7a7056e0bb | |||
| ab505564c9 | |||
| 527bd0664c | |||
| 6285e5af65 | |||
| 792f362b93 | |||
| db69332665 | |||
| 94a7bfecb0 | |||
| 8665733354 | |||
| a6abb7fda7 | |||
| 380199a948 | |||
| 2da1b09809 | |||
| a75dde8a5c | |||
| 3c98b96d40 | |||
| 3bd8388689 | |||
| 5ceee287f3 | |||
| 319e0b4d9a | |||
| 84bed3d71b | |||
| 381b712d96 | |||
| 87c9582273 | |||
| ae9910b3aa | |||
| 91607e97ed | |||
| 71c7eb7260 | |||
| 5b6037f3ac | |||
| d2ae521e17 | |||
| 11f0eb9979 | |||
| 4e1af8f1b3 | |||
| a68c438d5c | |||
| 9a7b7e38b9 | |||
| 43e57712eb | |||
| 55ebb7277b | |||
| 0ca2898178 | |||
| d1910944e2 | |||
| 257343b354 | |||
| 7989c3edc6 | |||
| accaf2e9f6 | |||
| 15f93e462f | |||
| d628dcedd2 | |||
| 8b42d3bbb7 | |||
| c92a464165 | |||
| 08410ed897 | |||
| aea1aa849b | |||
| fe2f0270d3 | |||
| bd6cea2f98 | |||
| b13b2b54a6 | |||
| 5a16abc079 | |||
| 0dd1864b73 | |||
| c23b03b50c | |||
| c5c150c146 | |||
| a555df3d69 | |||
| 87b270ef6a | |||
| 3f8f8601e2 | |||
| ad0957be6d | |||
| 5bdb86e23b | |||
| cb55f92d17 | |||
| 9c3d643dad | |||
| af053ebd3e | |||
| f241382c56 | |||
| 055d04ad68 | |||
| 02cac21426 | |||
| ee031ca12d | |||
| 2332c5b8da | |||
| a2842bc86c | |||
| 8d0db8766b | |||
| 746be7faee | |||
| 3b117ede45 | |||
| af5f09db42 | |||
| 48988ba271 | |||
| 1060c5998e | |||
| 9f5d13105d | |||
| 777816e6c7 | |||
| 0e0fd96278 | |||
| 5aa3fe9c10 | |||
| 882a1343ab | |||
| cb48f665eb | |||
| 0a786db090 | |||
| e9dec637ff | |||
| 954e74f2dd | |||
| dc3906acce | |||
| 4fc9ea71f9 | |||
| abe58b4a43 | |||
| 662231384d | |||
| c76465c42b | |||
| e2a73d8a93 | |||
| 7764cd6cc7 | |||
| 0a870ce21a | |||
| 55be7faa95 | |||
| 60afff1419 | |||
| 1c8d340d1b | |||
| 31d3c58089 | |||
| 4a900a1e3b | |||
| 2564d898d3 | |||
| cea03e39c7 | |||
| e38e49335c | |||
| 8d137d3be6 | |||
| 766b1926ed | |||
| 842721d87f | |||
| 247147c8dd | |||
| 75108f21ad | |||
| 9fa06fc780 | |||
| ed90d891a1 | |||
| d8f6207bee | |||
| 381fd47442 | |||
| f868caa529 | |||
| 4378a0456e | |||
| f829d4a446 | |||
| b49d086945 | |||
| 0aa07c2fa0 | |||
| 4d15a1932a | |||
| c2540e76e1 | |||
| c3c4013f08 | |||
| 210deee299 | |||
| 9c71a2396b | |||
| 6ba16921db | |||
| 245505f928 | |||
| d086c991ee | |||
| c8c625a0be | |||
| a71dd3f315 | |||
| a40fe0a766 | |||
| b2a39ba822 | |||
| 845c5d725b | |||
| ac12e36125 | |||
| 08a7bbc9ff | |||
| 52b0b2684c | |||
| 7c96968699 | |||
| c629a2ef7f | |||
| d500edf243 | |||
| b666f6f3aa | |||
| f66e4015b8 | |||
| a84533fee3 | |||
| b49beecf63 | |||
| 74b111bc7f | |||
| a8c5a14b7c | |||
| f9ad31d809 | |||
| db26bf99f5 | |||
| e4857c41fb | |||
| 37d9720b15 | |||
| 24e6ae8cc6 | |||
| e31d492145 | |||
| e5708be88c | |||
| c34713bfca | |||
| 364f72aa05 | |||
| 4e5d63c403 | |||
| 79bad718b6 | |||
| 01ed826fff | |||
| d842884534 | |||
| b51bfdd111 | |||
| db47e0ffbb | |||
| ceab443d08 | |||
| 5675d86412 | |||
| ad0d007abd | |||
| 69e5d0ef95 | |||
| f32f831749 | |||
| cdd0bfcc1a | |||
| 6153b68ff9 | |||
| 716f1ef9f1 | |||
| 101fb762f1 | |||
| 368cc39e7e | |||
| 806b78fd12 | |||
| 6c619b41c8 | |||
| f02f53f09b | |||
| c4acc71042 | |||
| a5fe571a1c | |||
| 9fa998f63b | |||
| 4b6776536a | |||
| b7a99c865f | |||
| 059c9be198 | |||
| f132783767 | |||
| 26ee0fa9cd | |||
| d3c653c13f | |||
| 1f6823d18f | |||
| 4d833069bd | |||
| 03b17f7a0d | |||
| 5b549b306d | |||
| 6c9ac19b6f | |||
| 83523cccd6 | |||
| 4846e7e856 | |||
| ad9c1a9966 | |||
| 67c80485b9 | |||
| b764301306 | |||
| 993c547bd6 | |||
| 558bfc50fe | |||
| dc13c4f8a3 | |||
| d485515725 | |||
| f8a7befdd5 | |||
| ad5cbccfd3 | |||
| f07794ae81 | |||
| 9930ae9e6b | |||
| 6bcb0ad140 | |||
| 78066f113a | |||
| e2e91ea8ce | |||
| 3b0b90d5c1 | |||
| ad890b4490 | |||
| ea369699c4 | |||
| 87db2759da | |||
| 6bd4ab8c5e | |||
| c887b2c522 | |||
| 02f54468a8 | |||
| d9316decdd | |||
| 39cc4b9f1a | |||
| 9cd9700ad6 | |||
| 6c9ceb3c2e | |||
| d52eafd9ae | |||
| 14f409f698 | |||
| 762b68827e | |||
| c4257b0ff9 | |||
| 76e4168089 | |||
| a58e869ce2 | |||
| 8798f3049f | |||
| 0d163e9ece | |||
| cb7e142c73 | |||
| 17e05203ff | |||
| 92ac252418 | |||
| c9dc31afe8 | |||
| 493dd6c934 | |||
| a2adf92023 | |||
| 005072a3ef | |||
| 8bed6c33cd | |||
| 0ac7fcd7da | |||
| 8aec60b652 | |||
| d4f4fa2abe | |||
| 7620c403ec |
+339
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,185 +0,0 @@
|
||||
<?php // $Id$
|
||||
// config.php - allows admin to edit all configuration variables
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$focus = '';
|
||||
|
||||
if ($site = get_site()) { // If false then this is a new installation
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
}
|
||||
|
||||
/// This is to overcome the "insecure forms paradox"
|
||||
if (isset($secureforms) and $secureforms == 0) {
|
||||
$match = 'nomatch';
|
||||
} else {
|
||||
$match = '';
|
||||
}
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($config = data_submitted($match)) {
|
||||
|
||||
if (!empty($USER->id)) { // Additional identity check
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
}
|
||||
|
||||
validate_form($config, $err);
|
||||
|
||||
if (count($err) == 0) {
|
||||
foreach ($config as $name => $value) {
|
||||
if ($name == "sessioncookie") {
|
||||
$value = eregi_replace("[^a-zA-Z0-9_]", "", $value);
|
||||
}
|
||||
if ($name == "defaultallowedmodules") {
|
||||
$value = implode(',',$value);
|
||||
}
|
||||
if ($name == 'hiddenuserfields') {
|
||||
if (in_array('none', $value)) {
|
||||
$value = '';
|
||||
} else {
|
||||
$value = implode(',',$value);
|
||||
}
|
||||
}
|
||||
if ($name == "locale") {
|
||||
$value = trim($value);
|
||||
}
|
||||
$conf = new object();
|
||||
$conf->name = $name;
|
||||
$conf->value = $value;
|
||||
if ($current = get_record('config', 'name', $name)) {
|
||||
$conf->id = $current->id;
|
||||
if (! update_record('config', $conf)) {
|
||||
error("Error: Could not update $name to $value");
|
||||
}
|
||||
} else {
|
||||
if (! insert_record('config', $conf)) {
|
||||
error("Error: could not add new variable $name !");
|
||||
}
|
||||
}
|
||||
}
|
||||
redirect('index.php');
|
||||
exit;
|
||||
|
||||
} else {
|
||||
foreach ($err as $key => $value) {
|
||||
$focus = "form.$key";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Otherwise fill and print the form.
|
||||
|
||||
if (empty($config)) {
|
||||
$config = $CFG;
|
||||
}
|
||||
|
||||
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
|
||||
|
||||
|
||||
$stradmin = get_string('administration');
|
||||
$strconfiguration = get_string('configuration');
|
||||
$strconfigvariables = get_string('configvariables', 'admin');
|
||||
|
||||
if ($site) {
|
||||
print_header("$site->shortname: $strconfigvariables", $site->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $strconfigvariables", $focus);
|
||||
print_heading($strconfigvariables);
|
||||
} else {
|
||||
print_header();
|
||||
print_heading($strconfigvariables);
|
||||
print_simple_box(get_string('configintro', 'admin'), 'center', "50%");
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Get all the configuration fields and helptext
|
||||
require('configvars.php');
|
||||
|
||||
/// Cycle through the sections to get the sectionnames
|
||||
$linktext = '';
|
||||
foreach($configvars as $sectionname=>$section) {
|
||||
if ($linktext !== '') {
|
||||
$linktext .= ' | ';
|
||||
}
|
||||
$linktext .= '<a href="#configsection'.$sectionname.'">'.get_string('configsection'.$sectionname, 'admin').'</a>';
|
||||
}
|
||||
|
||||
echo "<center>$linktext</center>\n";
|
||||
|
||||
|
||||
echo '<form method="post" action="config.php" name="form">';
|
||||
echo '<center><input type="submit" value="'.get_string('savechanges').'" /></center>';
|
||||
|
||||
/// Cycle through each section of the configuration
|
||||
foreach ($configvars as $sectionname=>$section) {
|
||||
|
||||
print_heading('<a name="configsection'.$sectionname.'"></a>'.get_string('configsection'.$sectionname, 'admin'));
|
||||
|
||||
$table = NULL;
|
||||
$table->data = array();
|
||||
foreach ($section as $configvariable=>$configobject) {
|
||||
$table->data[] = array ( $configvariable.': ',
|
||||
$configobject->field
|
||||
);
|
||||
if ($configobject->display_warning()) {
|
||||
$table->data[] = array ( ' ',
|
||||
'<span class="configwarning">'.$configobject->warning.'</span>'
|
||||
);
|
||||
}
|
||||
$table->data[] = array ( ' ',
|
||||
'<span class="confighelp">'.$configobject->help.'</span>'
|
||||
);
|
||||
$table->align = array ('right', 'left');
|
||||
}
|
||||
print_table($table);
|
||||
|
||||
}
|
||||
echo '<center>';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$sesskey.'" />';
|
||||
echo '<input type="submit" value="'.get_string('savechanges').'" />';
|
||||
echo '</center>';
|
||||
|
||||
echo '</form>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// Lock some options
|
||||
|
||||
$httpsurl = str_replace('http://', 'https://', $CFG->wwwroot);
|
||||
if ($httpsurl != $CFG->wwwroot) {
|
||||
if (ini_get('allow_url_fopen')) {
|
||||
if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
|
||||
echo '<script type="text/javascript">'."\n";
|
||||
echo '<!--'."\n";
|
||||
echo "eval('document.form.loginhttps.disabled=true');\n";
|
||||
echo '-->'."\n";
|
||||
echo '</script>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($site) {
|
||||
print_footer();
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
/// Functions /////////////////////////////////////////////////////////////////
|
||||
|
||||
function validate_form(&$form, &$err) {
|
||||
|
||||
// Currently no checks are needed ...
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,660 +0,0 @@
|
||||
<?php // $Id$
|
||||
// Shane Elliott
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
/// Add new sitewide configuration variables to this file.
|
||||
|
||||
|
||||
/// $configvars is parsed by config.php
|
||||
/// It is an array of arrays of objects
|
||||
/// $configvars[sectionname][configvariablename] = configvar object
|
||||
$configvars = array();
|
||||
|
||||
|
||||
/// no, yes strings and menu options are used in a number of places
|
||||
/// so we define them here to save time on repeatedly calling
|
||||
/// get_string()
|
||||
$stryes = get_string('yes');
|
||||
$strno = get_string('no');
|
||||
|
||||
$noyesoptions[0] = $strno;
|
||||
$noyesoptions[1] = $stryes;
|
||||
|
||||
|
||||
|
||||
/// A class to hold the configurable information
|
||||
/// $field - the html code for the form field
|
||||
/// $help - help text for the field
|
||||
/// $warning - optional warning text to be displayed
|
||||
/// method display_warning() - a generic function that can be used in an extended class
|
||||
/// e.g. enablerssfeeds
|
||||
class configvar {
|
||||
|
||||
var $field;
|
||||
var $help;
|
||||
var $warning;
|
||||
|
||||
function configvar($help, $field, $warning='') {
|
||||
$this->help = $help;
|
||||
$this->field = $field;
|
||||
$this->warning = $warning;
|
||||
}
|
||||
|
||||
function display_warning() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// Miscellaneous config variables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
$misc = array();
|
||||
|
||||
|
||||
/// maxeditingtime
|
||||
unset($options);
|
||||
$options[3600] = get_string('numminutes', '', 60);
|
||||
$options[2700] = get_string('numminutes', '', 45);
|
||||
$options[1800] = get_string('numminutes', '', 30);
|
||||
$options[900] = get_string('numminutes', '', 15);
|
||||
$options[300] = get_string('numminutes', '', 5);
|
||||
$options[60] = get_string('numminutes', '', 1);
|
||||
|
||||
$misc['maxeditingtime'] = new configvar (get_string('configmaxeditingtime', 'admin'),
|
||||
choose_from_menu ($options, 'maxeditingtime', $config->maxeditingtime, '', '', '', true) );
|
||||
|
||||
/// debug
|
||||
unset($options);
|
||||
$options[5] = $strno;
|
||||
$options[15] = $stryes;
|
||||
|
||||
$misc['debug'] = new configvar (get_string('configdebug', 'admin'),
|
||||
choose_from_menu ($options, 'debug', $config->debug, '', '', '', true) );
|
||||
|
||||
$misc['perfdebug'] = new configvar (get_string('configperfdebug', 'admin'),
|
||||
choose_from_menu ($options, 'perfdebug', $config->perfdebug, '', '', '', true) );
|
||||
|
||||
/// enablerssfeeds
|
||||
class configvarrss extends configvar {
|
||||
function display_warning() {
|
||||
return (!function_exists('utf8_encode'));
|
||||
}
|
||||
}
|
||||
|
||||
$misc['enablerssfeeds'] = new configvarrss (get_string('configenablerssfeeds', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'enablerssfeeds', $config->enablerssfeeds, '', '', '', true),
|
||||
'<font color="red"> You need to add XML support to your PHP installation.</font>' );
|
||||
|
||||
$misc['mymoodleredirect'] = new configvar (get_string('configmymoodleredirect','admin'),
|
||||
choose_from_menu($noyesoptions,'mymoodleredirect',$config->mymoodleredirect,'','','',true));
|
||||
|
||||
unset($options);
|
||||
$options[5] = get_string('worldblogs','blog');
|
||||
$options[4] = get_string('siteblogs','blog');
|
||||
$options[3] = get_string('courseblogs','blog');
|
||||
$options[2] = get_string('groupblogs','blog');
|
||||
$options[1] = get_string('personalblogs','blog');
|
||||
$options[0] = get_string('disableblogs','blog');
|
||||
|
||||
$misc['bloglevel'] = new configvar (get_string('configbloglevel', 'admin'),
|
||||
choose_from_menu ($options, 'bloglevel', $config->bloglevel,'','','',true));
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// OPERATING SYSTEM config variables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
$operatingsystem = array();
|
||||
|
||||
/// gdversion
|
||||
unset($options);
|
||||
$options[0] = get_string('gdnot');
|
||||
$options[1] = get_string('gd1');
|
||||
$options[2] = get_string('gd2');
|
||||
|
||||
$installed = check_gd_version();
|
||||
|
||||
$operatingsystem['gdversion'] = new configvar (get_string('configgdversion', 'admin'),
|
||||
choose_from_menu ($options, 'gdversion', $installed, '', '', '', true) );
|
||||
|
||||
/// dbsessions
|
||||
$operatingsystem['dbsessions'] = new configvar (get_string('configdbsessions', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'dbsessions', $config->dbsessions, '', '', '', true) );
|
||||
|
||||
/// sessiontimeout
|
||||
unset($options);
|
||||
$options[14400] = get_string('numhours', '', 4);
|
||||
$options[10800] = get_string('numhours', '', 3);
|
||||
$options[7200] = get_string('numhours', '', 2);
|
||||
$options[5400] = get_string('numhours', '', '1.5');
|
||||
$options[3600] = get_string('numminutes', '', 60);
|
||||
$options[2700] = get_string('numminutes', '', 45);
|
||||
$options[1800] = get_string('numminutes', '', 30);
|
||||
$options[900] = get_string('numminutes', '', 15);
|
||||
$options[300] = get_string('numminutes', '', 5);
|
||||
|
||||
$operatingsystem['sessiontimeout'] = new configvar (get_string('configsessiontimeout', 'admin'),
|
||||
choose_from_menu ($options, 'sessiontimeout', $config->sessiontimeout, '', '', '', true) );
|
||||
|
||||
/// sessioncookie
|
||||
$operatingsystem['sessioncookie'] = new configvar (get_string('configsessioncookie', 'admin'),
|
||||
'<input name="sessioncookie" type="text" size="10" value="'.s($config->sessioncookie).'" alt="sessioncookie" />' );
|
||||
$operatingsystem['sessioncookiepath'] = new configvar (get_string('configsessioncookiepath', 'admin'),
|
||||
'<input name="sessioncookiepath" type="text" size="10" value="'.s($config->sessioncookiepath).'" alt="sessioncookiepath" />' );
|
||||
|
||||
/// zip
|
||||
$operatingsystem['zip'] = new configvar (get_string('configzip', 'admin'),
|
||||
'<input name="zip" type="text" size="30" value="'.s($config->zip).'" alt="zip" />' );
|
||||
|
||||
/// unzip
|
||||
$operatingsystem['unzip'] = new configvar (get_string('configunzip', 'admin'),
|
||||
'<input name="unzip" type="text" size="30" value="'.s($config->unzip).'" alt="unzip" />' );
|
||||
|
||||
$operatingsystem['pathtodu'] = new configvar(get_string('configpathtodu', 'admin'),
|
||||
'<input name="pathtodu" type="text" size="30" value="'.s($config->pathtodu).'" alt="pathtodu" />');
|
||||
|
||||
/// slasharguments
|
||||
unset($options);
|
||||
$options[0] = "file.php?file=/1/pic.jpg";
|
||||
$options[1] = "file.php/1/pic.jpg";
|
||||
|
||||
$operatingsystem['slasharguments'] = new configvar (get_string('configslasharguments', 'admin'),
|
||||
choose_from_menu ($options, 'slasharguments', $config->slasharguments, '', '', '', true) );
|
||||
|
||||
/// proxyhost
|
||||
$operatingsystem['proxyhost'] = new configvar (get_string('configproxyhost', 'admin'),
|
||||
'<input name="proxyhost" type="text" size="30" value="'.s($config->proxyhost).'" alt="proxyhost" />' );
|
||||
|
||||
/// proxyport
|
||||
$operatingsystem['proxyport'] = new configvar ('',
|
||||
'<input name="proxyport" type="text" size="5" value="'.s($config->proxyport).'" alt="proxyport" />' );
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// PERMISSIONS config variables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
$permissions = array();
|
||||
|
||||
/// teacherassignteachers
|
||||
$permissions['teacherassignteachers'] = new configvar (get_string('configteacherassignteachers', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'teacherassignteachers', $config->teacherassignteachers, '', '', '', true) );
|
||||
|
||||
/// allowunenroll
|
||||
$permissions['allowunenroll'] = new configvar (get_string('configallowunenroll', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'allowunenroll', $config->allowunenroll, '', '', '', true) );
|
||||
|
||||
/// allusersaresitestudents
|
||||
$permissions['allusersaresitestudents'] = new configvar (get_string('configallusersaresitestudents', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'allusersaresitestudents', $config->allusersaresitestudents, '', '', '', true) );
|
||||
|
||||
/// showsiteparticipantslist
|
||||
unset($options);
|
||||
$options[0] = get_string('siteteachers');
|
||||
$options[1] = get_string('allteachers');
|
||||
$options[2] = get_string('studentsandteachers');
|
||||
|
||||
$permissions['showsiteparticipantslist'] = new configvar (get_string('configshowsiteparticipantslist', 'admin'),
|
||||
choose_from_menu ($options, 'showsiteparticipantslist', $config->showsiteparticipantslist, '', '', '', true) );
|
||||
|
||||
/// forcelogin
|
||||
$permissions['forcelogin'] = new configvar (get_string('configforcelogin', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'forcelogin', $config->forcelogin, '', '', '', true) );
|
||||
|
||||
/// forceloginforprofiles
|
||||
$permissions['forceloginforprofiles'] = new configvar (get_string('configforceloginforprofiles', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'forceloginforprofiles', $config->forceloginforprofiles, '', '', '', true) );
|
||||
|
||||
/// opentogoogle
|
||||
$permissions['opentogoogle'] = new configvar (get_string('configopentogoogle', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'opentogoogle', $config->opentogoogle, '', '', '', true) );
|
||||
|
||||
/// maxbytes
|
||||
$options = get_max_upload_sizes();
|
||||
|
||||
$permissions['maxbytes'] = new configvar (get_string('configmaxbytes', 'admin'),
|
||||
choose_from_menu ($options, 'maxbytes', $config->maxbytes, '', '', 0, true) );
|
||||
|
||||
/// messaging
|
||||
$permissions['messaging'] = new configvar (get_string('configmessaging', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'messaging', $config->messaging, '', '', '', true) );
|
||||
|
||||
/// allowobjectembed
|
||||
$permissions['allowobjectembed'] = new configvar (get_string('configallowobjectembed', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'allowobjectembed', $config->allowobjectembed, '', '', '', true) );
|
||||
|
||||
/// enabletrusttext
|
||||
$permissions['enabletrusttext'] = new configvar (get_string('configenabletrusttext', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'enabletrusttext', $config->enabletrusttext, '', '', '', true) );
|
||||
|
||||
unset($options);
|
||||
$options['none'] = 'No courses';
|
||||
$options['all'] = 'All courses';
|
||||
$options['requested'] = 'Requested courses';
|
||||
|
||||
$permissions['restrictmodulesfor'] = new configvar (get_string('configrestrictmodulesfor','admin'),
|
||||
' <script language="JavaScript">
|
||||
function togglemodules(index) {
|
||||
if (index == 0) {
|
||||
document.getElementById(\'allowedmodules\').disabled=true;
|
||||
}
|
||||
else {
|
||||
document.getElementById(\'allowedmodules\').disabled=false;
|
||||
}
|
||||
}
|
||||
</script>'.
|
||||
choose_from_menu($options,'restrictmodulesfor',$config->restrictmodulesfor,'','togglemodules(this.selectedIndex);','',true) );
|
||||
|
||||
$permissions['restrictbydefault'] = new configvar (get_string('configrestrictbydefault','admin'),
|
||||
choose_from_menu($noyesoptions, 'restrictbydefault',$config->restrictbydefault,'','','',true) );
|
||||
|
||||
$allowstr = '<select name="defaultallowedmodules[]" id="allowedmodules" multiple="multiple" size="10"'.((empty($config->restrictmodulesfor)) ? "disabled=\"disabled\"" : "").'>';
|
||||
|
||||
$allowedmodules = array();
|
||||
if (!empty($config->defaultallowedmodules)) {
|
||||
$allowedmodules = explode(',',$config->defaultallowedmodules);
|
||||
}
|
||||
|
||||
// On a fresh install of Moodle, this could be empty; prevent a warning on the following loop.
|
||||
if (!$mods = get_records("modules")) {
|
||||
$mods = array();
|
||||
}
|
||||
$s = "selected=\"selected\"";
|
||||
$allowstr .= '<option value="0" '.((empty($allowedmodules)) ? $s : '').'>'.get_string('allownone').'</option>'."\n";
|
||||
foreach ($mods as $mod) {
|
||||
$selected = "";
|
||||
if (in_array($mod->id,$allowedmodules))
|
||||
$selected = $s;
|
||||
$allowstr .= '<option '.$selected.' value="'.$mod->id.'">'.$mod->name.'</option>'."\n";
|
||||
}
|
||||
$allowstr .= '</select>';
|
||||
|
||||
$permissions['defaultallowedmodules'] = new configvar (get_string('configdefaultallowedmodules','admin'),$allowstr);
|
||||
|
||||
|
||||
/// course requests
|
||||
$reqcourse['enablecourserequests'] = new configvar (get_string('configenablecourserequests', 'admin'),
|
||||
choose_from_menu ($noyesoptions,'enablecourserequests',$config->enablecourserequests,'','','',true) );
|
||||
|
||||
/// default category for course requests
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
$reqcourse['defaultrequestedcategory'] = new configvar (get_string('configdefaultrequestedcategory', 'admin'),
|
||||
choose_from_menu (make_categories_options(), 'defaultrequestedcategory',$config->defaultrequestedcategory,'','','',true) );
|
||||
|
||||
$reqcourse['requestedteachername'] = new configvar (get_string('configrequestedteachername','admin'),
|
||||
'<input type="text" name="requestedteachername" size="20" maxlength="100" value="'.s($config->requestedteachername).'" />');
|
||||
|
||||
$reqcourse['requestedteachersname'] = new configvar (get_string('configrequestedteachersname','admin'),
|
||||
'<input type="text" name="requestedteachersname" size="20" maxlength="100" value="'.s($config->requestedteachersname).'" />');
|
||||
|
||||
$reqcourse['requestedstudentname'] = new configvar (get_string('configrequestedstudentname','admin'),
|
||||
'<input type="text" name="requestedstudentname" size="20" maxlength="100" value="'.s($config->requestedstudentname).'" />');
|
||||
|
||||
$reqcourse['requestedstudentsname'] = new configvar (get_string('configrequestedstudentsname','admin'),
|
||||
'<input type="text" name="requestedstudentsname" size="20" maxlength="100" value="'.s($config->requestedstudentsname).'" />');
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// INTERFACE config variables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
$interface = array();
|
||||
|
||||
/// language settings
|
||||
$interface['lang'] = new configvar ( get_string('configlang', 'admin'),
|
||||
choose_from_menu(get_list_of_languages(), 'lang', $config->lang, '', '', '', true) );
|
||||
|
||||
/// language menu
|
||||
$interface['langmenu'] = new configvar ( get_string('configlangmenu', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'langmenu', $config->langmenu, '', '', '', true) );
|
||||
|
||||
/// language list
|
||||
$interface['langlist'] = new configvar ( get_string('configlanglist', 'admin'),
|
||||
'<input name="langlist" type="text" size="60" value="'.s($config->langlist).'" alt="langlist" />' );
|
||||
|
||||
/// language menu
|
||||
$interface['langcache'] = new configvar ( get_string('configlangcache', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'langcache', $config->langcache, '', '', '', true) );
|
||||
|
||||
/// locale
|
||||
$interface['locale'] = new configvar ( get_string('configlocale', 'admin'),
|
||||
'<input name="locale" type="text" size="15" value="'.s($config->locale).'" alt="locale" />' );
|
||||
|
||||
/// docroot
|
||||
$interface['docroot'] = new configvar ( get_string('configdocroot', 'admin'),
|
||||
'<input name="docroot" type="text" size="60" value="'.s($config->docroot).'" alt="docroot" />' );
|
||||
|
||||
/// doctonewwindow
|
||||
$interface['doctonewwindow'] = new configvar ( get_string('configdoctonewwindow', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'doctonewwindow', $config->doctonewwindow, '', '', '', true) );
|
||||
|
||||
/// timezone
|
||||
$interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'),
|
||||
choose_from_menu (get_list_of_timezones(), 'timezone', $config->timezone, get_string('serverlocaltime'), '', '99', true ) );
|
||||
|
||||
/// country
|
||||
$interface['country'] = new configvar ( get_string('configcountry', 'admin'),
|
||||
choose_from_menu (get_list_of_countries(), 'country', $config->country, get_string('selectacountry'), '', 0, true) );
|
||||
|
||||
/// framename
|
||||
if (empty($config->framename)) {
|
||||
$config->framename = "_top";
|
||||
}
|
||||
|
||||
$interface['framename'] = new configvar (get_string('configframename', 'admin'),
|
||||
'<input name="framename" type="text" size="15" value="'.s($config->framename).'" alt="framename" />' );
|
||||
|
||||
/// language list
|
||||
$interface['themelist'] = new configvar ( get_string('configthemelist', 'admin'),
|
||||
'<input name="themelist" type="text" size="60" value="'.s($config->themelist).'" alt="themelist" />' );
|
||||
|
||||
/// user themes
|
||||
$interface['allowuserthemes'] = new configvar (get_string('configallowuserthemes', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'allowuserthemes', $config->allowuserthemes, '', '', '', true) );
|
||||
|
||||
/// course themes
|
||||
$interface['allowcoursethemes'] = new configvar (get_string('configallowcoursethemes', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'allowcoursethemes', $config->allowcoursethemes, '', '', '', true) );
|
||||
|
||||
/// allowuserblockhiding
|
||||
$interface['allowuserblockhiding'] = new configvar (get_string('configallowuserblockhiding', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'allowuserblockhiding', $config->allowuserblockhiding, '', '', '', true) );
|
||||
|
||||
/// showblocksonmodpages
|
||||
$interface['showblocksonmodpages'] = new configvar (get_string('configshowblocksonmodpages', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'showblocksonmodpages', $config->showblocksonmodpages, '', '', '', true) );
|
||||
|
||||
|
||||
/// tabselectedtofront
|
||||
$interface['tabselectedtofront'] = new configvar (get_string('tabselectedtofront', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'tabselectedtofront', $config->tabselectedtofront, '', '', '', true) );
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// USER config variables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
$user = array();
|
||||
|
||||
/// sitepolicy
|
||||
$user['sitepolicy'] = new configvar (get_string('configsitepolicy', 'admin'),
|
||||
'<input type="text" name="sitepolicy" size="60" value="'.$config->sitepolicy.'" alt="sitepolicy" />' );
|
||||
|
||||
|
||||
/// fullnamedisplay
|
||||
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');
|
||||
|
||||
$user['fullnamedisplay'] = new configvar (get_string('configfullnamedisplay', 'admin'),
|
||||
choose_from_menu ($options, 'fullnamedisplay', $config->fullnamedisplay, '', '', '', true) );
|
||||
|
||||
/// extendedusernamechars
|
||||
$user['extendedusernamechars'] = new configvar (get_string('configextendedusernamechars', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'extendedusernamechars', $config->extendedusernamechars, '', '', '', true) );
|
||||
|
||||
/// autologinguests
|
||||
$user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) );
|
||||
|
||||
/// hiddenuserfields
|
||||
$fields = array('none', 'description', 'city', 'country', 'webpage', 'icqnumber', 'skypeid', 'yahooid', 'aimid', 'msnid', 'lastaccess');
|
||||
if (empty($config->hiddenuserfields)) {
|
||||
$config->hiddenuserfields = 'none';
|
||||
}
|
||||
$configfields = array_flip(explode(',', $config->hiddenuserfields));
|
||||
$fieldoptions = '';
|
||||
foreach ($fields as $value) {
|
||||
$fieldoptions .= '<option value="'.$value.'"';
|
||||
if (isset($configfields[$value])) {
|
||||
$fieldoptions .= ' selected="selected"';
|
||||
}
|
||||
$fieldoptions .= '>'.get_string($value).'</option>';
|
||||
}
|
||||
|
||||
$user['hiddenuserfields'] = new configvar (get_string('confighiddenuserfields', 'admin'),
|
||||
'<select id="menuhiddenuserfields" name="hiddenuserfields[]" size="10" multiple="multiple">'.$fieldoptions.'</select>' );
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// SECURITY config variables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
$security = array();
|
||||
|
||||
/// displayloginfailures
|
||||
unset($options);
|
||||
$options[''] = get_string('nobody');
|
||||
$options['admin'] = get_string('administrators');
|
||||
$options['teacher'] = get_string('administratorsandteachers');
|
||||
$options['everybody'] = get_string('everybody');
|
||||
|
||||
$security['displayloginfailures'] = new configvar (get_string('configdisplayloginfailures', 'admin'),
|
||||
choose_from_menu($options, 'displayloginfailures', $config->displayloginfailures, '', '', '', true) );
|
||||
|
||||
/// notifyloginfailures
|
||||
unset($options);
|
||||
$options[''] = get_string('nobody');
|
||||
$options['mainadmin'] = get_string('administrator');
|
||||
$options['alladmins'] = get_string('administratorsall');
|
||||
|
||||
$security['notifyloginfailures'] = new configvar (get_string('confignotifyloginfailures', 'admin'),
|
||||
choose_from_menu($options, 'notifyloginfailures', $config->notifyloginfailures, '', '', '', true) );
|
||||
|
||||
/// notifyloginthreshold
|
||||
unset($options);
|
||||
for ($i=1; $i<=100; $i++) {
|
||||
$options[$i] = "$i";
|
||||
}
|
||||
|
||||
$security['notifyloginthreshold'] = new configvar (get_string('confignotifyloginthreshold', 'admin'),
|
||||
choose_from_menu($options, 'notifyloginthreshold', $config->notifyloginthreshold, '', '', '', true) );
|
||||
|
||||
/// secureforms
|
||||
$security['secureforms'] = new configvar (get_string('configsecureforms', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'secureforms', $config->secureforms, '', '', '', true) );
|
||||
|
||||
/// loginhttps
|
||||
$security['loginhttps'] = new configvar (get_string('configloginhttps', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'loginhttps', $config->loginhttps, '', '', '', true) );
|
||||
|
||||
/// runclamonupload
|
||||
$security['runclamonupload'] = new configvar (get_string('configrunclamonupload', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'runclamonupload', $config->runclamonupload, '', '', '', true) );
|
||||
|
||||
/// pathtoclam
|
||||
$security['pathtoclam'] = new configvar (get_string('configpathtoclam', 'admin'),
|
||||
'<input type="text" name="pathtoclam" size="30" value="'.$config->pathtoclam.'" alt="pathtoclam" />' );
|
||||
|
||||
/// quarantinedir
|
||||
$security['quarantinedir'] = new configvar (get_string('configquarantinedir', 'admin'),
|
||||
'<input type="text" name="quarantinedir" size="30" value="'.$config->quarantinedir.'" alt="quarantinedir" />' );
|
||||
|
||||
/// clamfailureonupload
|
||||
unset($options);
|
||||
$options['donothing'] = get_string('configclamdonothing', 'admin');
|
||||
$options['actlikevirus'] = get_string('configclamactlikevirus', 'admin');
|
||||
|
||||
$security['clamfailureonupload'] = new configvar (get_string('configclamfailureonupload', 'admin'),
|
||||
choose_from_menu($options, 'clamfailureonupload', $config->clamfailureonupload, '', '', '', true) );
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// MAINTENANCE config variables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
$maintenance = array();
|
||||
|
||||
/// longtimenosee
|
||||
unset($options);
|
||||
$options[0] = get_string('never');
|
||||
$options[1000] = get_string('numdays', '', 1000);
|
||||
$options[365] = get_string('numdays', '', 365);
|
||||
$options[180] = get_string('numdays', '', 180);
|
||||
$options[150] = get_string('numdays', '', 150);
|
||||
$options[120] = get_string('numdays', '', 120);
|
||||
$options[90] = get_string('numdays', '', 90);
|
||||
$options[60] = get_string('numdays', '', 60);
|
||||
$options[30] = get_string('numdays', '', 30);
|
||||
$options[21] = get_string('numdays', '', 21);
|
||||
$options[14] = get_string('numdays', '', 14);
|
||||
$options[7] = get_string('numdays', '', 7);
|
||||
|
||||
$maintenance['longtimenosee'] = new configvar (get_string('configlongtimenosee', 'admin'),
|
||||
choose_from_menu ($options, 'longtimenosee', $config->longtimenosee, '', '', '', true) );
|
||||
|
||||
/// deleteunconfirmed
|
||||
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);
|
||||
|
||||
$maintenance['deleteunconfirmed'] = new configvar (get_string('configdeleteunconfirmed', 'admin'),
|
||||
choose_from_menu ($options, 'deleteunconfirmed', $config->deleteunconfirmed, '', '', '', true) );
|
||||
|
||||
/// loglifetime
|
||||
unset($options);
|
||||
$options[0] = get_string('neverdeletelogs');
|
||||
$options[1000] = get_string('numdays', '', 1000);
|
||||
$options[365] = get_string('numdays', '', 365);
|
||||
$options[180] = get_string('numdays', '', 180);
|
||||
$options[150] = get_string('numdays', '', 150);
|
||||
$options[120] = get_string('numdays', '', 120);
|
||||
$options[90] = get_string('numdays', '', 90);
|
||||
$options[60] = get_string('numdays', '', 60);
|
||||
$options[30] = get_string('numdays', '', 30);
|
||||
|
||||
$maintenance['loglifetime'] = new configvar (get_string('configloglifetime', 'admin'),
|
||||
choose_from_menu ($options, 'loglifetime', $config->loglifetime, '', '', '', true) );
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// MAIL config variables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
$mail = array();
|
||||
|
||||
/// smtphosts
|
||||
$mail['smtphosts'] = new configvar (get_string('configsmtphosts', 'admin'),
|
||||
'<input name="smtphosts" type="text" size="30" value="'.s($config->smtphosts).'" alt="smtphosts" />' );
|
||||
|
||||
/// smtpuser
|
||||
$mail['smtpuser'] = new configvar (get_string('configsmtpuser', 'admin'),
|
||||
'<input name="smtpuser" type="text" size="10" value="'.s($config->smtpuser).'" alt="smtpuser" />' );
|
||||
|
||||
/// smtppass
|
||||
$mail['smtppass'] = new configvar ('',
|
||||
'<input name="smtppass" type="password" size="10" value="'.s($config->smtppass).'" alt="smtppass" />' );
|
||||
|
||||
/// noreplyaddress
|
||||
$mail['noreplyaddress'] = new configvar (get_string('confignoreplyaddress', 'admin'),
|
||||
'<input name="noreplyaddress" type="text" size="30" value="'.s($config->noreplyaddress).'" alt="noreplyaddress" />' );
|
||||
|
||||
/// digestmailtime
|
||||
$hours = array();
|
||||
for ($i=0; $i<=23; $i++) {
|
||||
$hours[$i] = sprintf("%02d",$i);
|
||||
}
|
||||
|
||||
$mail['digestmailtime'] = new configvar (get_string('configdigestmailtime', 'admin'),
|
||||
choose_from_menu($hours, 'digestmailtime', $config->digestmailtime, '', '', 0, true) );
|
||||
|
||||
/// allowemailaddresses
|
||||
$mail['allowemailaddresses'] = new configvar (get_string('configallowemailaddresses', 'admin'),
|
||||
'<input name="allowemailaddresses" type="text" size="60" value="'.s($config->allowemailaddresses).'" alt="allowemailaddresses" />' );
|
||||
|
||||
/// denyemailaddresses
|
||||
$mail['denyemailaddresses'] = new configvar (get_string('configdenyemailaddresses', 'admin'),
|
||||
'<input name="denyemailaddresses" type="text" size="60" value="'.s($config->denyemailaddresses).'" alt="denyemailaddresses" />' );
|
||||
|
||||
if (!empty($CFG->unicodedb)) { ///These options are only available if running under unicodedb
|
||||
/// sitemailcharset
|
||||
unset($options);
|
||||
unset($charsets);
|
||||
$charsets = get_list_of_charsets();
|
||||
$options['0'] = get_string('none');
|
||||
$options = array_merge($options, $charsets);
|
||||
$mail['sitemailcharset'] = new configvar (get_string('configsitemailcharset', 'admin'),
|
||||
choose_from_menu($options, 'sitemailcharset', $config->sitemailcharset, '', '', '', true));
|
||||
|
||||
/// allowusermailcharset
|
||||
$mail['allowusermailcharset'] = new configvar (get_string('configallowusermailcharset', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'allowusermailcharset', $config->allowusermailcharset, '', '', '', true));
|
||||
}
|
||||
|
||||
/// enable stats
|
||||
if (empty($CFG->disablestatsprocessing)) {
|
||||
$stats['enablestats'] = new configvar (get_string('configenablestats','admin'),
|
||||
choose_from_menu($noyesoptions, 'enablestats', $config->enablestats, '', '', '', true) );
|
||||
|
||||
unset($options);
|
||||
$options['none'] = get_string('none');
|
||||
$options[60*60*24*7] = get_string('numweeks','moodle',1);
|
||||
$options[60*60*24*14] = get_string('numweeks','moodle',2);
|
||||
$options[60*60*24*21] = get_string('numweeks','moodle',3);
|
||||
$options[60*60*24*28] = get_string('nummonths','moodle',1);
|
||||
$options[60*60*24*56] = get_string('nummonths','moodle',2);
|
||||
$options[60*60*24*84] = get_string('nummonths','moodle',3);
|
||||
$options[60*60*24*112] = get_string('nummonths','moodle',4);
|
||||
$options[60*60*24*140] = get_string('nummonths','moodle',5);
|
||||
$options[60*60*24*168] = get_string('nummonths','moodle',6);
|
||||
$options['all'] = get_string('all');
|
||||
|
||||
$stats['statsfirstrun'] = new configvar (get_string('configstatsfirstrun','admin'),
|
||||
choose_from_menu($options,'statsfirstrun',$config->statsfirstrun,'','','',true) );
|
||||
|
||||
unset($options);
|
||||
$options[0] = get_string('untilcomplete');
|
||||
$options[60*60] = '1 '.get_string('hour');
|
||||
$options[60*60*2] = '2 '.get_string('hours');
|
||||
$options[60*60*3] = '3 '.get_string('hours');
|
||||
$options[60*60*4] = '4 '.get_string('hours');
|
||||
$options[60*60*5] = '5 '.get_string('hours');
|
||||
$options[60*60*6] = '6 '.get_string('hours');
|
||||
$options[60*60*7] = '7 '.get_string('hours');
|
||||
$options[60*60*8] = '8 '.get_string('hours');
|
||||
|
||||
if (empty($config->statsruntimestarthour)) {
|
||||
$config->statsruntimestarthour = 0;
|
||||
}
|
||||
if (empty($config->statsruntimestartminute)) {
|
||||
$config->statsruntimestartminute = 0;
|
||||
}
|
||||
|
||||
$stats['statsmaxruntime'] = new configvar (get_string('configstatsmaxruntime','admin'),
|
||||
choose_from_menu($options,'statsmaxruntime',$config->statsmaxruntime,'','','',true) );
|
||||
|
||||
$stats['statsruntimestart'] = new configvar (get_string('configstatsruntimestart','admin'),
|
||||
print_time_selector("statsruntimestarthour","statsruntimestartminute",make_timestamp(2000,1,1,$config->statsruntimestarthour,$config->statsruntimestartminute),5,true) );
|
||||
|
||||
$stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'),
|
||||
'<input type="text" name="statsuserthreshold" size="4" value="'.$config->statsuserthreshold.'" />');
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
$configvars['interface'] = $interface;
|
||||
$configvars['security'] = $security;
|
||||
$configvars['operatingsystem'] = $operatingsystem;
|
||||
$configvars['maintenance'] = $maintenance;
|
||||
$configvars['mail'] = $mail;
|
||||
$configvars['user'] = $user;
|
||||
$configvars['permissions'] = $permissions;
|
||||
$configvars['requestedcourse'] = $reqcourse;
|
||||
$configvars['misc'] = $misc;
|
||||
if (empty($CFG->disablestatsprocessing)) {
|
||||
$configvars['stats'] = $stats;
|
||||
}
|
||||
|
||||
?>
|
||||
+24
-3
@@ -62,6 +62,9 @@
|
||||
@header('Content-Type: text/plain; charset='.current_charset());
|
||||
}
|
||||
|
||||
/// increase memory limit (PHP 5.2 does different calculation, we need more memory now)
|
||||
@raise_memory_limit('128M');
|
||||
|
||||
/// Start output log
|
||||
|
||||
$timenow = time();
|
||||
@@ -84,6 +87,8 @@
|
||||
mtrace("Error: could not update timestamp for $mod->fullname");
|
||||
}
|
||||
}
|
||||
/// Reset possible changes by modules to time_limit. MDL-11597
|
||||
@set_time_limit(0);
|
||||
mtrace("done.");
|
||||
}
|
||||
}
|
||||
@@ -108,19 +113,35 @@
|
||||
mtrace('Error: could not update timestamp for '.$block->name);
|
||||
}
|
||||
}
|
||||
/// Reset possible changes by blocks to time_limit. MDL-11597
|
||||
@set_time_limit(0);
|
||||
mtrace('done.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
mtrace("Finished blocks");
|
||||
mtrace('Finished blocks');
|
||||
|
||||
if (!empty($CFG->langcache)) {
|
||||
mtrace('Updating languages cache');
|
||||
get_list_of_languages();
|
||||
}
|
||||
|
||||
mtrace('Removing expired enrolments ...', ''); // See MDL-8785
|
||||
$timenow = time();
|
||||
if ($oldenrolments = get_records_select('role_assignments', "timeend > 0 AND timeend < '$timenow'")) {
|
||||
mtrace(count($oldenrolments).' to delete');
|
||||
foreach ($oldenrolments as $oldenrolment) {
|
||||
if (role_unassign($oldenrolment->roleid, $oldenrolment->userid, 0, $oldenrolment->contextid)) {
|
||||
mtrace("Deleted expired role assignment $oldenrolment->roleid for user $oldenrolment->userid from context $oldenrolment->contextid");
|
||||
}
|
||||
}
|
||||
mtrace('Done');
|
||||
} else {
|
||||
mtrace('none found');
|
||||
}
|
||||
|
||||
|
||||
/// Run all core cron jobs, but not every time since they aren't too important.
|
||||
/// These don't have a timer to reduce load, so we'll use a random number
|
||||
@@ -235,7 +256,7 @@
|
||||
//Execute backup's cron
|
||||
//Perhaps a long time and memory could help in large sites
|
||||
@set_time_limit(0);
|
||||
@raise_memory_limit("128M");
|
||||
@raise_memory_limit("192M");
|
||||
if (function_exists('apache_child_terminate')) {
|
||||
// if we are running from Apache, give httpd a hint that
|
||||
// it can recycle the process after it's done. Apache's
|
||||
@@ -290,7 +311,7 @@
|
||||
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
|
||||
|
||||
// check we're not before our runtime
|
||||
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
|
||||
$timetocheck = strtotime("today $CFG->statsruntimestarthour:$CFG->statsruntimestartminute");
|
||||
|
||||
if (time() > $timetocheck) {
|
||||
$time = 60*60*20; // set it to 20 here for first run... (overridden by $CFG)
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ function delete_subdirectories($rootdir) {
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
|
||||
while ($file = readdir($dir)) {
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
if ($file != '.' and $file != '..') {
|
||||
$fullfile = $rootdir .'/'. $file;
|
||||
if (filetype($fullfile) == 'dir') {
|
||||
|
||||
@@ -104,4 +104,73 @@
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.0" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="4.3.0" level="required">
|
||||
<RESTRICT function="restrict_php50_version" message="php50restricted" />
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.0">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.0" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.2.8" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+2
-4
@@ -59,10 +59,10 @@
|
||||
// run through submitted data
|
||||
// reject if does not start with filter_
|
||||
foreach ($config as $name => $value) {
|
||||
set_config( $name,$value );
|
||||
set_config($name, stripslashes($value));
|
||||
}
|
||||
}
|
||||
redirect( "$CFG->wwwroot/$CFG->admin/filters.php", get_string('changessaved'), 1);
|
||||
redirect("$CFG->wwwroot/$CFG->admin/filters.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,5 @@
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
+193
-1
@@ -525,11 +525,203 @@ class problem_000011 extends problem_base {
|
||||
}
|
||||
return 'Error counter was cleared.';
|
||||
} else {
|
||||
return '<p>Session errors can be caused by:<ul><li>unresolved problem in server software (aka random switching of users),</li><li>blocked or modified cookies,</li><li>deleting of active session files.</li></ul></p><p><a href="'.me().'&resetsesserrorcounter=1">Reset counter.</a></p>';
|
||||
return '<p>Session errors can be caused by:</p><ul>' .
|
||||
'<li>unresolved problem in server software (aka random switching of users),</li>' .
|
||||
'<li>blocked or modified cookies,</li>' .
|
||||
'<li>deleting of active session files.</li>' .
|
||||
'</ul><p><a href="'.me().'&resetsesserrorcounter=1">Reset counter</a></p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000012 extends problem_base {
|
||||
function title() {
|
||||
return 'Random questions data consistency';
|
||||
}
|
||||
function exists() {
|
||||
return record_exists_select('question', "qtype = 'random' AND parent <> id");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>For random questions, question.parent should equal question.id. ' .
|
||||
'There are some questions in your database for which this is not true. ' .
|
||||
'One way that this could have happened is for random questions restored from backup before ' .
|
||||
'<a href="http://tracker.moodle.org/browse/MDL-5482">MDL-5482</a> was fixed.</p>';
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the SQL</p>' .
|
||||
'<pre>UPDATE ' . $CFG->prefix . 'question SET parent = id WHERE qtype = \'random\' and parent <> id;</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000013 extends problem_base {
|
||||
function title() {
|
||||
return 'Multi-answer questions data consistency';
|
||||
}
|
||||
function exists() {
|
||||
global $CFG;
|
||||
$positionexpr = sql_position(sql_concat("','", "q.id", "','"),
|
||||
sql_concat("','", "qma.sequence", "','"));
|
||||
return record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question_multianswer qma ON $positionexpr > 0
|
||||
WHERE qma.question <> q.parent") ||
|
||||
record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question parent_q ON parent_q.id = q.parent
|
||||
WHERE q.category <> parent_q.category");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>For each sub-question whose id is listed in ' .
|
||||
'question_multianswer.sequence, its question.parent field should equal ' .
|
||||
'question_multianswer.question; and each sub-question should be in the same ' .
|
||||
'category as its parent. There are questions in your database for ' .
|
||||
'which this is not the case. One way that this could have happened is ' .
|
||||
'for multi-answer questions restored from backup before ' .
|
||||
'<a href="http://tracker.moodle.org/browse/MDL-14750">MDL-14750</a> was fixed.</p>';
|
||||
}
|
||||
function solution() {
|
||||
return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the ' .
|
||||
'code in question_multianswer_fix_subquestion_parents_and_categories in ' .
|
||||
'<a href="http://cvs.moodle.org/moodle/question/type/multianswer/db/upgrade.php?revision=1.1.10.2&view=markup">/question/type/multianswer/db/upgrade.php' .
|
||||
'from the 1.9 stable branch</a>.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000014 extends problem_base {
|
||||
function title() {
|
||||
return 'Only multianswer and random questions should be the parent of another question';
|
||||
}
|
||||
function exists() {
|
||||
global $CFG;
|
||||
return record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question parent_q ON parent_q.id = q.parent
|
||||
WHERE parent_q.qtype NOT IN ('random', 'multianswer')");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>You have questions that violate this in your databse. ' .
|
||||
'You will need to investigate to determine how this happened.</p>';
|
||||
}
|
||||
function solution() {
|
||||
return '<p>It is impossible to give a solution without knowing more about ' .
|
||||
' how the problem was caused. You may be able to get help from the ' .
|
||||
'<a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a>.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000017 extends problem_base {
|
||||
function title() {
|
||||
return 'Question categories tree structure';
|
||||
}
|
||||
function find_problems() {
|
||||
static $answer = null;
|
||||
|
||||
if (is_null($answer)) {
|
||||
$categories = get_records('question_categories', '', '', 'id');
|
||||
|
||||
// Look for missing parents.
|
||||
$missingparent = array();
|
||||
foreach ($categories as $category) {
|
||||
if ($category->parent != 0 && !array_key_exists($category->parent, $categories)) {
|
||||
$missingparent[$category->id] = $category;
|
||||
}
|
||||
}
|
||||
|
||||
// Look for loops.
|
||||
$loops = array();
|
||||
while (!empty($categories)) {
|
||||
$current = array_pop($categories);
|
||||
$thisloop = array($current->id => $current);
|
||||
while (true) {
|
||||
if (isset($thisloop[$current->parent])) {
|
||||
// Loop detected
|
||||
$loops[$current->id] = $thisloop;
|
||||
break;
|
||||
} else if (!isset($categories[$current->parent])) {
|
||||
// Got to the top level, or a category we already know is OK.
|
||||
break;
|
||||
} else {
|
||||
// Continue following the path.
|
||||
$current = $categories[$current->parent];
|
||||
$thisloop[$current->id] = $current;
|
||||
unset($categories[$current->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$answer = array($missingparent, $loops);
|
||||
}
|
||||
|
||||
return $answer;
|
||||
}
|
||||
function exists() {
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
return !empty($missingparent) || !empty($loops);
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
|
||||
$description = '<p>The question categories should be arranged into tree ' .
|
||||
' structures by the question_categories.parent field. Sometimes ' .
|
||||
' this tree structure gets messed up.</p>';
|
||||
|
||||
if (!empty($missingparent)) {
|
||||
$description .= '<p>The following categories are missing their parents:</p><ul>';
|
||||
foreach ($missingparent as $cat) {
|
||||
$description .= "<li>Category $cat->id: " . s($cat->name) . "</li>\n";
|
||||
}
|
||||
$description .= "</ul>\n";
|
||||
}
|
||||
|
||||
if (!empty($loops)) {
|
||||
$description .= '<p>The following categories form a loop of parents:</p><ul>';
|
||||
foreach ($loops as $loop) {
|
||||
$description .= "<li><ul>\n";
|
||||
foreach ($loop as $cat) {
|
||||
$description .= "<li>Category $cat->id: " . s($cat->name) . " has parent $cat->parent</li>\n";
|
||||
}
|
||||
$description .= "</ul></li>\n";
|
||||
}
|
||||
$description .= "</ul>\n";
|
||||
}
|
||||
|
||||
return $description;
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
|
||||
$solution = '<p>Consider executing the following SQL queries. These fix ' .
|
||||
'the problem by moving some categories to the top level.</p>';
|
||||
|
||||
if (!empty($missingparent)) {
|
||||
$solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
|
||||
" SET parent = 0\n" .
|
||||
" WHERE id IN (" . implode(',', array_keys($missingparent)) . ");</pre>\n";
|
||||
}
|
||||
|
||||
if (!empty($loops)) {
|
||||
$solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
|
||||
" SET parent = 0\n" .
|
||||
" WHERE id IN (" . implode(',', array_keys($loops)) . ");</pre>\n";
|
||||
}
|
||||
|
||||
return $solution;
|
||||
}
|
||||
}
|
||||
|
||||
class problem_00000x extends problem_base {
|
||||
function title() {
|
||||
|
||||
+36
-18
@@ -27,6 +27,7 @@
|
||||
|
||||
$id = optional_param('id', '', PARAM_ALPHANUM);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
||||
$agreelicence = optional_param('agreelicence',0, PARAM_BOOL);
|
||||
$ignoreupgradewarning = optional_param('ignoreupgradewarning', 0, PARAM_BOOL);
|
||||
|
||||
@@ -224,13 +225,36 @@
|
||||
|
||||
if (empty($confirmupgrade)) {
|
||||
|
||||
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", "", false, " ", " ");
|
||||
|
||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php');
|
||||
exit;
|
||||
|
||||
} else if (empty($confirmrelease)) {
|
||||
$strcurrentrelease = get_string("currentrelease");
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
print_simple_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'center');
|
||||
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
print_heading(get_string('environment', 'admin'));
|
||||
if (!check_moodle_environment($release, $environment_results, true)) {
|
||||
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
|
||||
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
|
||||
} else {
|
||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||
|
||||
echo '<form action="index.php">';
|
||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
echo '<div class="continuebutton"><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
print_footer('none');
|
||||
exit;
|
||||
|
||||
} else {
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
@@ -297,13 +321,9 @@
|
||||
/// Updated human-readable release version if necessary
|
||||
|
||||
if ($release <> $CFG->release) { // Update the release version
|
||||
$strcurrentrelease = get_string("currentrelease");
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
if (!set_config("release", $release)) {
|
||||
notify("ERROR: Could not update release version in database!!");
|
||||
error("ERROR: Could not update release version in database!!");
|
||||
}
|
||||
notice(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'index.php', 'none');
|
||||
}
|
||||
|
||||
/// Find and check all main modules and load them up or upgrade them if necessary
|
||||
@@ -399,7 +419,7 @@
|
||||
|
||||
/// Define the unique site ID code if it isn't already
|
||||
if (empty($CFG->siteidentifier)) { // Unique site identification code
|
||||
set_config('siteidentifier', random_string(32));
|
||||
set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
|
||||
}
|
||||
|
||||
/// Check if the guest user exists. If not, create one.
|
||||
@@ -468,14 +488,21 @@
|
||||
print_spacer(10,10);
|
||||
}
|
||||
|
||||
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
|
||||
print_simple_box(get_string('globalsquoteswarning', 'admin'), 'center', '60%');
|
||||
if (ini_get_bool('register_globals')) {
|
||||
print_simple_box(get_string('globalswarning', 'admin'), 'center', '60%');
|
||||
}
|
||||
|
||||
if (is_dataroot_insecure()) {
|
||||
print_simple_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'center', '60%');
|
||||
}
|
||||
|
||||
if (substr($CFG->wwwroot, -1) == '/') {
|
||||
print_simple_box(get_string('cfgwwwrootslashwarning', 'admin'), 'center', '60%');
|
||||
}
|
||||
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
|
||||
print_simple_box(get_string('cfgwwwrootwarning', 'admin'), 'center', '60%');
|
||||
}
|
||||
|
||||
/// If no recently cron run
|
||||
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
|
||||
if (time() - $lastcron > 3600 * 24) {
|
||||
@@ -528,15 +555,6 @@
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
if (optional_param('dbmigrate')) { // ??? Is this actually used?
|
||||
print_simple_box_start('center','60%');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/utfdbmigrate.php');
|
||||
db_migrate2utf8();
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
|
||||
+15
-3
@@ -4,6 +4,9 @@
|
||||
*
|
||||
* CHANGES
|
||||
*
|
||||
* 2006/11/07 mudrd8mz
|
||||
* Fixed bug MDL-7361. Thanks to Dan Poltawski for the patch proposal.
|
||||
*
|
||||
* 2006/06/08 mudrd8mz
|
||||
* 1) Fixed bug 5745 reported by Harry Smith so now can edit en_utf8_local pack
|
||||
* 2) More notification messages included
|
||||
@@ -133,13 +136,14 @@
|
||||
|
||||
// Get a list of all the root files in the English directory
|
||||
|
||||
$langbase = $CFG->dataroot . '/lang';
|
||||
$enlangdir = "$CFG->dirroot/lang/en_utf8";
|
||||
if ($currentlang == 'en_utf8') {
|
||||
$langdir = $enlangdir;
|
||||
} else {
|
||||
$langdir = "$CFG->dataroot/lang/$currentlang";
|
||||
$langdir = "$langbase/$currentlang";
|
||||
}
|
||||
$locallangdir = "$CFG->dataroot/lang/{$currentlang}_local";
|
||||
$locallangdir = "$langbase/{$currentlang}_local";
|
||||
|
||||
if (! $stringfiles = get_directory_list($enlangdir, "", false)) {
|
||||
error("Could not find English language pack!");
|
||||
@@ -256,6 +260,14 @@
|
||||
|
||||
} else if ($mode == "compare") {
|
||||
|
||||
if (!file_exists($langbase) ){
|
||||
if (!lang_make_directory($langbase) ){
|
||||
error('ERROR: Could not create base lang directory ' . $langbase);
|
||||
} else {
|
||||
echo '<div class="notifysuccess" align="center">Created directory '.
|
||||
$langbase .'</div>'."<br />\n";
|
||||
}
|
||||
}
|
||||
if (!$uselocal && !file_exists($langdir)) {
|
||||
if (!lang_make_directory($langdir)) {
|
||||
error('ERROR: Could not create directory '.$langdir);
|
||||
@@ -573,7 +585,7 @@ function lang_fix_value_from_file($value='') {
|
||||
* Try and create a new language directory.
|
||||
*
|
||||
* @uses $CFG
|
||||
* @param string $directory directory name under $CFG->dataroot/lang eg cs_utf8_local
|
||||
* @param string $directory full path to the directory under $langbase
|
||||
* @return string|false Returns full path to directory if successful, false if not
|
||||
*/
|
||||
function lang_make_directory($dir, $shownotices=true) {
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@
|
||||
$settings = "";
|
||||
}
|
||||
|
||||
$count = count_records("$module->name");
|
||||
$count = count_records_select("$module->name",'course<>0');
|
||||
|
||||
if ($module->visible) {
|
||||
$visible = "<a href=\"modules.php?hide=$module->name&sesskey=$USER->sesskey\" title=\"$strhide\">".
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ function online_assignment_cleanup($output=false) {
|
||||
|
||||
|
||||
/// get a list of all courses on this site
|
||||
$courses = get_courses();
|
||||
$courses = get_records('course');
|
||||
|
||||
/// cycle through each course
|
||||
foreach ($courses as $course) {
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
$graph->parameter['legend_size'] = 10;
|
||||
$graph->parameter['x_axis_angle'] = 90;
|
||||
$graph->parameter['title'] = false; // moodle will do a nicer job.
|
||||
$graph->y_tick_labels = null;
|
||||
$graph->offset_relation = null;
|
||||
if ($report != STATS_REPORT_ACTIVE_COURSES) {
|
||||
$graph->parameter['y_decimal_left'] = 2;
|
||||
}
|
||||
|
||||
Executable
+369
@@ -0,0 +1,369 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Spam Cleaner
|
||||
*
|
||||
* Helps an admin to clean up spam in Moodle
|
||||
*
|
||||
* @version $Id$
|
||||
* @authors Dongsheng Cai, Martin Dougiamas, Amr Hourani
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
*/
|
||||
|
||||
// Configuration
|
||||
|
||||
// List of known spammy keywords, please add more here
|
||||
|
||||
$autokeywords = array(
|
||||
"<img",
|
||||
"fuck",
|
||||
"casino",
|
||||
"porn",
|
||||
"xxx",
|
||||
"cialis",
|
||||
"viagra",
|
||||
"poker",
|
||||
"warcraft"
|
||||
);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
function delete_user($user) {
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = 1;
|
||||
$updateuser->username = addslashes("$user->email.".time());
|
||||
$updateuser->email = '';
|
||||
$updateuser->idnumber = '';
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record('user', $updateuser)) {
|
||||
role_unassign(0, $user->id);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$keyword = optional_param('keyword', '', PARAM_RAW);
|
||||
$autodetect = optional_param('autodetect', '', PARAM_RAW);
|
||||
$del = optional_param('del', '', PARAM_RAW);
|
||||
$delall = optional_param('delall', '', PARAM_RAW);
|
||||
$ignore = optional_param('ignore', '', PARAM_RAW);
|
||||
$reset = optional_param('reset', '', PARAM_RAW);
|
||||
$id = optional_param('id', '', PARAM_INT);
|
||||
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportspamcleaner', $adminroot);
|
||||
|
||||
// Implement some AJAX calls
|
||||
|
||||
// Delete one user
|
||||
if (!empty($del) && confirm_sesskey() && ($id != $USER->id)) {
|
||||
if (isset($SESSION->users_result[$id])) {
|
||||
$user = $SESSION->users_result[$id];
|
||||
if (delete_user($user)) {
|
||||
unset($SESSION->users_result[$id]);
|
||||
echo 1;
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
// Delete lots of users
|
||||
if (!empty($delall) && confirm_sesskey()) {
|
||||
if (!empty($SESSION->users_result)) {
|
||||
foreach ($SESSION->users_result as $userid => $user) {
|
||||
if ($userid != $USER->id) {
|
||||
if (delete_user($user)) {
|
||||
unset($SESSION->users_result[$userid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!empty($ignore)) {
|
||||
unset($SESSION->users_result[$id]);
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
// Print headers and things
|
||||
|
||||
print_spamcleaner_javascript();
|
||||
|
||||
print_simple_box(get_string('spamcleanerintro', 'report_spamcleaner'));
|
||||
|
||||
?>
|
||||
|
||||
<div class="mdl-align">
|
||||
|
||||
<form method="post" action="index.php">
|
||||
<div>
|
||||
<input type="text" name="keyword" id="keyword_el" value="<?php p($keyword) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey();?>" />
|
||||
<input type="submit" value="<?php echo get_string('spamsearch', 'report_spamcleaner')?>" />
|
||||
</div>
|
||||
</form>
|
||||
<p><?php echo get_string('spameg', 'report_spamcleaner');?></p>
|
||||
|
||||
<hr />
|
||||
|
||||
<form method="post" action="index.php">
|
||||
<div>
|
||||
<input type="submit" name="autodetect" value="<?php echo get_string('spamauto', 'report_spamcleaner');?>" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
echo '<div id="result" class="mdl-align">';
|
||||
|
||||
// Print list of resulting profiles
|
||||
|
||||
if (!empty($keyword)) { // Use the keyword(s) supplied by the user
|
||||
$keywords = explode(',', $keyword);
|
||||
foreach ($keywords as $key => $keyword) {
|
||||
$keywords[$key] = trim($keyword);
|
||||
}
|
||||
search_spammers($keywords);
|
||||
|
||||
} else if (!empty($autodetect)) { // Use the inbuilt keyword list to detect users
|
||||
search_spammers($autokeywords);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/// Functions
|
||||
|
||||
|
||||
function search_spammers($keywords) {
|
||||
|
||||
global $CFG, $USER, $DB;
|
||||
|
||||
if (!is_array($keywords)) {
|
||||
$keywords = array($keywords); // Make it into an array
|
||||
}
|
||||
|
||||
$like = sql_ilike();
|
||||
|
||||
$keywordfull = array();
|
||||
foreach ($keywords as $keyword) {
|
||||
$keyword = addslashes($keyword); // Just to be safe
|
||||
$keywordfull[] = " description $like '%$keyword%' ";
|
||||
$keywordfull2[] = " p.summary $like '%$keyword%' ";
|
||||
}
|
||||
$conditions = '( '.implode(' OR ', $keywordfull).' )';
|
||||
$conditions2 = '( '.implode(' OR ', $keywordfull2).' )';
|
||||
|
||||
$sql = "SELECT * FROM {$CFG->prefix}user WHERE deleted = 0 AND id <> {$USER->id} AND $conditions"; // Exclude oneself
|
||||
$sql2= "SELECT u.*, p.summary FROM {$CFG->prefix}user AS u, {$CFG->prefix}post AS p WHERE $conditions2 AND u.deleted = 0 AND u.id=p.userid AND u.id <> {$USER->id}";
|
||||
$spamusers_desc = get_recordset_sql($sql);
|
||||
$spamusers_blog = get_recordset_sql($sql2);
|
||||
|
||||
$keywordlist = implode(', ', $keywords);
|
||||
print_simple_box(get_string('spamresult', 'report_spamcleaner').s($keywordlist)).' ...';
|
||||
|
||||
print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
|
||||
|
||||
}
|
||||
|
||||
function print_user_list($users_rs, $keywords) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
// reset session everytime this function is called
|
||||
$SESSION->users_result = array();
|
||||
$count = 0;
|
||||
|
||||
foreach ($users_rs as $rs) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if (!$count) {
|
||||
echo '<table border="1" width="100%" id="data-grid"><tr><th> </th><th>'.get_string('user','admin').'</th><th>'.get_string('spamdesc', 'report_spamcleaner').'</th><th>'.get_string('spamoperation', 'report_spamcleaner').'</th></tr>';
|
||||
}
|
||||
$count++;
|
||||
filter_user($user, $keywords, $count);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$count) {
|
||||
echo get_string('spamcannotfinduser', 'report_spamcleaner');
|
||||
|
||||
} else {
|
||||
echo '</table>';
|
||||
echo '<div class="mld-align">
|
||||
<button id="removeall_btn">'.get_string('spamdeleteall', 'report_spamcleaner').'</button>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
function filter_user($user, $keywords, $count) {
|
||||
global $CFG;
|
||||
$image_search = false;
|
||||
if (in_array('<img', $keywords)) {
|
||||
$image_search = true;
|
||||
}
|
||||
if (isset($user->summary)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'report_spamcleaner').'</h3>'.$user->summary;
|
||||
unset($user->summary);
|
||||
}
|
||||
if (preg_match('#<img.*src=[\"\']('.$CFG->pixpath.')#', $user->description, $matches)
|
||||
&& $image_search) {
|
||||
$result = false;
|
||||
foreach ($keywords as $keyword) {
|
||||
if (preg_match('#'.$keyword.'#', $user->description)
|
||||
&& ($keyword != '<img')) {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
echo print_user_entry($user, $keywords, $count);
|
||||
} else {
|
||||
unset($user);
|
||||
}
|
||||
} else {
|
||||
echo print_user_entry($user, $keywords, $count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function print_user_entry($user, $keywords, $count) {
|
||||
|
||||
global $SESSION, $CFG;
|
||||
|
||||
$smalluserobject = new object; // All we need to delete them later
|
||||
$smalluserobject->id = $user->id;
|
||||
$smalluserobject->email = $user->email;
|
||||
$smalluserobject->auth = $user->auth;
|
||||
$smalluserobject->firstname = $user->firstname;
|
||||
$smalluserobject->lastname = $user->lastname;
|
||||
|
||||
if (empty($SESSION->users_result[$user->id])) {
|
||||
$SESSION->users_result[$user->id] = $smalluserobject;
|
||||
$html = '<tr valign="top" id="row-'.$user->id.'" class="result-row">';
|
||||
$html .= '<td width="10">'.$count.'</td>';
|
||||
$html .= '<td width="30%" align="left"><a href="'.$CFG->wwwroot."/user/view.php?course=1&id=".$user->id.'" title="'.s($user->username).'">'.fullname($user).'</a>';
|
||||
|
||||
$html .= "<ul>";
|
||||
$profile_set = array('city'=>true, 'country'=>true, 'email'=>true);
|
||||
foreach ($profile_set as $key=>$value) {
|
||||
if (isset($user->$key)){
|
||||
$html .= '<li>'.$user->$key.'</li>';
|
||||
}
|
||||
}
|
||||
$html .= "</ul>";
|
||||
$html .= '</td>';
|
||||
|
||||
foreach ($keywords as $keyword) {
|
||||
$user->description = highlight($keyword, $user->description);
|
||||
}
|
||||
|
||||
$html .= '<td align="left">'.format_text($user->description, FORMAT_MOODLE).'</td>';
|
||||
$html .= '<td width="100px" align="center">';
|
||||
$html .= '<button onclick="del_user(this,'.$user->id.')">'.get_string('deleteuser', 'admin').'</button><br />';
|
||||
$html .= '<button onclick="ignore_user(this,'.$user->id.')">'.get_string('ignore', 'admin').'</button>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
return $html;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function print_spamcleaner_javascript() {
|
||||
global $CFG;
|
||||
|
||||
$sesskey = sesskey();
|
||||
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo $CFG->wwwroot;?>/lib/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $CFG->wwwroot;?>/lib/yui/connection/connection-min.js"></script>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var row = null;
|
||||
var delall_cb = {
|
||||
success: function(o){
|
||||
var resp = o.responseText;
|
||||
if(resp){
|
||||
window.location.href=window.location.href;
|
||||
}
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
YAHOO.util.Event.addListener("removeall_btn", "click", function(){
|
||||
var yes = confirm('<?php echo get_string('spamdeleteallconfirm', 'report_spamcleaner');?>');
|
||||
if(yes){
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST', '<?php echo me();?>?delall=yes&sesskey=<?php echo $sesskey;?>', delall_cb);
|
||||
}
|
||||
});
|
||||
}
|
||||
var del_cb = {
|
||||
success: function(o) {
|
||||
var resp = o.responseText;
|
||||
if(row) {
|
||||
if(resp){
|
||||
while(row.tagName != 'TR') {
|
||||
row = row.parentNode;
|
||||
}
|
||||
row.parentNode.removeChild(row);
|
||||
row = null;
|
||||
} else {
|
||||
alert('<?php echo get_string('spamcannotdelete', 'report_spamcleaner');?>');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var ignore_cb = {
|
||||
success: function(o){
|
||||
var resp = o.responseText;
|
||||
if(row) {
|
||||
if(resp){
|
||||
while(row.tagName != 'TR') {
|
||||
row = row.parentNode;
|
||||
}
|
||||
row.parentNode.removeChild(row);
|
||||
row = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function del_user(obj, id) {
|
||||
var yes = confirm('<?php echo get_string('spamdeleteconfirm', 'report_spamcleaner');?>');
|
||||
if(yes){
|
||||
row = obj;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST', '<?php echo me();?>?del=yes&sesskey=<?php echo $sesskey;?>&id='+id, del_cb);
|
||||
}
|
||||
}
|
||||
function ignore_user(obj, id) {
|
||||
row = obj;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST', '<?php echo me();?>?ignore=yes&sesskey=<?php echo $sesskey;?>&id='+id, ignore_cb);
|
||||
}
|
||||
window.onload = function(){
|
||||
init();
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
// spam cleaner
|
||||
$ADMIN->add('reports', new admin_externalpage('reportspamcleaner', get_string('spamcleaner','report_spamcleaner'), "$CFG->wwwroot/$CFG->admin/report/spamcleaner/index.php", 'moodle/site:config'));
|
||||
|
||||
+24
-13
@@ -23,18 +23,33 @@
|
||||
document.assignform.remove.disabled=false;
|
||||
document.assignform.addselect.selectedIndex=-1;" />
|
||||
<?php
|
||||
foreach ($contextusers as $contextuser) {
|
||||
$fullname = fullname($contextuser, true);
|
||||
echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email."</option>\n";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($contextusers as $contextuser) {
|
||||
$fullname = fullname($contextuser, true);
|
||||
if ($contextuser->hidden) {
|
||||
$hidden=' ('.get_string('hiddenassign').') ';
|
||||
} else {
|
||||
$hidden="";
|
||||
}
|
||||
echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email.$hidden."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
if ($i==0) {
|
||||
echo '<option/>'; // empty select breaks xhtml strict
|
||||
}
|
||||
?>
|
||||
|
||||
</select></td>
|
||||
<td valign="top">
|
||||
<label title="<?php print_string('hiddenassign') ?>">
|
||||
<input type="checkbox" name="hidden" value="1" />
|
||||
<img src="<?php echo $CFG->pixpath; ?>/t/hide.gif" alt="<?php print_string('hiddenassign') ?>" class="hide-show-image" /> <?
|
||||
helpbutton ('hiddenassign', get_string('hiddenassign'));
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
<input name="add" type="submit" id="add" value="←" />
|
||||
<br />
|
||||
<input name="remove" type="submit" id="remove" value="→" />
|
||||
<input name="add" id="add" type="submit" value="<?php echo ' '.$THEME->larrow.' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo ' '.get_string('remove'). ' '.$THEME->rarrow.' '; ?>" title="<?php print_string('remove'); ?>" />
|
||||
<br />
|
||||
</td>
|
||||
<td valign="top">
|
||||
@@ -46,13 +61,11 @@
|
||||
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
|
||||
while (! $availableusers->EOF) {
|
||||
$user = $availableusers->FetchObj();
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
if (!isset($contextusers[$user->id])) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
}
|
||||
$availableusers->MoveNext();
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
|
||||
@@ -61,13 +74,11 @@
|
||||
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
|
||||
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
|
||||
} else {
|
||||
while (! $availableusers->EOF) {
|
||||
$user = $availableusers->FetchObj();
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
if (!isset($contextusers[$user->id])) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
}
|
||||
$availableusers->MoveNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-1
@@ -157,8 +157,25 @@
|
||||
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$topleveladmin = false;
|
||||
|
||||
// we only worry about this if the role has doanything capability at site level
|
||||
if ($context->id == $sitecontext->id && $adminroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $sitecontext)) {
|
||||
foreach ($adminroles as $adminrole) {
|
||||
if ($adminrole->id == $roleid) {
|
||||
$topleveladmin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($frm->removeselect as $removeuser) {
|
||||
$removeuser = clean_param($removeuser, PARAM_INT);
|
||||
|
||||
if ($topleveladmin && ($removeuser == $USER->id)) { // Prevent unassigning oneself from being admin
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! role_unassign($roleid, $removeuser, 0, $context->id)) {
|
||||
$errors[] = "Could not remove user with id $removeuser from this role!";
|
||||
} else if ($inmeta) {
|
||||
@@ -181,12 +198,16 @@
|
||||
|
||||
print_heading_with_help(get_string('assignroles', 'role'), 'assignroles');
|
||||
|
||||
if ($context->contextlevel==CONTEXT_SYSTEM) {
|
||||
print_simple_box(get_string('globalroleswarning', 'role'));
|
||||
}
|
||||
|
||||
if ($roleid) { /// prints a form to swap roles
|
||||
|
||||
/// Get all existing participants in this context.
|
||||
// Why is this not done with get_users???
|
||||
|
||||
if (!$contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email')) {
|
||||
if (!$contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email, r.hidden')) {
|
||||
$contextusers = array();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
$cancel = optional_param('cancel', 0, PARAM_BOOL);
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
require_capability('moodle/role:manage', $sitecontext);
|
||||
|
||||
if ($cancel) {
|
||||
redirect('manage.php');
|
||||
@@ -224,9 +225,9 @@
|
||||
if (array_key_exists($roleid, $roles) and confirm_sesskey()) {
|
||||
$role = $roles[$roleid];
|
||||
if ($role->sortorder + 1 < $rolescount) {
|
||||
$bellow = $roles[$rolesort[$role->sortorder + 1]];
|
||||
$below = $roles[$rolesort[$role->sortorder + 1]];
|
||||
|
||||
if (!switch_roles($role, $bellow)) {
|
||||
if (!switch_roles($role, $below)) {
|
||||
error("Cannot move role with ID $roleid");
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -18,17 +18,17 @@ $CFG->adminsearchquery = $query; // So we can reference it in search boxes late
|
||||
$statusmsg = '';
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
$data = (array)$data;
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
if (confirm_sesskey()) {
|
||||
$olddbsessions = !empty($CFG->dbsessions);
|
||||
$changedsettings = search_settings(admin_get_root(), $query);
|
||||
$errors = '';
|
||||
|
||||
foreach($changedsettings as $changedsetting) {
|
||||
if (!isset($data['s_' . $changedsetting->name])) {
|
||||
$data['s_' . $changedsetting->name] = ''; // needed for checkboxes
|
||||
if (!isset($unslashed['s_' . $changedsetting->name])) {
|
||||
$unslashed['s_' . $changedsetting->name] = ''; // needed for checkboxes
|
||||
}
|
||||
$errors .= $changedsetting->write_setting($data['s_' . $changedsetting->name]);
|
||||
$errors .= $changedsetting->write_setting($unslashed['s_' . $changedsetting->name]);
|
||||
}
|
||||
|
||||
if ($olddbsessions != !empty($CFG->dbsessions)) {
|
||||
@@ -69,6 +69,7 @@ if ($resultshtml != '') {
|
||||
} else {
|
||||
echo get_string('noresults','admin');
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
+2
-1
@@ -58,7 +58,8 @@ $statusmsg = '';
|
||||
if ($data = data_submitted()) {
|
||||
if (confirm_sesskey()) {
|
||||
$olddbsessions = !empty($CFG->dbsessions);
|
||||
$errors = $root->write_settings((array)$data);
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
$errors = $root->write_settings($unslashed);
|
||||
//force logout if dbsession setting changes
|
||||
if ($olddbsessions != !empty($CFG->dbsessions)) {
|
||||
require_logout();
|
||||
|
||||
@@ -123,6 +123,10 @@ $temp = new admin_settingpage('gradebook', get_string('gradebook', 'admin'));
|
||||
$temp->add(new admin_setting_special_gradebookroles());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for coursemanager (what roles to display)
|
||||
$temp = new admin_settingpage('coursemanager', get_string('coursemanager', 'admin'));
|
||||
$temp->add(new admin_setting_special_coursemanager());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$ADMIN->add('appearance', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ $temp = new admin_settingpage('locationsettings', get_string('locationsettings',
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('serverlocaltime');
|
||||
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_countries();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
$temp = new admin_settingpage('sitepolicies', get_string('sitepolicies', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('maxbytes', get_string('maxbytes', 'admin'), get_string('configmaxbytes', 'admin'), 0, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('messaging', get_string('messaging', 'admin'), get_string('configmessaging','admin'), 1));
|
||||
@@ -32,6 +32,7 @@ $temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', '
|
||||
2 => get_string('groupblogs','blog'),
|
||||
1 => get_string('personalblogs','blog'),
|
||||
0 => get_string('disableblogs','blog'))));
|
||||
$temp->add(new admin_setting_configcheckbox('profilesforenrolledusersonly', get_string('profilesforenrolledusersonly','admin'),get_string('configprofilesforenrolledusersonly', 'admin'),'1'));
|
||||
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
@@ -87,8 +88,8 @@ $ADMIN->add('security', $temp);
|
||||
// "antivirus" settingpage
|
||||
$temp = new admin_settingpage('antivirus', get_string('antivirus', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('runclamonupload', get_string('runclamavonupload', 'admin'), get_string('configrunclamavonupload', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('pathtoclam', get_string('pathtoclam', 'admin'), get_string('configpathtoclam', 'admin'), '', PARAM_PATH));
|
||||
$temp->add(new admin_setting_configtext('quarantinedir', get_string('quarantinedir', 'admin'), get_string('configquarantinedir', 'admin'), '', PARAM_PATH));
|
||||
$temp->add(new admin_setting_configtext('pathtoclam', get_string('pathtoclam', 'admin'), get_string('configpathtoclam', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('quarantinedir', get_string('quarantinedir', 'admin'), get_string('configquarantinedir', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configselect('clamfailureonupload', get_string('clamfailureonupload', 'admin'), get_string('configclamfailureonupload', 'admin'), 'donothing', array('donothing' => get_string('configclamdonothing', 'admin'),
|
||||
'actlikevirus' => get_string('configclamactlikevirus', 'admin'))));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
@@ -7,10 +7,10 @@ $temp = new admin_settingpage('systempaths', get_string('systempaths','admin'));
|
||||
$temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'),
|
||||
'1' => get_string('gd1'),
|
||||
'2' => get_string('gd2'))));
|
||||
$temp->add(new admin_setting_configtext('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), '', PARAM_PATH));
|
||||
$temp->add(new admin_setting_configtext('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), '', PARAM_PATH));
|
||||
$temp->add(new admin_setting_configtext('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), '', PARAM_PATH));
|
||||
$temp->add(new admin_setting_configtext('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), '', PARAM_PATH));
|
||||
$temp->add(new admin_setting_configtext('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$ADMIN->add('server', $temp, 0);
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ $ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('upload
|
||||
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
|
||||
$ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php"));
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $sitecontext->id));
|
||||
$ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $sitecontext->id));
|
||||
|
||||
|
||||
// "userpolicies" settingpage
|
||||
|
||||
@@ -24,14 +24,14 @@ if ($newsettingshtml == '') {
|
||||
|
||||
// now we'll deal with the case that the admin has submitted the form with new settings
|
||||
if ($data = data_submitted()) {
|
||||
$data = (array)$data;
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
if (confirm_sesskey()) {
|
||||
$newsettings = find_new_settings(admin_get_root());
|
||||
$errors = '';
|
||||
|
||||
foreach($newsettings as $newsetting) {
|
||||
if (isset($data['s_' . $newsetting->name])) {
|
||||
$errors .= $newsetting->write_setting($data['s_' . $newsetting->name]);
|
||||
if (isset($unslashed['s_' . $newsetting->name])) {
|
||||
$errors .= $newsetting->write_setting($unslashed['s_' . $newsetting->name]);
|
||||
} else {
|
||||
$errors .= $newsetting->write_setting($newsetting->defaultsetting);
|
||||
}
|
||||
|
||||
@@ -270,7 +270,6 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
//This can be used to obtain a list of userids for existing users
|
||||
notify("$olduser->id ".get_string('usernotaddedregistered', 'error', $username));
|
||||
$userserrors++;
|
||||
continue;
|
||||
}
|
||||
|
||||
} else { // new user
|
||||
@@ -424,4 +423,3 @@ function my_file_get_contents($filename, $use_include_path = 0) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+7
-2
@@ -86,6 +86,11 @@
|
||||
admin_externalpage_setup('editusers', $adminroot);
|
||||
}
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
|
||||
if ($newuser) { // Create a new user
|
||||
|
||||
@@ -111,7 +116,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
redirect("$CFG->wwwroot/user/edit.php?id=$user->id&course=$site->id");
|
||||
redirect("$securewwwroot/user/edit.php?id=$user->id&course=$site->id");
|
||||
|
||||
} else { // List all users for editing
|
||||
|
||||
@@ -330,7 +335,7 @@
|
||||
}
|
||||
|
||||
if (has_capability('moodle/user:update', $sitecontext)) {
|
||||
$editbutton = "<a href=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</a>";
|
||||
$editbutton = "<a href=\"$securewwwroot/user/edit.php?id=$user->id&course=$site->id\">$stredit</a>";
|
||||
if ($user->confirmed == 0) {
|
||||
$confirmbutton = "<a href=\"user.php?confirmuser=$user->id&sesskey=$USER->sesskey\">" . get_string('confirm') . "</a>";
|
||||
} else {
|
||||
|
||||
@@ -114,6 +114,8 @@ class test extends XMLDBAction {
|
||||
$table->addIndexInfo('course', XMLDB_INDEX_NOTUNIQUE, array('course'));
|
||||
$table->addIndexInfo('rsstype', XMLDB_INDEX_UNIQUE, array('rsstype'));
|
||||
|
||||
$table->setComment("This is a test'n drop table. You can drop it safely");
|
||||
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
$test->sql = $table->getCreateTableSQL($CFG->dbtype, $CFG->prefix, true);
|
||||
@@ -275,7 +277,7 @@ class test extends XMLDBAction {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
$field = new XMLDBField('grade');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'test');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, "test'n drop");
|
||||
|
||||
$test->sql = $table->getAlterFieldSQL($CFG->dbtype, $CFG->prefix, $field, true);
|
||||
$test->status = change_field_type($table, $field, false, false);
|
||||
@@ -775,7 +777,7 @@ class test extends XMLDBAction {
|
||||
if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
|
||||
delete_records('newnameforthetable', 'id', $new->id);
|
||||
$newtextlen = $textlib->strlen($new->intro, current_charset());
|
||||
if ($rec->intro === $new->intro) {
|
||||
if ($fulltext === $new->intro) {
|
||||
$test->sql = array($newtextlen . ' cc. (text) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
@@ -804,7 +806,7 @@ class test extends XMLDBAction {
|
||||
if ($rec->id = insert_record('newnameforthetable', $rec)) {
|
||||
if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
|
||||
$newtextlen = strlen($new->avatar);
|
||||
if ($rec->avatar === $new->avatar) {
|
||||
if ($fulltext === $new->avatar) {
|
||||
$test->sql = array($newtextlen . ' bytes (binary) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
@@ -837,7 +839,7 @@ class test extends XMLDBAction {
|
||||
if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
|
||||
$newtextlen = $textlib->strlen($new->intro, current_charset());
|
||||
$newimglen = strlen($new->avatar);
|
||||
if ($rec->avatar === $new->avatar && $rec->intro === $new->intro) {
|
||||
if ($basetext === $new->avatar && $basetext === $new->intro) {
|
||||
$test->sql = array($newtextlen . ' cc. (text) sent and received ok',
|
||||
$newimglen . ' bytes (binary) sent and received ok');
|
||||
$test->status = true;
|
||||
@@ -874,7 +876,7 @@ class test extends XMLDBAction {
|
||||
if (set_field('newnameforthetable', 'intro', $rec->intro, 'name', $rec->name)) {
|
||||
if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
|
||||
$newtextlen = $textlib->strlen($new->intro);
|
||||
if ($rec->intro === $new->intro) {
|
||||
if ($fulltext === $new->intro) {
|
||||
$test->sql = array($newtextlen . ' cc. (text) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
@@ -904,7 +906,7 @@ class test extends XMLDBAction {
|
||||
if (set_field('newnameforthetable', 'avatar', $rec->avatar, 'name', $rec->name)) {
|
||||
if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
|
||||
$newtextlen = strlen($new->avatar);
|
||||
if ($rec->avatar === $new->avatar) {
|
||||
if ($fulltext === $new->avatar) {
|
||||
$test->sql = array($newtextlen . ' bytes (binary) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
|
||||
@@ -133,7 +133,7 @@ class view_reserved_words extends XMLDBAction {
|
||||
|
||||
/// The textarea showing all the reserved words
|
||||
$o.= ' <table id="formelements" align="center" cellpadding="5">';
|
||||
$o.= ' <tr><td align="center">' . $this->str['listreservedwords'];
|
||||
$o.= ' <tr><td align="center">' . $this->str['listreservedwords'].'</td></tr>';
|
||||
$o.= ' <tr><td><textarea cols="80" rows="32">';
|
||||
$o.= s(implode(', ', $reserved_words));
|
||||
$o.= '</textarea></td></tr>';
|
||||
|
||||
@@ -211,7 +211,7 @@ class view_structure_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch create table for ' . $table->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && create_table($table);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && create_table($table);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -249,7 +249,7 @@ class view_structure_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch drop table for ' . $table->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && drop_table($table);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && drop_table($table);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -287,7 +287,7 @@ class view_structure_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch rename table for ' . $table->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && rename_table($table, ' . "'NEWNAMEGOESHERE'" . ');' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && rename_table($table, ' . "'NEWNAMEGOESHERE'" . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -336,7 +336,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch add field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && add_field($table, $field);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && add_field($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -379,7 +379,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch drop field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && drop_field($table, $field);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && drop_field($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -422,7 +422,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch rename field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && rename_field($table, $field, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && rename_field($table, $field, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -475,7 +475,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch change of type for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && change_field_type($table, $field);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_type($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -525,7 +525,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch change of precision for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && change_field_precision($table, $field);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_precision($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -571,7 +571,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch change of sign for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && change_field_unsigned($table, $field);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_unsigned($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -617,7 +617,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch change of nullability for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && change_field_notnull($table, $field);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_notnull($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -664,7 +664,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch change of list of values for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && change_field_enum($table, $field);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_enum($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -710,7 +710,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch change of default for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && change_field_default($table, $field);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_default($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -754,7 +754,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch add key ' . $key->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && add_key($table, $key);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && add_key($table, $key);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -798,7 +798,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch drop key ' . $key->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && drop_key($table, $key);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && drop_key($table, $key);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -845,7 +845,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch rename key ' . $key->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && rename_key($table, $key, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && rename_key($table, $key, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -889,7 +889,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch add index ' . $index->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && add_index($table, $index);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && add_index($table, $index);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -933,7 +933,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch drop index ' . $index->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && drop_index($table, $index);' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && drop_index($table, $index);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
@@ -980,7 +980,7 @@ class view_table_php extends XMLDBAction {
|
||||
/// Launch the proper DDL
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Launch rename index ' . $index->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $status = $status && rename_index($table, $index, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && rename_index($table, $index, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
/// getting "incomplete" objects
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/ddllib.php'); // Install/upgrade related db functions
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('xmldbeditor', $adminroot);
|
||||
|
||||
|
||||
@@ -112,7 +112,3 @@
|
||||
<?php
|
||||
include($CFG->dirroot.'/auth/ldap/config.html');
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,4 +15,3 @@
|
||||
print_footer();
|
||||
exit;
|
||||
?>
|
||||
|
||||
|
||||
+14
-7
@@ -22,7 +22,8 @@ function auth_user_login ($username, $password) {
|
||||
|
||||
// Connect to the external database
|
||||
$authdb = &ADONewConnection($CFG->auth_dbtype);
|
||||
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
||||
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
||||
$authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection
|
||||
|
||||
if ($CFG->auth_dbpasstype === 'internal') {
|
||||
// lookup username externally, but resolve
|
||||
@@ -92,6 +93,7 @@ function auth_get_userinfo($username){
|
||||
ADOLoadCode($CFG->auth_dbtype);
|
||||
$authdb = &ADONewConnection();
|
||||
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
||||
$authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection
|
||||
|
||||
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
|
||||
"department", "address", "city", "country", "description",
|
||||
@@ -101,15 +103,17 @@ function auth_get_userinfo($username){
|
||||
|
||||
foreach ($fields as $field) {
|
||||
if ($pcfg["field_map_$field"]) {
|
||||
if ($rs = $authdb->Execute("SELECT ".$pcfg["field_map_$field"]." FROM $CFG->auth_dbtable
|
||||
if ($rs = $authdb->Execute("SELECT ".$pcfg["field_map_$field"]." as myfield FROM $CFG->auth_dbtable
|
||||
WHERE $CFG->auth_dbfielduser = '$username'")) {
|
||||
if ( $rs->RecordCount() == 1 ) {
|
||||
$fields_obj = rs_fetch_record($rs);
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
$result["$field"] = addslashes(stripslashes($rs->fields[0]));
|
||||
$result["$field"] = addslashes(stripslashes($fields_obj->myfield));
|
||||
} else {
|
||||
$result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields[0])));
|
||||
$result["$field"] = addslashes(stripslashes(utf8_decode($fields_obj->myfield)));
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -302,6 +306,7 @@ function auth_user_exists ($username) {
|
||||
global $CFG;
|
||||
$authdb = &ADONewConnection($CFG->auth_dbtype);
|
||||
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
||||
$authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection
|
||||
|
||||
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
|
||||
WHERE $CFG->auth_dbfielduser = '$username' ");
|
||||
@@ -334,6 +339,7 @@ function auth_get_userlist() {
|
||||
// Connect to the external database
|
||||
$authdb = &ADONewConnection($CFG->auth_dbtype);
|
||||
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
||||
$authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection
|
||||
|
||||
// fetch userlist
|
||||
$rs = $authdb->Execute("SELECT $CFG->auth_dbfielduser AS username
|
||||
@@ -347,9 +353,10 @@ function auth_get_userlist() {
|
||||
|
||||
if ( $rs->RecordCount() ) {
|
||||
$userlist = array();
|
||||
while ($rec = $rs->FetchRow()) {
|
||||
array_push($userlist, $rec['username']);
|
||||
while ($rec = rs_fetch_next_record($rs)) {
|
||||
array_push($userlist, $rec->username);
|
||||
}
|
||||
rs_close($rs);
|
||||
return $userlist;
|
||||
} else {
|
||||
return array();
|
||||
@@ -459,4 +466,4 @@ function auth_validate_form(&$form, &$err) {
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@
|
||||
/* */
|
||||
/* 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. */
|
||||
/* the Free Software Foundation; either version 2 of the License or any */
|
||||
/* later version. */
|
||||
/************************************************************************/
|
||||
/* Author: Torsten Anderson, torsten.anderson@skeria.skelleftea.se
|
||||
*/
|
||||
|
||||
+61
-12
@@ -713,7 +713,7 @@ function auth_ldap_bulk_insert($users){
|
||||
// bulk insert -- superfast with $bulk_insert_records
|
||||
$sql = 'INSERT INTO '.$CFG->prefix.'extuser (idnumber) VALUES ';
|
||||
// make those values safe
|
||||
array_map('addslashes', $users);
|
||||
$users = array_map('addslashes', $users);
|
||||
// join and quote the whole lot
|
||||
$sql = $sql . '(\'' . join('\'),(\'', $users) . '\')';
|
||||
print "+ " . count($users) . " users\n";
|
||||
@@ -817,13 +817,27 @@ function auth_user_update($olduser, $newuser) {
|
||||
global $USER , $CFG;
|
||||
|
||||
$pcfg = get_config('auth/ldap');
|
||||
|
||||
|
||||
$attrmap = auth_ldap_attributes();
|
||||
|
||||
// Before doing anything else, make sure we really need to update anything
|
||||
// in the external LDAP server.
|
||||
$update_external = false;
|
||||
foreach ($attrmap as $key => $ldapkeys) {
|
||||
if (!empty($pcfg->{'field_updateremote_'.$key})) {
|
||||
$update_external = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$update_external) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$ldapconnection = auth_ldap_connect();
|
||||
|
||||
$result = array();
|
||||
$search_attribs = array();
|
||||
|
||||
$attrmap = auth_ldap_attributes();
|
||||
foreach ($attrmap as $key=>$values) {
|
||||
if (!is_array($values)) {
|
||||
$values = array($values);
|
||||
@@ -842,8 +856,18 @@ function auth_user_update($olduser, $newuser) {
|
||||
if ($user_info_result){
|
||||
|
||||
$user_entry = auth_ldap_get_entries($ldapconnection, $user_info_result);
|
||||
if (count($user_entry) > 1) {
|
||||
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
|
||||
if (empty($user_entry)) {
|
||||
$error = 'ldap: Could not find user while updating externally. '.
|
||||
'Details follow: search base: \''.$user_dn.'\'; search filter: \''.
|
||||
$CFG->ldap_objectclass.'\'; search attributes: ';
|
||||
foreach ($search_attribs as $attrib) {
|
||||
$error .= $attrib.' ';
|
||||
}
|
||||
error_log($error);
|
||||
return false; // old user not found!
|
||||
} else if (count($user_entry) > 1) {
|
||||
error_log('ldap: Strange! More than one user record found in ldap. Only using the first one.');
|
||||
return false;
|
||||
}
|
||||
$user_entry = $user_entry[0];
|
||||
|
||||
@@ -1002,15 +1026,33 @@ function auth_user_update_password($username, $newpassword) {
|
||||
. ldap_err2str(ldap_errno($ldapconnection)));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ad':
|
||||
// Passwords in Active Directory must be encoded as Unicode
|
||||
// strings (UCS-2 Little Endian format) and surrounded with
|
||||
// double quotes. See http://support.microsoft.com/?kbid=269190
|
||||
if (!function_exists('mb_convert_encoding')) {
|
||||
error_log ('You need the mbstring extension to change passwords in Active Directory');
|
||||
return false;
|
||||
}
|
||||
$newpassword = mb_convert_encoding('"'.$newpassword.'"', "UCS-2LE", "auto");
|
||||
$result = ldap_modify($ldapconnection, $user_dn, array('unicodePwd' => $newpassword));
|
||||
if(!$result){
|
||||
error_log('LDAP Error in auth_user_update_password(). Error code: '
|
||||
. ldap_errno($ldapconnection) . '; Error string : '
|
||||
. ldap_err2str(ldap_errno($ldapconnection)));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$usedconnection = &$ldapconnection;
|
||||
// send ldap the password in cleartext, it will md5 it itself
|
||||
$result = ldap_modify($ldapconnection, $user_dn, array('userPassword' => $newpassword));
|
||||
if(!$result){
|
||||
error_log('LDAP Error in auth_user_update_password(). Error code: '
|
||||
. ldap_errno($ldapconnection) . '; Error string : '
|
||||
. ldap_err2str(ldap_errno($ldapconnection)));
|
||||
}
|
||||
if(!$result){
|
||||
error_log('LDAP Error in auth_user_update_password(). Error code: '
|
||||
. ldap_errno($ldapconnection) . '; Error string : '
|
||||
. ldap_err2str(ldap_errno($ldapconnection)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1162,8 +1204,10 @@ function auth_ldap_init () {
|
||||
}
|
||||
}
|
||||
//hack prefix to objectclass
|
||||
if ('objectClass=' != substr($CFG->ldap_objectclass, 0, 12)) {
|
||||
$CFG->ldap_objectclass = 'objectClass='.$CFG->ldap_objectclass;
|
||||
if (empty($CFG->ldap_objectclass)) { // Can't send empty filter
|
||||
$CFG->ldap_objectclass = 'objectClass=*';
|
||||
} else if (stripos($CFG->ldap_objectclass, 'objectClass=') !== 0) {
|
||||
$CFG->ldap_objectclass = 'objectClass='.$CFG->ldap_objectclass;
|
||||
}
|
||||
|
||||
//all chages go in $CFG , no need to return value
|
||||
@@ -1318,6 +1362,11 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
|
||||
ldap_set_option($connresult, LDAP_OPT_PROTOCOL_VERSION, $CFG->ldap_version);
|
||||
}
|
||||
|
||||
// Fix MDL-10921
|
||||
if ($CFG->ldap_user_type == 'ad') {
|
||||
ldap_set_option($connresult, LDAP_OPT_REFERRALS, 0);
|
||||
}
|
||||
|
||||
if (!empty($binddn)){
|
||||
//bind with search-user
|
||||
//$debuginfo .= 'Using bind user'.$binddn.'and password:'.$bindpwd;
|
||||
|
||||
@@ -47,4 +47,3 @@ function auth_user_login ($username, $password) {
|
||||
$rauth->close();
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Changes:
|
||||
- 10. 2005: Added better error messages and moved text to language directories
|
||||
- 02. 2006: Simplified authentication so that authorization works properly
|
||||
Added instructions for IIS
|
||||
|
||||
- 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+
|
||||
|
||||
|
||||
Moodle Configuration with Dual login
|
||||
@@ -164,11 +164,6 @@ Example file:
|
||||
?>
|
||||
--
|
||||
|
||||
Bugs
|
||||
--------------------------------------------------------------------------------
|
||||
Please send bug reports concerning the Shibboleth part to
|
||||
Lukas Haemmerle <haemmerle@switch.ch>
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
In case of problems and questions with Shibboleth authentication, contact
|
||||
Lukas Haemmerle <haemmerle@switch.ch> or Markus Hagman <hagman@hytti.uku.fi>
|
||||
|
||||
@@ -56,6 +56,15 @@
|
||||
$urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
|
||||
unset($SESSION->wantsurl); /// Just in case
|
||||
}
|
||||
|
||||
/// Go to my-moodle page instead of homepage if mymoodleredirect enabled
|
||||
if (!has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM, SITEID)) and !empty($CFG->mymoodleredirect) and !isguest()) {
|
||||
if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
|
||||
$urltogo = $CFG->wwwroot.'/my/';
|
||||
}
|
||||
}
|
||||
|
||||
load_all_capabilities(); /// This is what lets the user do anything on the site :-)
|
||||
|
||||
redirect($urltogo);
|
||||
}
|
||||
|
||||
+20
-19
@@ -170,25 +170,10 @@
|
||||
return get_users_by_capability(get_context_instance(CONTEXT_COURSE, $courseid), 'moodle/course:view');
|
||||
}
|
||||
|
||||
//Returns all users (every record in users table)
|
||||
|
||||
//Returns all users ids (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;
|
||||
return get_records('user', '', '', '', 'id, id');
|
||||
}
|
||||
|
||||
//Calculate the number of log entries to backup
|
||||
@@ -1751,6 +1736,16 @@
|
||||
|
||||
global $CFG,$preferences;
|
||||
|
||||
//Use one static variable to cache all the require_once calls that,
|
||||
//under PHP5 seems to increase load too much, and we are requiring
|
||||
//them here thousands of times (one per content). MDL-8700.
|
||||
//Once fixed by PHP, we'll delete this hack
|
||||
|
||||
static $includedfiles;
|
||||
if (!isset($includedfiles)) {
|
||||
$includedfiles = array();
|
||||
}
|
||||
|
||||
//Check if preferences is ok. If it isn't set, we are
|
||||
//in a scheduled_backup to we are able to get a copy
|
||||
//from CFG->backup_preferences
|
||||
@@ -1770,8 +1765,14 @@
|
||||
$result = str_replace($search,$replace,$content);
|
||||
|
||||
foreach ($mypreferences->mods as $name => $info) {
|
||||
/// We only include the corresponding backuplib.php if it hasn't been included before
|
||||
/// This will save some load under PHP5. MDL-8700.
|
||||
/// Once fixed by PHP, we'll delete this hack
|
||||
if (!in_array($name, $includedfiles)) {
|
||||
include_once("$CFG->dirroot/mod/$name/backuplib.php");
|
||||
$includedfiles[] = $name;
|
||||
}
|
||||
//Check if the xxxx_encode_content_links exists
|
||||
include_once("$CFG->dirroot/mod/$name/backuplib.php");
|
||||
$function_name = $name."_encode_content_links";
|
||||
if (function_exists($function_name)) {
|
||||
$result = $function_name($result,$mypreferences);
|
||||
@@ -2222,4 +2223,4 @@
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
|
||||
|
||||
function get_subdirs($directory){
|
||||
$opendirectory = opendir( $directory );
|
||||
while($filename = readdir($opendirectory)) {
|
||||
while(false !== ($filename = readdir($opendirectory))) {
|
||||
if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
|
||||
$subdirs[] = $filename;
|
||||
}
|
||||
|
||||
+7
-6
@@ -7,10 +7,11 @@
|
||||
//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);
|
||||
return set_field("backup_config", "value", addslashes($value), "name", $name);
|
||||
} else {
|
||||
$config = new object();
|
||||
$config->name = $name;
|
||||
$config->value = $value;
|
||||
$config->value = addslashes($value);
|
||||
return insert_record("backup_config", $config);
|
||||
}
|
||||
}
|
||||
@@ -118,7 +119,7 @@
|
||||
}
|
||||
|
||||
// Loop through all directory entries, and construct two temporary arrays containing files and sub directories
|
||||
while($entry = readdir($handle)) {
|
||||
while(false !== ($entry = readdir($handle))) {
|
||||
if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) {
|
||||
$dir_subdirs[] = $dir. $slash .$entry;
|
||||
}
|
||||
@@ -195,7 +196,7 @@
|
||||
$results = null;
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -214,7 +215,7 @@
|
||||
$results = "";
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -301,7 +302,7 @@
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
}
|
||||
$dir = opendir($from_file);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -19,13 +19,24 @@
|
||||
|
||||
if ($form1 = data_submitted()) {
|
||||
$currentcourseshortname = $course_header->course_shortname; //"store_ShortName";
|
||||
$course_header->course_shortname = $form1->shortname; //"update_ShortName";
|
||||
$course_header->course_fullname = $form1->fullname; //"update_FullName";
|
||||
$form1->startdate = make_timestamp($form1->startyear, $form1->startmonth, $form1->startday);
|
||||
$currentcoursestartdate = $course_header->course_startdate;
|
||||
$coursestartdatedateoffset = $form1->startdate - $currentcoursestartdate;
|
||||
$restore->course_startdateoffset = $coursestartdatedateoffset; //change to restore
|
||||
}
|
||||
$course_header->course_shortname = $form1->shortname; //"update_ShortName";
|
||||
$course_header->course_fullname = $form1->fullname; //"update_FullName";
|
||||
/// Roll dates only if the backup course has a start date
|
||||
/// (some formats like main page, social..., haven't it and rolling dates
|
||||
/// from 0 produces crazy dates. MDL-10125
|
||||
if ($course_header->course_startdate) {
|
||||
$form1->startdate = make_timestamp($form1->startyear, $form1->startmonth, $form1->startday);
|
||||
$currentcoursestartdate = $course_header->course_startdate;
|
||||
$coursestartdatedateoffset = $form1->startdate - $currentcoursestartdate;
|
||||
$restore->course_startdateoffset = $coursestartdatedateoffset; //change to restore
|
||||
} else { // don't roll if the course hasn't start date
|
||||
$coursestartdatedateoffset = 0;
|
||||
$restore->course_startdateoffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
///Enforce SESSION->course_header rewrite (PHP 4.x needed because assigns are by value) MDL-8298
|
||||
$SESSION->course_header = $course_header;
|
||||
|
||||
//If restore session info exists, but we are coming from the form
|
||||
//it has prioriry
|
||||
|
||||
@@ -54,6 +54,15 @@
|
||||
print_simple_box(get_string("restorefinished"),"center");
|
||||
} else {
|
||||
print_simple_box(get_string("importdatafinished"),"center");
|
||||
$file = $CFG->dataroot . '/'
|
||||
. $SESSION->import_preferences->backup_course
|
||||
. '/backupdata/' . $SESSION->import_preferences->backup_name;
|
||||
if (is_readable($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
else {
|
||||
error_log("import course data: couldn't unlink $file");
|
||||
}
|
||||
unset($SESSION->restore);
|
||||
}
|
||||
print_continue("$CFG->wwwroot/course/view.php?id=".$restore->course_id);
|
||||
|
||||
@@ -169,15 +169,16 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "<td align=\"right\"><b>";
|
||||
echo get_string("restoreto").":</b>";
|
||||
echo "</td><td colspan=\"3\">";
|
||||
if (!has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
$restore_restoreto_options[0] = get_string("currentcoursedeleting");
|
||||
$restore_restoreto_options[1] = get_string("currentcourseadding");
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
$restore_restoreto_options[0] = get_string("existingcoursedeleting");
|
||||
$restore_restoreto_options[1] = get_string("existingcourseadding");
|
||||
$restore_restoreto_options[2] = get_string("newcourse");
|
||||
} else { // fix for MDL-7773
|
||||
$restore_restoreto_options[0] = get_string("currentcoursedeleting");
|
||||
$restore_restoreto_options[1] = get_string("currentcourseadding");
|
||||
}
|
||||
|
||||
choose_from_menu($restore_restoreto_options, "restore_restoreto", $restore_restoreto, "");
|
||||
echo "</td></tr>";
|
||||
if (iscreator()) { //display these fields conditionally
|
||||
@@ -200,7 +201,17 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "<td align=\"right\"> ";
|
||||
print_string("startdate");
|
||||
echo ":</td><td>";
|
||||
print_date_selector("startday", "startmonth", "startyear", $form1->startdate);
|
||||
/// Show the roll dates option only if the backup course has a start date
|
||||
/// (some formats like main page, social..., haven't it and rolling dates
|
||||
/// from 0 produces crazy dates. MDL-10125
|
||||
if ($form1->startdate) {
|
||||
print_date_selector("startday", "startmonth", "startyear", $form1->startdate);
|
||||
} else {
|
||||
print_string('notavailable');
|
||||
echo '<input type="hidden" name="startyear" value="0" />';
|
||||
echo '<input type="hidden" name="startmonth" value="0" />';
|
||||
echo '<input type="hidden" name="startday" value="0" />';
|
||||
}
|
||||
helpbutton("coursestartdate", get_string("startdate"));
|
||||
echo "</td></tr>";
|
||||
}
|
||||
|
||||
+163
-65
@@ -70,6 +70,44 @@
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo "<ul>";
|
||||
}
|
||||
|
||||
// Recode links in the course summary.
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>' . get_string('from') . ' ' . get_string('course');
|
||||
}
|
||||
$course = get_record('course', 'id', $restore->course_id, '', '', '', '', 'id,summary');
|
||||
$coursesummary = restore_decode_content_links_worker($course->summary, $restore);
|
||||
if ($coursesummary != $course->summary) {
|
||||
$course->summary = addslashes($coursesummary);
|
||||
if (!update_record('course', $course)) {
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
// Recode links in section summaries.
|
||||
$sections = get_records('course_sections', 'course', $restore->course_id, 'id', 'id,summary');
|
||||
if ($sections) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>' . get_string('from') . ' ' . get_string('sections');
|
||||
}
|
||||
foreach ($sections as $section) {
|
||||
$sectionsummary = restore_decode_content_links_worker($section->summary, $restore);
|
||||
if ($sectionsummary != $section->summary) {
|
||||
$section->summary = addslashes($sectionsummary);
|
||||
if (!update_record('course_sections', $section)) {
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
// Restore links in modules.
|
||||
foreach ($restore->mods as $name => $info) {
|
||||
//If the module is being restored
|
||||
if (isset($info->restore) && $info->restore == 1) {
|
||||
@@ -85,12 +123,23 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: process all html text also in blocks too
|
||||
|
||||
// Restore links in questions.
|
||||
require_once("$CFG->dirroot/question/restorelib.php");
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>' . get_string('from') . ' ' . get_string('questions', 'quiz');
|
||||
}
|
||||
$status = question_decode_content_links_caller($restore);
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
// TODO: process all html text also in blocks too
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -901,14 +950,18 @@
|
||||
// Yu: This part is called repeatedly for every instance,
|
||||
// so it is necessary to set the granular flag and check isset()
|
||||
// when the first instance of this type of mod is processed.
|
||||
if (!isset($restore->mods[$mod->type]->granular) && isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
// This defines whether we want to restore specific
|
||||
// instances of the modules (granular restore), or
|
||||
// whether we don't care and just want to restore
|
||||
// all module instances (non-granular).
|
||||
$restore->mods[$mod->type]->granular = true;
|
||||
} else {
|
||||
$restore->mods[$mod->type]->granular = false;
|
||||
//if (!isset($restore->mods[$mod->type]->granular) && isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
|
||||
if (!isset($restore->mods[$mod->type]->granular)) {
|
||||
if (isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
// This defines whether we want to restore specific
|
||||
// instances of the modules (granular restore), or
|
||||
// whether we don't care and just want to restore
|
||||
// all module instances (non-granular).
|
||||
$restore->mods[$mod->type]->granular = true;
|
||||
} else {
|
||||
$restore->mods[$mod->type]->granular = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if we've to restore this module (and instance)
|
||||
@@ -1111,7 +1164,7 @@
|
||||
if (!$preferencescount) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grade').'</li>';
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grades').'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,7 +1175,7 @@
|
||||
if ($pref_rec->value == 0) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('respectingcurrentdata','grade').'</li>';
|
||||
echo '<li>'.get_string('respectingcurrentdata','grades').'</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1138,7 +1191,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_preferences' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$counter,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1192,7 +1245,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_letter' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$counter,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1242,7 +1295,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_category' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$countercat,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1401,21 +1454,42 @@
|
||||
//in backup_ids->info will be the real info (serialized)
|
||||
$info = restore_read_xml_users($restore,$xml_file);
|
||||
}
|
||||
|
||||
|
||||
//Now, get evey user_id from $info and user data from $backup_ids
|
||||
//and create the necessary records (users, user_students, user_teachers
|
||||
//user_course_creators and user_admins
|
||||
if (!empty($info->users)) {
|
||||
//For each user, take its info from backup_ids
|
||||
foreach ($info->users as $userid) {
|
||||
$rec = backup_getid($restore->backup_unique_code,"user",$userid);
|
||||
$rec = backup_getid($restore->backup_unique_code,"user",$userid);
|
||||
$user = $rec->info;
|
||||
foreach (array_keys(get_object_vars($user)) as $field) {
|
||||
if (!is_array($user->$field)) {
|
||||
$user->$field = backup_todb($user->$field);
|
||||
if (is_null($user->$field)) {
|
||||
$user->$field = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now, recode some languages (Moodle 1.5)
|
||||
if ($user->lang == 'ma_nt') {
|
||||
$user->lang = 'mi_nt';
|
||||
}
|
||||
|
||||
//Country list updates - MDL-13060
|
||||
//Any user whose country code has been deleted or modified needs to be assigned a valid one.
|
||||
$country_update_map = array(
|
||||
'ZR' => 'CD',
|
||||
'TP' => 'TL',
|
||||
'FX' => 'FR',
|
||||
'KO' => 'RS',
|
||||
'CS' => 'RS',
|
||||
'WA' => 'GB');
|
||||
if (array_key_exists($user->country, $country_update_map)) {
|
||||
$user->country = $country_update_map[$user->country];
|
||||
}
|
||||
|
||||
//Check if it's admin and coursecreator
|
||||
$is_admin = !empty($user->roles['admin']);
|
||||
$is_coursecreator = !empty($user->roles['coursecreator']);
|
||||
@@ -1693,7 +1767,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $unreadcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -1758,7 +1832,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $readcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_read' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_read' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -1825,7 +1899,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $contactcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_contacts' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_contacts' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -1913,14 +1987,7 @@
|
||||
foreach ($info as $category) {
|
||||
//Skip empty categories (some backups can contain them)
|
||||
if (!empty($category->id)) {
|
||||
$catrestore = "restore_question_categories";
|
||||
if (function_exists($catrestore)) {
|
||||
//print_object ($category); //Debug
|
||||
$status = $catrestore($category,$restore);
|
||||
} else {
|
||||
//Something was wrong. Function should exist.
|
||||
$status = false;
|
||||
}
|
||||
$status = restore_question_categories($category,$restore);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2090,7 +2157,18 @@
|
||||
|
||||
//Now search if that group exists (by name and description field) in
|
||||
//restore->course_id course
|
||||
$gro_db = get_record("groups","courseid",$restore->course_id,"name",$gro->name,"description",$gro->description);
|
||||
//Going to compare LOB columns so, use the cross-db sql_compare_text() in both sides.
|
||||
$description_clause = '';
|
||||
if (!empty($gro->description)) { /// Only for groups having a description
|
||||
$literal_description = "'" . $gro->description . "'";
|
||||
$description_clause = " AND " .
|
||||
sql_compare_text('description') . " = " .
|
||||
sql_compare_text($literal_description);
|
||||
}
|
||||
$gro_db = get_record_sql("SELECT *
|
||||
FROM {$CFG->prefix}groups
|
||||
WHERE courseid = $restore->course_id AND
|
||||
name = '{$gro->name}'" . $description_clause);
|
||||
//If it doesn't exist, create
|
||||
if (!$gro_db) {
|
||||
$create_group = true;
|
||||
@@ -2262,19 +2340,6 @@
|
||||
//Assign it to admin
|
||||
$eve->userid = $adminid;
|
||||
}
|
||||
|
||||
//We must recode the repeatid if the event has it
|
||||
if (!empty($eve->repeatid)) {
|
||||
$repeat_rec = backup_getid($restore->backup_unique_code,"event_repeatid",$eve->repeatid);
|
||||
if ($repeat_rec) { //Exists, so use it...
|
||||
$eve->repeatid = $repeat_rec->new_id;
|
||||
} else { //Doesn't exists, calculate the next and save it
|
||||
$oldrepeatid = $eve->repeatid;
|
||||
$max_rec = get_record_sql('SELECT 1, MAX(repeatid) AS repeatid FROM '.$CFG->prefix.'event');
|
||||
$eve->repeatid = empty($max_rec) ? 1 : $max_rec->repeatid + 1;
|
||||
backup_putid($restore->backup_unique_code,"event_repeatid", $oldrepeatid, $eve->repeatid);
|
||||
}
|
||||
}
|
||||
|
||||
//We have to recode the groupid field
|
||||
$group = backup_getid($restore->backup_unique_code,"groups",$eve->groupid);
|
||||
@@ -2287,6 +2352,22 @@
|
||||
|
||||
//The structure is equal to the db, so insert the event
|
||||
$newid = insert_record ("event",$eve);
|
||||
|
||||
//We must recode the repeatid if the event has it
|
||||
//The repeatid now refers to the id of the original event. (see Bug#5956)
|
||||
if ($newid && !empty($eve->repeatid)) {
|
||||
$repeat_rec = backup_getid($restore->backup_unique_code,"event_repeatid",$eve->repeatid);
|
||||
if ($repeat_rec) { //Exists, so use it...
|
||||
$eve->repeatid = $repeat_rec->new_id;
|
||||
} else { //Doesn't exists, calculate the next and save it
|
||||
$oldrepeatid = $eve->repeatid;
|
||||
$eve->repeatid = $newid;
|
||||
backup_putid($restore->backup_unique_code,"event_repeatid", $oldrepeatid, $eve->repeatid);
|
||||
}
|
||||
$eve->id = $newid;
|
||||
// update the record to contain the correct repeatid
|
||||
update_record('event',$eve);
|
||||
}
|
||||
} else {
|
||||
//get current event id
|
||||
$newid = $eve_db->id;
|
||||
@@ -2599,7 +2680,7 @@
|
||||
while ($counter < $count_logs) {
|
||||
//Get a chunk of records
|
||||
//Take old_id twice to avoid adodb limitation
|
||||
$logs = get_records_select("backup_ids","table_name = 'log' AND backup_code = '$restore->backup_unique_code'","old_id","old_id,old_id",$counter,$recordset_size);
|
||||
$logs = get_records_select("backup_ids","table_name = 'log' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
//We have logs
|
||||
if ($logs) {
|
||||
//Iterate
|
||||
@@ -4411,7 +4492,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($this->level == 6 && $this->tree[5]!="ROLE_ASSIGNMENTS" && $this->tree[5]!="ROLE_OVERRIDES") {
|
||||
if ($this->level == 6 && $this->tree[5]!="ROLES_ASSIGNMENTS" && $this->tree[5]!="ROLES_OVERRIDES") {
|
||||
switch ($tagName) {
|
||||
case "ROLE":
|
||||
//We've finalized a role, get it
|
||||
@@ -4426,7 +4507,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->level == 7 && $this->tree[5]!="ROLE_ASSIGNMENTS" && $this->tree[5]!="ROLE_OVERRIDES") {
|
||||
if ($this->level == 7) {
|
||||
switch ($tagName) {
|
||||
case "TYPE":
|
||||
$this->info->temprole->type = $this->getContents();
|
||||
@@ -5825,9 +5906,9 @@
|
||||
}
|
||||
if (!$status = restore_decode_content_links($restore)) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
notify("Could not refresh events for activities!");
|
||||
notify("Could not decode content links!");
|
||||
} else {
|
||||
$errorstr = "Could not refresh events for activities!";
|
||||
$errorstr = "Could not decode content links!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -6012,12 +6093,24 @@
|
||||
// the following code creates new roles
|
||||
// but we could use more intelligent detection, and role mapping
|
||||
// get role mapping info from $restore
|
||||
$rolemappings = array();
|
||||
|
||||
$rolemappings = $restore->rolesmapping; // an array
|
||||
if ($info->roles) {
|
||||
foreach ($info->roles as $oldroleid=>$roledata) {
|
||||
if (!empty($restore->rolesmapping)) {
|
||||
$rolemappings = $restore->rolesmapping;
|
||||
}
|
||||
// $info->roles will be empty for backups pre 1.7
|
||||
if (isset($info->roles) && $info->roles) {
|
||||
|
||||
/// first we check if the roles are in the mappings
|
||||
foreach ($info->roles as $oldroleid=>$roledata) {
|
||||
if (empty($restore->rolesmapping)) {
|
||||
// if this is empty altogether, we came from import or there's no roles used in course at all
|
||||
// in this case, write the same oldid as this is the same site
|
||||
// no need to do mapping
|
||||
$status = backup_putid($restore->backup_unique_code,"role",$oldroleid,
|
||||
$oldroleid); // adding a new id
|
||||
continue; // do not create additonal roles;
|
||||
}
|
||||
// first we check if the roles are in the mappings
|
||||
// if so, we just do a mapping i.e. update oldids table
|
||||
if (isset($rolemappings[$oldroleid]) && $rolemappings[$oldroleid]) {
|
||||
$status = backup_putid($restore->backup_unique_code,"role",$oldroleid,
|
||||
@@ -6053,7 +6146,7 @@
|
||||
|
||||
// done finding a unique name
|
||||
|
||||
$newroleid = create_role($roledata->name,$roledata->shortname,'');
|
||||
$newroleid = create_role(addslashes($roledata->name),addslashes($roledata->shortname),'');
|
||||
$status = backup_putid($restore->backup_unique_code,"role",$oldroleid,
|
||||
$newroleid); // adding a new id
|
||||
foreach ($roledata->capabilities as $capability) {
|
||||
@@ -6069,7 +6162,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6089,7 +6181,13 @@
|
||||
}
|
||||
$course = restore_read_xml_course_header($xmlfile);
|
||||
|
||||
if (!empty($course->roleassignments)) {
|
||||
if (!isset($restore->rolesmapping)) {
|
||||
$isimport = true; // course import from another course, or course with no role assignments
|
||||
} else {
|
||||
$isimport = false; // course restore with role assignments
|
||||
}
|
||||
|
||||
if (!empty($course->roleassignments) && !$isimport) {
|
||||
$courseassignments = $course->roleassignments;
|
||||
|
||||
foreach ($courseassignments as $oldroleid => $courseassignment) {
|
||||
@@ -6100,14 +6198,12 @@
|
||||
* Restoring from course level overrides *
|
||||
*****************************************************/
|
||||
|
||||
if (!empty($course->roleoverrides)) {
|
||||
if (!empty($course->roleoverrides) && !$isimport) {
|
||||
$courseoverrides = $course->roleoverrides;
|
||||
$rolemappings = $restore->rolesmapping;
|
||||
foreach ($courseoverrides as $oldroleid => $courseoverride) {
|
||||
|
||||
// if not importing into exiting course, or creating new role, we are ok
|
||||
// local course overrides to be respected (i.e. restored course overrides ignored)
|
||||
if ($restore->restoreto != 1 || empty($rolemappings[$oldroleid])) {
|
||||
if ($restore->restoreto != 1 || empty($restore->rolesmapping[$oldroleid])) {
|
||||
restore_write_roleoverrides($restore, $courseoverride->overrides, "course", CONTEXT_COURSE, $course->course_id, $oldroleid);
|
||||
}
|
||||
}
|
||||
@@ -6127,11 +6223,12 @@
|
||||
foreach ($secs as $section) {
|
||||
if (isset($section->mods)) {
|
||||
foreach ($section->mods as $modid=>$mod) {
|
||||
if (isset($mod->roleassignments)) {
|
||||
if (isset($mod->roleassignments) && !$isimport) {
|
||||
foreach ($mod->roleassignments as $oldroleid=>$modassignment) {
|
||||
restore_write_roleassignments($restore, $modassignment->assignments, "course_modules", CONTEXT_MODULE, $modid, $oldroleid);
|
||||
}
|
||||
}
|
||||
// role overrides always applies, in import or backup/restore
|
||||
if (isset($mod->roleoverrides)) {
|
||||
foreach ($mod->roleoverrides as $oldroleid=>$modoverride) {
|
||||
restore_write_roleoverrides($restore, $modoverride->overrides, "course_modules", CONTEXT_MODULE, $modid, $oldroleid);
|
||||
@@ -6153,13 +6250,14 @@
|
||||
$blocks = restore_read_xml_blocks($xmlfile);
|
||||
if (isset($blocks->instances)) {
|
||||
foreach ($blocks->instances as $instance) {
|
||||
if (isset($instance->roleassignments)) {
|
||||
if (isset($instance->roleassignments) && !$isimport) {
|
||||
foreach ($instance->roleassignments as $oldroleid=>$blockassignment) {
|
||||
restore_write_roleassignments($restore, $blockassignment->assignments, "block_instance", CONTEXT_BLOCK, $instance->id, $oldroleid);
|
||||
|
||||
}
|
||||
}
|
||||
if (isset($instance->roleoverrides)) {
|
||||
// likewise block overrides should always be restored like mods
|
||||
if (isset($instance->roleoverrides)) {
|
||||
foreach ($instance->roleoverrides as $oldroleid=>$blockoverride) {
|
||||
restore_write_roleoverrides($restore, $blockoverride->overrides, "block_instance", CONTEXT_BLOCK, $instance->id, $oldroleid);
|
||||
}
|
||||
@@ -6175,7 +6273,7 @@
|
||||
echo "<li>".get_string("creatinguserroles").'</li>';
|
||||
}
|
||||
$info = restore_read_xml_users($restore, $xmlfile);
|
||||
if (!empty($info->users)) {
|
||||
if (!empty($info->users) && !$isimport) { // no need to restore user assignments for imports (same course)
|
||||
//For each user, take its info from backup_ids
|
||||
foreach ($info->users as $userid) {
|
||||
$rec = backup_getid($restore->backup_unique_code,"user",$userid);
|
||||
@@ -6221,7 +6319,7 @@
|
||||
$newcontext = get_context_instance($contextlevel, $oldinstance->new_id);
|
||||
$assignment->contextid = $newcontext->id; // new context id
|
||||
// might already have same assignment
|
||||
role_assign($assignment->roleid, $assignment->userid, 0, $assignment->contextid, $assignment->timestart, $assignment->timeend, $assignment->hidden, $assignment->enrol);
|
||||
role_assign($assignment->roleid, $assignment->userid, 0, $assignment->contextid, $assignment->timestart, $assignment->timeend, $assignment->hidden, $assignment->enrol, $assignment->timemodified);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6316,4 +6414,4 @@
|
||||
fclose($restorelog);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
-1232
File diff suppressed because it is too large
Load Diff
@@ -172,30 +172,9 @@ class block_admin extends block_list {
|
||||
}
|
||||
}
|
||||
|
||||
/// Should the following two be in this block?
|
||||
|
||||
|
||||
/// View own activity report
|
||||
// if ($course->showreports) {
|
||||
// $this->content->items[]='<a href="user.php?id='.$this->instance->pageid.'&user='.$USER->id.'">'.get_string('activityreport').'</a>';
|
||||
// $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/report.gif" alt="" />';
|
||||
// }
|
||||
|
||||
|
||||
/// Edit your own profile
|
||||
|
||||
// $fullname = fullname($USER, has_capability('moodle/site:viewfullnames', $context));
|
||||
// $editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
|
||||
// if (empty($USER->description)) {
|
||||
// //Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
|
||||
// $text = get_string('profile').' '.get_string('missingdescription');
|
||||
// $this->content->items[]= $editmyprofile.' <a title="'.$text.'" class="useredit blink">*<span class="accesshide">'.$text.'</span></a>';
|
||||
// } else {
|
||||
// $this->content->items[]= $editmyprofile;
|
||||
// }
|
||||
// $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
|
||||
|
||||
/// Link to the user own profile
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/user/view.php?id='.$USER->id.'&course='.$course->id.'">'.get_string('profile').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,10 @@ class block_admin_bookmarks extends block_base {
|
||||
$bookmarks = array();
|
||||
}
|
||||
|
||||
if (($section = (isset($PAGE->section) ? $PAGE->section : '')) && (in_array($section, $bookmarks))) {
|
||||
if(isset($PAGE->section) and $PAGE->section == 'search'){
|
||||
// the search page can't be properly bookmarked at present
|
||||
$this->content->footer = '';
|
||||
}elseif (($section = (isset($PAGE->section) ? $PAGE->section : '')) && (in_array($section, $bookmarks))) {
|
||||
$this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/delete.php?section=' . $section . '&sesskey='.sesskey().'">' . get_string('unbookmarkthispage','admin') . '</a>';
|
||||
} elseif ($section = (isset($PAGE->section) ? $PAGE->section : '')) {
|
||||
$this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/create.php?section=' . $section . '&sesskey='.sesskey().'">' . get_string('bookmarkthispage','admin') . '</a>';
|
||||
|
||||
+24
-18
@@ -15,8 +15,13 @@ function migrate2utf8_block_instance_configdata($recordid){
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($blockinstance->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
|
||||
if ($blockinstance->pagetype == 'course-view') {
|
||||
$courselang = get_course_lang($blockinstance->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
|
||||
} else {
|
||||
$courselang = false;
|
||||
$userlang = false;
|
||||
}
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
@@ -42,8 +47,13 @@ function migrate2utf8_block_instance_configdata($recordid){
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($blockinstance->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
|
||||
if ($blockinstance->pagetype == 'course-view') {
|
||||
$courselang = get_course_lang($blockinstance->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
|
||||
} else {
|
||||
$courselang = false;
|
||||
$userlang = false;
|
||||
}
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
@@ -68,8 +78,13 @@ function migrate2utf8_block_instance_configdata($recordid){
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($blockinstance->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
|
||||
if ($blockinstance->pagetype == 'course-view') {
|
||||
$courselang = get_course_lang($blockinstance->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
|
||||
} else {
|
||||
$courselang = false;
|
||||
$userlang = false;
|
||||
}
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
@@ -110,10 +125,7 @@ global $CFG, $globallang;
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($blockpinned->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockpinned->pageid); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
$fromenc = get_original_encoding($sitelang, false, false);
|
||||
}
|
||||
|
||||
$blah = unserialize(base64_decode($blockpinned->configdata));
|
||||
@@ -137,10 +149,7 @@ global $CFG, $globallang;
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($blockpinned->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockpinned->pageid); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
$fromenc = get_original_encoding($sitelang, false, false);
|
||||
}
|
||||
|
||||
$blah = unserialize(base64_decode($blockpinned->configdata));
|
||||
@@ -163,10 +172,7 @@ global $CFG, $globallang;
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($blockpinned->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockpinned->pageid); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
$fromenc = get_original_encoding($sitelang, false, false);
|
||||
}
|
||||
|
||||
$blah = unserialize(base64_decode($blockpinned->configdata));
|
||||
|
||||
@@ -12,7 +12,7 @@ class block_html extends block_base {
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
$this->title = isset($this->config->title) ? $this->config->title : get_string('newhtmlblock', 'block_html');
|
||||
$this->title = isset($this->config->title) ? format_string($this->config->title) : get_string('newhtmlblock', 'block_html');
|
||||
}
|
||||
|
||||
function instance_allow_multiple() {
|
||||
@@ -24,8 +24,13 @@ class block_html extends block_base {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$filteropt = new stdClass;
|
||||
$filteropt->noclean = true;
|
||||
if (!empty($this->instance->pinned) or $this->instance->pagetype === 'course-view') {
|
||||
// fancy html allowed only on course page and in pinned blocks for security reasons
|
||||
$filteropt = new stdClass;
|
||||
$filteropt->noclean = true;
|
||||
} else {
|
||||
$filteropt = null;
|
||||
}
|
||||
|
||||
$this->content = new stdClass;
|
||||
$this->content->text = isset($this->config->text) ? format_text($this->config->text, FORMAT_HTML, $filteropt) : '';
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
<?php $usehtmleditor = can_use_html_editor(); ?>
|
||||
<?php
|
||||
$usehtmleditor = can_use_html_editor();
|
||||
|
||||
$text = isset($this->config->text) ? $this->config->text : '';
|
||||
if (empty($this->instance->pinned) and $this->instance->pagetype !== 'course-view') {
|
||||
$text = clean_text($text, FORMAT_HTML);
|
||||
}
|
||||
?>
|
||||
<table cellpadding="9" cellspacing="0">
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('configtitle', 'block_html'); ?>:</td>
|
||||
@@ -6,7 +13,7 @@
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('configcontent', 'block_html'); ?>:</td>
|
||||
<td><?php print_textarea($usehtmleditor, 25, 50, 0, 0, 'text', isset($this->config->text)?$this->config->text:'') ?></td>
|
||||
<td><?php print_textarea($usehtmleditor, 25, 50, 0, 0, 'text', $text) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
|
||||
@@ -52,7 +52,7 @@ class block_login extends block_base {
|
||||
$this->content->text .= '<table align="center" cellpadding="2" cellspacing="0" class="logintable">';
|
||||
|
||||
$this->content->text .= '<tr><td class="c0 r0" align="right">'.get_string('username').':</td>';
|
||||
$this->content->text .= '<td class="c1 r0"><input type="text" name="username" size="10" value="'.$username.'" /></td></tr>';
|
||||
$this->content->text .= '<td class="c1 r0"><input type="text" name="username" size="10" value="'.s($username).'" /></td></tr>';
|
||||
|
||||
$this->content->text .= '<tr><td class="c0 r1" align="right">'.get_string('password').':</td>';
|
||||
$this->content->text .= '<td class="c1 r1"><input type="password" name="password" size="10" value="" /></td></tr>';
|
||||
|
||||
@@ -245,11 +245,6 @@ class block_base {
|
||||
// The full treatment, please. Include the title text.
|
||||
print_side_block($this->_title_html(), $this->content->text, NULL, NULL, $this->content->footer, $this->html_attributes(), $this->title);
|
||||
}
|
||||
|
||||
//make a record of the block for the ajax course format to use
|
||||
if (!empty($COURSE->javascriptportal)) {
|
||||
$COURSE->javascriptportal->block_add('inst'.$this->instance->id,!$this->instance->visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,13 +303,7 @@ class block_base {
|
||||
|
||||
switch ($this->instance->pagetype) {
|
||||
case 'course-view':
|
||||
if ($this->instance->pageid == SITEID) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, $this->instance->pageid);
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $this->instance->pageid);
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:manageblocks', $context)) {
|
||||
if (!has_capability('moodle/site:manageblocks', $blockcontext)) {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
@@ -358,7 +347,7 @@ class block_base {
|
||||
|
||||
// place holder for roles button
|
||||
$movebuttons .= '<a class="icon roles" title="'. $this->str->assignroles .'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$blockcontext->id.'">' .
|
||||
'<img src="'.$CFG->pixpath.'/i/roles.gif" alt="'.$this->str->assignroles.'" /></a>';
|
||||
'<img src="'.$CFG->pixpath.'/i/roles.gif" alt="'.$this->str->assignroles.'" height="11" width="11" border="0"/></a>';
|
||||
|
||||
$movebuttons .= '<a class="icon hide" title="'. $title .'" href="'.$script.'&blockaction=toggle">' .
|
||||
'<img src="'. $CFG->pixpath.$icon .'" alt="'.$title.'" /></a>';
|
||||
@@ -706,14 +695,9 @@ class block_list extends block_base {
|
||||
print_side_block($this->_title_html(), '', $this->content->items, $this->content->icons,
|
||||
$this->content->footer, $this->html_attributes(), $this->title);
|
||||
}
|
||||
|
||||
//make a record of the block for the ajax course format to use
|
||||
if (!empty($COURSE->javascriptportal)) {
|
||||
$COURSE->javascriptportal->block_add('inst'.$this->instance->id,!$this->instance->visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,204 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
die; //must be fixed before enabling again, see SC#971
|
||||
|
||||
// All of this is standard Moodle fixtures
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot .'/course/lib.php');
|
||||
require_once($CFG->dirroot .'/lib/blocklib.php');
|
||||
require_once($CFG->dirroot .'/mod/resource/lib.php');
|
||||
require_once($CFG->dirroot .'/mod/forum/lib.php');
|
||||
|
||||
optional_param('blockaction');
|
||||
optional_param('instanceid', 0, PARAM_INT);
|
||||
optional_param('blockid', 0, PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
// Begin snippet -----------------------------------------------------------------
|
||||
// This snippet should normally be defined in another file, but I 've put it all
|
||||
// in here to keep it simple.
|
||||
|
||||
// First of all define the string identifier for this "type" of page.
|
||||
define('MOODLE_PAGE_TEST', 'testpage');
|
||||
|
||||
// Also, define identifiers for any non-standard block positions we want to support.
|
||||
define('BLOCK_POS_CENTERUP', 'cu');
|
||||
define('BLOCK_POS_CENTERDOWN', 'cd');
|
||||
|
||||
// The actual Page derived class
|
||||
class page_test extends page_base {
|
||||
|
||||
// Mandatory; should return our identifier.
|
||||
function get_type() {
|
||||
return MOODLE_PAGE_TEST;
|
||||
}
|
||||
|
||||
// For this test page, only admins are going to be allowed editing (for simplicity).
|
||||
function user_allowed_editing() {
|
||||
return isadmin();
|
||||
}
|
||||
|
||||
// Also, admins are considered to have "always on" editing (I wanted to avoid duplicating
|
||||
// the code that turns editing on/off here; you can roll your own or copy course/view.php).
|
||||
function user_is_editing() {
|
||||
return isadmin();
|
||||
}
|
||||
|
||||
// Simple method that accepts one parameter and prints the header. Here we just ignore
|
||||
// the parameter entirely.
|
||||
function print_header($title) {
|
||||
print_header("Page testing page", 'SAMPLE CUSTOM PAGE', 'home');
|
||||
}
|
||||
|
||||
// This should point to the script that displays us; it's straightforward in this case.
|
||||
function url_get_path() {
|
||||
global $CFG;
|
||||
return $CFG->wwwroot .'/blocks/pagedemo.php';
|
||||
}
|
||||
|
||||
// We do not need any special request variables such as ID in this case, so we 're not
|
||||
// going to have to override url_get_parameters() here; the default suits us nicely.
|
||||
|
||||
// Having defined all identifiers we need, here we declare which block positions we are
|
||||
// going to support.
|
||||
function blocks_get_positions() {
|
||||
return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT, BLOCK_POS_CENTERUP, BLOCK_POS_CENTERDOWN);
|
||||
}
|
||||
|
||||
// And here we declare where new blocks will appear (arbitrary choice).
|
||||
function blocks_default_position() {
|
||||
return BLOCK_POS_CENTERUP;
|
||||
}
|
||||
|
||||
// Since we 're not going to be creating multiple instances of this "page" (as we do with
|
||||
// courses), we don't need to provide default blocks. Otherwise we 'd need to override
|
||||
// the blocks_get_default() method.
|
||||
|
||||
// And finally, a little block move logic. Given a block's previous position and where
|
||||
// we want to move it to, return its new position. Pretty self-documenting.
|
||||
function blocks_move_position(&$instance, $move) {
|
||||
if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) {
|
||||
return BLOCK_POS_CENTERUP;
|
||||
} else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) {
|
||||
return BLOCK_POS_CENTERUP;
|
||||
} else if (($instance->position == BLOCK_POS_CENTERUP || $instance->position == BLOCK_POS_CENTERDOWN) && $move == BLOCK_MOVE_LEFT) {
|
||||
return BLOCK_POS_LEFT;
|
||||
} else if (($instance->position == BLOCK_POS_CENTERUP || $instance->position == BLOCK_POS_CENTERDOWN) && $move == BLOCK_MOVE_RIGHT) {
|
||||
return BLOCK_POS_RIGHT;
|
||||
} else if ($instance->position == BLOCK_POS_CENTERUP && $move == BLOCK_MOVE_DOWN) {
|
||||
return BLOCK_POS_CENTERDOWN;
|
||||
} else if ($instance->position == BLOCK_POS_CENTERDOWN && $move == BLOCK_MOVE_UP) {
|
||||
return BLOCK_POS_CENTERUP;
|
||||
}
|
||||
return $instance->position;
|
||||
}
|
||||
}
|
||||
// End snippet -------------------------------------------------------------------
|
||||
|
||||
/// Bounds for block widths on this page
|
||||
define('BLOCK_L_MIN_WIDTH', 160);
|
||||
define('BLOCK_L_MAX_WIDTH', 210);
|
||||
define('BLOCK_R_MIN_WIDTH', 160);
|
||||
define('BLOCK_R_MAX_WIDTH', 210);
|
||||
define('BLOCK_C_MIN_WIDTH', 250);
|
||||
define('BLOCK_C_MAX_WIDTH', 350);
|
||||
|
||||
|
||||
// Before creating our page object, we need to map our page identifier to the actual name
|
||||
// of the class which will be handling its operations. Pretty simple, but essential.
|
||||
page_map_class(MOODLE_PAGE_TEST, 'page_test');
|
||||
|
||||
// Now, create our page object. The identifier "1" is passed arbitrarily because we don't
|
||||
// have multiple "testpages"; if we did, that would be the "testpageid" from the database.
|
||||
$PAGE = page_create_object(MOODLE_PAGE_TEST, 1);
|
||||
|
||||
$PAGE->print_header(NULL);
|
||||
$editing = $PAGE->user_is_editing();
|
||||
|
||||
// That's it! From now on, everything is simply copy-pasted from course/view.php with a few
|
||||
// minor tweaks to display the page layout!
|
||||
|
||||
// Calculate the preferred width for left, right and center (both center positions will use the same)
|
||||
if (empty($preferred_width_left)) {
|
||||
$preferred_width_left = blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]);
|
||||
}
|
||||
if (empty($preferred_width_right)) {
|
||||
$preferred_width_right = blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]);
|
||||
}
|
||||
if (empty($preferred_width_centerup)) {
|
||||
$preferred_width_centerup = blocks_preferred_width($pageblocks[BLOCK_POS_CENTERUP]);
|
||||
}
|
||||
if (empty($preferred_width_centerdown)) {
|
||||
$preferred_width_centerdown = blocks_preferred_width($pageblocks[BLOCK_POS_CENTERDOWN]);
|
||||
}
|
||||
$preferred_width_left = min($preferred_width_left, BLOCK_L_MAX_WIDTH);
|
||||
$preferred_width_left = max($preferred_width_left, BLOCK_L_MIN_WIDTH);
|
||||
$preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
|
||||
$preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
|
||||
$preferred_width_center = max($preferred_width_centerup, $preferred_width_centerdown);
|
||||
$preferred_width_center = min($preferred_width_center, BLOCK_C_MAX_WIDTH);
|
||||
$preferred_width_center = max($preferred_width_center, BLOCK_C_MIN_WIDTH);
|
||||
|
||||
// Display the blocks and allow blocklib to handle any block action requested
|
||||
$pageblocks = blocks_get_by_page($PAGE);
|
||||
|
||||
if($editing) {
|
||||
if (!empty($blockaction) && confirm_sesskey()) {
|
||||
if (!empty($blockid)) {
|
||||
blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), intval($blockid));
|
||||
|
||||
}
|
||||
else if (!empty($instanceid)) {
|
||||
$instance = blocks_find_instance($instanceid, $pageblocks);
|
||||
blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), $instance);
|
||||
}
|
||||
// This re-query could be eliminated by judicious programming in blocks_execute_action(),
|
||||
// but I'm not sure if it's worth the complexity increase...
|
||||
$pageblocks = blocks_get_by_page($PAGE);
|
||||
}
|
||||
}
|
||||
|
||||
// The actual display logic is here
|
||||
echo '<table style="width: 100%;"><tr>';
|
||||
|
||||
if(blocks_have_content($pageblocks,BLOCK_POS_LEFT) || $editing) {
|
||||
echo '<td style="vertical-align: top; width: '.$preferred_width_left.'px;">';
|
||||
blocks_print_group($PAGE, $pageblocks,BLOCK_POS_LEFT);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '<td style="border: 1px black solid; width: '.$preferred_width_center.'px;"><p style="text-align: center; padding: 10px; background: black; color: white;">Center-up position:</p>';
|
||||
if(blocks_have_content($pageblocks,BLOCK_POS_CENTERUP) || $editing) {
|
||||
blocks_print_group($PAGE, $pageblocks,BLOCK_POS_CENTERUP);
|
||||
}
|
||||
|
||||
echo '<div style="padding: 10px; background: gold; text-align: center;">Content Here';
|
||||
|
||||
print_object(make_timestamp(2005, 6, 1, 0, 0, 0));
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '<p style="text-align: center; padding: 10px; background: black; color: white;">Center-down position:</p>';
|
||||
if(blocks_have_content($pageblocks,BLOCK_POS_CENTERDOWN) || $editing) {
|
||||
blocks_print_group($PAGE, $pageblocks,BLOCK_POS_CENTERDOWN);
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
if(blocks_have_content($pageblocks,BLOCK_POS_RIGHT) || $editing) {
|
||||
echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;">';
|
||||
blocks_print_group($PAGE, $pageblocks,BLOCK_POS_RIGHT);
|
||||
if ($editing) {
|
||||
blocks_print_adminblock($PAGE, $pageblocks);
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
// Finished! :-)
|
||||
|
||||
echo '</tr></table>';
|
||||
print_footer();
|
||||
|
||||
|
||||
?>
|
||||
@@ -8,7 +8,7 @@ class block_participants extends block_list {
|
||||
|
||||
function get_content() {
|
||||
|
||||
global $USER, $CFG;
|
||||
global $USER, $CFG, $COURSE;
|
||||
|
||||
// the following 3 lines is need to pass _self_test();
|
||||
if (empty($this->instance->pageid)) {
|
||||
@@ -21,7 +21,8 @@ class block_participants extends block_list {
|
||||
$currentcontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$canviewparticipants = has_capability('moodle/site:viewparticipants', $currentcontext);
|
||||
} else { // course context
|
||||
$currentcontext = get_context_instance(CONTEXT_COURSE, $this->instance->pageid);
|
||||
/// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
|
||||
$currentcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
|
||||
$canviewparticipants = has_capability('moodle/course:viewparticipants', $currentcontext);
|
||||
}
|
||||
|
||||
@@ -48,8 +49,7 @@ class block_participants extends block_list {
|
||||
$this->instance->pageid = SITEID;
|
||||
}
|
||||
|
||||
if ($this->instance->pageid != SITEID
|
||||
|| $canviewparticipants) {
|
||||
if ($COURSE->id != SITEID || $canviewparticipants) {
|
||||
|
||||
$this->content->items[] = '<a title="'.get_string('listofallpeople').'" href="'.
|
||||
$CFG->wwwroot.'/user/index.php?contextid='.$currentcontext->id.'">'.get_string('participants').'</a>';
|
||||
|
||||
@@ -273,8 +273,12 @@ if ($act == 'updfeed') {
|
||||
if (file_exists($CFG->dirroot .'/blog/lib.php')) {
|
||||
//Blog module is installed - provide "blog this" link
|
||||
print '<td align="right">'."\n";
|
||||
print '<img src="'. $CFG->pixpath .'/blog/blog.gif" alt="'. get_string('blogthis', 'blog').'" title="'. get_string('blogthis', 'blog') .'" border="0" align="middle" />'."\n";
|
||||
print '<a href="'. $CFG->wwwroot .'/blog/blogthis.php?userid='. $userid .'&act=use&item='. $y .'&rssid='. $rssid .'"><small><strong>'. get_string('blogthis', 'blog') .'</strong></small></a>'."\n";
|
||||
|
||||
/// MDL-9291, blog this feature needs further discussion/implementation
|
||||
/// temporarily disabling for now.
|
||||
|
||||
// print '<img src="'. $CFG->pixpath .'/blog/blog.gif" alt="'. get_string('blogthis', 'blog').'" title="'. get_string('blogthis', 'blog') .'" border="0" align="middle" />'."\n";
|
||||
//print '<a href="'. $CFG->wwwroot .'/blog/blogthis.php?userid='. $USER->id .'&act=use&item='. $y .'&rssid='. $rssid .'"><small><strong>'. get_string('blogthis', 'blog') .'</strong></small></a>'."\n";
|
||||
} else {
|
||||
print '<td> ';
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ $block_rss_client_capabilities = array(
|
||||
'legacy' => array(
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'admin' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
@@ -51,7 +50,6 @@ $block_rss_client_capabilities = array(
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'legacy' => array(
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'admin' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
@@ -63,7 +61,6 @@ $block_rss_client_capabilities = array(
|
||||
'legacy' => array(
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'admin' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
|
||||
@@ -38,7 +38,7 @@ class block_social_activities extends block_list {
|
||||
$groupbuttons = $course->groupmode;
|
||||
$groupbuttonslink = (!$course->groupmodeforce);
|
||||
$viewhiddenactivities = has_capability('moodle/course:viewhiddenactivities', $context);
|
||||
$manageactivities = has_capability('moodle/course:manageactivities', $context);
|
||||
$isediting = isediting($this->instance->pageid);
|
||||
$ismoving = ismoving($this->instance->pageid);
|
||||
if ($ismoving) {
|
||||
$strmovehere = get_string('movehere');
|
||||
@@ -62,7 +62,7 @@ class block_social_activities extends block_list {
|
||||
continue;
|
||||
}
|
||||
$mod = $mods[$modnumber];
|
||||
if ($manageactivities && !$ismoving) {
|
||||
if ($isediting && !$ismoving) {
|
||||
if ($groupbuttons) {
|
||||
if (! $mod->groupmodelink = $groupbuttonslink) {
|
||||
$mod->groupmode = $course->groupmode;
|
||||
@@ -116,7 +116,7 @@ class block_social_activities extends block_list {
|
||||
$this->content->icons[] = '';
|
||||
}
|
||||
|
||||
if ($manageactivities && $modnames) {
|
||||
if ($isediting && $modnames) {
|
||||
$this->content->footer = print_section_add_menus($course, 0, $modnames, true, true);
|
||||
} else {
|
||||
$this->content->footer = '';
|
||||
|
||||
+42
-45
@@ -37,17 +37,44 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<strong><?php print_string('publishto', 'blog'); ?>:</strong>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<?php
|
||||
$options = blog_applicable_publish_states(); //$blogEntry may be null
|
||||
choose_from_menu($options, 'publishstate', $post->publishstate, '');
|
||||
?>
|
||||
<td align="right"><strong>
|
||||
<?php
|
||||
helpbutton('publish_state', get_string('helppublish', 'blog'), 'blog');
|
||||
print_string('entrybody', 'blog');
|
||||
?>:
|
||||
</strong><br /><br />
|
||||
<small><small>
|
||||
<?php
|
||||
helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
|
||||
echo '<br />';
|
||||
if ($usehtmleditor) {
|
||||
helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true);
|
||||
} else {
|
||||
emoticonhelpbutton('entry', 'body');
|
||||
}
|
||||
?>
|
||||
</small></small>
|
||||
</td>
|
||||
<td align="left" colspan="2">
|
||||
<?php print_textarea($usehtmleditor, 25, 62, 500, 600, 'summary', $post->summary); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><strong><?php print_string('formattexttype'); ?>:</strong></td>
|
||||
<td colspan="2">
|
||||
<?php
|
||||
if ($usehtmleditor) { /// Trying this out for a while
|
||||
print_string('formathtml');
|
||||
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
choose_from_menu(format_text_menu(), 'format', $post->format, '');
|
||||
}
|
||||
?>
|
||||
<small><small>
|
||||
<?php
|
||||
helpbutton('textformat', get_string('helpformatting'));
|
||||
?>
|
||||
</small></small>
|
||||
<?php if (isset($errors["summary"])) formerr($errors["summary"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
@@ -100,48 +127,18 @@
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><strong>
|
||||
<?php
|
||||
print_string('entrybody', 'blog');
|
||||
?>:
|
||||
</strong><br /><br />
|
||||
<small><small>
|
||||
<?php
|
||||
helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
|
||||
echo '<br />';
|
||||
if ($usehtmleditor) {
|
||||
helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true);
|
||||
} else {
|
||||
emoticonhelpbutton('entry', 'body');
|
||||
}
|
||||
?>
|
||||
</small></small>
|
||||
<td align="right">
|
||||
<strong><?php print_string('publishto', 'blog'); ?>:</strong>
|
||||
</td>
|
||||
<td align="left" colspan="2">
|
||||
<?php print_textarea($usehtmleditor, 25, 62, 500, 600, 'summary', $post->summary); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><strong><?php print_string('formattexttype'); ?>:</strong></td>
|
||||
<td colspan="2">
|
||||
<?php
|
||||
if ($usehtmleditor) { /// Trying this out for a while
|
||||
print_string('formathtml');
|
||||
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
choose_from_menu(format_text_menu(), 'format', $post->format, '');
|
||||
}
|
||||
<?php
|
||||
$options = blog_applicable_publish_states(); //$blogEntry may be null
|
||||
choose_from_menu($options, 'publishstate', $post->publishstate, '');
|
||||
?>
|
||||
<small><small>
|
||||
<?php
|
||||
helpbutton('textformat', get_string('helpformatting'));
|
||||
helpbutton('publish_state', get_string('helppublish', 'blog'), 'blog');
|
||||
?>
|
||||
</small></small>
|
||||
<?php if (isset($errors["summary"])) formerr($errors["summary"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
+4
-3
@@ -75,7 +75,7 @@ switch ($filtertype) {
|
||||
$courseid = $course->id;
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_login($course->id);
|
||||
if (!has_capability('moodle/blog:view', $sitecontext)) {
|
||||
if (!has_capability('moodle/blog:view', $coursecontext)) {
|
||||
error('You do not have the required permissions to view blogs in this course');
|
||||
}
|
||||
break;
|
||||
@@ -84,7 +84,8 @@ switch ($filtertype) {
|
||||
if ($CFG->bloglevel < BLOG_GROUP_LEVEL) {
|
||||
error('Group blogs is not enabled');
|
||||
}
|
||||
if (!$group = get_record('groups','id',$groupid)) {
|
||||
// fix for MDL-9268
|
||||
if (!$group = get_record('groups','id',$filterselect)) {
|
||||
error('Incorrect group id specified');
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $group->courseid)) {
|
||||
@@ -115,7 +116,7 @@ switch ($filtertype) {
|
||||
if ($USER->id == $filterselect) {
|
||||
if (!has_capability('moodle/blog:create', $sitecontext)
|
||||
and !has_capability('moodle/blog:view', $sitecontext)) {
|
||||
error('You do not have your own a blog, sorry.');
|
||||
error('You do not have your own blog, sorry.');
|
||||
}
|
||||
} else {
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $filterselect);
|
||||
|
||||
+36
-17
@@ -154,9 +154,9 @@
|
||||
global $USER, $CFG, $COURSE, $ME;
|
||||
|
||||
$template['body'] = format_text($blogEntry->summary, $blogEntry->format);
|
||||
$template['title'] = '<a name="'. $blogEntry->subject .'"></a>';
|
||||
$template['title'] = '<a name="'. s($blogEntry->subject) .'"></a>';
|
||||
//enclose the title in nolink tags so that moodle formatting doesn't autolink the text
|
||||
$template['title'] .= '<span class="nolink">'.$blogEntry->subject.'</span>';
|
||||
$template['title'] .= '<span class="nolink">'. format_string($blogEntry->subject) .'</span>';
|
||||
$template['userid'] = $blogEntry->userid;
|
||||
$template['author'] = fullname(get_record('user','id',$blogEntry->userid));
|
||||
$template['lastmod'] = userdate($blogEntry->lastmodified);
|
||||
@@ -327,10 +327,16 @@
|
||||
if (has_capability('moodle/blog:manageentries', $sitecontext)) {
|
||||
return true; // can manage all posts
|
||||
}
|
||||
|
||||
|
||||
// coming for 1 post, make sure it's not a draft
|
||||
if ($blogEntry and $blogEntry->publishstate == 'draft') {
|
||||
return false; // can not view draft of others
|
||||
}
|
||||
|
||||
// coming for 1 post, make sure user is logged in, if not a public blog
|
||||
if ($blogEntry && $blogEntry->publishstate != 'public' && !isloggedin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($CFG->bloglevel) {
|
||||
case BLOG_GLOBAL_LEVEL:
|
||||
@@ -345,7 +351,7 @@
|
||||
break;
|
||||
|
||||
case BLOG_COURSE_LEVEL:
|
||||
$mycourses = array_keys(get_my_courses($targetuserid));
|
||||
$mycourses = array_keys(get_my_courses($USER->id));
|
||||
$usercourses = array_keys(get_my_courses($targetuserid));
|
||||
$shared = array_intersect($mycourses, $usercourses);
|
||||
if (!empty($shared)) {
|
||||
@@ -355,7 +361,7 @@
|
||||
break;
|
||||
|
||||
case BLOG_GROUP_LEVEL:
|
||||
$mycourses = array_keys(get_my_courses($targetuserid));
|
||||
$mycourses = array_keys(get_my_courses($USER->id));
|
||||
$usercourses = array_keys(get_my_courses($targetuserid));
|
||||
$shared = array_intersect($mycourses, $usercourses);
|
||||
foreach ($shared as $courseid) {
|
||||
@@ -393,6 +399,8 @@
|
||||
|
||||
global $CFG, $USER;
|
||||
|
||||
$typesql = " AND p.module = 'blog' ";
|
||||
|
||||
/// set the tag id for searching
|
||||
if ($tagid) {
|
||||
$tag = $tagid;
|
||||
@@ -411,7 +419,7 @@
|
||||
|
||||
if ($post = get_record('post', 'id', $postid)) {
|
||||
|
||||
if (blog_user_can_view_user_post($post->userid)) {
|
||||
if (blog_user_can_view_user_post($post->userid, $post)) {
|
||||
|
||||
if ($user = get_record('user', 'id', $post->userid)) {
|
||||
$post->email = $user->email;
|
||||
@@ -437,13 +445,19 @@
|
||||
$tagquerysql = '';
|
||||
}
|
||||
|
||||
if (isloggedin()) {
|
||||
$permissionsql = '(p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
if (isloggedin() && !has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM, SITEID), $USER->id, false)) {
|
||||
$permissionsql = 'AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
} else {
|
||||
$permissionsql = 'p.publishstate = \'public\'';
|
||||
$permissionsql = 'AND p.publishstate = \'public\'';
|
||||
}
|
||||
|
||||
// fix for MDL-9165, use with readuserblogs capability in a user context can read that user's private blogs
|
||||
// admins can see all blogs regardless of publish states, as described on the help page
|
||||
if (has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
$permissionsql = '';
|
||||
} else if ($filtertype=='user' && has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_USER, $filterselect))) {
|
||||
$permissionsql = '';
|
||||
}
|
||||
|
||||
|
||||
/****************************************
|
||||
* depending on the type, there are 4 *
|
||||
* different possible sqls *
|
||||
@@ -463,7 +477,7 @@
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.deleted = 0
|
||||
AND '.$permissionsql;
|
||||
'.$permissionsql.$typesql;
|
||||
|
||||
break;
|
||||
|
||||
@@ -477,20 +491,25 @@
|
||||
AND ra.contextid '.get_related_contexts_string($context).'
|
||||
AND u.id = p.userid
|
||||
AND u.deleted = 0
|
||||
AND '.$permissionsql;
|
||||
'.$permissionsql.$typesql;
|
||||
|
||||
break;
|
||||
|
||||
case 'group':
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'groups_members m, '.$CFG->prefix.'user u
|
||||
WHERE p.userid = m.userid '.$tagquerysql.'
|
||||
AND u.id = p.userid
|
||||
AND m.groupid = '.$filterselect.'
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
|
||||
/*$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.groups_members_from_sql().', '.$CFG->prefix.'user u
|
||||
WHERE '.groups_members_where_sql($filterselect, 'p.userid').'
|
||||
AND u.id = p.userid
|
||||
AND u.deleted = 0
|
||||
AND '.$permissionsql;
|
||||
|
||||
'.$permissionsql.$typesql;
|
||||
*/
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
@@ -500,7 +519,7 @@
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.id = '.$filterselect.'
|
||||
AND u.deleted = 0
|
||||
AND '.$permissionsql;
|
||||
'.$permissionsql.$typesql;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+10
-9
@@ -9,14 +9,14 @@
|
||||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
||||
// //
|
||||
// Designed by: //
|
||||
// Avgoustos Tsinakos (tsinakos@uom.gr) //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// Programming and development: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// For bugs, suggestions, etc contact: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// The current module was developed at the University of Macedonia //
|
||||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
||||
@@ -205,13 +205,14 @@
|
||||
if (count($err) == 0) {
|
||||
$form->timemodified = time();
|
||||
|
||||
if ($form->repeat) {
|
||||
$fetch = get_record_sql('SELECT 1, MAX(repeatid) AS repeatid FROM '.$CFG->prefix.'event');
|
||||
$form->repeatid = empty($fetch) ? 1 : $fetch->repeatid + 1;
|
||||
}
|
||||
|
||||
/// Get the event id for the log record.
|
||||
$eventid = insert_record('event', $form, true);
|
||||
|
||||
/// Use the event id as the repeatid to link repeat entries together
|
||||
if ($form->repeat) {
|
||||
$form->repeatid = $form->id = $eventid;
|
||||
update_record('event', $form); // update the row, to set its repeatid
|
||||
}
|
||||
|
||||
/// Log the event entry.
|
||||
add_to_log($form->courseid, 'calendar', 'add', 'event.php?action=edit&id='.$eventid, stripslashes($form->name));
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
<form method="get" action="export_execute.php">
|
||||
<?php print_string('iwanttoexport', 'calendar'); ?>:
|
||||
<div class="indent">
|
||||
<input type="radio" name="preset_what" id="pw_all" value="all" /><label for="pw_all"><?php print_string('eventsall', 'calendar'); ?></label><br />
|
||||
<input type="radio" name="preset_what" id="pw_all" value="all" checked="checked"/><label for="pw_all"><?php print_string('eventsall', 'calendar'); ?></label><br />
|
||||
<input type="radio" name="preset_what" id="pw_course" value="courses" /><label for="pw_course"><?php print_string('eventsrelatedtocourses', 'calendar'); ?></label><br />
|
||||
</div>
|
||||
<?php print_string('for', 'calendar'); ?>:
|
||||
<div class="indent">
|
||||
<?php if($allowthisweek) { ?>
|
||||
<input type="radio" name="preset_time" id="pt_wknow" value="weeknow" /><label for="pt_wknow"><?php print_string('weekthis', 'calendar'); ?></label><br />
|
||||
<input type="radio" name="preset_time" id="pt_wknow" value="weeknow" checked="checked"/><label for="pt_wknow"><?php print_string('weekthis', 'calendar'); ?></label><br />
|
||||
<?php } ?>
|
||||
<?php if($allownextweek) { ?>
|
||||
<input type="radio" name="preset_time" id="pt_wknext" value="weeknext" /><label for="pt_wknext"><?php print_string('weeknext', 'calendar'); ?></label><br />
|
||||
|
||||
@@ -16,8 +16,8 @@ $day = optional_param('cal_d', 0, PARAM_INT);
|
||||
$mon = optional_param('cal_m', 0, PARAM_INT);
|
||||
$yr = optional_param('cal_y', 0, PARAM_INT);
|
||||
|
||||
$what = optional_param('preset_what', '', PARAM_ALPHA);
|
||||
$time = optional_param('preset_time', '', PARAM_ALPHA);
|
||||
$what = optional_param('preset_what', 'all', PARAM_ALPHA);
|
||||
$time = optional_param('preset_time', 'weeknow', PARAM_ALPHA);
|
||||
|
||||
$now = usergetdate(time());
|
||||
// Let's see if we have sufficient and correct data
|
||||
|
||||
+49
-31
@@ -9,14 +9,14 @@
|
||||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
||||
// //
|
||||
// Designed by: //
|
||||
// Avgoustos Tsinakos (tsinakos@uom.gr) //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// Programming and development: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// For bugs, suggestions, etc contact: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// The current module was developed at the University of Macedonia //
|
||||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
||||
@@ -242,7 +242,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
|
||||
$popupicon = $CFG->pixpath.'/c/user.gif';
|
||||
$popupalt = '';
|
||||
}
|
||||
$popupcontent .= '<div><img height="16" width="16" src="'.$popupicon.'" style="vertical-align: middle; margin-right: 4px;" alt="'.$popupalt.'" /><a href="'.$dayhref.'">'.format_string($event->name,true).'</a></div>';
|
||||
$popupcontent .= '<div><img height="16" width="16" src="'.$popupicon.'" style="vertical-align: middle; margin-right: 4px;" alt="'.$popupalt.'" /><a href="'.$dayhref.'#event_'.$event->id.'">'.format_string($event->name,true).'</a></div>';
|
||||
}
|
||||
|
||||
//Accessibility: functionality moved to calendar_get_popup.
|
||||
@@ -456,7 +456,7 @@ function calendar_print_event($event) {
|
||||
static $strftimetime;
|
||||
|
||||
$event = calendar_add_event_metadata($event);
|
||||
echo '<table class="event" cellspacing="0">';
|
||||
echo '<a name="event_'.$event->id.'"></a><table class="event" cellspacing="0">';
|
||||
echo '<tr><td class="picture">';
|
||||
if (!empty($event->icon)) {
|
||||
echo $event->icon;
|
||||
@@ -870,7 +870,7 @@ function calendar_get_sideblock_upcoming($events, $linkhref = NULL) {
|
||||
if(!empty($linkhref)) {
|
||||
$ed = usergetdate($events[$i]->timestart);
|
||||
$href = calendar_get_link_href(CALENDAR_URL.$linkhref, $ed['mday'], $ed['mon'], $ed['year']);
|
||||
$content .= '<a href="'.$href.'">'.$events[$i]->name.'</a>';
|
||||
$content .= '<a href="'.$href.'#event_'.$events[$i]->id.'">'.$events[$i]->name.'</a>';
|
||||
}
|
||||
else {
|
||||
$content .= $events[$i]->name;
|
||||
@@ -1095,10 +1095,11 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
|
||||
else {
|
||||
$courses = false;
|
||||
}
|
||||
//BUG 6130 clean $courses array as SESSION has bad entries.
|
||||
foreach ($courses as $index => $value) {
|
||||
if (empty($value)) unset($courses[$index]);
|
||||
}
|
||||
//BUG 6130 clean $courses array as SESSION has bad entries.
|
||||
// [pj] TODO: See if this has to do with my new change in get_default_courses and can be taken out
|
||||
foreach ($courses as $index => $value) {
|
||||
if (empty($value)) unset($courses[$index]);
|
||||
}
|
||||
|
||||
if($SESSION->cal_show_user || $ignorefilters) {
|
||||
// This doesn't work for arrays yet (maybe someday it will)
|
||||
@@ -1177,15 +1178,11 @@ function calendar_edit_event_allowed($event) {
|
||||
if (has_capability('moodle/calendar:manageentries', $sitecontext)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// editting userid account
|
||||
if ($event->userid) {
|
||||
if ($event->userid == $USER->id) {
|
||||
return (has_capability('moodle/calendar:manageownentries', $sitecontext));
|
||||
}
|
||||
} else if ($event->groupid) {
|
||||
$group = get_record('groups', 'id', $event->groupid);
|
||||
if($group === false) {
|
||||
|
||||
// if groupid is set, it's definitely a group event
|
||||
if ($event->groupid) {
|
||||
//TODO:check.
|
||||
if (! groups_group_exists($event->groupid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1193,10 +1190,15 @@ function calendar_edit_event_allowed($event) {
|
||||
// to edit group calendar too
|
||||
// there is no need to check membership, because if you have this capability
|
||||
// you will have a role in this group context
|
||||
return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_GROUP, $group->id));
|
||||
return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_GROUP, $event->groupid));
|
||||
} else if ($event->courseid) {
|
||||
return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $event->courseid));
|
||||
}
|
||||
// if groupid is not set, but course is set,
|
||||
// it's definiely a course event
|
||||
return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $event->courseid));
|
||||
} else if ($event->userid && $event->userid == $USER->id) {
|
||||
// if course is not set, but userid id set, it's a user event
|
||||
return (has_capability('moodle/calendar:manageownentries', $sitecontext));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1212,18 +1214,34 @@ function calendar_get_default_courses($ignoreref = false) {
|
||||
}
|
||||
|
||||
$courses = array();
|
||||
if(has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if(!empty($CFG->calendar_adminseesall)) {
|
||||
if (has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!empty($CFG->calendar_adminseesall)) {
|
||||
$courses = get_records_sql('SELECT id, 1 FROM '.$CFG->prefix.'course');
|
||||
return $courses;
|
||||
}
|
||||
}
|
||||
if(isset($USER->student) && is_array($USER->student)) {
|
||||
$courses = $courses + $USER->student;
|
||||
}
|
||||
if(isset($USER->teacher) && is_array($USER->teacher)) {
|
||||
$courses = $courses + $USER->teacher;
|
||||
|
||||
// find all course this student can view
|
||||
if ($allcourses = get_my_courses($USER->id,'visible DESC,sortorder ASC', '*', true)) {
|
||||
foreach ($allcourses as $courseid=>$acourse) {
|
||||
$auth = '';
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
if ($roleassign = get_records_sql("SELECT * FROM {$CFG->prefix}role_assignments
|
||||
WHERE contextid = $context->id
|
||||
AND userid = $USER->id")) {
|
||||
foreach ($roleassign as $rid => $rs) {
|
||||
if (!empty($rs->enrol)) {
|
||||
$auth = $rs->enrol;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$auth = '';
|
||||
}
|
||||
$courses[$courseid] = $auth;
|
||||
}
|
||||
}
|
||||
|
||||
return $courses;
|
||||
}
|
||||
|
||||
@@ -1347,4 +1365,4 @@ function calendar_set_filters_status($packed_bitfield) {
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+4
-4
@@ -9,14 +9,14 @@
|
||||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
||||
// //
|
||||
// Designed by: //
|
||||
// Avgoustos Tsinakos (tsinakos@uom.gr) //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// Programming and development: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// For bugs, suggestions, etc contact: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// The current module was developed at the University of Macedonia //
|
||||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
||||
|
||||
+23
-13
@@ -9,14 +9,14 @@
|
||||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
||||
// //
|
||||
// Designed by: //
|
||||
// Avgoustos Tsinakos (tsinakos@uom.gr) //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// Programming and development: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// For bugs, suggestions, etc contact: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// The current module was developed at the University of Macedonia //
|
||||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
||||
@@ -44,8 +44,8 @@
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->dirroot.'/calendar/lib.php');
|
||||
|
||||
$course = optional_param('course', 0);
|
||||
$view = optional_param('view', 'upcoming');
|
||||
$courseid = optional_param('course', 0, PARAM_INT);
|
||||
$view = optional_param('view', 'upcoming', PARAM_ALPHA);
|
||||
$day = optional_param('cal_d', 0, PARAM_INT);
|
||||
$mon = optional_param('cal_m', 0, PARAM_INT);
|
||||
$yr = optional_param('cal_y', 0, PARAM_INT);
|
||||
@@ -54,7 +54,9 @@
|
||||
redirect($CFG->wwwroot.'/'.$CFG->admin.'/index.php');
|
||||
}
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
if ($courseid) {
|
||||
require_login($courseid);
|
||||
} else if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
}
|
||||
|
||||
@@ -87,8 +89,8 @@
|
||||
}
|
||||
|
||||
// If a course has been supplied in the URL, change the filters to show that one
|
||||
if (!empty($course)) {
|
||||
if ($course = get_record('course', 'id', $course)) {
|
||||
if (!empty($courseid)) {
|
||||
if ($course = get_record('course', 'id', $courseid)) {
|
||||
if ($course->id == SITEID) {
|
||||
// If coming from the home page, show all courses
|
||||
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
|
||||
@@ -100,6 +102,8 @@
|
||||
calendar_set_referring_course($SESSION->cal_courses_shown);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$course = null;
|
||||
}
|
||||
|
||||
if (empty($USER->id) or isguest()) {
|
||||
@@ -302,9 +306,15 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
list($d, $m, $y) = array($date['mday'], $date['mon'], $date['year']); // This is what we want to display
|
||||
$display->maxdays = calendar_days_in_month($m, $y);
|
||||
|
||||
// We 'll keep these values as GMT here, and offset them when the time comes to query the db
|
||||
$display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
|
||||
$display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
|
||||
if (get_user_timezone_offset() < 99) {
|
||||
// We 'll keep these values as GMT here, and offset them when the time comes to query the db
|
||||
$display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
|
||||
$display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
|
||||
} else {
|
||||
// no timezone info specified
|
||||
$display->tstart = mktime(0, 0, 0, $m, 1, $y);
|
||||
$display->tend = mktime(23, 59, 59, $m, $display->maxdays, $y);
|
||||
}
|
||||
|
||||
$startwday = gmdate('w', $display->tstart); // $display->tstart is already GMT, so don't use date(): messes with server's TZ
|
||||
|
||||
@@ -440,7 +450,7 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
if(isset($eventsbyday[$day])) {
|
||||
echo '<ul class="events-new">';
|
||||
foreach($eventsbyday[$day] as $eventindex) {
|
||||
echo '<li><a href="'.$dayhref.'">'.format_string($events[$eventindex]->name,true).'</a></li>';
|
||||
echo '<li><a href="'.$dayhref.'#event_'.$events[$eventindex]->id.'">'.format_string($events[$eventindex]->name, true).'</a></li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
+41
-50
@@ -32,12 +32,11 @@
|
||||
error("Category not known!");
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/course:create', $context)) {
|
||||
if ($categoryedit !== -1) {
|
||||
$USER->categoryediting = $categoryedit;
|
||||
}
|
||||
$navbaritem = update_category_button($category->id);
|
||||
|
||||
$creatorediting = !empty($USER->categoryediting);
|
||||
$adminediting = (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $creatorediting);
|
||||
|
||||
@@ -51,7 +50,7 @@
|
||||
}
|
||||
|
||||
|
||||
if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/category:update', $context)) {
|
||||
/// Rename the category if requested
|
||||
if (!empty($rename) and confirm_sesskey()) {
|
||||
$category->name = $rename;
|
||||
@@ -218,7 +217,7 @@
|
||||
if ($subcategories = get_records("course_categories", "parent", $category->id, "sortorder ASC")) {
|
||||
$firstentry = true;
|
||||
foreach ($subcategories as $subcategory) {
|
||||
if ($subcategory->visible or has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if ($subcategory->visible or has_capability('moodle/course:create', $context)) {
|
||||
$subcategorieswereshown = true;
|
||||
if ($firstentry) {
|
||||
echo '<table align="center" border="0" cellspacing="2" cellpadding="4" class="generalbox">';
|
||||
@@ -305,7 +304,7 @@
|
||||
|
||||
foreach ($courses as $acourse) {
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $acourse->id);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $acourse->id);
|
||||
|
||||
$count++;
|
||||
$up = ($count > 1 || !$atfirstpage);
|
||||
@@ -315,44 +314,46 @@
|
||||
echo '<tr>';
|
||||
echo '<td><a '.$linkcss.' href="view.php?id='.$acourse->id.'">'.$acourse->fullname.'</a></td>';
|
||||
if ($creatorediting) {
|
||||
if ($adminediting) {
|
||||
echo "<td>";
|
||||
echo "<td>";
|
||||
if (has_capability('moodle/course:update', $coursecontext)) {
|
||||
echo '<a title="'.$strsettings.'" href="'.$CFG->wwwroot.'/course/edit.php?id='.
|
||||
$acourse->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.$stredit.'" /></a> ';
|
||||
// role assignment link
|
||||
if (has_capability('moodle/role:assign', $context)) {
|
||||
echo'<a title="'.get_string('assignroles', 'role').'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id.'"><img src="'.$CFG->pixpath.'/i/roles.gif" height="11" width="11" alt="'.get_string('assignroles', 'role').'" /></a>';
|
||||
}
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.$stredit.'" /></a> '; }
|
||||
|
||||
// role assignment link
|
||||
if (has_capability('moodle/role:assign', $coursecontext)) {
|
||||
echo'<a title="'.get_string('assignroles', 'role').'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$coursecontext->id.'"><img src="'.$CFG->pixpath.'/i/roles.gif" height="11" width="11" alt="'.get_string('assignroles', 'role').'" /></a>';
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:delete', $context)) {
|
||||
echo '<a title="'.$strdelete.'" href="delete.php?id='.$acourse->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.$strdelete.'" /></a> ';
|
||||
}
|
||||
if (can_delete_course($acourse->id)) {
|
||||
echo '<a title="'.$strdelete.'" href="delete.php?id='.$acourse->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.$strdelete.'" /></a> ';
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:visibility', $context)) {
|
||||
if (!empty($acourse->visible)) {
|
||||
echo '<a title="'.$strhide.'" href="category.php?id='.$category->id.'&page='.$page.
|
||||
'&perpage='.$perpage.'&hide='.$acourse->id.'&sesskey='.$USER->sesskey.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/hide.gif" height="11" width="11" border="0" alt="'.$strhide.'" /></a> ';
|
||||
} else {
|
||||
echo '<a title="'.$strshow.'" href="category.php?id='.$category->id.'&page='.$page.
|
||||
'&perpage='.$perpage.'&show='.$acourse->id.'&sesskey='.$USER->sesskey.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/show.gif" height="11" width="11" border="0" alt="'.$strshow.'" /></a> ';
|
||||
}
|
||||
if (has_capability('moodle/course:visibility', $coursecontext) && has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
|
||||
if (!empty($acourse->visible)) {
|
||||
echo '<a title="'.$strhide.'" href="category.php?id='.$category->id.'&page='.$page.
|
||||
'&perpage='.$perpage.'&hide='.$acourse->id.'&sesskey='.$USER->sesskey.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/hide.gif" height="11" width="11" border="0" alt="'.$strhide.'" /></a> ';
|
||||
} else {
|
||||
echo '<a title="'.$strshow.'" href="category.php?id='.$category->id.'&page='.$page.
|
||||
'&perpage='.$perpage.'&show='.$acourse->id.'&sesskey='.$USER->sesskey.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/show.gif" height="11" width="11" border="0" alt="'.$strshow.'" /></a> ';
|
||||
}
|
||||
}
|
||||
|
||||
if (has_capability('moodle/site:backup', $context)) {
|
||||
echo '<a title="'.$strbackup.'" href="../backup/backup.php?id='.$acourse->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/backup.gif" height="11" width="11" border="0" alt="" /></a> ';
|
||||
}
|
||||
if (has_capability('moodle/site:backup', $coursecontext)) {
|
||||
echo '<a title="'.$strbackup.'" href="../backup/backup.php?id='.$acourse->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/backup.gif" height="11" width="11" border="0" alt="" /></a> ';
|
||||
}
|
||||
|
||||
if (has_capability('moodle/site:restore', $context)) {
|
||||
echo '<a title="'.$strrestore.'" href="../files/index.php?id='.$acourse->id.
|
||||
'&wdir=/backupdata">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/restore.gif" height="11" width="11" border="0" alt="" /></a> ';
|
||||
}
|
||||
if (has_capability('moodle/site:restore', $coursecontext)) {
|
||||
echo '<a title="'.$strrestore.'" href="../files/index.php?id='.$acourse->id.
|
||||
'&wdir=/backupdata">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/restore.gif" height="11" width="11" border="0" alt="" /></a> ';
|
||||
}
|
||||
|
||||
if (has_capability('moodle/category:update', $context)) {
|
||||
if ($up) {
|
||||
echo '<a title="'.$strmoveup.'" href="category.php?id='.$category->id.'&page='.$page.
|
||||
'&perpage='.$perpage.'&moveup='.$acourse->id.'&sesskey='.$USER->sesskey.'">'.
|
||||
@@ -368,20 +369,13 @@
|
||||
} else {
|
||||
echo '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" height="11" width="11" border="0" alt="" /> ';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '<td align="center">';
|
||||
echo '<input type="checkbox" name="c'.$acourse->id.'" />';
|
||||
$abletomovecourses = true;
|
||||
|
||||
} else if (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $acourse->id))) {
|
||||
echo '<td>';
|
||||
echo '<a title="'.$strsettings.'" href="'.$CFG->wwwroot.'/course/edit.php?id='.$acourse->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.$strsettings.'" /></a> ';
|
||||
echo '<a title="'.$strassignteachers.'" href="'.$CFG->wwwroot.'/course/teacher.php?id='.$acourse->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/user.gif" height="11" width="11" border="0" alt="'.$strassignteachers.'" /></a> ';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '<td align="center">';
|
||||
echo '<input type="checkbox" name="c'.$acourse->id.'" />';
|
||||
|
||||
} else {
|
||||
echo '<td align="right">';
|
||||
if (!empty($acourse->guest)) {
|
||||
@@ -417,8 +411,7 @@
|
||||
echo '</form>';
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo '<center>';
|
||||
if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $numcourses > 1) { /// Print button to re-sort courses by name
|
||||
unset($options);
|
||||
@@ -428,7 +421,6 @@
|
||||
print_single_button('category.php', $options, get_string('resortcoursesbyname'), 'get');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
if (has_capability('moodle/course:create', $context)) { /// Print button to create a new course
|
||||
unset($options);
|
||||
$options['category'] = $category->id;
|
||||
@@ -436,7 +428,6 @@
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSECAT, $id);
|
||||
if (has_capability('moodle/category:update', $context)) { /// Print form to rename the category
|
||||
$strrename= get_string('rename');
|
||||
echo '<form name="renameform" action="category.php" method="post">';
|
||||
|
||||
+3
-1
@@ -8,7 +8,9 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/course:delete', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
if (!can_delete_course($id)) {
|
||||
error('You do not have the permission to delete this course.');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
|
||||
@@ -156,6 +156,11 @@
|
||||
}
|
||||
|
||||
$choices = $choices + $roles;
|
||||
|
||||
// fix for MDL-9197
|
||||
foreach ($choices as $choiceid => $choice) {
|
||||
$choices[$choiceid] = format_string($choice);
|
||||
}
|
||||
|
||||
choose_from_menu ($choices, 'defaultrole', $form->defaultrole, '');
|
||||
helpbutton("coursedefaultrole", get_string("defaultrole"));
|
||||
|
||||
+8
-4
@@ -40,11 +40,15 @@
|
||||
$disable_meta = get_string('metaalreadyhasenrolments');
|
||||
}
|
||||
}
|
||||
} else { // Admin is creating a new course
|
||||
} else { // Creating a new course
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
if (!has_capability('moodle/course:create',$context)) {
|
||||
error("You do not currently have course creation privileges!");
|
||||
$context = get_context_instance(CONTEXT_COURSECAT, $category);
|
||||
// first check to see if user has site level course creation.
|
||||
// This is because it is possible that coursecat = 0 when an admin is adding a course
|
||||
if (!has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/course:create',$context)) {
|
||||
error("You do not currently have course creation privileges!");
|
||||
}
|
||||
}
|
||||
|
||||
$course = NULL;
|
||||
|
||||
+103
-159
@@ -1,177 +1,122 @@
|
||||
<?php // $Id$
|
||||
// Edit course settings
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("$CFG->libdir/blocklib.php");
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php");
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/enrol/enrol.class.php');
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
require_once('lib.php');
|
||||
require_once('edit_form.php');
|
||||
|
||||
include_once $CFG->libdir.'/formslib.php';
|
||||
$id = optional_param('id', 0, PARAM_INT); // course id
|
||||
$categoryid = optional_param('category', 0, PARAM_INT); // course category - can be changed in edit form
|
||||
|
||||
require_login();
|
||||
|
||||
$mform =& new moodleform('edit_course', 'post', 'edit2.php');
|
||||
|
||||
$mform->acceptGet('id', 'category');
|
||||
|
||||
$id = $mform->optional_param('id', 0, PARAM_INT); // course id
|
||||
$category = $mform->optional_param('category', 0, PARAM_INT); // possible default category
|
||||
|
||||
|
||||
$disable_meta = false;
|
||||
$focus = "";
|
||||
|
||||
if ($id) {
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID was incorrect");
|
||||
/// basic access control checks
|
||||
if ($id) { // editing course
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
error('Course ID was incorrect');
|
||||
}
|
||||
$category = get_record('course_categories', 'id', $course->category);
|
||||
require_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
if (!has_capability('moodle/course:update', $context)) {
|
||||
error("You do not currently have editing privileges!");
|
||||
} else if ($categoryid) { // creating new course in this category
|
||||
$course = null;
|
||||
if (!$category = get_record('course_categories', 'id', $categoryid)) {
|
||||
error('Category ID was incorrect');
|
||||
}
|
||||
|
||||
if (course_in_meta($course)) {
|
||||
$disable_meta = get_string('metaalreadyinmeta');
|
||||
} else if ($course->metacourse) {
|
||||
if (count_records("course_meta","parent_course",$course->id) > 0) {
|
||||
$disable_meta = get_string('metaalreadyhascourses');
|
||||
}
|
||||
} else {
|
||||
$managers = count(get_users_by_capability($context, 'moodle/course:managemetacourse'));
|
||||
$participants = count(get_users_by_capability($context, 'moodle/course:view'));
|
||||
if ($participants > $managers) {
|
||||
$disable_meta = get_string('metaalreadyhasenrolments');
|
||||
}
|
||||
}
|
||||
} else { // Admin is creating a new course
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
if (!has_capability('moodle/course:create',$context)) {
|
||||
error("You do not currently have course creation privileges!");
|
||||
}
|
||||
|
||||
$course = NULL;
|
||||
require_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id));
|
||||
} else {
|
||||
error('Either course id or category must be specified');
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/index.php");
|
||||
}
|
||||
|
||||
|
||||
|
||||
include("edit_form.php");
|
||||
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
// data_submitted tries to validate form data and returns false if
|
||||
// the user inputted data is invalid and the form should be redisplayed with
|
||||
// feedback.
|
||||
|
||||
if ($fromform=$mform->data_submitted()) {
|
||||
|
||||
|
||||
if (!empty($fromform->enrolstartdisabled)){
|
||||
$fromform->enrolstartdate = 0;
|
||||
}
|
||||
|
||||
if (!empty($fromform->enrolenddisabled)) {
|
||||
$fromform->enrolenddate = 0;
|
||||
}
|
||||
/// prepare course
|
||||
if (!empty($course)) {
|
||||
$allowedmods = array();
|
||||
if (!empty($fromform->allowedmods)) {
|
||||
$allowedmods = $fromform->allowedmods;
|
||||
unset($fromform->allowedmods);
|
||||
}
|
||||
|
||||
$fromform->timemodified = time();
|
||||
|
||||
if ($fromform->defaultrole == -1) { // Just leave it however it is
|
||||
unset($fromform->defaultrole);
|
||||
}
|
||||
if (!empty($course)) {
|
||||
// Test for and remove blocks which aren't appropriate anymore
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $course->id);
|
||||
blocks_remove_inappropriate($page);
|
||||
|
||||
// Update with the new data
|
||||
if (update_record('course', $fromform)) {
|
||||
add_to_log($course->id, "course", "update", "edit.php?id=$id", "");
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
$course->restrictmodules = $fromform->restrictmodules;
|
||||
update_restricted_mods($course,$allowedmods);
|
||||
if ($am = get_records('course_allowed_modules','course',$course->id)) {
|
||||
foreach ($am as $m) {
|
||||
$allowedmods[] = $m->module;
|
||||
}
|
||||
fix_course_sortorder();
|
||||
// everything ok, no need to display any message in redirect
|
||||
redirect("view.php?id=$course->id");
|
||||
} else {
|
||||
error("Serious Error! Could not update the course record! (id = $fromform->id)");
|
||||
if (empty($course->restrictmodules)) {
|
||||
$allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||
} // it'll be greyed out but we want these by default anyway.
|
||||
}
|
||||
} else {
|
||||
$fromform->timecreated = time();
|
||||
|
||||
// place at beginning of category
|
||||
fix_course_sortorder();
|
||||
$fromform->sortorder = get_field_sql("SELECT min(sortorder)-1 FROM {$CFG->prefix}course WHERE category=$fromform->category");
|
||||
if (empty($fromform->sortorder)) {
|
||||
$fromform->sortorder = 100;
|
||||
$course->allowedmods = $allowedmods;
|
||||
|
||||
if ($course->enrolstartdate){
|
||||
$course->enrolstartdisabled = 0;
|
||||
}
|
||||
// fill in default teacher and student names to keep backwards compatibility
|
||||
$fromform->teacher = addslashes(get_string('defaultcourseteacher'));
|
||||
$fromform->teachers = addslashes(get_string('defaultcourseteachers'));
|
||||
$fromform->student = addslashes(get_string('defaultcoursestudent'));
|
||||
$fromform->students = addslashes(get_string('defaultcoursestudents'));
|
||||
|
||||
if ($newcourseid = insert_record('course', $fromform)) { // Set up new course
|
||||
|
||||
// Setup the blocks
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $newcourseid);
|
||||
blocks_repopulate_page($page); // Return value not checked because you can always edit later
|
||||
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
$course = get_record("course","id",$newcourseid);
|
||||
update_restricted_mods($course,$allowedmods);
|
||||
}
|
||||
|
||||
$section = NULL;
|
||||
$section->course = $newcourseid; // Create a default section.
|
||||
$section->section = 0;
|
||||
$section->id = insert_record("course_sections", $section);
|
||||
|
||||
fix_course_sortorder();
|
||||
add_to_log(SITEID, "course", "new", "view.php?id=$newcourseid", "$fromform->fullname (ID $newcourseid)") ;
|
||||
$context = get_context_instance(CONTEXT_COURSE, $newcourseid);
|
||||
|
||||
if ($fromform->metacourse and has_capability('moodle/course:managemetacourse', $context)) { // Redirect users with metacourse capability to student import
|
||||
redirect($CFG->wwwroot."/course/importstudents.php?id=$newcourseid");
|
||||
|
||||
} else if (has_capability('moodle/role:assign', $context)) { // Redirect users with assign capability to assign users to different roles
|
||||
redirect($CFG->wwwroot."/$CFG->admin/roles/assign.php?contextid=$context->id");
|
||||
|
||||
} else { // Add current teacher and send to course
|
||||
|
||||
// find a role with legacy:edittingteacher
|
||||
if ($teacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, $context)) {
|
||||
// assign the role to this user
|
||||
$teachereditrole = array_shift($teacherroles);
|
||||
role_assign($teachereditrole->id, $USER->id, 0, $context->id);
|
||||
}
|
||||
|
||||
redirect("view.php?id=$newcourseid");
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
error("Serious Error! Could not create the new course!");
|
||||
|
||||
if ($course->enrolenddate) {
|
||||
$course->enrolenddisabled = 0;
|
||||
}
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
//print the form
|
||||
/// first create the form
|
||||
$editform = new course_edit_form('edit.php', compact('course', 'category'));
|
||||
// now override defaults if course already exists
|
||||
if (!empty($course)) {
|
||||
$editform->set_data($course);
|
||||
}
|
||||
if ($editform->is_cancelled()){
|
||||
if (empty($course)) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect($CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
} else if ($data = $editform->get_data()) {
|
||||
|
||||
/// process data if submitted
|
||||
|
||||
//preprocess data
|
||||
if ($data->enrolstartdisabled){
|
||||
$data->enrolstartdate = 0;
|
||||
}
|
||||
|
||||
if ($data->enrolenddisabled) {
|
||||
$data->enrolenddate = 0;
|
||||
}
|
||||
|
||||
$data->timemodified = time();
|
||||
|
||||
if (empty($course)) {
|
||||
if (!$course = create_course($data)) {
|
||||
print_error('coursenotcreated');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
// assign default role to creator if not already having permission to manage course assignments
|
||||
if (!has_capability('moodle/course:view', $context) or !has_capability('moodle/role:assign', $context)) {
|
||||
role_assign($CFG->creatornewroleid, $USER->id, 0, $context->id);
|
||||
}
|
||||
|
||||
if ($data->metacourse and has_capability('moodle/course:managemetacourse', $context)) {
|
||||
// Redirect users with metacourse capability to student import
|
||||
redirect($CFG->wwwroot."/course/importstudents.php?id=$course->id");
|
||||
} else {
|
||||
// Redirect to roles assignment
|
||||
redirect($CFG->wwwroot."/$CFG->admin/roles/assign.php?contextid=$context->id");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!update_course($data)) {
|
||||
print_error('coursenotupdated');
|
||||
}
|
||||
|
||||
redirect($CFG->wwwroot."/course/view.php?id=$course->id");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Print the form
|
||||
|
||||
$site = get_site();
|
||||
|
||||
$streditcoursesettings = get_string("editcoursesettings");
|
||||
$straddnewcourse = get_string("addnewcourse");
|
||||
@@ -179,20 +124,19 @@
|
||||
$strcategories = get_string("categories");
|
||||
|
||||
if (!empty($course)) {
|
||||
print_header($streditcoursesettings, "$course->fullname",
|
||||
print_header($streditcoursesettings, $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
|
||||
-> $streditcoursesettings", $focus);
|
||||
-> $streditcoursesettings", $editform->focus());
|
||||
} else {
|
||||
print_header("$site->shortname: $straddnewcourse", "$site->fullname",
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"index.php\">$strcategories</a> -> $straddnewcourse", $focus);
|
||||
print_header("$site->shortname: $straddnewcourse", $site->fullname,
|
||||
"<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"index.php\">$strcategories</a> -> $straddnewcourse", $editform->focus());
|
||||
}
|
||||
|
||||
|
||||
print_heading($streditcoursesettings);
|
||||
|
||||
$mform->display();
|
||||
|
||||
$editform->display();
|
||||
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
|
||||
+341
-351
@@ -1,392 +1,382 @@
|
||||
<?php
|
||||
/// For moodleform we reconstruct all the data about the form after submission before we
|
||||
/// extract data submitted. So we can then tell for select, checkbox and radio fields what
|
||||
/// options could have been submitted by the form eg submitted value for a single selection
|
||||
/// select field must be one of the options of the select field.
|
||||
<?php //$Id$
|
||||
|
||||
// $toform will be used for the default value of a field if no data has been submitted.
|
||||
require_once($CFG->libdir.'/formslib.php');
|
||||
|
||||
if (!empty($course)) {
|
||||
//this is what we do if we are editing a record from the db
|
||||
$toform = $course;
|
||||
$toform->allowedmods = array();
|
||||
if ($am = get_records("course_allowed_modules","course",$course->id)) {
|
||||
foreach ($am as $m) {
|
||||
$toform->allowedmods[] = $m->module;
|
||||
class course_edit_form extends moodleform {
|
||||
|
||||
function definition() {
|
||||
global $USER, $CFG;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$course = $this->_customdata['course'];
|
||||
$category = $this->_customdata['category'];
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$categorycontext = get_context_instance(CONTEXT_COURSECAT, $category->id);
|
||||
|
||||
$disable_meta = false; // basic meta course state protection; server-side security checks not needed
|
||||
|
||||
if (!empty($course)) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = $coursecontext;
|
||||
|
||||
if (course_in_meta($course)) {
|
||||
$disable_meta = get_string('metaalreadyinmeta');
|
||||
|
||||
} else if ($course->metacourse) {
|
||||
if (count_records('course_meta', 'parent_course', $course->id) > 0) {
|
||||
$disable_meta = get_string('metaalreadyhascourses');
|
||||
}
|
||||
|
||||
} else {
|
||||
$managers = count(get_users_by_capability($coursecontext, 'moodle/course:managemetacourse'));
|
||||
$participants = count(get_users_by_capability($coursecontext, 'moodle/course:view'));
|
||||
if ($participants > $managers) {
|
||||
$disable_meta = get_string('metaalreadyhasenrolments');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (empty($course->restrictmodules)) {
|
||||
$toform->allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||
} // it'll be greyed out but we want these by default anyway.
|
||||
}
|
||||
} else {
|
||||
//this is a brand new course!
|
||||
$toform->startdate = time() + 3600 * 24;
|
||||
$toform->fullname = get_string("defaultcoursefullname");
|
||||
$toform->shortname = get_string("defaultcourseshortname");
|
||||
$toform->summary = get_string("defaultcoursesummary");
|
||||
$toform->format = "weeks";
|
||||
$toform->password = "";
|
||||
$toform->guest = 0;
|
||||
$toform->numsections = 10;
|
||||
$toform->idnumber = '';
|
||||
$toform->cost = '';
|
||||
$toform->currency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency;
|
||||
$toform->newsitems = 5;
|
||||
$toform->showgrades = 1;
|
||||
$toform->groupmode = 0;
|
||||
$toform->groupmodeforce = 0;
|
||||
$toform->category = $category;
|
||||
$toform->id = "";
|
||||
$toform->visible = 1;
|
||||
$toform->allowedmods = array();
|
||||
if ($CFG->restrictmodulesfor == 'all') {
|
||||
$toform->allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||
if (!empty($CFG->restrictbydefault)) {
|
||||
$toform->restrictmodules = 1;
|
||||
}
|
||||
$coursecontext = null;
|
||||
$context = $categorycontext;
|
||||
}
|
||||
|
||||
/// form definition with new course defaults
|
||||
//--------------------------------------------------------------------------------
|
||||
$mform->addElement('header','general', get_string('general', 'form'));
|
||||
|
||||
}
|
||||
//must have create course capability in both categories in order to move course
|
||||
if (has_capability('moodle/course:create', $categorycontext)) {
|
||||
$displaylist = array();
|
||||
$parentlist = array();
|
||||
make_categories_list($displaylist, $parentlist);
|
||||
foreach ($displaylist as $key=>$val) {
|
||||
if (!has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $key))) {
|
||||
unset($displaylist[$key]);
|
||||
}
|
||||
}
|
||||
$mform->addElement('select', 'category', get_string('category'), $displaylist);
|
||||
} else {
|
||||
$mform->addElement('hidden', 'category', null);
|
||||
}
|
||||
$mform->setHelpButton('category', array('coursecategory', get_string('category')));
|
||||
$mform->setDefault('category', $category->id);
|
||||
$mform->setType('category', PARAM_INT);
|
||||
|
||||
$mform->addElement('header','general', get_string("general"));
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $toform->category))) {
|
||||
$displaylist = array();
|
||||
$parentlist = array();
|
||||
make_categories_list($displaylist, $parentlist);
|
||||
$mform->addElement('select', "category", get_string("category"), $displaylist );
|
||||
}
|
||||
$mform->setDefault('fullname', $toform->fullname);
|
||||
$mform->addElement('text','fullname', get_string("fullname"),'maxlength="254" size="50"');
|
||||
$mform->setDefault('shortname', $toform->shortname);
|
||||
$mform->addElement('text','shortname', get_string("shortname"),'maxlength="15" size="10"');
|
||||
$mform->setDefault('idnumber', $toform->idnumber);
|
||||
$mform->addElement('text','idnumber', get_string("idnumbercourse"),'maxlength="100" size="10"');
|
||||
$mform->setDefault('summary', $toform->summary);
|
||||
$mform->addElement('htmleditor','summary', get_string("summary"), array('rows'=>'10', 'cols'=>'65'));
|
||||
$mform->addElement('text','fullname', get_string('fullname'),'maxlength="254" size="50"');
|
||||
$mform->setHelpButton('fullname', array('coursefullname', get_string('fullname')), true);
|
||||
$mform->setDefault('fullname', get_string('defaultcoursefullname'));
|
||||
$mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
|
||||
$mform->setType('fullname', PARAM_MULTILANG);
|
||||
|
||||
$mform->setDefault('format', $toform->format);
|
||||
$courseformats = get_list_of_plugins("course/format");
|
||||
$formcourseformats = array();
|
||||
$mform->addElement('text','shortname', get_string('shortname'),'maxlength="15" size="10"');
|
||||
$mform->setHelpButton('shortname', array('courseshortname', get_string('shortname')), true);
|
||||
$mform->setDefault('shortname', get_string('defaultcourseshortname'));
|
||||
$mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
|
||||
$mform->setType('shortname', PARAM_MULTILANG);
|
||||
|
||||
foreach ($courseformats as $courseformat) {
|
||||
$formcourseformats["$courseformat"] = get_string("format$courseformat");
|
||||
}
|
||||
$mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"');
|
||||
$mform->setHelpButton('idnumber', array('courseidnumber', get_string('idnumbercourse')), true);
|
||||
$mform->setType('idnumber', PARAM_RAW);
|
||||
|
||||
$mform->addElement('select', 'format', get_string("format"), $formcourseformats );
|
||||
$mform->addElement('htmleditor','summary', get_string('summary'), array('rows'=> '10', 'cols'=>'65'));
|
||||
$mform->setHelpButton('summary', array('text', get_string('helptext')), true);
|
||||
$mform->setDefault('summary', get_string('defaultcoursesummary'));
|
||||
$mform->addRule('summary', get_string('missingsummary'), 'required', null, 'client');
|
||||
$mform->setType('summary', PARAM_RAW);
|
||||
|
||||
$mform->setDefault('numsections', $toform->numsections);
|
||||
for ($i=1; $i<=52; $i++) {
|
||||
$sectionmenu[$i] = "$i";
|
||||
}
|
||||
$mform->addElement('select', 'numsections', get_string("numberweeks"), $sectionmenu);
|
||||
$mform->setDefault('startdate', $toform->startdate);
|
||||
$mform->addElement('date_selector', 'startdate', get_string('startdate'));
|
||||
$courseformats = get_list_of_plugins('course/format');
|
||||
$formcourseformats = array();
|
||||
foreach ($courseformats as $courseformat) {
|
||||
$formcourseformats["$courseformat"] = get_string("format$courseformat","format_$courseformat");
|
||||
if($formcourseformats["$courseformat"]=="[[format$courseformat]]") {
|
||||
$formcourseformats["$courseformat"] = get_string("format$courseformat");
|
||||
}
|
||||
}
|
||||
$mform->addElement('select', 'format', get_string('format'), $formcourseformats);
|
||||
$mform->setHelpButton('format', array('courseformats', get_string('courseformats')), true);
|
||||
$mform->setDefault('format', 'weeks');
|
||||
|
||||
$mform->setDefault('hiddensections',(isset($toform->hiddensections))?$toform->hiddensections:0);
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("hiddensectionscollapsed");
|
||||
$choices["1"] = get_string("hiddensectionsinvisible");
|
||||
$mform->addElement('select', 'hiddensections', get_string("hiddensections"), $choices);
|
||||
for ($i=1; $i<=52; $i++) {
|
||||
$sectionmenu[$i] = "$i";
|
||||
}
|
||||
$mform->addElement('select', 'numsections', get_string('numberweeks'), $sectionmenu);
|
||||
$mform->setDefault('numsections', 10);
|
||||
|
||||
$mform->setDefault('newsitems', $toform->newsitems);
|
||||
$newsitem = get_string("newsitem");
|
||||
$newsitems = get_string("newsitems");
|
||||
$options = array("0" => "0 $newsitems",
|
||||
"1" => "1 $newsitem",
|
||||
"2" => "2 $newsitems",
|
||||
"3" => "3 $newsitems",
|
||||
"4" => "4 $newsitems",
|
||||
"5" => "5 $newsitems",
|
||||
"6" => "6 $newsitems",
|
||||
"7" => "7 $newsitems",
|
||||
"8" => "8 $newsitems",
|
||||
"9" => "9 $newsitems",
|
||||
"10" => "10 $newsitems");
|
||||
$mform->addElement('select', 'newsitems', get_string("newsitemsnumber"), $options);
|
||||
$mform->addElement('date_selector', 'startdate', get_string('startdate'));
|
||||
$mform->setHelpButton('startdate', array('coursestartdate', get_string('startdate')), true);
|
||||
$mform->setDefault('startdate', time() + 3600 * 24);
|
||||
|
||||
$mform->setDefault('showgrades', $toform->showgrades);
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
$mform->addElement('select', 'showgrades', get_string("showgrades"), $choices);
|
||||
unset($choices);
|
||||
$mform->setDefault('showreports',(isset($toform->showreports))?$toform->showreports:0);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
$mform->addElement('select', 'showreports', get_string("showreports"), $choices);
|
||||
$mform->setDefault('maxbytes',(isset($toform->maxbytes))?$toform->maxbytes:0);
|
||||
$choices = get_max_upload_sizes($CFG->maxbytes);
|
||||
$mform->addElement('select', 'maxbytes', get_string("maximumupload"), $choices);
|
||||
if (!empty($CFG->allowcoursethemes)) {
|
||||
$mform->setDefault('theme',(isset($toform->theme))?$toform->theme:'');
|
||||
|
||||
$themes=array();
|
||||
$themes[''] = get_string("forceno");
|
||||
$themes += get_list_of_themes();
|
||||
$mform->addElement('select', 'theme', get_string("forcetheme"), $themes);
|
||||
}
|
||||
unset($choices);
|
||||
$mform->setDefault('metacourse',(isset($toform->metacourse))?$toform->metacourse:0);
|
||||
$choices = array();
|
||||
$choices['0'] = get_string('hiddensectionscollapsed');
|
||||
$choices['1'] = get_string('hiddensectionsinvisible');
|
||||
$mform->addElement('select', 'hiddensections', get_string('hiddensections'), $choices);
|
||||
$mform->setHelpButton('hiddensections', array('coursehiddensections', get_string('hiddensections')), true);
|
||||
$mform->setDefault('hiddensections', 0);
|
||||
|
||||
$options = range(0, 10);
|
||||
$mform->addElement('select', 'newsitems', get_string('newsitemsnumber'), $options);
|
||||
$mform->setHelpButton('newsitems', array('coursenewsitems', get_string('newsitemsnumber')), true);
|
||||
$mform->setDefault('newsitems', 5);
|
||||
|
||||
$mform->addElement('selectyesno', 'showgrades', get_string('showgrades'));
|
||||
$mform->setHelpButton('showgrades', array('coursegrades', get_string('grades')), true);
|
||||
$mform->setDefault('showgrades', 1);
|
||||
|
||||
$mform->addElement('selectyesno', 'showreports', get_string('showreports'));
|
||||
$mform->setHelpButton('showreports', array('coursereports', get_string('activityreport')), true);
|
||||
$mform->setDefault('showreports', 0);
|
||||
|
||||
$choices = get_max_upload_sizes($CFG->maxbytes);
|
||||
$mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
|
||||
$mform->setHelpButton('maxbytes', array('courseuploadsize', get_string('maximumupload')), true);
|
||||
|
||||
if (!empty($CFG->allowcoursethemes)) {
|
||||
$themes=array();
|
||||
$themes[''] = get_string('forceno');
|
||||
$themes += get_list_of_themes();
|
||||
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
|
||||
}
|
||||
|
||||
if (empty($disable_meta)) {
|
||||
$meta=array();
|
||||
$meta[0] = get_string('no');
|
||||
$meta[1] = get_string('yes');
|
||||
$mform->addElement('select', 'metacourse', get_string("managemeta"), $meta);
|
||||
}else{
|
||||
$mform->addElement('static', 'metacourse', get_string("managemeta"),
|
||||
((empty($toform->metacourse)) ? get_string("no") : get_string("yes"))
|
||||
. " - $disable_meta ");
|
||||
|
||||
}
|
||||
|
||||
$mform->setDefault('defaultrole',(isset($toform->defaultrole))?$toform->defaultrole:0);
|
||||
$roles = get_assignable_roles($context);
|
||||
asort($roles);
|
||||
$choices = array();
|
||||
|
||||
if ($sitedefaultrole = get_record('role', 'id', $CFG->defaultcourseroleid)) {
|
||||
$choices[0] = get_string('sitedefault').' ('.$sitedefaultrole->name.')';
|
||||
} else {
|
||||
$choices[0] = get_string('sitedefault');
|
||||
}
|
||||
|
||||
$choices = $choices + $roles;
|
||||
$defaultroleelement=$mform->addElement('select', 'defaultrole', get_string('defaultrole', 'role'), $choices );
|
||||
if ($mform->exportValue('defaultrole') && !isset($roles[$mform->exportValue('defaultrole')])) { // Existing setting is one we can't choose
|
||||
if ($coursedefaultrole = get_record('role', 'id', $mform->exportValue('defaultrole'))) {
|
||||
|
||||
$defaultroleelement->addOption(get_string('currentrole', 'role').' ('.$coursedefaultrole->name.')',-1);
|
||||
if ($disable_meta === false) {
|
||||
$mform->addElement('select', 'metacourse', get_string('managemeta'), $meta);
|
||||
$mform->setHelpButton('metacourse', array('metacourse', get_string('metacourse')), true);
|
||||
$mform->setDefault('metacourse', 0);
|
||||
} else {
|
||||
$defaultroleelement->addOption(get_string('currentrole', 'role'),-1);
|
||||
// no metacourse element - we do not want to change it anyway!
|
||||
$mform->addElement('static', 'nometacourse', get_string('managemeta'),
|
||||
((empty($course->metacourse)) ? $meta[0] : $meta[1]) . " - $disable_meta ");
|
||||
$mform->setHelpButton('nometacourse', array('metacourse', get_string('metacourse')), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$mform->addElement('header','enrolhdr', get_string("enrolment"));
|
||||
$mform->setDefault('enrol',(isset($toform->enrol))?$toform->enrol:'');
|
||||
|
||||
$modules = explode(',', $CFG->enrol_plugins_enabled);
|
||||
foreach ($modules as $module) {
|
||||
$name = get_string("enrolname", "enrol_$module");
|
||||
$plugin = enrolment_factory::factory($module);
|
||||
if (method_exists($plugin, 'print_entry')) {
|
||||
$choices[$name] = $module;
|
||||
$roles = get_assignable_roles($context);
|
||||
if (!empty($course)) {
|
||||
// add current default role, so that it is selectable even when user can not assign it
|
||||
if ($current_role = get_record('role', 'id', $course->defaultrole)) {
|
||||
$roles[$current_role->id] = strip_tags(format_string($current_role->name, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
asort($choices);
|
||||
$choices = array_flip($choices);
|
||||
$choices = array_merge(array('' => get_string('sitedefault').' ('.get_string("enrolname", "enrol_$CFG->enrol").')'), $choices);
|
||||
$mform->addElement('select', 'enrol', get_string("enrolmentplugins"), $choices );
|
||||
|
||||
$mform->setDefault('enrollable',(isset($toform->enrollable))?$toform->enrollable:1);
|
||||
$radio = array();
|
||||
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("no"), 0);
|
||||
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("yes"), 1);
|
||||
$radio[] = &moodleform::createElement('radio', 'enrollable', null, get_string("enroldate"), 2);
|
||||
$mform->addGroup($radio, 'enrollable', get_string("enrollable"), ' ', false);
|
||||
|
||||
$mform->setDefault('enrolstartdate',(isset($toform->enrolstartdate))?$toform->enrolstartdate:0);
|
||||
$mform->setDefault('enrolstartdisabled',
|
||||
(!isset($toform->enrolstartdate)||
|
||||
(isset($toform->enrolstartdate)&&!$toform->enrolstartdate)
|
||||
?1:0));
|
||||
$enroldatestartgrp = array();
|
||||
$enroldatestartgrp[] = &moodleform::createElement('date_selector', 'enrolstartdate');
|
||||
$enroldatestartgrp[] = &moodleform::createElement('checkbox', 'enrolstartdisabled', null, get_string('disable'));
|
||||
$mform->addGroup($enroldatestartgrp, '', get_string('enrolstartdate'), ' ', false);
|
||||
|
||||
$mform->setDefault('enrolenddate',(isset($toform->enrolenddate))?$toform->enrolenddate:0);
|
||||
$mform->setDefault('enrolenddisabled',
|
||||
(!isset($toform->enrolenddate)||
|
||||
(isset($toform->enrolenddate)&&!$toform->enrolenddate)
|
||||
?1:0));
|
||||
$enroldateendgrp = array();
|
||||
$enroldateendgrp[] = &moodleform::createElement('date_selector', 'enrolenddate');
|
||||
$enroldateendgrp[] = &moodleform::createElement('checkbox', 'enrolenddisabled', null, get_string('disable'));
|
||||
$mform->addGroup($enroldateendgrp, 'enroldateendgrp', get_string('enrolenddate'), ' ', false);
|
||||
|
||||
$mform->setDefault('enrolperiod',(isset($toform->enrolperiod))?$toform->enrolperiod:0);
|
||||
$periodmenu=array();
|
||||
$periodmenu[0] = get_string('unlimited');
|
||||
for ($i=1; $i<=365; $i++) {
|
||||
$seconds = $i * 86400;
|
||||
$periodmenu[$seconds] = get_string('numdays', '', $i);
|
||||
}
|
||||
$mform->addElement('select', 'enrolperiod', get_string("enrolperiod"), $periodmenu);
|
||||
|
||||
|
||||
$mform->addElement('header','expirynotifyhdr', get_string("expirynotify"));
|
||||
|
||||
$mform->setDefault('expirynotify',(isset($toform->expirynotify))?$toform->expirynotify:0);
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
$mform->addElement('select', 'expirynotify', get_string("expirynotify"), $choices);
|
||||
$mform->setDefault('notifystudents',(isset($toform->notifystudents))?$toform->notifystudents:0);
|
||||
$mform->addElement('select', 'notifystudents', get_string("expirynotifystudents"), $choices);
|
||||
$mform->setDefault('expirythreshold',(isset($toform->expirythreshold))?$toform->expirythreshold:10 * 86400);
|
||||
$thresholdmenu=array();
|
||||
for ($i=1; $i<=30; $i++) {
|
||||
$seconds = $i * 86400;
|
||||
$thresholdmenu[$seconds] = get_string('numdays', '', $i);
|
||||
}
|
||||
$mform->addElement('select', 'expirythreshold', get_string("expirythreshold"), $thresholdmenu);
|
||||
|
||||
|
||||
$mform->addElement('header','', get_string("groupmode"));
|
||||
$choices = array();
|
||||
if ($sitedefaultrole = get_record('role', 'id', $CFG->defaultcourseroleid)) {
|
||||
$choices[0] = get_string('sitedefault').' ('.$sitedefaultrole->name.')';
|
||||
} else {
|
||||
$choices[0] = get_string('sitedefault');
|
||||
}
|
||||
$choices = $choices + $roles;
|
||||
$mform->addElement('select', 'defaultrole', get_string('defaultrole', 'role'), $choices);
|
||||
$mform->setDefault('defaultrole', 0);
|
||||
|
||||
$mform->setDefault('groupmode', $toform->groupmode);
|
||||
unset($choices);
|
||||
$choices[NOGROUPS] = get_string("groupsnone");
|
||||
$choices[SEPARATEGROUPS] = get_string("groupsseparate");
|
||||
$choices[VISIBLEGROUPS] = get_string("groupsvisible");
|
||||
$mform->addElement('select', 'groupmode', get_string("groupmode"), $choices);
|
||||
$mform->setDefault('groupmodeforce', $toform->groupmodeforce);
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
$mform->addElement('select', 'groupmodeforce', get_string("force"), $choices);
|
||||
//--------------------------------------------------------------------------------
|
||||
$mform->addElement('header','enrolhdr', get_string('enrolments'));
|
||||
|
||||
$mform->addElement('header','', get_string("availability"));
|
||||
$choices = array();
|
||||
$modules = explode(',', $CFG->enrol_plugins_enabled);
|
||||
foreach ($modules as $module) {
|
||||
$name = get_string('enrolname', "enrol_$module");
|
||||
$plugin = enrolment_factory::factory($module);
|
||||
if (method_exists($plugin, 'print_entry')) {
|
||||
$choices[$name] = $module;
|
||||
}
|
||||
}
|
||||
asort($choices);
|
||||
$choices = array_flip($choices);
|
||||
$choices = array_merge(array('' => get_string('sitedefault').' ('.get_string('enrolname', "enrol_$CFG->enrol").')'), $choices);
|
||||
$mform->addElement('select', 'enrol', get_string('enrolmentplugins'), $choices);
|
||||
$mform->setHelpButton('enrol', array('courseenrolmentplugins', get_string('enrolmentplugins')), true);
|
||||
|
||||
$mform->setDefault('visible', $toform->visible);
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("courseavailablenot");
|
||||
$choices["1"] = get_string("courseavailable");
|
||||
$mform->addElement('select', 'visible', get_string("availability"), $choices);
|
||||
$mform->setDefault('password', $toform->password);
|
||||
$mform->addElement('text', 'password', get_string("enrolmentkey"), 'size="25"');
|
||||
$mform->setDefault('guest', $toform->guest);
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("guestsno");
|
||||
$choices["1"] = get_string("guestsyes");
|
||||
$choices["2"] = get_string("guestskey");
|
||||
$mform->addElement('select', 'guest', get_string("opentoguests"), $choices);
|
||||
if (isset($course) && method_exists(enrolment_factory::factory($course->enrol), 'print_entry') && $course->enrol != 'manual') {
|
||||
$mform->setDefault('cost', $toform->cost);
|
||||
$mform->setDefault('currency', $toform->currency);
|
||||
$costgroup=array();
|
||||
$currencies = get_list_of_currencies();
|
||||
$costgroup[]= &moodleform::createElement('text','cost', '', 'maxlength="6" size="6"');
|
||||
$costgroup[]= &moodleform::createElement('select', 'currency', '', $currencies);
|
||||
$mform->addGroup($costgroup, 'costgrp', get_string("cost"), ' ', false);
|
||||
$radio = array();
|
||||
$radio[] = &MoodleQuickForm::createElement('radio', 'enrollable', null, get_string('no'), 0);
|
||||
$radio[] = &MoodleQuickForm::createElement('radio', 'enrollable', null, get_string('yes'), 1);
|
||||
$radio[] = &MoodleQuickForm::createElement('radio', 'enrollable', null, get_string('enroldate'), 2);
|
||||
$mform->addGroup($radio, 'enrollable', get_string('enrollable'), ' ', false);
|
||||
$mform->setHelpButton('enrollable', array('courseenrollable', get_string('enrollable')), true);
|
||||
$mform->setDefault('enrollable', 1);
|
||||
|
||||
$enroldatestartgrp = array();
|
||||
$enroldatestartgrp[] = &MoodleQuickForm::createElement('date_selector', 'enrolstartdate');
|
||||
$enroldatestartgrp[] = &MoodleQuickForm::createElement('checkbox', 'enrolstartdisabled', null, get_string('disable'));
|
||||
$mform->addGroup($enroldatestartgrp, 'enrolstartdategrp', get_string('enrolstartdate'), ' ', false);
|
||||
$mform->setDefault('enrolstartdate', 0);
|
||||
$mform->setDefault('enrolstartdisabled', 1);
|
||||
$mform->disabledIf('enrolstartdategrp', 'enrolstartdisabled', 'checked');
|
||||
|
||||
$enroldateendgrp = array();
|
||||
$enroldateendgrp[] = &MoodleQuickForm::createElement('date_selector', 'enrolenddate');
|
||||
$enroldateendgrp[] = &MoodleQuickForm::createElement('checkbox', 'enrolenddisabled', null, get_string('disable'));
|
||||
$mform->addGroup($enroldateendgrp, 'enroldateendgrp', get_string('enrolenddate'), ' ', false);
|
||||
$mform->setDefault('enrolenddate', 0);
|
||||
$mform->setDefault('enrolenddisabled', 1);
|
||||
$mform->disabledIf('enroldateendgrp', 'enrolenddisabled', 'checked');
|
||||
|
||||
$periodmenu=array();
|
||||
$periodmenu[0] = get_string('unlimited');
|
||||
for ($i=1; $i<=365; $i++) {
|
||||
$seconds = $i * 86400;
|
||||
$periodmenu[$seconds] = get_string('numdays', '', $i);
|
||||
}
|
||||
$mform->addElement('select', 'enrolperiod', get_string('enrolperiod'), $periodmenu);
|
||||
$mform->setDefault('enrolperiod', 0);
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
$mform->addElement('header','expirynotifyhdr', get_string('expirynotify'));
|
||||
|
||||
$choices = array();
|
||||
$choices['0'] = get_string('no');
|
||||
$choices['1'] = get_string('yes');
|
||||
$mform->addElement('select', 'expirynotify', get_string('notify'), $choices);
|
||||
$mform->setHelpButton('expirynotify', array('expirynotify', get_string('expirynotify')), true);
|
||||
$mform->setDefault('expirynotify', 0);
|
||||
|
||||
$mform->addElement('select', 'notifystudents', get_string('expirynotifystudents'), $choices);
|
||||
$mform->setHelpButton('notifystudents', array('expirynotifystudents', get_string('expirynotifystudents')), true);
|
||||
$mform->setDefault('notifystudents', 0);
|
||||
|
||||
$thresholdmenu=array();
|
||||
for ($i=1; $i<=30; $i++) {
|
||||
$seconds = $i * 86400;
|
||||
$thresholdmenu[$seconds] = get_string('numdays', '', $i);
|
||||
}
|
||||
$mform->addElement('select', 'expirythreshold', get_string('expirythreshold'), $thresholdmenu);
|
||||
$mform->setHelpButton('expirythreshold', array('expirythreshold', get_string('expirythreshold')), true);
|
||||
$mform->setDefault('expirythreshold', 10 * 86400);
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
$mform->addElement('header','', get_string('groups', 'group'));
|
||||
|
||||
$choices = array();
|
||||
$choices[NOGROUPS] = get_string('no');
|
||||
$choices[SEPARATEGROUPS] = get_string('separate');
|
||||
$choices[VISIBLEGROUPS] = get_string('visible');
|
||||
$mform->addElement('select', 'groupmode', get_string('groupmode'), $choices);
|
||||
$mform->setHelpButton('groupmode', array('groupmode', get_string('groupmode')), true);
|
||||
$mform->setDefault('groupmode', 0);
|
||||
|
||||
$choices = array();
|
||||
$choices['0'] = get_string('no');
|
||||
$choices['1'] = get_string('yes');
|
||||
$mform->addElement('select', 'groupmodeforce', get_string('force'), $choices);
|
||||
$mform->setHelpButton('groupmodeforce', array('groupmodeforce', get_string('groupmodeforce')), true);
|
||||
$mform->setDefault('groupmodeforce', 0);
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
$mform->addElement('header','', get_string('availability'));
|
||||
|
||||
$choices = array();
|
||||
$choices['0'] = get_string('courseavailablenot');
|
||||
$choices['1'] = get_string('courseavailable');
|
||||
$mform->addElement('select', 'visible', get_string('availability'), $choices);
|
||||
$mform->setHelpButton('visible', array('courseavailability', get_string('availability')), true);
|
||||
$mform->setDefault('visible', 1);
|
||||
|
||||
$mform->addElement('text', 'password', get_string('enrolmentkey'), 'size="25"');
|
||||
$mform->setHelpButton('password', array('enrolmentkey', get_string('enrolmentkey')), true);
|
||||
$mform->setDefault('password', '');
|
||||
$mform->setType('password', PARAM_RAW);
|
||||
|
||||
$choices = array();
|
||||
$choices['0'] = get_string('guestsno');
|
||||
$choices['1'] = get_string('guestsyes');
|
||||
$choices['2'] = get_string('guestskey');
|
||||
$mform->addElement('select', 'guest', get_string('opentoguests'), $choices);
|
||||
$mform->setHelpButton('guest', array('guestaccess', get_string('opentoguests')), true);
|
||||
$mform->setDefault('guest', 0);
|
||||
|
||||
if (!empty($course) && method_exists(enrolment_factory::factory($course->enrol), 'print_entry') && $course->enrol != 'manual') {
|
||||
$costgroup=array();
|
||||
$currencies = get_list_of_currencies();
|
||||
$costgroup[]= &MoodleQuickForm::createElement('text','cost', '', 'maxlength="6" size="6"');
|
||||
$costgroup[]= &MoodleQuickForm::createElement('select', 'currency', '', $currencies);
|
||||
$mform->addGroup($costgroup, 'costgrp', get_string('cost'), ' ', false);
|
||||
//defining a rule for a form element within a group :
|
||||
$costgrprules=array();
|
||||
//set the message to null to tell Moodle to use a default message
|
||||
//available for most rules, fetched from language pack (err_{rulename}).
|
||||
$costgrprules['cost'][]=array(null, 'numeric', null, 'client');
|
||||
$mform->addGroupRule('costgrp',$costgrprules);
|
||||
$mform->setHelpButton('costgrp', array('cost', get_string('cost')), true);
|
||||
$mform->setDefault('cost', '');
|
||||
$mform->setDefault('currency', empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
$mform->addElement('header','', get_string('language'));
|
||||
|
||||
$languages=array();
|
||||
$languages[''] = get_string('forceno');
|
||||
$languages += get_list_of_languages();
|
||||
$mform->addElement('select', 'lang', get_string('forcelanguage'), $languages);
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
if (has_capability('moodle/site:config', $systemcontext) && ((!empty($course->requested) && $CFG->restrictmodulesfor == 'requested') || $CFG->restrictmodulesfor == 'all')) {
|
||||
$mform->addElement('header', '', get_string('restrictmodules'));
|
||||
|
||||
$options = array();
|
||||
$options['0'] = get_string('no');
|
||||
$options['1'] = get_string('yes');
|
||||
$mform->addElement('select', 'restrictmodules', get_string('restrictmodules'), $options);
|
||||
$mods = array(0=>get_string('allownone'));
|
||||
$mods += get_records_menu('modules', '','','','id, name');
|
||||
|
||||
|
||||
$mform->addElement('select', 'allowedmods', get_string('to'), $mods,
|
||||
array('multiple'=>'multiple', 'size'=>'10'));
|
||||
$mform->disabledIf('allowedmods', 'restrictmodules', 'eq', 0);
|
||||
} else {
|
||||
$mform->addElement('hidden', 'restrictmodules', null);
|
||||
}
|
||||
if ($CFG->restrictmodulesfor == 'all') {
|
||||
$mform->setDefault('allowedmods', explode(',',$CFG->defaultallowedmodules));
|
||||
if (!empty($CFG->restrictbydefault)) {
|
||||
$mform->setDefault('restrictmodules', 1);
|
||||
}
|
||||
}
|
||||
$mform->setType('restrictmodules', PARAM_INT);
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
$this->add_action_buttons();
|
||||
//--------------------------------------------------------------------------------
|
||||
$mform->addElement('hidden', 'id', null);
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
// fill in default teacher and student names to keep backwards compatibility for a while
|
||||
$mform->addElement('hidden', 'teacher', get_string('defaultcourseteacher'));
|
||||
$mform->addElement('hidden', 'teachers', get_string('defaultcourseteachers'));
|
||||
$mform->addElement('hidden', 'student', get_string('defaultcoursestudent'));
|
||||
$mform->addElement('hidden', 'students', get_string('defaultcoursestudents'));
|
||||
}
|
||||
|
||||
$mform->addElement('header','', get_string("language"));
|
||||
$mform->setDefault('lang',(isset($toform->lang))?$toform->lang:'');
|
||||
$languages=array();
|
||||
$languages[''] = get_string("forceno");
|
||||
$languages += get_list_of_languages();
|
||||
$mform->addElement('select', 'lang', get_string("forcelanguage"), $languages);
|
||||
|
||||
if(!has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $toform->category))) {
|
||||
$mform->addElement('hidden', 'category', null);
|
||||
}
|
||||
$mform->addElement('hidden', 'id', null);
|
||||
|
||||
$mform->setDefault('restrictmodules',(isset($toform->restrictmodules))?$toform->restrictmodules:0);
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) && ((!empty($course->requested) && $CFG->restrictmodulesfor == 'requested') || $CFG->restrictmodulesfor == 'all')) {
|
||||
unset($options);
|
||||
$options[0] = get_string("no");
|
||||
$options[1] = get_string("yes");
|
||||
$mform->addElement('header', '', get_string("restrictmodules"));
|
||||
$mform->addElement('select', 'restrictmodules', get_string("restrictmodules"), $options,
|
||||
array('onChange'=>"document.getElementById('id_allowedmods').disabled=".
|
||||
"((this.selectedIndex==0)?true:false);"));
|
||||
$mods = array(0=>get_string('allownone'));
|
||||
$mods += get_records_menu("modules", '','','','id, name');
|
||||
$disabled=($mform->exportValue('restrictmodules')==1) ? array() :array('disabled' => 'disabled') ;
|
||||
|
||||
|
||||
$mform->setDefault('allowedmods', $toform->allowedmods);
|
||||
$mform->addElement('select', 'allowedmods', get_string("to"),$mods,
|
||||
array('multiple'=>"multiple", 'size'=>"10", 'id'=>"allowedmods")
|
||||
+$disabled);
|
||||
}else {
|
||||
$mform->addElement('hidden', 'restrictmodules', $toform->restrictmodules);
|
||||
}
|
||||
$mform->setHelpButtons(array('category'=>array("coursecategory", get_string("category")),
|
||||
'fullname'=>array("coursefullname", get_string("fullname")),
|
||||
'shortname'=>array("courseshortname", get_string("shortname")),
|
||||
'idnumber'=>array("courseidnumber", get_string("idnumbercourse")),
|
||||
'summary'=>array("text", get_string("helptext")),
|
||||
'format'=>array("courseformats", get_string("courseformats")),
|
||||
'summary'=>array("coursestartdate", get_string("startdate")),
|
||||
'enrol'=>array("courseenrolmentplugins", get_string("enrolmentplugins")),
|
||||
'enrollable'=>array("courseenrollable", get_string("enrollable")),
|
||||
'expirynotify'=>array("expirynotify", get_string("expirynotify")),
|
||||
'notifystudents'=>array("expirynotifystudents", get_string("expirynotifystudents")),
|
||||
'expirythreshold'=>array("expirythreshold", get_string("expirythreshold")),
|
||||
'groupmode'=>array("groupmode", get_string("groupmode")),
|
||||
'groupmodeforce'=>array("groupmodeforce", get_string("groupmodeforce")),
|
||||
'visible'=>array("courseavailability", get_string("availability")),
|
||||
'password'=>array("enrolmentkey", get_string("enrolmentkey")),
|
||||
'guest'=>array("guestaccess", get_string("opentoguests")),
|
||||
'costgrp'=>array("cost", get_string("cost")),
|
||||
'hiddensections'=>array("coursehiddensections", get_string("hiddensections")),
|
||||
'newsitems'=>array("coursenewsitems", get_string("newsitemsnumber")),
|
||||
'showgrades'=>array("coursegrades", get_string("grades")),
|
||||
'showreports'=>array("coursereports", get_string("activityreport")),
|
||||
'maxbytes'=>array("courseuploadsize", get_string("maximumupload")),
|
||||
'metacourse'=>array("metacourse", get_string("metacourse")),
|
||||
'defaultrole'=>array("coursedefaultrole", get_string("defaultrole", 'role'))),
|
||||
true);
|
||||
$mform->addElement('submit', 'submit', get_string("savechanges"));
|
||||
|
||||
$mform->addRule('fullname', get_string("missingfullname"), 'required', null, 'client');
|
||||
$mform->addRule('shortname', get_string("missingshortname"), 'required', null, 'client');
|
||||
$mform->addRule('summary', get_string("missingsummary"), 'required', null, 'client');
|
||||
$mform->addRule('category', get_string("missingcategory"), 'required', null, 'client');
|
||||
|
||||
/**
|
||||
* a Form rule check - if we need to create rules which involve the contents of more than one
|
||||
* field this is the way to do it. We can do it all at once in one function or create several
|
||||
* form rules.
|
||||
*
|
||||
* @param array $fields values from form without slashes
|
||||
* @return mixed array of errors or true if passed check
|
||||
*/
|
||||
function form_check($fields){
|
||||
global $course;
|
||||
/// perform some extra moodle validation
|
||||
function validation($data){
|
||||
$errors= array();
|
||||
if ($foundcourses = get_records("course", "shortname", addslashes($fields['shortname']))) {
|
||||
if (!empty($course->id)) {
|
||||
unset($foundcourses[$course->id]);
|
||||
if ($foundcourses = get_records('course', 'shortname', $data['shortname'])) {
|
||||
if (!empty($data['id'])) {
|
||||
unset($foundcourses[$data['id']]);
|
||||
}
|
||||
if (!empty($foundcourses)) {
|
||||
foreach ($foundcourses as $foundcourse) {
|
||||
$foundcoursenames[] = $foundcourse->fullname;
|
||||
}
|
||||
$foundcoursenamestring = addslashes(implode(',', $foundcoursenames));
|
||||
|
||||
$errors['shortname']= get_string("shortnametaken", "", $foundcoursenamestring);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (empty($fields['enrolenddisabled'])){
|
||||
$enrolenddate=make_timestamp($fields['enrolenddate']['year'],
|
||||
$fields['enrolenddate']['month'],
|
||||
$fields['enrolenddate']['day']);
|
||||
$enrolstartdate=make_timestamp($fields['enrolstartdate']['year'],
|
||||
$fields['enrolstartdate']['month'],
|
||||
$fields['enrolstartdate']['day']);
|
||||
if ($enrolenddate <= $enrolstartdate){
|
||||
$errors['enroldateendgrp']=get_string("enrolenddaterror");
|
||||
$foundcoursenamestring = implode(',', $foundcoursenames);
|
||||
$errors['shortname']= get_string('shortnametaken', '', $foundcoursenamestring);
|
||||
}
|
||||
}
|
||||
if (0==count($errors)){
|
||||
|
||||
if (empty($data['enrolenddisabled'])){
|
||||
if ($data['enrolenddate'] <= $data['enrolstartdate']){
|
||||
$errors['enroldateendgrp'] = get_string('enrolenddaterror');
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == count($errors)){
|
||||
return true;
|
||||
}else {
|
||||
} else {
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
$mform->addFormRule('form_check');
|
||||
|
||||
$renderer =& $mform->defaultRenderer();
|
||||
$renderer->addStopFieldsetElements('submit');
|
||||
?>
|
||||
}
|
||||
?>
|
||||
+10
-9
@@ -8,12 +8,15 @@
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$loginasguest = optional_param('loginasguest', 0, PARAM_BOOL);
|
||||
$loginasguest = optional_param('loginasguest', 0, PARAM_BOOL); // hmm, is this still needed?
|
||||
|
||||
require_login();
|
||||
|
||||
if ($USER->username == 'guest') { // Guests can't enrol in anything!
|
||||
redirect($CFG->wwwroot.'/login/index.php');
|
||||
if (!isloggedin()) {
|
||||
$wwwroot = $CFG->wwwroot;
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$wwwroot = str_replace('http:','https:', $wwwroot);
|
||||
}
|
||||
// do not use require_login here because we are usually comming from it
|
||||
redirect($wwwroot.'/login/index.php');
|
||||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
@@ -24,9 +27,7 @@
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (! $enrol = enrolment_factory::factory($course->enrol)) {
|
||||
error("Could not determine course enrolment method!");
|
||||
}
|
||||
$enrol = enrolment_factory::factory($course->enrol); // do not use if (!$enrol... here, it can not work in PHP4 - see MDL-7529
|
||||
|
||||
/// Refreshing all current role assignments for the current user
|
||||
|
||||
@@ -36,7 +37,7 @@
|
||||
/// thus got to this script by mistake. This might occur if enrolments
|
||||
/// changed during this session or something
|
||||
|
||||
if (has_capability('moodle/course:view', $context) and !has_capability('moodle/legacy:guest', $context)) {
|
||||
if (has_capability('moodle/course:view', $context) and !has_capability('moodle/legacy:guest', $context, NULL, false)) {
|
||||
if ($SESSION->wantsurl) {
|
||||
$destination = $SESSION->wantsurl;
|
||||
unset($SESSION->wantsurl);
|
||||
|
||||
@@ -238,17 +238,19 @@ while ($section <= $course->numsections) {
|
||||
|
||||
$currenttopic = ($course->marker == $section);
|
||||
|
||||
$currenttext = '';
|
||||
if (!$thissection->visible) {
|
||||
$sectionstyle = ' hidden';
|
||||
} else if ($currenttopic) {
|
||||
$sectionstyle = ' current';
|
||||
$currenttext = get_accesshide(get_string('currenttopic','access'));
|
||||
} else {
|
||||
$sectionstyle = '';
|
||||
}
|
||||
|
||||
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
|
||||
|
||||
echo '<td class="left side"> </td>';
|
||||
echo '<td class="left side"> '.$currenttext.'</td>';
|
||||
|
||||
echo '<td class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
|
||||
@@ -171,16 +171,18 @@
|
||||
|
||||
$currenttopic = ($course->marker == $section);
|
||||
|
||||
$currenttext = '';
|
||||
if (!$thissection->visible) {
|
||||
$sectionstyle = ' hidden';
|
||||
} else if ($currenttopic) {
|
||||
$sectionstyle = ' current';
|
||||
$currenttext = get_accesshide(get_string('currenttopic','access'));
|
||||
} else {
|
||||
$sectionstyle = '';
|
||||
}
|
||||
|
||||
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
|
||||
echo '<td class="left side">'.$section.'</td>';
|
||||
echo '<td class="left side">'.$currenttext.$section.'</td>';
|
||||
|
||||
echo '<td class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
define('BLOCK_R_MIN_WIDTH', 100);
|
||||
define('BLOCK_R_MAX_WIDTH', 210);
|
||||
|
||||
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
|
||||
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
|
||||
BLOCK_L_MAX_WIDTH);
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
if ($week != -1) {
|
||||
@@ -88,7 +88,7 @@
|
||||
echo '<tr id="section-0" class="section main">';
|
||||
echo '<td class="left side"> </td>';
|
||||
echo '<td class="content">';
|
||||
|
||||
|
||||
echo '<div class="summary">';
|
||||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
@@ -99,7 +99,7 @@
|
||||
'class="icon edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
|
||||
print_section($course, $thissection, $mods, $modnamesused);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
@@ -162,26 +162,20 @@
|
||||
|
||||
$currentweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate));
|
||||
|
||||
$currenttext = '';
|
||||
if (!$thissection->visible) {
|
||||
$sectionstyle = ' hidden';
|
||||
} else if ($currentweek) {
|
||||
$sectionstyle = ' current';
|
||||
$currenttext = get_accesshide(get_string('currentweek','access'));
|
||||
} else {
|
||||
$sectionstyle = '';
|
||||
}
|
||||
|
||||
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
|
||||
echo '<td class="left side"> </td>';
|
||||
echo '<td class="left side"> '.$currenttext.'</td>';
|
||||
|
||||
if (!empty($USER->ajax) && $editing) {
|
||||
// Temporarily hide the dates for the weeks. We do it this way
|
||||
// for now. Eventually, we'll have to modify the javascript code
|
||||
// to handle re-calculation of dates when sections are moved
|
||||
// around. For now, just hide all the dates to avoid confusion.
|
||||
$weekperiod = '';
|
||||
} else {
|
||||
$weekperiod = $weekday.' '.$endweekday;
|
||||
}
|
||||
$weekperiod = $weekday.' - '.$endweekday;
|
||||
|
||||
echo '<td class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
@@ -265,4 +259,4 @@
|
||||
|
||||
echo '</tr></table>';
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -190,10 +190,12 @@
|
||||
|
||||
$currentweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate));
|
||||
|
||||
$currenttext = '';
|
||||
if (!$thissection->visible) {
|
||||
$sectionstyle = ' hidden';
|
||||
} else if ($currentweek) {
|
||||
$sectionstyle = ' current';
|
||||
$currenttext = get_accesshide(get_string('currentweek','access'));
|
||||
} else {
|
||||
$sectionstyle = '';
|
||||
}
|
||||
@@ -201,7 +203,7 @@
|
||||
echo '<li id="section-'.$section.'" class="section main'.$sectionstyle.'" >'; //'<div class="left side"> </div>';
|
||||
|
||||
// Note, 'right side' is BEFORE content.
|
||||
echo '<div class="right side">';
|
||||
echo '<div class="right side">'.$currenttext;
|
||||
|
||||
if ($displaysection == $section) {
|
||||
echo '<a href="view.php?id='.$course->id.'&week=0#section-'.$section.'" title="'.$strshowallweeks.'">'.
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
$newgrpcoursecontext = get_context_instance(CONTEXT_COURSE, $newgroup->courseid);
|
||||
|
||||
///Users cannot upload groups in courses they cannot update.
|
||||
if (has_capability('moodle/course:update', $newgrpcoursecontext)){
|
||||
if (!has_capability('moodle/course:managegroups', $newgrpcoursecontext)){
|
||||
notify("$newgroup->name ".get_string('notaddedto').$newgroup->coursename.get_string('notinyourcapacity'));
|
||||
}
|
||||
|
||||
@@ -212,4 +212,3 @@ function my_file_get_contents($filename, $use_include_path = 0) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -110,13 +110,12 @@
|
||||
|
||||
/// If no search results then get potential students for this course excluding users already in course
|
||||
if (empty($searchcourses)) {
|
||||
$numcourses = count_courses_notin_metacourse($course->id);
|
||||
|
||||
$numcourses = get_courses_notin_metacourse($course->id,true);
|
||||
|
||||
$courses = array();
|
||||
|
||||
if ($numcourses <= MAX_COURSES_PER_PAGE) {
|
||||
if ($numcourses > 0 and $numcourses <= MAX_COURSES_PER_PAGE) {
|
||||
$courses = get_courses_notin_metacourse($course->id);
|
||||
} else {
|
||||
$courses = array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -60,11 +60,13 @@
|
||||
echo "<center>";
|
||||
|
||||
/// I am not sure this context in the next has_capability call is correct.
|
||||
if (isloggedin() and !isguest() and !has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) { // Print link to request a new course
|
||||
if (isloggedin() and !isguest() and !has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $CFG->enablecourserequests) { // Print link to request a new course
|
||||
print_single_button("request.php", NULL, get_string("courserequest"), "get");
|
||||
}
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) { // Print link to create a new course
|
||||
print_single_button("edit.php", NULL, get_string("addnewcourse"), "get");
|
||||
/// Get the 1st available category
|
||||
$options = array('category' => get_field('course_categories', 'id', 'parent', '0'));
|
||||
print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
|
||||
}
|
||||
if (has_capability('moodle/site:approvecourse', get_context_instance(CONTEXT_SYSTEM, SITEID)) and !empty($CFG->enablecourserequests)) {
|
||||
print_single_button('pending.php',NULL, get_string('coursespending'),"get");
|
||||
|
||||
+24
-16
@@ -43,28 +43,37 @@
|
||||
}
|
||||
|
||||
|
||||
if ($teachers = get_course_teachers($course->id)) {
|
||||
echo "<table align=\"center\"><tr><td nowrap=\"nowrap\">";
|
||||
echo "<p><font size=\"1\">\n";
|
||||
foreach ($teachers as $teacher) {
|
||||
if ($teacher->authority > 0) {
|
||||
if (!$teacher->role) {
|
||||
$teacher->role = $course->teacher;
|
||||
/// first find all roles that are supposed to be displayed
|
||||
if (!empty($CFG->coursemanager)) {
|
||||
$coursemanagerroles = split(',', $CFG->coursemanager);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
foreach ($coursemanagerroles as $roleid) {
|
||||
$role = get_record('role','id',$roleid);
|
||||
if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', true)) {
|
||||
foreach ($users as $teacher) {
|
||||
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
|
||||
$namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
|
||||
$teacher->id.'&course='.SITEID.'">'.$fullname.'</a>';
|
||||
}
|
||||
echo "$teacher->role: ";
|
||||
link_to_popup_window ("/user/view.php?id=$teacher->id&course=$site->id", "opener",
|
||||
fullname($teacher), 400, 500, "$teacher->role",
|
||||
"");
|
||||
echo "<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($namesarray)) {
|
||||
echo "<div align=\"center\">";
|
||||
echo implode('<br />', $namesarray);
|
||||
echo "</div>";
|
||||
}
|
||||
echo "</font></p>";
|
||||
echo "</td</tr></table>";
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center", "100%");
|
||||
echo filter_text(text_to_html($course->summary),$course->id);
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php");
|
||||
$enrol = enrolment_factory::factory($course->enrol);
|
||||
echo $enrol->get_access_icons($course);
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
echo "<br />";
|
||||
@@ -72,4 +81,3 @@
|
||||
close_window_button();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+124
-75
@@ -241,19 +241,50 @@ function make_log_url($module, $url) {
|
||||
case 'message':
|
||||
case 'calendar':
|
||||
case 'blog':
|
||||
return "/$module/$url";
|
||||
if (strpos($url, '../') === 0) {
|
||||
$url = ltrim($url, '.');
|
||||
} else {
|
||||
$url = "/course/$url";
|
||||
}
|
||||
break;
|
||||
$url = "/$module/$url";
|
||||
break;
|
||||
case 'upload':
|
||||
return $url;
|
||||
$url = $url;
|
||||
break;
|
||||
case 'library':
|
||||
case '':
|
||||
return '/';
|
||||
$url = '/';
|
||||
break;
|
||||
default:
|
||||
return "/mod/$module/$url";
|
||||
$url = "/mod/$module/$url";
|
||||
break;
|
||||
}
|
||||
|
||||
//now let's sanitise urls - there might be some ugly nasties:-(
|
||||
$parts = explode('?', $url);
|
||||
$script = array_shift($parts);
|
||||
if (strpos($script, 'http') === 0) {
|
||||
$script = clean_param($script, PARAM_URL);
|
||||
} else {
|
||||
$script = clean_param($script, PARAM_PATH);
|
||||
}
|
||||
|
||||
$query = '';
|
||||
if ($parts) {
|
||||
$query = implode('', $parts);
|
||||
$query = str_replace('&', '&', $query); // both & and & are stored in db :-|
|
||||
$parts = explode('&', $query);
|
||||
$eq = urlencode('=');
|
||||
foreach ($parts as $key=>$part) {
|
||||
$part = urlencode(urldecode($part));
|
||||
$part = str_replace($eq, '=', $part);
|
||||
$parts[$key] = $part;
|
||||
}
|
||||
$query = '?'.implode('&', $parts);
|
||||
}
|
||||
|
||||
return $script.$query;
|
||||
}
|
||||
|
||||
|
||||
@@ -415,10 +446,6 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
|
||||
//Filter log->info
|
||||
$log->info = format_string($log->info);
|
||||
|
||||
$log->url = strip_tags(urldecode($log->url)); // Some XSS protection
|
||||
$log->info = strip_tags(urldecode($log->info)); // Some XSS protection
|
||||
$log->url = str_replace('&', '&', $log->url); /// XHTML compatibility
|
||||
|
||||
echo '<tr class="r'.$row.'">';
|
||||
if ($course->id == SITEID) {
|
||||
echo "<td class=\"r$row c0\" nowrap=\"nowrap\">\n";
|
||||
@@ -506,10 +533,7 @@ function print_log_csv($course, $user, $date, $order='l.time DESC', $modname,
|
||||
|
||||
//Filter log->info
|
||||
$log->info = format_string($log->info);
|
||||
|
||||
$log->url = strip_tags(urldecode($log->url)); // Some XSS protection
|
||||
$log->info = strip_tags(urldecode($log->info)); // Some XSS protection
|
||||
$log->url = str_replace('&', '&', $log->url); // XHTML compatibility
|
||||
|
||||
$firstField = $courses[$log->course];
|
||||
$fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
|
||||
@@ -532,7 +556,8 @@ function print_log_xls($course, $user, $date, $order='l.time DESC', $modname,
|
||||
$modname, $modid, $modaction, $groupid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$courses = array();
|
||||
if ($course->id == SITEID) {
|
||||
$courses[0] = '';
|
||||
if ($ccc = get_courses('all', 'c.id ASC', 'c.id,c.shortname')) {
|
||||
@@ -540,6 +565,8 @@ function print_log_xls($course, $user, $date, $order='l.time DESC', $modname,
|
||||
$courses[$cc->id] = $cc->shortname;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$courses[$course->id] = $course->shortname;
|
||||
}
|
||||
|
||||
$count=0;
|
||||
@@ -707,10 +734,7 @@ function print_log_ooo($course, $user, $date, $order='l.time DESC', $modname,
|
||||
|
||||
// Filter log->info
|
||||
$log->info = format_string($log->info);
|
||||
|
||||
$log->url = strip_tags(urldecode($log->url)); // Some XSS protection
|
||||
$log->info = strip_tags(urldecode($log->info)); // Some XSS protection
|
||||
$log->url = str_replace('&', '&', $log->url); // XHTML compatibility
|
||||
|
||||
$firstField = $courses[$log->course];
|
||||
$fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
|
||||
@@ -1027,15 +1051,13 @@ function get_all_sections($courseid) {
|
||||
function course_set_display($courseid, $display=0) {
|
||||
global $USER;
|
||||
|
||||
if (empty($USER->id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($display == "all" or empty($display)) {
|
||||
$display = 0;
|
||||
}
|
||||
|
||||
if (record_exists("course_display", "userid", $USER->id, "course", $courseid)) {
|
||||
if (empty($USER->id) or $USER->username == 'guest') {
|
||||
//do not store settings in db for guests
|
||||
} else if (record_exists("course_display", "userid", $USER->id, "course", $courseid)) {
|
||||
set_field("course_display", "display", $display, "userid", $USER->id, "course", $courseid);
|
||||
} else {
|
||||
$record->userid = $USER->id;
|
||||
@@ -1549,21 +1571,21 @@ function print_course($course, $width="100%") {
|
||||
$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.
|
||||
$course->fullname.'</a></b><br />';
|
||||
|
||||
if ($teachers = get_users_by_capability($context, 'moodle/course:update',
|
||||
'u.*, ul.timeaccess as lastaccess, ra.hidden',
|
||||
'r.sortorder ASC', '','','','', false)) {
|
||||
$canseehidden = has_capability('moodle/role:viewhiddenassigns', $context);
|
||||
$namesarray = array();
|
||||
foreach ($teachers as $teacher) {
|
||||
if (!$teacher->hidden || $canseehidden) {
|
||||
$roles = get_user_roles($context, $teacher->id);
|
||||
$role = array_shift($roles); // First one
|
||||
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
|
||||
$namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
|
||||
$teacher->id.'&course='.SITEID.'">'.$fullname.'</a>';
|
||||
}
|
||||
/// first find all roles that are supposed to be displayed
|
||||
if (!empty($CFG->coursemanager)) {
|
||||
$coursemanagerroles = split(',', $CFG->coursemanager);
|
||||
foreach ($coursemanagerroles as $roleid) {
|
||||
$role = get_record('role','id',$roleid);
|
||||
if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', true)) {
|
||||
foreach ($users as $teacher) {
|
||||
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
|
||||
$namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
|
||||
$teacher->id.'&course='.SITEID.'">'.$fullname.'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($namesarray) {
|
||||
|
||||
if (!empty($namesarray)) {
|
||||
echo "<ul class=\"teachers\">\n<li>";
|
||||
echo implode('</li><li>', $namesarray);
|
||||
echo "</li></ul>";
|
||||
@@ -1763,7 +1785,7 @@ function delete_course_module($id) {
|
||||
$modulename = get_field('modules', 'name', 'id', $cm->module);
|
||||
if ($events = get_records_select('event', "instance = '$cm->instance' AND modulename = '$modulename'")) {
|
||||
foreach($events as $event) {
|
||||
delete_event($event);
|
||||
delete_event($event->id);
|
||||
}
|
||||
}
|
||||
return delete_records('course_modules', 'id', $cm->id);
|
||||
@@ -1882,16 +1904,16 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
|
||||
static $sesskey;
|
||||
|
||||
if (!isset($str)) {
|
||||
$str->delete = get_string("delete");
|
||||
$str->move = get_string("move");
|
||||
$str->moveup = get_string("moveup");
|
||||
$str->movedown = get_string("movedown");
|
||||
$str->moveright = get_string("moveright");
|
||||
$str->moveleft = get_string("moveleft");
|
||||
$str->update = get_string("update");
|
||||
$str->duplicate = get_string("duplicate");
|
||||
$str->hide = get_string("hide");
|
||||
$str->show = get_string("show");
|
||||
$str->delete = get_string("delete");
|
||||
$str->move = get_string("move");
|
||||
$str->moveup = get_string("moveup");
|
||||
$str->movedown = get_string("movedown");
|
||||
$str->moveright = get_string("moveright");
|
||||
$str->moveleft = get_string("moveleft");
|
||||
$str->update = get_string("update");
|
||||
$str->duplicate = get_string("duplicate");
|
||||
$str->hide = get_string("hide");
|
||||
$str->show = get_string("show");
|
||||
$str->clicktochange = get_string("clicktochange");
|
||||
$str->forcedmode = get_string("forcedmode");
|
||||
$str->groupsnone = get_string("groupsnone");
|
||||
@@ -1913,32 +1935,35 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
|
||||
}
|
||||
|
||||
if ($mod->visible) {
|
||||
$hideshow = '<a title="'.$str->hide.'" href="'.$path.'/mod.php?hide='.$mod->id.
|
||||
$hideshow = '<a class="editing_hide" title="'.$str->hide.'" href="'.$path.'/mod.php?hide='.$mod->id.
|
||||
'&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/hide.gif" hspace="2" height="11" width="11" '.
|
||||
' border="0" alt="'.$str->hide.'" /></a> ';
|
||||
' border="0" alt="'.$str->hide.'" /></a>'."\n";
|
||||
} else {
|
||||
$hideshow = '<a title="'.$str->show.'" href="'.$path.'/mod.php?show='.$mod->id.
|
||||
$hideshow = '<a class="editing_show" title="'.$str->show.'" href="'.$path.'/mod.php?show='.$mod->id.
|
||||
'&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/show.gif" hspace="2" height="11" width="11" '.
|
||||
' border="0" alt="'.$str->show.'" /></a> ';
|
||||
' border="0" alt="'.$str->show.'" /></a>'."\n";
|
||||
}
|
||||
if ($mod->groupmode !== false) {
|
||||
if ($mod->groupmode == SEPARATEGROUPS) {
|
||||
$grouptitle = $str->groupsseparate;
|
||||
$groupclass = 'editing_groupseparate';
|
||||
$groupimage = $CFG->pixpath.'/t/groups.gif';
|
||||
$grouplink = $path.'/mod.php?id='.$mod->id.'&groupmode=0&sesskey='.$sesskey;
|
||||
} else if ($mod->groupmode == VISIBLEGROUPS) {
|
||||
$grouptitle = $str->groupsvisible;
|
||||
$groupclass = 'editing_groupvisible';
|
||||
$groupimage = $CFG->pixpath.'/t/groupv.gif';
|
||||
$grouplink = $path.'/mod.php?id='.$mod->id.'&groupmode=1&sesskey='.$sesskey;
|
||||
} else {
|
||||
$grouptitle = $str->groupsnone;
|
||||
$groupclass = 'editing_groupsnone';
|
||||
$groupimage = $CFG->pixpath.'/t/groupn.gif';
|
||||
$grouplink = $path.'/mod.php?id='.$mod->id.'&groupmode=2&sesskey='.$sesskey;
|
||||
}
|
||||
if ($mod->groupmodelink) {
|
||||
$groupmode = '<a title="'.$grouptitle.' ('.$str->clicktochange.')" href="'.$grouplink.'">'.
|
||||
$groupmode = '<a class="'.$groupclass.'" title="'.$grouptitle.' ('.$str->clicktochange.')" href="'.$grouplink.'">'.
|
||||
'<img src="'.$groupimage.'" hspace="2" height="11" width="11" '.
|
||||
'border="0" alt="'.$grouptitle.'" /></a>';
|
||||
} else {
|
||||
@@ -1951,44 +1976,44 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
|
||||
}
|
||||
|
||||
if ($moveselect) {
|
||||
$move = '<a title="'.$str->move.'" href="'.$path.'/mod.php?copy='.$mod->id.
|
||||
$move = '<a class="editing_move" title="'.$str->move.'" href="'.$path.'/mod.php?copy='.$mod->id.
|
||||
'&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/move.gif" hspace="2" height="11" width="11" '.
|
||||
' border="0" alt="'.$str->move.'" /></a>';
|
||||
' border="0" alt="'.$str->move.'" /></a>'."\n";
|
||||
} else {
|
||||
$move = '<a title="'.$str->moveup.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
$move = '<a class="editing_moveup" title="'.$str->moveup.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
'&move=-1&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/up.gif" hspace="2" height="11" width="11" '.
|
||||
' border="0" alt="'.$str->moveup.'" /></a>'.
|
||||
'<a title="'.$str->movedown.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
' border="0" alt="'.$str->moveup.'" /></a>'."\n".
|
||||
'<a class="editing_movedown" title="'.$str->movedown.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
'&move=1&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/down.gif" hspace="2" height="11" width="11" '.
|
||||
' border="0" alt="'.$str->movedown.'" /></a>';
|
||||
' border="0" alt="'.$str->movedown.'" /></a>'."\n";
|
||||
}
|
||||
|
||||
$leftright = "";
|
||||
if ($indent > 0) {
|
||||
$leftright .= '<a title="'.$str->moveleft.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
$leftright .= '<a class="editing_moveleft" title="'.$str->moveleft.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
'&indent=-1&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/left.gif" hspace="2" height="11" width="11" '.
|
||||
' border="0" alt="'.$str->moveleft.'" /></a>';
|
||||
' border="0" alt="'.$str->moveleft.'" /></a>'."\n";
|
||||
}
|
||||
if ($indent >= 0) {
|
||||
$leftright .= '<a title="'.$str->moveright.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
$leftright .= '<a class="editing_moveright" title="'.$str->moveright.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
'&indent=1&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/right.gif" hspace="2" height="11" width="11" '.
|
||||
' border="0" alt="'.$str->moveright.'" /></a>';
|
||||
' border="0" alt="'.$str->moveright.'" /></a>'."\n";
|
||||
}
|
||||
|
||||
return '<span class="commands">'.$leftright.$move.
|
||||
'<a title="'.$str->update.'" href="'.$path.'/mod.php?update='.$mod->id.
|
||||
return '<span class="commands">'."\n".$leftright.$move.
|
||||
'<a class="editing_update" title="'.$str->update.'" href="'.$path.'/mod.php?update='.$mod->id.
|
||||
'&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/edit.gif" hspace="2" height="11" width="11" border="0" '.
|
||||
' alt="'.$str->update.'" /></a>'.
|
||||
'<a title="'.$str->delete.'" href="'.$path.'/mod.php?delete='.$mod->id.
|
||||
' alt="'.$str->update.'" /></a>'."\n".
|
||||
'<a class="editing_delete" title="'.$str->delete.'" href="'.$path.'/mod.php?delete='.$mod->id.
|
||||
'&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/delete.gif" hspace="2" height="11" width="11" border="0" '.
|
||||
' alt="'.$str->delete.'" /></a>'.$hideshow.$groupmode.'</span>';
|
||||
' alt="'.$str->delete.'" /></a>'."\n".$hideshow.$groupmode."\n".'</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2159,7 +2184,7 @@ function move_courses ($courseids, $categoryid) {
|
||||
// figure out a sortorder that we can use in the destination category
|
||||
$sortorder = get_field_sql('SELECT MIN(sortorder)-1 AS min
|
||||
FROM ' . $CFG->prefix . 'course WHERE category=' . $categoryid);
|
||||
if ($sortorder === false) {
|
||||
if (is_null($sortorder) || $sortorder === false) {
|
||||
// the category is empty
|
||||
// rather than let the db default to 0
|
||||
// set it to > 100 and avoid extra work in fix_coursesortorder()
|
||||
@@ -2170,16 +2195,8 @@ function move_courses ($courseids, $categoryid) {
|
||||
|
||||
$course->category = $categoryid;
|
||||
$course->sortorder = $sortorder;
|
||||
$course->fullname = addslashes($course->fullname);
|
||||
$course->shortname = addslashes($course->shortname);
|
||||
$course->summary = addslashes($course->summary);
|
||||
$course->password = addslashes($course->password);
|
||||
$course->teacher = addslashes($course->teacher);
|
||||
$course->teachers = addslashes($course->teachers);
|
||||
$course->student = addslashes($course->student);
|
||||
$course->students = addslashes($course->students);
|
||||
|
||||
if (!update_record('course', $course)) {
|
||||
if (!update_record('course', addslashes_object($course))) {
|
||||
notify("An error occurred - course not moved!");
|
||||
}
|
||||
}
|
||||
@@ -2189,4 +2206,36 @@ function move_courses ($courseids, $categoryid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can the current user delete this course?
|
||||
* @param int $courseid
|
||||
* @return boolean
|
||||
*
|
||||
* Exception here to fix MDL-7796.
|
||||
*
|
||||
* FIXME
|
||||
* Course creators who can manage activities in the course
|
||||
* shoule be allowed to delete the course. We do it this
|
||||
* way because we need a quick fix to bring the functionality
|
||||
* in line with what we had pre-roles. We can't give the
|
||||
* default course creator role moodle/course:delete at
|
||||
* CONTEXT_SYSTEM level because this will allow them to
|
||||
* delete any course in the site. So we hard code this here
|
||||
* for now.
|
||||
*
|
||||
* @author vyshane AT gmail.com
|
||||
*/
|
||||
function can_delete_course($courseid) {
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
|
||||
return ( has_capability('moodle/course:delete', $context)
|
||||
|| (has_capability('moodle/legacy:coursecreator', $context)
|
||||
&& has_capability('moodle/course:manageactivities', $context)) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -53,6 +53,9 @@
|
||||
if (!has_capability('moodle/course:view', $context, $userid, false)) {
|
||||
error('This user is not in this course!');
|
||||
}
|
||||
if (has_capability('moodle/site:doanything', $context, $userid, false)) {
|
||||
print_error('nologinas');
|
||||
}
|
||||
}
|
||||
|
||||
/// User must have permissions
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Moves, adds, updates, duplicates or deletes modules in a course
|
||||
|
||||
require("../config.php");
|
||||
require("lib.php");
|
||||
require_once("lib.php");
|
||||
|
||||
require_login();
|
||||
|
||||
|
||||
@@ -126,4 +126,3 @@ function print_outline_row($mod, $instance, $result) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -73,17 +73,17 @@
|
||||
$graph->y_data['line3'][] = $stat->line3;
|
||||
}
|
||||
}
|
||||
$graph->y_order = array('line1','line2');
|
||||
if (!empty($param->line3)) {
|
||||
$graph->y_order[] = 'line3';
|
||||
}
|
||||
$graph->y_order = array('line1');
|
||||
$graph->y_format['line1'] = array('colour' => $c[1],'line' => 'line','legend' => $param->line1);
|
||||
if (!empty($param->line2)) {
|
||||
$graph->y_order[] = 'line2';
|
||||
$graph->y_format['line2'] = array('colour' => $c[2],'line' => 'line','legend' => $param->line2);
|
||||
}
|
||||
if (!empty($param->line3)) {
|
||||
$graph->y_order[] = 'line3';
|
||||
$graph->y_format['line3'] = array('colour' => $c[3],'line' => 'line','legend' => $param->line3);
|
||||
}
|
||||
$graph->y_tick_labels = false;
|
||||
} else {
|
||||
$data = array();
|
||||
$times = array();
|
||||
@@ -103,6 +103,16 @@
|
||||
$times[$stat->timeend] = userdate($stat->timeend,get_string('strftimedate'),$CFG->timezone);
|
||||
}
|
||||
}
|
||||
foreach (array_keys($times) as $t) {
|
||||
foreach ($data as $roleid => $stuff) {
|
||||
if (!array_key_exists($t, $stuff)) {
|
||||
$data[$roleid][$t] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($data as $role => $stuff) {
|
||||
ksort($data[$role]);
|
||||
}
|
||||
$nonzeroroleid = 0;
|
||||
foreach (array_keys($data) as $roleid) {
|
||||
if ($roleid == 0) {
|
||||
|
||||
@@ -167,6 +167,13 @@
|
||||
$rolesdata[$roleid] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach (array_keys($roles) as $r) {
|
||||
if (!array_key_exists($r, $rolesdata)) {
|
||||
$rolesdata[$r] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
krsort($rolesdata);
|
||||
$row = array_merge(array($times[$time]),$rolesdata);
|
||||
if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) {
|
||||
|
||||
+38
-22
@@ -6,11 +6,10 @@ require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->libdir .'/pagelib.php');
|
||||
require_once($CFG->libdir .'/blocklib.php');
|
||||
|
||||
|
||||
// Initialise ALL the incoming parameters here, up front.
|
||||
|
||||
$courseid = required_param('courseId', PARAM_INT);
|
||||
$class = required_param('class', PARAM_ALPHA);
|
||||
|
||||
$courseid = required_param('courseId', PARAM_INT);
|
||||
$class = required_param('class', PARAM_ALPHA);
|
||||
$field = optional_param('field', '', PARAM_ALPHA);
|
||||
$instanceid = optional_param('instanceId', 0, PARAM_INT);
|
||||
$sectionid = optional_param('sectionId', 0, PARAM_INT);
|
||||
@@ -22,46 +21,51 @@ $summary = optional_param('summary', '', PARAM_RAW);
|
||||
$sequence = optional_param('sequence', '', PARAM_SEQUENCE);
|
||||
$visible = optional_param('visible', 0, PARAM_INT);
|
||||
|
||||
// Authorise the user and verify some incoming data
|
||||
|
||||
// Authorise the user and verify some incoming data
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error_log('AJAX commands.php: Course does not exist');
|
||||
die;
|
||||
}
|
||||
|
||||
$PAGE = page_create_object(PAGE_COURSE_VIEW, $course->id);
|
||||
$pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
|
||||
$pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
|
||||
|
||||
if (!empty($instanceid)) {
|
||||
$blockinstance = blocks_find_instance($instanceid, $pageblocks);
|
||||
if (!$blockinstance || $blockinstance->pageid != $course->id || $blockinstance->pagetype != 'course-view') {
|
||||
if (!$blockinstance || $blockinstance->pageid != $course->id
|
||||
|| $blockinstance->pagetype != 'course-view') {
|
||||
error_log('AJAX commands.php: Bad block ID '.$instanceid);
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
require_login($course->id);
|
||||
require_capability('moodle/course:update', $context);
|
||||
|
||||
// OK, now let's process the parameters and do stuff
|
||||
|
||||
|
||||
// OK, now let's process the parameters and do stuff
|
||||
switch($_SERVER['REQUEST_METHOD']) {
|
||||
case 'POST':
|
||||
|
||||
switch ($class) {
|
||||
case 'block':
|
||||
switch ($field) {
|
||||
case 'visible':
|
||||
blocks_execute_action($PAGE, $pageblocks, 'toggle', $blockinstance);
|
||||
break;
|
||||
|
||||
case 'position':
|
||||
//while not entirely restful this will handle all the details of moving a block
|
||||
blocks_execute_repositioning_atomic($blockinstance, $column, $value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'block':
|
||||
|
||||
switch ($field) {
|
||||
case 'visible':
|
||||
blocks_execute_action($PAGE, $pageblocks, 'toggle', $blockinstance);
|
||||
break;
|
||||
|
||||
case 'position': // Misleading case. Should probably call it 'move'.
|
||||
// We want to move the block around. This means changing
|
||||
// the column (position field) and/or block sort order
|
||||
// (weight field).
|
||||
blocks_move_block($PAGE, $blockinstance, $column, $value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'section':
|
||||
|
||||
@@ -95,6 +99,18 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
set_coursemodule_groupmode($mod->id, $value);
|
||||
break;
|
||||
|
||||
case 'indentleft':
|
||||
if ($mod->indent > 0) {
|
||||
$mod->indent--;
|
||||
update_record('course_modules', $mod);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'indentright':
|
||||
$mod->indent++;
|
||||
update_record('course_modules', $mod);
|
||||
break;
|
||||
|
||||
case 'move':
|
||||
if (!$section = get_record('course_sections','course',$course->id,'section',$sectionid)) {
|
||||
error_log('AJAX commands.php: Bad section ID '.$sectionid);
|
||||
|
||||
+54
-21
@@ -163,14 +163,25 @@
|
||||
echo "<th>$strcategory</th>";
|
||||
echo "<th>$strselect</th>";
|
||||
echo "<th>$stredit</th>";
|
||||
foreach ($courses as $course) {
|
||||
foreach ($courses as $course) {
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
$course->fullname = highlight("$search", $course->fullname);
|
||||
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
||||
echo "<tr>";
|
||||
echo "<td><a $linkcss href=\"view.php?id=$course->id\">$course->fullname</a></td>";
|
||||
echo "<td>".$displaylist[$course->category]."</td>";
|
||||
echo "<td align=\"center\">";
|
||||
echo "<input type=\"checkbox\" name=\"c$course->id\">";
|
||||
|
||||
// this is ok since this will get inherited from course category context
|
||||
// if it is set
|
||||
if (has_capability('moodle/category:update', $coursecontext)) {
|
||||
echo "<input type=\"checkbox\" name=\"c$course->id\">";
|
||||
} else {
|
||||
echo "<input type=\"checkbox\" name=\"c$course->id\" disabled=\"disabled\">";
|
||||
}
|
||||
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
if (empty($THEME->custompix)) {
|
||||
@@ -178,25 +189,48 @@
|
||||
} else {
|
||||
$pixpath = "$CFG->themedir/$CFG->theme/pix";
|
||||
}
|
||||
echo "<a title=\"".get_string("settings")."\" href=\"$CFG->wwwroot/course/edit.php?id=$course->id\"><img".
|
||||
" src=\"$pixpath/t/edit.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
echo "<a title=\"".get_string("assignteachers")."\" href=\"$CFG->wwwroot/course/teacher.php?id=$course->id\"><img".
|
||||
" src=\"$pixpath/t/user.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
echo "<a title=\"".get_string("delete")."\" href=\"delete.php?id=$course->id\"><img".
|
||||
" src=\"$pixpath/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
if (!empty($course->visible)) {
|
||||
echo "<a title=\"".get_string("hide")."\" href=\"search.php?search=$encodedsearch&perpage=$perpage&page=$page&hide=$course->id&sesskey=$USER->sesskey\"><img".
|
||||
" src=\"$pixpath/t/hide.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
} else {
|
||||
echo "<a title=\"".get_string("show")."\" href=\"search.php?search=$encodedsearch&perpage=$perpage&page=$page&show=$course->id&sesskey=$USER->sesskey\"><img".
|
||||
" src=\"$pixpath/t/show.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
|
||||
// checks whether user can update course settings
|
||||
if (has_capability('moodle/course:update', $coursecontext)) {
|
||||
echo "<a title=\"".get_string("settings")."\" href=\"$CFG->wwwroot/course/edit.php?id=$course->id\"><img".
|
||||
" src=\"$pixpath/t/edit.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
}
|
||||
|
||||
// checks whether user can do role assignment
|
||||
if (has_capability('moodle/role:assign', $coursecontext)) {
|
||||
echo'<a title="'.get_string('assignroles', 'role').'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$coursecontext->id.'">';
|
||||
echo '<img src="'.$CFG->pixpath.'/i/roles.gif" height="11" width="11" alt="'.get_string('assignroles', 'role').'" /></a>';
|
||||
}
|
||||
|
||||
// checks whether user can delete course
|
||||
if (has_capability('moodle/course:delete', $coursecontext)) {
|
||||
echo "<a title=\"".get_string("delete")."\" href=\"delete.php?id=$course->id\"><img".
|
||||
" src=\"$pixpath/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
}
|
||||
|
||||
// checks whether user can change visibility
|
||||
if (has_capability('moodle/course:visibility', $coursecontext)) {
|
||||
if (!empty($course->visible)) {
|
||||
echo "<a title=\"".get_string("hide")."\" href=\"search.php?search=$encodedsearch&perpage=$perpage&page=$page&hide=$course->id&sesskey=$USER->sesskey\"><img".
|
||||
" src=\"$pixpath/t/hide.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
} else {
|
||||
echo "<a title=\"".get_string("show")."\" href=\"search.php?search=$encodedsearch&perpage=$perpage&page=$page&show=$course->id&sesskey=$USER->sesskey\"><img".
|
||||
" src=\"$pixpath/t/show.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
}
|
||||
}
|
||||
|
||||
// checks whether user can do site backup
|
||||
if (has_capability('moodle/site:backup', $coursecontext)) {
|
||||
echo "<a title=\"".get_string("backup")."\" href=\"../backup/backup.php?id=$course->id\"><img".
|
||||
" src=\"$pixpath/t/backup.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
}
|
||||
|
||||
echo "<a title=\"".get_string("backup")."\" href=\"../backup/backup.php?id=$course->id\"><img".
|
||||
" src=\"$pixpath/t/backup.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
|
||||
echo "<a title=\"".get_string("restore")."\" href=\"../files/index.php?id=$course->id&wdir=/backupdata\"><img".
|
||||
" src=\"$pixpath/t/restore.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
// checks whether user can do restore
|
||||
if (has_capability('moodle/site:restore', $coursecontext)) {
|
||||
echo "<a title=\"".get_string("restore")."\" href=\"../files/index.php?id=$course->id&wdir=/backupdata\"><img".
|
||||
" src=\"$pixpath/t/restore.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
|
||||
}
|
||||
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "<tr><td colspan=\"4\" align=\"center\">";
|
||||
@@ -213,7 +247,7 @@
|
||||
|
||||
if ($perpage != 99999 && $totalcount > $perpage) {
|
||||
echo "<center><p>";
|
||||
echo "<a href=\"search.php?search=$encoededsearch&perpage=99999\">".get_string("showall", "", $totalcount)."</a>";
|
||||
echo "<a href=\"search.php?search=$encodedsearch&perpage=99999\">".get_string("showall", "", $totalcount)."</a>";
|
||||
echo "</p></center>";
|
||||
}
|
||||
|
||||
@@ -229,4 +263,3 @@
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -285,4 +285,3 @@ function print_outline_row($mod, $instance, $result) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
Moodle - Modular Object-Oriented Dynamic Learning Environment
|
||||
http://moodle.org
|
||||
|
||||
Copyright (C) 1999-2004 Martin Dougiamas martin@dougiamas.com
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require("../config.php");
|
||||
|
||||
if (! $info = document_file("files.php", false)) {
|
||||
error("404 - File Not Found");
|
||||
}
|
||||
|
||||
$string = array();
|
||||
if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
}
|
||||
|
||||
include($info->filepath);
|
||||
|
||||
print_header();
|
||||
|
||||
$ulopen = false;
|
||||
|
||||
foreach ($string as $file => $filename) {
|
||||
if (substr($file,0,1) == "-") {
|
||||
if($ulopen) {
|
||||
echo '</ul>';
|
||||
}
|
||||
echo '<h1>'.$filename.'</h1><ul>';
|
||||
$ulopen = true;
|
||||
} else {
|
||||
echo '<li><a target="main" href="'.$CFG->wwwroot.'/doc/?file='.$file.'">'.$filename.'</a></li>';
|
||||
}
|
||||
}
|
||||
if($ulopen) {
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
// Sloppy way to produce valid markup... there should be a print_footer_minimal().
|
||||
echo '</div></div></body></html>';
|
||||
|
||||
?>
|
||||
@@ -1,131 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
.commandline {
|
||||
font-family: "Courier New", Courier, mono;
|
||||
font-size: x-small;
|
||||
background-color: #FBFBFB;
|
||||
margin: auto auto 20px 30px;
|
||||
padding: 5px;
|
||||
width: compact;
|
||||
font-weight: bold;
|
||||
border: 1px solid #999999;
|
||||
white-space: nowrap;
|
||||
clear: both;
|
||||
float: none;
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require("../config.php");
|
||||
|
||||
$file = optional_param('file', "", PARAM_FILE); // docs file to view straight
|
||||
$frame = optional_param('frame', "", PARAM_FILE); // docs file to view in frame
|
||||
$sub = optional_param('sub', "", PARAM_CLEAN); // sub-section (named anchor)
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
}
|
||||
|
||||
if (!empty($sub)) {
|
||||
$sub = '#'.s($sub);
|
||||
} else {
|
||||
$sub = "";
|
||||
}
|
||||
|
||||
if (empty($file)) {
|
||||
$include = false;
|
||||
if (empty($frame)) {
|
||||
$file = "intro.html";
|
||||
} else {
|
||||
$file = $frame;
|
||||
}
|
||||
} else {
|
||||
$include = true;
|
||||
}
|
||||
|
||||
if (! document_file($file, $include)) {
|
||||
error("Error 404 - File Not Found");
|
||||
}
|
||||
|
||||
if ($include) {
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title><?php print_string("documentation")?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo current_charset(); ?>" />
|
||||
</head>
|
||||
|
||||
<frameset rows="70,*">
|
||||
<frame name="top" src="top.php" />
|
||||
<frameset cols="200,*">
|
||||
<frame name="contents" src="contents.php" />
|
||||
<frame name="main" src="index.php?file=<?php echo "$file$sub"; ?>" />
|
||||
</frameset>
|
||||
</frameset>
|
||||
</html>
|
||||
@@ -1,421 +0,0 @@
|
||||
<head>
|
||||
|
||||
<title>Moodle Docs: Installation</title>
|
||||
|
||||
<link rel="stylesheet" href="docstyles.css" type="TEXT/CSS">
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<h1>Installing Moodle</h1>
|
||||
<blockquote>
|
||||
<p>This guide explains how to install Moodle for the first time. It goes into some detail
|
||||
about some of the steps, in order to cover the wide variety of small differences between
|
||||
web server setups, so this document may look long and complicated. Don't be put off by this
|
||||
- I usually set Moodle up in a few minutes!</p>
|
||||
<p>Take your time and work through this document carefully - it will save you time later on.</p>
|
||||
<p>Sections in this document:</p>
|
||||
<ol>
|
||||
<li><a href="#requirements">Requirements</a></li>
|
||||
<li><a href="#downloading">Download</a></li>
|
||||
<li><a href="#site">Site structure</a></li>
|
||||
<li><a href="#data">Create a data directory</a></li>
|
||||
<li><a href="#database">Create a database</a></li>
|
||||
<li><a href="#webserver">Check web server settings</a></li>
|
||||
<li><a href="#config">Edit config.php</a></li>
|
||||
<li><a href="#admin">Go to the admin page</a></li>
|
||||
<li><a href="#cron">Set up cron</a></li>
|
||||
<li><a href="#course">Create a new course</a></li>
|
||||
</ol>
|
||||
<p> </p>
|
||||
</blockquote>
|
||||
<h3 class="sectionheading"><a name="requirements"></a>1. Requirements</h3>
|
||||
<blockquote>
|
||||
<p>Moodle is primarily developed in Linux using Apache, MySQL and PHP (also
|
||||
sometimes known as the LAMP platform), but is also regularly tested with PostgreSQL
|
||||
and on Windows XP, Mac OS X and Netware 6 operating systems</p>
|
||||
<p>The requirements for Moodle are as follows:</p>
|
||||
<ol>
|
||||
<li>Web server software. Most people use <a href="http://www.apache.org/" target="_blank">Apache</a>,
|
||||
but Moodle should work fine under any web server that supports PHP, such
|
||||
as IIS on Windows platforms.</li>
|
||||
<li><a href="http://www.php.net/" target="_blank">PHP</a> scripting language (version 4.1.0
|
||||
or later), with the following settings:
|
||||
<ul>
|
||||
<li><a href="http://www.boutell.com/gd/" target="_blank">GD library</a>
|
||||
turned ON, with support for JPG and PNG formats</li>
|
||||
<li>zlib library turned ON (if you want to use backup/restore on Windows)</li>
|
||||
<li>Sessions support turned ON</li>
|
||||
<li>File uploading turned ON</li>
|
||||
<li>Safe Mode must be turned OFF (see the forums on moodle.org for problems
|
||||
caused by Safe Mode)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>a working database server: <a href="http://www.mysql.com/" target="_blank">MySQL</a>
|
||||
or <a href="http://www.postgresql.org/" target="_blank">PostgreSQL</a> are
|
||||
completely supported and recommended for use with Moodle 1.1. All other
|
||||
databases will be supported fully in the next release.</li>
|
||||
</ol>
|
||||
<p>Most web hosts support all of this by default. If you are signed up with
|
||||
one of the few webhosts that does not support these features ask them why,
|
||||
and consider taking your business elsewhere.</p>
|
||||
<p>If you want to run Moodle on your own computer and all this looks a bit daunting,
|
||||
then please see our guide: <a href="http://moodle.org/doc/?file=installamp.html">Installing
|
||||
Apache, MySQL and PHP</a>. It provides some step-by-step instructions to install
|
||||
all this on most popular platforms.</p>
|
||||
<p> </p>
|
||||
</blockquote>
|
||||
<h3 class="sectionheading"><a name="downloading"></a>2. Download</h3>
|
||||
<blockquote>
|
||||
<p>There are two ways to get Moodle, as a compressed package and via CVS. These
|
||||
are explained in detail on the download page: <a href="http://moodle.org/download/" target="_blank">http://moodle.org/download/</a></p>
|
||||
<p>After downloading and unpacking the archive, or checking out the files via
|
||||
CVS, you will be left with a directory called "moodle", containing
|
||||
a number of files and folders. </p>
|
||||
<p>You can either place the whole folder in your web server documents directory,
|
||||
in which case the site will be located at <b>http://yourwebserver.com/moodle</b>,
|
||||
or you can copy all the contents straight into the main web server documents
|
||||
directory, in which case the site will be simply <b>http://yourwebserver.com</b>.</p>
|
||||
</blockquote>
|
||||
<p> </p>
|
||||
<h3 class="sectionheading"><a name="site"></a>3. Site structure</h3>
|
||||
<blockquote>
|
||||
<p>Here is a quick summary of the contents of the Moodle folder, to help get
|
||||
you oriented:</p>
|
||||
<blockquote>
|
||||
<p>config.php - the ONLY file you need to edit to get started<br />
|
||||
version.php - defines the current version of Moodle code<br />
|
||||
index.php - the front page of the site</p>
|
||||
<ul>
|
||||
<li>admin/ - code to administrate the whole server </li>
|
||||
<li>auth/ - plugin modules to authenticate users </li>
|
||||
<li>course/ - code to display and manage courses </li>
|
||||
<li>doc/ - help documentation for Moodle (eg this page)</li>
|
||||
<li>files/ - code to display and manage uploaded files</li>
|
||||
<li>lang/ - texts in different languages, one directory per language </li>
|
||||
<li>lib/ - libraries of core Moodle code </li>
|
||||
<li>login/ - code to handle login and account creation </li>
|
||||
<li>mod/ - all Moodle course modules</li>
|
||||
<li>pix/ - generic site graphics</li>
|
||||
<li>theme/ - theme packs/skins to change the look of the site.</li>
|
||||
<li>user/ - code to display and manage users</li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<h3 class="sectionheading"><a name="data"></a>4. Create a data directory</h3>
|
||||
<blockquote>
|
||||
<p>Moodle will also need some space on your hard disk to store uploaded files,
|
||||
such as course documents and user pictures.</p>
|
||||
<p>Create a directory for this purpose somewhere. For security, it's best that
|
||||
this directory is NOT accessible directly via the web. The easiest way to do this
|
||||
is to simply locate it OUTSIDE the web directory, otherwise protect it
|
||||
by creating a file in the data directory called .htaccess, containing this line:
|
||||
<blockquote>
|
||||
|
||||
<pre>deny from all<br />AllowOverride None</pre>
|
||||
</blockquote>
|
||||
<p>To make sure that Moodle can save uploaded files in this directory, check that
|
||||
the web server software (eg Apache) has permission to write
|
||||
to this directory. On Unix machines, this means setting the owner of the directory
|
||||
to be something like "nobody" or "apache".</p>
|
||||
<p>On many shared hosting servers, you will probably need to restrict all file access
|
||||
to your "group" (to prevent other webhost customers from looking at or changing your files),
|
||||
but provide full read/write access to everyone else (which will allow the web server
|
||||
to access your files). Speak to your server administrator if you are having
|
||||
trouble setting this up securely.</p>
|
||||
</blockquote>
|
||||
<p> </p>
|
||||
<h3 class="sectionheading"><a name="database"></a>5. Create a database</h3>
|
||||
<blockquote>
|
||||
<p>You need to create an empty database (eg "moodle") in your database system
|
||||
along with a special user (eg "moodleuser") that has access to that database
|
||||
(and that database only). You could use the "root" user if you wanted to, but
|
||||
this is not recommended for a production system: if hackers manage to discover
|
||||
the password then your whole database system would be at risk, rather than
|
||||
just one database.
|
||||
</p>
|
||||
<p>Example command lines for MySQL: </p>
|
||||
<pre>
|
||||
# mysql -u root -p
|
||||
> CREATE DATABASE moodle;
|
||||
> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON moodle.*
|
||||
TO moodleuser@localhost IDENTIFIED BY 'yourpassword';
|
||||
> quit
|
||||
# mysqladmin -p reload
|
||||
</pre>
|
||||
<p>Example command lines for PostgreSQL: </p>
|
||||
<pre>
|
||||
# su - postgres
|
||||
> psql -c "create user moodleuser createdb;" template1
|
||||
> psql -c "create database moodle;" -U moodleuser template1
|
||||
> psql -c "alter user moodleuser nocreatedb;" template1
|
||||
</pre>
|
||||
<p>(For MySQL I highly recommend the use of <a href="http://phpmyadmin.sourceforge.net/">phpMyAdmin</a>
|
||||
to manage your databases - you can do all this via a web interface).</p>
|
||||
<p>As of version 1.0.8, Moodle now supports table prefixes, and so can safely share
|
||||
a database with tables from other applications.</p>
|
||||
</blockquote>
|
||||
<p> </p>
|
||||
<h3 class="sectionheading"><a name="webserver" id="webserver"></a>6. Check your web server settings</h3>
|
||||
<blockquote>
|
||||
<p>Firstly, make sure that your web server is set up to use index.php as a default
|
||||
page (perhaps in addition to index.html, default.htm and so on).</p>
|
||||
<p>In Apache, this is done using a DirectoryIndex parameter in your httpd.conf
|
||||
file. Mine usually looks like this:</p>
|
||||
<blockquote>
|
||||
<pre><strong>DirectoryIndex</strong> index.php index.html index.htm </pre>
|
||||
</blockquote>
|
||||
<p>Just make sure index.php is in the list (and preferably towards the start
|
||||
of the list, for efficiency).</p>
|
||||
<p>Secondly, <b>if you are using Apache 2</b>, then you should turn on the <i>AcceptPathInfo</i>
|
||||
variable, which allows scripts to be passed arguments like http://server/file.php/arg1/arg2.
|
||||
This is essential to allow relative links between your resources, and also
|
||||
provides a performance boost for people using your Moodle web site. You can
|
||||
turn this on by adding these lines to your httpd.conf file.</p>
|
||||
<blockquote>
|
||||
<pre><strong>AcceptPathInfo</strong> on </pre>
|
||||
</blockquote>
|
||||
<p>Thirdly, Moodle requires a number of PHP settings to be active for it to
|
||||
work. <b>On most servers these will already be the default settings.</b>
|
||||
However, some PHP servers (and some of the more recent PHP versions) may
|
||||
have things set differently. These are defined in PHP's configuration
|
||||
file (usually called php.ini):</p>
|
||||
<blockquote>
|
||||
|
||||
<pre>magic_quotes_gpc = 1 (preferred but not necessary)
|
||||
magic_quotes_runtime = 0 (necessary)
|
||||
file_uploads = 1
|
||||
session.auto_start = 0
|
||||
session.bug_compat_warn = 0
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>If you don't have access to httpd.conf or php.ini on your server, or you
|
||||
have Moodle on a server with other applications that require different settings,
|
||||
then don't worry, you can still OVERRIDE all of the default settings.
|
||||
<p>To do this, you need to create a file called <b>.htaccess</b> in Moodle's
|
||||
main directory that contains definitions for these settings.
|
||||
This only works on Apache servers and only when Overrides have been allowed.
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
DirectoryIndex index.php index.html index.htm
|
||||
|
||||
<IfDefine APACHE2>
|
||||
<b>AcceptPathInfo</b> on
|
||||
</IfDefine>
|
||||
|
||||
php_flag magic_quotes_gpc 1
|
||||
php_flag magic_quotes_runtime 0
|
||||
php_flag file_uploads 1
|
||||
php_flag session.auto_start 0
|
||||
php_flag session.bug_compat_warn 0</pre>
|
||||
</blockquote>
|
||||
<p>You can also do things like define the maximum size for uploaded files:
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
LimitRequestBody 0
|
||||
php_value upload_max_filesize 2M
|
||||
php_value post_max_size 2M
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>The easiest thing to do is just copy the sample file from lib/htaccess
|
||||
and edit it to suit your needs. It contains further instructions. For
|
||||
example, in a Unix shell:
|
||||
<blockquote>
|
||||
<pre>cp lib/htaccess .htaccess</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p> </p>
|
||||
<h3 class="sectionheading"><a name="config"></a>7. Edit config.php</h3>
|
||||
<blockquote>
|
||||
<p>Now you can edit the configuration file, <strong>config.php</strong>, using a
|
||||
text editor. This file is used by all other files in Moodle.</p>
|
||||
<p>To start with, make a copy of <strong>config-dist.php</strong> and name it
|
||||
config.php. We do this so that your config.php won't be overwritten in case
|
||||
you upgrade Moodle later on. </p>
|
||||
<p>Edit <strong>config.php</strong> to specify the database details that you
|
||||
just defined (including a table prefix - notice that this is REQUIRED for
|
||||
PostgreSQL), as well as the site address, file system directory and data directory.
|
||||
The config file itself has detailed directions and examples.</p>
|
||||
<p>Once you have done this the rest of the installation is via a web interface.
|
||||
For the rest of this installation document we will assume your site is at:
|
||||
<u>http://example.com/moodle</u></p>
|
||||
</blockquote>
|
||||
<p> </p>
|
||||
<h3 class="sectionheading"><a name="admin"></a>8. Go to the admin page</h3>
|
||||
<blockquote>
|
||||
<p>The admin page should now be working at: <u>http://example.com/moodle/admin</u>.
|
||||
If you try and access the front page of your site you'll be taken there automatically
|
||||
anyway. The first time you access this admin page, you will be presented with
|
||||
a GPL "shrinkwrap" agreement with which you must agree before you
|
||||
can continue with the setup.</p>
|
||||
<p>(Moodle will also try to set some cookies in your browser. If you have your
|
||||
browser set up to let you choose to accept cookies, then you <b>must</b> accept
|
||||
the Moodle cookies, or Moodle won't work properly.)
|
||||
<p>Now Moodle will start setting up your database and creating tables to store
|
||||
data. Firstly, the main database tables are created. You should see a number
|
||||
of SQL statements followed by status messages (in green or red) that look
|
||||
like this:</p>
|
||||
<blockquote>
|
||||
<p>CREATE TABLE course ( id int(10) unsigned NOT NULL auto_increment, category
|
||||
int(10) unsigned NOT NULL default '0', password varchar(50) NOT NULL default
|
||||
'', fullname varchar(254) NOT NULL default '', shortname varchar(15) NOT
|
||||
NULL default '', summary text NOT NULL, format tinyint(4) NOT NULL default
|
||||
'1', teacher varchar(100) NOT NULL default 'Teacher', startdate int(10)
|
||||
unsigned NOT NULL default '0', enddate int(10) unsigned NOT NULL default
|
||||
'0', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id))
|
||||
TYPE=MyISAM</p>
|
||||
<p><font color="#006600">SUCCESS</font></p>
|
||||
<p>...and so on, followed by: <font color="#006600">Main databases set up
|
||||
successfully.</font> </p>
|
||||
</blockquote>
|
||||
<p>If you don't see these, then there must have been some problem with the database
|
||||
or the configuration settings you defined in config.php. Check that PHP isn't
|
||||
in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode
|
||||
turned on). You can check PHP variables by creating a little file containing
|
||||
<? phpinfo() ?> and looking at it through a browser. Check all these and
|
||||
try this page again.</p>
|
||||
<p>Scroll down the very bottom of the page and press the "Continue"
|
||||
link.</p>
|
||||
<p>Next you will see a similar page that sets up all the tables required by
|
||||
each Moodle module. As before, they should all be <font color="#006600">green</font>.</p>
|
||||
<p>Scroll down the very bottom of the page and press the "Continue"
|
||||
link.</p>
|
||||
<p>You should now see a form where you can define more configuration variables
|
||||
for your installation, such as the default language, SMTP hosts and so on.
|
||||
Don't worry too much about getting everything right just now - you can always
|
||||
come back and edit these later on using the admin interface. Scroll down to
|
||||
the bottom and click "Save changes".</p>
|
||||
<p>If (and only if) you find yourself getting stuck on this page, unable to
|
||||
continue, then your server probably has what I call the "buggy referrer" problem.
|
||||
This is easy to fix: just turn off the "secureforms" setting, then
|
||||
try to continue again.</p>
|
||||
<p>The next page is a form where you can define parameters for your Moodle site
|
||||
and the front page, such as the name, format, description and so on. Fill
|
||||
this out (you can always come back and change these later) and then press
|
||||
"Save changes".</p>
|
||||
<p>Finally, you will then be asked to create a top-level administration user
|
||||
for future access to the admin pages. Fill out the details with your own name,
|
||||
email etc and then click "Save changes". Not all the fields are
|
||||
required, but if you miss any important fields you'll be re-prompted for them.
|
||||
</p>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<p><strong>Make sure you remember the username and password you chose
|
||||
for the administration user account, as they will be necessary to
|
||||
access the administration page in future.</strong></p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p>(If for any reason your install is interrupted, or there is a system error
|
||||
of some kind that prevents you from logging in using the admin account, you
|
||||
can usually log in using the default username of "<strong>admin</strong>",
|
||||
with password "<strong>admin</strong>".)</p>
|
||||
<p>Once successful, you will be returned to home page of your site. Note the
|
||||
administration links that appear down the left hand side of the page (these
|
||||
items also appear on a separate Admin page) - these items are only visible
|
||||
to you because you are logged in as the admin user. All your further administration
|
||||
of Moodle can now be done using this menu, such as:</p>
|
||||
<ul>
|
||||
<li>creating and deleting courses</li>
|
||||
<li>creating and editing user accounts</li>
|
||||
<li>administering teacher accounts</li>
|
||||
<li>changing site-wide settings like themes etc</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<p> </p>
|
||||
<h3 class="sectionheading"><a name="cron"></a>9. Set up cron</h3>
|
||||
<blockquote>
|
||||
<p>Some of Moodle's modules require continual checks to perform tasks. For example,
|
||||
Moodle needs to check the discussion forums so it can mail out copies of posts
|
||||
to people who have subscribed.</p>
|
||||
<p>The script that does all this is located in the admin directory, and is called
|
||||
cron.php. However, it can not run itself, so you need to set up a mechanism
|
||||
where this script is run regularly (eg every five or ten minutes). This provides
|
||||
a "heartbeat" so that the script can perform functions at periods
|
||||
defined by each module.</p>
|
||||
<p>Note that the machine performing the cron <b>does not need to be the same
|
||||
machine that is running Moodle</b>. For example, if you have a limited web
|
||||
hosting service that does not have cron, then you can might choose to run
|
||||
cron on another server or on your home computer. All that matters is that
|
||||
the cron.php file is called regularly. </p>
|
||||
<p>The load of this script is not very high, so 5 minutes is usually reasonable,
|
||||
but if you're worried about it you can reduce the time period to something
|
||||
like 15 minutes or even 30 minutes. It's best not to make the time period
|
||||
too long, as delaying mail-outs can slow down activity within the course.</p>
|
||||
<p>First, test that the script works by running it directly from your browser:</p>
|
||||
<blockquote>
|
||||
<pre>http://example.com/moodle/admin/cron.php</pre>
|
||||
</blockquote>
|
||||
<p>Now, you need to set up some of way of running the script automatically and
|
||||
regularly. </p>
|
||||
<h4> Running the script from a command line</h4>
|
||||
<p>You can call the page from the command line just as you did in the example
|
||||
above. For example, you can use a Unix utility like 'wget':</p>
|
||||
<blockquote>
|
||||
<pre>wget -q -O /dev/null http://example.com/moodle/admin/cron.php</pre>
|
||||
</blockquote>
|
||||
<p>Note in this example that the output is thrown away (to /dev/null).</p>
|
||||
<p>The same thing using lynx:</p>
|
||||
<blockquote>
|
||||
<pre>lynx -dump http://example.com/moodle/admin/cron.php > /dev/null</pre>
|
||||
</blockquote>
|
||||
<p>Alternatively you could use a standalone version of PHP, compiled to be run
|
||||
on the command line. The advantage with doing this is that your web server
|
||||
logs aren't filled with constant requests to cron.php. The disadvantage is
|
||||
that you need to have access to a command-line version of php.</p>
|
||||
<blockquote>
|
||||
<pre>/opt/bin/php /web/moodle/admin/cron.php
|
||||
|
||||
|
||||
(Windows) C:\apache\php\php.exe C:\apache\htdocs\moodle\admin\cron.php
|
||||
|
||||
</pre>
|
||||
</blockquote>
|
||||
<h4>Automatically running the script every 5 minutes</h4>
|
||||
<p><b>On Unix systems</b>: Use <b>cron</b>. Edit your cron settings from the commandline
|
||||
using "crontab -e" and add a line like:</p>
|
||||
<blockquote>
|
||||
<pre>*/5 * * * * wget -q -O /dev/null http://example.com/moodle/admin/cron.php</pre>
|
||||
</blockquote>
|
||||
<p>Usually, the "crontab" command will put you into the 'vi' editor. You enter
|
||||
"insert mode" by pressing "i", then type in the line as above, then exit insert mode by
|
||||
pressing ESC. You save and exit by typing ":wq", or quit without saving using ":q!" (without the quotes).</p>
|
||||
<p><b>On Windows systems</b>: The simplest way is to use this little package <a href="http://moodle.org/download/moodle-cron-for-windows.zip" title="Click to download this package (150k)" target="_blank">moodle-cron-for-windows.zip</a>
|
||||
which makes this whole thing very easy. You can also explore using the built-in
|
||||
Windows feature for "Scheduled Tasks".</p>
|
||||
<p>On web hosts: Your web-based control panel may have a web page that allows
|
||||
you to set up this cron process. Ask your administrator for details on how
|
||||
it works.</p>
|
||||
<p></p>
|
||||
</blockquote>
|
||||
<h3 class="sectionheading"><a name="course"></a>10. Create a new course</h3>
|
||||
<blockquote>
|
||||
<p>Now that Moodle is running properly, you can create a course. </p>
|
||||
<p>Select "Create a new course" from the Admin page (or the admin
|
||||
links on the home page).</p>
|
||||
<p>Fill out the form, paying special attention to the course format. You don't
|
||||
have to worry about the details too much at this stage, as everything can
|
||||
be changed later by the teacher.</p>
|
||||
<p>Press "Save changes", and you will be taken to a new form where
|
||||
you can assign teachers to the course. You can only add existing user accounts
|
||||
from this form - if you want to create a new teacher account then either ask
|
||||
the teacher to create one for themselves (see the login page), or create one
|
||||
for them using the "Add a new user" on the Admin page.</p>
|
||||
<p>Once done, the course is ready to customise, and is accessible via the "Courses"
|
||||
link on the home page.</p>
|
||||
<p>See the "<a href="./?file=teacher.html">Teacher Manual</a>" for more details
|
||||
on course-building.</p>
|
||||
</blockquote>
|
||||
<p> </p>
|
||||
<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Documentation</a></font></p>
|
||||
<p align="CENTER"><font size="1">Version: $Id$</font></p>
|
||||
</body>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user