Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed unassigned variables in function workshop_print_assignment_info

  • Loading branch information...
commit c75599f4c36c2dc6e1ac30324b80b3f637d8accd 1 parent 202ba39
authored
22  mod/workshop/lib.php
@@ -2,6 +2,9 @@
2 2
 
3 3
 include_once("$CFG->dirroot/files/mimetypes.php");
4 4
 
  5
+// reset error reporting
  6
+error_reporting($CFG->debug);
  7
+
5 8
 /*** Constants **********************************/
6 9
 
7 10
 $WORKSHOP_TYPE = array (0 => get_string("notgraded", "workshop"),
@@ -707,7 +710,7 @@ function workshop_list_user_submissions($workshop, $user) {
707 710
 function workshop_print_assessment($workshop, $assessment, $allowchanges, $showcommentlinks)
708 711
 function workshop_print_assessments_by_user_for_admin($workshop, $user) {
709 712
 function workshop_print_assessments_for_admin($workshop, $submission) {
710  
-function workshop_print_assignment_info($workshop) {
  713
+function workshop_print_assignment_info($cm, $workshop) {
711 714
 function workshop_print_difference($time) {
712 715
 function workshop_print_feedback($course, $submission) {
713 716
 function workshop_print_league_table($workshop) {
@@ -2593,8 +2596,21 @@ function workshop_print_assessments_for_admin($workshop, $submission) {
2593 2596
 
2594 2597
 
2595 2598
 function workshop_print_assignment_info($workshop) {
  2599
+
  2600
+	if (! $course = get_record("course", "id", $workshop->course)) {
  2601
+        error("Course is misconfigured");
  2602
+        }
  2603
+    if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) {
  2604
+        error("Course Module ID was incorrect");
  2605
+		}
  2606
+	// print standard assignment heading
  2607
+	$strdifference = format_time($workshop->deadline - time());
  2608
+	if (($workshop->deadline - time()) < 0) {
  2609
+		$strdifference = "<font color=\"red\">$strdifference</font>";
  2610
+	}
  2611
+	$strduedate = userdate($workshop->deadline)." ($strdifference)";
2596 2612
 	print_simple_box_start("center");
2597  
-	print_heading($workshop->name);
  2613
+	print_heading($workshop->name, "center");
2598 2614
 	print_simple_box_start("center");
2599 2615
 	echo "<b>".get_string("duedate", "assignment")."</b>: $strduedate<br />";
2600 2616
 	echo "<b>".get_string("maximumgrade")."</b>: $workshop->grade<br />";
@@ -2605,7 +2621,7 @@ function workshop_print_assignment_info($workshop) {
2605 2621
 	echo "<br />";
2606 2622
 	echo format_text($workshop->description, $workshop->format);
2607 2623
 	print_simple_box_end();
2608  
-	echo "<br />";
  2624
+	echo "<br />";	
2609 2625
 	}
2610 2626
 
2611 2627
 
21  mod/workshop/view.php
@@ -64,6 +64,7 @@
64 64
                   "", "", true, update_module_button($cm->id, $course->id, $strworkshop), navmenu($course, $cm));
65 65
 
66 66
 	// ...and if necessary set default action 
  67
+	
67 68
 	optional_variable($action);
68 69
     if (isteacher($course->id)) {
69 70
 		if (empty($action)) { // no action specified, either go straight to elements page else the admin page
@@ -273,25 +274,7 @@
273 274
 	
274 275
 	/*********************** student's view could be in 1 of 4 stages ***********************/
275 276
 	elseif ($action == 'studentsview') {
276  
-		// print standard assignment heading
277  
-		$strdifference = format_time($workshop->deadline - time());
278  
-		if (($workshop->deadline - time()) < 0) {
279  
-			$strdifference = "<font color=\"red\">$strdifference</font>";
280  
-		}
281  
-		$strduedate = userdate($workshop->deadline)." ($strdifference)";
282  
-		print_simple_box_start("CENTER");
283  
-		print_heading($workshop->name, "CENTER");
284  
-		print_simple_box_start("CENTER");
285  
-		echo "<b>".get_string("duedate", "assignment")."</b>: $strduedate<br />";
286  
-		echo "<b>".get_string("maximumgrade")."</b>: $workshop->grade<br />";
287  
-		echo "<b>".get_string("detailsofassessment", "workshop")."</b>: 
288  
-			<a href=\"assessments.php?id=$cm->id&action=displaygradingform\">".
289  
-			get_string("specimenassessmentform", "workshop")."</a><br />";
290  
-		print_simple_box_end();
291  
-		echo "<br />";
292  
-		echo format_text($workshop->description, $workshop->format);
293  
-		print_simple_box_end();
294  
-		echo "<br />";
  277
+		workshop_print_assignment_info($workshop);
295 278
 		// in Stage 1? - are there any teacher's submissions? and...
296 279
 		// ...has student assessed the required number of the teacher's submissions ("satisfactory level" dropped 14/8/03)
297 280
 		if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {

0 notes on commit c75599f

Please sign in to comment.
Something went wrong with that request. Please try again.