$extrawhere='ue.status = '.$statussuspended.' AND e.status = '.$enrolmentactive.' AND ue.timestart < '.$now1.' AND (ue.timeend = 0 OR ue.timeend > '.$now2.')';
// Get course teachers based on global teacher roles
// Get course teachers based on global teacher roles
if(count($teacherroles)>0){
if(count($teacherroles)>0){
// Check if we have to check for suspended teachers
if($coc_config->teacherroleshidesuspended==1){
// Build extra where clause for SQL query
$now=round(time(),-2);// improves db caching
$extrawhere='ue.status = '.ENROL_USER_ACTIVE.' AND e.status = '.ENROL_INSTANCE_ENABLED.' AND ue.timestart < '.$now.' AND (ue.timeend = 0 OR ue.timeend > '.$now.')';
}
// Check if we have to include teacher roles from parent contexts
// Check if we have to include teacher roles from parent contexts
// If yes
// If yes
if($coc_config->teacherrolesparent==1){
if($coc_config->teacherrolesparent==1){
if($coc_config->teacherroleshidesuspendedteacher==0){// also show suspended teachers
$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['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['teacherroleshidesuspendedteacher']='Verify active teacher enrolment';
$string['teacherrolessuspendedteacher_desc']='If this option is active, it will check for suspended but enroled teachers and will NOT display them as teachers in the course information. This will cause a little higher load on the database. So just activate if you are sure that you really need this feature.';
$string['teacherroleshidesuspended_desc']='When looking for teachers with the specified teacher roles, do not only check if a teacher has one of the given roles in a course, but also check if his enrolment into the course is active (i.e. the teacher\'s enrolment in the course is not suspended + the current date is within the start and end dates of the teacher\'s enrolment + the enrolment method of the teacher\'s enrolment is enabled in the course). Teachers whose enrolment in a course is not active will not be considered as teacher for this course.<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 enable this setting, the load on the database to create the list of courses will slightly increase due to the necessary additional checks. Thus, enable this setting only if you need to.</em>';
$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['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['teacherrolesparentcapability']='Depending on the user\'s moodle/course:reviewotherusers capability';