Skip to content
Snippets Groups Projects
Commit 5152efb5 authored by Alexander Bias's avatar Alexander Bias
Browse files

New Feature: Add a setting to control if the block should, when looking for...

New Feature: Add a setting to control if the block should, when looking for teachers with the specified teacher roles, include teachers who have their role assigned in parent contexts
parent 05e1344c
No related branches found
No related tags found
No related merge requests found
......@@ -13,9 +13,10 @@ This plugin requires Moodle 2.8+
Changes
-------
* 2014-02-22 - Bugfix: Teacher filter showed teachers twice or even multiple times, Thanks to Mario Wehr
* 2014-02-22 - Bugfix: Term filter might have listed terms twice; Thanks to Michael Veit
* 2014-01-29 - Check compatibility for Moodle 2.8, no functionality change
* 2015-03-20 - New Feature: Add a setting to control if the block should, when looking for teachers with the specified teacher roles, include teachers who have their role assigned in parent contexts (course category or system level)
* 2015-02-22 - Bugfix: Teacher filter showed teachers twice or even multiple times, Thanks to Mario Wehr
* 2015-02-22 - Bugfix: Term filter might have listed terms twice; Thanks to Michael Veit
* 2015-01-29 - Check compatibility for Moodle 2.8, no functionality change
* 2014-10-20 - Bugfix: There were problems with the term filter and courses which start on the term start day and / or term starting on january 1st
* 2014-10-20 - Add multilanguage support to noteachertext string
* 2014-08-29 - Update README file
......
......@@ -436,8 +436,24 @@ class block_course_overview_campus extends block_base {
if ($coc_config->teachercoursefilter == true || $coc_config->secondrowshowteachername == true) {
// Get course teachers based on global teacher roles
if (count($teacherroles) > 0) {
// Check if we have to include teacher roles from parent contexts
// If yes
if ($coc_config->teacherrolesparent == 1) {
$courseteachers = get_role_users($teacherroles, $context, true, 'ra.id, u.id, u.lastname, u.firstname, r.sortorder', 'u.lastname, u.firstname');
}
// If no
else if ($coc_config->teacherrolesparent == 2) {
$courseteachers = get_role_users($teacherroles, $context, false, 'ra.id, u.id, u.lastname, u.firstname, r.sortorder', 'u.lastname, u.firstname');
}
// If depending on moodle/course:reviewotherusers capability
else if ($coc_config->teacherrolesparent == 3) {
$courseteachers = get_role_users($teacherroles, $context, has_capability('moodle/course:reviewotherusers', $context), 'ra.id, u.id, u.lastname, u.firstname, r.sortorder', 'u.lastname, u.firstname');
}
// Should not happen
else {
$courseteachers = get_role_users($teacherroles, $context, true, 'ra.id, u.id, u.lastname, u.firstname, r.sortorder', 'u.lastname, u.firstname');
}
}
else {
$courseteachers = array();
}
......
......@@ -89,6 +89,9 @@ $string['teachernamestylefullnamedisplay'] = 'Teacher name style according to Mo
$string['teacherrolessettingheading'] = 'Teacher roles';
$string['teacherroles'] = 'Teacher roles';
$string['teacherroles_desc'] = 'Define which roles are handled as teacher roles by this plugin<br /><em>This setting is only processed when show teacher name is activated or when the teacher filter is activated or when the priorization of courses in which I teach is activated</em>';
$string['teacherrolesparent'] = 'Include parent context teacher roles';
$string['teacherrolesparent_desc'] = 'When looking for teachers with the specified teacher roles, include teachers who have their role assigned in parent contexts (course category or system level)<br /><em>This setting is only processed when show teacher name is activated or when the teacher filter is activated.</em><br /><em>Warning: If you set this to "No" or "Depending on the user\'s moodle/course:reviewotherusers capability", the "Prioritize courses in which I teach" function will also be influenced and will not priorize courses where the user has his teacher role assigned in parent contexts.</em>';
$string['teacherrolesparentcapability'] = 'Depending on the user\'s moodle/course:reviewotherusers capability';
$string['term'] = 'Term';
$string['term1'] = 'Term 1';
$string['term1name'] = 'Term 1 name';
......
......@@ -111,6 +111,14 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configtext('block_course_overview_campus/noteachertext', get_string('noteachertext', 'block_course_overview_campus'),
get_string('noteachertext_desc', 'block_course_overview_campus'), get_string('noteacher', 'block_course_overview_campus'), PARAM_TEXT));
// Possible settings for parent teacher roles
$teacherrolesparentmodes[1] = get_string('yes');
$teacherrolesparentmodes[2] = get_string('no');
$teacherrolesparentmodes[3] = get_string('teacherrolesparentcapability', 'block_course_overview_campus');
$settings->add(new admin_setting_configselect('block_course_overview_campus/teacherrolesparent', get_string('teacherrolesparent', 'block_course_overview_campus'),
get_string('teacherrolesparent_desc', 'block_course_overview_campus'), $teacherrolesparentmodes[1], $teacherrolesparentmodes));
// Category filter: Activation
$settings->add(new admin_setting_heading('block_course_overview_campus/categorycoursefiltersettingheading', get_string('categorycoursefiltersettingheading', 'block_course_overview_campus'), ''));
......
......@@ -26,7 +26,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'block_course_overview_campus';
$plugin->version = 2014111002;
$plugin->release = '2.8 (Build: 2015022201)';
$plugin->version = 2014111003;
$plugin->release = '2.8 (Build: 2015032000)';
$plugin->requires = 2014111000;
$plugin->maturity = MATURITY_STABLE;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment