Compare commits
490 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df1a564fa6 | |||
| e20fd196ce | |||
| fd10b9422d | |||
| 80f7504f86 | |||
| a203cb09be | |||
| 131015e234 | |||
| 8494b4356c | |||
| 3b1bd3405b | |||
| d4e2861046 | |||
| 008809ad21 | |||
| 89a750dbeb | |||
| c0db85f0b2 | |||
| ef02670d09 | |||
| 7764e1afe0 | |||
| 2c36ba5bb8 | |||
| 1f046e1625 | |||
| 31a8a7e4e1 | |||
| 120f722403 | |||
| 2854559b92 | |||
| 696d638772 | |||
| 2e0b0c94f8 | |||
| d6070215b8 | |||
| 7ca5f47dcb | |||
| 008c431636 | |||
| 17e44aad44 | |||
| cad170cba8 | |||
| b215544c31 | |||
| 5d10e3f43d | |||
| 354cd59314 | |||
| 1ede3a6712 | |||
| 8558e34ed5 | |||
| 614b05ec8b | |||
| ed2bc33154 | |||
| 1ab501974f | |||
| 87753e76d1 | |||
| 0b06840128 | |||
| 9abc42b262 | |||
| 90080d990a | |||
| e7fcbec49e | |||
| 1576c4d233 | |||
| 6ac068ae5c | |||
| 7074cb559f | |||
| 9138c1f9a8 | |||
| 98ed0ea1af | |||
| 6abfa47012 | |||
| 59b08215b2 | |||
| c7c1adeb8d | |||
| 9230c9417b | |||
| 23f0f6f72d | |||
| 7eb1d32847 | |||
| fadb4b239b | |||
| f319b5bf61 | |||
| 4a373dbaf9 | |||
| c612f884dc | |||
| b543159952 | |||
| 667fdd514e | |||
| 951f480ab9 | |||
| bcbb41a0fa | |||
| ba39176b59 | |||
| 4305306220 | |||
| 8864d0f442 | |||
| 741162fbbe | |||
| f1e4622ccb | |||
| 4241549aed | |||
| 9e0d96f36b | |||
| 7e5b0b4e9c | |||
| 9be2fc8f19 | |||
| f8cbf4713a | |||
| 1a7d693572 | |||
| 31922db550 | |||
| 3cf94d16ed | |||
| ae471b7ab6 | |||
| f00c241f7d | |||
| cbd20ae8ba | |||
| 7bbe252c59 | |||
| a7d6e5b0f7 | |||
| e4edbb9e0b | |||
| 80895066a2 | |||
| 40385816cd | |||
| 1be6adbd3e | |||
| d416d809a1 | |||
| bf3c381651 | |||
| 9338d432f9 | |||
| b2ef8fc07e | |||
| 53ff8d79ee | |||
| ed55a25fd5 | |||
| c92727ae6b | |||
| 5cc8148eb8 | |||
| 92b2d0f2dd | |||
| ec27637e08 | |||
| 319047dfb1 | |||
| 67145bac78 | |||
| 7675f212ee | |||
| 25e0480339 | |||
| 8a286fda3e | |||
| 5e73ea768b | |||
| fdecc5c6da | |||
| f3e4a7a514 | |||
| f966e024ef | |||
| f3410ae74b | |||
| 7e70535f09 | |||
| 8def180d7a | |||
| e123a4e191 | |||
| df5ee47979 | |||
| b18207cd3a | |||
| f750f104ca | |||
| cc1b52fddf | |||
| e6f1411d72 | |||
| 90f08155c5 | |||
| 24f49eaa7e | |||
| 086617bac8 | |||
| 088f9942ef | |||
| 6befbe8050 | |||
| 62385afcd3 | |||
| b9f7637ea8 | |||
| 5e435e4635 | |||
| 362af1586a | |||
| c8305b464f | |||
| f5303bd518 | |||
| d040f940a2 | |||
| c97ab4b00a | |||
| 5e8720e3a3 | |||
| 3cef39f10a | |||
| 0e938d8e6c | |||
| 6a9781ab1f | |||
| 18ecdd56aa | |||
| f9452850dd | |||
| d2925a9397 | |||
| 537cef4fdd | |||
| 8319d93b45 | |||
| 41a96d7c4d | |||
| 1b88c2ef22 | |||
| 0d4057f406 | |||
| 07182b5324 | |||
| 0070770144 | |||
| 03240ae37b | |||
| 0ee01f0cda | |||
| 23febf1491 | |||
| cf299069d4 | |||
| b3abd77235 | |||
| 45c65f2b7e | |||
| 6ef50f6983 | |||
| 378d834f44 | |||
| 9a1e5c1750 | |||
| 6a691a2dba | |||
| a44d38fc25 | |||
| 826153a73d | |||
| 1e76d6529c | |||
| 6dce2448c4 | |||
| 828a4b2350 | |||
| 8300665144 | |||
| 4ccdd406cb | |||
| fc5711d43c | |||
| 1e35150951 | |||
| af6ca730d4 | |||
| e60154c553 | |||
| b2a2b9af0c | |||
| a3fcc4d416 | |||
| 1809c83ef3 | |||
| 88b5a2a15c | |||
| ee9534257d | |||
| 4b612862c7 | |||
| 75bf99a13c | |||
| fd10cafb1a | |||
| 831a8bae99 | |||
| 36b84580e0 | |||
| 4bb8788c44 | |||
| e8e5f86657 | |||
| be310ffda8 | |||
| cacc23f041 | |||
| 72a4c9a290 | |||
| 5d68b50a62 | |||
| 6a1055bf37 | |||
| 67e43279bb | |||
| 3f4bcbd03a | |||
| 74acff4411 | |||
| d6a54ada6e | |||
| d556c2aeaa | |||
| df313f0e94 | |||
| 4d4ef0e0b8 | |||
| 9717970b60 | |||
| 4f2ae57c31 | |||
| 6266a81cf7 | |||
| d0f6aa914a | |||
| 4c7701a6d9 | |||
| b1d476b800 | |||
| eae483c5a4 | |||
| 22da58c579 | |||
| 9b657e0dec | |||
| 8e6f38a406 | |||
| 537515d8e8 | |||
| 3c5f492e9d | |||
| 1301de5879 | |||
| 87698fefb6 | |||
| 7fd096aa14 | |||
| 78dea37dbc | |||
| 8117a6dc8a | |||
| 866002a1ef | |||
| c4a0e8dab6 | |||
| b3f66a5f13 | |||
| 78fb084d02 | |||
| 08f1de55d0 | |||
| 29949f0031 | |||
| 24dea5f76b | |||
| f5f53ceb7a | |||
| 3638683cdd | |||
| ed1061fd15 | |||
| fab77ea872 | |||
| ebb351fa65 | |||
| c8bf751abf | |||
| fc10786ff1 | |||
| 841c716376 | |||
| ca36c9581f | |||
| c03b88f607 | |||
| abf7820411 | |||
| 6cdd66e3c5 | |||
| 316e201245 | |||
| 54c9dab53b | |||
| c60272d855 | |||
| d7895072ac | |||
| 3a1d81851f | |||
| 3e82837cc0 | |||
| 6f0c99c7a8 | |||
| 7dbf7695da | |||
| 0c64299b01 | |||
| 70f97a5995 | |||
| a9530ec147 | |||
| fe5cf88b17 | |||
| 9f79ed8a3c | |||
| 868d207889 | |||
| c28941370e | |||
| 5c0cd26dbf | |||
| 8e9aa7d060 | |||
| 49cb76f312 | |||
| d91d2fa6d3 | |||
| 20dbeadfb3 | |||
| 8ed24b7dda | |||
| 1ca7a8001b | |||
| 5aab521e4d | |||
| a1332df845 | |||
| eb2d09c49c | |||
| e2c0f78d63 | |||
| d7440e481e | |||
| 5fd7a8cc89 | |||
| 7429a293b7 | |||
| a31fec1556 | |||
| a8cecdc232 | |||
| b0d3c33001 | |||
| b3ede2a6f5 | |||
| a804689232 | |||
| 62e0242116 | |||
| 0321eb66d0 | |||
| 604c996ca6 | |||
| ba7b72a53d | |||
| 077b7e99c1 | |||
| 7099595c4d | |||
| e723db1680 | |||
| 19043b2c61 | |||
| 97b0c002ec | |||
| 3c9367fb62 | |||
| a064e86c8b | |||
| f0cb717a7e | |||
| ed14ae8128 | |||
| 05888cfc84 | |||
| cca1df961b | |||
| fb4f768789 | |||
| 1fda1af9d2 | |||
| 6d338ba5f9 | |||
| 63d4e986d0 | |||
| 9595f6a388 | |||
| c50d4d9039 | |||
| 1a5d7ed12e | |||
| e18bb176e1 | |||
| 42fd053ddc | |||
| d873273749 | |||
| cba3313110 | |||
| 122ea396cf | |||
| 1b068b9049 | |||
| 8069349d65 | |||
| 1de8317f92 | |||
| 0ff7b38264 | |||
| 9fc48040ba | |||
| 1752044872 | |||
| 685ecea312 | |||
| ef90bd2c06 | |||
| bcf99ba3b9 | |||
| 48e385f582 | |||
| f9baa9c1cc | |||
| 564f9b03e6 | |||
| a270bb477a | |||
| 23f4b83ec6 | |||
| 28c5a47afc | |||
| b52e9a106c | |||
| 0d2fdd9cd9 | |||
| 591234f350 | |||
| 1b2f2b82f0 | |||
| 85e21f03a1 | |||
| 864dbb4ae7 | |||
| 247475fc9f | |||
| 2fb18d1cdc | |||
| 74f65d5ef6 | |||
| 3443f0a7b2 | |||
| ab05be1a23 | |||
| 0aba3fd198 | |||
| 2466ff5d77 | |||
| fc0966ba1f | |||
| 83e674cd7f | |||
| 9468a32a8e | |||
| 01cd957389 | |||
| d0d30cb9a0 | |||
| 3bbc55a650 | |||
| 0f1d2d8c94 | |||
| da8b22453c | |||
| d490ba1476 | |||
| 408a5a1b03 | |||
| 0ec5eaa5ca | |||
| e4173bf72a | |||
| 55a96b2f3e | |||
| 1a42831794 | |||
| 571acdabaa | |||
| f7396c7867 | |||
| c1bfa6076c | |||
| f9e8f1118d | |||
| 8d1ea9fbed | |||
| 9197f258b9 | |||
| bbaae076fa | |||
| 7ba21c9f41 | |||
| 8f211852b7 | |||
| 0a1dc0b126 | |||
| 104b23ff7f | |||
| d7355da165 | |||
| 64a985181b | |||
| 9fb2199303 | |||
| 0e4429dfec | |||
| 09a47d4232 | |||
| f39c91312f | |||
| f0769c5367 | |||
| 68199074d8 | |||
| 8807ea9497 | |||
| 60061f9d34 | |||
| 4cbb779866 | |||
| 7add89d356 | |||
| a3faf996f5 | |||
| 1dd6d5a8a2 | |||
| c4020445c4 | |||
| 3b455ec7d2 | |||
| 760f271b07 | |||
| bf28e6d08a | |||
| 13f366f87b | |||
| c9c2c6df00 | |||
| ba1fa71220 | |||
| 08afbd8644 | |||
| 3e1a16bbbc | |||
| 2620831e61 | |||
| 040c22892d | |||
| 43059890b7 | |||
| 03796898f6 | |||
| ecaa25ff09 | |||
| 9a055d09c9 | |||
| c95fff4fa9 | |||
| 324480d4b2 | |||
| 4d4a11fd68 | |||
| 89a8bdc8cc | |||
| 8a2bccf264 | |||
| f697f01e35 | |||
| 976fe7c655 | |||
| e6ecbb498b | |||
| 37e6138a3c | |||
| e7514ae3f1 | |||
| 81f9b42660 | |||
| 7c5bebadf1 | |||
| d1a0531ca4 | |||
| 5f536e23ed | |||
| 16d42c3776 | |||
| ca108ade8d | |||
| 8997698305 | |||
| 9cb996a977 | |||
| 6f7fcae9f2 | |||
| 44089f2cb4 | |||
| 5140419a14 | |||
| d0bc1c59ae | |||
| f3726ba3b2 | |||
| e1079fc4f1 | |||
| a8500a96f8 | |||
| 325bbaaa17 | |||
| 12961dfd4d | |||
| c646026617 | |||
| 6dfa18dff6 | |||
| 269a213980 | |||
| 311a061ce1 | |||
| f152f333d0 | |||
| 24ec651269 | |||
| 8abe956ca8 | |||
| 8e1ae566f2 | |||
| b0b359cd73 | |||
| 1ad395e023 | |||
| b1e07b8879 | |||
| 4d78c38a37 | |||
| bb9cae5afc | |||
| 9051e08619 | |||
| cec1b35f86 | |||
| 2fe45c4a0a | |||
| b40e18c325 | |||
| d72975122f | |||
| 7508d0918f | |||
| a91a3c5c79 | |||
| a30e48bc6a | |||
| 6cb0f10970 | |||
| a0de778c07 | |||
| b866247504 | |||
| 33dc359ccc | |||
| 9b6c468b16 | |||
| de028f7715 | |||
| 4be0a0c1b5 | |||
| 7873f331ea | |||
| f8961f9bc0 | |||
| d0949f39e9 | |||
| 042699bf23 | |||
| 49163d4fb6 | |||
| 6ad9639961 | |||
| 694c70e8e6 | |||
| 4398b01077 | |||
| 95df21e3ae | |||
| 6fe671e94a | |||
| 92fa909b5e | |||
| 7b23572651 | |||
| e9369e5282 | |||
| 74b0c7ac01 | |||
| e01a96ef15 | |||
| 00d69809d4 | |||
| 02d7853dab | |||
| 7f5f0ae62b | |||
| b5a814308a | |||
| f22675fed9 | |||
| 1f45359727 | |||
| 7fe0a5d596 | |||
| e83bdb2c03 | |||
| 3b253287d7 | |||
| bf252c1d4a | |||
| cf0d9e996b | |||
| 670eea76db | |||
| 59359cde79 | |||
| 2794229c55 | |||
| 626caefd89 | |||
| 6880e3bb16 | |||
| ed0dd58cf2 | |||
| 1c52f98506 | |||
| 5aac129459 | |||
| 43efbf3deb | |||
| 408964a73b | |||
| b0c015e156 | |||
| b47138f834 | |||
| 40652b156b | |||
| afa39a8fa8 | |||
| c52128df17 | |||
| c0234d300b | |||
| ddc35e5bd5 | |||
| fb904d1889 | |||
| 5d7850d42e | |||
| 52657c4298 | |||
| bd2930f2b1 | |||
| 6cebd028b9 | |||
| 1e006c3d5f | |||
| d5ebb85dce | |||
| be653a00cc | |||
| a1dfc10135 | |||
| e67dfebaca | |||
| 33a9f3495e | |||
| e1f8632d26 | |||
| 82192c1bd8 | |||
| b59efda13c | |||
| 044f9df97e | |||
| 3743bfe506 | |||
| 90beaec2eb | |||
| f758baa9ac | |||
| 42a5861017 | |||
| c9ddd414c7 | |||
| 6b0ee8e3d7 | |||
| e4db399ca5 | |||
| 43b3cb4230 | |||
| 8bf4dbe31c | |||
| 471a2de79c | |||
| a0ba79ded7 | |||
| 252b76e7aa | |||
| fe6ed5c2c2 | |||
| ea95720fe5 | |||
| 916ad6bf7e | |||
| ef10c059ef | |||
| 770f2e2ab1 | |||
| e364a5368d |
+30
-14
@@ -53,7 +53,14 @@
|
||||
moodle_setlocale();
|
||||
|
||||
/// send mime type and encoding
|
||||
@header('Content-Type: text/plain; charset='.current_charset());
|
||||
if (check_browser_version('MSIE')) {
|
||||
//ugly IE hack to work around downloading instead of viewing
|
||||
@header('Content-Type: text/html; charset='.current_charset());
|
||||
echo "<xmp>"; //<pre> is not good enough for us here
|
||||
} else {
|
||||
//send proper plaintext header
|
||||
@header('Content-Type: text/plain; charset='.current_charset());
|
||||
}
|
||||
|
||||
/// Start output log
|
||||
|
||||
@@ -132,8 +139,8 @@
|
||||
if ($assigns = get_users_longtimenosee($longtime)) {
|
||||
foreach ($assigns as $assign) {
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
|
||||
if (role_unassign(0, $assign->userid, 0, $context->id)) {
|
||||
mtrace("Deleted student enrolment for user $assign->userid from course $assign->courseid");
|
||||
if (role_unassign(0, $assign->id, 0, $context->id)) {
|
||||
mtrace("Deleted student enrolment for user $assign->id from course $assign->courseid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,11 +150,13 @@
|
||||
|
||||
/// Delete users who haven't confirmed within required period
|
||||
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_unconfirmed($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
|
||||
if (!empty($CFG->deleteunconfirmed)) {
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_unconfirmed($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,11 +166,13 @@
|
||||
|
||||
/// Delete users who haven't completed profile within required period
|
||||
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_not_fully_set_up($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted not fully setup user $user->username ($user->id)");
|
||||
if (!empty($CFG->deleteunconfirmed)) {
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_not_fully_set_up($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted not fully setup user $user->username ($user->id)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,7 +298,7 @@
|
||||
if (!empty($CFG->statsmaxruntime)) {
|
||||
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour just to make sure (it could take that long to break out of the loop)
|
||||
}
|
||||
if (!get_field_sql('SELECT id FROM '.$CFG->prefix.'stats_daily LIMIT 1')) {
|
||||
if (!get_field_sql('SELECT id FROM '.$CFG->prefix.'stats_daily')) {
|
||||
// first run, set another lock. we'll check for this in subsequent runs to set the timeout to later for the normal lock.
|
||||
set_cron_lock('statsfirstrunlock',true,$time,true);
|
||||
$firsttime = true;
|
||||
@@ -330,4 +341,9 @@
|
||||
$difftime = microtime_diff($starttime, microtime());
|
||||
mtrace("Execution took ".$difftime." seconds");
|
||||
|
||||
/// finishe the IE hack
|
||||
if (check_browser_version('MSIE')) {
|
||||
echo "</xmp>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -35,6 +35,11 @@
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.7">
|
||||
<UNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unicoderecommended" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
@@ -45,6 +50,42 @@
|
||||
<VENDOR name="postgres" version="7.4" />
|
||||
<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="1.8">
|
||||
<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="7.4" />
|
||||
<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">
|
||||
|
||||
@@ -52,6 +52,13 @@
|
||||
error("The PHP server variable 'file_uploads' is not turned On - $documentationlink");
|
||||
}
|
||||
|
||||
if (empty($CFG->prefix) && $CFG->dbtype != 'mysql') { //Enforce prefixes for everybody but mysql
|
||||
error('$CFG->prefix can\'t be empty for your target DB (' . $CFG->dbtype . ')');
|
||||
}
|
||||
|
||||
if ($CFG->dbtype == 'oci8po' && strlen($CFG->prefix) > 2) { //Max prefix length for Oracle is 2cc
|
||||
error('$CFG->prefix maximum allowed length for Oracle DBs is 2cc.');
|
||||
}
|
||||
|
||||
/// Check that config.php has been edited
|
||||
|
||||
@@ -133,6 +140,8 @@
|
||||
|
||||
/// Both old .sql files and new install.xml are supported
|
||||
/// But we prioritise install.xml (XMLDB) if present
|
||||
|
||||
change_db_encoding(); // first try to change db encoding to utf8
|
||||
$status = false;
|
||||
if (file_exists("$CFG->libdir/db/install.xml")) {
|
||||
$status = install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
|
||||
@@ -214,8 +223,11 @@
|
||||
}
|
||||
|
||||
if (empty($confirmupgrade)) {
|
||||
|
||||
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", "", false, " ", " ");
|
||||
|
||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php');
|
||||
exit;
|
||||
|
||||
@@ -223,10 +235,15 @@
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", $linktoscrolltoerrors, false, " ", " ");
|
||||
|
||||
/// return to original debugging level
|
||||
$CFG->debug = $origdebug;
|
||||
error_reporting($CFG->debug);
|
||||
upgrade_log_start();
|
||||
|
||||
/// Upgrade current language pack if we can
|
||||
upgrade_language_pack();
|
||||
|
||||
print_heading($strdatabasechecking);
|
||||
$db->debug=true;
|
||||
/// Launch the old main upgrade (if exists)
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
if (empty($CFG->siteidentifier)) { // Unique site identification code
|
||||
set_config('siteidentifier', random_string(32));
|
||||
set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
|
||||
$tableprefix = $CFG->prefix.'stats_';
|
||||
|
||||
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
|
||||
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
|
||||
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
|
||||
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend');
|
||||
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend');
|
||||
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend');
|
||||
|
||||
if (empty($earliestday)) $earliestday = time();
|
||||
if (empty($earliestweek)) $earliestweek = time();
|
||||
@@ -66,24 +66,27 @@
|
||||
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
|
||||
|
||||
if (!empty($param->sql)) {
|
||||
$sql = $param->sql ." LIMIT ".$numcourses;
|
||||
$sql = $param->sql;
|
||||
} else {
|
||||
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
|
||||
." WHERE timeend >= ".$param->timeafter.' AND stattype = \'activity\''
|
||||
." GROUP BY courseid "
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby
|
||||
." LIMIT ".$numcourses;
|
||||
." ORDER BY ".$param->orderby;
|
||||
}
|
||||
error_log($sql);
|
||||
|
||||
$courses = get_records_sql($sql);
|
||||
$courses = get_records_sql($sql, 0, $numcourses);
|
||||
|
||||
if (empty($courses)) {
|
||||
notify(get_string('statsnodata'));
|
||||
|
||||
} else {
|
||||
echo '<div align="center"><img src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo '<div align="center">(' . get_string("gdneed") .')</div>';
|
||||
} else {
|
||||
echo '<div align="center"><img src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
}
|
||||
|
||||
$table = new StdClass;
|
||||
$table->align = array('left','center','center','center');
|
||||
|
||||
@@ -17,17 +17,16 @@
|
||||
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
|
||||
|
||||
if (!empty($param->sql)) {
|
||||
$sql = $param->sql ." LIMIT ".$numcourses;
|
||||
$sql = $param->sql;
|
||||
} else {
|
||||
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
|
||||
." WHERE timeend >= ".$param->timeafter.' AND stattype = \'activity\''
|
||||
." GROUP BY courseid "
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby
|
||||
." LIMIT ".$numcourses;
|
||||
." ORDER BY ".$param->orderby;
|
||||
}
|
||||
|
||||
$courses = get_records_sql($sql);
|
||||
$courses = get_records_sql($sql, 0, $numcourses);
|
||||
|
||||
if (empty($courses)) {
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
// $strstats";
|
||||
|
||||
// print_header("$course->shortname: $strstats", "$course->fullname",
|
||||
// $crumb, '', '', true, ' ', $menu);
|
||||
// $crumb, '', '', true, ' ', $menu);
|
||||
|
||||
|
||||
require_once($CFG->dirroot.'/course/report/stats/report.php');
|
||||
|
||||
@@ -116,7 +116,6 @@
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('assignroles', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading($straction);
|
||||
} else {
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
@@ -179,6 +178,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_heading_with_help(get_string('assignroles', 'role'), 'assignroles');
|
||||
|
||||
if ($roleid) { /// prints a form to swap roles
|
||||
|
||||
/// Get all existing participants in this context.
|
||||
@@ -243,14 +245,15 @@
|
||||
$table->tablealign = 'center';
|
||||
$table->cellpadding = 5;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '20%';
|
||||
$table->head = array(get_string('roles', 'role'), get_string('users'));
|
||||
$table->wrap = array('nowrap', 'nowrap');
|
||||
$table->align = array('right', 'center');
|
||||
$table->width = '60%';
|
||||
$table->head = array(get_string('roles', 'role'), get_string('description'), get_string('users'));
|
||||
$table->wrap = array('nowrap', '', 'nowrap');
|
||||
$table->align = array('right', 'left', 'center');
|
||||
|
||||
foreach ($assignableroles as $roleid => $rolename) {
|
||||
$countusers = count_role_users($roleid, $context);
|
||||
$table->data[] = array('<a href="'.$baseurl.'&roleid='.$roleid.'">'.$rolename.'</a>', $countusers);
|
||||
$description = format_string(get_field('role', 'description', 'id', $roleid));
|
||||
$table->data[] = array('<a href="'.$baseurl.'&roleid='.$roleid.'">'.$rolename.'</a>',$description, $countusers);
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
|
||||
+37
-22
@@ -52,17 +52,24 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php print_heading(get_string('permissions','role')) ?>
|
||||
<?php
|
||||
print_heading_with_help(get_string('permissions','role'), 'permissions');
|
||||
|
||||
$strinherit = get_string('inherit','role');
|
||||
$strallow = get_string('allow','role');
|
||||
$strprevent = get_string('prevent','role');
|
||||
$strprohibit = get_string('prohibit','role');
|
||||
?>
|
||||
|
||||
<table class="rolecap" align="center">
|
||||
|
||||
<tr>
|
||||
<th class="name" align="left"><?php print_string('capability','role') ?></th>
|
||||
<th class="inherit"><?php print_string('inherit','role') ?></th>
|
||||
<th class="allow"><?php print_string('allow','role') ?></th>
|
||||
<th class="prevent"><?php print_string('prevent','role') ?></th>
|
||||
<th class="prohibit"><?php print_string('prohibit','role') ?></th>
|
||||
<th class="risk"><?php print_string('risks','role') ?></th>
|
||||
<th class="inherit"><?php p($strinherit); ?></th>
|
||||
<th class="allow"><?php p($strallow); ?></th>
|
||||
<th class="prevent"><?php p($strprevent); ?></th>
|
||||
<th class="prohibit"><?php p($strprohibit); ?></th>
|
||||
<th class="risk" colspan="5"><?php print_string('risks','role') ?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
@@ -71,10 +78,13 @@
|
||||
$contextlevel = 0;
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
|
||||
foreach ($capabilities as $capability) {
|
||||
// prints a breaker if component or name or context level
|
||||
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
||||
echo ('<tr class="rolecapheading header"><td colspan="6" class="header"><strong>'.
|
||||
echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.
|
||||
get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
|
||||
}
|
||||
|
||||
@@ -91,42 +101,47 @@ foreach ($capabilities as $capability) {
|
||||
$localoverride->permission = $role->{$capability->name};
|
||||
}
|
||||
|
||||
$disabled = ($action != 'edit') ? ' disabled="disabled" ' : '';
|
||||
$disabled = ($action != 'edit' and $action != 'add') ? ' disabled="disabled" ' : '';
|
||||
|
||||
$riskinfo = '';
|
||||
$riskinfo = '<td class="risk managetrust">';
|
||||
$rowclasses = '';
|
||||
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">T</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">T</a>';
|
||||
$rowclasses .= ' riskmanagetrust';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk config">';
|
||||
if (RISK_CONFIG & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">C</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">C</a>';
|
||||
$rowclasses .= ' riskconfig';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk xss">';
|
||||
if (RISK_XSS & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">X</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">X</a>';
|
||||
$rowclasses .= ' riskxss';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk personal">';
|
||||
if (RISK_PERSONAL & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">P</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">P</a>';
|
||||
$rowclasses .= ' riskpersonal';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk spam">';
|
||||
if (RISK_SPAM & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">S</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">S</a>';
|
||||
$rowclasses .= ' riskspam';
|
||||
}
|
||||
$riskinfo .= '</td>';
|
||||
|
||||
?>
|
||||
|
||||
<tr class="rolecap <?php echo $rowclasses; ?>">
|
||||
<td class="name"><span title="<?php echo $capability->name ?>"><?php echo get_capability_string($capability->name); ?></span></td>
|
||||
<td class="inherit"><input type="radio" name="<?php echo $capability->name; ?>" value="<?php echo CAP_INHERIT ?>" <?php if (!isset($localoverride->permission) || $localoverride->permission==CAP_INHERIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="allow"><input type="radio" name="<?php echo $capability->name; ?>" value="<?php echo CAP_ALLOW ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_ALLOW){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="prevent" ><input type="radio" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PREVENT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PREVENT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="prohibit" ><input type="radio" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PROHIBIT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PROHIBIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="risk"><?php
|
||||
echo $riskinfo;
|
||||
?></td>
|
||||
<td class="name"><span class="cap-desc"><a target="docspopup" href="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php echo get_capability_string($capability->name); ?></a><span class="cap-name"><?php echo $capability->name ?></span></label></td>
|
||||
<td class="inherit"><input type="radio" title="<?php p($strinherit); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_INHERIT ?>" <?php if (!isset($localoverride->permission) || $localoverride->permission==CAP_INHERIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="allow"><input type="radio" title="<?php p($strallow); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_ALLOW ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_ALLOW){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="prevent" ><input type="radio" title="<?php p($strprevent); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PREVENT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PREVENT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="prohibit" ><input type="radio" title="<?php p($strprohibit); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PROHIBIT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PROHIBIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
|
||||
<?php echo $riskinfo; ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
@@ -171,6 +171,7 @@
|
||||
// update normal role settings
|
||||
$role->id = $roleid;
|
||||
$role->name = $name;
|
||||
$role->shortname = $shortname;
|
||||
$role->description = $description;
|
||||
|
||||
if (!update_record('role', $role)) {
|
||||
@@ -280,13 +281,13 @@
|
||||
|
||||
switch ($action) {
|
||||
case 'add':
|
||||
print_heading(get_string('addrole', 'role'));
|
||||
print_heading_with_help(get_string('addrole', 'role'), 'roles');
|
||||
break;
|
||||
case 'view':
|
||||
print_heading(get_string('viewrole', 'role'));
|
||||
print_heading_with_help(get_string('viewrole', 'role'), 'roles');
|
||||
break;
|
||||
case 'edit':
|
||||
print_heading(get_string('editrole', 'role'));
|
||||
print_heading_with_help(get_string('editrole', 'role'), 'roles');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -317,6 +318,8 @@
|
||||
|
||||
} else {
|
||||
|
||||
print_heading_with_help(get_string('roles', 'role'), 'roles');
|
||||
|
||||
$table = new object;
|
||||
|
||||
$table->tablealign = 'center';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
// this page deals with the 2 tabs for manage.php and grant.php
|
||||
|
||||
$toprow[] = new tabobject('manage', $CFG->wwwroot.'/'.$CFG->admin.'/roles/manage.php', get_string('manageroles', 'role'));
|
||||
$toprow[] = new tabobject('manage', $CFG->wwwroot.'/'.$CFG->admin.'/roles/manage.php', get_string('manageroles', 'role'),'', true);
|
||||
|
||||
$toprow[] = new tabobject('allowassign', $CFG->wwwroot.'/'.$CFG->admin.'/roles/allowassign.php', get_string('allowassign', 'role'));
|
||||
|
||||
|
||||
+34
-19
@@ -1,3 +1,10 @@
|
||||
<?php
|
||||
$strinherit = get_string('inherit','role');
|
||||
$strallow = get_string('allow','role');
|
||||
$strprevent = get_string('prevent','role');
|
||||
$strprohibit = get_string('prohibit','role');
|
||||
?>
|
||||
|
||||
<form name="overrideform" action="override.php" method="post">
|
||||
<input type="hidden" name="contextid" value="<?php p($contextid) ?>">
|
||||
<input type="hidden" name="roleid" value="<?php p($roleid) ?>">
|
||||
@@ -8,11 +15,11 @@
|
||||
<table class="rolecap">
|
||||
<tr>
|
||||
<th class="name" align="left"><?php print_string('capability','role') ?></th>
|
||||
<th class="inherit"><?php print_string('inherit','role') ?></th>
|
||||
<th class="allow"><?php print_string('allow','role') ?></th>
|
||||
<th class="prevent"><?php print_string('prevent','role') ?></th>
|
||||
<th class="prohibit"><?php print_string('prohibit','role') ?></th>
|
||||
<th class="risk"><?php print_string('risks','role') ?></th>
|
||||
<th class="inherit"><?php p($strinherit); ?></th>
|
||||
<th class="allow"><?php p($strallow); ?></th>
|
||||
<th class="prevent"><?php p($strprevent); ?></th>
|
||||
<th class="prohibit"><?php p($strprohibit); ?></th>
|
||||
<th class="risk" colspan="5"><?php print_string('risks','role') ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
@@ -20,10 +27,13 @@
|
||||
$contextlevel = 0;
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
|
||||
foreach ($capabilities as $capability) {
|
||||
// prints a breaker if component or name or context level
|
||||
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
||||
echo ('<tr class="rolecapheading header"><td colspan="6" class="header"><strong>'.get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
|
||||
echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
|
||||
}
|
||||
|
||||
// these 2 are used to see to group same mod/core capabilities together
|
||||
@@ -49,63 +59,68 @@
|
||||
|
||||
$isdisabled = $isprohibit || islegacy($capability->name);
|
||||
|
||||
$riskinfo = '';
|
||||
$riskinfo = '<td class="risk managetrust">';
|
||||
$rowclasses = '';
|
||||
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">T</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">T</a>';
|
||||
$rowclasses .= ' riskmanagetrust';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk config">';
|
||||
if (RISK_CONFIG & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">C</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">C</a>';
|
||||
$rowclasses .= ' riskconfig';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk xss">';
|
||||
if (RISK_XSS & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">X</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">X</a>';
|
||||
$rowclasses .= ' riskxss';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk personal">';
|
||||
if (RISK_PERSONAL & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">P</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">P</a>';
|
||||
$rowclasses .= ' riskpersonal';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk spam">';
|
||||
if (RISK_SPAM & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">S</a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">S</a>';
|
||||
$rowclasses .= ' riskspam';
|
||||
}
|
||||
$riskinfo .= '</td>';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<tr class="rolecap <?php echo $rowclasses; ?>">
|
||||
<td class="name"><?php echo get_capability_string($capability->name); ?></td>
|
||||
<td class="name"><span class="cap-desc"><a target="docspopup" href="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php echo get_capability_string($capability->name); ?></a><span class="cap-name"><?php echo $capability->name ?></span></label></td>
|
||||
|
||||
<td class="inherit">
|
||||
<input type="radio" name="<?php echo $capability->name; ?>" value="0"
|
||||
<input type="radio" title="<?php p($strinherit); ?>" name="<?php echo $capability->name; ?>" value="0"
|
||||
<?php
|
||||
if ($localpermission == CAP_INHERIT) {echo 'checked="checked"';}
|
||||
if ($isdisabled) {echo 'disabled="disabled"';}?> />
|
||||
</td>
|
||||
|
||||
<td class="inherit <?php if ($isallow) {echo ' capcurrent';} ?>">
|
||||
<input type="radio" name="<?php echo $capability->name; ?>"
|
||||
<td class="allow <?php if ($isallow) {echo ' capcurrent';} ?>">
|
||||
<input type="radio" title="<?php p($strallow); ?>" name="<?php echo $capability->name; ?>"
|
||||
<?php echo ' value="'.CAP_ALLOW.'"';
|
||||
if ($localpermission == CAP_ALLOW) {echo ' checked="checked"';}
|
||||
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
||||
</td>
|
||||
|
||||
<td class="prevent <?php if ($isprevent) {echo ' capcurrent';} ?>">
|
||||
<input type="radio" name="<?php echo $capability->name; ?>"
|
||||
<input type="radio" title="<?php p($strprevent); ?>" name="<?php echo $capability->name; ?>"
|
||||
<?php echo ' value="'.CAP_PREVENT.'"';
|
||||
if ($localpermission == CAP_PREVENT) {echo ' checked="checked"';}
|
||||
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
||||
</td>
|
||||
|
||||
<td class="prohibit <?php if ($isprohibit) {echo ' capcurrent';} ?>">
|
||||
<input type="radio" name="<?php echo $capability->name; ?>"
|
||||
<input type="radio" title="<?php p($strprohibit); ?>" name="<?php echo $capability->name; ?>"
|
||||
<?php echo ' value="'.CAP_PROHIBIT.'"';
|
||||
if ($localpermission == CAP_PROHIBIT) {echo ' checked="checked"';}
|
||||
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
||||
</td>
|
||||
<td class="risk"><?php echo $riskinfo; ?></td>
|
||||
<?php echo $riskinfo; ?>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
print_heading_with_help(get_string('overrides', 'role'), 'overrides');
|
||||
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
|
||||
@@ -188,15 +189,16 @@
|
||||
$table->tablealign = 'center';
|
||||
$table->cellpadding = 5;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '20%';
|
||||
$table->head = array(get_string('roles', 'role'), get_string('overrides', 'role'));
|
||||
$table->wrap = array('nowrap', 'nowrap');
|
||||
$table->align = array('right', 'center');
|
||||
$table->width = '60%';
|
||||
$table->head = array(get_string('roles', 'role'), get_string('description'), get_string('overrides', 'role'));
|
||||
$table->wrap = array('nowrap', '', 'nowrap');
|
||||
$table->align = array('right', 'left', 'center');
|
||||
|
||||
foreach ($overridableroles as $roleid => $rolename) {
|
||||
$countusers = 0;
|
||||
$overridecount = count_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id");
|
||||
$table->data[] = array('<a href="'.$baseurl.'&roleid='.$roleid.'">'.$rolename.'</a>', $overridecount);
|
||||
$description = format_string(get_field('role', 'description', 'id', $roleid));
|
||||
$table->data[] = array('<a href="'.$baseurl.'&roleid='.$roleid.'">'.$rolename.'</a>', $description, $overridecount);
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
|
||||
+21
-14
@@ -13,43 +13,50 @@ admin_externalpage_setup('search', $adminroot); // now hidden page
|
||||
$CFG->adminsearchquery = $query; // So we can reference it in search boxes later in this invocation
|
||||
|
||||
|
||||
$resultshtml = search_settings_html(admin_get_root(), $query);
|
||||
|
||||
// now we'll deal with the case that the admin has submitted the form with changed settings
|
||||
|
||||
$statusmsg = '';
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
$data = (array)$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])) {
|
||||
$errors .= $changedsetting->write_setting($data['s_' . $changedsetting->name]);
|
||||
} else {
|
||||
$errors .= $changedsetting->write_setting($changedsetting->defaultsetting);
|
||||
if (!isset($data['s_' . $changedsetting->name])) {
|
||||
$data['s_' . $changedsetting->name] = ''; // needed for checkboxes
|
||||
}
|
||||
$errors .= $changedsetting->write_setting($data['s_' . $changedsetting->name]);
|
||||
}
|
||||
|
||||
if ($olddbsessions != !empty($CFG->dbsessions)) {
|
||||
require_logout();
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
// there must be either redirect without message or continue button or else upgrade would be sometimes broken
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/search.php?query=' . $query);
|
||||
die;
|
||||
$statusmsg = get_string('changessaved');
|
||||
} else {
|
||||
error(get_string('errorwithsettings', 'admin') . ' <br />' . $errors);
|
||||
die;
|
||||
$statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors;
|
||||
}
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
die;
|
||||
}
|
||||
|
||||
// now update $SITE - it might have been changed
|
||||
$SITE = get_record('course', 'id', $SITE->id);
|
||||
$COURSE = clone($SITE);
|
||||
}
|
||||
|
||||
// and finally, if we get here, then there are matching settings and we have to print a form
|
||||
// to modify them
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
// print_simple_box(get_string('upgradesettingsintro','admin'),'','100%','',5,'generalbox','');
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
}
|
||||
|
||||
$resultshtml = search_settings_html(admin_get_root(), $query);
|
||||
|
||||
echo '<form action="search.php" method="post" name="adminsettings" id="adminsettings">';
|
||||
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
|
||||
+18
-9
@@ -49,7 +49,11 @@ if (!($root->check_access())) {
|
||||
|
||||
$CFG->pagepath = 'admin/setting/'.$section;
|
||||
|
||||
// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
|
||||
|
||||
$statusmsg = '';
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
if (confirm_sesskey()) {
|
||||
@@ -66,22 +70,22 @@ if ($data = data_submitted()) {
|
||||
case 'admin':
|
||||
redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
default:
|
||||
// following redirect should display confirmation message because it redirects
|
||||
// to the same page, user might not know if save button worked
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=" . $PAGE->section, get_string('changessaved'),2);
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
} else {
|
||||
error(get_string('errorwithsettings', 'admin') . ' <br />' . $errors);
|
||||
$statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors;
|
||||
}
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
die;
|
||||
}
|
||||
// now update $SITE - it might have been changed
|
||||
$SITE = get_record('course', 'id', $SITE->id);
|
||||
$COURSE = clone($SITE);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/// print header stuff ------------------------------------------------------------
|
||||
// header must be printed after the redirects and require_logout
|
||||
if (!empty($SITE->fullname)) {
|
||||
$pageblocks = blocks_setup($PAGE);
|
||||
|
||||
@@ -90,7 +94,6 @@ if (!empty($SITE->fullname)) {
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
// print header stuff
|
||||
$PAGE->print_header();
|
||||
|
||||
echo '<table id="layout-table"><tr>';
|
||||
@@ -105,6 +108,12 @@ if (!empty($SITE->fullname)) {
|
||||
|
||||
}
|
||||
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<form action="settings.php" method="post" name="adminsettings" id="adminsettings">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
|
||||
@@ -17,8 +17,8 @@ $ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themes
|
||||
|
||||
// "frontpage" settingpage
|
||||
$temp = new admin_settingpage('frontpage', get_string('frontpage','admin'));
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', ''));
|
||||
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', ''));
|
||||
$temp->add(new admin_setting_special_frontpagedesc());
|
||||
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
|
||||
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
|
||||
@@ -118,6 +118,12 @@ $temp = new admin_settingpage('mymoodle', get_string('mymoodle', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('mymoodleredirect', get_string('mymoodleredirect', 'admin'), get_string('configmymoodleredirect', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for gradebook (what roles to display)
|
||||
$temp = new admin_settingpage('gradebook', get_string('gradebook', 'admin'));
|
||||
$temp->add(new admin_setting_special_gradebookroles());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
|
||||
$ADMIN->add('appearance', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
<?php // $Id$
|
||||
|
||||
// * Miscellaneous settings (still to be sorted)
|
||||
// * Miscellaneous settings
|
||||
|
||||
// Experimental settings page
|
||||
$temp = new admin_settingpage('experimental', get_string('experimental', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
|
||||
$ADMIN->add('misc', $temp);
|
||||
|
||||
// XMLDB editor
|
||||
$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
|
||||
|
||||
|
||||
// hidden scripts linked from elsewhere
|
||||
$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true));
|
||||
|
||||
@@ -175,6 +175,11 @@ $ADMIN->add('server', new admin_externalpage('environment', get_string('environm
|
||||
$ADMIN->add('server', new admin_externalpage('phpinfo', get_string('phpinfo'), "$CFG->wwwroot/$CFG->admin/phpinfo.php"));
|
||||
|
||||
|
||||
// "performance" settingpage
|
||||
$temp = new admin_settingpage('performance', get_string('performance', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('enablerecordcache', get_string('enablerecordcache', 'admin'), get_string('configenablerecordcache', 'admin'), 1));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/mysql/frame.php")) {
|
||||
$ADMIN->add('server', new admin_externalpage('database', get_string('managedatabase'), "$CFG->wwwroot/$CFG->admin/mysql/frame.php"));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,12 @@ $ADMIN->add('root', new admin_category('appearance', get_string('appearance','ad
|
||||
$ADMIN->add('root', new admin_category('server', get_string('server','admin')));
|
||||
|
||||
$ADMIN->add('root', new admin_category('reports', get_string('reports')));
|
||||
foreach(get_list_of_plugins('admin/report') as $plugin) {
|
||||
foreach (get_list_of_plugins('admin/report') as $plugin) {
|
||||
/// This snippet is temporary until simpletest can be fixed to use xmldb. See MDL-7377 XXX TODO
|
||||
if ($plugin == 'simpletest' && $CFG->dbtype != 'mysql' && $CFG->dbtype != 'postgres7') {
|
||||
continue;
|
||||
}
|
||||
/// End of removable snippet
|
||||
$ADMIN->add('reports', new admin_externalpage('report'.$plugin, get_string($plugin, 'admin'), "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php"));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ $ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('upload
|
||||
// stuff under the "roles" subcategory
|
||||
$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"));
|
||||
$ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . SITEID));
|
||||
$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));
|
||||
|
||||
|
||||
// "userpolicies" settingpage
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
redirect('index.php');
|
||||
}
|
||||
|
||||
if (!$CFG->rolesactive) { // No admin user yet.
|
||||
if (empty($CFG->rolesactive)) { // No admin user yet.
|
||||
|
||||
$user = new object();
|
||||
$user->firstname = get_string('admin');
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
sesskey(); // For added security, used to check script parameters
|
||||
|
||||
load_user_capability();
|
||||
load_all_capabilities();
|
||||
|
||||
redirect("$CFG->wwwroot/user/edit.php?id=$user->id&course=$site->id"); // Edit thyself
|
||||
exit;
|
||||
@@ -169,7 +169,7 @@
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = 1;
|
||||
$updateuser->username = "$user->email.".time(); // Remember it just in case
|
||||
$updateuser->username = addslashes("$user->email.".time()); // Remember it just in case
|
||||
$updateuser->email = ''; // Clear this field to free it up
|
||||
$updateuser->idnumber = ''; // Clear this field to free it up
|
||||
$updateuser->timemodified = time();
|
||||
|
||||
@@ -594,8 +594,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
* converting each record *
|
||||
**************************/
|
||||
while(($counter < $totalrecords) and ($fieldname !='dummy') and ($method!='NO_CONV')) { //while there is still something
|
||||
$SQL = 'SELECT * FROM '.$prefix.$dbtablename.' ORDER BY id ASC '.sql_paging_limit($counter, $recordsetsize);
|
||||
if ($records = get_records_sql($SQL)) {
|
||||
$SQL = 'SELECT * FROM '.$prefix.$dbtablename.' ORDER BY id ASC';
|
||||
if ($records = get_records_sql($SQL, $counter, $recordsetsize)) {
|
||||
foreach ($records as $record) {
|
||||
|
||||
//if we are up this far, either no crash, or crash with same table, field name.
|
||||
|
||||
@@ -93,7 +93,7 @@ class test extends XMLDBAction {
|
||||
$table->addFieldInfo('type', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, XMLDB_ENUM, array('single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda'), 'general');
|
||||
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, '');
|
||||
$table->addFieldInfo('intro', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, '');
|
||||
$table->addFieldInfo('logo', XMLDB_TYPE_BINARY, 'big', null, XMLDB_NOTNULL, null, null, null, '');
|
||||
$table->addFieldInfo('logo', XMLDB_TYPE_BINARY, 'big', null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('assessed', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('assesstimestart', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('assesstimefinish', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
@@ -142,8 +142,9 @@ class test extends XMLDBAction {
|
||||
$table->addFieldInfo('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, '30', null, null, null, null, null, 'Moodle');
|
||||
$table->addFieldInfo('secondname', XMLDB_TYPE_CHAR, '30', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->addFieldInfo('intro', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->addFieldInfo('grade', XMLDB_TYPE_NUMBER, '20,10', null, null, null, null, null, '');
|
||||
$table->addFieldInfo('intro', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->addFieldInfo('avatar', XMLDB_TYPE_BINARY, 'medium', null, null, null, null, null, null);
|
||||
$table->addFieldInfo('grade', XMLDB_TYPE_NUMBER, '20,10', null, null, null, null, null);
|
||||
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -181,7 +182,7 @@ class test extends XMLDBAction {
|
||||
if (!$test->status) {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['add field'] = $test;
|
||||
$tests['add enum field'] = $test;
|
||||
}
|
||||
|
||||
/// 5th test. Dropping one complex enum field
|
||||
@@ -193,7 +194,7 @@ class test extends XMLDBAction {
|
||||
if (!$test->status) {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['drop field'] = $test;
|
||||
$tests['drop enum field'] = $test;
|
||||
}
|
||||
|
||||
/// 6th test. Adding one complex enum field
|
||||
@@ -208,22 +209,38 @@ class test extends XMLDBAction {
|
||||
if (!$test->status) {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['add field again'] = $test;
|
||||
$tests['add enum field again'] = $test;
|
||||
}
|
||||
|
||||
/// 7th test. Dropping one complex enum field
|
||||
/// 7th test. Adding one numeric field
|
||||
if ($test->status) {
|
||||
/// Create a new field (numeric)
|
||||
$field = new XMLDBField('onenumber');
|
||||
$field->setAttributes(XMLDB_TYPE_INTEGER, '6', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0, 'type');
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
$test->sql = $table->getAddFieldSQL($CFG->dbtype, $CFG->prefix, $field, true);
|
||||
$test->status = add_field($table, $field, false, false);
|
||||
if (!$test->status) {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['add numeric field'] = $test;
|
||||
}
|
||||
|
||||
/// 8th test. Dropping one complex enum field
|
||||
if ($test->status) {
|
||||
/// Create a new field with complex specs (enums are good candidates)
|
||||
$field = new XMLDBField('type');
|
||||
$test = new stdClass;
|
||||
$test->sql = $table->getDropFieldSQL($CFG->dbtype, $CFG->prefix, $field, true);
|
||||
$test->status = drop_field($table, $field, false, false);
|
||||
if (!$test->status) {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['drop field again'] = $test;
|
||||
$tests['drop enum field again'] = $test;
|
||||
}
|
||||
|
||||
/// 8th test. Change the type of one column from integer to varchar
|
||||
/// 9th test. Change the type of one column from integer to varchar
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -238,7 +255,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field type (int2char)'] = $test;
|
||||
}
|
||||
|
||||
/// 9th test. Change the type of one column from varchar to integer
|
||||
/// 10th test. Change the type of one column from varchar to integer
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -253,7 +270,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field type (char2int)'] = $test;
|
||||
}
|
||||
|
||||
/// 10th test. Change the type of one column from number to varchar
|
||||
/// 11th test. Change the type of one column from number to varchar
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -268,7 +285,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field type (number2char)'] = $test;
|
||||
}
|
||||
|
||||
/// 11th test. Change the type of one column from varchar to float
|
||||
/// 12th test. Change the type of one column from varchar to float
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -283,7 +300,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field type (char2float)'] = $test;
|
||||
}
|
||||
|
||||
/// 12th test. Change the type of one column from float to char
|
||||
/// 13th test. Change the type of one column from float to char
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -298,7 +315,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field type (float2char)'] = $test;
|
||||
}
|
||||
|
||||
/// 13th test. Change the type of one column from char to number
|
||||
/// 14th test. Change the type of one column from char to number
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -314,7 +331,7 @@ class test extends XMLDBAction {
|
||||
}
|
||||
|
||||
|
||||
/// 14th test. Change the precision of one text field
|
||||
/// 15th test. Change the precision of one text field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -329,7 +346,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field precision (text)'] = $test;
|
||||
}
|
||||
|
||||
/// 15th test. Change the precision of one char field
|
||||
/// 16th test. Change the precision of one char field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -344,7 +361,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field precision (char)'] = $test;
|
||||
}
|
||||
|
||||
/// 16th test. Change the precision of one numeric field
|
||||
/// 17th test. Change the precision of one numeric field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -359,7 +376,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field precision (number)'] = $test;
|
||||
}
|
||||
|
||||
/// 17th test. Change the sign of one numeric field to unsigned
|
||||
/// 18th test. Change the sign of one numeric field to unsigned
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -374,7 +391,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field sign (unsigned)'] = $test;
|
||||
}
|
||||
|
||||
/// 18th test. Change the sign of one numeric field to signed
|
||||
/// 19th test. Change the sign of one numeric field to signed
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -389,7 +406,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field sign (signed)'] = $test;
|
||||
}
|
||||
|
||||
/// 19th test. Change the nullability of one char field to not null
|
||||
/// 20th test. Change the nullability of one char field to not null
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -404,7 +421,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field nullability (not null)'] = $test;
|
||||
}
|
||||
|
||||
/// 20th test. Change the nullability of one char field to null
|
||||
/// 21th test. Change the nullability of one char field to null
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -419,7 +436,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field nullability (null)'] = $test;
|
||||
}
|
||||
|
||||
/// 21th test. Dropping the default of one field
|
||||
/// 22th test. Dropping the default of one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -434,7 +451,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop field default of NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 22th test. Creating the default for one field
|
||||
/// 23th test. Creating the default for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -449,7 +466,7 @@ class test extends XMLDBAction {
|
||||
$tests['add field default of NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 23th test. Creating the default for one field
|
||||
/// 24th test. Creating the default for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -465,7 +482,7 @@ class test extends XMLDBAction {
|
||||
}
|
||||
|
||||
|
||||
/// 24th test. Dropping the default of one NOT NULL field
|
||||
/// 25th test. Dropping the default of one NOT NULL field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -480,7 +497,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop field default of NOT NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 25th test. Adding one unique index to the table
|
||||
/// 26th test. Adding one unique index to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -495,7 +512,7 @@ class test extends XMLDBAction {
|
||||
$tests['add unique index'] = $test;
|
||||
}
|
||||
|
||||
/// 26th test. Adding one not unique index to the table
|
||||
/// 27th test. Adding one not unique index to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -510,7 +527,7 @@ class test extends XMLDBAction {
|
||||
$tests['add not unique index'] = $test;
|
||||
}
|
||||
|
||||
/// 27th test. Re-add the same index than previous test. Check find_index_name() works.
|
||||
/// 28th test. Re-add the same index than previous test. Check find_index_name() works.
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -529,7 +546,7 @@ class test extends XMLDBAction {
|
||||
$tests['check find_index_name()'] = $test;
|
||||
}
|
||||
|
||||
/// 28th test. Dropping one index from the table
|
||||
/// 29th test. Dropping one index from the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -544,7 +561,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop index'] = $test;
|
||||
}
|
||||
|
||||
/// 29th test. Adding one unique key to the table
|
||||
/// 30th test. Adding one unique key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -559,7 +576,7 @@ class test extends XMLDBAction {
|
||||
$tests['add unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 30th test. Adding one foreign+unique key to the table
|
||||
/// 31th test. Adding one foreign+unique key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -574,7 +591,7 @@ class test extends XMLDBAction {
|
||||
$tests['add foreign+unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 31th test. Drop one key
|
||||
/// 32th test. Drop one key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -589,7 +606,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop foreign+unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 32th test. Adding one foreign key to the table
|
||||
/// 33th test. Adding one foreign key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -604,7 +621,7 @@ class test extends XMLDBAction {
|
||||
$tests['add foreign key'] = $test;
|
||||
}
|
||||
|
||||
/// 33th test. Drop one foreign key
|
||||
/// 34th test. Drop one foreign key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -619,7 +636,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop foreign key'] = $test;
|
||||
}
|
||||
|
||||
/// 34th test. Adding one complex enum field
|
||||
/// 35th test. Adding one complex enum field
|
||||
if ($test->status) {
|
||||
/// Create a new field with complex specs (enums are good candidates)
|
||||
$field = new XMLDBField('type');
|
||||
@@ -634,7 +651,7 @@ class test extends XMLDBAction {
|
||||
$tests['add field with enum'] = $test;
|
||||
}
|
||||
|
||||
/// 35th test. Dropping the enum of one field
|
||||
/// 36th test. Dropping the enum of one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -649,7 +666,7 @@ class test extends XMLDBAction {
|
||||
$tests['delete enumlist from one field'] = $test;
|
||||
}
|
||||
|
||||
/// 36th test. Creating the enum for one field
|
||||
/// 37th test. Creating the enum for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -663,7 +680,7 @@ class test extends XMLDBAction {
|
||||
$tests['add enumlist to one field'] = $test;
|
||||
}
|
||||
|
||||
/// 37th test. Renaming one index
|
||||
/// 38th test. Renaming one index
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -678,7 +695,7 @@ class test extends XMLDBAction {
|
||||
$tests['rename index (experimental. DO NOT USE IT)'] = $test;
|
||||
}
|
||||
|
||||
/// 38th test. Renaming one key
|
||||
/// 39th test. Renaming one key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -693,7 +710,7 @@ class test extends XMLDBAction {
|
||||
$tests['rename key (experimental. DO NOT USE IT)'] = $test;
|
||||
}
|
||||
|
||||
/// 39th test. Renaming one field
|
||||
/// 40th test. Renaming one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -708,7 +725,7 @@ class test extends XMLDBAction {
|
||||
$tests['rename field'] = $test;
|
||||
}
|
||||
|
||||
/// 40th test. Renaming one table
|
||||
/// 41th test. Renaming one table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -721,7 +738,188 @@ class test extends XMLDBAction {
|
||||
$tests['rename table'] = $test;
|
||||
}
|
||||
|
||||
/// 42th test. Getting the PK sequence name for one table
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$table->setName('newnameforthetable');
|
||||
$test->sql = array(find_sequence_name($table));
|
||||
$test->status = find_sequence_name($table);
|
||||
if (!$test->status) {
|
||||
if (!$test->error = $db->ErrorMsg()) { //If no db errors, result is ok. Just the driver doesn't support this
|
||||
$test->sql = array('not needed for this DB');
|
||||
$test->status = true;
|
||||
}
|
||||
}
|
||||
$tests['find sequence name'] = $test;
|
||||
}
|
||||
|
||||
/// 43th test. Inserting TEXT contents
|
||||
$textlib = textlib_get_instance();
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
$test->sql = array();
|
||||
$basetext = '日本語 • Русский • Deutsch • English • Español • Français • Italiano • Nederlands • Polski • Português • Svenska • العربية • فارسی 한국어 • עברית • ไทย中文 Ελληνικά • Български • Српски • Українська • Bosanski • Català • Česky • Dansk • Eesti • Simple English • Esperanto • Euskara • Galego • Hrvatski • Ido • Bahasa Indonesia • Íslenska • Lëtzebuergesch • Lietuvių • Magyar • Bahasa Melayu اردو • ئۇيغۇرچه • हिन्दी • नेपाल भाषा मराठी • தமிழ் Հայերեն • Беларуская • Чăваш • Ирон æвзаг • Македонски • Сибирской говор • Afrikaans • Aragonés • Arpitan • Asturianu • Kreyòl Ayisyen • Azərbaycan • Bân-lâm-gú • Basa Banyumasan • Brezhoneg • Corsu • Cymraeg • Deitsch • Føroyskt • Frysk • Furlan • Gaeilge • Gàidhlig • Ilokano • Interlingua • Basa Jawa • Kapampangan • Kernewek • Kurdî كوردی • Ladino לאדינו • Latina • Latviešu • Limburgs • Lumbaart • Nedersaksisch • Nouormand • Occitan • O‘zbek • Piemontèis • Plattdüütsch • Ripoarisch • Sámegiella • Scots • Shqip • Sicilianu • Sinugboanon • Srpskohrvatski / Српскохрватски • Basa Sunda • Kiswahili • Tagalog • Tatarça • Walon • Winaray Авар • Башҡорт • Кыргызча Монгол • Қазақша • Тоҷикӣ • Удмурт • Armãneashce • Bamanankan • Eald Englisc • Gaelg • Interlingue • Kaszëbsczi • Kongo • Ligure • Lingála • lojban • Malagasy • Malti • Māori • Nāhuatl • Ekakairũ Naoero • Novial • Pangasinán • Tok Pisin • Romani / रोमानी • Rumantsch • Runa Simi • Sardu • Tetun • Türkmen / تركمن / Туркмен • Vèneto • Volapük • Võro • West-Vlaoms • Wollof • Zazaki • Žemaitėška';
|
||||
/// Create one big text (1.500.000 chars)
|
||||
$fulltext = '';
|
||||
for ($i=0; $i<1000; $i++) { //1500 * 1000 chars
|
||||
$fulltext .= $basetext;
|
||||
}
|
||||
|
||||
/// Build the record to insert
|
||||
$rec->intro = addslashes($fulltext);
|
||||
$rec->name = 'texttest';
|
||||
/// Calculate its length
|
||||
$textlen = $textlib->strlen($fulltext, current_charset());
|
||||
if ($rec->id = insert_record('newnameforthetable', $rec)) {
|
||||
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) {
|
||||
$test->sql = array($newtextlen . ' cc. (text) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
$test->sql = array($newtextlen . ' cc. (text) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['insert record '. $textlen . ' cc. (text)'] = $test;
|
||||
}
|
||||
|
||||
/// 44th test. Inserting BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
/// Build the record to insert
|
||||
$rec->avatar = addslashes($fulltext);
|
||||
$rec->name = 'binarytest';
|
||||
/// Calculate its length
|
||||
$textlen = strlen($fulltext);
|
||||
if ($rec->id = insert_record('newnameforthetable', $rec)) {
|
||||
if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
|
||||
$newtextlen = strlen($new->avatar);
|
||||
if ($rec->avatar === $new->avatar) {
|
||||
$test->sql = array($newtextlen . ' bytes (binary) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
$test->sql = array($newtextlen . ' bytes (binary) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['insert record '. $textlen . ' bytes (binary)'] = $test;
|
||||
}
|
||||
|
||||
/// 45th test. update_record with TEXT and BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
$test->sql = array();
|
||||
/// Build the record to insert
|
||||
$rec->intro = addslashes($basetext);
|
||||
$rec->avatar = addslashes($basetext);
|
||||
$rec->name = 'updatelobs';
|
||||
/// Calculate its length
|
||||
$textlen = $textlib->strlen($basetext, current_charset());
|
||||
$imglen = strlen($basetext);
|
||||
if (update_record('newnameforthetable', $rec)) {
|
||||
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) {
|
||||
$test->sql = array($newtextlen . ' cc. (text) sent and received ok',
|
||||
$newimglen . ' bytes (binary) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
if ($rec->avatar !== $new->avatar) {
|
||||
$test->error = $db->ErrorMsg();
|
||||
$test->sql = array($newimglen . ' bytes (binary) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
$test->sql = array($newtextlen . ' cc. (text) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['update record '. $textlen . ' cc. (text) and ' . $imglen . ' bytes (binary)'] = $test;
|
||||
}
|
||||
|
||||
/// 46th test. set_field with TEXT contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
$test->sql = array();
|
||||
/// Build the record to insert
|
||||
$rec->intro = addslashes($fulltext);
|
||||
$rec->name = 'updatelobs';
|
||||
/// Calculate its length
|
||||
$textlen = $textlib->strlen($fulltext, current_charset());
|
||||
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) {
|
||||
$test->sql = array($newtextlen . ' cc. (text) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
$test->sql = array($newtextlen . ' cc. (text) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['set field '. $textlen . ' cc. (text)'] = $test;
|
||||
}
|
||||
|
||||
/// 47th test. set_field with BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
$test->sql = array();
|
||||
/// Build the record to insert
|
||||
$rec->avatar = addslashes($fulltext);
|
||||
$rec->name = 'updatelobs';
|
||||
/// Calculate its length
|
||||
$textlen = strlen($fulltext);
|
||||
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) {
|
||||
$test->sql = array($newtextlen . ' bytes (binary) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
$test->sql = array($newtextlen . ' bytes (binary) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
} else {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['set field '. $textlen . ' bytes (binary)'] = $test;
|
||||
}
|
||||
|
||||
/// TODO: Check here values of the inserted records to see that everything ha the correct value
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ class view_structure_php extends XMLDBAction {
|
||||
/// Calculate the popup of commands
|
||||
$commands = array('create_table',
|
||||
'drop_table',
|
||||
'rename_table (not imp!)');
|
||||
'rename_table');
|
||||
foreach ($commands as $command) {
|
||||
$popcommands[$command] = str_replace('_', ' ', $command);
|
||||
}
|
||||
|
||||
@@ -119,13 +119,12 @@ class view_table_php extends XMLDBAction {
|
||||
$commands = array('Fields',
|
||||
$optionspacer . 'add_field',
|
||||
$optionspacer . 'drop_field',
|
||||
$optionspacer . 'rename_field (not imp!)',
|
||||
$optionspacer . 'rename_field',
|
||||
$optionspacer . 'change_field_type',
|
||||
$optionspacer . 'change_field_precision',
|
||||
$optionspacer . 'change_field_unsigned',
|
||||
$optionspacer . 'change_field_notnull',
|
||||
$optionspacer . 'change_field_sequence (not imp!)',
|
||||
$optionspacer . 'change_field_enum (not imp!)',
|
||||
$optionspacer . 'change_field_enum',
|
||||
$optionspacer . 'change_field_default',
|
||||
'Keys',
|
||||
$optionspacer . 'add_key',
|
||||
@@ -229,6 +228,13 @@ class view_table_php extends XMLDBAction {
|
||||
$o.= $this->str['mustselectonefield'];
|
||||
}
|
||||
break;
|
||||
case 'change_field_enum':
|
||||
if ($fieldkeyindexinitial == 'f') { //Only if we have got one field
|
||||
$o.= s($this->change_field_enum_php($structure, $tableparam, $fieldkeyindexparam));
|
||||
} else {
|
||||
$o.= $this->str['mustselectonefield'];
|
||||
}
|
||||
break;
|
||||
case 'change_field_default':
|
||||
if ($fieldkeyindexinitial == 'f') { //Only if we have got one field
|
||||
$o.= s($this->change_field_default_php($structure, $tableparam, $fieldkeyindexparam));
|
||||
@@ -619,6 +625,53 @@ class view_table_php extends XMLDBAction {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will generate all the PHP code needed to
|
||||
* change the enum values (check constraint) of one field
|
||||
* using XMLDB objects and functions
|
||||
*
|
||||
* @param XMLDBStructure structure object containing all the info
|
||||
* @param string table table name
|
||||
* @param string field field name to change its enum
|
||||
*/
|
||||
function change_field_enum_php($structure, $table, $field) {
|
||||
|
||||
$result = '';
|
||||
/// Validate if we can do it
|
||||
if (!$table = $structure->getTable($table)) {
|
||||
return false;
|
||||
}
|
||||
if (!$field = $table->getField($field)) {
|
||||
return false;
|
||||
}
|
||||
if ($table->getAllErrors()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Calculate the enum tip text
|
||||
$enum = $field->getEnum() ? implode(', ', $field->getEnumValues()) : 'none';
|
||||
|
||||
/// Add the standard PHP header
|
||||
$result .= XMLDB_PHP_HEADER;
|
||||
|
||||
/// Add contents
|
||||
$result .= XMLDB_LINEFEED;
|
||||
$result .= ' /// Changing list of values (enum) of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $enum . XMLDB_LINEFEED;
|
||||
$result .= ' $table = new XMLDBTable(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
|
||||
$result .= ' $field = new XMLDBField(' . "'" . $field->getName() . "'" . ');' . XMLDB_LINEFEED;
|
||||
$result .= ' $field->setAttributes(' . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// 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;
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will generate all the PHP code needed to
|
||||
* change the default of one field using XMLDB objects and functions
|
||||
@@ -776,6 +829,9 @@ class view_table_php extends XMLDBAction {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Prepend warning. This function isn't usable!
|
||||
$result .= 'DON\'T USE THIS FUNCTION (IT\'S ONLY EXPERIMENTAL). SOME DBs DON\'T SUPPORT IT!' . XMLDB_LINEFEED . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the standard PHP header
|
||||
$result .= XMLDB_PHP_HEADER;
|
||||
|
||||
@@ -908,6 +964,9 @@ class view_table_php extends XMLDBAction {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Prepend warning. This function isn't usable!
|
||||
$result .= 'DON\'T USE THIS FUNCTION (IT\'S ONLY EXPERIMENTAL). SOME DBs DON\'T SUPPORT IT!' . XMLDB_LINEFEED . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the standard PHP header
|
||||
$result .= XMLDB_PHP_HEADER;
|
||||
|
||||
|
||||
@@ -159,6 +159,8 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
reset_login_count();
|
||||
|
||||
load_all_capabilities(); /// This is what lets the user do anything on the site :-)
|
||||
|
||||
redirect($urltogo);
|
||||
|
||||
exit;
|
||||
@@ -266,6 +268,8 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
reset_login_count();
|
||||
|
||||
load_all_capabilities(); /// This is what lets the user do anything on the site :-)
|
||||
|
||||
redirect($urltogo);
|
||||
|
||||
exit;
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">auth_dbtype:</td>
|
||||
<td>
|
||||
<?php $dbtypes = array("access","ado_access", "ado", "ado_mssql", "borland_ibase", "csv", "db2", "fbsql", "firebird", "ibase", "informix72", "informix", "mssql", "mysql", "mysqlt", "oci805", "oci8", "oci8po", "odbc", "odbc_mssql", "odbc_oracle", "oracle", "postgres64", "postgres7", "postgres", "proxy", "sqlanywhere", "sybase", "vfp");
|
||||
<?php $dbtypes = array("access","ado_access", "ado", "ado_mssql", "borland_ibase", "csv", "db2", "fbsql", "firebird", "ibase", "informix72", "informix", "mssql", "mssql_n", "mysql", "mysqlt", "oci805", "oci8", "oci8po", "odbc", "odbc_mssql", "odbc_oracle", "oracle", "postgres64", "postgres7", "postgres", "proxy", "sqlanywhere", "sybase", "vfp");
|
||||
foreach ($dbtypes as $dbtype) {
|
||||
$dboptions[$dbtype] = $dbtype;
|
||||
}
|
||||
|
||||
@@ -1,169 +1,85 @@
|
||||
<?php
|
||||
|
||||
if (!isset($config->auth_fchost)) {
|
||||
|
||||
$config->auth_fchost = "127.0.0.1";
|
||||
|
||||
}
|
||||
|
||||
if (!isset($config->auth_fcfppport)) {
|
||||
|
||||
$config->auth_fcfppport = "3333";
|
||||
|
||||
}
|
||||
|
||||
if (!isset($config->auth_fcuserid)) {
|
||||
|
||||
$config->auth_fcuserid = "fcMoodle";
|
||||
|
||||
}
|
||||
|
||||
if (!isset($config->auth_fcpasswd)) {
|
||||
|
||||
$config->auth_fcpasswd = "";
|
||||
|
||||
}
|
||||
|
||||
if (!isset($config->auth_fccreators)) {
|
||||
|
||||
$config->auth_fccreators = "";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right">auth_fchost:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="auth_fchost" type="text" size="30" value="<?php echo $config->auth_fchost?>" />
|
||||
|
||||
<?php if (isset($err["auth_fchost"])) formerr($err["auth_fchost"]); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string("auth_fchost","auth") ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right">auth_fcfppport:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="auth_fcfppport" type="text" size="30" value="<?php echo $config->auth_fcfppport?>" />
|
||||
|
||||
<?php if (isset($err["auth_fcfppport"])) formerr($err["auth_fchost"]); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string("auth_fcfppport","auth") ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right">auth_fcuserid:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="auth_fcuserid" type="text" size="30" maxlength="15" value="<?php echo $config->auth_fcuserid?>" />
|
||||
|
||||
<?php if (isset($err["auth_fcuserid"])) formerr($err["auth_fcuserid"]); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string("auth_fcuserid","auth") ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right">auth_fcpasswd:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="auth_fcpasswd" type="password" size="30" maxlength="12" value="<?php echo $config->auth_fcpasswd?>" />
|
||||
|
||||
<?php if (isset($err["auth_fcpasswd"])) formerr($err["auth_fcpasswd"]); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string("auth_fcpasswd","auth") ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right">auth_fccreators:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="auth_fccreators" type="text" size="30" value="<?php echo $config->auth_fccreators?>" />
|
||||
|
||||
<?php if (isset($err["auth_fccreators"])) formerr($err["auth_fccreators"]); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string("auth_fccreators","auth") ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
|
||||
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string("authinstructions","auth") ?>
|
||||
|
||||
<?php helpbutton("text", get_string("helptext")) ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php print_auth_lock_options($auth, $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false); ?>
|
||||
|
||||
+7
-6
@@ -108,13 +108,14 @@ class fcFPP
|
||||
if($this->_debug) echo $line;
|
||||
|
||||
if (preg_match ("/^\+0/", $line)) { //+0, user with subadmin privileges
|
||||
$this->_user = $userid;
|
||||
$this->_pwd = $passwd;
|
||||
return TRUE;
|
||||
} elseif (preg_match ("/^\Sorry/",$line)){ //Denied access but a valid user and password
|
||||
$this->_user = $userid;
|
||||
$this->_pwd = $passwd;
|
||||
return TRUE;
|
||||
} elseif (strpos($line, 'You are not allowed')){ // Denied access but a valid user and password
|
||||
// "Sorry. You are not allowed to login with the FPP interface"
|
||||
return TRUE;
|
||||
} else { //Invalid user or password
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,4 +216,4 @@ class fcFPP
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+1
-1
@@ -551,7 +551,7 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
|
||||
|
||||
}
|
||||
if ( $do_updates && !(empty($updatekeys)) ) { // run updates only if relevant
|
||||
$users = get_records_sql('SELECT u.username, u.id FROM ' . $CFG->prefix . 'user AS u WHERE u.deleted=0 and u.auth=\'' . AUTH_LDAP_NAME . '\'' );
|
||||
$users = get_records_sql('SELECT u.username, u.id FROM ' . $CFG->prefix . 'user u WHERE u.deleted=0 and u.auth=\'' . AUTH_LDAP_NAME . '\'' );
|
||||
if (!empty($users)) {
|
||||
print "User entries to update: ". count($users). "\n";
|
||||
|
||||
|
||||
+5
-15
@@ -1,20 +1,9 @@
|
||||
<?php //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// backup/restore utility.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -164,6 +153,7 @@ function backup_upgrade($oldversion=0) {
|
||||
table_column('backup_ids','info','info','mediumtext','','','','not null');
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
rem
|
||||
rem Table structure for table prefix_backup_files
|
||||
rem
|
||||
|
||||
drop table prefix_backup_files;
|
||||
|
||||
CREATE TABLE prefix_backup_files (
|
||||
backup_code number(10) default '0' NOT NULL,
|
||||
file_type varchar2(10) default '' NOT NULL,
|
||||
path varchar2(255) default '' NOT NULL,
|
||||
old_id number(10) default NULL,
|
||||
new_id number(10) default NULL
|
||||
);
|
||||
|
||||
ALTER TABLE prefix_backup_files
|
||||
ADD CONSTRAINT pbf_pk
|
||||
PRIMARY KEY (backup_code,file_type,path);
|
||||
|
||||
COMMENT on table prefix_backup_files is 'To store and recode ids to user and course files.';
|
||||
|
||||
rem --------------------------------------------------------
|
||||
rem
|
||||
rem Table structure for table prefix_backup_ids
|
||||
rem
|
||||
|
||||
drop table prefix_backup_ids;
|
||||
|
||||
CREATE TABLE prefix_backup_ids (
|
||||
backup_code number(12) default '0' NOT NULL,
|
||||
table_name varchar2(30) default '' NOT NULL,
|
||||
old_id number(10) default '0' NOT NULL,
|
||||
new_id number(10) default NULL,
|
||||
info varchar2(20)
|
||||
);
|
||||
|
||||
ALTER TABLE prefix_backup_ids
|
||||
ADD CONSTRAINT pbi_pk
|
||||
PRIMARY KEY (backup_code,table_name,old_id);
|
||||
|
||||
COMMENT on table prefix_backup_ids is 'To store and convert ids in backup/restore';
|
||||
|
||||
rem --------------------------------------------------------
|
||||
rem
|
||||
rem Table structure for table prefix_backup_config
|
||||
rem
|
||||
|
||||
drop TABLE prefix_backup_config;
|
||||
|
||||
CREATE TABLE prefix_backup_config (
|
||||
id number(10) default '0' not null,
|
||||
name varchar2(255) default '' not null,
|
||||
value varchar2(255) default '' not null,
|
||||
constraint pk_baco primary key (id),
|
||||
constraint uk_baco_name unique (name)
|
||||
);
|
||||
|
||||
COMMENT on table prefix_backup_config is 'To store backup configuration variables';
|
||||
|
||||
drop sequence p_backup_config_seq;
|
||||
create sequence p_backup_config_seq;
|
||||
|
||||
create or replace trigger p_backup_config_trig
|
||||
before insert on prefix_backup_config
|
||||
referencing new as new_row
|
||||
for each row
|
||||
begin
|
||||
select p_backup_config_seq.nextval into :new_row.id from dual;
|
||||
end;
|
||||
|
||||
rem --------------------------------------------------------
|
||||
rem
|
||||
rem Table structure for table prefix_backup_courses
|
||||
rem
|
||||
|
||||
drop TABLE prefix_backup_courses;
|
||||
|
||||
CREATE TABLE prefix_backup_courses (
|
||||
id number(10) default '0' NOT NULL,
|
||||
courseid number(10) default '0' NOT NULL,
|
||||
laststarttime number(10) default '0' NOT NULL,
|
||||
lastendtime number(10) default '0' NOT NULL,
|
||||
laststatus varchar2(1) default '0' NOT NULL,
|
||||
nextstarttime number(10) default '0' NOT NULL,
|
||||
constraint pk_bacu primary key (id),
|
||||
constraint uk_bacu_courseid unique (courseid)
|
||||
);
|
||||
|
||||
COMMENT on table prefix_backup_courses is 'To store every course backup status';
|
||||
|
||||
drop sequence p_backup_courses_seq;
|
||||
create sequence p_backup_courses_seq;
|
||||
|
||||
create or replace trigger p_backup_courses_trig
|
||||
before insert on prefix_backup_courses
|
||||
referencing new as new_row
|
||||
for each row
|
||||
begin
|
||||
select p_backup_courses_seq.nextval into :new_row.id from dual;
|
||||
end;
|
||||
|
||||
rem --------------------------------------------------------
|
||||
rem
|
||||
rem Table structure for table prefix_backup_log
|
||||
rem
|
||||
|
||||
drop TABLE prefix_backup_log;
|
||||
|
||||
CREATE TABLE prefix_backup_log (
|
||||
id number(10) default '0' NOT NULL,
|
||||
courseid number(10) default '0' NOT NULL,
|
||||
time number(10) default '0' NOT NULL,
|
||||
laststarttime number(10) default '0' NOT NULL,
|
||||
info varchar2(255) default '0' NOT NULL,
|
||||
constraint pk_balo primary key (id)
|
||||
);
|
||||
|
||||
COMMENT on table prefix_backup_log is 'To store every course backup log info';
|
||||
|
||||
drop sequence p_backup_log_seq;
|
||||
create sequence p_backup_log_seq;
|
||||
|
||||
create or replace trigger p_backup_log_trig
|
||||
before insert on prefix_backup_log
|
||||
referencing new as new_row
|
||||
for each row
|
||||
begin
|
||||
select p_backup_log_seq.nextval into :new_row.id from dual;
|
||||
end;
|
||||
|
||||
/
|
||||
+6
-16
@@ -1,21 +1,9 @@
|
||||
<?php //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// backup/restore utility.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
|
||||
function backup_upgrade($oldversion=0) {
|
||||
|
||||
@@ -61,6 +49,8 @@ function backup_upgrade($oldversion=0) {
|
||||
table_column('backup_courses', 'nextstarttime', 'nextstarttime', 'integer', '', '', '0');
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the backup system
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_backup_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -17,7 +17,7 @@
|
||||
//Detect if we are coming from the restore form
|
||||
$fromform = optional_param ('fromform', 0, PARAM_INT);
|
||||
|
||||
if ($form1 = data_submitted()); {
|
||||
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";
|
||||
|
||||
@@ -266,7 +266,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\" />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
$instances = $info->mods[$modname]->instances;
|
||||
if (isset($info->mods[$modname]->instances)) {
|
||||
$instances = $info->mods[$modname]->instances;
|
||||
}
|
||||
if (!empty($instances) && is_array($instances)) {
|
||||
echo '<tr><td></td><td colspan="3"><table class="restore-form-instances">';
|
||||
foreach ($instances as $instance) {
|
||||
@@ -422,7 +424,11 @@ $xml_file = $CFG->dataroot."/temp/backup/".$backup_unique_code."/moodle.xml";
|
||||
|
||||
$info = restore_read_xml_info($xml_file);
|
||||
|
||||
$siterolesarray = get_assignable_roles (get_context_instance(CONTEXT_COURSE, $course->id), "shortname");
|
||||
if ($course->id == SITEID) {
|
||||
$siterolesarray = get_assignable_roles (get_context_instance(CONTEXT_SYSTEM, SITEID), "shortname");
|
||||
} else {
|
||||
$siterolesarray = get_assignable_roles (get_context_instance(CONTEXT_COURSE, $course->id), "shortname");
|
||||
}
|
||||
|
||||
echo ('<table width="100%" class="restore-form-instances">');
|
||||
echo ('<tr><td align="right"><b>'.get_string('sourcerole').'</b></td><td align="left"><b>'.get_string('targetrole').'</b></td></tr>');
|
||||
@@ -439,7 +445,7 @@ if ($info->backup_moodle_version < 2006092801) {
|
||||
$roles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
$editteacher = array_shift($roles);
|
||||
choose_from_menu ($siterolesarray, "defaultteacheredit", $editteacher->id);
|
||||
choose_from_menu ($siterolesarray, "defaultteacheredit", $editteacher->id, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
|
||||
/// Non-editting teacher
|
||||
@@ -451,7 +457,7 @@ if ($info->backup_moodle_version < 2006092801) {
|
||||
$roles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
$teacher = array_shift($roles);
|
||||
|
||||
choose_from_menu ($siterolesarray, "defaultteacher", $teacher->id);
|
||||
choose_from_menu ($siterolesarray, "defaultteacher", $teacher->id, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
|
||||
|
||||
@@ -464,7 +470,7 @@ if ($info->backup_moodle_version < 2006092801) {
|
||||
$roles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
$studentrole = array_shift($roles);
|
||||
|
||||
choose_from_menu ($siterolesarray, "defaultstudent", $studentrole->id);
|
||||
choose_from_menu ($siterolesarray, "defaultstudent", $studentrole->id, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
|
||||
} else {
|
||||
|
||||
+78
-22
@@ -45,7 +45,7 @@
|
||||
//Iterate
|
||||
foreach($modules as $name => $module) {
|
||||
//Only if the module is being restored
|
||||
if ($module->restore == 1) {
|
||||
if (isset($module->restore) && $module->restore == 1) {
|
||||
//Include module library
|
||||
include_once("$CFG->dirroot/mod/$name/lib.php");
|
||||
//If module_refresh_events exists
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
foreach ($restore->mods as $name => $info) {
|
||||
//If the module is being restored
|
||||
if ($info->restore == 1) {
|
||||
if (isset($info->restore) && $info->restore == 1) {
|
||||
//Check if the xxxx_decode_content_links_caller exists
|
||||
include_once("$CFG->dirroot/mod/$name/restorelib.php");
|
||||
$function_name = $name."_decode_content_links_caller";
|
||||
@@ -365,7 +365,7 @@
|
||||
} else {
|
||||
$tab[$elem][1] = get_string("included")." ".get_string("withoutuserdata");
|
||||
}
|
||||
if (is_array($mod->instances) && count($mod->instances)) {
|
||||
if (isset($mod->instances) && is_array($mod->instances) && count($mod->instances)) {
|
||||
foreach ($mod->instances as $instance) {
|
||||
if ($instance->backup) {
|
||||
$elem++;
|
||||
@@ -565,7 +565,7 @@
|
||||
$course->lang = addslashes($course_header->course_lang);
|
||||
$course->theme = addslashes($course_header->course_theme);
|
||||
$course->cost = addslashes($course_header->course_cost);
|
||||
$course->currency = addslashes($course_header->course_currency);
|
||||
$course->currency = isset($course_header->course_currency)?addslashes($course_header->course_currency):'';
|
||||
$course->marker = addslashes($course_header->course_marker);
|
||||
$course->visible = addslashes($course_header->course_visible);
|
||||
$course->hiddensections = addslashes($course_header->course_hiddensections);
|
||||
@@ -901,7 +901,7 @@
|
||||
// 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) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
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
|
||||
@@ -912,7 +912,7 @@
|
||||
}
|
||||
|
||||
//Check if we've to restore this module (and instance)
|
||||
if ($restore->mods[$mod->type]->restore) {
|
||||
if (!empty($restore->mods[$mod->type]->restore)) {
|
||||
if (empty($restore->mods[$mod->type]->granular) // we don't care about per instance
|
||||
|| (array_key_exists($mod->instance,$restore->mods[$mod->type]->instances)
|
||||
&& !empty($restore->mods[$mod->type]->instances[$mod->instance]->restore))) {
|
||||
@@ -1932,15 +1932,14 @@
|
||||
if ($categories) {
|
||||
foreach ($categories as $category) {
|
||||
$restoredcategory = get_record('question_categories','id',$category->new_id);
|
||||
$restoredcategory = addslashes_object($restoredcategory);
|
||||
if ($restoredcategory->parent != 0) {
|
||||
//echo 'Parent '.$restoredcategory->parent.' is '; //Debug
|
||||
$idcat = backup_getid($restore->backup_unique_code,'question_categories',$restoredcategory->parent);
|
||||
if ($idcat->new_id) {
|
||||
$restoredcategory->parent = $idcat->new_id;
|
||||
} else {
|
||||
$restoredcategory->parent = 0;
|
||||
}
|
||||
//echo $restoredcategory->parent.' now<br />'; //Debug
|
||||
update_record('question_categories', $restoredcategory);
|
||||
}
|
||||
}
|
||||
@@ -2205,10 +2204,7 @@
|
||||
//Get admin->id for later use
|
||||
$admin = get_admin();
|
||||
$adminid = $admin->id;
|
||||
//First, we check the course_id backup data folder exists
|
||||
$dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
|
||||
check_dir_exists($dest_dir,true);
|
||||
$restorelog_file = fopen("$dest_dir/restorelog.html","a");
|
||||
|
||||
//Now, if we have anything in events, we have to restore that
|
||||
//events
|
||||
if ($events) {
|
||||
@@ -2227,6 +2223,11 @@
|
||||
//print_object ($GLOBALS['traverse_array']); //Debug
|
||||
//$GLOBALS['traverse_array']=""; //Debug
|
||||
|
||||
//if necessary, write to restorelog and adjust date/time fields
|
||||
if ($restore->course_startdateoffset) {
|
||||
restore_log_date_changes('Events', $restore, $info['EVENT']['#'], array('TIMESTART'));
|
||||
}
|
||||
|
||||
//Now build the EVENT record structure
|
||||
$eve->name = backup_todb($info['EVENT']['#']['NAME']['0']['#']);
|
||||
$eve->description = backup_todb($info['EVENT']['#']['DESCRIPTION']['0']['#']);
|
||||
@@ -2239,11 +2240,6 @@
|
||||
$eve->instance = 0;
|
||||
$eve->eventtype = backup_todb($info['EVENT']['#']['EVENTTYPE']['0']['#']);
|
||||
$eve->timestart = backup_todb($info['EVENT']['#']['TIMESTART']['0']['#']);
|
||||
$date = usergetdate($eve->timestart);
|
||||
fwrite ($restorelog_file,"The Event - ".$eve->name. " - TIMESTART was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
|
||||
$eve->timestart += $restore->course_startdateoffset;
|
||||
$date = usergetdate($eve->timestart);
|
||||
fwrite ($restorelog_file," the Event TIMESTART is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
|
||||
$eve->timeduration = backup_todb($info['EVENT']['#']['TIMEDURATION']['0']['#']);
|
||||
$eve->visible = backup_todb($info['EVENT']['#']['VISIBLE']['0']['#']);
|
||||
$eve->timemodified = backup_todb($info['EVENT']['#']['TIMEMODIFIED']['0']['#']);
|
||||
@@ -4901,7 +4897,7 @@
|
||||
$mod_id = $data["MOD"]["#"]["ID"]["0"]["#"];
|
||||
$mod_type = $data["MOD"]["#"]["MODTYPE"]["0"]["#"];
|
||||
//Only if we've selected to restore it
|
||||
if ($this->preferences->mods[$mod_type]->restore) {
|
||||
if (!empty($this->preferences->mods[$mod_type]->restore)) {
|
||||
//Save to db
|
||||
$status = backup_putid($this->preferences->backup_unique_code,$mod_type,$mod_id,
|
||||
null,$data);
|
||||
@@ -5350,7 +5346,7 @@
|
||||
*/
|
||||
function restore_userdata_selected($restore,$modname,$modid) {
|
||||
// check first for per instance array
|
||||
if (!empty($restore->mods[$modname]->instances)) { // supports per instance
|
||||
if (!empty($restore->mods[$modname]->granular)) { // supports per instance
|
||||
return array_key_exists($modid,$restore->mods[$modname]->instances)
|
||||
&& !empty($restore->mods[$modname]->instances[$modid]->userinfo);
|
||||
}
|
||||
@@ -5878,7 +5874,7 @@
|
||||
// would have loaded it anyway, if there is any assignments.
|
||||
// fix for MDL-6831
|
||||
$newcontext = get_context_instance(CONTEXT_COURSE, $restore->course_id);
|
||||
if (!has_capability('course:manageactivities', $newcontext)) {
|
||||
if (!has_capability('moodle/course:manageactivities', $newcontext)) {
|
||||
if ($legacyteachers = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if ($legacyteacher = array_shift($legacyteachers)) {
|
||||
role_assign($legacyteacher->id, $USER->id, 0, $newcontext->id);
|
||||
@@ -6212,7 +6208,7 @@
|
||||
}
|
||||
$assignment->userid = $olduser->new_id; // new userid here
|
||||
$oldmodifier = backup_getid($restore->backup_unique_code,"user",$assignment->modifierid);
|
||||
$assignment->modifierid = $oldmodifier->new_id?$oldmodifier->new_id:0; // new modifier id here
|
||||
$assignment->modifierid = !empty($oldmodifier->new_id) ? $oldmodifier->new_id : 0; // new modifier id here
|
||||
$assignment->roleid = $role->new_id; // restored new role id
|
||||
|
||||
// hack to make the correct contextid for course level imports
|
||||
@@ -6259,5 +6255,65 @@
|
||||
insert_record('role_capabilities', $override);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//write activity date changes to the html log file, and update date values in the the xml array
|
||||
function restore_log_date_changes($recordtype, &$restore, &$xml, $TAGS, $NAMETAG='NAME') {
|
||||
|
||||
global $CFG;
|
||||
$openlog = false;
|
||||
|
||||
// loop through time fields in $TAGS
|
||||
foreach ($TAGS as $TAG) {
|
||||
|
||||
// check $TAG has a sensible value
|
||||
if (!empty($xml[$TAG][0]['#']) && is_string($xml[$TAG][0]['#']) && is_numeric($xml[$TAG][0]['#'])) {
|
||||
|
||||
if ($openlog==false) {
|
||||
$openlog = true; // only come through here once
|
||||
|
||||
// open file for writing
|
||||
$course_dir = "$CFG->dataroot/$restore->course_id/backupdata";
|
||||
check_dir_exists($course_dir, true);
|
||||
$restorelog = fopen("$course_dir/restorelog.html", "a");
|
||||
|
||||
// start output for this record
|
||||
$msg = new stdClass();
|
||||
$msg->recordtype = $recordtype;
|
||||
$msg->recordname = $xml[$NAMETAG][0]['#'];
|
||||
fwrite ($restorelog, get_string("backupdaterecordtype", "moodle", $msg));
|
||||
}
|
||||
|
||||
// write old date to $restorelog
|
||||
$value = $xml[$TAG][0]['#'];
|
||||
$date = usergetdate($value);
|
||||
|
||||
$msg = new stdClass();
|
||||
$msg->TAG = $TAG;
|
||||
$msg->weekday = $date['weekday'];
|
||||
$msg->mday = $date['mday'];
|
||||
$msg->month = $date['month'];
|
||||
$msg->year = $date['year'];
|
||||
fwrite ($restorelog, get_string("backupdateold", "moodle", $msg));
|
||||
|
||||
// write new date to $restorelog
|
||||
$value += $restore->course_startdateoffset;
|
||||
$date = usergetdate($value);
|
||||
|
||||
$msg = new stdClass();
|
||||
$msg->TAG = $TAG;
|
||||
$msg->weekday = $date['weekday'];
|
||||
$msg->mday = $date['mday'];
|
||||
$msg->month = $date['month'];
|
||||
$msg->year = $date['year'];
|
||||
fwrite ($restorelog, get_string("backupdatenew", "moodle", $msg));
|
||||
|
||||
// update $value in $xml tree for calling module
|
||||
$xml[$TAG][0]['#'] = "$value";
|
||||
}
|
||||
}
|
||||
// close the restore log, if it was opened
|
||||
if ($openlog) {
|
||||
fclose($restorelog);
|
||||
}
|
||||
}
|
||||
?>
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
/// database (backup_version) to determine whether upgrades should
|
||||
/// be performed (see db/backup_*.php)
|
||||
|
||||
$backup_version = 2006082301; // The current version is a date (YYYYMMDDXX)
|
||||
$backup_release = "1.7dev"; // User-friendly version number
|
||||
$backup_version = 2006082304; // The current version is a date (YYYYMMDDXX)
|
||||
$backup_release = "1.7"; // User-friendly version number
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
<?PHP //$Id$
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +16,8 @@ function activity_modules_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function activity_modules_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the activity_modules block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_activity_modules_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -57,7 +57,7 @@ class block_admin extends block_list {
|
||||
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&edit=on&sesskey='.sesskey().'">'.get_string('turneditingon').'</a>';
|
||||
}
|
||||
|
||||
$this->content->items[]='<a href="edit.php?id='.$this->instance->pageid.'">'.get_string('settings').'</a>';
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/edit.php?id='.$this->instance->pageid.'">'.get_string('settings').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/settings.gif" alt="" />';
|
||||
}
|
||||
|
||||
@@ -143,16 +143,16 @@ class block_admin extends block_list {
|
||||
}
|
||||
|
||||
/// Authorize hooks
|
||||
if (has_capability('enrol/authorize:managepayments', $context)) {
|
||||
if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize')) {
|
||||
require_once($CFG->dirroot.'/enrol/authorize/const.php');
|
||||
$paymenturl = '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?course='.$course->id.'">'.get_string('payments').'</a> ';
|
||||
if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize')) {
|
||||
require_once($CFG->dirroot.'/enrol/authorize/const.php');
|
||||
$paymenturl = '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?course='.$course->id.'">'.get_string('payments').'</a> ';
|
||||
if (has_capability('enrol/authorize:managepayments', $context)) {
|
||||
if ($cnt = count_records('enrol_authorize', 'status', AN_STATUS_AUTH, 'courseid', $course->id)) {
|
||||
$paymenturl .= '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?status='.AN_STATUS_AUTH.'&course='.$course->id.'">'.get_string('paymentpending', 'moodle', $cnt).'</a>';
|
||||
}
|
||||
$this->content->items[] = $paymenturl;
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/payment.gif" alt="" />';
|
||||
}
|
||||
$this->content->items[] = $paymenturl;
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/payment.gif" alt="" />';
|
||||
}
|
||||
|
||||
/// View course grades (or just your own grades, same link)
|
||||
@@ -162,14 +162,16 @@ class block_admin extends block_list {
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" alt="" />';
|
||||
}
|
||||
|
||||
/// Person can unenrol themselves from this course
|
||||
if (has_capability('moodle/role:unassignself', $context, NULL, false) and empty($course->metacourse)) {
|
||||
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
if (empty($course->metacourse)) {
|
||||
if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Are a guest now
|
||||
$this->content->items[]='<a href="enrol.php?id='.$this->instance->pageid.'">'.get_string('enrolme', '', $course->shortname).'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
} else if (has_capability('moodle/role:unassignself', $context, NULL, false)) { // Have some role
|
||||
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Should the following two be in this block?
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function admin_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function admin_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the admin block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_admin_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -88,8 +88,8 @@ class block_blog_menu extends block_base {
|
||||
&& (!$blogmodon || ($blogmodon && $coursearg != ''))
|
||||
&& $CFG->bloglevel >= BLOG_USER_LEVEL ) {
|
||||
|
||||
// show Add entry link - moderation is off, or moderation is on and the user is viewing the block within the context of a course
|
||||
if (has_capability('moodle/blog:create', $curcontext)) {
|
||||
// show Add entry link
|
||||
if (has_capability('moodle/blog:create', $sitecontext)) {
|
||||
$addentrylink = '<li><a href="'. $CFG->wwwroot. '/blog/edit.php?action=add'
|
||||
.$coursearg.'">'.get_string('addnewentry', 'blog') ."</a></li>\n";
|
||||
}
|
||||
@@ -113,9 +113,9 @@ class block_blog_menu extends block_base {
|
||||
$output .= get_string('viewsiteentries', 'blog')."</a></li>\n";
|
||||
}
|
||||
|
||||
if (isloggedin() && !isguest()
|
||||
&& (has_capability('moodle/blog:manageofficialtags', $sitecontext)
|
||||
|| has_capability('moodle/blog:managepersonaltags', $curcontext))) {
|
||||
if (has_capability('moodle/blog:manageofficialtags', $sitecontext)
|
||||
or has_capability('moodle/blog:managepersonaltags', $sitecontext)
|
||||
or has_capability('moodle/blog:create', $sitecontext)) {
|
||||
|
||||
$output .= '<li>'. link_to_popup_window("/blog/tags.php",'popup',get_string('tagmanagement'), 400, 500, 'Popup window', 'none', true) ."</li>\n";
|
||||
}
|
||||
|
||||
@@ -77,16 +77,15 @@ class block_blog_tags extends block_base {
|
||||
$timewithin = $this->config->timewithin * 24 * 60 * 60; /// convert to seconds
|
||||
|
||||
$sql = 'SELECT t.id, t.type, t.text, COUNT(DISTINCT bt.id) as ct ';
|
||||
$sql .= "FROM {$CFG->prefix}tags as t, {$CFG->prefix}blog_tag_instance as bt, {$CFG->prefix}post as p ";
|
||||
$sql .= "FROM {$CFG->prefix}tags t, {$CFG->prefix}blog_tag_instance bt, {$CFG->prefix}post p ";
|
||||
$sql .= 'WHERE t.id = bt.tagid ';
|
||||
$sql .= 'AND p.id = bt.entryid ';
|
||||
$sql .= 'AND (p.publishstate = \'site\' or p.publishstate=\'public\') ';
|
||||
$sql .= "AND bt.timemodified > {$timewithin} ";
|
||||
$sql .= 'GROUP BY t.id, t.type, t.text ';
|
||||
$sql .= 'ORDER BY ct DESC, t.text ASC ';
|
||||
$sql .= "LIMIT {$this->config->numberoftags} ";
|
||||
$sql .= 'ORDER BY ct DESC, t.text ASC';
|
||||
|
||||
if ($tags = get_records_sql($sql)) {
|
||||
if ($tags = get_records_sql($sql, 0, $this->config->numberoftags)) {
|
||||
|
||||
/// There are 2 things to do:
|
||||
/// 1. tags with the same count should have the same size class
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function calendar_month_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function calendar_month_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the calendar_month block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_calendar_month_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function calendar_upcoming_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function calendar_upcoming_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the calendar_upcoming block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_calendar_upcoming_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -36,7 +36,7 @@ class block_course_list extends block_list {
|
||||
|
||||
if (empty($CFG->disablemycourses) and
|
||||
!empty($USER->id) and
|
||||
!(has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $adminseesall)and
|
||||
!(has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) and $adminseesall) and
|
||||
!isguest()) { // Just print My Courses
|
||||
if ($courses = get_my_courses($USER->id)) {
|
||||
foreach ($courses as $course) {
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function course_list_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function course_list_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the course_list block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_course_list_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function course_summary_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function course_summary_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the course_summary block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_course_summary_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
+6
-15
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -161,6 +150,8 @@ global $CFG;
|
||||
modify_database('','ALTER TABLE prefix_block_pinned ADD INDEX pagetype (pagetype);');
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
+6
-15
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -163,6 +152,8 @@ global $CFG;
|
||||
modify_database('','CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype);');
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the blocks system
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_blocks_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -41,11 +41,14 @@ class block_glossary_random extends block_base {
|
||||
$this->instance_config_commit();
|
||||
}
|
||||
|
||||
$limitfrom = 0;
|
||||
$limitnum = 1;
|
||||
|
||||
switch ($this->config->type) {
|
||||
|
||||
case BGR_RANDOMLY:
|
||||
$i = rand(1,$numberofentries);
|
||||
$LIMIT = sql_paging_limit($i-1, 1);
|
||||
$limitfrom = $i-1;
|
||||
$SORT = 'ASC';
|
||||
break;
|
||||
|
||||
@@ -58,13 +61,13 @@ class block_glossary_random extends block_base {
|
||||
if ($i > $numberofentries) { // Loop back to beginning
|
||||
$i = 1;
|
||||
}
|
||||
$LIMIT = sql_paging_limit($i-1, 1);
|
||||
$limitfrom = $i-1;
|
||||
$SORT = 'ASC';
|
||||
break;
|
||||
|
||||
default: // BGR_LASTMODIFIED
|
||||
$i = $numberofentries;
|
||||
$LIMIT = 'LIMIT 1'; // The last one
|
||||
$limitfrom = 0;
|
||||
$SORT = 'DESC';
|
||||
break;
|
||||
}
|
||||
@@ -73,7 +76,7 @@ class block_glossary_random extends block_base {
|
||||
' FROM '.$CFG->prefix.'glossary_entries'.
|
||||
' WHERE glossaryid = '.$this->config->glossary.
|
||||
' AND approved = 1 '.
|
||||
'ORDER BY timemodified '.$SORT.' '.$LIMIT)) {
|
||||
'ORDER BY timemodified '.$SORT, $limitfrom, $limitnum)) {
|
||||
|
||||
$entry = reset($entry);
|
||||
|
||||
@@ -82,7 +85,10 @@ class block_glossary_random extends block_base {
|
||||
} else {
|
||||
$text = "<h2>".format_string($entry->concept,true)."</h2>";
|
||||
}
|
||||
$text .= format_text($entry->definition, $entry->format);
|
||||
|
||||
$options = new object;
|
||||
$options->trusttext = true;
|
||||
$text .= format_text($entry->definition, $entry->format, $options);
|
||||
|
||||
$this->config->nexttime = usergetmidnight(time()) + DAYSECS * $this->config->refresh;
|
||||
$this->config->previous = $i;
|
||||
@@ -169,7 +175,6 @@ class block_glossary_random extends block_base {
|
||||
// place link to glossary in the footer if the glossary is visible
|
||||
$glossaryid = $this->config->glossary;
|
||||
$glossary=get_record('glossary', 'id', $glossaryid);
|
||||
$studentcanpost = $glossary->studentcanpost; //needed to decide on which footer
|
||||
|
||||
//Create a temp valid module structure (course,id)
|
||||
$tempmod->course = $this->course->id;
|
||||
@@ -178,7 +183,7 @@ class block_glossary_random extends block_base {
|
||||
//Obtain the visible property from the instance
|
||||
if (instance_is_visible('glossary', $tempmod)) {
|
||||
$cm = get_coursemodule_from_instance('glossary',$glossaryid, $this->course->id) ;
|
||||
if ($studentcanpost) {
|
||||
if (has_capability('mod/glossary:write', get_context_instance(CONTEXT_MODULE, $cm->id))) {
|
||||
$this->content->footer = '<a href="'.$CFG->wwwroot.'/mod/glossary/edit.php?id='.$cm->id
|
||||
.'" title="'.$this->config->addentry.'">'.$this->config->addentry.'</a><br />';
|
||||
} else {
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function news_items_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function news_items_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the news_items block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_news_items_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -72,9 +72,9 @@ class block_online_users extends block_base {
|
||||
ul.userid = u.id
|
||||
$courseselect
|
||||
$timeselect
|
||||
$groupselect ".sql_paging_limit(0,20);
|
||||
$groupselect ";
|
||||
|
||||
if ($pusers = get_records_sql($SQL)) {
|
||||
if ($pusers = get_records_sql($SQL, 0, 20)) {
|
||||
foreach ($pusers as $puser) {
|
||||
$puser->fullname = fullname($puser);
|
||||
$users[$puser->id] = $puser;
|
||||
@@ -95,9 +95,16 @@ class block_online_users extends block_base {
|
||||
foreach ($users as $user) {
|
||||
$this->content->text .= '<li class="listentry">';
|
||||
$timeago = format_time(time() - max($user->timeaccess, $user->lastaccess)); //bruno to calculate correctly on frontpage
|
||||
$this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true).' ';
|
||||
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'" title="'.$timeago.'">'.$user->fullname.'</a>';
|
||||
if (!empty($USER->id) and ($USER->id != $user->id) and !empty($CFG->messaging) and !isguest()) { // Only when logged in
|
||||
if ($user->username == 'guest') {
|
||||
$this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true, false).' ';
|
||||
$this->content->text .= get_string('guestuser');
|
||||
|
||||
} else {
|
||||
$this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true).' ';
|
||||
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'" title="'.$timeago.'">'.$user->fullname.'</a>';
|
||||
}
|
||||
if (!empty($USER->id) and ($USER->id != $user->id) and !empty($CFG->messaging) and
|
||||
!isguest() and $user->username != 'guest') { // Only when logged in and messaging active etc
|
||||
$this->content->text .= "\n".' <a title="'.get_string('messageselectadd').'" target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/discussion.php?id='.$user->id.'" onclick="return openpopup(\'/message/discussion.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);">'
|
||||
.'<img class="messageicon" src="'.$CFG->pixpath.'/t/message.gif" alt="'. get_string('messageselectadd') .'" /></a>';
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function online_users_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function online_users_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the online_users block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_online_users_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function participants_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function participants_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the participants block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_participants_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function recent_activity_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function recent_activity_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the recent_activity block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_recent_activity_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -102,7 +102,8 @@
|
||||
'sesskey' => $USER->sesskey,
|
||||
'blockaction' => 'config',
|
||||
'currentaction' => 'managefeeds',
|
||||
'id' => $this->courseid
|
||||
'id' => $this->courseid,
|
||||
'section' => 'rss'
|
||||
));
|
||||
$output .= '<div align="center"><a title="'. get_string('feedsaddedit', 'block_rss_client') .'" href="'. $script .'">'. get_string('feedsaddedit', 'block_rss_client') .'</a></div>';
|
||||
} else {
|
||||
@@ -113,7 +114,8 @@
|
||||
'sesskey' => $USER->sesskey,
|
||||
'blockaction' => 'config',
|
||||
'currentaction' => 'configblock',
|
||||
'id' => $this->courseid
|
||||
'id' => $this->courseid,
|
||||
'section' => 'rss'
|
||||
));
|
||||
$output .= '<div align="center"><a title="'. get_string('feedsconfigurenewinstance', 'block_rss_client') .'" href="'. $script.'">'. get_string('feedsconfigurenewinstance', 'block_rss_client') .'</a></div>';
|
||||
}
|
||||
@@ -128,7 +130,7 @@
|
||||
$numids = count($rssidarray);
|
||||
$count = 0;
|
||||
foreach ($rssidarray as $rssid) {
|
||||
$output .= $this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false);
|
||||
$output .= clean_text($this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false), FORMAT_HTML);
|
||||
if ($numids > 1 && $count != $numids -1 && !empty($rssfeedstring)) {
|
||||
$output .= '<hr width="80%" />';
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ $tabs = $row = array();
|
||||
$context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
|
||||
|
||||
if (has_capability('moodle/site:manageblocks', $context)) {
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id));
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id, 'section' => 'rss'));
|
||||
$row[] = new tabobject('configblock', $script,
|
||||
get_string('configblock', 'block_rss_client'));
|
||||
}
|
||||
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id));
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id, 'section' => 'rss'));
|
||||
$row[] = new tabobject('managefeeds', $script,
|
||||
get_string('managefeeds', 'block_rss_client'));
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@ $block_rss_client_capabilities = array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_PREVENT,
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
@@ -52,9 +50,6 @@ $block_rss_client_capabilities = array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_PREVENT,
|
||||
'teacher' => CAP_PREVENT,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'admin' => CAP_ALLOW
|
||||
@@ -66,8 +61,6 @@ $block_rss_client_capabilities = array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_PREVENT,
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
@@ -80,15 +73,10 @@ $block_rss_client_capabilities = array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_PREVENT,
|
||||
'teacher' => CAP_PREVENT,
|
||||
'editingteacher' => CAP_PREVENT,
|
||||
'coursecreator' => CAP_PREVENT,
|
||||
'admin' => CAP_ALLOW
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?php //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
|
||||
function rss_client_upgrade($oldversion) {
|
||||
/// This function does anything necessary to upgrade
|
||||
/// older versions to match current functionality
|
||||
@@ -130,7 +135,9 @@ function rss_client_upgrade($oldversion) {
|
||||
}
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?php //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
|
||||
function rss_client_upgrade($oldversion) {
|
||||
/// This function does anything necessary to upgrade
|
||||
/// older versions to match current functionality
|
||||
@@ -131,8 +136,10 @@ function rss_client_upgrade($oldversion) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the rss_client block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_rss_client_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -30,7 +30,11 @@
|
||||
|
||||
function get_content() {
|
||||
global $CFG;
|
||||
|
||||
|
||||
if (empty($CFG->enableglobalsearch)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
//cache block contents
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?php
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function search_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?php
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to pgsql
|
||||
|
||||
@@ -28,6 +17,8 @@ function search_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the search block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_search_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function search_forums_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function search_forums_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the search_forums block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_search_forums_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -27,6 +16,7 @@ function section_links_upgrade($oldversion=0) {
|
||||
if ($oldversion < 2004050500 and $result) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function section_links_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the section_links block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_section_links_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function social_activities_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// blocks system.
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// Versions are defined by backup_version.php
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to PostgreSQL
|
||||
|
||||
@@ -28,6 +17,8 @@ function social_activities_upgrade($oldversion=0) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the social_activities block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the functions defined in lib/ddllib.php
|
||||
|
||||
function xmldb_block_social_activities_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG, $THEME, $db;
|
||||
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -13,6 +13,7 @@ class page_blog extends page_base {
|
||||
var $courseid = NULL;
|
||||
var $filtertype = NULL;
|
||||
var $filterselect = NULL;
|
||||
var $tagid = NULL;
|
||||
|
||||
// Mandatory; should return our identifier.
|
||||
function get_type() {
|
||||
@@ -102,6 +103,7 @@ class page_blog extends page_base {
|
||||
}
|
||||
|
||||
function url_get_parameters() {
|
||||
|
||||
$array = array();
|
||||
if (!$this->full_init_done) {
|
||||
$array['userid'] = $this->id;
|
||||
@@ -117,6 +119,9 @@ class page_blog extends page_base {
|
||||
if (!empty($this->filterselect)) {
|
||||
$array['filterselect'] = $this->filterselect;
|
||||
}
|
||||
if (!empty($this->tagid)) {
|
||||
$array['tagid'] = $this->tagid;
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -43,6 +43,7 @@ if (empty($USER->id)) {
|
||||
$PAGE->courseid = $courseid;
|
||||
$PAGE->filtertype = $filtertype;
|
||||
$PAGE->filterselect = $filterselect;
|
||||
$PAGE->tagid = $tagid;
|
||||
|
||||
$PAGE->init_full(); //init the BlogInfo object and the courserecord object
|
||||
|
||||
@@ -116,10 +117,10 @@ if (!$course = get_record('course', 'id', $courseid)) {
|
||||
|
||||
case 'course':
|
||||
if ($tagid || !empty($tag)) {
|
||||
print_header_simple("$course->shortname: $blogstring", $course->fullname,
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
'<a href="index.php?filtertype=course&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
|
||||
} else {
|
||||
print_header_simple("$course->shortname: $blogstring", $course->fullname,
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
$blogstring,'','',true,$PAGE->get_extra_header_string());
|
||||
}
|
||||
break;
|
||||
@@ -129,11 +130,11 @@ if (!$course = get_record('course', 'id', $courseid)) {
|
||||
$thisgroup = get_record('groups', 'id', $filterselect);
|
||||
|
||||
if ($tagid || !empty($tag)) {
|
||||
print_header_simple("$course->shortname: $blogstring", $course->fullname,
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$filterselect.'">'.$thisgroup->name.'</a> ->
|
||||
<a href="index.php?filtertype=group&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
|
||||
} else {
|
||||
print_header_simple("$course->shortname: $blogstring", $course->fullname,
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$filterselect.'">'.$thisgroup->name."</a> ->
|
||||
$blogstring",'','',true,$PAGE->get_extra_header_string());
|
||||
|
||||
|
||||
+62
-81
@@ -90,10 +90,11 @@
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
$morelink = '<br /> ';
|
||||
|
||||
|
||||
$totalentries = get_viewable_entry_count($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='lastmodified DESC');
|
||||
$blogEntries = fetch_entries($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='lastmodified DESC', true);
|
||||
|
||||
print_paging_bar(count($blogEntries), $blogpage, $bloglimit, get_baseurl($filtertype, $filterselect), 'blogpage');
|
||||
|
||||
print_paging_bar($totalentries, $blogpage, $bloglimit, get_baseurl($filtertype, $filterselect), 'blogpage');
|
||||
|
||||
if ($CFG->enablerssfeeds) {
|
||||
blog_rss_print_link($filtertype, $filterselect, $tag);
|
||||
@@ -114,17 +115,22 @@
|
||||
blog_print_entry($blogEntry, 'list', $filtertype, $filterselect); //print this entry.
|
||||
$count++;
|
||||
}
|
||||
|
||||
print_paging_bar($totalentries, $blogpage, $bloglimit, get_baseurl($filtertype, $filterselect), 'blogpage');
|
||||
|
||||
if (!$count) {
|
||||
print '<br /><center>'. get_string('noentriesyet', 'blog') .'</center><br />';
|
||||
|
||||
}
|
||||
|
||||
|
||||
print $morelink.'<br />'."\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '<br /><center>'. get_string('noentriesyet', 'blog') .'</center><br />';
|
||||
print $output;
|
||||
|
||||
print $output;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -259,9 +265,17 @@
|
||||
global $CFG;
|
||||
|
||||
// everyone gets draft access
|
||||
$options = array ( 'draft' => get_string('publishtonoone', 'blog') );
|
||||
$options['site'] = get_string('publishtosite', 'blog');
|
||||
$options['public'] = get_string('publishtoworld', 'blog');
|
||||
if ($CFG->bloglevel >= BLOG_USER_LEVEL) {
|
||||
$options = array ( 'draft' => get_string('publishtonoone', 'blog') );
|
||||
}
|
||||
|
||||
if ($CFG->bloglevel > BLOG_USER_LEVEL) {
|
||||
$options['site'] = get_string('publishtosite', 'blog');
|
||||
}
|
||||
|
||||
if ($CFG->bloglevel >= BLOG_GLOBAL_LEVEL) {
|
||||
$options['public'] = get_string('publishtoworld', 'blog');
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
@@ -423,6 +437,12 @@
|
||||
$tagquerysql = '';
|
||||
}
|
||||
|
||||
if (isloggedin()) {
|
||||
$permissionsql = '(p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
} else {
|
||||
$permissionsql = 'p.publishstate = \'public\'';
|
||||
}
|
||||
|
||||
|
||||
/****************************************
|
||||
* depending on the type, there are 4 *
|
||||
@@ -431,61 +451,33 @@
|
||||
|
||||
$requiredfields = 'p.*, u.firstname,u.lastname,u.email';
|
||||
|
||||
if ($filtertype == 'course' && $filterselect == SITEID) { // Really a site
|
||||
$filtertype = 'site';
|
||||
}
|
||||
|
||||
switch ($filtertype) {
|
||||
|
||||
case 'site':
|
||||
|
||||
if (isloggedin()) {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')
|
||||
AND u.deleted = 0';
|
||||
|
||||
} else {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND p.publishstate = \'public\'
|
||||
AND u.deleted = 0';
|
||||
}
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.deleted = 0
|
||||
AND '.$permissionsql;
|
||||
|
||||
break;
|
||||
|
||||
case 'course':
|
||||
if ($filterselect != SITEID) {
|
||||
// all users with a role assigned
|
||||
$context = get_context_instance(CONTEXT_COURSE, $filterselect);
|
||||
|
||||
// all users with a role assigned
|
||||
$context = get_context_instance(CONTEXT_COURSE, $filterselect);
|
||||
|
||||
$SQL = '(SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'role_assignments ra, '.$CFG->prefix.'user u
|
||||
WHERE p.userid = ra.userid '.$tagquerysql.'
|
||||
AND ra.contextid '.get_related_contexts_string($context).'
|
||||
AND u.id = p.userid
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.'))';
|
||||
} else {
|
||||
|
||||
if (isloggedin()) {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')
|
||||
AND u.deleted = 0';
|
||||
|
||||
} else {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND p.publishstate = \'public\'
|
||||
AND u.deleted = 0';
|
||||
}
|
||||
|
||||
}
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'role_assignments ra, '.$CFG->prefix.'user u
|
||||
WHERE p.userid = ra.userid '.$tagquerysql.'
|
||||
AND ra.contextid '.get_related_contexts_string($context).'
|
||||
AND u.id = p.userid
|
||||
AND u.deleted = 0
|
||||
AND '.$permissionsql;
|
||||
|
||||
break;
|
||||
|
||||
@@ -496,46 +488,35 @@
|
||||
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.')';
|
||||
AND u.deleted = 0
|
||||
AND '.$permissionsql;
|
||||
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
|
||||
if (isloggedin()) {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.id = '.$filterselect.'
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
} else {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.id = '.$filterselect.'
|
||||
AND p.publishstate = \'public\'';
|
||||
|
||||
}
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.id = '.$filterselect.'
|
||||
AND u.deleted = 0
|
||||
AND '.$permissionsql;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
$limitfrom = 0;
|
||||
$limitnum = 0;
|
||||
|
||||
if ($fetchstart !== '' && $limit) {
|
||||
$limit = sql_paging_limit($fetchstart, $fetchlimit);
|
||||
} else {
|
||||
$limit = '';
|
||||
$limitfrom = $fetchstart;
|
||||
$limitnum = $fetchlimit;
|
||||
}
|
||||
|
||||
$orderby = ' ORDER BY '. $sort .' ';
|
||||
|
||||
//echo 'Debug: BlogFilter fetch_entries() sql="'. $SQL . $orderby . $limit .'"<br />'. $this->categoryid; //debug
|
||||
$records = get_records_sql($SQL . $orderby . $limit);
|
||||
|
||||
// print_object($records); //debug
|
||||
//global $db; $db->debug = true;
|
||||
$records = get_records_sql($SQL . $orderby, $limitfrom, $limitnum);
|
||||
//$db->debug = false;
|
||||
|
||||
if (empty($records)) {
|
||||
return array();
|
||||
|
||||
+1
-3
@@ -67,9 +67,7 @@
|
||||
|
||||
/// Get all the posts from the database
|
||||
|
||||
//$blogFilter =& new BlogFilter(0, 0, 20, 0, $type, $id, $tagid);
|
||||
|
||||
$blogposts = fetch_entries(0, 0, 20, 0, $type, $id, $tagid); //$blogFilter->fetch_entries();
|
||||
$blogposts = fetch_entries('', 20, '', $type, $id, $tagid);
|
||||
|
||||
/// Now generate an array of RSS items
|
||||
if ($blogposts) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user