Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Minor bug fixes; additions to teachers admin screen; minor changes to

operation of pre-submission assessments.
  • Loading branch information...
commit a21db785d1091a988e532254f1b673b095ac7fdc 1 parent c477ecb
authored August 18, 2003
32  mod/workshop/assessments.php
... ...
@@ -1,5 +1,4 @@
1  
-<?PHP  
2  
-/*	assessments.php: version 1.0 30th April 2003 */
  1
+<?PHP  // $Id: lib.php,v 1.0 14 Aug 2003
3 2
 
4 3
 /*************************************************
5 4
 	ACTIONS handled are:
@@ -64,8 +63,6 @@
64 63
 
65 64
     if ($course->category) {
66 65
         $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
67  
-    } else {
68  
-        $navigation = "";
69 66
     }
70 67
 
71 68
     $strworkshops = get_string("modulenameplural", "workshop");
@@ -212,18 +209,18 @@
212 209
 			}
213 210
 	
214 211
 		if (! $submission = get_record("workshop_submissions", "id", $sid)) {
215  
-			error("assess submission is misconfigured");
  212
+			error("Assess submission is misconfigured - no submission record!");
216 213
 			}
217 214
 		
218  
-		$yearfromnow = time() + 365 * 86400;
219  
-		// is there an assessment record, create one and set timecreated way in the future, this is reset when record is updated
  215
+		// there can be an assessment record (for teacher submissions), if there isn't...
220 216
 		if (!$assessment = workshop_get_submission_assessment($submission, $USER)) {
  217
+			$yearfromnow = time() + 365 * 86400;
  218
+			// ...create one and set timecreated way in the future, this is reset when record is updated
221 219
 			$assessment->workshopid = $workshop->id;
222 220
 			$assessment->submissionid = $submission->id;
223 221
 			$assessment->userid = $USER->id;
224 222
 			$assessment->grade = -1; // set impossible grade
225 223
 			$assessment->timecreated = $yearfromnow;
226  
-			$assessment->timeagreed = 0;
227 224
 			$assessment->timegraded = 0;
228 225
 			if (!$assessment->id = insert_record("workshop_assessments", $assessment)) {
229 226
 				error("Could not insert workshop assessment!");
@@ -792,15 +789,16 @@
792 789
 			set_field("workshop_assessments", "generalcomment", $form->generalcomment, "id", $assessment->id);
793 790
 			}
794 791
 			
  792
+	    add_to_log($course->id, "workshop", "assess", "view.php?a=$workshop->id", "$workshop->id");
  793
+
795 794
 		// show grade if grading strategy is not zero
796 795
 		if ($workshop->gradingstrategy) {
797  
-			echo "<B>".get_string("thegradeis", "workshop").": ".number_format($grade, 2)."% (".get_string("maximumgrade").
798  
-				" ".number_format($workshop->grade)."%)</B>\n";
  796
+			redirect("view.php?id=$cm->id", get_string("thegradeis", "workshop").": ".number_format($grade, 2)."% (".get_string("maximumgrade").
  797
+				" ".number_format($workshop->grade)."%)");
  798
+			}
  799
+		else {
  800
+			redirect("view.php?id=$cm->id");
799 801
 			}
800  
-			
801  
-		print_continue("view.php?id=$cm->id");
802  
-		
803  
-	    add_to_log($course->id, "workshop", "assess", "view.php?a=$workshop->id", "$workshop->id");
804 802
 		}
805 803
 
806 804
 
@@ -851,16 +849,16 @@
851 849
 			set_field("workshop_assessments", "gradinggrade", $form->gradinggrade, "id", $assessment->id);
852 850
 			set_field("workshop_assessments", "timegraded", $timenow, "id", $assessment->id);
853 851
 			set_field("workshop_assessments", "mailed", 0, "id", $assessment->id);
854  
-			echo "<CENTRE><B>".get_string("savedok", "workshop")."</B></CENTER><BR>\n";
  852
+			echo "<CENTRE><B>".get_string("savedok", "workshop")."</B></CENTRE><BR>\n";
855 853
 			
856 854
 			add_to_log($course->id, "workshop", "grade", "view.php?id=$cm->id", "$workshop->id");
857 855
 			}
858 856
 		switch ($form->stype) {
859 857
 			case "student" : 
860  
-				print_continue("assessments.php?action=listungradedstudentsubmissions&id=$cm->id");
  858
+				redirect("assessments.php?action=listungradedstudentsubmissions&id=$cm->id");
861 859
 				break;
862 860
 			case "teacher" : 
863  
-				print_continue("assessments.php?action=listungradedteachersubmissions&id=$cm->id");
  861
+				redirect("assessments.php?action=listungradedteachersubmissions&id=$cm->id");
864 862
 				break;
865 863
 			}
866 864
 		}
258  mod/workshop/lib.php
... ...
@@ -1,4 +1,4 @@
1  
-<?PHP  // $Id: lib.php,v 1.0 30th April 2003
  1
+<?PHP  // $Id: lib.php,v 1.0 14 Aug 2003
2 2
 
3 3
 include_once("$CFG->dirroot/files/mimetypes.php");
4 4
 
@@ -36,10 +36,6 @@
36 36
 	define("COMMENTSCALE", 20);
37 37
 	}
38 38
 
39  
-if (!defined("PASSGRADE")) {
40  
-	define("PASSGRADE", 8); // 40% of COMMENTSCALE
41  
-	}
42  
-
43 39
 /*** Standard Moodle functions ******************
44 40
 function workshop_add_instance($workshop) 
45 41
 function workshop_update_instance($workshop) 
@@ -171,9 +167,8 @@ function workshop_delete_instance($id) {
171 167
 }
172 168
 
173 169
 function workshop_user_outline($course, $user, $mod, $workshop) {
174  
-/// Just lists rough details about a workshop submission
175 170
     if ($submission = workshop_get_student_submission($workshop, $user)) {
176  
-        $result->info = $submission->title;
  171
+		$result->info = $submission->title;
177 172
         if ($submission->finalgrade) {
178 173
             $result->info .= ", ".get_string("grade").": $submission->finalgrade";
179 174
         }
@@ -664,6 +659,7 @@ function workshop_count_teacher_submissions_for_assessment($workshop, $user) {
664 659
 function workshop_count_ungraded_assessments_student($workshop) {
665 660
 function workshop_count_ungraded_assessments_teacher($workshop) {
666 661
 function workshop_count_user_assessments($worshop, $user, $type = "all") { $type is all, student or teacher
  662
+function workshop_count_user_submissions($workshop, $user) {
667 663
 
668 664
 function workshop_delete_submitted_files($workshop, $submission) {
669 665
 function workshop_delete_user_files($workshop, $user, $exception) {
@@ -674,6 +670,7 @@ function workshop_file_area_name($workshop, $submission) {
674 670
 function workshop_get_assessments($submission) {
675 671
 function workshop_get_comments($assessment) {
676 672
 function workshop_get_student_assessments($workshop, $user) {
  673
+function workshop_get_student_submission($workshop, $user) {
677 674
 function workshop_get_student_submission_assessments($workshop) {
678 675
 function workshop_get_student_submissions($workshop) {
679 676
 function workshop_get_submission_assessment($submission, $user) {
@@ -730,8 +727,9 @@ function workshop_count_all_submissions_for_assessment($workshop, $user) {
730 727
 
731 728
 
732 729
 function workshop_count_assessments($submission) {
733  
-	// Return the assessments for this submission, 
734  
-   return count_records_select("workshop_assessments", "submissionid = $submission->id");
  730
+	// Return the (real) assessments for this submission, 
  731
+	$timenow = time();
  732
+   return count_records_select("workshop_assessments", "submissionid = $submission->id AND timecreated < $timenow");
735 733
 }
736 734
 
737 735
 function workshop_count_comments($assessment) {
@@ -897,9 +895,10 @@ function workshop_count_ungraded_assessments_teacher($workshop) {
897 895
 
898 896
 
899 897
 function workshop_count_user_assessments($workshop, $user, $stype = "all") {
900  
-	// returns the number of assessments made by a user, all of them, or just those for the student or teacher submissions
  898
+	// returns the number of assessments allocated/made by a user, all of them, or just those for the student or teacher submissions
901 899
 	// the student's self assessments are included in the count
902  
-	// the maxeditingtime is NOT taken into account here
  900
+	// the maxeditingtime is NOT taken into account here also allocated assessments which have not yet
  901
+	// been done are counted as well
903 902
 	
904 903
 	$n = 0;
905 904
 	if ($assessments = workshop_get_user_assessments($workshop, $user)) {
@@ -927,6 +926,30 @@ function workshop_count_user_assessments($workshop, $user, $stype = "all") {
927 926
 	}
928 927
 
929 928
 
  929
+function workshop_count_user_assessments_done($workshop, $user) {
  930
+	// returns the number of assessments actually done by a user
  931
+	// the student's self assessments are included in the count
  932
+	// the maxeditingtime is NOT taken into account here 
  933
+	
  934
+	$n = 0;
  935
+	$timenow = time();
  936
+	if ($assessments = workshop_get_user_assessments($workshop, $user)) {
  937
+		 foreach ($assessments as $assessment) {
  938
+			if ($assessment->timecreated < $timenow) {
  939
+				$n++;
  940
+				}
  941
+			}
  942
+		}
  943
+	return $n;
  944
+	}
  945
+
  946
+
  947
+function workshop_count_user_submissions($workshop, $user) {
  948
+	// returns the number of submissions make by this user
  949
+	return count_records("workshop_submissions", "workshopid", $workshop->id, "userid", $user->id);
  950
+	}
  951
+
  952
+
930 953
 function workshop_delete_submitted_files($workshop, $submission) {
931 954
 // Deletes the files in the workshop area for this submission
932 955
 
@@ -1015,6 +1038,18 @@ function workshop_get_student_assessments($workshop, $user) {
1015 1038
 }
1016 1039
 
1017 1040
 
  1041
+function workshop_get_student_submission($workshop, $user) {
  1042
+// Return a submission for a particular user
  1043
+	global $CFG;
  1044
+
  1045
+    $submission = get_record("workshop_submissions", "workshopid", $workshop->id, "userid", $user->id);
  1046
+    if (!empty($submission->timecreated)) {
  1047
+        return $submission;
  1048
+    }
  1049
+    return NULL;
  1050
+}
  1051
+
  1052
+
1018 1053
 function workshop_get_student_submission_assessments($workshop) {
1019 1054
 // Return all assessments on the student submissions, order by youngest first, oldest last
1020 1055
 	global $CFG;
@@ -1049,17 +1084,6 @@ function workshop_get_student_submissions($workshop, $order = "title") {
1049 1084
 							  ORDER BY $order");
1050 1085
 }
1051 1086
 
1052  
-function workshop_get_student_submission($workshop, $user) {
1053  
-// Return a submission for a particular user
1054  
-	global $CFG;
1055  
-
1056  
-    $submission = get_record("workshop_submissions", "workshopid", $workshop->id, "userid", $user->id);
1057  
-    if (!empty($submission->timecreated)) {
1058  
-        return $submission;
1059  
-    }
1060  
-    return NULL;
1061  
-}
1062  
-
1063 1087
 
1064 1088
 function workshop_get_submission_assessment($submission, $user) {
1065 1089
 	// Return the user's assessment for this submission
@@ -1570,7 +1594,7 @@ function workshop_list_submissions_for_admin($workshop, $order) {
1570 1594
 					AND userid = $USER->id")) {
1571 1595
 				$curtime = time();
1572 1596
 				if (($curtime - $assessment->timecreated) > $CFG->maxeditingtime) {
1573  
-					$action .= " | <a href=\"assessments.php?action=assesssubmission&a=$workshop->id&aid=$assessment->id\">"
  1597
+					$action .= " | <a href=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">"
1574 1598
 						.get_string("reassess", "workshop")."</a>";
1575 1599
 					}
1576 1600
 				else { // there's still time left to edit...
@@ -1593,6 +1617,51 @@ function workshop_list_submissions_for_admin($workshop, $order) {
1593 1617
 		print_table($table);
1594 1618
 		}
1595 1619
 
  1620
+	// list student assessments
  1621
+	// Get all the students...
  1622
+	if ($users = get_course_students($course->id, "u.firstname, u.lastname")) {
  1623
+		$timenow = time();
  1624
+		print_heading(get_string("studentassessments", "workshop", $course->student));
  1625
+		unset($table);
  1626
+		$table->head = array(get_string("name"), get_string("title", "workshop"), get_string("action", "workshop"));
  1627
+		$table->align = array ("left", "left", "left");
  1628
+		$table->size = array ("*", "*", "*");
  1629
+		$table->cellpadding = 2;
  1630
+		$table->cellspacing = 0;
  1631
+		foreach ($users as $user) {
  1632
+			if ($assessments = workshop_get_user_assessments($workshop, $user)) {
  1633
+				$title ='';
  1634
+				foreach ($assessments as $assessment) {
  1635
+					if (!$submission = get_record("workshop_submissions", "id", $assessment->submissionid)) {
  1636
+						error("Workshop_list_submissions_for_admin: Submission record not found!");
  1637
+						}
  1638
+					$title .= $submission->title;
  1639
+					// test for allocated assesments which have not been done
  1640
+					if ($assessment->timecreated < $timenow) {
  1641
+						$title .= " {".number_format($assessment->grade, 0)."%";
  1642
+						}
  1643
+					else { // assessment record created but user has not yet assessed this submission
  1644
+						$title .= " {-";
  1645
+						}
  1646
+					if ($assessment->timegraded) {
  1647
+						$title .= "/".number_format($assessment->gradinggrade*100/COMMENTSCALE,0)."%";
  1648
+						}
  1649
+					$title .= "} ";
  1650
+					if ($realassessments = workshop_count_user_assessments_done($workshop, $user)) {
  1651
+						$action = "<a href=\"assessments.php?action=adminlistbystudent&a=$workshop->id&userid=$user->id\">".
  1652
+							get_string("liststudentsassessments", "workshop")." ($realassessments)</a>";
  1653
+						}
  1654
+					else {
  1655
+						$action ="";
  1656
+						}
  1657
+					}
  1658
+				$table->data[] = array("$user->firstname $user->lastname", $title, $action);
  1659
+				}
  1660
+			}
  1661
+		print_table($table);
  1662
+		}
  1663
+
  1664
+	// now the sudent submissions
1596 1665
 	echo "<CENTER><P><B>".get_string("studentsubmissions", "workshop", $course->student)."</B></CENTER><BR>\n";
1597 1666
 	unset($table);
1598 1667
 	switch ($order) {
@@ -1639,14 +1708,11 @@ function workshop_list_submissions_for_admin($workshop, $order) {
1639 1708
 				$action .= " | <a href=\"assessments.php?action=adminlist&a=$workshop->id&sid=$submission->id\">".
1640 1709
 					get_string("listassessments", "workshop")." ($nassessments)</a>";
1641 1710
 				}
1642  
-			if ($nassessments = workshop_count_user_assessments($workshop, $user, "all")) { // has user assessed anything?
1643  
-				$action .= " | <a href=\"assessments.php?action=adminlistbystudent&a=$workshop->id&userid=$user->id\">".
1644  
-					get_string("liststudentsassessments", "workshop")." ($nassessments)</a>";
1645  
-				}
1646 1711
 			$action .= " | <a href=\"submissions.php?action=adminconfirmdelete&a=$workshop->id&sid=$submission->id\">".
1647 1712
 				get_string("delete", "workshop")."</a>";
1648  
-			$table->data[] = array("$user->firstname $user->lastname", workshop_print_submission_title($workshop, $submission), 
1649  
-				$action);
  1713
+			$table->data[] = array("$user->firstname $user->lastname", $submission->title.
  1714
+				" ".workshop_print_submission_assessments($workshop, $submission, "teacher").
  1715
+				" ".workshop_print_submission_assessments($workshop, $submission, "student"), $action);
1650 1716
 			}
1651 1717
 		print_table($table);
1652 1718
 		}
@@ -1713,29 +1779,36 @@ function workshop_list_teacher_submissions($workshop, $user) {
1713 1779
 	$nassessed = count_records_select("workshop_assessments", "workshopid = $workshop->id
1714 1780
 					AND userid = $user->id");
1715 1781
 	if ($nassessed < $workshop->ntassessments) { 
1716  
-		// if user has not successfully assessed enough display one of the teacher submissions...
  1782
+		// if user has not assessed enough, set up "future" assessment records for this user for the teacher submissions...
1717 1783
 		// ... first count the number of assessments for each teacher submission...
1718 1784
 		if ($submissions = workshop_get_teacher_submissions($workshop)) {
1719 1785
 			srand ((float)microtime()*1000000); // initialise random number generator
1720 1786
 			foreach ($submissions as $submission) {
1721 1787
 				$n = count_records("workshop_assessments", "submissionid", $submission->id);
1722  
-				// ...OK to have zero, we add a small random number to randomise things
  1788
+				// ...OK to have zero, we add a small random number to randomise things...
1723 1789
 				$nassessments[$submission->id] = $n + rand(0, 99) / 100;
1724 1790
 				}
1725  
-			// put the submissions with the lowest number of assessments first
  1791
+			// ...put the submissions with the lowest number of assessments first...
1726 1792
 			asort($nassessments);
1727 1793
 			reset($nassessments);
1728  
-			$comment = "";
1729  
-			foreach ($nassessments as $submissionid => $n) { // actually only the first one is displayed...
1730  
-				$comment = '';
  1794
+			foreach ($nassessments as $submissionid => $n) { // break out of loop when we allocated enough assessments...
1731 1795
 				$submission = get_record("workshop_submissions", "id", $submissionid);
1732  
-				// ... provided the user has NOT already assessed that submission
1733  
-				if (!$assessment = get_record_select("workshop_assessments", "submissionid = $submissionid
1734  
-						AND userid = $user->id")) {
1735  
-					$action = "<A HREF=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">".
1736  
-						get_string("assess", "workshop")."</A>";
1737  
-					$table->data[] = array(workshop_print_submission_title($workshop, $submission), $action, $comment);
1738  
-					break;
  1796
+				// ... provided the user has NOT already assessed that submission...
  1797
+				if (!$assessment = workshop_get_submission_assessment($submission, $user)) {
  1798
+					$yearfromnow = time() + 365 * 86400;
  1799
+					// ...create one and set timecreated way in the future, this is reset when record is updated
  1800
+					$assessment->workshopid = $workshop->id;
  1801
+					$assessment->submissionid = $submission->id;
  1802
+					$assessment->userid = $user->id;
  1803
+					$assessment->grade = -1; // set impossible grade
  1804
+					$assessment->timecreated = $yearfromnow;
  1805
+					if (!$assessment->id = insert_record("workshop_assessments", $assessment)) {
  1806
+						error("Could not insert workshop assessment!");
  1807
+						}
  1808
+					$nassessed++;
  1809
+					if ($nassessed >= $workshop->ntassessments) {
  1810
+						break;
  1811
+						}
1739 1812
 					}
1740 1813
 				}
1741 1814
 			}
@@ -1750,16 +1823,16 @@ function workshop_list_teacher_submissions($workshop, $user) {
1750 1823
 			// submission from a teacher?
1751 1824
 			if (isteacher($workshop->course, $submission->userid)) {
1752 1825
 				$comment = '';
1753  
-				// user assessment has three states: still fresh; graded but not passed; and static (may or may not be graded 
1754  
-				if (($timenow - $assessment->timecreated) < $CFG->maxeditingtime) { // there's still time left to edit...
  1826
+				// user assessment has three states: record created but not assessed (date created in the future); 
  1827
+				// just assessed but still editable; and "static" (may or may not have been graded by teacher, that
  1828
+				// is shown in the comment) 
  1829
+				if ($assessment->timecreated> $timenow) { // user needs to assess this submission
1755 1830
 					$action = "<A HREF=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">".
1756  
-						get_string("edit", "workshop")."</A>";
  1831
+						get_string("assess", "workshop")."</A>";
1757 1832
 					}
1758  
-				// has teacher graded user's assessment and it has not passed?
1759  
-				elseif ($assessment->timegraded and (($timenow - $assessment->timegraded) > $CFG->maxeditingtime) and 
1760  
-						($assessment->gradinggrade < PASSGRADE)) { // allow the user to have another go 
1761  
-					$action = "<A HREF=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">"
1762  
-						.get_string("reassess", "workshop")."</A>";
  1833
+				elseif (($timenow - $assessment->timecreated) < $CFG->maxeditingtime) { // there's still time left to edit...
  1834
+					$action = "<A HREF=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">".
  1835
+						get_string("edit", "workshop")."</A>";
1763 1836
 					}
1764 1837
 				else { 
1765 1838
 					$action = "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">"
@@ -1767,8 +1840,7 @@ function workshop_list_teacher_submissions($workshop, $user) {
1767 1840
 					}
1768 1841
 				// see if teacher has graded assessment
1769 1842
 				if ($assessment->timegraded and (($timenow - $assessment->timegraded) > $CFG->maxeditingtime)) {
1770  
-					$comment .= get_string("gradedbyteacher", "workshop", $course->teacher);
1771  
-					$comment .= " (".number_format($assessment->gradinggrade*100/COMMENTSCALE,0)."%)";
  1843
+					$comment .= get_string("thereisfeedbackfromtheteacher", "workshop", $course->teacher);
1772 1844
 					}
1773 1845
 				$table->data[] = array(workshop_print_submission_title($workshop, $submission), $action, $comment);
1774 1846
 				}
@@ -1782,9 +1854,10 @@ function workshop_list_unassessed_student_submissions($workshop, $user) {
1782 1854
 	// list the student submissions not assessed by this user
1783 1855
 	global $CFG;
1784 1856
 	
1785  
-	$table->head = array (get_string("title", "workshop"), get_string("action", "workshop"), get_string("comment", "workshop"));
1786  
-	$table->align = array ("LEFT", "LEFT", "LEFT");
1787  
-	$table->size = array ("*", "*", "*");
  1857
+	$table->head = array (get_string("title", "workshop"), get_string("submittedby", "workshop"),
  1858
+		get_string("action", "workshop"), get_string("comment", "workshop"));
  1859
+	$table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
  1860
+	$table->size = array ("*", "*", "*", "*");
1788 1861
 	$table->cellpadding = 2;
1789 1862
 	$table->cellspacing = 0;
1790 1863
 
@@ -1797,15 +1870,19 @@ function workshop_list_unassessed_student_submissions($workshop, $user) {
1797 1870
 				$timenow = time();
1798 1871
 				if (($timenow - $assessment->timecreated < $CFG->maxeditingtime)) {
1799 1872
 					// last chance salon
  1873
+					$submissionowner = get_record("user", "id", $submission->userid);
1800 1874
 					$action = "<A HREF=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">".
1801 1875
 						get_string("edit", "workshop")."</A>";
1802  
-					$table->data[] = array(workshop_print_submission_title($workshop, $submission), $action, $comment);
  1876
+					$table->data[] = array(workshop_print_submission_title($workshop, $submission), 
  1877
+						$submissionowner->firstname." ".$submissionowner->lastname, $action, $comment);
1803 1878
 					}
1804 1879
 				}
1805 1880
 			else { // no assessment
  1881
+				$submissionowner = get_record("user", "id", $submission->userid);
1806 1882
 				$action = "<A HREF=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">".
1807 1883
 					get_string("assess", "workshop")."</A>";
1808  
-				$table->data[] = array(workshop_print_submission_title($workshop, $submission), $action, $comment);
  1884
+				$table->data[] = array(workshop_print_submission_title($workshop, $submission), 
  1885
+					$submissionowner->firstname." ".$submissionowner->lastname, $action, $comment);
1809 1886
 				}
1810 1887
 			}
1811 1888
 		if (isset($table->data)) {
@@ -1856,7 +1933,8 @@ function workshop_list_ungraded_assessments($workshop, $stype) {
1856 1933
 	global $CFG;
1857 1934
 	
1858 1935
 	// lists all the assessments of student submissions for grading by teacher
1859  
-	$table->head = array (get_string("title", "workshop"), get_string("name"),get_string("timeassessed", "workshop"), get_string("action", "workshop"));
  1936
+	$table->head = array (get_string("title", "workshop"), get_string("submittedby", "workshop"),
  1937
+	get_string("assessor", "workshop"), get_string("timeassessed", "workshop"), get_string("action", "workshop"));
1860 1938
 	$table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
1861 1939
 	$table->size = array ("*", "*", "*", "*");
1862 1940
 	$table->cellpadding = 2;
@@ -1883,9 +1961,11 @@ function workshop_list_ungraded_assessments($workshop, $stype) {
1883 1961
 						get_string("grade", "workshop")."</A>";
1884 1962
 					}
1885 1963
 				$submission = get_record("workshop_submissions", "id", $assessment->submissionid);
1886  
-				$user = get_record("user", "id", $assessment->userid);
  1964
+				$submissionowner = get_record("user", "id", $submission->userid);
  1965
+				$assessor = get_record("user", "id", $assessment->userid);
1887 1966
 				$table->data[] = array(workshop_print_submission_title($workshop, $submission), 
1888  
-					$user->firstname." ".$user->lastname, userdate($assessment->timecreated), $action);
  1967
+					$submissionowner->firstname." ".$submissionowner->lastname, 
  1968
+					$assessor->firstname." ".$assessor->lastname, userdate($assessment->timecreated), $action);
1889 1969
 				}
1890 1970
 			}
1891 1971
 		if (isset($table->data)) {
@@ -2365,11 +2445,14 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
2365 2445
 		echo text_to_html($assessment->teachercomment);
2366 2446
 		echo "&nbsp;</TD>\n";
2367 2447
 		echo "</TR>\n";
2368  
-		echo "<TR valign=top>\n";
2369  
-		echo "	<TD align=right><P><B>". get_string("teachersgrade", "workshop").":</B></P></TD>\n";
2370  
-		echo "	<TD>\n";
2371  
-		echo number_format($assessment->gradinggrade*100/COMMENTSCALE,0)."%";
2372  
-		echo "&nbsp;</TD>\n";
  2448
+		// only show the grading grade if it's the teacher
  2449
+		if (isteacher($course->id)) {
  2450
+			echo "<TR valign=top>\n";
  2451
+			echo "	<TD align=right><P><B>". get_string("teachersgrade", "workshop").":</B></P></TD>\n";
  2452
+			echo "	<TD>\n";
  2453
+			echo number_format($assessment->gradinggrade*100/COMMENTSCALE,0)."%";
  2454
+			echo "&nbsp;</TD>\n";
  2455
+			}
2373 2456
 		echo "</TR>\n";
2374 2457
 		echo "<TR valign=top>\n";
2375 2458
 		echo "	<TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
@@ -2472,32 +2555,41 @@ function workshop_print_feedback($course, $submission) {
2472 2555
 
2473 2556
 function workshop_print_submission_assessments($workshop, $submission, $type) {
2474 2557
 	// Returns the teacher or peer grade and a hyperlinked list of grades for this submission
2475  
-
  2558
+	
  2559
+	$str = '';
2476 2560
 	if ($assessments = workshop_get_assessments($submission)) {
2477 2561
 		switch ($type) {
2478 2562
 			case "teacher" : 
2479  
-				$str = "$submission->teachergrade  (";
  2563
+				if ($submission->teachergrade) { // if there's a final teacher's grade...
  2564
+					$str = "$submission->teachergrade  ";
  2565
+					}
2480 2566
 				foreach ($assessments as $assessment) {
2481 2567
 					if (isteacher($workshop->course, $assessment->userid)) {
2482  
-						$str .= "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">";
2483  
-						$str .= number_format($assessment->grade, 1)."</A> ";
  2568
+						$str .= "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">[";
  2569
+						$str .= number_format($assessment->grade, 0)."%";
  2570
+						if ($assessment->gradinggrade) { // funny, teacher is grading self!
  2571
+							$str .= "/".number_format($assessment->gradinggrade*100/COMMENTSCALE,0)."%";
  2572
+							}
  2573
+						$str .= "]</A> ";
2484 2574
 						}
2485 2575
 					}
2486 2576
 				break;
2487 2577
 			case "student" : 
2488  
-				$str = "$submission->peergrade  (";
  2578
+				if ($submission->peergrade) { // if there's a final peer grade...
  2579
+					$str = "$submission->peergrade ";
  2580
+					}
2489 2581
 				foreach ($assessments as $assessment) {
2490 2582
 					if (isstudent($workshop->course, $assessment->userid)) {
2491  
-						$str .= "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">";
2492  
-						$str .= number_format($assessment->grade, 1)."</A> ";
  2583
+						$str .= "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">{";
  2584
+						$str .= number_format($assessment->grade, 0)."%";
  2585
+						if ($assessment->gradinggrade) {
  2586
+							$str .= "/".number_format($assessment->gradinggrade*100/COMMENTSCALE,0)."%";
  2587
+							}
  2588
+						$str .= "}</A> ";
2493 2589
 						}
2494 2590
 					}
2495 2591
 				break;
2496 2592
 			}
2497  
-		$str .= ")";
2498  
-		}
2499  
-	else {
2500  
-		$str ="0";
2501 2593
 		}
2502 2594
     return $str;
2503 2595
 }
@@ -2630,7 +2722,7 @@ function workshop_print_upload_form($workshop) {
2630 2722
     echo "<FORM ENCTYPE=\"multipart/form-data\" METHOD=\"POST\" ACTION=upload.php>";
2631 2723
     echo " <INPUT TYPE=hidden NAME=MAX_FILE_SIZE value=\"$workshop->maxbytes\">";
2632 2724
     echo " <INPUT TYPE=hidden NAME=a VALUE=\"$workshop->id\">";
2633  
-	echo get_string("title", "workshop")." <INPUT NAME=\"title\" TYPE=\"text\" SIZE=\"60\" MAXSIZE=\"100\"><BR><BR>\n";
  2725
+	echo "<b>".get_string("title", "workshop")."</b>: <INPUT NAME=\"title\" TYPE=\"text\" SIZE=\"60\" MAXSIZE=\"100\"><BR><BR>\n";
2634 2726
     echo " <INPUT NAME=\"newfile\" TYPE=\"file\" size=\"50\">";
2635 2727
     echo " <INPUT TYPE=submit NAME=save VALUE=\"".get_string("uploadthisfile")."\">";
2636 2728
     echo "</FORM>";
@@ -2665,25 +2757,25 @@ function workshop_print_user_assessments($workshop, $user) {
2665 2757
 
2666 2758
 
2667 2759
 function workshop_test_user_assessments($workshop, $user) {
2668  
-	// see if user has passed the required number of assessments of teachers submissions
  2760
+	// see if user has assessed required number of assessments of teachers submissions...
2669 2761
 	global $CFG;
2670 2762
 	
2671  
-	$result = true;
  2763
+	$result = false;
2672 2764
 	$n = 0;
2673 2765
 	$timenow =time();
2674 2766
 	if ($workshop->ntassessments) { // they have to pass some!
2675 2767
 		if ($submissions = workshop_get_teacher_submissions($workshop)) {
2676 2768
 			foreach ($submissions as $submission) {
2677 2769
 				if ($assessment = workshop_get_submission_assessment($submission, $user)) {
2678  
-					if (($assessment->gradinggrade >= PASSGRADE) and 
2679  
-							(($timenow - $assessment->timegraded) > $CFG->maxeditingtime)) {
  2770
+					// ...the date stamp on the assessment should be in the past 
  2771
+					if ($assessment->timecreated < $timenow) {
2680 2772
 						$n++;
2681 2773
 						}
2682 2774
 					}
2683 2775
 				}
2684 2776
 			}
2685  
-		if ($n < min($workshop->ntassessments, workshop_count_teacher_submissions($workshop))) {
2686  
-			$result = false; 
  2777
+		if ($n >= min($workshop->ntassessments, workshop_count_teacher_submissions($workshop))) {
  2778
+			$result = true; 
2687 2779
 			}
2688 2780
 		}
2689 2781
 	return $result;
3  mod/workshop/submissions.php
... ...
@@ -1,5 +1,4 @@
1  
-<?PHP  
2  
-/*	submissions.php: version 1.0 30th April 2003 */
  1
+<?PHP  // $Id: lib.php,v 1.0 14 Aug 2003
3 2
 
4 3
 /*************************************************
5 4
 	ACTIONS handled are:
18  mod/workshop/view.php
... ...
@@ -1,4 +1,4 @@
1  
-<?PHP  // $Id: view.php, v1.0 30th April 2003
  1
+<?PHP  // $Id: view.php, v1.0 14 Aug 2003
2 2
 
3 3
 /*************************************************
4 4
 	ACTIONS handled are:
@@ -287,17 +287,15 @@
287 287
 		echo format_text($workshop->description, $workshop->format);
288 288
 		print_simple_box_end();
289 289
 		echo "<br />";
290  
-		// in Stage 1? - assess teacher's submissions to a satisfactory level
  290
+		// in Stage 1? - assess teacher's submissions ("satisfactory level" dropped 14/8/03)
291 291
 		if (!workshop_test_user_assessments($workshop, $USER)) {
292 292
 			print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop", $course->teacher));
293  
-			print_heading(get_string("theseasessmentsaregradedbytheteacher", "workshop", $course->teacher), "center", 5);
294 293
 			workshop_list_teacher_submissions($workshop, $USER);
295 294
 			}
296 295
 		// in stage 2? - submit own first attempt
297 296
 		else {
298  
-			if ($workshop->ntassessments) { // display message if student had to assess the teacher's examples
299  
-				print_heading("<a href=\"assessments.php?action=listteachersubmissions&id=$cm->id\">".
300  
-					get_string("assessmentsareok", "workshop")."</a>");
  297
+			if ($workshop->ntassessments) { // show assessment the teacher's examples, there may be feedback from teacher
  298
+				workshop_list_teacher_submissions($workshop, $USER);
301 299
 				}
302 300
 			if (!workshop_get_user_submissions($workshop, $USER)) {
303 301
 				// print upload form
@@ -362,7 +360,7 @@
362 360
 		echo "<B>".get_string("duedate", "assignment")."</B>: $strduedate<BR>";
363 361
 		echo "<B>".get_string("maximumgrade")."</B>: $workshop->grade<BR>";
364 362
 		echo "<B>".get_string("detailsofassessment", "workshop")."</B>: 
365  
-			<A HREF=\"assessments.php?id=$cm->id&action=displayelements\">".
  363
+			<A HREF=\"assessments.php?id=$cm->id&action=displaygradingform\">".
366 364
 			get_string("specimenassessmentform", "workshop")."</A><BR>";
367 365
 		print_simple_box_end();
368 366
 		echo "<BR>";
@@ -403,7 +401,11 @@
403 401
 			"view.php?id=$cm->id&action=openworkshop",
404 402
 			"view.php?id=$cm->id&action=closeworkshop",
405 403
 			"view.php?id=$cm->id&action=makefinalgradesavailable");
406  
-		$tabs->highlight = $workshop->phase - 1;
  404
+		if ($workshop->phase) { // phase 1 or more
  405
+			$tabs->highlight = $workshop->phase - 1;
  406
+			} else {
  407
+			$tabs->highlight = 0; // phase is zero
  408
+			}
407 409
 		workshop_print_tabbed_heading($tabs);
408 410
 		echo "<CENTER><P>\n";
409 411
 			switch ($workshop->phase) {

0 notes on commit a21db78

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