Fixing bug when showing teacher/learner preview see #4868

skala
Julio Montoya 14 years ago
parent 114dea5b35
commit 86ebfdabad
  1. 11
      main/inc/lib/main_api.lib.php

@ -2501,7 +2501,12 @@ function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach =
//Admins can edit anything
if (api_is_platform_admin(false)) {
return true;
//The student preview was on
if (isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview") {
return false;
} else {
return true;
}
}
$is_courseAdmin = api_is_course_admin();
@ -2509,6 +2514,7 @@ function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach =
if (!$is_courseAdmin && $tutor) { // If we also want to check if the user is a tutor...
$is_courseAdmin = $is_courseAdmin || api_is_course_tutor();
}
if (!$is_courseAdmin && $coach) { // If we also want to check if the user is a coach...';
// Check if session visibility is read only for coaches.
if ($session_visibility == SESSION_VISIBLE_READ_ONLY) {
@ -2526,7 +2532,8 @@ function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach =
$is_courseAdmin = $is_courseAdmin || api_is_coach();
}
if (api_get_setting('student_view_enabled') == 'true') { // Check if the student_view is enabled, and if so, if it is activated.
// Check if the student_view is enabled, and if so, if it is activated.
if (api_get_setting('student_view_enabled') == 'true') {
if (!empty($my_session_id)) {
// Check if session visibility is read only for coachs
if ($session_visibility == SESSION_VISIBLE_READ_ONLY) {

Loading…
Cancel
Save