|
8 | 8 | */ |
9 | 9 | defined('MOODLE_INTERNAL') || die; |
10 | 10 |
|
11 | | -// settings.php may be called several times |
12 | | -if(!function_exists('t')) |
13 | | -{ |
14 | | - function t($name) |
15 | | - { |
| 11 | +if ($ADMIN->fulltree) { |
| 12 | + $t = function($name) { |
16 | 13 | return get_string($name, 'ratingallocate'); |
17 | | - } |
18 | | - } |
| 14 | + }; |
19 | 15 |
|
20 | | -if ($ADMIN->fulltree) { |
21 | | - $settings->add(new admin_setting_heading('ratingallocate_general', t('general'), '')); |
22 | | - $options = ['edmonds_karp' => t('edmonds_karp'), |
23 | | - 'ford_fulkerson' => t('ford_fulkerson'), |
24 | | - 'lp' => t('lp')]; |
25 | | - $settings->add(new admin_setting_configselect('ratingallocate_solver', t('solver'), t('solver_description'), 'edmonds_karp', $options)); |
| 16 | + $settings->add(new admin_setting_heading('ratingallocate_general', $t('general'), '')); |
| 17 | + $options = ['edmonds_karp' => $t('edmonds_karp'), |
| 18 | + 'ford_fulkerson' => $t('ford_fulkerson'), |
| 19 | + 'lp' => $t('lp')]; |
| 20 | + $settings->add(new admin_setting_configselect('ratingallocate_solver', $t('solver'), $t('solver_description'), 'edmonds_karp', $options)); |
26 | 21 | $settings->add(new admin_setting_configtext('ratingallocate_algorithm_timeout', get_string('algorithmtimeout', 'ratingallocate'), |
27 | 22 | get_string('configalgorithmtimeout', 'ratingallocate'), 600, PARAM_INT)); |
28 | 23 |
|
29 | | - $settings->add(new admin_setting_heading('ratingallocate_lp', t('lp'), '')); |
30 | | - $options = ['scip' => t('scip'), |
31 | | - 'cplex' => t('cplex')]; |
32 | | - $settings->add(new admin_setting_configselect('ratingallocate_engine', t('engine'), t('engine_description'), 'scip', $options)); |
33 | | - $options = ['local' => t('local'), |
34 | | - 'ssh' => t('ssh'), |
35 | | - 'webservice' => t('webservice')]; |
36 | | - $settings->add(new admin_setting_configselect('ratingallocate_executor', t('executor'), t('executor_description'), 'local', $options)); |
| 24 | + $settings->add(new admin_setting_heading('ratingallocate_lp', $t('lp'), '')); |
| 25 | + $options = ['scip' => $t('scip'), |
| 26 | + 'cplex' => $t('cplex')]; |
| 27 | + $settings->add(new admin_setting_configselect('ratingallocate_engine', $t('engine'), $t('engine_description'), 'scip', $options)); |
| 28 | + $options = ['local' => $t('local'), |
| 29 | + 'ssh' => $t('ssh'), |
| 30 | + 'webservice' => $t('webservice')]; |
| 31 | + $settings->add(new admin_setting_configselect('ratingallocate_executor', $t('executor'), $t('executor_description'), 'local', $options)); |
| 32 | + |
| 33 | + $settings->add(new admin_setting_heading('ratingallocate_webservice', $t('webservice'), $t('webservice_description'))); |
| 34 | + $settings->add(new admin_setting_configpasswordunmask('ratingallocate_secret', $t('secret'), $t('secret_description'), '', PARAM_TEXT)); |
| 35 | + $settings->add(new admin_setting_configtext('ratingallocate_uri', $t('uri'), $t('uri_description'), 'http://localhost/moodle-mod_ratingallocate/webservice', PARAM_TEXT)); |
37 | 36 |
|
38 | | - $settings->add(new admin_setting_heading('ratingallocate_webservice', t('webservice'), t('webservice_description'))); |
39 | | - $settings->add(new admin_setting_configpasswordunmask('ratingallocate_secret', t('secret'), t('secret_description'), '', PARAM_TEXT)); |
40 | | - $settings->add(new admin_setting_configtext('ratingallocate_uri', t('uri'), t('uri_description'), 'http://localhost/moodle-mod_ratingallocate/webservice', PARAM_TEXT)); |
| 37 | + $settings->add(new admin_setting_heading('ratingallocate_ssh', $t('ssh'), $t('ssh_description'))); |
| 38 | + $settings->add(new admin_setting_configtext('ratingallocate_ssh_address', $t('ssh_address'), $t('ssh_address_description'), null, PARAM_TEXT)); |
| 39 | + $settings->add(new admin_setting_configtext('ratingallocate_ssh_username', $t('ssh_username'), $t('ssh_username_description'), null, PARAM_TEXT)); |
| 40 | + $settings->add(new admin_setting_configpasswordunmask('ratingallocate_ssh_password', $t('ssh_password'), $t('ssh_password_description'), null, PARAM_TEXT)); |
41 | 41 |
|
42 | | - $settings->add(new admin_setting_heading('ratingallocate_ssh', t('ssh'), t('ssh_description'))); |
43 | | - $settings->add(new admin_setting_configtext('ratingallocate_ssh_address', t('ssh_address'), t('ssh_address_description'), null, PARAM_TEXT)); |
44 | | - $settings->add(new admin_setting_configtext('ratingallocate_ssh_username', t('ssh_username'), t('ssh_username_description'), null, PARAM_TEXT)); |
45 | | - $settings->add(new admin_setting_configpasswordunmask('ratingallocate_ssh_password', t('ssh_password'), t('ssh_password_description'), null, PARAM_TEXT)); |
| 42 | + unset($t); |
46 | 43 | } |
0 commit comments