diff --git a/mod/chat/gui_header_js/index.php b/mod/chat/gui_header_js/index.php index 632940a7e72..dcbc97ef2f4 100644 --- a/mod/chat/gui_header_js/index.php +++ b/mod/chat/gui_header_js/index.php @@ -24,7 +24,7 @@ require_capability('mod/chat:chat',$context); - if (!$cm->visible and !isteacher($course->id)) { + if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) { print_header(); notice(get_string("activityiscurrentlyhidden")); } diff --git a/mod/chat/gui_sockets/index.php b/mod/chat/gui_sockets/index.php index 073f773a91e..74504f52810 100644 --- a/mod/chat/gui_sockets/index.php +++ b/mod/chat/gui_sockets/index.php @@ -24,7 +24,7 @@ error('Guest does not have access to chat rooms'); } - if (!$cm->visible and !isteacher($course->id)) { + if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) { print_header(); notice(get_string("activityiscurrentlyhidden")); } diff --git a/mod/choice/lib.php b/mod/choice/lib.php index 2164e630386..fd9b01de142 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -159,7 +159,6 @@ $cdisplay = array(); if (!empty($countanswers)) { foreach ($countanswers as $ca) { //only return enrolled users. if (has_capability('mod/choice:choose', $context)) { - //if (isstudent($cm->course, $ca->userid) or isteacher($cm->course, $ca->userid)) { $countans = $countans+1; } } @@ -262,7 +261,6 @@ $current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $user $countans = 0; foreach ($countanswers as $ca) { //only return enrolled users. if (has_capability('mod/choice:choose', $context)) { - //if (isstudent($courseid, $ca->userid) or isteacher($courseid, $ca->userid)) { $countans = $countans+1; } } @@ -308,7 +306,6 @@ function choice_show_reportlink($choice, $courseid, $cmid) { $responsecount = 0; foreach ($allanswers as $aa) { if (has_capability('mod/choice:readresponses', $context)) { - //if (isstudent($courseid, $aa->userid) or isteacher($courseid, $aa->userid)) { //check to make sure user is enrolled in course. $responsecount++; } } @@ -380,11 +377,8 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') { switch ($forcepublish) { case CHOICE_PUBLISH_NAMES: - //$isteacher = isteacher($course->id); - $tablewidth = (int) (100.0 / count($useranswer)); if (has_capability('mod/choice:readresponses', $context)) { - //if (isteacher($course->id, $USER->id)) { echo '