2023-05-17 21:19:14 +02:00
|
|
|
<?php
|
2023-08-24 23:02:41 +02:00
|
|
|
// This file is part of Moodle - http://moodle.org/.
|
2023-05-17 21:19:14 +02:00
|
|
|
//
|
2023-08-24 23:02:41 +02:00
|
|
|
// 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.
|
2023-05-17 21:19:14 +02:00
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
2023-08-24 23:02:41 +02:00
|
|
|
// 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.
|
2023-05-17 21:19:14 +02:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
2023-08-24 23:02:41 +02:00
|
|
|
// You should have received a copy of the GNU General Public License.
|
2023-05-17 21:19:14 +02:00
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Local plugin "Boost navigation fumbling" - Settings
|
|
|
|
*
|
|
|
|
* @package local_chronotable
|
|
|
|
* @copyright 2017 Alexander Bias, Ulm University <alexander.bias@uni-ulm.de>
|
2023-08-24 23:02:41 +02:00
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
2023-05-17 21:19:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
|
|
|
|
use local_treestudyplan\aggregator;
|
|
|
|
|
|
|
|
if ($hassiteconfig) {
|
|
|
|
|
2023-06-19 22:48:33 +02:00
|
|
|
/**************************************
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
2023-06-19 22:48:33 +02:00
|
|
|
* Main studyplan settings
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
|
|
|
*************************************/
|
2023-05-17 21:19:14 +02:00
|
|
|
|
|
|
|
// Create admin settings category.
|
|
|
|
$ADMIN->add('courses', new admin_category('local_treestudyplan',
|
|
|
|
get_string('pluginname', 'local_treestudyplan', null, true)));
|
|
|
|
|
|
|
|
// Settings page: Root nodes.
|
|
|
|
$page = new admin_settingpage('local_treestudyplan_settings',
|
|
|
|
get_string('settingspage', 'local_treestudyplan', null, true));
|
|
|
|
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// GOAL AGGREGATION SETTINGS.
|
2023-05-17 21:19:14 +02:00
|
|
|
$page->add(new admin_setting_heading('local_treestudyplan/aggregation_heading',
|
|
|
|
get_string('setting_aggregation_heading', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_aggregation_heading', 'local_treestudyplan')
|
|
|
|
));
|
|
|
|
|
|
|
|
$aggregators = [];
|
2023-08-24 23:02:41 +02:00
|
|
|
foreach (aggregator::list() as $a) {
|
|
|
|
$aggregators[$a] = get_string("{$a}_aggregator_title", 'local_treestudyplan', null, true);
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$page->add(new admin_setting_configselect('local_treestudyplan/aggregation_mode',
|
|
|
|
get_string('setting_aggregation_mode', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_aggregation_mode', 'local_treestudyplan'),
|
2023-07-03 23:28:46 +02:00
|
|
|
"core",
|
2023-05-17 21:19:14 +02:00
|
|
|
$aggregators
|
|
|
|
));
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// DISPLAY COURSE INFO SETTINGS.
|
2023-05-17 21:19:14 +02:00
|
|
|
$page->add(new admin_setting_heading('local_treestudyplan/display_heading',
|
|
|
|
get_string('setting_display_heading', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_display_heading', 'local_treestudyplan')
|
|
|
|
));
|
|
|
|
|
|
|
|
$displayfields = ["shortname" => get_string("shortname"), "idnumber" => get_string("idnumber")];
|
|
|
|
$handler = \core_customfield\handler::get_handler('core_course', 'course');
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
foreach ($handler->get_categories_with_fields() as $cat) {
|
2023-05-17 21:19:14 +02:00
|
|
|
$catname = $cat->get_formatted_name();
|
2023-08-24 23:02:41 +02:00
|
|
|
foreach ($cat->get_fields() as $field) {
|
2023-05-17 21:19:14 +02:00
|
|
|
$fieldname = $field->get_formatted_name();
|
|
|
|
$fieldid = $field->get("shortname");
|
|
|
|
$displayfields["customfield_".$fieldid] = $catname.": ".$fieldname;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$page->add(new admin_setting_configselect('local_treestudyplan/display_field',
|
|
|
|
get_string('setting_display_field', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_display_field', 'local_treestudyplan'),
|
|
|
|
"shortname",
|
|
|
|
$displayfields
|
|
|
|
));
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// BISTATE AGGREGATON DEFAULTS.
|
2023-05-17 21:19:14 +02:00
|
|
|
$page->add(new admin_setting_heading('local_treestudyplan/bistate_aggregation_heading',
|
|
|
|
get_string('setting_bistate_heading', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_bistate_heading', 'local_treestudyplan')
|
|
|
|
));
|
|
|
|
|
|
|
|
$page->add(new admin_setting_configtext('local_treestudyplan/bistate_thresh_excellent',
|
|
|
|
get_string('setting_bistate_thresh_excellent', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_bistate_thresh_excellent', 'local_treestudyplan'),
|
|
|
|
"100",
|
|
|
|
PARAM_INT
|
|
|
|
));
|
|
|
|
|
|
|
|
$page->add(new admin_setting_configtext('local_treestudyplan/bistate_thresh_good',
|
|
|
|
get_string('setting_bistate_thresh_good', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_bistate_thresh_good', 'local_treestudyplan'),
|
|
|
|
"80",
|
|
|
|
PARAM_INT
|
|
|
|
));
|
|
|
|
|
|
|
|
$page->add(new admin_setting_configtext('local_treestudyplan/bistate_thresh_completed',
|
|
|
|
get_string('setting_bistate_thresh_completed', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_bistate_thresh_completed', 'local_treestudyplan'),
|
|
|
|
"66",
|
|
|
|
PARAM_INT
|
|
|
|
));
|
|
|
|
|
|
|
|
$page->add(new admin_setting_configcheckbox('local_treestudyplan/bistate_support_failed',
|
|
|
|
get_string('setting_bistate_support_failed', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_bistate_support_failed', 'local_treestudyplan'),
|
|
|
|
True,
|
|
|
|
));
|
|
|
|
|
|
|
|
$page->add(new admin_setting_configcheckbox('local_treestudyplan/bistate_accept_pending_submitted',
|
|
|
|
get_string('setting_bistate_accept_pending_submitted', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_bistate_accept_pending_submitted', 'local_treestudyplan'),
|
|
|
|
False,
|
|
|
|
));
|
|
|
|
|
|
|
|
// Add settings page to the admin settings category.
|
|
|
|
$ADMIN->add('local_treestudyplan', $page);
|
2023-06-19 22:48:33 +02:00
|
|
|
|
|
|
|
/**************************************
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
2023-06-19 22:48:33 +02:00
|
|
|
* Manage plans link (systemwide)
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
|
|
|
*************************************/
|
2023-06-19 22:48:33 +02:00
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
$ADMIN->add('local_treestudyplan', new admin_externalpage(
|
|
|
|
'local_treestudyplan_editplans',
|
|
|
|
get_string('cfg_plans', 'local_treestudyplan', null, true),
|
|
|
|
$CFG->wwwroot . '/local/treestudyplan/edit-plan.php'));
|
2023-06-19 22:48:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**************************************
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
|
|
|
* Settings page: Cohort sync
|
|
|
|
*
|
|
|
|
*************************************/
|
2023-06-19 22:48:33 +02:00
|
|
|
|
2023-08-25 09:33:42 +02:00
|
|
|
$pagecsync = new admin_settingpage('local_treestudyplan_settings_cohortsync',
|
2023-06-19 22:48:33 +02:00
|
|
|
get_string('settingspage_csync', 'local_treestudyplan', null, true));
|
|
|
|
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// Description heading.
|
2023-08-25 09:33:42 +02:00
|
|
|
$pagecsync->add(new admin_setting_heading('local_treestudyplan/csync_heading',
|
2023-06-19 22:48:33 +02:00
|
|
|
get_string('setting_csync_heading', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_csync_heading', 'local_treestudyplan')
|
|
|
|
));
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// Enable/disable cohort sync.
|
2023-08-25 09:33:42 +02:00
|
|
|
$pagecsync->add(new admin_setting_configcheckbox('local_treestudyplan/csync_enable',
|
2023-06-19 22:48:33 +02:00
|
|
|
get_string('setting_csync_enable_field', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_csync_enable_field', 'local_treestudyplan'),
|
|
|
|
false
|
|
|
|
));
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// Enable/disable autoremove.
|
2023-08-25 09:33:42 +02:00
|
|
|
$pagecsync->add(new admin_setting_configcheckbox('local_treestudyplan/csync_autoremove',
|
2023-06-19 22:48:33 +02:00
|
|
|
get_string('setting_csync_autoremove_field', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_csync_autoremove_field', 'local_treestudyplan'),
|
|
|
|
true
|
|
|
|
));
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// Enable/disable remembering previously added cohort syncs so they're not automatically deleted.
|
2023-08-25 09:33:42 +02:00
|
|
|
$pagecsync->add(new admin_setting_configcheckbox('local_treestudyplan/csync_remember_manual_csync',
|
2023-06-26 21:44:31 +02:00
|
|
|
get_string('setting_csync_remember_manual_csync_field', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_csync_remember_manual_csync_field', 'local_treestudyplan'),
|
|
|
|
true
|
|
|
|
));
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// Enable/disable group creation.
|
2023-08-25 09:33:42 +02:00
|
|
|
$pagecsync->add(new admin_setting_configcheckbox('local_treestudyplan/csync_creategroup',
|
2023-06-19 22:48:33 +02:00
|
|
|
get_string('setting_csync_creategroup_field', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_csync_creategroup_field', 'local_treestudyplan'),
|
|
|
|
true
|
|
|
|
));
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// Sync users too yes/no?.
|
2023-08-25 09:33:42 +02:00
|
|
|
$pagecsync->add(new admin_setting_configcheckbox('local_treestudyplan/csync_users',
|
2023-06-30 12:14:11 +02:00
|
|
|
get_string('setting_csync_users_field', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_csync_users_field', 'local_treestudyplan'),
|
|
|
|
true
|
|
|
|
));
|
|
|
|
|
2023-08-24 23:02:41 +02:00
|
|
|
// Select csync enrol role.
|
2023-06-19 22:48:33 +02:00
|
|
|
if (!during_initial_install()) {
|
|
|
|
$options = get_default_enrol_roles(context_system::instance());
|
|
|
|
$student = get_archetype_roles('student');
|
|
|
|
$student = reset($student);
|
2023-08-25 09:33:42 +02:00
|
|
|
$pagecsync->add(new admin_setting_configselect('local_treestudyplan/csync_roleid',
|
2023-06-27 07:33:27 +02:00
|
|
|
get_string('setting_csync_role_field', 'local_treestudyplan'),
|
|
|
|
get_string('settingdesc_csync_role_field', 'local_treestudyplan'),
|
|
|
|
$student->id ?? null, $options));
|
2023-06-19 22:48:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add settings page2 to the admin settings category.
|
2023-08-25 09:33:42 +02:00
|
|
|
$ADMIN->add('local_treestudyplan', $pagecsync);
|
2023-06-19 22:48:33 +02:00
|
|
|
|
|
|
|
/**************************************
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
2023-06-19 22:48:33 +02:00
|
|
|
* Grade and scale interpretation
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
|
|
|
*************************************/
|
2023-05-17 21:19:14 +02:00
|
|
|
$ADMIN->add('local_treestudyplan', new admin_externalpage(
|
|
|
|
'local_treestudyplan_gradeconfig',
|
|
|
|
get_string('cfg_grades', 'local_treestudyplan', null, true),
|
|
|
|
$CFG->wwwroot . '/local/treestudyplan/cfg_grades.php'));
|
|
|
|
|
2023-07-04 23:38:08 +02:00
|
|
|
/**************************************
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
2023-07-04 23:38:08 +02:00
|
|
|
* Add the help link (Temporary until a better place is found)
|
2023-08-24 23:02:41 +02:00
|
|
|
*
|
2023-07-04 23:38:08 +02:00
|
|
|
**************************************/
|
|
|
|
|
|
|
|
$ADMIN->add('local_treestudyplan', new admin_externalpage(
|
|
|
|
'local_treestudyplan_doc',
|
|
|
|
get_string('cfg_help', 'local_treestudyplan', null, true),
|
|
|
|
$CFG->wwwroot . '/local/treestudyplan/doc.php/index.htm'));
|
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|