Skip to content
Snippets Groups Projects
Commit 487bc967 authored by Elke Kreim's avatar Elke Kreim
Browse files

Decrease amount of categories in request form

parent a96665f3
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,10 @@
$string['pluginname'] = 'HsH Anpassungen';
// request
$string['settingslabel'] = 'HSH Kursantrag';
$string['categoriesenabledvisiblename'] = 'Kursbereiche';
$string['categoriesenabledhelper'] = 'Kurskategorien für HSH Kursantrag auswählen';
$string['categoriesenableddefault'] = 'Keine Kursbereiche ausgewählt';
$string['courserequest'] = 'Kursbeantragung';
$string['courserequestsuccess'] = '<p>Ihr Kursantrag wurde an das E-Learning Center übertragen und wird so schnell wie
möglich (i.d.R. in den nächsten drei Werktagen) bearbeitet. Sie werden umgehend per E-Mail über die Freischaltung informiert.</p>
......
......@@ -5,6 +5,10 @@
* Time: 10:48
*/
$string['pluginname'] = 'HSH Edits';
$string['settingslabel'] = 'HSH course request';
$string['categoriesenabledvisiblename'] = 'Course categories';
$string['categoriesenabledhelper'] = 'Select course categories for hsh course request form';
$string['categoriesenableddefault'] = 'No course category selected';
$string['courserequest'] = 'Course request';
$string['courserequestsuccess'] = 'Your course request has been saved successfully. You will be sent an email to inform you whether your request was approved.';
// request_form
......
......@@ -132,8 +132,12 @@ class course_request_hsh_form extends moodleform {
* @return array
*/
private function get_short_categories_list() {
$courselist = core_course_category::make_categories_list('', 0, '$$$');
foreach ($courselist as &$actCourse) {
$selectedcatecorieids = get_config('local_hsh', 'categoriesenabled');
$selectedcatecories = core_course_category::get_many(explode(',', $selectedcatecorieids));
$categorylist = core_course_category::make_categories_list('', 0, '$$$');
$selected = array_intersect_key($categorylist, $selectedcatecories);
var_dump($selected);
foreach ($selected as &$actCourse) {
$actCourseArr = explode('$$$', $actCourse);
$actCourseSize = sizeof($actCourseArr);
if ($actCourseSize > 1) {
......@@ -144,7 +148,7 @@ class course_request_hsh_form extends moodleform {
$actCourse .= $actCourseArr[$actCourseSize - 1];
}
}
return $courselist;
return $selected;
}
// < HsH
......
<?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/>.
/**
* Plugin settings for the local_hsh plugin.
*
* @package local_hsh
* @copyright 2023, Elke Kreim <elke.kreim@hs-hannover.de>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Ensure the configurations for this site are set
if ($hassiteconfig) {
// Create the new settings page
// - in a local plugin this is not defined as standard, so normal $settings->methods will throw an error as
// $settings will be null
$settings = new admin_settingpage('local_hsh', get_string('settingslabel', 'local_hsh'));
// Create
$ADMIN->add('localplugins', $settings);
$settings -> add(new admin_setting_configmultiselect(
'local_hsh/categoriesenabled',
get_string('categoriesenabledvisiblename', 'local_hsh' ),
get_string('categoriesenabledhelper', 'local_hsh' ),
array(),
core_course_category::make_categories_list()
));
// Add a setting field to the settings for this page
// $settings->add(new admin_setting_configtext(
// // This is the reference you will use to your configuration
// 'local_hsh/categoriesenabled',
//
// // This is the friendly title for the config, which will be displayed
// get_string('categoriesenabledvisiblename', 'local_hsh' ),
//
// // This is helper text for this config field
// get_string('categoriesenabledhelper', 'local_hsh' ),
//
// // This is the default value
// get_string('categoriesenableddefault', 'local_hsh' ),
//
// // This is the type of Parameter this config is
// PARAM_TEXT
// ));
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment