Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixing Bug #653.

  • Loading branch information...
commit 0978073ffbb02a274eab283a3e46a158e30e75de 1 parent c79f962
authored August 23, 2003
45  mod/workshop/lib.php
... ...
@@ -1,4 +1,4 @@
1  
-<?PHP  // $Id: lib.php,v 1.1 22 Aug 2003
  1
+<?PHP  // $Id: lib.php,v 1.1 23 Aug 2003
2 2
 
3 3
 include_once("$CFG->dirroot/files/mimetypes.php");
4 4
 
@@ -254,15 +254,17 @@ function workshop_cron () {
254 254
 			// it's an assessment, tell the submission owner
255 255
 			$USER->lang = $submissionowner->lang;
256 256
 			$sendto = $submissionowner;
257  
-			$msg = "Your assignment \"$submission->title\" has been assessed.\n".
258  
-				"The comments and grade can be seen in ".
259  
-				"the workshop assignment '$workshop->name'\n\n";
  257
+			// "Your assignment \"$submission->title\" has been assessed."
  258
+			$msg = get_string("mail1", "workshop", $submission->title)."\n".
  259
+			// "The comments and grade can be seen in the workshop assignment '$workshop->name'
  260
+			$msg .= get_string("mail2", "workshop", $workshop->name)."\n\n";
260 261
 	
261 262
 			$postsubject = "$course->shortname: $strworkshops: $workshop->name";
262 263
 			$posttext  = "$course->shortname -> $strworkshops -> $workshop->name\n";
263 264
 			$posttext .= "---------------------------------------------------------------------\n";
264 265
 			$posttext .= $msg;
265  
-			$posttext .= "You can see it in your workshop assignment:\n";
  266
+			// "You can see it in your workshop assignment
  267
+			$posttext .= get_string("mail3", "workshop").":\n";
266 268
 			$posttext .= "   $CFG->wwwroot/mod/workshop/view.php?a=$workshop->id\n";
267 269
 			$posttext .= "---------------------------------------------------------------------\n";
268 270
 			if ($sendto->mailformat == 1) {  // HTML
@@ -1583,7 +1585,31 @@ function workshop_list_submissions_for_admin($workshop, $order) {
1583 1585
     if (! $course = get_record("course", "id", $workshop->course)) {
1584 1586
         error("Course is misconfigured");
1585 1587
         }
1586  
-	
  1588
+    if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) {
  1589
+        error("Course Module ID was incorrect");
  1590
+    }
  1591
+
  1592
+	// print standard assignment "header"
  1593
+	$strdifference = format_time($workshop->deadline - time());
  1594
+	if (($workshop->deadline - time()) < 0) {
  1595
+		$strdifference = "<FONT COLOR=RED>$strdifference</FONT>";
  1596
+	}
  1597
+	$strduedate = userdate($workshop->deadline)." ($strdifference)";
  1598
+	print_simple_box_start("CENTER");
  1599
+	print_heading($workshop->name, "CENTER");
  1600
+	print_simple_box_start("CENTER");
  1601
+	echo "<B>".get_string("duedate", "assignment")."</B>: $strduedate<BR>";
  1602
+	echo "<B>".get_string("maximumgrade")."</B>: $workshop->grade<BR>";
  1603
+	echo "<B>".get_string("detailsofassessment", "workshop")."</B>: 
  1604
+		<A HREF=\"assessments.php?id=$cm->id&action=displaygradingform\">".
  1605
+		get_string("specimenassessmentform", "workshop")."</A><BR>";
  1606
+	print_simple_box_end();
  1607
+	echo "<BR>";
  1608
+	echo format_text($workshop->description, $workshop->format);
  1609
+	print_simple_box_end();
  1610
+	echo "<BR>";
  1611
+
  1612
+	// list any teacher submissions
1587 1613
 	$table->head = array (get_string("title", "workshop"), get_string("submittedby", "workshop"), get_string("action", "workshop"));
1588 1614
 	$table->align = array ("left", "left", "left");
1589 1615
 	$table->size = array ("*", "*", "*");
@@ -1619,6 +1645,7 @@ function workshop_list_submissions_for_admin($workshop, $order) {
1619 1645
 					get_string("delete", "workshop")."</a>";
1620 1646
 			$table->data[] = array(workshop_print_submission_title($workshop, $submission), $course->teacher, $action);
1621 1647
 			}
  1648
+		print_heading(get_string("studentsubmissions", "workshop", $course->teacher), "center");
1622 1649
 		print_table($table);
1623 1650
 		}
1624 1651
 
@@ -1663,11 +1690,12 @@ function workshop_list_submissions_for_admin($workshop, $order) {
1663 1690
 				$table->data[] = array("$user->firstname $user->lastname", $title, $action);
1664 1691
 				}
1665 1692
 			}
1666  
-		print_table($table);
  1693
+		if (isset($table->data)) {
  1694
+			print_table($table);
  1695
+			}
1667 1696
 		}
1668 1697
 
1669 1698
 	// now the sudent submissions
1670  
-	echo "<CENTER><P><B>".get_string("studentsubmissions", "workshop", $course->student)."</B></CENTER><BR>\n";
1671 1699
 	unset($table);
1672 1700
 	switch ($order) {
1673 1701
 		case "title" :
@@ -1719,6 +1747,7 @@ function workshop_list_submissions_for_admin($workshop, $order) {
1719 1747
 				" ".workshop_print_submission_assessments($workshop, $submission, "teacher").
1720 1748
 				" ".workshop_print_submission_assessments($workshop, $submission, "student"), $action);
1721 1749
 			}
  1750
+		print_heading(get_string("studentsubmissions", "workshop", $course->student), "center");
1722 1751
 		print_table($table);
1723 1752
 		}
1724 1753
 	}
1  mod/workshop/submissions.php
@@ -168,7 +168,6 @@
168 168
 			$order = $_GET['order'];
169 169
 			}
170 170
 			
171  
-		print_heading(get_string("listofallsubmissions", "workshop").":", "center");
172 171
 		workshop_list_submissions_for_admin($workshop, $order);
173 172
 		print_continue("view.php?id=$cm->id");
174 173
 		
36  mod/workshop/view.php
... ...
@@ -1,4 +1,4 @@
1  
-<?PHP  // $Id: view.php, v1.1 22 Aug 2003
  1
+<?PHP  // $Id: view.php, v1.1 23 Aug 2003
2 2
 
3 3
 /*************************************************
4 4
 	ACTIONS handled are:
@@ -247,10 +247,15 @@
247 247
 			error("Only teachers can look at this page");
248 248
 			}
249 249
 
250  
-		// move to phase 2
251  
-		set_field("workshop", "phase", 2, "id", "$workshop->id");
252  
-		redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 2));
253  
-		add_to_log($course->id, "workshop", "open", "view.php?a=$workshop->id", "$workshop->id");
  250
+		// move to phase 2, check that teacher has made enough submissions
  251
+		if (workshop_count_teacher_submissions($workshop) < $workshop->ntassessments) {
  252
+			redirect("view.php?id=$cm->id", get_string("notenoughexamplessubmitted", "workshop", $course->teacher));
  253
+			}
  254
+		else {
  255
+			set_field("workshop", "phase", 2, "id", "$workshop->id");
  256
+			redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 2));
  257
+			add_to_log($course->id, "workshop", "open", "view.php?a=$workshop->id", "$workshop->id");
  258
+			}
254 259
 		}
255 260
 
256 261
 
@@ -369,15 +374,18 @@
369 374
 		print_simple_box_end();
370 375
 		echo "<BR>";
371 376
 		
372  
-		workshop_list_teacher_submissions($workshop, $USER);
373  
-		echo "<HR SIZE=1 NOSHADE>";
374  
-		echo "<BR>";
375  
-		
376  
-		workshop_list_student_submissions($workshop, $USER);
377  
-		echo "<HR SIZE=1 NOSHADE>";
378  
-		echo "<BR>";
379  
-		
380  
-		// list previous submissions
  377
+		// only list teacher and (other) student submissions if it's a student
  378
+		if (isstudent($course->id)) {
  379
+			workshop_list_teacher_submissions($workshop, $USER);
  380
+			echo "<HR SIZE=1 NOSHADE>";
  381
+			echo "<BR>";
  382
+			
  383
+			workshop_list_student_submissions($workshop, $USER);
  384
+			echo "<HR SIZE=1 NOSHADE>";
  385
+			echo "<BR>";
  386
+			}
  387
+			
  388
+		// list previous submissions from this user (could be a teacher or a student)
381 389
 		workshop_list_user_submissions($workshop, $USER);
382 390
 	
383 391
 		echo "<HR SIZE=1 NOSHADE>";

0 notes on commit 0978073

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