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.
This commit is contained in:
moodler 2003-05-15 18:03:22 +00:00
parent 610603be4d
commit 3a4c2fd089
8 changed files with 56 additions and 29 deletions

View File

@ -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 "<P align=right><A HREF=\"submissions.php?id=$assignment->id\">".
get_string("viewsubmissions", "assignment", $count)."</A></P>";
}
} else if (!$cm->visible) {
notice(get_string("activityiscurrentlyhidden"));
}
$strdifference = format_time($assignment->timedue - time());
if (($assignment->timedue - time()) < 0) {
$strdifference = "<FONT COLOR=RED>$strdifference</FONT>";

View File

@ -71,6 +71,8 @@
$responsecount = 0;
}
echo "<P align=right><A HREF=\"report.php?id=$cm->id\">".get_string("viewallresponses", "choice", $responsecount)."</A></P>";
} else if (!$cm->visible) {
notice(get_string("activityiscurrentlyhidden"));
}
print_simple_box( text_to_html($choice->text) , "center");

View File

@ -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)) {

View File

@ -43,6 +43,8 @@
$entrycount = 0;
}
echo "<P align=right><A HREF=\"report.php?id=$cm->id\">".get_string("viewallentries","journal", $entrycount)."</A></P>";
} else if (!$cm->visible) {
notice(get_string("activityiscurrentlyhidden"));
}
echo "<CENTER>\n";

View File

@ -60,6 +60,8 @@
$answercount = 0;
}
echo "<P align=right><A HREF=\"report.php?id=$cm->id\">".get_string("viewallanswers","quiz",$answercount)."</A></P>";
} else if (!$cm->visible) {
notice(get_string("activityiscurrentlyhidden"));
}
$available = ($quiz->timeopen < $timenow and $timenow < $quiz->timeclose);

View File

@ -30,6 +30,11 @@
$navigation = "<A TARGET=\"{$CFG->framename}\" HREF=\"index.php?id=$course->id\">$strresources</A> ->";
}
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:

View File

@ -34,6 +34,8 @@
$numusers = survey_count_responses($survey->id);
echo "<P align=right><A HREF=\"report.php?id=$cm->id\">".
get_string("viewsurveyresponses", "survey", $numusers)."</A></P>";
} 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 "<CENTER>";
echo "<center>";
survey_print_graph("id=$cm->id&sid=$USER->id&type=student.png");
echo "</CENTER>";
echo "</center>";
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 "<FORM NAME=form METHOD=post ACTION=save.php>";
echo "<INPUT TYPE=hidden NAME=id VALUE=$id>";
echo "<form name=form method=post action=save.php>";
echo "<input type=hidden name=id value=$id>";
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 @@
?>
<CENTER>
<BR>
<SCRIPT>
<center>
<br />
<script>
<!-- // BEGIN
function checkform() {
var error=false;
with (document.form) {
<? foreach ($checklist as $question => $default) {
echo " if (".$question."[".$default."].checked) error=true;\n";
}?>
<?php
if (!empty($checklist)) {
foreach ($checklist as $question => $default) {
echo " if (".$question."[".$default."].checked) error=true;\n";
}
}
?>
}
if (error) {
alert("<?PHP print_string("questionsnotanswered", "survey") ?>");
alert("<?php print_string("questionsnotanswered", "survey") ?>");
} else {
document.form.submit();
}
}
<?PHP echo "document.write('<INPUT TYPE=button VALUE=\"".get_string("clicktocontinuecheck", "survey")."\" onClick=\"checkform()\">');"; ?>
<?php echo "document.write('<INPUT TYPE=button VALUE=\"".get_string("clicktocontinuecheck", "survey")."\" onClick=\"checkform()\">');"; ?>
// END -->
</SCRIPT>
<NOSCRIPT>
<noscript>
<!-- Without Javascript, no checking is done -->
<INPUT TYPE="submit" VALUE="<? get_string("clicktocontinue", "survey") ?>">
</NOSCRIPT>
<input type="submit" value="<? get_string("clicktocontinue", "survey") ?>">
</noscript>
</CENTER>
</center>
<?
echo "</FORM>";
echo "</form>";
print_footer($course);

View File

@ -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;