From 3a4c2fd089695ec1214e4d1bce2697697acf2ee9 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 15 May 2003 18:03:22 +0000 Subject: [PATCH] I knew there was something else I'd forgotten! Added a check to all modules (well view.php anyway) to check whether a module is hidden or not. If it is, then students get a message. --- mod/assignment/view.php | 5 +++- mod/choice/view.php | 2 ++ mod/forum/view.php | 4 +++ mod/journal/view.php | 2 ++ mod/quiz/view.php | 2 ++ mod/resource/view.php | 5 ++++ mod/survey/view.php | 62 ++++++++++++++++++++++------------------- mod/workshop/view.php | 3 ++ 8 files changed, 56 insertions(+), 29 deletions(-) diff --git a/mod/assignment/view.php b/mod/assignment/view.php index 1893431ed9..8673ebcb72 100644 --- a/mod/assignment/view.php +++ b/mod/assignment/view.php @@ -10,7 +10,7 @@ if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); } - + if (! $course = get_record("course", "id", $cm->course)) { error("Course is misconfigured"); } @@ -56,8 +56,11 @@ echo "

id\">". get_string("viewsubmissions", "assignment", $count)."

"; } + } else if (!$cm->visible) { + notice(get_string("activityiscurrentlyhidden")); } + $strdifference = format_time($assignment->timedue - time()); if (($assignment->timedue - time()) < 0) { $strdifference = "$strdifference"; diff --git a/mod/choice/view.php b/mod/choice/view.php index dc255b8afa..b8c0c5f56f 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -71,6 +71,8 @@ $responsecount = 0; } echo "

id\">".get_string("viewallresponses", "choice", $responsecount)."

"; + } else if (!$cm->visible) { + notice(get_string("activityiscurrentlyhidden")); } print_simple_box( text_to_html($choice->text) , "center"); diff --git a/mod/forum/view.php b/mod/forum/view.php index 4c63d93ad7..46c5ecca08 100644 --- a/mod/forum/view.php +++ b/mod/forum/view.php @@ -64,6 +64,10 @@ print_header("$course->shortname: $forum->name", "$course->fullname", "$navigation $forum->name", "", "", true, $buttontext, navmenu($course, $cm)); + if (!$cm->visible and !isteacher($course->id)) { + notice(get_string("activityiscurrentlyhidden")); + } + if ($USER) { $SESSION->fromdiscussion = "$FULLME"; if (forum_is_forcesubscribed($forum->id)) { diff --git a/mod/journal/view.php b/mod/journal/view.php index 7c8e3258e4..673c6770df 100644 --- a/mod/journal/view.php +++ b/mod/journal/view.php @@ -43,6 +43,8 @@ $entrycount = 0; } echo "

id\">".get_string("viewallentries","journal", $entrycount)."

"; + } else if (!$cm->visible) { + notice(get_string("activityiscurrentlyhidden")); } echo "
\n"; diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 0744a4bb70..e99cb08a2f 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -60,6 +60,8 @@ $answercount = 0; } echo "

id\">".get_string("viewallanswers","quiz",$answercount)."

"; + } else if (!$cm->visible) { + notice(get_string("activityiscurrentlyhidden")); } $available = ($quiz->timeopen < $timenow and $timenow < $quiz->timeclose); diff --git a/mod/resource/view.php b/mod/resource/view.php index 0e7df75b8c..4fd17eb2bb 100644 --- a/mod/resource/view.php +++ b/mod/resource/view.php @@ -30,6 +30,11 @@ $navigation = "framename}\" HREF=\"index.php?id=$course->id\">$strresources ->"; } + if (!$cm->visible and !isteacher($course->id)) { + print_header("$course->shortname: $resource->name", "$course->fullname", "$navigation $resource->name", + "", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm)); + notice(get_string("activityiscurrentlyhidden")); + } switch ($resource->type) { case REFERENCE: diff --git a/mod/survey/view.php b/mod/survey/view.php index 26f95ad0b5..cfb00d9500 100644 --- a/mod/survey/view.php +++ b/mod/survey/view.php @@ -34,6 +34,8 @@ $numusers = survey_count_responses($survey->id); echo "

id\">". get_string("viewsurveyresponses", "survey", $numusers)."

"; + } else if (!$cm->visible) { + notice(get_string("activityiscurrentlyhidden")); } if (isguest()) { @@ -48,9 +50,9 @@ print_heading(get_string("surveycompleted", "survey")); $numusers = survey_count_responses($survey->id); print_heading(get_string("peoplecompleted", "survey", $numusers)); - echo "
"; + echo "
"; survey_print_graph("id=$cm->id&sid=$USER->id&type=student.png"); - echo "
"; + echo "
"; print_footer($course); exit; } @@ -58,8 +60,8 @@ // Start the survey form add_to_log($course->id, "survey", "view form", "view.php?id=$cm->id", "$survey->id"); - echo "
"; - echo ""; + echo ""; + echo ""; print_simple_box(text_to_html($survey->intro), "center", "80%"); @@ -76,25 +78,25 @@ $question = $questions["$val"]; $question->id = $val; + if ($question->text) { + $question->text = get_string($question->text, "survey"); + } + if ($question->shorttext) { + $question->shorttext = get_string($question->shorttext, "survey"); + } if ($question->type > 0) { - if ($question->text) { - $question->text = get_string($question->text, "survey"); - } - if ($question->shorttext) { - $question->shorttext = get_string($question->shorttext, "survey"); - } if ($question->intro) { $question->intro = get_string($question->intro, "survey"); } if ($question->options) { $question->options = get_string($question->options, "survey"); } + } - if ($question->multi) { - survey_print_multi($question); - } else { - survey_print_single($question); - } + if ($question->multi) { + survey_print_multi($question); + } else { + survey_print_single($question); } } @@ -106,41 +108,45 @@ ?> -
-
- - -
+
"; + echo ""; print_footer($course); diff --git a/mod/workshop/view.php b/mod/workshop/view.php index c033176a0e..06480dfdf6 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -78,6 +78,9 @@ } } elseif (!isguest()) { // it's a student then + if (!$cm->visible) { + notice(get_string("activityiscurrentlyhidden")); + } switch ($workshop->phase) { case 0 : case 1 : $action = 'notavailable'; break; -- 2.39.5