]> git.mjollnir.org Git - moodle.git/commitdiff
I knew there was something else I'd forgotten!
authormoodler <moodler>
Thu, 15 May 2003 18:03:22 +0000 (18:03 +0000)
committermoodler <moodler>
Thu, 15 May 2003 18:03:22 +0000 (18:03 +0000)
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
mod/choice/view.php
mod/forum/view.php
mod/journal/view.php
mod/quiz/view.php
mod/resource/view.php
mod/survey/view.php
mod/workshop/view.php

index 1893431ed93211ef225361cc2df8b2a3344133ac..8673ebcb729c7ec69d8d0a663f3b820abb0dee1b 100644 (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");
         }
             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>";
index dc255b8afa20741a719de4c3e4552aab9f454a65..b8c0c5f56fbb77ba476b4b19546158b73fcfa4b3 100644 (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");
index 4c63d93ad7ac83eb7cc9b2f96034a8db42de4e5d..46c5ecca0858ae47f1cadb143c8e7682b8b2a407 100644 (file)
     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)) {
index 7c8e3258e4cb332d32a953fb78ff6b9988881f7e..673c6770dfca5a0c80397a3e5b0d0267dd8a91c4 100644 (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";
index 0744a4bb70c42676c035cd6922c68dc69da8f955..e99cb08a2f691f339e4a8753e5f83273aae835fb 100644 (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);
index 0e7df75b8c0a868690c148c53c09232d5767b7ce..4fd17eb2bb6bd152a2038db76c5002a80aa470c6 100644 (file)
         $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:
index 26f95ad0b5f8faabec94f8ac94109d62f7667eb5..cfb00d9500623c8864a5ea928d754d777cb6a6b6 100644 (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%");
 
         $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);
         }
     }
 
 
 ?>
 
-<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);
 
index c033176a0e7b3bdd40a6a91a2d9e93fe149ea34d..06480dfdf69cee2651bf5c82bf004e213095d34c 100644 (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;