Compare commits
289 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a1d246334b | |||
| 7ca0ece0db | |||
| dcfc7a875a | |||
| ffd6212152 | |||
| 1cf721e235 | |||
| aed7f32783 | |||
| dbc7d20cf5 | |||
| 6357d61912 | |||
| 3acce7a095 | |||
| a36531da4f | |||
| 7d1906cf7c | |||
| 8be58774cd | |||
| ffbcd681f3 | |||
| dc49c2d461 | |||
| 10357af3ef | |||
| 1800b35bf6 | |||
| 6ca2f1d3ce | |||
| 8ef685cf4c | |||
| e4b1208377 | |||
| cd735560d3 | |||
| a770897929 | |||
| 40ff6e3663 | |||
| b408061558 | |||
| be1af716b7 | |||
| f69ff3b72e | |||
| 0543bb679b | |||
| 9cad3e182d | |||
| 1243bf814b | |||
| e972cdc5ad | |||
| dc8d309c88 | |||
| 860848dca8 | |||
| aafe1618f8 | |||
| 358e5cf791 | |||
| a2c591662b | |||
| 64550fa6c1 | |||
| 267ff8cd27 | |||
| 32bbc36039 | |||
| 8129b01641 | |||
| a39a53fa6f | |||
| c50d05671b | |||
| 7f7d9ce6e8 | |||
| 58a44ab228 | |||
| b43c2e9d39 | |||
| 42cbe9be98 | |||
| 0ba9f5a5e9 | |||
| 9d1963b421 | |||
| ed82e03798 | |||
| a89d501b72 | |||
| 4587d4f5b7 | |||
| cb0318b633 | |||
| 404e01f59e | |||
| 96ebc911d7 | |||
| 7d8c4fb5af | |||
| 929c26ccf1 | |||
| c994fe7430 | |||
| 1d4262608c | |||
| 0016ed0115 | |||
| 0c5e3d4564 | |||
| e0c00395b7 | |||
| 9e9e0732f5 | |||
| 965344c08f | |||
| 0f97c8afdb | |||
| 1b5afe64c4 | |||
| 5831b4c70c | |||
| 223e753520 | |||
| 72682b8868 | |||
| 8fe13ecf1a | |||
| dbfa519ad9 | |||
| 6ff99dde45 | |||
| 332748dd7e | |||
| db65026449 | |||
| 45c920b0af | |||
| 1be36988ac | |||
| d7964ccf87 | |||
| efa9f19281 | |||
| 6662dee76d | |||
| 1729746211 | |||
| fe2a74db60 | |||
| 72b01fbeb3 | |||
| 7259dbc551 | |||
| 39949b56ad | |||
| 7110207a34 | |||
| 40b67fca0a | |||
| b9c38ef120 | |||
| b8e5740796 | |||
| 8c9d533f3d | |||
| 18952a18fd | |||
| 53516a8ece | |||
| a5f35b4cf2 | |||
| fbb829b82d | |||
| ceec817f95 | |||
| 0cba7c0408 | |||
| 2df28fda6c | |||
| 9f83ba0887 | |||
| 956d1a3ab5 | |||
| 6005434b55 | |||
| a8fb78b142 | |||
| b3af6c110a | |||
| 58ca2c4b71 | |||
| 4e77491aff | |||
| c2ca1a3793 | |||
| 1f3933bee6 | |||
| e7af814b0d | |||
| 365e163946 | |||
| 9f689071a8 | |||
| 85daa5926c | |||
| 415be0ff94 | |||
| e50e70d12e | |||
| 8c14856d86 | |||
| d613d7d78e | |||
| 7c19940ca6 | |||
| ead158db7e | |||
| 3bcb2c1dff | |||
| 265dbb3a54 | |||
| 2253ea2592 | |||
| 5ff8144cc8 | |||
| 9cf83e67a1 | |||
| 4d199d6b33 | |||
| 8109fce46d | |||
| cb6ff0a71c | |||
| d107f1e2cd | |||
| ebad6e2f6f | |||
| 9660c98e57 | |||
| c34b325447 | |||
| 35cd08c96e | |||
| e5baaad498 | |||
| 8e8a8810de | |||
| 177bc9c8b9 | |||
| 33b8721c71 | |||
| 6cf3a65082 | |||
| 841b2a44ef | |||
| 98402da094 | |||
| 76ffac7f93 | |||
| 782b21dc0f | |||
| e0b587be49 | |||
| e60d8e5a42 | |||
| 67cb80dc09 | |||
| abe73c6d99 | |||
| f455e4e9bd | |||
| 6d3ac4035b | |||
| b057855440 | |||
| 92ec74a9a7 | |||
| 9abb69aacb | |||
| cb8e878573 | |||
| ba0c76e7a9 | |||
| 40ab5a4010 | |||
| a30e3c5a1a | |||
| cb140ca0d6 | |||
| 4026898f5c | |||
| 51d861632b | |||
| 72306a6ff4 | |||
| 9831354928 | |||
| 925d068de1 | |||
| 1a35796fba | |||
| b2b9890d08 | |||
| 4f7dc83fe8 | |||
| 7c183f44d4 | |||
| 7d919d8f27 | |||
| 324ea4d7de | |||
| 9ff12f3dae | |||
| 83688ab542 | |||
| 2b6d08a333 | |||
| e2acc0a010 | |||
| c5b8cda403 | |||
| d4b584c5f6 | |||
| 2f24a39b5b | |||
| de1b85d795 | |||
| d6b040af81 | |||
| a23463acec | |||
| 3b89933d9f | |||
| 903ab24de4 | |||
| 5c8e2b97d3 | |||
| 9dfd9a124d | |||
| db5602f751 | |||
| a3bb5afdd0 | |||
| 423dc3b17e | |||
| 3a353b12ba | |||
| 26ebc41703 | |||
| b23dd6ee72 | |||
| 03adb289ec | |||
| 1a52d9e2cc | |||
| 1daa8c0821 | |||
| 51a2716e6b | |||
| b3463f416c | |||
| fc97bb9863 | |||
| 8c495ea4ee | |||
| bb0ece5a0c | |||
| e79c09855c | |||
| 1f00dc45d4 | |||
| f9c5bd9234 | |||
| f6b9be73f5 | |||
| f08f05610b | |||
| b750cfde81 | |||
| 7210cb5d19 | |||
| 860f7f9195 | |||
| a3a3186770 | |||
| 424f91c056 | |||
| 56b77440ad | |||
| 92bf70765a | |||
| 653599b3a4 | |||
| ba9489ce91 | |||
| 6aabb69f9e | |||
| 02af5654f2 | |||
| 4e8da675ac | |||
| d3054582d5 | |||
| c3c2a213a2 | |||
| ed9c60fed7 | |||
| 9de951556f | |||
| ff4a2ddef7 | |||
| 8d7ec82427 | |||
| c4437be63b | |||
| 7f467e69c0 | |||
| d59ef547c9 | |||
| abf82af8f7 | |||
| 5cb418e9f8 | |||
| 7109330e9a | |||
| e467ed219f | |||
| f0c8bb711f | |||
| cfef4e754a | |||
| cbd8609407 | |||
| 2a1733aafc | |||
| 1357ab1d5b | |||
| 001f78b41f | |||
| 853f2e8eea | |||
| 00c7590c95 | |||
| 24e5fcbe26 | |||
| 4d8a37a0db | |||
| 3cba5809ae | |||
| d7320fc84a | |||
| cff596e51b | |||
| acb3bf8ac1 | |||
| ebd748fd71 | |||
| 653e811ec0 | |||
| 81dda1da15 | |||
| 9cd8fdda3c | |||
| c532957be2 | |||
| ad86ee91e9 | |||
| 11892d8fdf | |||
| 00aa596e8e | |||
| 7b80d3c65a | |||
| 7da6c0f82d | |||
| a6395af1b9 | |||
| 4dbdc834ff | |||
| bc3801cb9c | |||
| 4e7a371b2e | |||
| db48cf080d | |||
| e0745be16b | |||
| 9671325a35 | |||
| 1e92c729ba | |||
| 347f822856 | |||
| 0f69a9eaaf | |||
| cdbd44f00e | |||
| 6ae2048c1f | |||
| 02ed16902b | |||
| 30e1b79889 | |||
| d30043c852 | |||
| add75e9682 | |||
| 78baf38ea4 | |||
| cad8d5ccb0 | |||
| a52422abcb | |||
| a33d85b374 | |||
| da3494a8c4 | |||
| ae7aad593c | |||
| cf2d7311ab | |||
| 8f64668af2 | |||
| 2af51a1dc3 | |||
| 17e0ed7919 | |||
| 7e4c833c5a | |||
| 264ca6c58d | |||
| b1d4c42ad6 | |||
| 7f96df6222 | |||
| 73553ddbaa | |||
| a6adddfb7d | |||
| f10ad2d4eb | |||
| e61eecacc8 | |||
| 924deffba6 | |||
| de276c9216 | |||
| aed70c6d40 | |||
| b11d6236df | |||
| 4921fb4c9f | |||
| 6a8a17eb28 | |||
| c114ff92bb | |||
| a77b489d67 | |||
| 9d7ce57ae3 | |||
| 28a6552570 | |||
| 6f2d62d022 | |||
| a9cc3954b9 | |||
| 2324ddd3d5 | |||
| 59c1a98c05 |
@@ -556,4 +556,118 @@
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.3" requires="2.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="5.0.25">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.3" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
<VENDOR name="sqlite" version="2.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.3.2" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="gdrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="40M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="safe_mode" value="0" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingsafemode" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+19
-13
@@ -38,9 +38,10 @@ class mnet_simple_host_form extends moodleform {
|
||||
|
||||
$mform = $this->_form;
|
||||
|
||||
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
|
||||
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'), array('maxlength' => 255, 'size' => 50));
|
||||
$mform->setType('wwwroot', PARAM_URL);
|
||||
$mform->addRule('wwwroot', null, 'required', null, 'client');
|
||||
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
|
||||
$mform->addElement('select', 'applicationid', get_string('applicationtype', 'mnet'),
|
||||
$DB->get_records_menu('mnet_application', array(), 'id,display_name'));
|
||||
@@ -81,11 +82,13 @@ class mnet_review_host_form extends moodleform {
|
||||
$mform->addElement('hidden', 'applicationid');
|
||||
$mform->addElement('hidden', 'oldpublickey');
|
||||
|
||||
$mform->addElement('text', 'name', get_string('site'));
|
||||
$mform->addElement('text', 'name', get_string('site'), array('maxlength' => 80, 'size' => 50));
|
||||
$mform->setType('name', PARAM_NOTAGS);
|
||||
$mform->addRule('name', get_string('maximumchars', '', 80), 'maxlength', 80, 'client');
|
||||
|
||||
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
|
||||
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'), array('maxlength' => 255, 'size' => 50));
|
||||
$mform->setType('wwwroot', PARAM_URL);
|
||||
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
|
||||
$themes = array('' => get_string('forceno'));
|
||||
foreach (array_keys(get_plugin_list('theme')) as $themename) {
|
||||
@@ -96,15 +99,6 @@ class mnet_review_host_form extends moodleform {
|
||||
$mform->addElement('textarea', 'public_key', get_string('publickey', 'mnet'), array('rows' => 17, 'cols' => 100, 'class' => 'smalltext'));
|
||||
$mform->setType('public_key', PARAM_PEM);
|
||||
|
||||
if ($mnet_peer && !empty($mnet_peer->deleted)) {
|
||||
$radioarray = array();
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1);
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0);
|
||||
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' '), false);
|
||||
} else {
|
||||
$mform->addElement('hidden', 'deleted');
|
||||
}
|
||||
|
||||
// finished with form controls, now the static informational stuff
|
||||
if ($mnet_peer && !empty($mnet_peer->bootstrapped)) {
|
||||
$expires = '';
|
||||
@@ -140,7 +134,19 @@ class mnet_review_host_form extends moodleform {
|
||||
}
|
||||
}
|
||||
|
||||
$mform->addElement('static', 'certdetails', get_string('certdetails', 'mnet'), $OUTPUT->box('<pre>' . $credstr . '</pre>'));
|
||||
$mform->addElement('static', 'certdetails', get_string('certdetails', 'mnet'),
|
||||
$OUTPUT->box('<pre>' . $credstr . '</pre>', 'generalbox certdetails'));
|
||||
}
|
||||
|
||||
if ($mnet_peer && !empty($mnet_peer->deleted)) {
|
||||
$radioarray = array();
|
||||
$radioarray[] = MoodleQuickForm::createElement('static', 'deletedinfo', '',
|
||||
$OUTPUT->container(get_string('deletedhostinfo', 'mnet'), 'deletedhostinfo'));
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1);
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0);
|
||||
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' ', ' '), false);
|
||||
} else {
|
||||
$mform->addElement('hidden', 'deleted');
|
||||
}
|
||||
|
||||
// finished with static stuff, print save button
|
||||
|
||||
+19
-4
@@ -190,7 +190,7 @@ if ($formdata = $reviewform->get_data()) {
|
||||
|
||||
// normal flow - just display all hosts with links
|
||||
echo $OUTPUT->header();
|
||||
$hosts = mnet_get_hosts();
|
||||
$hosts = mnet_get_hosts(true);
|
||||
|
||||
// print the table to display the register all hosts setting
|
||||
$table = new html_table();
|
||||
@@ -231,28 +231,43 @@ $table->head = array(
|
||||
);
|
||||
$table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap');
|
||||
$baseurl = new moodle_url('/admin/mnet/peers.php');
|
||||
$deleted = array();
|
||||
foreach($hosts as $host) {
|
||||
$hosturl = new moodle_url($baseurl, array('hostid' => $host->id));
|
||||
if (trim($host->name) === '') {
|
||||
// should not happen but...
|
||||
$host->name = '???';
|
||||
}
|
||||
// process all hosts first since it's the easiest
|
||||
if ($host->id == $CFG->mnet_all_hosts_id) {
|
||||
$table->data[] = array(html_writer::tag('a', $host->name, array('href'=>$hosturl)), '', '', '');
|
||||
$table->data[] = array(html_writer::link($hosturl, get_string('allhosts', 'core_mnet')), '*', '', '');
|
||||
continue;
|
||||
}
|
||||
|
||||
// populate the list of deleted hosts
|
||||
if ($host->deleted) {
|
||||
$deleted[] = html_writer::link($hosturl, $host->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($host->last_connect_time == 0) {
|
||||
$last_connect = get_string('never');
|
||||
} else {
|
||||
$last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
|
||||
$last_connect = userdate($host->last_connect_time, get_string('strftimedatetime', 'core_langconfig'));
|
||||
}
|
||||
$table->data[] = array(
|
||||
html_writer::link($hosturl, $host->name),
|
||||
html_writer::link($hosturl, $host->wwwroot),
|
||||
html_writer::link($host->wwwroot, $host->wwwroot),
|
||||
$last_connect,
|
||||
$OUTPUT->single_button(new moodle_url('/admin/mnet/delete.php', array('hostid' => $host->id)), get_string('delete'))
|
||||
);
|
||||
}
|
||||
echo html_writer::table($table);
|
||||
|
||||
if ($deleted) {
|
||||
echo $OUTPUT->box(get_string('deletedhosts', 'core_mnet', join(', ', $deleted)), 'deletedhosts');
|
||||
}
|
||||
|
||||
// finally, print the initial form to add a new host
|
||||
echo $OUTPUT->box_start();
|
||||
echo $OUTPUT->heading(get_string('addnewhost', 'mnet'), 3);
|
||||
|
||||
@@ -52,16 +52,16 @@ foreach ($behaviours as $behaviour => $notused) {
|
||||
if (!array_key_exists($behaviour, $counts)) {
|
||||
$counts[$behaviour] = 0;
|
||||
}
|
||||
$needed[$behaviour] = ($counts[$behaviour] > 0) &&
|
||||
$needed[$behaviour] = ($counts[$behaviour] > 0) ||
|
||||
$pluginmanager->other_plugins_that_require('qbehaviour_' . $behaviour);
|
||||
$archetypal[$behaviour] = question_engine::is_behaviour_archetypal($behaviour);
|
||||
}
|
||||
|
||||
foreach ($counts as $behaviour => $count) {
|
||||
if (!array_key_exists($behaviour, $behaviours)) {
|
||||
$counts['missingtype'] += $count;
|
||||
$counts['missing'] += $count;
|
||||
}
|
||||
}
|
||||
$needed['missing'] = true;
|
||||
|
||||
// Work of the correct sort order.
|
||||
$config = get_config('question');
|
||||
@@ -179,7 +179,7 @@ if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey())
|
||||
unset($disabledbehaviours[$key]);
|
||||
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
|
||||
}
|
||||
$behaviourorder = explode(',', $config->behavioursortorder);
|
||||
$behaviourorder = array_keys($sortedbehaviours);
|
||||
if (($key = array_search($delete, $behaviourorder)) !== false) {
|
||||
unset($behaviourorder[$key]);
|
||||
set_config('behavioursortorder', implode(',', $behaviourorder), 'question');
|
||||
@@ -248,7 +248,7 @@ foreach ($sortedbehaviours as $behaviour => $behaviourname) {
|
||||
$row[] = '';
|
||||
}
|
||||
|
||||
// Are people allowed to create new questions of this type?
|
||||
// Are people allowed to select this behaviour?
|
||||
$rowclass = '';
|
||||
if ($archetypal[$behaviour]) {
|
||||
$enabled = array_search($behaviour, $disabledbehaviours) === false;
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ foreach ($sortedqtypes as $qtypename => $localname) {
|
||||
$strcount = $counts[$qtypename]->numquestions;
|
||||
}
|
||||
if ($canviewreports) {
|
||||
$row[] = html_writer::link(new moodle_url('/admin/report/questioninstances/index.php',
|
||||
$row[] = html_writer::link(new moodle_url('/report/questioninstances/index.php',
|
||||
array('qtype' => $qtypename)), $strcount, array('title' => get_string('showdetails', 'admin')));
|
||||
} else {
|
||||
$strcount;
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->maturity_info($maturity);
|
||||
$output .= $this->insecure_dataroot_warning($insecuredataroot);
|
||||
$output .= $this->display_errors_warning($errorsdisplayed);
|
||||
$output .= $this->cron_overdue_warning($errorsdisplayed);
|
||||
$output .= $this->cron_overdue_warning($cronoverdue);
|
||||
$output .= $this->db_problems($dbproblems);
|
||||
$output .= $this->maintenance_mode_warning($maintenancemode);
|
||||
|
||||
|
||||
@@ -67,6 +67,26 @@ if (optional_param('add', false, PARAM_BOOL) and confirm_sesskey()) {
|
||||
}
|
||||
}
|
||||
|
||||
} else if (optional_param('main', false, PARAM_BOOL) and confirm_sesskey()) {
|
||||
if ($newmain = $admisselector->get_selected_users()) {
|
||||
$newmain = reset($newmain);
|
||||
$newmain = $newmain->id;
|
||||
$admins = array();
|
||||
foreach(explode(',', $CFG->siteadmins) as $admin) {
|
||||
$admin = (int)$admin;
|
||||
if ($admin) {
|
||||
$admins[$admin] = $admin;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($admins[$newmain])) {
|
||||
unset($admins[$newmain]);
|
||||
array_unshift($admins, $newmain);
|
||||
set_config('siteadmins', implode(',', $admins));
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
|
||||
} else if ($confirmadd and confirm_sesskey()) {
|
||||
$admins = array();
|
||||
foreach(explode(',', $CFG->siteadmins) as $admin) {
|
||||
@@ -115,6 +135,7 @@ echo $OUTPUT->header();
|
||||
<p class="arrow_button">
|
||||
<input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$OUTPUT->rarrow(); ?>" title="<?php print_string('remove'); ?>" />
|
||||
<input name="main" id="main" type="submit" value="<?php echo get_string('mainadminset', 'role'); ?>" title="<?php print_string('mainadminset', 'role'); ?>" />
|
||||
</p>
|
||||
</td>
|
||||
<td id='potentialcell'>
|
||||
|
||||
+23
-5
@@ -1584,13 +1584,31 @@ class admins_existing_selector extends user_selector_base {
|
||||
return array();
|
||||
}
|
||||
|
||||
if ($search) {
|
||||
$groupname = get_string('extusersmatching', 'role', $search);
|
||||
} else {
|
||||
$groupname = get_string('extusers', 'role');
|
||||
$mainadmin = array();
|
||||
$adminids = explode(',', $CFG->siteadmins);
|
||||
foreach ($adminids as $id) {
|
||||
if (isset($availableusers[$id])) {
|
||||
$mainadmin = array($id=>$availableusers[$id]);
|
||||
unset($availableusers[$id]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return array($groupname => $availableusers);
|
||||
$result = array();
|
||||
if ($mainadmin) {
|
||||
$result[get_string('mainadmin', 'role')] = $mainadmin;
|
||||
}
|
||||
|
||||
if ($availableusers) {
|
||||
if ($search) {
|
||||
$groupname = get_string('extusersmatching', 'role', $search);
|
||||
} else {
|
||||
$groupname = get_string('extusers', 'role');
|
||||
}
|
||||
$result[$groupname] = $availableusers;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function get_options() {
|
||||
|
||||
+1
-1
@@ -98,13 +98,13 @@ if (empty($SITE->fullname)) {
|
||||
$url->param('adminedit', 'on');
|
||||
}
|
||||
$buttons = $OUTPUT->single_button($url, $caption, 'get');
|
||||
$PAGE->set_button($buttons);
|
||||
}
|
||||
|
||||
$visiblepathtosection = array_reverse($settingspage->visiblepath);
|
||||
|
||||
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
$PAGE->set_button($buttons);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($errormsg !== '') {
|
||||
|
||||
@@ -22,6 +22,9 @@ if (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode !== 'off')
|
||||
|
||||
$hosts = mnet_get_hosts();
|
||||
foreach ($hosts as $host) {
|
||||
if ($host->id == $CFG->mnet_all_hosts_id) {
|
||||
$host->name = get_string('allhosts', 'core_mnet');
|
||||
}
|
||||
$ADMIN->add('mnetpeercat',
|
||||
new admin_externalpage(
|
||||
'mnetpeer' . $host->id,
|
||||
|
||||
@@ -16,6 +16,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', get_string('forceloginforprofileimage', 'admin'), get_string('forceloginforprofileimage_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
|
||||
$temp->add(new admin_setting_pickroles('profileroles',
|
||||
get_string('profileroles','admin'),
|
||||
@@ -81,6 +82,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('cookiesecure', get_string('cookiesecure', 'admin'), get_string('configcookiesecure', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiehttponly', get_string('cookiehttponly', 'admin'), get_string('configcookiehttponly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowframembedding', get_string('allowframembedding', 'admin'), get_string('allowframembedding_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', get_string('loginpasswordautocomplete', 'admin'), get_string('loginpasswordautocomplete_help', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
@@ -127,7 +127,9 @@ if ($hassiteconfig
|
||||
'firstaccess' => get_string('firstaccess'),
|
||||
'lastaccess' => get_string('lastaccess'),
|
||||
'mycourses' => get_string('mycourses'),
|
||||
'groups' => get_string('groups'))));
|
||||
'groups' => get_string('groups'),
|
||||
'suspended' => get_string('suspended', 'auth'),
|
||||
)));
|
||||
|
||||
// Select fields to display as part of user identity (only to those
|
||||
// with moodle/site:viewuseridentity).
|
||||
|
||||
@@ -29,7 +29,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ class database_transfer_form extends moodleform {
|
||||
$mform->addElement('text', 'dbuser', get_string('user'));
|
||||
$mform->addElement('text', 'dbpass', get_string('password'));
|
||||
$mform->addElement('text', 'prefix', get_string('dbprefix', 'install'));
|
||||
$mform->addElement('text', 'dbport', get_string('dbport', 'install'));
|
||||
$mform->addElement('text', 'dbsocket', get_string('databasesocket', 'install'));
|
||||
|
||||
$mform->addRule('dbhost', get_string('required'), 'required', null);
|
||||
$mform->addRule('dbname', get_string('required'), 'required', null);
|
||||
|
||||
@@ -40,7 +40,14 @@ if ($data = $form->get_data()) {
|
||||
// Connect to the other database.
|
||||
list($dbtype, $dblibrary) = explode('/', $data->driver);
|
||||
$targetdb = moodle_database::get_driver_instance($dbtype, $dblibrary);
|
||||
if (!$targetdb->connect($data->dbhost, $data->dbuser, $data->dbpass, $data->dbname, $data->prefix, null)) {
|
||||
$dboptions = array();
|
||||
if ($data->dbport) {
|
||||
$dboptions['dbport'] = $data->dbport;
|
||||
}
|
||||
if ($data->dbsocket) {
|
||||
$dboptions['dbsocket'] = $data->dbsocket;
|
||||
}
|
||||
if (!$targetdb->connect($data->dbhost, $data->dbuser, $data->dbpass, $data->dbname, $data->prefix, $dboptions)) {
|
||||
throw new dbtransfer_exception('notargetconectexception', null, "$CFG->wwwroot/$CFG->admin/tool/dbtransfer/");
|
||||
}
|
||||
if ($targetdb->get_tables()) {
|
||||
|
||||
@@ -25,13 +25,7 @@
|
||||
|
||||
ob_start(); //for whitespace test
|
||||
require('../../../config.php');
|
||||
|
||||
// extra whitespace test - intentionally breaks cookieless mode
|
||||
$extraws = '';
|
||||
while (ob_get_level()) {
|
||||
$extraws .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
$extraws = ob_get_clean();
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ abstract class tool_qeupgradehelper_quiz_list {
|
||||
html_writer::link(new moodle_url('/course/view.php',
|
||||
array('id' => $quizinfo->courseid)), format_string($quizinfo->shortname)),
|
||||
html_writer::link(new moodle_url('/mod/quiz/view.php',
|
||||
array('id' => $quizinfo->name)), format_string($quizinfo->name)),
|
||||
array('q' => $quizinfo->id)), format_string($quizinfo->name)),
|
||||
$quizinfo->attemptcount,
|
||||
$quizinfo->questionattempts ? $quizinfo->questionattempts : 0,
|
||||
);
|
||||
|
||||
@@ -157,21 +157,54 @@ function search_spammers($keywords) {
|
||||
$params['descpat'.$i] = "%$keyword%";
|
||||
$keywordfull2[] = $DB->sql_like('p.summary', ':sumpat'.$i, false);
|
||||
$params['sumpat'.$i] = "%$keyword%";
|
||||
$keywordfull3[] = $DB->sql_like('p.subject', ':subpat'.$i, false);
|
||||
$params['subpat'.$i] = "%$keyword%";
|
||||
$keywordfull4[] = $DB->sql_like('c.content', ':contpat'.$i, false);
|
||||
$params['contpat'.$i] = "%$keyword%";
|
||||
$keywordfull5[] = $DB->sql_like('m.fullmessage', ':msgpat'.$i, false);
|
||||
$params['msgpat'.$i] = "%$keyword%";
|
||||
$keywordfull6[] = $DB->sql_like('fp.message', ':forumpostpat'.$i, false);
|
||||
$params['forumpostpat'.$i] = "%$keyword%";
|
||||
$keywordfull7[] = $DB->sql_like('fp.subject', ':forumpostsubpat'.$i, false);
|
||||
$params['forumpostsubpat'.$i] = "%$keyword%";
|
||||
$i++;
|
||||
}
|
||||
$conditions = '( '.implode(' OR ', $keywordfull).' )';
|
||||
$conditions2 = '( '.implode(' OR ', $keywordfull2).' )';
|
||||
$conditions3 = '( '.implode(' OR ', $keywordfull3).' )';
|
||||
$conditions4 = '( '.implode(' OR ', $keywordfull4).' )';
|
||||
$conditions5 = '( '.implode(' OR ', $keywordfull5).' )';
|
||||
$conditions6 = '( '.implode(' OR ', $keywordfull6).' )';
|
||||
$conditions7 = '( '.implode(' OR ', $keywordfull7).' )';
|
||||
|
||||
$sql = "SELECT * FROM {user} WHERE deleted = 0 AND id <> :userid AND $conditions"; // Exclude oneself
|
||||
$sql2 = "SELECT u.*, p.summary FROM {user} AS u, {post} AS p WHERE $conditions2 AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
|
||||
$sql3 = "SELECT u.*, p.subject as postsubject FROM {user} AS u, {post} AS p WHERE $conditions3 AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
|
||||
$sql4 = "SELECT u.*, c.content FROM {user} AS u, {comments} AS c WHERE $conditions4 AND u.deleted = 0 AND u.id=c.userid AND u.id <> :userid";
|
||||
$sql5 = "SELECT u.*, m.fullmessage FROM {user} AS u, {message} AS m WHERE $conditions5 AND u.deleted = 0 AND u.id=m.useridfrom AND u.id <> :userid";
|
||||
$sql6 = "SELECT u.*, fp.message FROM {user} AS u, {forum_posts} AS fp WHERE $conditions6 AND u.deleted = 0 AND u.id=fp.userid AND u.id <> :userid";
|
||||
$sql7 = "SELECT u.*, fp.subject FROM {user} AS u, {forum_posts} AS fp WHERE $conditions7 AND u.deleted = 0 AND u.id=fp.userid AND u.id <> :userid";
|
||||
|
||||
$spamusers_desc = $DB->get_recordset_sql($sql, $params);
|
||||
$spamusers_blog = $DB->get_recordset_sql($sql2, $params);
|
||||
$spamusers_blogsub = $DB->get_recordset_sql($sql3, $params);
|
||||
$spamusers_comment = $DB->get_recordset_sql($sql4, $params);
|
||||
$spamusers_message = $DB->get_recordset_sql($sql5, $params);
|
||||
$spamusers_forumpost = $DB->get_recordset_sql($sql6, $params);
|
||||
$spamusers_forumpostsub = $DB->get_recordset_sql($sql7, $params);
|
||||
|
||||
$keywordlist = implode(', ', $keywords);
|
||||
echo $OUTPUT->box(get_string('spamresult', 'tool_spamcleaner').s($keywordlist)).' ...';
|
||||
|
||||
print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
|
||||
|
||||
print_user_list(array($spamusers_desc,
|
||||
$spamusers_blog,
|
||||
$spamusers_blogsub,
|
||||
$spamusers_comment,
|
||||
$spamusers_message,
|
||||
$spamusers_forumpost,
|
||||
$spamusers_forumpostsub
|
||||
),
|
||||
$keywords);
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +245,23 @@ function filter_user($user, $keywords, $count) {
|
||||
if (isset($user->summary)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'tool_spamcleaner').'</h3>'.$user->summary;
|
||||
unset($user->summary);
|
||||
} else if (isset($user->postsubject)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'tool_spamcleaner').'</h3>'.$user->postsubject;
|
||||
unset($user->postsubject);
|
||||
} else if (isset($user->content)) {
|
||||
$user->description = '<h3>'.get_string('spamfromcomments', 'tool_spamcleaner').'</h3>'.$user->content;
|
||||
unset($user->content);
|
||||
} else if (isset($user->fullmessage)) {
|
||||
$user->description = '<h3>'.get_string('spamfrommessages', 'tool_spamcleaner').'</h3>'.$user->fullmessage;
|
||||
unset($user->fullmessage);
|
||||
} else if (isset($user->message)) {
|
||||
$user->description = '<h3>'.get_string('spamfromforumpost', 'tool_spamcleaner').'</h3>'.$user->message;
|
||||
unset($user->message);
|
||||
} else if (isset($user->subject)) {
|
||||
$user->description = '<h3>'.get_string('spamfromforumpost', 'tool_spamcleaner').'</h3>'.$user->subject;
|
||||
unset($user->subject);
|
||||
}
|
||||
|
||||
if (preg_match('#<img.*src=[\"\']('.$CFG->wwwroot.')#', $user->description, $matches)
|
||||
&& $image_search) {
|
||||
$result = false;
|
||||
|
||||
@@ -34,6 +34,9 @@ $string['spamdeleteconfirm'] = 'Are you sure you want to delete this entry? You
|
||||
$string['spamdesc'] = 'Description';
|
||||
$string['spameg'] = 'eg: casino, porn, xxx';
|
||||
$string['spamfromblog'] = 'From blog post:';
|
||||
$string['spamfromcomments'] = 'From comments:';
|
||||
$string['spamfrommessages'] = 'From messages:';
|
||||
$string['spamfromforumpost'] = 'From forum post:';
|
||||
$string['spaminvalidresult'] = 'Unknown but invalid result';
|
||||
$string['spamoperation'] = 'Operation';
|
||||
$string['spamresult'] = 'Results of searching user profiles containing:';
|
||||
|
||||
+99
-51
@@ -14,7 +14,8 @@
|
||||
$ru = optional_param('ru', '2', PARAM_INT); // show remote users
|
||||
$lu = optional_param('lu', '2', PARAM_INT); // show local users
|
||||
$acl = optional_param('acl', '0', PARAM_INT); // id of user to tweak mnet ACL (requires $access)
|
||||
|
||||
$suspend = optional_param('suspend', 0, PARAM_INT);
|
||||
$unsuspend = optional_param('unsuspend', 0, PARAM_INT);
|
||||
|
||||
admin_externalpage_setup('editusers');
|
||||
|
||||
@@ -29,6 +30,9 @@
|
||||
$strdelete = get_string('delete');
|
||||
$strdeletecheck = get_string('deletecheck');
|
||||
$strshowallusers = get_string('showallusers');
|
||||
$strsuspend = get_string('suspenduser', 'admin');
|
||||
$strunsuspend = get_string('unsuspenduser', 'admin');
|
||||
$strconfirm = get_string('confirm');
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
@@ -36,10 +40,11 @@
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/user.php";
|
||||
$returnurl = new moodle_url('/admin/user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage, 'page'=>$page));
|
||||
|
||||
if ($confirmuser and confirm_sesskey()) {
|
||||
if (!$user = $DB->get_record('user', array('id'=>$confirmuser))) {
|
||||
require_capability('moodle/user:update', $sitecontext);
|
||||
if (!$user = $DB->get_record('user', array('id'=>$confirmuser, 'mnethostid'=>$CFG->mnet_localhost_id))) {
|
||||
print_error('nousers');
|
||||
}
|
||||
|
||||
@@ -55,10 +60,9 @@
|
||||
}
|
||||
|
||||
} else if ($delete and confirm_sesskey()) { // Delete a selected user, after confirmation
|
||||
|
||||
require_capability('moodle/user:delete', $sitecontext);
|
||||
|
||||
$user = $DB->get_record('user', array('id'=>$delete), '*', MUST_EXIST);
|
||||
$user = $DB->get_record('user', array('id'=>$delete, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
|
||||
|
||||
if (is_siteadmin($user->id)) {
|
||||
print_error('useradminodelete', 'error');
|
||||
@@ -69,7 +73,7 @@
|
||||
$fullname = fullname($user, true);
|
||||
echo $OUTPUT->heading(get_string('deleteuser', 'admin'));
|
||||
$optionsyes = array('delete'=>$delete, 'confirm'=>md5($delete), 'sesskey'=>sesskey());
|
||||
echo $OUTPUT->confirm(get_string('deletecheckfull', '', "'$fullname'"), new moodle_url('user.php', $optionsyes), 'user.php');
|
||||
echo $OUTPUT->confirm(get_string('deletecheckfull', '', "'$fullname'"), new moodle_url($returnurl, $optionsyes), $returnurl);
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
} else if (data_submitted() and !$user->deleted) {
|
||||
@@ -83,8 +87,7 @@
|
||||
}
|
||||
}
|
||||
} else if ($acl and confirm_sesskey()) {
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
// TODO: this should be under a separate capability
|
||||
if (!has_capability('moodle/user:update', $sitecontext)) {
|
||||
print_error('nopermissions', 'error', '', 'modify the NMET access control list');
|
||||
}
|
||||
if (!$user = $DB->get_record('user', array('id'=>$acl))) {
|
||||
@@ -110,6 +113,36 @@
|
||||
}
|
||||
$mnethosts = $DB->get_records('mnet_host', null, 'id', 'id,wwwroot,name');
|
||||
redirect($returnurl);
|
||||
|
||||
} else if ($suspend and confirm_sesskey()) {
|
||||
require_capability('moodle/user:update', $sitecontext);
|
||||
|
||||
if ($user = $DB->get_record('user', array('id'=>$suspend, 'mnethostid'=>$CFG->mnet_localhost_id, 'deleted'=>0))) {
|
||||
if (!is_siteadmin($user) and $USER->id != $user->id and $user->suspended != 1) {
|
||||
$user->suspended = 1;
|
||||
$user->timemodified = time();
|
||||
$DB->set_field('user', 'suspended', $user->suspended, array('id'=>$user->id));
|
||||
$DB->set_field('user', 'timemodified', $user->timemodified, array('id'=>$user->id));
|
||||
// force logout
|
||||
session_kill_user($user->id);
|
||||
events_trigger('user_updated', $user);
|
||||
}
|
||||
}
|
||||
redirect($returnurl);
|
||||
|
||||
} else if ($unsuspend and confirm_sesskey()) {
|
||||
require_capability('moodle/user:update', $sitecontext);
|
||||
|
||||
if ($user = $DB->get_record('user', array('id'=>$unsuspend, 'mnethostid'=>$CFG->mnet_localhost_id, 'deleted'=>0))) {
|
||||
if ($user->suspended != 0) {
|
||||
$user->suspended = 0;
|
||||
$user->timemodified = time();
|
||||
$DB->set_field('user', 'suspended', $user->suspended, array('id'=>$user->id));
|
||||
$DB->set_field('user', 'timemodified', $user->timemodified, array('id'=>$user->id));
|
||||
events_trigger('user_updated', $user);
|
||||
}
|
||||
}
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
// create the user filter form
|
||||
@@ -163,7 +196,7 @@
|
||||
|
||||
$strall = get_string('all');
|
||||
|
||||
$baseurl = new moodle_url('user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
|
||||
$baseurl = new moodle_url('/admin/user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
|
||||
echo $OUTPUT->paging_bar($usercount, $page, $perpage, $baseurl);
|
||||
|
||||
flush();
|
||||
@@ -225,9 +258,7 @@
|
||||
$table->align[] = 'left';
|
||||
$table->head[] = $lastaccess;
|
||||
$table->align[] = 'left';
|
||||
$table->head[] = "";
|
||||
$table->align[] = 'center';
|
||||
$table->head[] = "";
|
||||
$table->head[] = get_string('edit');
|
||||
$table->align[] = 'center';
|
||||
$table->head[] = "";
|
||||
$table->align[] = 'center';
|
||||
@@ -238,52 +269,65 @@
|
||||
continue; // do not display guest here
|
||||
}
|
||||
|
||||
if ($user->id == $USER->id or is_siteadmin($user)) {
|
||||
$deletebutton = "";
|
||||
} else {
|
||||
if (has_capability('moodle/user:delete', $sitecontext)) {
|
||||
$deletebutton = "<a href=\"user.php?delete=$user->id&sesskey=".sesskey()."\">$strdelete</a>";
|
||||
$buttons = array();
|
||||
$lastcolumn = '';
|
||||
|
||||
// delete button
|
||||
if (has_capability('moodle/user:delete', $sitecontext)) {
|
||||
if (is_mnet_remote_user($user) or $user->id == $USER->id or is_siteadmin($user)) {
|
||||
// no deleting of self, mnet accounts or admins allowed
|
||||
} else {
|
||||
$deletebutton ="";
|
||||
$buttons[] = html_writer::link(new moodle_url($returnurl, array('delete'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/delete'), 'alt'=>$strdelete, 'class'=>'iconsmall')), array('title'=>$strdelete));
|
||||
}
|
||||
}
|
||||
|
||||
if (has_capability('moodle/user:update', $sitecontext) and (is_siteadmin($USER) or !is_siteadmin($user)) and !is_mnet_remote_user($user)) {
|
||||
$editbutton = "<a href=\"$securewwwroot/user/editadvanced.php?id=$user->id&course=$site->id\">$stredit</a>";
|
||||
if ($user->confirmed == 0) {
|
||||
$confirmbutton = "<a href=\"user.php?confirmuser=$user->id&sesskey=".sesskey()."\">" . get_string('confirm') . "</a>";
|
||||
// suspend button
|
||||
if (has_capability('moodle/user:update', $sitecontext)) {
|
||||
if (is_mnet_remote_user($user)) {
|
||||
// mnet users have special access control, they can not be deleted the standard way or suspended
|
||||
$accessctrl = 'allow';
|
||||
if ($acl = $DB->get_record('mnet_sso_access_control', array('username'=>$user->username, 'mnet_host_id'=>$user->mnethostid))) {
|
||||
$accessctrl = $acl->accessctrl;
|
||||
}
|
||||
$changeaccessto = ($accessctrl == 'deny' ? 'allow' : 'deny');
|
||||
$buttons[] = " (<a href=\"?acl={$user->id}&accessctrl=$changeaccessto&sesskey=".sesskey()."\">".get_string($changeaccessto, 'mnet') . " access</a>)";
|
||||
|
||||
} else {
|
||||
$confirmbutton = "";
|
||||
}
|
||||
} else {
|
||||
$editbutton ="";
|
||||
if ($user->confirmed == 0) {
|
||||
$confirmbutton = "<span class=\"dimmed_text\">".get_string('confirm')."</span>";
|
||||
} else {
|
||||
$confirmbutton = "";
|
||||
if ($user->suspended) {
|
||||
$buttons[] = html_writer::link(new moodle_url($returnurl, array('unsuspend'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/show'), 'alt'=>$strunsuspend, 'class'=>'iconsmall')), array('title'=>$strunsuspend));
|
||||
} else {
|
||||
if ($user->id == $USER->id or is_siteadmin($user)) {
|
||||
// no suspending of admins or self!
|
||||
} else {
|
||||
$buttons[] = html_writer::link(new moodle_url($returnurl, array('suspend'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/hide'), 'alt'=>$strsuspend, 'class'=>'iconsmall')), array('title'=>$strsuspend));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// for remote users, shuffle columns around and display MNET stuff
|
||||
// edit button
|
||||
if (has_capability('moodle/user:update', $sitecontext)) {
|
||||
// prevent editing of admins by non-admins
|
||||
if (is_siteadmin($USER) or !is_siteadmin($user)) {
|
||||
$buttons[] = html_writer::link(new moodle_url($securewwwroot.'/user/editadvanced.php', array('id'=>$user->id, 'course'=>$site->id)), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/edit'), 'alt'=>$stredit, 'class'=>'iconsmall')), array('title'=>$stredit));
|
||||
}
|
||||
}
|
||||
|
||||
// the last column - confirm or mnet info
|
||||
if (is_mnet_remote_user($user)) {
|
||||
$accessctrl = 'allow';
|
||||
if ($acl = $DB->get_record('mnet_sso_access_control', array('username'=>$user->username, 'mnet_host_id'=>$user->mnethostid))) {
|
||||
$accessctrl = $acl->accessctrl;
|
||||
}
|
||||
$changeaccessto = ($accessctrl == 'deny' ? 'allow' : 'deny');
|
||||
// delete button in confirm column - remote users should already be confirmed
|
||||
// TODO: no delete for remote users, for now. new userid, delete flag, unique on username/host...
|
||||
$confirmbutton = "";
|
||||
// ACL in delete column
|
||||
$deletebutton = get_string($accessctrl, 'mnet');
|
||||
if (has_capability('moodle/user:delete', $sitecontext)) {
|
||||
// TODO: this should be under a separate capability
|
||||
$deletebutton .= " (<a href=\"?acl={$user->id}&accessctrl=$changeaccessto&sesskey=".sesskey()."\">"
|
||||
. get_string($changeaccessto, 'mnet') . " access</a>)";
|
||||
}
|
||||
// mnet info in edit column
|
||||
// all mnet users are confirmed, let's print just the name of the host there
|
||||
if (isset($mnethosts[$user->mnethostid])) {
|
||||
$editbutton = $mnethosts[$user->mnethostid]->name;
|
||||
$lastcolumn = get_string($accessctrl, 'mnet').': '.$mnethosts[$user->mnethostid]->name;
|
||||
} else {
|
||||
$lastcolumn = get_string($accessctrl, 'mnet');
|
||||
}
|
||||
|
||||
} else if ($user->confirmed == 0) {
|
||||
if (has_capability('moodle/user:update', $sitecontext)) {
|
||||
$lastcolumn = html_writer::link(new moodle_url($returnurl, array('confirmuser'=>$user->id, 'sesskey'=>sesskey())), $strconfirm);
|
||||
} else {
|
||||
$lastcolumn = "<span class=\"dimmed_text\">".get_string('confirm')."</span>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,9 +346,13 @@
|
||||
$row[] = $user->city;
|
||||
$row[] = $user->country;
|
||||
$row[] = $strlastaccess;
|
||||
$row[] = $editbutton;
|
||||
$row[] = $deletebutton;
|
||||
$row[] = $confirmbutton;
|
||||
if ($user->suspended) {
|
||||
foreach ($row as $k=>$v) {
|
||||
$row[$k] = html_writer::tag('span', $v, array('class'=>'usersuspended'));
|
||||
}
|
||||
}
|
||||
$row[] = implode(' ', $buttons);
|
||||
$row[] = $lastcolumn;
|
||||
$table->data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
+59
-11
@@ -179,7 +179,7 @@ class external_service_functions_form extends moodleform {
|
||||
class web_service_token_form extends moodleform {
|
||||
|
||||
function definition() {
|
||||
global $USER, $DB;
|
||||
global $USER, $DB, $CFG;
|
||||
|
||||
$mform = $this->_form;
|
||||
$data = $this->_customdata;
|
||||
@@ -187,16 +187,28 @@ class web_service_token_form extends moodleform {
|
||||
$mform->addElement('header', 'token', get_string('token', 'webservice'));
|
||||
|
||||
if (empty($data->nouserselection)) {
|
||||
//user searchable selector - get all users (admin and guest included)
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname
|
||||
FROM {user} u
|
||||
ORDER BY u.lastname";
|
||||
$users = $DB->get_records_sql($sql, array());
|
||||
$options = array();
|
||||
foreach ($users as $userid => $user) {
|
||||
$options[$userid] = $user->firstname . " " . $user->lastname;
|
||||
|
||||
//check if the number of user is reasonable to be displayed in a select box
|
||||
$usertotal = $DB->count_records('user',
|
||||
array('deleted' => 0, 'suspended' => 0, 'confirmed' => 1));
|
||||
|
||||
if ($usertotal < 500) {
|
||||
//user searchable selector - get all users (admin and guest included)
|
||||
//user must be confirmed, not deleted, not suspended, not guest
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname
|
||||
FROM {user} u
|
||||
WHERE u.deleted = 0 AND u.confirmed = 1 AND u.suspended = 0 AND u.id != ?
|
||||
ORDER BY u.lastname";
|
||||
$users = $DB->get_records_sql($sql, array($CFG->siteguest));
|
||||
$options = array();
|
||||
foreach ($users as $userid => $user) {
|
||||
$options[$userid] = $user->firstname . " " . $user->lastname;
|
||||
}
|
||||
$mform->addElement('searchableselector', 'user', get_string('user'), $options);
|
||||
} else {
|
||||
//simple text box for username or user id (if two username exists, a form error is displayed)
|
||||
$mform->addElement('text', 'user', get_string('usernameorid', 'webservice'));
|
||||
}
|
||||
$mform->addElement('searchableselector', 'user', get_string('user'), $options);
|
||||
$mform->addRule('user', get_string('required'), 'required', null, 'client');
|
||||
}
|
||||
|
||||
@@ -230,8 +242,44 @@ class web_service_token_form extends moodleform {
|
||||
$this->set_data($data);
|
||||
}
|
||||
|
||||
function validation($data, $files) {
|
||||
function get_data() {
|
||||
global $DB;
|
||||
$data = parent::get_data();
|
||||
|
||||
if (!empty($data) && !is_numeric($data->user)) {
|
||||
//retrieve username
|
||||
$user = $DB->get_record('user', array('username' => $data->user), 'id');
|
||||
$data->user = $user->id;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function validation(&$data, $files) {
|
||||
global $DB;
|
||||
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
if (is_numeric($data['user'])) {
|
||||
$searchtype = 'id';
|
||||
} else {
|
||||
$searchtype = 'username';
|
||||
//check the username is valid
|
||||
if (clean_param($data['user'], PARAM_USERNAME) != $data['user']) {
|
||||
$errors['user'] = get_string('invalidusername');
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($errors['user'])) {
|
||||
$users = $DB->get_records('user', array($searchtype => $data['user']), '', 'id');
|
||||
|
||||
//check that the user exists in the database
|
||||
if (count($users) == 0) {
|
||||
$errors['user'] = get_string('usernameoridnousererror', 'webservice');
|
||||
} else if (count($users) > 1) { //can only be a username search as id are unique
|
||||
$errors['user'] = get_string('usernameoridoccurenceerror', 'webservice');
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,12 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
|
||||
//check if the user is deleted. unconfirmed, suspended or guest
|
||||
$user = $DB->get_record('user', array('id' => $data->user));
|
||||
if ($user->id == $CFG->siteguest or $user->deleted or !$user->confirmed or $user->suspended) {
|
||||
throw new moodle_exception('forbiddenwsuser', 'webservice');
|
||||
}
|
||||
|
||||
//process the creation
|
||||
if (empty($errormsg)) {
|
||||
//TODO improvement: either move this function from externallib.php to webservice/lib.php
|
||||
|
||||
@@ -520,7 +520,7 @@ $yesno = array(get_string('no'), get_string('yes'));
|
||||
<?php echo html_writer::select($yesno, 'ntlmsso_ie_fastpath', $config->ntlmsso_ie_fastpath, false); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
|
||||
<?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
|
||||
@@ -48,5 +48,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,5 +46,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -278,8 +278,8 @@ just before the <MetadataProvider> element.
|
||||
|
||||
--
|
||||
<Notify
|
||||
Channel="back"
|
||||
Location="https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php" />
|
||||
Channel="back"
|
||||
Location="https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php" />
|
||||
--
|
||||
|
||||
Then restart the Shibboleth daemon and check the log file for errors. If there
|
||||
@@ -300,9 +300,9 @@ Requirements:
|
||||
|
||||
--
|
||||
<Directory /path/to/moodle/auth/shibboleth/logout.php>
|
||||
AuthType shibboleth
|
||||
ShibRequireSession Off
|
||||
require shibboleth
|
||||
AuthType shibboleth
|
||||
ShibRequireSession Off
|
||||
require shibboleth
|
||||
</Directory>
|
||||
--
|
||||
When using IIS, the same can be achieved by something like:
|
||||
|
||||
@@ -42,12 +42,12 @@ $PAGE->https_required();
|
||||
set_saml_cookie($selectedIdP);
|
||||
|
||||
// Redirect to SessionInitiator with entityID as argument
|
||||
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])){
|
||||
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])) {
|
||||
// For Shibbolet 1.x Service Providers
|
||||
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
|
||||
// For Shibbolet 2.x Service Providers
|
||||
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
// For Shibbolet 2.x Service Providers
|
||||
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
|
||||
} else {
|
||||
// For Shibbolet 1.x Service Providers
|
||||
|
||||
@@ -379,7 +379,7 @@ class cc2moodle {
|
||||
if (!empty($CFG->defaultblocks)) {
|
||||
$blocknames = $CFG->defaultblocks;
|
||||
} else {
|
||||
$blocknames = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
$blocknames = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,9 +208,8 @@ class entities {
|
||||
if (!empty($files)) {
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
||||
$source = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $file->nodeValue;
|
||||
$destination = $destination_folder . DIRECTORY_SEPARATOR . $file->nodeValue;
|
||||
$source = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $file;
|
||||
$destination = $destination_folder . DIRECTORY_SEPARATOR . $file;
|
||||
|
||||
$destination_directory = dirname($destination);
|
||||
|
||||
@@ -251,10 +250,9 @@ class entities {
|
||||
if (in_array($ext, array('html', 'htm', 'xhtml'))) {
|
||||
continue;
|
||||
}
|
||||
$all_files[] = $file;
|
||||
$all_files[] = $file->nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
unset($files);
|
||||
}
|
||||
|
||||
@@ -264,8 +262,8 @@ class entities {
|
||||
if (!empty($labels) && ($labels->length > 0)) {
|
||||
$tname = 'course_files';
|
||||
$dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname;
|
||||
$fpath = $dpath . DIRECTORY_SEPARATOR . 'folder.gif';
|
||||
$rfpath = $tname.'/folder.gif';
|
||||
$rfpath = 'folder.gif';
|
||||
$fpath = $dpath . DIRECTORY_SEPARATOR . $rfpath;
|
||||
|
||||
if (!file_exists($dpath)) {
|
||||
mkdir($dpath);
|
||||
|
||||
@@ -51,7 +51,7 @@ class entities11 extends entities {
|
||||
if (in_array($ext, array('html', 'htm', 'xhtml'))) {
|
||||
continue;
|
||||
}
|
||||
$all_files[] = $file;
|
||||
$all_files[] = $file->nodeValue;
|
||||
}
|
||||
unset($files);
|
||||
}
|
||||
@@ -62,8 +62,8 @@ class entities11 extends entities {
|
||||
if (!empty($labels) && ($labels->length > 0)) {
|
||||
$tname = 'course_files';
|
||||
$dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname;
|
||||
$rfpath = 'folder.gif';
|
||||
$fpath = $dpath . DIRECTORY_SEPARATOR . 'folder.gif';
|
||||
$rfpath = $tname.'/folder.gif';
|
||||
if (!file_exists($dpath)) {
|
||||
mkdir($dpath);
|
||||
}
|
||||
|
||||
@@ -276,6 +276,7 @@ class cc_quiz extends entities {
|
||||
'[#question_text#]',
|
||||
'[#question_type#]',
|
||||
'[#question_general_feedback#]',
|
||||
'[#question_defaultgrade#]',
|
||||
'[#date_now#]',
|
||||
'[#question_type_nodes#]',
|
||||
'[#question_stamp#]',
|
||||
@@ -308,6 +309,7 @@ class cc_quiz extends entities {
|
||||
self::safexml($question['title']),
|
||||
$question_moodle_type,
|
||||
self::safexml($question['feedback']),
|
||||
$question['defaultgrade'], //default grade
|
||||
time(),
|
||||
$question_type_node,
|
||||
$quiz_stamp,
|
||||
@@ -368,6 +370,7 @@ class cc_quiz extends entities {
|
||||
$questions[$question_identifier]['moodle_type'] = $question_type['moodle'];
|
||||
$questions[$question_identifier]['cc_type'] = $question_type['cc'];
|
||||
$questions[$question_identifier]['feedback'] = $this->get_general_feedback($assessment, $question_identifier);
|
||||
$questions[$question_identifier]['defaultgrade'] = $this->get_defaultgrade($assessment, $question_identifier);
|
||||
$questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id);
|
||||
|
||||
}
|
||||
@@ -395,6 +398,21 @@ class cc_quiz extends entities {
|
||||
}
|
||||
}
|
||||
|
||||
private function get_defaultgrade($assessment, $question_identifier) {
|
||||
$result = 1;
|
||||
$xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns());
|
||||
$query = '//xmlns:item[@ident="' . $question_identifier . '"]';
|
||||
$query .= '//xmlns:qtimetadatafield[xmlns:fieldlabel="cc_weighting"]/xmlns:fieldentry';
|
||||
$defgrade = $xpath->query($query);
|
||||
if (!empty($defgrade) && ($defgrade->length > 0)) {
|
||||
$resp = (int)$defgrade->item(0)->nodeValue;
|
||||
if ($resp >= 0 && $resp <= 99) {
|
||||
$result = $resp;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function get_general_feedback ($assessment, $question_identifier) {
|
||||
|
||||
$xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns());
|
||||
|
||||
@@ -276,6 +276,7 @@ class cc11_quiz extends entities11 {
|
||||
'[#question_text#]',
|
||||
'[#question_type#]',
|
||||
'[#question_general_feedback#]',
|
||||
'[#question_defaultgrade#]',
|
||||
'[#date_now#]',
|
||||
'[#question_type_nodes#]',
|
||||
'[#question_stamp#]',
|
||||
@@ -308,6 +309,7 @@ class cc11_quiz extends entities11 {
|
||||
self::safexml($question['title']),
|
||||
$question_moodle_type,
|
||||
self::safexml($question['feedback']),
|
||||
$question['defaultgrade'],
|
||||
time(),
|
||||
$question_type_node,
|
||||
$quiz_stamp,
|
||||
@@ -368,6 +370,7 @@ class cc11_quiz extends entities11 {
|
||||
$questions[$question_identifier]['moodle_type'] = $question_type['moodle'];
|
||||
$questions[$question_identifier]['cc_type'] = $question_type['cc'];
|
||||
$questions[$question_identifier]['feedback'] = $this->get_general_feedback($assessment, $question_identifier);
|
||||
$questions[$question_identifier]['defaultgrade'] = $this->get_defaultgrade($assessment, $question_identifier);
|
||||
$questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id);
|
||||
|
||||
}
|
||||
@@ -395,6 +398,21 @@ class cc11_quiz extends entities11 {
|
||||
}
|
||||
}
|
||||
|
||||
private function get_defaultgrade($assessment, $question_identifier) {
|
||||
$result = 1;
|
||||
$xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns());
|
||||
$query = '//xmlns:item[@ident="' . $question_identifier . '"]';
|
||||
$query .= '//xmlns:qtimetadatafield[xmlns:fieldlabel="cc_weighting"]/xmlns:fieldentry';
|
||||
$defgrade = $xpath->query($query);
|
||||
if (!empty($defgrade) && ($defgrade->length > 0)) {
|
||||
$resp = (int)$defgrade->item(0)->nodeValue;
|
||||
if ($resp >= 0 && $resp <= 99) {
|
||||
$result = $resp;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function get_general_feedback ($assessment, $question_identifier) {
|
||||
|
||||
$xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns());
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<QUESTIONTEXTFORMAT>1</QUESTIONTEXTFORMAT>
|
||||
<IMAGE></IMAGE>
|
||||
<GENERALFEEDBACK>[#question_general_feedback#]</GENERALFEEDBACK>
|
||||
<DEFAULTGRADE>1</DEFAULTGRADE>
|
||||
<DEFAULTGRADE>[#question_defaultgrade#]</DEFAULTGRADE>
|
||||
<PENALTY>0</PENALTY>
|
||||
<QTYPE>[#question_type#]</QTYPE>
|
||||
<LENGTH>1</LENGTH>
|
||||
|
||||
@@ -293,6 +293,14 @@ class backup_controller extends backup implements loggable {
|
||||
// Basic/initial prevention against time/memory limits
|
||||
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
// If this is not a course backup, inform the plan we are not
|
||||
// including all the activities for sure. This will affect any
|
||||
// task/step executed conditionally to stop including information
|
||||
// for section and activity backup. MDL-28180.
|
||||
if ($this->get_type() !== backup::TYPE_1COURSE) {
|
||||
$this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
|
||||
$this->plan->set_excluding_activities();
|
||||
}
|
||||
return $this->plan->execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -299,6 +299,14 @@ class restore_controller extends backup implements loggable {
|
||||
// Basic/initial prevention against time/memory limits
|
||||
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
// If this is not a course restore, inform the plan we are not
|
||||
// including all the activities for sure. This will affect any
|
||||
// task/step executed conditionally to stop processing information
|
||||
// for section and activity restore. MDL-28180.
|
||||
if ($this->get_type() !== backup::TYPE_1COURSE) {
|
||||
$this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
|
||||
$this->plan->set_excluding_activities();
|
||||
}
|
||||
return $this->plan->execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ class imscc1_converter extends base_converter {
|
||||
$manifestdir = dirname($manifest);
|
||||
$cc2moodle = new cc2moodle($manifest);
|
||||
if ($cc2moodle->is_auth()) {
|
||||
throw new imscc1_convert_exception('Protected cartridge content - Skipping import!');
|
||||
throw new imscc1_convert_exception('protected_cc_not_supported');
|
||||
}
|
||||
$status = $cc2moodle->generate_moodle_xml();
|
||||
//Final cleanup
|
||||
|
||||
@@ -99,7 +99,7 @@ class imscc11_converter extends base_converter {
|
||||
$manifestdir = dirname($manifest);
|
||||
$cc112moodle = new cc112moodle($manifest);
|
||||
if ($cc112moodle->is_auth()) {
|
||||
throw new imscc11_convert_exception('Protected cartridge content - Skipping import!');
|
||||
throw new imscc11_convert_exception('protected_cc_not_supported');
|
||||
}
|
||||
$status = $cc112moodle->generate_moodle_xml();
|
||||
//Final cleanup
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@
|
||||
|
||||
require_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
redirect("$CFG->wwwroot/$CFG->admin/report/backups/index.php", '', 'admin', 1);
|
||||
redirect("$CFG->wwwroot/report/backups/index.php", '', 'admin', 1);
|
||||
|
||||
@@ -1805,15 +1805,20 @@ class restore_course_completion_structure_step extends restore_structure_step {
|
||||
|
||||
$data->course = $this->get_courseid();
|
||||
|
||||
$params = array(
|
||||
'course' => $data->course,
|
||||
'criteriatype' => $data->criteriatype,
|
||||
'method' => $data->method,
|
||||
'value' => $data->value,
|
||||
);
|
||||
$DB->insert_record('course_completion_aggr_methd', $params);
|
||||
// Only create the course_completion_aggr_methd records if
|
||||
// the target course has not them defined. MDL-28180
|
||||
if (!$DB->record_exists('course_completion_aggr_methd', array(
|
||||
'course' => $data->course,
|
||||
'criteriatype' => $data->criteriatype))) {
|
||||
$params = array(
|
||||
'course' => $data->course,
|
||||
'criteriatype' => $data->criteriatype,
|
||||
'method' => $data->method,
|
||||
'value' => $data->value,
|
||||
);
|
||||
$DB->insert_record('course_completion_aggr_methd', $params);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ abstract class backup_cron_automated_helper {
|
||||
//Reference
|
||||
if ($haserrors) {
|
||||
$message .= " ".get_string('backupfailed')."\n\n";
|
||||
$dest_url = "$CFG->wwwroot/$CFG->admin/report/backups/index.php";
|
||||
$dest_url = "$CFG->wwwroot/report/backups/index.php";
|
||||
$message .= " ".get_string('backuptakealook','',$dest_url)."\n\n";
|
||||
//Set message priority
|
||||
$admin->priority = 1;
|
||||
|
||||
@@ -44,6 +44,7 @@ class backup_plan extends base_plan implements loggable {
|
||||
}
|
||||
$this->controller = $controller;
|
||||
$this->basepath = $CFG->tempdir . '/backup/' . $controller->get_backupid();
|
||||
$this->excludingdactivities = false;
|
||||
parent::__construct('backup_plan');
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ abstract class backup_setting extends base_setting implements checksumable {
|
||||
|
||||
/**
|
||||
* Returns the level of the setting
|
||||
*
|
||||
*
|
||||
* @return {int} One of the above constants
|
||||
*/
|
||||
public function get_level() {
|
||||
|
||||
@@ -145,7 +145,7 @@ class setting_test extends UnitTestCase {
|
||||
$this->assertEqual($e->errorcode, 'incorrect_object_passed');
|
||||
}
|
||||
restore_error_handler();
|
||||
|
||||
|
||||
// Try to change value of locked setting by permission
|
||||
$bs = new mock_base_setting('test', base_setting::IS_BOOLEAN, null, null, base_setting::LOCKED_BY_PERMISSION);
|
||||
try {
|
||||
@@ -448,4 +448,4 @@ function backup_setting_error_handler($errno, $errstr, $errfile, $errline, $errc
|
||||
return false;
|
||||
}
|
||||
throw new backup_setting_exception('incorrect_object_passed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class backup_optigroup extends base_optigroup implements processable {
|
||||
public function add_child($element) {
|
||||
if (!($element instanceof backup_optigroup_element)) { // parameter must be backup_optigroup_element
|
||||
if (is_object($element)) {
|
||||
$found = get_class($element);
|
||||
$found = get_class($element);
|
||||
} else {
|
||||
$found = 'non object';
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ class backup_ui extends base_ui {
|
||||
*/
|
||||
public function get_progress_bar() {
|
||||
global $PAGE;
|
||||
|
||||
|
||||
$stage = self::STAGE_COMPLETE;
|
||||
$currentstage = $this->stage->get_stage();
|
||||
$items = array();
|
||||
@@ -190,4 +190,4 @@ class backup_ui extends base_ui {
|
||||
/**
|
||||
* Backup user interface exception. Modelled off the backup_exception class
|
||||
*/
|
||||
class backup_ui_exception extends base_ui_exception {}
|
||||
class backup_ui_exception extends base_ui_exception {}
|
||||
|
||||
+11
-11
@@ -16,7 +16,7 @@ M.core_backup_files_tree = {
|
||||
// XXX: the id in params['contextid'] is current context
|
||||
// request file list, so should be user context
|
||||
params['contextid'] = this.usercontextid;
|
||||
}
|
||||
}
|
||||
var scope = this;
|
||||
params['sesskey']=M.cfg.sesskey;
|
||||
var cfg = {
|
||||
@@ -38,14 +38,14 @@ M.core_backup_files_tree = {
|
||||
var n = new YAHOO.widget.TextNode(info, node, false);
|
||||
YAHOO.util.Event.addListener(n.labelElId, "click", function(e) {
|
||||
YAHOO.util.Event.preventDefault(e);
|
||||
});
|
||||
});
|
||||
n.isLeaf = false;
|
||||
} else {
|
||||
var params = data[i].params;
|
||||
if (params['filearea'] == 'backup' && params['component'] == 'user') {
|
||||
// XXX: display the restore link, so should be context id
|
||||
params['contextid'] = scope.currentcontextid;
|
||||
}
|
||||
}
|
||||
params.action = 'choosebackupfile';
|
||||
var restoreurl = M.cfg.wwwroot+'/backup/restorefile.php?'+build_querystring(params);
|
||||
var info = {label: data[i].filename, 'href': data[i].url, 'restoreurl': restoreurl};
|
||||
@@ -89,14 +89,14 @@ M.core_backup_files_tree = {
|
||||
// prevent link
|
||||
YAHOO.util.Event.addListener(node.labelElId, "click", function(e) {
|
||||
YAHOO.util.Event.preventDefault(e);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
node.isLeaf = true;
|
||||
}
|
||||
}
|
||||
tree.render();
|
||||
this.y3 = Y;
|
||||
},
|
||||
},
|
||||
dynload: function(node, oncompletecb) {
|
||||
M.core_backup_files_tree.request(node.href, node, oncompletecb);
|
||||
},
|
||||
@@ -115,7 +115,7 @@ M.core_backup_files_tree = {
|
||||
|
||||
YAHOO.widget.RestoreNode = function(oData, oParent, expanded) {
|
||||
|
||||
if (oData) {
|
||||
if (oData) {
|
||||
if (YAHOO.lang.isString(oData)) {
|
||||
oData = { label: oData };
|
||||
}
|
||||
@@ -132,10 +132,10 @@ YAHOO.extend(YAHOO.widget.RestoreNode, YAHOO.widget.TextNode, {
|
||||
href: null,
|
||||
target: "_blank",
|
||||
_type: "RestoreNode",
|
||||
setUpLabel: function(oData) {
|
||||
setUpLabel: function(oData) {
|
||||
if (YAHOO.lang.isString(oData)) {
|
||||
oData = {
|
||||
label: oData
|
||||
oData = {
|
||||
label: oData
|
||||
};
|
||||
} else {
|
||||
if (oData.style) {
|
||||
@@ -147,7 +147,7 @@ YAHOO.extend(YAHOO.widget.RestoreNode, YAHOO.widget.TextNode, {
|
||||
this.restoreurl = oData.restoreurl;
|
||||
this.labelElId = "ygtvlabelel" + this.index;
|
||||
},
|
||||
getContentHtml: function() {
|
||||
getContentHtml: function() {
|
||||
var sb = [];
|
||||
sb[sb.length] = '<a';
|
||||
sb[sb.length] = ' id="' + this.labelElId + '"';
|
||||
@@ -155,7 +155,7 @@ YAHOO.extend(YAHOO.widget.RestoreNode, YAHOO.widget.TextNode, {
|
||||
if (this.href) {
|
||||
sb[sb.length] = ' href="' + this.href + '"';
|
||||
sb[sb.length] = ' target="' + this.target + '"';
|
||||
}
|
||||
}
|
||||
if (this.title) {
|
||||
sb[sb.length] = ' title="' + this.title + '"';
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ YUI.add('moodle-backup-confirmcancel', function(Y) {
|
||||
M.core_backup = M.core_backup || {};
|
||||
/**
|
||||
* Adds confirmation dialogues to the cancel buttons on the page.
|
||||
*
|
||||
*
|
||||
* @param {object} config
|
||||
*/
|
||||
M.core_backup.watch_cancel_buttons = function(config) {
|
||||
@@ -27,4 +27,4 @@ M.core_backup.watch_cancel_buttons = function(config) {
|
||||
});
|
||||
}
|
||||
|
||||
}, '@VERSION@', {'requires':['base','node','node-event-simulate','moodle-enrol-notification']});
|
||||
}, '@VERSION@', {'requires':['base','node','node-event-simulate','moodle-enrol-notification']});
|
||||
|
||||
@@ -76,5 +76,8 @@ function xmldb_block_community_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
-7
@@ -31,13 +31,6 @@ YUI.add('moodle-block_community-comments', function(Y) {
|
||||
this.overlays[commentid].render();
|
||||
this.overlays[commentid].hide();
|
||||
|
||||
// position the overlay in the middle of the web browser window
|
||||
var WidgetPositionAlign = Y.WidgetPositionAlign;
|
||||
this.overlays[commentid].set("align", {
|
||||
node:"", //empty => viewport
|
||||
points:[WidgetPositionAlign.CC, WidgetPositionAlign.CC]
|
||||
});
|
||||
|
||||
Y.one('#comments-'+commentid).on('click', this.show, this, commentid);
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ class block_edit_form extends moodleform {
|
||||
$mform->addHelpButton('bui_defaultweight', 'defaultweight', 'block');
|
||||
|
||||
// Where this block is positioned on this page.
|
||||
$mform->addElement('header', 'whereheader', get_string('onthispage', 'block'));
|
||||
$mform->addElement('header', 'onthispage', get_string('onthispage', 'block'));
|
||||
|
||||
$mform->addElement('selectyesno', 'bui_visible', get_string('visible', 'block'));
|
||||
|
||||
|
||||
@@ -66,5 +66,8 @@ function xmldb_block_html_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ class block_html_edit_form extends block_edit_form {
|
||||
|
||||
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean'=>true, 'context'=>$this->block->context);
|
||||
$mform->addElement('editor', 'config_text', get_string('configcontent', 'block_html'), null, $editoroptions);
|
||||
$mform->addRule('config_text', null, 'required', null, 'client');
|
||||
$mform->setType('config_text', PARAM_RAW); // XSS is prevented when printing the block contents and serving files
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@ class block_login extends block_base {
|
||||
// TODO: now that we have multiauth it is hard to find out if there is a way to change password
|
||||
$forgot = $wwwroot . '/login/forgot_password.php';
|
||||
|
||||
if (empty($CFG->xmlstrictheaders) and !empty($CFG->loginpasswordautocomplete)) {
|
||||
$autocomplete = 'autocomplete="off"';
|
||||
} else {
|
||||
$autocomplete = '';
|
||||
}
|
||||
|
||||
$username = get_moodle_cookie();
|
||||
|
||||
$this->content->footer = '';
|
||||
@@ -42,13 +48,14 @@ class block_login extends block_base {
|
||||
|
||||
if (!isloggedin() or isguestuser()) { // Show the block
|
||||
|
||||
$this->content->text .= "\n".'<form class="loginform" id="login" method="post" action="'.get_login_url().'">';
|
||||
$this->content->text .= "\n".'<form class="loginform" id="login" method="post" action="'.get_login_url().'" '.$autocomplete.'>';
|
||||
|
||||
$this->content->text .= '<div class="c1 fld username"><label for="login_username">'.get_string('username').'</label>';
|
||||
$this->content->text .= '<input type="text" name="username" id="login_username" value="'.s($username).'" /></div>';
|
||||
|
||||
$this->content->text .= '<div class="c1 fld password"><label for="login_password">'.get_string('password').'</label>';
|
||||
$this->content->text .= '<input type="password" name="password" id="login_password" value="" /></div>';
|
||||
|
||||
$this->content->text .= '<input type="password" name="password" id="login_password" value="" '.$autocomplete.' /></div>';
|
||||
|
||||
if (isset($CFG->rememberusername) and $CFG->rememberusername == 2) {
|
||||
$checked = $username ? 'checked="checked"' : '';
|
||||
|
||||
@@ -75,5 +75,8 @@ function xmldb_block_navigation_upgrade($oldversion, $block) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -75,5 +75,8 @@ function xmldb_block_settings_upgrade($oldversion, $block) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
+7
-9
@@ -134,27 +134,25 @@ class blog_edit_form extends moodleform {
|
||||
|
||||
// validate course association
|
||||
if (!empty($data['courseassoc']) && has_capability('moodle/blog:associatecourse', $sitecontext)) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $data['courseassoc']);
|
||||
$coursecontext = context::instance_by_id($data['courseassoc'], IGNORE_MISSING);
|
||||
|
||||
if ($coursecontext) {
|
||||
if ($coursecontext and $coursecontext->contextlevel == CONTEXT_COURSE) {
|
||||
if (!is_enrolled($coursecontext) and !is_viewing($coursecontext)) {
|
||||
$errors['courseassoc'] = get_string('studentnotallowed', '', fullname($USER, true));
|
||||
}
|
||||
} else {
|
||||
$errors['courseassoc'] = get_string('invalidcontextid', 'blog');
|
||||
$errors['courseassoc'] = get_string('error');
|
||||
}
|
||||
}
|
||||
|
||||
// validate mod association
|
||||
if (!empty($data['modassoc'])) {
|
||||
$modcontextid = $data['modassoc'];
|
||||
$modcontext = context::instance_by_id($modcontextid, IGNORE_MISSING);
|
||||
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $modcontextid);
|
||||
|
||||
if ($modcontext) {
|
||||
if ($modcontext and $modcontext->contextlevel == CONTEXT_MODULE) {
|
||||
// get context of the mod's course
|
||||
$path = explode('/', $modcontext->path);
|
||||
$coursecontext = get_context_instance_by_id($path[(count($path) - 2)]);
|
||||
$coursecontext = $modcontext->get_course_context(true);
|
||||
|
||||
// ensure only one course is associated
|
||||
if (!empty($data['courseassoc'])) {
|
||||
@@ -170,7 +168,7 @@ class blog_edit_form extends moodleform {
|
||||
$errors['modassoc'] = get_string('studentnotallowed', '', fullname($USER, true));
|
||||
}
|
||||
} else {
|
||||
$errors['modassoc'] = get_string('invalidcontextid', 'blog');
|
||||
$errors['modassoc'] = get_string('error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -212,9 +212,13 @@ if (empty($entryid) && empty($modid) && empty($groupid)) {
|
||||
}
|
||||
|
||||
if ($CFG->enablerssfeeds) {
|
||||
$rsscontext = $filtertype = $thingid = null;
|
||||
$rsscontext = null;
|
||||
$filtertype = null;
|
||||
$thingid = null;
|
||||
list($thingid, $rsscontext, $filtertype) = blog_rss_get_params($blogheaders['filters']);
|
||||
|
||||
if (empty($rsscontext)) {
|
||||
$rsscontext = get_system_context();
|
||||
}
|
||||
$rsstitle = $blogheaders['heading'];
|
||||
|
||||
//check we haven't started output by outputting an error message
|
||||
|
||||
+10
-4
@@ -529,7 +529,10 @@ function blog_get_options_for_course(stdClass $course, stdClass $user=null) {
|
||||
return $courseoptions[$key];
|
||||
}
|
||||
|
||||
if (has_capability('moodle/blog:view', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$canparticipate = (is_enrolled($coursecontext) or is_viewing($coursecontext));
|
||||
|
||||
if (has_capability('moodle/blog:view', $coursecontext)) {
|
||||
// We can view!
|
||||
if ($CFG->bloglevel >= BLOG_SITE_LEVEL) {
|
||||
// View entries about this course
|
||||
@@ -552,7 +555,7 @@ function blog_get_options_for_course(stdClass $course, stdClass $user=null) {
|
||||
}
|
||||
}
|
||||
|
||||
if (has_capability('moodle/blog:create', $sitecontext)) {
|
||||
if (has_capability('moodle/blog:create', $sitecontext) and $canparticipate) {
|
||||
// We can blog about this course
|
||||
$options['courseadd'] = array(
|
||||
'string' => get_string('blogaboutthiscourse', 'blog'),
|
||||
@@ -604,7 +607,10 @@ function blog_get_options_for_module($module, $user=null) {
|
||||
return $moduleoptions[$module->id];
|
||||
}
|
||||
|
||||
if (has_capability('moodle/blog:view', get_context_instance(CONTEXT_MODULE, $module->id))) {
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $module->id);
|
||||
$canparticipate = (is_enrolled($modcontext) or is_viewing($modcontext));
|
||||
|
||||
if (has_capability('moodle/blog:view', $modcontext)) {
|
||||
// We can view!
|
||||
if ($CFG->bloglevel >= BLOG_SITE_LEVEL) {
|
||||
// View all entries about this module
|
||||
@@ -632,7 +638,7 @@ function blog_get_options_for_module($module, $user=null) {
|
||||
}
|
||||
}
|
||||
|
||||
if (has_capability('moodle/blog:create', $sitecontext)) {
|
||||
if (has_capability('moodle/blog:create', $sitecontext) and $canparticipate) {
|
||||
// The user can blog about this module
|
||||
$options['moduleadd'] = array(
|
||||
'string' => get_string('blogaboutthismodule', 'blog', $module->modname),
|
||||
|
||||
+6
-6
@@ -196,17 +196,17 @@ $CFG->admin = 'admin';
|
||||
//
|
||||
// These variables define DEFAULT block variables for new courses
|
||||
// If this one is set it overrides all others and is the only one used.
|
||||
// $CFG->defaultblocks_override = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
// $CFG->defaultblocks_override = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
//
|
||||
// These variables define the specific settings for defined course formats.
|
||||
// They override any settings defined in the formats own config file.
|
||||
// $CFG->defaultblocks_site = 'site_main_menu,admin,course_list:course_summary,calendar_month';
|
||||
// $CFG->defaultblocks_social = 'participants,search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,admin,course_list';
|
||||
// $CFG->defaultblocks_topics = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
// $CFG->defaultblocks_weeks = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
// $CFG->defaultblocks_site = 'site_main_menu,course_list:course_summary,calendar_month';
|
||||
// $CFG->defaultblocks_social = 'participants,search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,course_list';
|
||||
// $CFG->defaultblocks_topics = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
// $CFG->defaultblocks_weeks = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
//
|
||||
// These blocks are used when no other default setting is found.
|
||||
// $CFG->defaultblocks = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
// $CFG->defaultblocks = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
|
||||
//
|
||||
// You can specify a different class to be created for the $PAGE global, and to
|
||||
// compute which blocks appear on each page. However, I cannot think of any good
|
||||
|
||||
@@ -110,7 +110,7 @@ if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing())
|
||||
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $coursecontext)) {
|
||||
echo '<a title="'.$streditsummary.'" '.
|
||||
' href="editsection.php?id='.$thissection->id.'"><img src="'.$OUTPUT->pix_url('t/edit') . '" '.
|
||||
' class="icon edit" alt="'.$streditsummary.'" /></a>';
|
||||
' class="iconsmall edit" alt="'.$streditsummary.'" /></a>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
@@ -234,7 +234,7 @@ while ($section <= $course->numsections) {
|
||||
|
||||
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
echo ' <a title="'.$streditsummary.'" href="editsection.php?id='.$thissection->id.'">'.
|
||||
'<img src="'.$OUTPUT->pix_url('t/edit') . '" class="icon edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
'<img src="'.$OUTPUT->pix_url('t/edit') . '" class="iconsmall edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
echo '<p><a title="'.$streditsummary.'" '.
|
||||
' href="editsection.php?id='.$thissection->id.'"><img src="'.$OUTPUT->pix_url('t/edit') . '" '.
|
||||
' class="icon edit" alt="'.$streditsummary.'" /></a></p>';
|
||||
' class="iconsmall edit" alt="'.$streditsummary.'" /></a></p>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
@@ -234,7 +234,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
echo ' <a title="'.$streditsummary.'" href="editsection.php?id='.$thissection->id.'">'.
|
||||
'<img src="'.$OUTPUT->pix_url('t/edit') . '" class="icon edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
'<img src="'.$OUTPUT->pix_url('t/edit') . '" class="iconsmall edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
|
||||
+32
-28
@@ -1606,8 +1606,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||
|
||||
// If specified, display extra content after link
|
||||
if ($content) {
|
||||
$contentpart = '<div class="contentafterlink' .
|
||||
trim($textclasses) . '">' . $content . '</div>';
|
||||
$contentpart = '<div class="' . trim('contentafterlink' . $textclasses) .
|
||||
'">' . $content . '</div>';
|
||||
}
|
||||
} else {
|
||||
// No link, so display only content
|
||||
@@ -3062,13 +3062,13 @@ function moveto_module($mod, $section, $beforemod=NULL) {
|
||||
* @global core_renderer $OUTPUT
|
||||
* @staticvar type $str
|
||||
* @param stdClass $mod The module to produce editing buttons for
|
||||
* @param bool $absolute If true an absolute link is produced (default true)
|
||||
* @param bool $absolute_ignored ignored - all links are absolute
|
||||
* @param bool $moveselect If true a move seleciton process is used (default true)
|
||||
* @param int $indent The current indenting
|
||||
* @param int $section The section to link back to
|
||||
* @return string XHTML for the editing buttons
|
||||
*/
|
||||
function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = true, $indent=-1, $section=-1) {
|
||||
function make_editing_buttons(stdClass $mod, $absolute_ignored = true, $moveselect = true, $indent=-1, $section=-1) {
|
||||
global $CFG, $OUTPUT;
|
||||
|
||||
static $str;
|
||||
@@ -3076,11 +3076,16 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $mod->course);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $mod->id);
|
||||
|
||||
// no permission to edit
|
||||
if (!has_capability('moodle/course:manageactivities', $modcontext)) {
|
||||
$editcaps = array('moodle/course:manageactivities', 'moodle/course:activityvisibility', 'moodle/role:assign');
|
||||
$dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
|
||||
|
||||
// no permission to edit anything
|
||||
if (!has_any_capability($editcaps, $modcontext) and !has_all_capabilities($dupecaps, $coursecontext)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$hasmanageactivities = has_capability('moodle/course:manageactivities', $modcontext);
|
||||
|
||||
if (!isset($str)) {
|
||||
$str = new stdClass;
|
||||
$str->assign = get_string("assignroles", 'role');
|
||||
@@ -3101,11 +3106,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||
$str->groupsvisible = get_string("groupsvisible");
|
||||
}
|
||||
|
||||
if ($absolute) {
|
||||
$baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
|
||||
} else {
|
||||
$baseurl = new moodle_url('mod.php', array('sesskey' => sesskey()));
|
||||
}
|
||||
$baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
|
||||
|
||||
if ($section >= 0) {
|
||||
$baseurl->param('sr', $section);
|
||||
@@ -3113,7 +3114,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||
$actions = array();
|
||||
|
||||
// leftright
|
||||
if (has_capability('moodle/course:update', $coursecontext)) {
|
||||
if ($hasmanageactivities) {
|
||||
if (right_to_left()) { // Exchange arrows on RTL
|
||||
$rightarrow = 't/left';
|
||||
$leftarrow = 't/right';
|
||||
@@ -3141,7 +3142,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||
}
|
||||
|
||||
// move
|
||||
if (has_capability('moodle/course:update', $coursecontext)) {
|
||||
if ($hasmanageactivities) {
|
||||
if ($moveselect) {
|
||||
$actions[] = new action_link(
|
||||
new moodle_url($baseurl, array('copy' => $mod->id)),
|
||||
@@ -3166,15 +3167,16 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||
}
|
||||
|
||||
// Update
|
||||
$actions[] = new action_link(
|
||||
new moodle_url($baseurl, array('update' => $mod->id)),
|
||||
new pix_icon('t/edit', $str->update, 'moodle', array('class' => 'iconsmall')),
|
||||
null,
|
||||
array('class' => 'editing_update', 'title' => $str->update)
|
||||
);
|
||||
if ($hasmanageactivities) {
|
||||
$actions[] = new action_link(
|
||||
new moodle_url($baseurl, array('update' => $mod->id)),
|
||||
new pix_icon('t/edit', $str->update, 'moodle', array('class' => 'iconsmall')),
|
||||
null,
|
||||
array('class' => 'editing_update', 'title' => $str->update)
|
||||
);
|
||||
}
|
||||
|
||||
// Duplicate (require both target import caps to be able to duplicate, see modduplicate.php)
|
||||
$dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
|
||||
if (has_all_capabilities($dupecaps, $coursecontext)) {
|
||||
$actions[] = new action_link(
|
||||
new moodle_url($baseurl, array('duplicate' => $mod->id)),
|
||||
@@ -3185,12 +3187,14 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||
}
|
||||
|
||||
// Delete
|
||||
$actions[] = new action_link(
|
||||
new moodle_url($baseurl, array('delete' => $mod->id)),
|
||||
new pix_icon('t/delete', $str->delete, 'moodle', array('class' => 'iconsmall')),
|
||||
null,
|
||||
array('class' => 'editing_delete', 'title' => $str->delete)
|
||||
);
|
||||
if ($hasmanageactivities) {
|
||||
$actions[] = new action_link(
|
||||
new moodle_url($baseurl, array('delete' => $mod->id)),
|
||||
new pix_icon('t/delete', $str->delete, 'moodle', array('class' => 'iconsmall')),
|
||||
null,
|
||||
array('class' => 'editing_delete', 'title' => $str->delete)
|
||||
);
|
||||
}
|
||||
|
||||
// hideshow
|
||||
if (has_capability('moodle/course:activityvisibility', $modcontext)) {
|
||||
@@ -3212,7 +3216,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||
}
|
||||
|
||||
// groupmode
|
||||
if ($mod->groupmode !== false) {
|
||||
if ($hasmanageactivities and $mod->groupmode !== false) {
|
||||
if ($mod->groupmode == SEPARATEGROUPS) {
|
||||
$groupmode = 0;
|
||||
$grouptitle = $str->groupsseparate;
|
||||
@@ -3242,7 +3246,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||
}
|
||||
|
||||
// Assign
|
||||
if (has_capability('moodle/course:managegroups', $modcontext)){
|
||||
if (has_capability('moodle/role:assign', $modcontext)){
|
||||
$actions[] = new action_link(
|
||||
new moodle_url('/'.$CFG->admin.'/roles/assign.php', array('contextid' => $modcontext->id)),
|
||||
new pix_icon('i/roles', $str->assign, 'moodle', array('class' => 'iconsmall')),
|
||||
|
||||
+51
-61
@@ -26,8 +26,6 @@
|
||||
require("../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
require_login();
|
||||
|
||||
$sectionreturn = optional_param('sr', '', PARAM_INT);
|
||||
$add = optional_param('add', '', PARAM_ALPHA);
|
||||
$type = optional_param('type', '', PARAM_ALPHA);
|
||||
@@ -66,6 +64,8 @@ if ($groupmode !== '') {
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
|
||||
require_login();
|
||||
|
||||
//check if we are adding / editing a module that has new forms using formslib
|
||||
if (!empty($add)) {
|
||||
$id = required_param('id', PARAM_INT);
|
||||
@@ -76,9 +76,7 @@ if (!empty($add)) {
|
||||
redirect("$CFG->wwwroot/course/modedit.php?add=$add&type=$type&course=$id§ion=$section&return=$returntomod");
|
||||
|
||||
} else if (!empty($update)) {
|
||||
if (!$cm = get_coursemodule_from_id('', $update, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$cm = get_coursemodule_from_id('', $update, 0, true, MUST_EXIST);
|
||||
$returntomod = optional_param('return', 0, PARAM_BOOL);
|
||||
redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod");
|
||||
|
||||
@@ -86,7 +84,7 @@ if (!empty($add)) {
|
||||
$cm = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($course->id);
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:manageactivities', $coursecontext);
|
||||
@@ -119,17 +117,13 @@ if (!empty($add)) {
|
||||
}
|
||||
|
||||
} else if (!empty($delete)) {
|
||||
if (!$cm = get_coursemodule_from_id('', $delete, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$cm = get_coursemodule_from_id('', $delete, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$cm->course))) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
|
||||
$return = "$CFG->wwwroot/course/view.php?id=$cm->course#section-$cm->sectionnum";
|
||||
|
||||
@@ -203,9 +197,13 @@ if (!empty($add)) {
|
||||
|
||||
|
||||
if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
if (!$cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
|
||||
if (!empty($movetosection)) {
|
||||
if (!$section = $DB->get_record('course_sections', array('id'=>$movetosection, 'course'=>$cm->course))) {
|
||||
@@ -222,10 +220,6 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
}
|
||||
}
|
||||
|
||||
require_login($section->course); // needed to setup proper $COURSE
|
||||
$context = get_context_instance(CONTEXT_COURSE, $section->course);
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (!ismoving($section->course)) {
|
||||
print_error('needcopy', '', "view.php?id=$section->course");
|
||||
}
|
||||
@@ -246,13 +240,14 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
|
||||
} else if (!empty($indent) and confirm_sesskey()) {
|
||||
$id = required_param('id', PARAM_INT);
|
||||
if (!$cm = get_coursemodule_from_id('', $id, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
$context = get_context_instance(CONTEXT_COURSE, $cm->course);
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
$cm = get_coursemodule_from_id('', $id, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
|
||||
$cm->indent += $indent;
|
||||
|
||||
@@ -271,13 +266,13 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
}
|
||||
|
||||
} else if (!empty($hide) and confirm_sesskey()) {
|
||||
if (!$cm = get_coursemodule_from_id('', $hide, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$cm = get_coursemodule_from_id('', $hide, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:activityvisibility', $context);
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:activityvisibility', $modcontext);
|
||||
|
||||
set_coursemodule_visible($cm->id, 0);
|
||||
|
||||
@@ -290,21 +285,17 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
}
|
||||
|
||||
} else if (!empty($show) and confirm_sesskey()) {
|
||||
if (!$cm = get_coursemodule_from_id('', $show, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$cm = get_coursemodule_from_id('', $show, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
$context = get_context_instance(CONTEXT_COURSE, $cm->course);
|
||||
require_capability('moodle/course:activityvisibility', $context);
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:activityvisibility', $modcontext);
|
||||
|
||||
if (!$section = $DB->get_record('course_sections', array('id'=>$cm->section))) {
|
||||
print_error('sectionnotexist');
|
||||
}
|
||||
$section = $DB->get_record('course_sections', array('id'=>$cm->section), '*', MUST_EXIST);
|
||||
|
||||
if (!$module = $DB->get_record('modules', array('id'=>$cm->module))) {
|
||||
print_error('moduledoesnotexist');
|
||||
}
|
||||
$module = $DB->get_record('modules', array('id'=>$cm->module), '*', MUST_EXIST);
|
||||
|
||||
if ($module->visible and ($section->visible or (SITEID == $cm->course))) {
|
||||
set_coursemodule_visible($cm->id, 1);
|
||||
@@ -319,13 +310,14 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
|
||||
} else if ($groupmode > -1 and confirm_sesskey()) {
|
||||
$id = required_param('id', PARAM_INT);
|
||||
if (!$cm = get_coursemodule_from_id('', $id, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
$cm = get_coursemodule_from_id('', $id, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
|
||||
set_coursemodule_groupmode($cm->id, $groupmode);
|
||||
|
||||
@@ -338,17 +330,15 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
}
|
||||
|
||||
} else if (!empty($copy) and confirm_sesskey()) { // value = course module
|
||||
if (!$cm = get_coursemodule_from_id('', $copy, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$cm = get_coursemodule_from_id('', $copy, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
$context = get_context_instance(CONTEXT_COURSE, $cm->course);
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
|
||||
if (!$section = $DB->get_record('course_sections', array('id'=>$cm->section))) {
|
||||
print_error('sectionnotexist');
|
||||
}
|
||||
$section = $DB->get_record('course_sections', array('id'=>$cm->section), '*', MUST_EXIST);
|
||||
|
||||
$USER->activitycopy = $copy;
|
||||
$USER->activitycopycourse = $cm->course;
|
||||
|
||||
+4
-1
@@ -365,7 +365,9 @@ if ($mform->is_cancelled()) {
|
||||
}
|
||||
|
||||
// make sure visibility is set correctly (in particular in calendar)
|
||||
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
|
||||
if (has_capability('moodle/course:activityvisibility', $modcontext)) {
|
||||
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
|
||||
}
|
||||
|
||||
if (isset($fromform->cmidnumber)) { //label
|
||||
// set cm idnumber - uniqueness is already verified by form validation
|
||||
@@ -477,6 +479,7 @@ if ($mform->is_cancelled()) {
|
||||
$DB->set_field('course_modules', 'section', $sectionid, array('id'=>$fromform->coursemodule));
|
||||
|
||||
// make sure visibility is set correctly (in particular in calendar)
|
||||
// note: allow them to set it even without moodle/course:activityvisibility
|
||||
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
|
||||
|
||||
if (isset($fromform->cmidnumber)) { //label
|
||||
|
||||
+48
-10
@@ -173,16 +173,21 @@ abstract class moodleform_mod extends moodleform {
|
||||
}
|
||||
}
|
||||
|
||||
if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
|
||||
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
|
||||
// Don't disable/remove groupingid if it is currently set to something,
|
||||
// otherwise you cannot turn it off at same time as turning off other
|
||||
// option (MDL-30764)
|
||||
if (empty($this->_cm) || !$this->_cm->groupingid) {
|
||||
if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
|
||||
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
|
||||
|
||||
} else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
|
||||
$mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
|
||||
} else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
|
||||
$mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
|
||||
|
||||
} else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
|
||||
// groupings have no use without groupmode or groupmembersonly
|
||||
if ($mform->elementExists('groupingid')) {
|
||||
$mform->removeElement('groupingid');
|
||||
} else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
|
||||
// groupings have no use without groupmode or groupmembersonly
|
||||
if ($mform->elementExists('groupingid')) {
|
||||
$mform->removeElement('groupingid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,6 +318,35 @@ abstract class moodleform_mod extends moodleform {
|
||||
$errors['availablefrom'] = get_string('badavailabledates', 'condition');
|
||||
}
|
||||
|
||||
// Conditions: Verify that the grade conditions are numbers, and make sense.
|
||||
if (array_key_exists('conditiongradegroup', $data)) {
|
||||
foreach ($data['conditiongradegroup'] as $i => $gradedata) {
|
||||
if ($gradedata['conditiongrademin'] !== '' && !is_numeric($gradedata['conditiongrademin'])) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
|
||||
continue;
|
||||
}
|
||||
if ($gradedata['conditiongrademax'] !== '' && !is_numeric($gradedata['conditiongrademax'])) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
|
||||
continue;
|
||||
}
|
||||
if ($gradedata['conditiongrademin'] !== '' && $gradedata['conditiongrademax'] !== '' &&
|
||||
$gradedata['conditiongrademax'] < $gradedata['conditiongrademin']) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('badgradelimits', 'condition');
|
||||
continue;
|
||||
}
|
||||
if ($gradedata['conditiongrademin'] === '' && $gradedata['conditiongrademax'] === '' &&
|
||||
$gradedata['conditiongradeitemid']) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('gradeitembutnolimits', 'condition');
|
||||
continue;
|
||||
}
|
||||
if (($gradedata['conditiongrademin'] !== '' || $gradedata['conditiongrademax'] !== '') &&
|
||||
!$gradedata['conditiongradeitemid']) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('gradelimitsbutnoitem', 'condition');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
@@ -422,6 +456,12 @@ abstract class moodleform_mod extends moodleform {
|
||||
}
|
||||
|
||||
$mform->addElement('modvisible', 'visible', get_string('visible'));
|
||||
if (!empty($this->_cm)) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $this->_cm->id);
|
||||
if (!has_capability('moodle/course:activityvisibility', $context)) {
|
||||
$mform->hardFreeze('visible');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->_features->idnumber) {
|
||||
$mform->addElement('text', 'cmidnumber', get_string('idnumbermod'));
|
||||
@@ -471,8 +511,6 @@ abstract class moodleform_mod extends moodleform {
|
||||
$grouparray[] =& $mform->createElement('static', '', '','% '.get_string('grade_upto','condition').' ');
|
||||
$grouparray[] =& $mform->createElement('text', 'conditiongrademax','',array('size'=>3));
|
||||
$grouparray[] =& $mform->createElement('static', '', '','%');
|
||||
$mform->setType('conditiongrademin',PARAM_FLOAT);
|
||||
$mform->setType('conditiongrademax',PARAM_FLOAT);
|
||||
$group = $mform->createElement('group','conditiongradegroup',
|
||||
get_string('gradecondition', 'condition'),$grouparray);
|
||||
|
||||
|
||||
+22
-20
@@ -43,16 +43,16 @@ $pageaction = optional_param('action', '', PARAM_ALPHA); // Used to simulate a D
|
||||
|
||||
$PAGE->set_url('/course/rest.php', array('courseId'=>$courseid,'class'=>$class));
|
||||
|
||||
//NOTE: when making any changes here please make sure it is using the same access control as course/mod.php !!
|
||||
|
||||
require_login();
|
||||
|
||||
// Authorise the user and verify some incoming data
|
||||
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
|
||||
error_log('AJAX commands.php: Course does not exist');
|
||||
die;
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_login($course);
|
||||
require_capability('moodle/course:update', $context);
|
||||
|
||||
if (empty($CFG->enablecourseajax)) {
|
||||
error_log('Course AJAX not allowed');
|
||||
die;
|
||||
@@ -72,22 +72,13 @@ switch($requestmethod) {
|
||||
|
||||
switch ($class) {
|
||||
case 'block':
|
||||
|
||||
switch ($field) {
|
||||
case 'visible':
|
||||
blocks_execute_action($PAGE, $pageblocks, 'toggle', $blockinstance);
|
||||
break;
|
||||
|
||||
case 'position': // Misleading case. Should probably call it 'move'.
|
||||
// We want to move the block around. This means changing
|
||||
// the column (position field) and/or block sort order
|
||||
// (weight field).
|
||||
blocks_move_block($PAGE, $blockinstance, $column, $value);
|
||||
break;
|
||||
}
|
||||
// not used any more
|
||||
break;
|
||||
|
||||
case 'section':
|
||||
require_login($course);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_capability('moodle/course:update', $coursecontext);
|
||||
|
||||
if (!$DB->record_exists('course_sections', array('course'=>$course->id, 'section'=>$id))) {
|
||||
error_log('AJAX commands.php: Bad Section ID '.$id);
|
||||
@@ -111,16 +102,21 @@ switch($requestmethod) {
|
||||
error_log('AJAX commands.php: Bad course module ID '.$id);
|
||||
die;
|
||||
}
|
||||
require_login($course, false, $cm);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
switch ($field) {
|
||||
case 'visible':
|
||||
require_capability('moodle/course:activityvisibility', $modcontext);
|
||||
set_coursemodule_visible($cm->id, $value);
|
||||
break;
|
||||
|
||||
case 'groupmode':
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
set_coursemodule_groupmode($cm->id, $value);
|
||||
break;
|
||||
|
||||
case 'indentleft':
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
if ($cm->indent > 0) {
|
||||
$cm->indent--;
|
||||
$DB->update_record('course_modules', $cm);
|
||||
@@ -128,11 +124,13 @@ switch($requestmethod) {
|
||||
break;
|
||||
|
||||
case 'indentright':
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
$cm->indent++;
|
||||
$DB->update_record('course_modules', $cm);
|
||||
break;
|
||||
|
||||
case 'move':
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
if (!$section = $DB->get_record('course_sections', array('course'=>$course->id, 'section'=>$sectionid))) {
|
||||
error_log('AJAX commands.php: Bad section ID '.$sectionid);
|
||||
die;
|
||||
@@ -158,6 +156,9 @@ switch($requestmethod) {
|
||||
case 'course':
|
||||
switch($field) {
|
||||
case 'marker':
|
||||
require_login($course);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_capability('moodle/course:update', $coursecontext);
|
||||
$newcourse = new stdClass();
|
||||
$newcourse->id = $course->id;
|
||||
$newcourse->marker = $value;
|
||||
@@ -171,7 +172,7 @@ switch($requestmethod) {
|
||||
case 'DELETE':
|
||||
switch ($class) {
|
||||
case 'block':
|
||||
blocks_execute_action($PAGE, $pageblocks, 'delete', $blockinstance);
|
||||
// not used any more
|
||||
break;
|
||||
|
||||
case 'resource':
|
||||
@@ -179,6 +180,9 @@ switch($requestmethod) {
|
||||
error_log('AJAX rest.php: Bad course module ID '.$id);
|
||||
die;
|
||||
}
|
||||
require_login($course, false, $cm);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
$modlib = "$CFG->dirroot/mod/$cm->modname/lib.php";
|
||||
|
||||
if (file_exists($modlib)) {
|
||||
@@ -195,8 +199,6 @@ switch($requestmethod) {
|
||||
die;
|
||||
}
|
||||
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
// remove all module files in case modules forget to do that
|
||||
$fs = get_file_storage();
|
||||
$fs->delete_area_files($modcontext->id);
|
||||
|
||||
@@ -55,6 +55,8 @@ if ($mode === 'coursecompletions' or $mode === 'coursecompletion') {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
|
||||
$PAGE->set_url('/course/user.php', array('id'=>$id, 'user'=>$user->id, 'mode'=>$mode));
|
||||
|
||||
require_login();
|
||||
$PAGE->set_pagelayout('admin');
|
||||
if (has_capability('moodle/user:viewuseractivitiesreport', $personalcontext) and !is_enrolled($coursecontext)) {
|
||||
|
||||
+27
-15
@@ -107,32 +107,44 @@
|
||||
if ($PAGE->user_allowed_editing()) {
|
||||
if (($edit == 1) and confirm_sesskey()) {
|
||||
$USER->editing = 1;
|
||||
redirect($PAGE->url);
|
||||
// Redirect to site root if Editing is toggled on frontpage
|
||||
if ($course->id == SITEID) {
|
||||
redirect($CFG->wwwroot .'/?redirect=0');
|
||||
} else {
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
} else if (($edit == 0) and confirm_sesskey()) {
|
||||
$USER->editing = 0;
|
||||
if(!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) {
|
||||
$USER->activitycopy = false;
|
||||
$USER->activitycopycourse = NULL;
|
||||
}
|
||||
redirect($PAGE->url);
|
||||
// Redirect to site root if Editing is toggled on frontpage
|
||||
if ($course->id == SITEID) {
|
||||
redirect($CFG->wwwroot .'/?redirect=0');
|
||||
} else {
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
|
||||
if ($hide && confirm_sesskey()) {
|
||||
set_section_visible($course->id, $hide, '0');
|
||||
}
|
||||
if (has_capability('moodle/course:update', $context)) {
|
||||
if ($hide && confirm_sesskey()) {
|
||||
set_section_visible($course->id, $hide, '0');
|
||||
}
|
||||
|
||||
if ($show && confirm_sesskey()) {
|
||||
set_section_visible($course->id, $show, '1');
|
||||
}
|
||||
if ($show && confirm_sesskey()) {
|
||||
set_section_visible($course->id, $show, '1');
|
||||
}
|
||||
|
||||
if (!empty($section)) {
|
||||
if (!empty($move) and confirm_sesskey()) {
|
||||
if (!move_section($course, $section, $move)) {
|
||||
echo $OUTPUT->notification('An error occurred while moving a section');
|
||||
if (!empty($section)) {
|
||||
if (!empty($move) and confirm_sesskey()) {
|
||||
if (!move_section($course, $section, $move)) {
|
||||
echo $OUTPUT->notification('An error occurred while moving a section');
|
||||
}
|
||||
// Clear the navigation cache at this point so that the affects
|
||||
// are seen immediately on the navigation.
|
||||
$PAGE->navigation->clear_cache();
|
||||
}
|
||||
// Clear the navigation cache at this point so that the affects
|
||||
// are seen immediately on the navigation.
|
||||
$PAGE->navigation->clear_cache();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ switch ($action) {
|
||||
case 'unenrol':
|
||||
$ue = $DB->get_record('user_enrolments', array('id'=>required_param('ue', PARAM_INT)), '*', MUST_EXIST);
|
||||
list ($instance, $plugin) = $manager->get_user_enrolment_components($ue);
|
||||
if (!$instance || !$plugin || !$plugin->allow_unenrol($instance) || !has_capability("enrol/$instance->enrol:unenrol", $manager->get_context()) || !$manager->unenrol_user($ue)) {
|
||||
if (!$instance || !$plugin || !$plugin->allow_unenrol_user($instance, $ue) || !has_capability("enrol/$instance->enrol:unenrol", $manager->get_context()) || !$manager->unenrol_user($ue)) {
|
||||
throw new enrol_ajax_exception('unenrolnotpermitted');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -96,5 +96,8 @@ function xmldb_enrol_authorize_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once("$CFG->dirroot/group/lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
$bulkuserop = required_param('bulkuserop', PARAM_ALPHANUMEXT);
|
||||
$userids = required_param('bulkuser', PARAM_INT);
|
||||
$userids = required_param_array('bulkuser', PARAM_INT);
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$filter = optional_param('ifilter', 0, PARAM_INT);
|
||||
|
||||
|
||||
@@ -99,7 +99,9 @@ class enrol_category_handler {
|
||||
|
||||
// now this is going to be a bit slow, take all enrolments in child courses and verify each separately
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext);
|
||||
if (!$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$plugin = enrol_get_plugin('category');
|
||||
|
||||
|
||||
@@ -39,5 +39,8 @@ function xmldb_enrol_database_upgrade($oldversion) {
|
||||
}
|
||||
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+28
-6
@@ -185,7 +185,7 @@ class enrol_database_plugin extends enrol_plugin {
|
||||
|
||||
$existing = array();
|
||||
foreach ($current as $r) {
|
||||
if (in_array($r->id, $roles)) {
|
||||
if (in_array($r->roleid, $roles)) {
|
||||
$existing[$r->roleid] = $r->roleid;
|
||||
} else {
|
||||
role_unassign($r->roleid, $user->id, $context->id, 'enrol_database', $instance->id);
|
||||
@@ -639,22 +639,44 @@ class enrol_database_plugin extends enrol_plugin {
|
||||
if ($createcourses) {
|
||||
require_once("$CFG->dirroot/course/lib.php");
|
||||
|
||||
$template = $this->get_config('templatecourse');
|
||||
$templatecourse = $this->get_config('templatecourse');
|
||||
$defaultcategory = $this->get_config('defaultcategory');
|
||||
|
||||
if ($template) {
|
||||
if ($template = $DB->get_record('course', array('shortname'=>$template))) {
|
||||
$template = false;
|
||||
if ($templatecourse) {
|
||||
if ($template = $DB->get_record('course', array('shortname'=>$templatecourse))) {
|
||||
unset($template->id);
|
||||
unset($template->fullname);
|
||||
unset($template->shortname);
|
||||
unset($template->idnumber);
|
||||
} else {
|
||||
$template = new stdClass();
|
||||
if ($verbose) {
|
||||
mtrace(" can not find template for new course!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (!$template) {
|
||||
$courseconfig = get_config('moodlecourse');
|
||||
$template = new stdClass();
|
||||
$template->summary = '';
|
||||
$template->summaryformat = FORMAT_HTML;
|
||||
$template->format = $courseconfig->format;
|
||||
$template->numsections = $courseconfig->numsections;
|
||||
$template->hiddensections = $courseconfig->hiddensections;
|
||||
$template->newsitems = $courseconfig->newsitems;
|
||||
$template->showgrades = $courseconfig->showgrades;
|
||||
$template->showreports = $courseconfig->showreports;
|
||||
$template->maxbytes = $courseconfig->maxbytes;
|
||||
$template->groupmode = $courseconfig->groupmode;
|
||||
$template->groupmodeforce = $courseconfig->groupmodeforce;
|
||||
$template->visible = $courseconfig->visible;
|
||||
$template->lang = $courseconfig->lang;
|
||||
$template->groupmodeforce = $courseconfig->groupmodeforce;
|
||||
}
|
||||
if (!$DB->record_exists('course_categories', array('id'=>$defaultcategory))) {
|
||||
if ($verbose) {
|
||||
mtrace(" default course category does not exist!");
|
||||
}
|
||||
$categories = $DB->get_records('course_categories', array(), 'sortorder', 'id', 0, 1);
|
||||
$first = reset($categories);
|
||||
$defaultcategory = $first->id;
|
||||
|
||||
@@ -62,6 +62,8 @@ function xmldb_enrol_flatfile_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2010091400, 'enrol', 'flatfile');
|
||||
}
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Guest enrol plugin installation.
|
||||
*
|
||||
* @package enrol
|
||||
* @subpackage guest
|
||||
* @copyright 2011 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_guest_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
// migrate settings during 2.0 upgrade
|
||||
|
||||
// convert all null passwords to empty strings
|
||||
$DB->set_field('enrol', 'password', '', array('enrol'=>'guest', 'password'=>null));
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This file keeps track of upgrades to the guest enrolment plugin
|
||||
*
|
||||
* @package enrol
|
||||
* @subpackage guest
|
||||
* @copyright 2011 Petr Skoda {@link http://skodak.org
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_guest_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
if ($oldversion < 2011112901) {
|
||||
// convert all null passwords to empty strings
|
||||
$DB->set_field('enrol', 'password', '', array('enrol'=>'guest', 'password'=>null));
|
||||
|
||||
upgrade_plugin_savepoint(true, 2011112901, 'enrol', 'guest');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+26
-2
@@ -178,8 +178,12 @@ class enrol_guest_plugin extends enrol_plugin {
|
||||
public function course_edit_form($instance, MoodleQuickForm $mform, $data, $context) {
|
||||
|
||||
$i = isset($instance->id) ? $instance->id : 0;
|
||||
$plugin = enrol_get_plugin('guest');
|
||||
$header = $plugin->get_instance_name($instance);
|
||||
|
||||
if (!$i and !$this->get_config('defaultenrol')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$header = $this->get_instance_name($instance);
|
||||
$config = has_capability('enrol/guest:config', $context);
|
||||
|
||||
$mform->addElement('header', 'enrol_guest_header_'.$i, $header);
|
||||
@@ -230,6 +234,10 @@ class enrol_guest_plugin extends enrol_plugin {
|
||||
|
||||
$i = isset($instance->id) ? $instance->id : 0;
|
||||
|
||||
if (!isset($data['enrol_guest_status_'.$i])) {
|
||||
return $errors;
|
||||
}
|
||||
|
||||
$password = empty($data['enrol_guest_password_'.$i]) ? '' : $data['enrol_guest_password_'.$i];
|
||||
$checkpassword = false;
|
||||
|
||||
@@ -327,6 +335,22 @@ class enrol_guest_plugin extends enrol_plugin {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new instance of enrol plugin.
|
||||
* @param object $course
|
||||
* @param array instance fields
|
||||
* @return int id of new instance, null if can not be created
|
||||
*/
|
||||
public function add_instance($course, array $fields = NULL) {
|
||||
$fields = (array)$fields;
|
||||
|
||||
if (!isset($fields['password'])) {
|
||||
$fields['password'] = '';
|
||||
}
|
||||
|
||||
return parent::add_instance($course, $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new instance of enrol plugin with default settings.
|
||||
* @param object $course
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011112900; // Requires this Moodle version
|
||||
$plugin->component = 'enrol_guest'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -83,6 +83,9 @@ function xmldb_enrol_imsenterprise_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -315,9 +315,12 @@ function process_group_tag($tagcontents) {
|
||||
if (preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $tagcontents, $matches)) {
|
||||
$group->coursecode = trim($matches[1]);
|
||||
}
|
||||
if (preg_match('{<description>.*?<short>(.*?)</short>.*?</description>}is', $tagcontents, $matches)) {
|
||||
if (preg_match('{<description>.*?<long>(.*?)</long>.*?</description>}is', $tagcontents, $matches)){
|
||||
$group->description = trim($matches[1]);
|
||||
}
|
||||
if (preg_match('{<description>.*?<short>(.*?)</short>.*?</description>}is', $tagcontents, $matches)) {
|
||||
$group->shortName = trim($matches[1]);
|
||||
}
|
||||
if (preg_match('{<org>.*?<orgunit>(.*?)</orgunit>.*?</org>}is', $tagcontents, $matches)) {
|
||||
$group->category = trim($matches[1]);
|
||||
}
|
||||
@@ -355,11 +358,25 @@ function process_group_tag($tagcontents) {
|
||||
if (!$createnewcourses) {
|
||||
$this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
|
||||
} else {
|
||||
// Set shortname to description or description to shortname if one is set but not the other.
|
||||
$nodescription = !isset($group->description);
|
||||
$noshortname = !isset($group->shortName);
|
||||
if ( $nodescription && $noshortname) {
|
||||
// If neither short nor long description are set let if fail
|
||||
$this->log_line("Neither long nor short name are set for $coursecode");
|
||||
} else if ($nodescription) {
|
||||
// If short and ID exist, then give the long short's value, then give short the ID's value
|
||||
$group->description = $group->shortName;
|
||||
$group->shortName = $coursecode;
|
||||
} else if ($noshortname) {
|
||||
// If long and ID exist, then map long to long, then give short the ID's value.
|
||||
$group->shortName = $coursecode;
|
||||
}
|
||||
// Create the (hidden) course(s) if not found
|
||||
$courseconfig = get_config('moodlecourse'); // Load Moodle Course shell defaults
|
||||
$course = new stdClass();
|
||||
$course->fullname = $group->description;
|
||||
$course->shortname = $coursecode;
|
||||
$course->shortname = $group->shortName;;
|
||||
$course->idnumber = $coursecode;
|
||||
$course->format = $courseconfig->format;
|
||||
$course->visible = $courseconfig->visible;
|
||||
@@ -403,6 +420,10 @@ function process_group_tag($tagcontents) {
|
||||
|
||||
$courseid = $DB->insert_record('course', $course);
|
||||
|
||||
// Setup default enrolment plugins
|
||||
$course->id = $courseid;
|
||||
enrol_course_updated(true, $course, null);
|
||||
|
||||
// Setup the blocks
|
||||
$course = $DB->get_record('course', array('id' => $courseid));
|
||||
blocks_add_default_course_blocks($course);
|
||||
|
||||
+6
-9
@@ -98,7 +98,6 @@ if ($canconfig and $action and confirm_sesskey()) {
|
||||
|
||||
if ($confirm) {
|
||||
$plugin->delete_instance($instance);
|
||||
$context->mark_dirty(); // invalidate all enrol caches
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
|
||||
@@ -113,19 +112,17 @@ if ($canconfig and $action and confirm_sesskey()) {
|
||||
|
||||
} else if ($action === 'disable') {
|
||||
$instance = $instances[$instanceid];
|
||||
if ($instance->status == ENROL_INSTANCE_ENABLED) {
|
||||
$instance->status = ENROL_INSTANCE_DISABLED;
|
||||
$DB->update_record('enrol', $instance);
|
||||
$context->mark_dirty(); // invalidate all enrol caches
|
||||
$plugin = $plugins[$instance->enrol];
|
||||
if ($instance->status != ENROL_INSTANCE_DISABLED) {
|
||||
$plugin->update_status($instance, ENROL_INSTANCE_DISABLED);
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
|
||||
} else if ($action === 'enable') {
|
||||
$instance = $instances[$instanceid];
|
||||
if ($instance->status == ENROL_INSTANCE_DISABLED) {
|
||||
$instance->status = ENROL_INSTANCE_ENABLED;
|
||||
$DB->update_record('enrol', $instance);
|
||||
$context->mark_dirty(); // invalidate all enrol caches
|
||||
$plugin = $plugins[$instance->enrol];
|
||||
if ($instance->status != ENROL_INSTANCE_ENABLED) {
|
||||
$plugin->update_status($instance, ENROL_INSTANCE_ENABLED);
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
|
||||
+21
-3
@@ -885,16 +885,34 @@ class enrol_ldap_plugin extends enrol_plugin {
|
||||
require_once("$CFG->dirroot/course/lib.php");
|
||||
|
||||
// Override defaults with template course
|
||||
$course = new stdClass();
|
||||
$template = false;
|
||||
if ($this->get_config('template')) {
|
||||
if($template = $DB->get_record('course', array('shortname'=>$this->get_config('template')))) {
|
||||
if ($template = $DB->get_record('course', array('shortname'=>$this->get_config('template')))) {
|
||||
unset($template->id); // So we are clear to reinsert the record
|
||||
unset($template->fullname);
|
||||
unset($template->shortname);
|
||||
unset($template->idnumber);
|
||||
$course = $template;
|
||||
}
|
||||
}
|
||||
if (!$template) {
|
||||
$courseconfig = get_config('moodlecourse');
|
||||
$template = new stdClass();
|
||||
$template->summary = '';
|
||||
$template->summaryformat = FORMAT_HTML;
|
||||
$template->format = $courseconfig->format;
|
||||
$template->numsections = $courseconfig->numsections;
|
||||
$template->hiddensections = $courseconfig->hiddensections;
|
||||
$template->newsitems = $courseconfig->newsitems;
|
||||
$template->showgrades = $courseconfig->showgrades;
|
||||
$template->showreports = $courseconfig->showreports;
|
||||
$template->maxbytes = $courseconfig->maxbytes;
|
||||
$template->groupmode = $courseconfig->groupmode;
|
||||
$template->groupmodeforce = $courseconfig->groupmodeforce;
|
||||
$template->visible = $courseconfig->visible;
|
||||
$template->lang = $courseconfig->lang;
|
||||
$template->groupmodeforce = $courseconfig->groupmodeforce;
|
||||
}
|
||||
$course = $template;
|
||||
|
||||
$course->category = $this->get_config('category');
|
||||
if (!$DB->record_exists('course_categories', array('id'=>$this->get_config('category')))) {
|
||||
|
||||
@@ -56,7 +56,7 @@ if ($ADMIN->fulltree) {
|
||||
//--- role mapping settings ---
|
||||
$settings->add(new admin_setting_heading('enrol_ldap_roles', get_string('roles', 'enrol_ldap'), ''));
|
||||
if (!during_initial_install()) {
|
||||
$settings->add(new admin_setting_ldap_rolemapping('enrol_ldap/role_mapping', get_string ('role_mapping_key', 'enrol_ldap', $role->name), get_string ('role_mapping', 'enrol_ldap'), ''));
|
||||
$settings->add(new admin_setting_ldap_rolemapping('enrol_ldap/role_mapping', get_string ('role_mapping_key', 'enrol_ldap'), get_string ('role_mapping', 'enrol_ldap'), ''));
|
||||
}
|
||||
$options = $yesno;
|
||||
$settings->add(new admin_setting_configselect('enrol_ldap/course_search_sub', get_string('course_search_sub_key', 'enrol_ldap'), get_string('course_search_sub', 'enrol_ldap'), 0, $options));
|
||||
|
||||
+1
-1
@@ -506,7 +506,7 @@ class course_enrolment_manager {
|
||||
public function unenrol_user($ue) {
|
||||
global $DB;
|
||||
list ($instance, $plugin) = $this->get_user_enrolment_components($ue);
|
||||
if ($instance && $plugin && $plugin->allow_unenrol($instance) && has_capability("enrol/$instance->enrol:unenrol", $this->context)) {
|
||||
if ($instance && $plugin && $plugin->allow_unenrol_user($instance, $ue) && has_capability("enrol/$instance->enrol:unenrol", $this->context)) {
|
||||
$plugin->unenrol_user($instance, $ue->userid);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
*
|
||||
* By defaults looks for manage.php file and tests for manage capability.
|
||||
*
|
||||
* @param object $instance
|
||||
* @param navigation_node $instancesnode
|
||||
* @param stdClass $instance
|
||||
* @return moodle_url;
|
||||
*/
|
||||
public function add_course_navigation($instancesnode, stdClass $instance) {
|
||||
@@ -263,8 +264,8 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
$instance = $ue->enrolmentinstance;
|
||||
$params = $manager->get_moodlepage()->url->params();
|
||||
$params['ue'] = $ue->id;
|
||||
if ($this->allow_unenrol($instance) && has_capability("enrol/manual:unenrol", $context)) {
|
||||
$url = new moodle_url('/enrol/manual/unenroluser.php', $params);
|
||||
if ($this->allow_unenrol_user($instance, $ue) && has_capability("enrol/manual:unenrol", $context)) {
|
||||
$url = new moodle_url('/enrol/unenroluser.php', $params);
|
||||
$actions[] = new user_enrolment_action(new pix_icon('t/delete', ''), get_string('unenrol', 'enrol'), $url, array('class'=>'unenrollink', 'rel'=>$ue->id));
|
||||
}
|
||||
if ($this->allow_manage($instance) && has_capability("enrol/manual:manage", $context)) {
|
||||
@@ -276,6 +277,7 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
|
||||
/**
|
||||
* The manual plugin has several bulk operations that can be performed
|
||||
* @param course_enrolment_manager $manager
|
||||
* @return array
|
||||
*/
|
||||
public function get_bulk_operations(course_enrolment_manager $manager) {
|
||||
|
||||
@@ -348,7 +348,7 @@ class enrol_manual_deleteselectedusers_operation extends enrol_bulk_enrolment_op
|
||||
foreach ($user->enrolments as $enrolment) {
|
||||
$plugin = $enrolment->enrolmentplugin;
|
||||
$instance = $enrolment->enrolmentinstance;
|
||||
if ($plugin->allow_unenrol($instance)) {
|
||||
if ($plugin->allow_unenrol_user($instance, $enrolment)) {
|
||||
$plugin->unenrol_user($instance, $user->id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Unenrol a user who was enrolled through a manual enrolment.
|
||||
*
|
||||
* Please note when unenrolling a user all of their grades are removed as well.
|
||||
*
|
||||
* @package enrol
|
||||
* @subpackage manual
|
||||
* @copyright 2011 Sam Hemelryk
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require('../../config.php');
|
||||
require_once("$CFG->dirroot/enrol/locallib.php");
|
||||
require_once("$CFG->dirroot/enrol/renderer.php");
|
||||
|
||||
$ueid = required_param('ue', PARAM_INT); // user enrolment id
|
||||
$filter = optional_param('ifilter', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', false, PARAM_BOOL);
|
||||
|
||||
// Get the user enrolment object
|
||||
$ue = $DB->get_record('user_enrolments', array('id' => $ueid), '*', MUST_EXIST);
|
||||
// Get the user for whom the enrolment is
|
||||
$user = $DB->get_record('user', array('id'=>$ue->userid), '*', MUST_EXIST);
|
||||
// Get the course the enrolment is to
|
||||
list($ctxsql, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
|
||||
$sql = "SELECT c.* $ctxsql
|
||||
FROM {course} c
|
||||
LEFT JOIN {enrol} e ON e.courseid = c.id
|
||||
$ctxjoin
|
||||
WHERE e.id = :enrolid";
|
||||
$params = array('enrolid' => $ue->enrolid);
|
||||
$course = $DB->get_record_sql($sql, $params, MUST_EXIST);
|
||||
context_instance_preload($course);
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
redirect(new moodle_url('/'));
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
require_capability("enrol/manual:unenrol", get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST));
|
||||
|
||||
$manager = new course_enrolment_manager($PAGE, $course, $filter);
|
||||
$table = new course_enrolment_users_table($manager, $PAGE);
|
||||
|
||||
// The URL of the enrolled users page for the course.
|
||||
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
|
||||
// The URl to return the user too after this screen.
|
||||
$returnurl = new moodle_url($usersurl, $manager->get_url_params()+$table->get_url_params());
|
||||
// The URL of this page
|
||||
$url = new moodle_url('/enrol/manual/unenroluser.php', $returnurl->params());
|
||||
$url->param('ue', $ueid);
|
||||
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
navigation_node::override_active_url($usersurl);
|
||||
|
||||
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
|
||||
if (!$plugin->allow_unenrol($instance) || $instance->enrol != 'manual' || !($plugin instanceof enrol_manual_plugin)) {
|
||||
print_error('erroreditenrolment', 'enrol');
|
||||
}
|
||||
|
||||
// If the unenrolment has been confirmed and the sesskey is valid unenrol the user.
|
||||
if ($confirm && confirm_sesskey() && $manager->unenrol_user($ue)) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
$yesurl = new moodle_url($PAGE->url, array('confirm'=>1, 'sesskey'=>sesskey()));
|
||||
$message = get_string('unenroluser', 'enrol_manual', array('user'=>fullname($user, true), 'course'=>format_string($course->fullname)));
|
||||
$fullname = fullname($user);
|
||||
$title = get_string('unenrol', 'enrol_manual');
|
||||
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($title);
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->navbar->add($fullname);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($fullname);
|
||||
echo $OUTPUT->confirm($message, $yesurl, $returnurl);
|
||||
echo $OUTPUT->footer();
|
||||
@@ -39,5 +39,8 @@ function xmldb_enrol_mnet_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,5 +62,8 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -363,7 +363,7 @@ class enrol_self_plugin extends enrol_plugin {
|
||||
$params = $manager->get_moodlepage()->url->params();
|
||||
$params['ue'] = $ue->id;
|
||||
if ($this->allow_unenrol($instance) && has_capability("enrol/self:unenrol", $context)) {
|
||||
$url = new moodle_url('/enrol/self/unenroluser.php', $params);
|
||||
$url = new moodle_url('/enrol/unenroluser.php', $params);
|
||||
$actions[] = new user_enrolment_action(new pix_icon('t/delete', ''), get_string('unenrol', 'enrol'), $url, array('class'=>'unenrollink', 'rel'=>$ue->id));
|
||||
}
|
||||
if ($this->allow_manage($instance) && has_capability("enrol/self:manage", $context)) {
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Unenrol a user who was enrolled through a self enrolment.
|
||||
*
|
||||
* @package enrol
|
||||
* @subpackage self
|
||||
* @copyright 2011 Sam Hemelryk
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require('../../config.php');
|
||||
require_once("$CFG->dirroot/enrol/locallib.php");
|
||||
require_once("$CFG->dirroot/enrol/renderer.php");
|
||||
|
||||
$ueid = required_param('ue', PARAM_INT); // user enrolment id
|
||||
$filter = optional_param('ifilter', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', false, PARAM_BOOL);
|
||||
|
||||
// Get the user enrolment object
|
||||
$ue = $DB->get_record('user_enrolments', array('id' => $ueid), '*', MUST_EXIST);
|
||||
// Get the user for whom the enrolment is
|
||||
$user = $DB->get_record('user', array('id'=>$ue->userid), '*', MUST_EXIST);
|
||||
// Get the course the enrolment is to
|
||||
list($ctxsql, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
|
||||
$sql = "SELECT c.* $ctxsql
|
||||
FROM {course} c
|
||||
LEFT JOIN {enrol} e ON e.courseid = c.id
|
||||
$ctxjoin
|
||||
WHERE e.id = :enrolid";
|
||||
$params = array('enrolid' => $ue->enrolid);
|
||||
$course = $DB->get_record_sql($sql, $params, MUST_EXIST);
|
||||
context_instance_preload($course);
|
||||
|
||||
// Make sure it's not the front page
|
||||
if ($course->id == SITEID) {
|
||||
redirect(new moodle_url('/'));
|
||||
}
|
||||
|
||||
// Obviously
|
||||
require_login($course);
|
||||
// Make sure the user can unenrol self enrolled users.
|
||||
require_capability("enrol/self:unenrol", get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
|
||||
// Get the enrolment manager for this course
|
||||
$manager = new course_enrolment_manager($PAGE, $course, $filter);
|
||||
// Get an enrolment users table object. Doign this will automatically retrieve the the URL params
|
||||
// relating to table the user was viewing before coming here, and allows us to return the user to the
|
||||
// exact page of the users screen they can from.
|
||||
$table = new course_enrolment_users_table($manager, $PAGE);
|
||||
|
||||
// The URL of the enrolled users page for the course.
|
||||
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
|
||||
// The URl to return the user too after this screen.
|
||||
$returnurl = new moodle_url($usersurl, $manager->get_url_params()+$table->get_url_params());
|
||||
// The URL of this page
|
||||
$url = new moodle_url('/enrol/self/unenroluser.php', $returnurl->params());
|
||||
$url->param('ue', $ueid);
|
||||
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
navigation_node::override_active_url($usersurl);
|
||||
|
||||
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
|
||||
if (!$plugin->allow_unenrol($instance) || $instance->enrol != 'self' || !($plugin instanceof enrol_self_plugin)) {
|
||||
print_error('erroreditenrolment', 'enrol');
|
||||
}
|
||||
|
||||
// If the unenrolment has been confirmed and the sesskey is valid unenrol the user.
|
||||
if ($confirm && confirm_sesskey() && $manager->unenrol_user($ue)) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
$yesurl = new moodle_url($PAGE->url, array('confirm'=>1, 'sesskey'=>sesskey()));
|
||||
$message = get_string('unenroluser', 'enrol_self', array('user' => fullname($user, true), 'course' => format_string($course->fullname)));
|
||||
$fullname = fullname($user);
|
||||
$title = get_string('unenrol', 'enrol_self');
|
||||
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($title);
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->navbar->add($fullname);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($fullname);
|
||||
echo $OUTPUT->confirm($message, $yesurl, $returnurl);
|
||||
echo $OUTPUT->footer();
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Completely unenrol a user from a course.
|
||||
*
|
||||
* Please note when unenrolling a user all of their grades are removed as well,
|
||||
* most ppl actually expect enrolments to be suspended only...
|
||||
*
|
||||
* @package core
|
||||
* @subpackage enrol
|
||||
* @copyright 2011 Petr skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require('../config.php');
|
||||
require_once("$CFG->dirroot/enrol/locallib.php");
|
||||
require_once("$CFG->dirroot/enrol/renderer.php");
|
||||
|
||||
$ueid = required_param('ue', PARAM_INT); // user enrolment id
|
||||
$confirm = optional_param('confirm', false, PARAM_BOOL);
|
||||
$filter = optional_param('ifilter', 0, PARAM_INT);
|
||||
|
||||
$ue = $DB->get_record('user_enrolments', array('id' => $ueid), '*', MUST_EXIST);
|
||||
$user = $DB->get_record('user', array('id'=>$ue->userid), '*', MUST_EXIST);
|
||||
$instance = $DB->get_record('enrol', array('id'=>$ue->enrolid), '*', MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
|
||||
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
// set up PAGE url first!
|
||||
$PAGE->set_url('/enrol/unenroluser.php', array('ue'=>$ueid, 'ifilter'=>$filter));
|
||||
|
||||
require_login($course);
|
||||
|
||||
if (!enrol_is_enabled($instance->enrol)) {
|
||||
print_error('erroreditenrolment', 'enrol');
|
||||
}
|
||||
|
||||
$plugin = enrol_get_plugin($instance->enrol);
|
||||
|
||||
if (!$plugin->allow_unenrol_user($instance, $ue) or !has_capability("enrol/$instance->enrol:unenrol", $context)) {
|
||||
print_error('erroreditenrolment', 'enrol');
|
||||
}
|
||||
|
||||
$manager = new course_enrolment_manager($PAGE, $course, $filter);
|
||||
$table = new course_enrolment_users_table($manager, $PAGE);
|
||||
|
||||
$returnurl = new moodle_url('/enrol/users.php', array('id' => $course->id)+$manager->get_url_params()+$table->get_url_params());
|
||||
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
|
||||
|
||||
$PAGE->set_pagelayout('admin');
|
||||
navigation_node::override_active_url($usersurl);
|
||||
|
||||
// If the unenrolment has been confirmed and the sesskey is valid unenrol the user.
|
||||
if ($confirm && confirm_sesskey()) {
|
||||
$plugin->unenrol_user($instance, $ue->userid);
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
$yesurl = new moodle_url($PAGE->url, array('confirm'=>1, 'sesskey'=>sesskey()));
|
||||
$message = get_string('unenrolconfirm', 'core_enrol', array('user'=>fullname($user, true), 'course'=>format_string($course->fullname)));
|
||||
$fullname = fullname($user);
|
||||
$title = get_string('unenrol', 'core_enrol');
|
||||
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($title);
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->navbar->add($fullname);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($fullname);
|
||||
echo $OUTPUT->confirm($message, $yesurl, $returnurl);
|
||||
echo $OUTPUT->footer();
|
||||
+3
-2
@@ -81,8 +81,9 @@ Y.extend(DIALOGUE, Y.Overlay, {
|
||||
if (hidden) {
|
||||
bb.setStyle('top', '-1000px').removeClass(DIALOGUE_PREFIX+'-hidden');
|
||||
}
|
||||
var x = Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2);
|
||||
var y = Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2)+Y.one(window).get('scrollTop');
|
||||
var x = Math.max(Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2), 15);
|
||||
var y = Math.max(Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2), 15) + Y.one(window).get('scrollTop');
|
||||
|
||||
if (hidden) {
|
||||
bb.addClass(DIALOGUE_PREFIX+'-hidden');
|
||||
}
|
||||
|
||||
@@ -46,5 +46,8 @@ function xmldb_filter_mediaplugin_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,5 +41,8 @@ function xmldb_filter_tex_upgrade($oldversion) {
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,5 +35,8 @@ function xmldb_gradingform_rubric_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+8
-1
@@ -626,6 +626,7 @@ class grade_plugin_info {
|
||||
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
|
||||
* @param string $bodytags Additional attributes that will be added to the <body> tag
|
||||
* @param string $buttons Additional buttons to display on the page
|
||||
* @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
|
||||
*
|
||||
* @return string HTML code or nothing if $return == false
|
||||
*/
|
||||
@@ -673,7 +674,13 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null,
|
||||
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
|
||||
$returnval .= print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return);
|
||||
}
|
||||
$returnval .= $OUTPUT->heading($heading);
|
||||
|
||||
if ($return) {
|
||||
$returnval .= $OUTPUT->heading($heading);
|
||||
} else {
|
||||
echo $OUTPUT->heading($heading);
|
||||
}
|
||||
|
||||
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
|
||||
$returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
|
||||
}
|
||||
|
||||
@@ -627,7 +627,7 @@ class grade_report_grader extends grade_report {
|
||||
$usercell->scope = 'row';
|
||||
|
||||
if ($showuserimage) {
|
||||
$usercell->text = $OUTPUT->container($OUTPUT->user_picture($user), 'userpic');
|
||||
$usercell->text = $OUTPUT->user_picture($user);
|
||||
}
|
||||
|
||||
$usercell->text .= html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), fullname($user));
|
||||
|
||||
@@ -269,16 +269,12 @@ table#user-grades td.topleft {
|
||||
background-color:#fff;
|
||||
}
|
||||
|
||||
.path-grade-report-grader div.userpic {
|
||||
margin-right:10px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.path-grade-report-grader div.userpic img {
|
||||
.path-grade-report-grader th.user img {
|
||||
border:3px double #cecece;
|
||||
vertical-align:middle;
|
||||
vertical-align:top;
|
||||
width:2.7em;
|
||||
height:2.7em;
|
||||
margin-right:10px;
|
||||
}
|
||||
|
||||
.path-grade-report-grader a.quickedit {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user