]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed unassigned variables in function workshop_print_assignment_info
authorrkingdon <rkingdon>
Wed, 27 Aug 2003 17:13:03 +0000 (17:13 +0000)
committerrkingdon <rkingdon>
Wed, 27 Aug 2003 17:13:03 +0000 (17:13 +0000)
mod/workshop/lib.php
mod/workshop/view.php

index 6c25ff0585c9c41365f0547d77349e76c62068e6..ed7172f4547b6d3dde7fd3ebf29ecb05f9eeafd5 100644 (file)
@@ -2,6 +2,9 @@
 
 include_once("$CFG->dirroot/files/mimetypes.php");
 
+// reset error reporting
+error_reporting($CFG->debug);
+
 /*** Constants **********************************/
 
 $WORKSHOP_TYPE = array (0 => get_string("notgraded", "workshop"),
@@ -707,7 +710,7 @@ function workshop_list_user_submissions($workshop, $user) {
 function workshop_print_assessment($workshop, $assessment, $allowchanges, $showcommentlinks)
 function workshop_print_assessments_by_user_for_admin($workshop, $user) {
 function workshop_print_assessments_for_admin($workshop, $submission) {
-function workshop_print_assignment_info($workshop) {
+function workshop_print_assignment_info($cm, $workshop) {
 function workshop_print_difference($time) {
 function workshop_print_feedback($course, $submission) {
 function workshop_print_league_table($workshop) {
@@ -2593,8 +2596,21 @@ function workshop_print_assessments_for_admin($workshop, $submission) {
 
 
 function workshop_print_assignment_info($workshop) {
+
+       if (! $course = get_record("course", "id", $workshop->course)) {
+        error("Course is misconfigured");
+        }
+    if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) {
+        error("Course Module ID was incorrect");
+               }
+       // print standard assignment heading
+       $strdifference = format_time($workshop->deadline - time());
+       if (($workshop->deadline - time()) < 0) {
+               $strdifference = "<font color=\"red\">$strdifference</font>";
+       }
+       $strduedate = userdate($workshop->deadline)." ($strdifference)";
        print_simple_box_start("center");
-       print_heading($workshop->name);
+       print_heading($workshop->name, "center");
        print_simple_box_start("center");
        echo "<b>".get_string("duedate", "assignment")."</b>: $strduedate<br />";
        echo "<b>".get_string("maximumgrade")."</b>: $workshop->grade<br />";
@@ -2605,7 +2621,7 @@ function workshop_print_assignment_info($workshop) {
        echo "<br />";
        echo format_text($workshop->description, $workshop->format);
        print_simple_box_end();
-       echo "<br />";
+       echo "<br />";  
        }
 
 
index 54cf52ad7c1391a0fb91e689372b8990e3301de8..3e3277254dab8542185ad37e6243a99aa99fd5db 100644 (file)
@@ -64,6 +64,7 @@
                   "", "", true, update_module_button($cm->id, $course->id, $strworkshop), navmenu($course, $cm));
 
        // ...and if necessary set default action 
+       
        optional_variable($action);
     if (isteacher($course->id)) {
                if (empty($action)) { // no action specified, either go straight to elements page else the admin page
        
        /*********************** student's view could be in 1 of 4 stages ***********************/
        elseif ($action == 'studentsview') {
-               // print standard assignment heading
-               $strdifference = format_time($workshop->deadline - time());
-               if (($workshop->deadline - time()) < 0) {
-                       $strdifference = "<font color=\"red\">$strdifference</font>";
-               }
-               $strduedate = userdate($workshop->deadline)." ($strdifference)";
-               print_simple_box_start("CENTER");
-               print_heading($workshop->name, "CENTER");
-               print_simple_box_start("CENTER");
-               echo "<b>".get_string("duedate", "assignment")."</b>: $strduedate<br />";
-               echo "<b>".get_string("maximumgrade")."</b>: $workshop->grade<br />";
-               echo "<b>".get_string("detailsofassessment", "workshop")."</b>: 
-                       <a href=\"assessments.php?id=$cm->id&action=displaygradingform\">".
-                       get_string("specimenassessmentform", "workshop")."</a><br />";
-               print_simple_box_end();
-               echo "<br />";
-               echo format_text($workshop->description, $workshop->format);
-               print_simple_box_end();
-               echo "<br />";
+               workshop_print_assignment_info($workshop);
                // in Stage 1? - are there any teacher's submissions? and...
                // ...has student assessed the required number of the teacher's submissions ("satisfactory level" dropped 14/8/03)
                if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {