Added visibility check to all workshop pages, see bug 2450.
This commit is contained in:
+24
-20
@@ -1,7 +1,7 @@
|
||||
<?php // $Id: assess.php
|
||||
|
||||
require("../../config.php");
|
||||
require("lib.php");
|
||||
require("lib.php");
|
||||
require("locallib.php");
|
||||
|
||||
require_variable($sid); // Submission ID
|
||||
@@ -20,17 +20,21 @@
|
||||
if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) {
|
||||
error("No coursemodule found");
|
||||
}
|
||||
|
||||
|
||||
if (!$redirect) {
|
||||
$redirect = urlencode($_SERVER["HTTP_REFERER"].'#sid='.$submission->id);
|
||||
}
|
||||
|
||||
|
||||
require_login($course->id);
|
||||
if (!$cm->visible and !isteacher($course->id)) {
|
||||
print_header();
|
||||
notice(get_string('activityiscurrentlyhidden'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
$strworkshops = get_string("modulenameplural", "workshop");
|
||||
$strworkshop = get_string("modulename", "workshop");
|
||||
$strassess = get_string("assess", "workshop");
|
||||
|
||||
|
||||
/// Now check whether we need to display a frameset
|
||||
|
||||
if (empty($_GET['frameset'])) {
|
||||
@@ -43,19 +47,19 @@
|
||||
}
|
||||
|
||||
/// top frame with the navigation bar and the assessment form
|
||||
|
||||
|
||||
if (!empty($_GET['frameset']) and $_GET['frameset'] == "top") {
|
||||
|
||||
|
||||
print_header_simple("$workshop->name", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> -> $strassess",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> -> $strassess",
|
||||
"", '<base target="_parent" />', true);
|
||||
|
||||
|
||||
// there can be an assessment record (for teacher submissions), if there isn't...
|
||||
if (!$assessment = get_record("workshop_assessments", "submissionid", $submission->id, "userid",
|
||||
if (!$assessment = get_record("workshop_assessments", "submissionid", $submission->id, "userid",
|
||||
$USER->id)) {
|
||||
// if it's the teacher see if the user has done a self assessment if so copy it
|
||||
if (isteacher($course->id) and ($assessment = get_record("workshop_assessments", "submissionid",
|
||||
if (isteacher($course->id) and ($assessment = get_record("workshop_assessments", "submissionid",
|
||||
$submission->id, "userid", $submission->userid))) {
|
||||
$assessment = workshop_copy_assessment($assessment, $submission, true);
|
||||
// need to set owner of assessment
|
||||
@@ -103,19 +107,19 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_heading_with_help(get_string("assessthissubmission", "workshop"), "grading", "workshop");
|
||||
|
||||
|
||||
// show assessment and allow changes
|
||||
workshop_print_assessment($workshop, $assessment, true, $allowcomments, $redirect);
|
||||
|
||||
|
||||
print_heading("<a target=\"{$CFG->framename}\" href=\"$redirect\">".get_string("cancel")."</a>");
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/// print bottom frame with the submission
|
||||
|
||||
|
||||
print_header('', '', '', '', '<base target="_parent" />');
|
||||
$title = '"'.$submission->title.'" ';
|
||||
if (isteacher($course->id)) {
|
||||
@@ -123,15 +127,15 @@
|
||||
}
|
||||
print_heading($title);
|
||||
workshop_print_submission($workshop, $submission);
|
||||
|
||||
|
||||
if (isteacher($course->id)) {
|
||||
echo '<br /><center><b>'.get_string('assessments', 'workshop').': </b><br />';
|
||||
echo workshop_print_submission_assessments($workshop, $submission, "all");
|
||||
echo '</center>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
print_footer('none');
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
************************************************/
|
||||
|
||||
require("../../config.php");
|
||||
require("lib.php");
|
||||
require("lib.php");
|
||||
require("locallib.php");
|
||||
|
||||
optional_variable($id, ''); // Course Module ID
|
||||
@@ -56,7 +56,11 @@
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
if (!$cm->visible and !isteacher($course->id)) {
|
||||
print_header();
|
||||
notice(get_string('activityiscurrentlyhidden'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
$navigation = "";
|
||||
if ($course->category) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
@@ -68,17 +72,17 @@
|
||||
|
||||
// ... print the header and...
|
||||
print_header_simple("$workshop->name", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> -> $strassessments",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> -> $strassessments",
|
||||
"", "", true);
|
||||
|
||||
//...get the action
|
||||
//...get the action
|
||||
require_variable($action);
|
||||
|
||||
|
||||
|
||||
/*************** add comment to assessment (by author, assessor or teacher) ***************************/
|
||||
if ($action == 'addcomment') {
|
||||
|
||||
|
||||
print_heading_with_help(get_string("addacomment", "workshop"), "addingacomment", "workshop");
|
||||
// get assessment record
|
||||
if (!$assessmentid = $_REQUEST['aid']) { // comes from link or hidden form variable
|
||||
@@ -124,12 +128,12 @@
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
|
||||
if (!$assessment = get_record("workshop_assessments", "id", $aid)) {
|
||||
error("workshop assessment is misconfigured");
|
||||
}
|
||||
$form = data_submitted("nomatch"); // probably always come from the same page, change this statement
|
||||
|
||||
|
||||
// store the comment in the stock comments table
|
||||
if ($elementno == 99) { // it's the general comment
|
||||
$form->feedback_99 = $form->generalcomment;
|
||||
@@ -143,7 +147,7 @@
|
||||
print_footer($course);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if (!$element->id = insert_record("workshop_stockcomments", $comment)) {
|
||||
error("Could not insert comment into comment bank");
|
||||
}
|
||||
@@ -166,8 +170,8 @@
|
||||
$timenow = time();
|
||||
// don't fiddle about, delete all the old and add the new!
|
||||
delete_records("workshop_grades", "assessmentid", $assessment->id);
|
||||
|
||||
|
||||
|
||||
|
||||
//determine what kind of grading we have
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0: // no grading
|
||||
@@ -184,7 +188,7 @@
|
||||
}
|
||||
$grade = 0; // set to satisfy save to db
|
||||
break;
|
||||
|
||||
|
||||
case 1: // accumulative grading
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->grade as $key => $thegrade) {
|
||||
@@ -204,7 +208,7 @@
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
@@ -215,7 +219,7 @@
|
||||
|
||||
case 2: // error banded graded
|
||||
// Insert all the elements that contain something
|
||||
$error = 0.0;
|
||||
$error = 0.0;
|
||||
for ($i =0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
@@ -249,9 +253,9 @@
|
||||
}
|
||||
echo "<b>".get_string("weightederrorcount", "workshop", intval($error + 0.5))."</b>\n";
|
||||
break;
|
||||
|
||||
|
||||
case 3: // criteria grading
|
||||
// save in the selected criteria value in element zero,
|
||||
// save in the selected criteria value in element zero,
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
@@ -291,7 +295,7 @@
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
@@ -300,18 +304,18 @@
|
||||
break;
|
||||
|
||||
} // end of switch
|
||||
|
||||
|
||||
|
||||
|
||||
// any comment?
|
||||
if (!empty($form->generalcomment)) { // update the object (no need to update the db record)
|
||||
$assessment->generalcomment = $form->generalcomment;
|
||||
}
|
||||
|
||||
|
||||
// redisplay form, going back to original returnto address
|
||||
workshop_print_assessment($workshop, $assessment, true, true, $form->returnto);
|
||||
|
||||
|
||||
// add_to_log($course->id, "workshop", "assess", "viewassessment.php?id=$cm->id&aid=$assessment->id", "$assessment->id", "$cm->id");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -321,11 +325,11 @@
|
||||
if (empty($_GET['aid'])) {
|
||||
error("Confirm delete: assessment id missing");
|
||||
}
|
||||
|
||||
notice_yesno(get_string("confirmdeletionofthisitem","workshop", get_string("assessment", "workshop")),
|
||||
|
||||
notice_yesno(get_string("confirmdeletionofthisitem","workshop", get_string("assessment", "workshop")),
|
||||
"assessments.php?action=delete&id=$cm->id&aid=$_GET[aid]", "submissions.php?action=adminlist&id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* delete ************************************/
|
||||
elseif ($action == 'delete' ) {
|
||||
@@ -333,17 +337,17 @@
|
||||
if (empty($_GET['aid'])) {
|
||||
error("Delete: submission id missing");
|
||||
}
|
||||
|
||||
|
||||
print_string("deleting", "workshop");
|
||||
// first delete all the associated records...
|
||||
delete_records("workshop_comments", "assessmentid", $_GET['aid']);
|
||||
delete_records("workshop_grades", "assessmentid", $_GET['aid']);
|
||||
// ...now delete the assessment...
|
||||
delete_records("workshop_assessments", "id", $_GET['aid']);
|
||||
|
||||
|
||||
print_continue("view.php?id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************** admin list of asssessments (of a submission) (by teachers)**************/
|
||||
elseif ($action == 'adminlist') {
|
||||
@@ -351,7 +355,7 @@
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
|
||||
if (empty($_GET['sid'])) {
|
||||
error ("Workshop asssessments: adminlist called with no sid");
|
||||
}
|
||||
@@ -367,7 +371,7 @@
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
|
||||
if (empty($_GET['userid'])) {
|
||||
error ("Workshop asssessments: adminlistbystudent called with no userid");
|
||||
}
|
||||
@@ -381,13 +385,13 @@
|
||||
elseif ($action == 'agreeassessment') {
|
||||
$timenow = time();
|
||||
// assessment id comes from link or hidden form variable
|
||||
if (!$assessment = get_record("workshop_assessments", "id", $_REQUEST['aid'])) {
|
||||
if (!$assessment = get_record("workshop_assessments", "id", $_REQUEST['aid'])) {
|
||||
error("Assessment : agree assessment failed");
|
||||
}
|
||||
//save time of agreement
|
||||
set_field("workshop_assessments", "timeagreed", $timenow, "id", $assessment->id);
|
||||
echo "<centre><b>".get_string("savedok", "workshop")."</b></center><br />\n";
|
||||
|
||||
|
||||
add_to_log($course->id, "workshop", "agree", "viewassessment.php?id=$cm->id&aid=$assessment->id", "$assessment->id");
|
||||
print_continue("view.php?id=$cm->id");
|
||||
}
|
||||
@@ -398,7 +402,7 @@
|
||||
elseif ($action == 'displaygradingform') {
|
||||
|
||||
print_heading_with_help(get_string("specimenassessmentform", "workshop"), "specimen", "workshop");
|
||||
|
||||
|
||||
workshop_print_assessment($workshop); // called with no assessment
|
||||
print_continue("view.php?id=$cm->id");
|
||||
}
|
||||
@@ -406,7 +410,7 @@
|
||||
|
||||
/*************** edit comment on assessment (by author, assessor or teacher) ***************************/
|
||||
elseif ($action == 'editcomment') {
|
||||
|
||||
|
||||
print_heading_with_help(get_string("editacomment", "workshop"), "editingacomment", "workshop");
|
||||
// get the comment record...
|
||||
if (!$comment = get_record("workshop_comments", "id", $_GET['cid'])) {
|
||||
@@ -462,7 +466,7 @@
|
||||
<input type="hidden" name="action" value="insertelements" />
|
||||
<center><table cellpadding="5" border="1">
|
||||
<?php
|
||||
|
||||
|
||||
// get existing elements, if none set up appropriate default ones
|
||||
if ($elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC" )) {
|
||||
foreach ($elementsraw as $element) {
|
||||
@@ -478,7 +482,7 @@
|
||||
$elements[$i]->weight = 11;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0: // no grading
|
||||
for ($i=0; $i<$workshop->nelements; $i++) {
|
||||
@@ -521,7 +525,7 @@
|
||||
echo "</tr>\n";
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2: // error banded grading
|
||||
for ($i=0; $i<$workshop->nelements; $i++) {
|
||||
$iplus1 = $i+1;
|
||||
@@ -560,7 +564,7 @@
|
||||
}
|
||||
echo "</table></center>\n";
|
||||
break;
|
||||
|
||||
|
||||
case 3: // criterion grading
|
||||
for ($j = 100; $j >= 0; $j--) {
|
||||
$numbers[$j] = $j;
|
||||
@@ -626,11 +630,11 @@
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*************** grade all assessments (by teacher) ***************************/
|
||||
elseif ($action == 'gradeallassessments') {
|
||||
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
@@ -666,7 +670,7 @@
|
||||
$user = get_record("user", "id", $assessment->userid);
|
||||
echo "<center><b>".get_string("assessmentby", "workshop", $user->firstname." ".$user->lastname)."</b></center>\n";
|
||||
workshop_print_assessment($workshop, $assessment);
|
||||
|
||||
|
||||
include('assessment_grading_form.html');
|
||||
die;
|
||||
}
|
||||
@@ -677,7 +681,7 @@
|
||||
$timenow = time();
|
||||
|
||||
$form = (object)$_POST;
|
||||
|
||||
|
||||
if (!$assessment = get_record("workshop_assessments", "id", $_POST['aid'])) {
|
||||
error("Unable to insert comment");
|
||||
}
|
||||
@@ -690,7 +694,7 @@
|
||||
if (!$comment->id = insert_record("workshop_comments", $comment)) {
|
||||
error("Could not insert workshop comment!");
|
||||
}
|
||||
|
||||
|
||||
add_to_log($course->id, "workshop", "comment", "view.php?id=$cm->id", "$comment->id");
|
||||
|
||||
print_continue("viewassessment.php?id=$cm->id&aid=$assessment->id");
|
||||
@@ -705,10 +709,10 @@
|
||||
}
|
||||
|
||||
$form = (object)$HTTP_POST_VARS;
|
||||
|
||||
|
||||
// let's not fool around here, dump the junk!
|
||||
delete_records("workshop_elements", "workshopid", $workshop->id);
|
||||
|
||||
|
||||
// determine wich type of grading
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0: // no grading
|
||||
@@ -725,7 +729,7 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 1: // accumulative grading
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->description as $key => $description) {
|
||||
@@ -752,7 +756,7 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2: // error banded grading...
|
||||
case 3: // ...and criterion grading
|
||||
// Insert all the elements that contain something, the number of descriptions is one less than the number of grades
|
||||
@@ -772,7 +776,7 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 4: // ...and criteria grading
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->description as $key => $description) {
|
||||
@@ -866,7 +870,7 @@
|
||||
echo '</pre>';
|
||||
print_continue("submissions.php?id=$cm->id&action=adminlist");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************** remove stock comment (by teacher ) ***************************/
|
||||
elseif ($action == 'removestockcomment') {
|
||||
@@ -877,12 +881,12 @@
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
|
||||
if (!$assessment = get_record("workshop_assessments", "id", $aid)) {
|
||||
error("workshop assessment is misconfigured");
|
||||
}
|
||||
$form = data_submitted("nomatch"); // probably always come from the same page, change this statement
|
||||
|
||||
|
||||
// delete the comment from the stock comments table
|
||||
if (!delete_records("workshop_stockcomments", "id", $stockcommentid)) {
|
||||
error("Could not remove comment from the comment bank");
|
||||
@@ -906,8 +910,8 @@
|
||||
$timenow = time();
|
||||
// don't fiddle about, delete all the old and add the new!
|
||||
delete_records("workshop_grades", "assessmentid", $assessment->id);
|
||||
|
||||
|
||||
|
||||
|
||||
//determine what kind of grading we have
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0: // no grading
|
||||
@@ -924,7 +928,7 @@
|
||||
}
|
||||
$grade = 0; // set to satisfy save to db
|
||||
break;
|
||||
|
||||
|
||||
case 1: // accumulative grading
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->grade as $key => $thegrade) {
|
||||
@@ -944,7 +948,7 @@
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
@@ -955,7 +959,7 @@
|
||||
|
||||
case 2: // error banded graded
|
||||
// Insert all the elements that contain something
|
||||
$error = 0.0;
|
||||
$error = 0.0;
|
||||
for ($i =0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
@@ -989,9 +993,9 @@
|
||||
}
|
||||
echo "<b>".get_string("weightederrorcount", "workshop", intval($error + 0.5))."</b>\n";
|
||||
break;
|
||||
|
||||
|
||||
case 3: // criteria grading
|
||||
// save in the selected criteria value in element zero,
|
||||
// save in the selected criteria value in element zero,
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
@@ -1031,7 +1035,7 @@
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
@@ -1040,18 +1044,18 @@
|
||||
break;
|
||||
|
||||
} // end of switch
|
||||
|
||||
|
||||
|
||||
|
||||
// any comment?
|
||||
if (!empty($form->generalcomment)) { // update the object (no need to update the db record)
|
||||
$assessment->generalcomment = $form->generalcomment;
|
||||
}
|
||||
|
||||
|
||||
// redisplay form, going back to original returnto address
|
||||
workshop_print_assessment($workshop, $assessment, true, true, $form->returnto);
|
||||
|
||||
|
||||
// add_to_log($course->id, "workshop", "assess", "viewassessment.php?id=$cm->id&aid=$assessment->id", "$assessment->id", "$cm->id");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1079,9 +1083,9 @@
|
||||
$timenow = time();
|
||||
// don't fiddle about, delete all the old and add the new!
|
||||
delete_records("workshop_grades", "assessmentid", $assessment->id);
|
||||
|
||||
|
||||
$form = data_submitted("nomatch"); // probably always come from the same page, change this statement
|
||||
|
||||
|
||||
//determine what kind of grading we have
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0: // no grading
|
||||
@@ -1098,7 +1102,7 @@
|
||||
}
|
||||
$grade = 0; // set to satisfy save to db
|
||||
break;
|
||||
|
||||
|
||||
case 1: // accumulative grading
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->grade as $key => $thegrade) {
|
||||
@@ -1118,7 +1122,7 @@
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
@@ -1129,7 +1133,7 @@
|
||||
|
||||
case 2: // error banded graded
|
||||
// Insert all the elements that contain something
|
||||
$error = 0.0;
|
||||
$error = 0.0;
|
||||
for ($i =0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
@@ -1163,9 +1167,9 @@
|
||||
}
|
||||
echo "<b>".get_string("weightederrorcount", "workshop", intval($error + 0.5))."</b>\n";
|
||||
break;
|
||||
|
||||
|
||||
case 3: // criteria grading
|
||||
// save in the selected criteria value in element zero,
|
||||
// save in the selected criteria value in element zero,
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
@@ -1205,7 +1209,7 @@
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
@@ -1214,19 +1218,19 @@
|
||||
break;
|
||||
|
||||
} // end of switch
|
||||
|
||||
|
||||
// update the time of the assessment record (may be re-edited)...
|
||||
set_field("workshop_assessments", "timecreated", $timenow, "id", $assessment->id);
|
||||
|
||||
|
||||
if (!$submission = get_record("workshop_submissions", "id", $assessment->submissionid)) {
|
||||
error ("Updateassessment: submission record not found");
|
||||
}
|
||||
|
||||
|
||||
// if the workshop does need peer agreement AND it's self assessment then set timeagreed
|
||||
if ($workshop->agreeassessments and ($submission->userid == $assessment->userid)) {
|
||||
set_field("workshop_assessments", "timeagreed", $timenow, "id", $assessment->id);
|
||||
}
|
||||
|
||||
|
||||
// set grade...
|
||||
set_field("workshop_assessments", "grade", $grade, "id", $assessment->id);
|
||||
// ...and clear the timegraded but set the graddinggrade to maximum, may be reduced subsequently...
|
||||
@@ -1268,20 +1272,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// any comment?
|
||||
if (!empty($form->generalcomment)) {
|
||||
set_field("workshop_assessments", "generalcomment", $form->generalcomment, "id", $assessment->id);
|
||||
}
|
||||
|
||||
|
||||
add_to_log($course->id, "workshop", "assess",
|
||||
"viewassessment.php?id=$cm->id&aid=$assessment->id", "$assessment->id", "$cm->id");
|
||||
|
||||
|
||||
// set up return address
|
||||
if (!$returnto = $form->returnto) {
|
||||
$returnto = "view.php?id=$cm->id";
|
||||
}
|
||||
|
||||
|
||||
// show grade if grading strategy is not zero
|
||||
if ($workshop->gradingstrategy) {
|
||||
redirect($returnto, get_string("thegradeis", "workshop").": ".
|
||||
@@ -1299,7 +1303,7 @@
|
||||
$timenow = time();
|
||||
|
||||
$form = (object)$_POST;
|
||||
|
||||
|
||||
// get the comment record...
|
||||
if (!$comment = get_record("workshop_comments", "id", $_POST['cid'])) {
|
||||
error("Update to Comment failed");
|
||||
@@ -1314,8 +1318,8 @@
|
||||
// ..and kick to comment into life (probably not needed but just in case)
|
||||
set_field("workshop_comments", "mailed", 0, "id", $comment->id);
|
||||
echo "<centre><b>".get_string("savedok", "workshop")."</b></center><br />\n";
|
||||
|
||||
add_to_log($course->id, "workshop", "comment",
|
||||
|
||||
add_to_log($course->id, "workshop", "comment",
|
||||
"viewassessment.php?id=$cm->id&aid=$assessment->id", "$comment->id");
|
||||
}
|
||||
|
||||
@@ -1332,11 +1336,11 @@
|
||||
}
|
||||
|
||||
$form = (object)$_POST;
|
||||
|
||||
|
||||
if (!$assessment = get_record("workshop_assessments", "id", $_POST['aid'])) {
|
||||
error("Update Grading failed");
|
||||
}
|
||||
//save the comment and grade for the assessment
|
||||
//save the comment and grade for the assessment
|
||||
if (isset($form->teachercomment)) {
|
||||
set_field("workshop_assessments", "teachercomment", $form->teachercomment, "id", $assessment->id);
|
||||
set_field("workshop_assessments", "gradinggrade", $form->gradinggrade, "id", $assessment->id);
|
||||
@@ -1344,21 +1348,21 @@
|
||||
set_field("workshop_assessments", "mailed", 0, "id", $assessment->id);
|
||||
set_field("workshop_assessments", "teachergraded", 1, "id", $assessment->id);
|
||||
echo "<centre><b>".get_string("savedok", "workshop")."</b></centre><br />\n";
|
||||
|
||||
add_to_log($course->id, "workshop", "grade",
|
||||
|
||||
add_to_log($course->id, "workshop", "grade",
|
||||
"viewassessment.php?id=$cm->id&aid=$assessment->id", "$assessment->id", "$cm->id");
|
||||
}
|
||||
redirect($form->redirect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************** view all assessments ***********************/
|
||||
elseif ($action == 'viewallassessments') {
|
||||
|
||||
|
||||
if (!$submission = get_record("workshop_submissions", "id", $_GET['sid'])) {
|
||||
error("View All Assessments: submission record not found");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
foreach ($assessments as $assessment) {
|
||||
workshop_print_assessment($workshop, $assessment);
|
||||
@@ -1374,6 +1378,6 @@
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
listforassessmentteacher
|
||||
showsubmission
|
||||
updatesubmission
|
||||
|
||||
|
||||
|
||||
************************************************/
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
require("locallib.php");
|
||||
|
||||
require_variable($id); // Course Module ID
|
||||
|
||||
|
||||
$timenow = time();
|
||||
|
||||
// get some useful stuff...
|
||||
@@ -37,6 +37,10 @@
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
if (!$cm->visible and !isteacher($course->id)) {
|
||||
print_header();
|
||||
notice(get_string('activityiscurrentlyhidden'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
$strworkshops = get_string("modulenameplural", "workshop");
|
||||
$strworkshop = get_string("modulename", "workshop");
|
||||
@@ -44,8 +48,8 @@
|
||||
|
||||
// ... print the header and...
|
||||
print_header_simple("$workshop->name", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> -> $strsubmissions",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> -> $strsubmissions",
|
||||
"", "", true);
|
||||
|
||||
//...get the action or set up an suitable default
|
||||
@@ -64,7 +68,7 @@
|
||||
if (empty($_GET['sid'])) {
|
||||
error("Admin Amend Title: submission id missing");
|
||||
}
|
||||
|
||||
|
||||
$submission = get_record("workshop_submissions", "id", $_GET['sid']);
|
||||
print_heading(get_string("amendtitle", "workshop"));
|
||||
?>
|
||||
@@ -84,10 +88,10 @@
|
||||
echo " </td></tr></table>\n";
|
||||
echo "<input type=\"submit\" value=\"".get_string("amendtitle", "workshop")."\" />\n";
|
||||
echo "</center></form>\n";
|
||||
|
||||
|
||||
print_heading("<a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id#sid=$submission->id\">".get_string("cancel")."</a>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* admin clear late (flag) ************************************/
|
||||
elseif ($action == 'adminclearlate' ) {
|
||||
@@ -98,19 +102,19 @@
|
||||
if (empty($_GET['sid'])) {
|
||||
error("Admin clear late flag: submission id missing");
|
||||
}
|
||||
|
||||
|
||||
if (!$submission = get_record("workshop_submissions", "id", $_GET['sid'])) {
|
||||
error("Admin clear late flag: can not get submission record");
|
||||
}
|
||||
if (set_field("workshop_submissions", "late", 0, "id", $_GET['sid'])) {
|
||||
print_heading(get_string("clearlateflag", "workshop")." ".get_string("ok"));
|
||||
}
|
||||
|
||||
|
||||
add_to_log($course->id, "workshop", "late flag cleared", "view.php?id=$cm->id", "submission $submission->id");
|
||||
|
||||
|
||||
redirect("view.php?id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* confirm delete ************************************/
|
||||
elseif ($action == 'confirmdelete' ) {
|
||||
@@ -119,10 +123,10 @@
|
||||
error("Confirm delete: submission id missing");
|
||||
}
|
||||
$sid = $_GET['sid'];
|
||||
notice_yesno(get_string("confirmdeletionofthisitem","workshop", get_string("submission", "workshop")),
|
||||
notice_yesno(get_string("confirmdeletionofthisitem","workshop", get_string("submission", "workshop")),
|
||||
"submissions.php?action=delete&id=$cm->id&sid=$sid", "view.php?id=$cm->id#sid=$sid");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* delete ************************************/
|
||||
elseif ($action == 'delete' ) {
|
||||
@@ -130,18 +134,18 @@
|
||||
if (empty($_GET['sid'])) {
|
||||
error("Delete: submission id missing");
|
||||
}
|
||||
|
||||
|
||||
if (!$submission = get_record("workshop_submissions", "id", $_GET['sid'])) {
|
||||
error("Admin delete: can not get submission record");
|
||||
}
|
||||
|
||||
|
||||
// students are only allowed to delete their own submission and only up to the deadline
|
||||
if (!(isteacher($course->id) or
|
||||
if (!(isteacher($course->id) or
|
||||
(($USER->id = $submission->userid) and ($timenow < $workshop->submissionend)
|
||||
and (($timenow < $workshop->assessmentstart) or ($timenow < $submission->timecreated + $CFG->maxeditingtime))))) {
|
||||
error("You are not authorized to delete this submission");
|
||||
}
|
||||
|
||||
|
||||
print_string("deleting", "workshop");
|
||||
// first get any assessments...
|
||||
if ($assessments = workshop_get_assessments($submission, 'ALL')) {
|
||||
@@ -161,7 +165,7 @@
|
||||
|
||||
redirect("view.php?id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* admin (confirm) late flag ************************************/
|
||||
elseif ($action == 'adminlateflag' ) {
|
||||
@@ -176,11 +180,11 @@
|
||||
error("Admin confirm late flag: can not get submission record");
|
||||
}
|
||||
|
||||
notice_yesno(get_string("clearlateflag","workshop")."?",
|
||||
"submissions.php?action=adminclearlate&id=$cm->id&sid=$_GET[sid]",
|
||||
notice_yesno(get_string("clearlateflag","workshop")."?",
|
||||
"submissions.php?action=adminclearlate&id=$cm->id&sid=$_GET[sid]",
|
||||
"view.php?id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* list all submissions ************************************/
|
||||
elseif ($action == 'adminlist' ) {
|
||||
@@ -194,12 +198,12 @@
|
||||
else {
|
||||
$order = $_GET['order'];
|
||||
}
|
||||
|
||||
|
||||
workshop_list_submissions_for_admin($workshop, $order);
|
||||
print_continue("view.php?id=$cm->id");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* admin update title ************************************/
|
||||
elseif ($action == 'adminupdatetitle' ) {
|
||||
@@ -210,13 +214,13 @@
|
||||
if (empty($_POST['sid'])) {
|
||||
error("Admin Update Title: submission id missing");
|
||||
}
|
||||
|
||||
|
||||
if (set_field("workshop_submissions", "title", $_POST['title'], "id", $_POST['sid'])) {
|
||||
print_heading(get_string("amendtitle", "workshop")." ".get_string("ok"));
|
||||
}
|
||||
print_continue("view.php?id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* confirm remove attachments ************************************/
|
||||
elseif ($action == 'confirmremoveattachments' ) {
|
||||
@@ -228,11 +232,11 @@
|
||||
error("Admin delete: can not get submission record");
|
||||
}
|
||||
|
||||
notice_yesno(get_string("confirmremoveattachments","workshop"),
|
||||
"submissions.php?action=removeattachments&id=$cm->id&sid=$_GET[sid]",
|
||||
notice_yesno(get_string("confirmremoveattachments","workshop"),
|
||||
"submissions.php?action=removeattachments&id=$cm->id&sid=$_GET[sid]",
|
||||
"view.php?id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* edit submission ************************************/
|
||||
elseif ($action == 'editsubmission' ) {
|
||||
@@ -241,7 +245,7 @@
|
||||
error("Edit submission: submission id missing");
|
||||
}
|
||||
$usehtmleditor = can_use_html_editor();
|
||||
|
||||
|
||||
$submission = get_record("workshop_submissions", "id", $_GET['sid']);
|
||||
print_heading(get_string("editsubmission", "workshop"));
|
||||
if ($submission->userid <> $USER->id) {
|
||||
@@ -280,7 +284,7 @@
|
||||
} else {
|
||||
$ffurl = "file.php?file=/$filearea/$file";
|
||||
}
|
||||
echo "<tr><td>".get_string("attachment", "workshop")." $n: <img src=\"$CFG->pixpath/f/$icon\"
|
||||
echo "<tr><td>".get_string("attachment", "workshop")." $n: <img src=\"$CFG->pixpath/f/$icon\"
|
||||
height=\"16\" width=\"16\" border=\"0\" alt=\"File\" />".
|
||||
" <a target=\"uploadedfile\" href=\"$CFG->wwwroot/$ffurl\">$file</a></td></tr>\n";
|
||||
}
|
||||
@@ -303,7 +307,7 @@
|
||||
echo "<input type=\"submit\" value=\"".get_string("savemysubmission", "workshop")."\" />\n";
|
||||
echo "</center></form>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* list all submissions ************************************/
|
||||
elseif ($action == 'listallsubmissions' ) {
|
||||
@@ -315,9 +319,9 @@
|
||||
print_heading(get_string("listofallsubmissions", "workshop").":", "CENTER");
|
||||
workshop_list_all_submissions($workshop, $USER);
|
||||
print_continue("view.php?id=$cm->id");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* list for assessment student (submissions) ************************************/
|
||||
elseif ($action == 'listforassessmentstudent' ) {
|
||||
@@ -328,41 +332,41 @@
|
||||
}
|
||||
workshop_list_unassessed_student_submissions($workshop, $USER);
|
||||
print_continue("view.php?id=$cm->id");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* list for assessment teacher (submissions) ************************************/
|
||||
elseif ($action == 'listforassessmentteacher' ) {
|
||||
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
workshop_list_unassessed_teacher_submissions($workshop, $USER);
|
||||
print_continue("view.php?id=$cm->id");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* remove (all) attachments ************************************/
|
||||
elseif ($action == 'removeattachments' ) {
|
||||
|
||||
|
||||
$form = data_submitted();
|
||||
|
||||
|
||||
if (empty($form->sid)) {
|
||||
error("Update submission: submission id missing");
|
||||
}
|
||||
|
||||
|
||||
$submission = get_record("workshop_submissions", "id", $form->sid);
|
||||
|
||||
|
||||
// students are only allowed to remove their own attachments and only up to the deadline
|
||||
if (!(isteacher($course->id) or
|
||||
if (!(isteacher($course->id) or
|
||||
(($USER->id = $submission->userid) and ($timenow < $workshop->submissionend)
|
||||
and (($timenow < $workshop->assessmentstart) or ($timenow < $submission->timecreated + $CFG->maxeditingtime))))) {
|
||||
error("You are not authorized to delete these attachments");
|
||||
}
|
||||
|
||||
|
||||
// amend title... just in case they were modified
|
||||
// check existence of title
|
||||
if (empty($form->title)) {
|
||||
@@ -370,14 +374,14 @@
|
||||
} else {
|
||||
set_field("workshop_submissions", "title", $form->title, "id", $submission->id);
|
||||
set_field("workshop_submissions", "description", trim($form->description), "id", $submission->id);
|
||||
}
|
||||
}
|
||||
print_string("removeallattachments", "workshop");
|
||||
workshop_delete_submitted_files($workshop, $submission);
|
||||
add_to_log($course->id, "workshop", "removeattachments", "view.php?id=$cm->id", "submission $submission->id");
|
||||
|
||||
|
||||
print_continue("view.php?id=$cm->id#sid=$submission->id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* show submission ************************************/
|
||||
elseif ($action == 'showsubmission' ) {
|
||||
@@ -385,7 +389,7 @@
|
||||
if (empty($_GET['sid'])) {
|
||||
error("Show submission: submission id missing");
|
||||
}
|
||||
|
||||
|
||||
$submission = get_record("workshop_submissions", "id", $_GET['sid']);
|
||||
$title = '"'.$submission->title.'" ';
|
||||
if (isteacher($course->id)) {
|
||||
@@ -396,23 +400,23 @@
|
||||
workshop_print_submission($workshop, $submission);
|
||||
print_continue($_SERVER['HTTP_REFERER'].'#sid='.$submission->id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************** update (league table options teacher) ***************************/
|
||||
elseif ($action == 'updateleaguetable') {
|
||||
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
$form = (object)$_POST;
|
||||
|
||||
|
||||
// save number of entries in showleaguetable option
|
||||
if ($form->nentries == 'All') {
|
||||
$form->nentries = 99;
|
||||
}
|
||||
set_field("workshop", "showleaguetable", $form->nentries, "id", "$workshop->id");
|
||||
|
||||
|
||||
// save the anonymous option
|
||||
set_field("workshop", "anonymous", $form->anonymous, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "league table", "view.php?id=$cm->id", $form->nentries, $cm->id);
|
||||
@@ -425,23 +429,23 @@
|
||||
elseif ($action == 'updatesubmission') {
|
||||
|
||||
$form = data_submitted();
|
||||
|
||||
|
||||
if (empty($form->sid)) {
|
||||
error("Update submission: submission id missing");
|
||||
}
|
||||
$submission = get_record("workshop_submissions", "id", $form->sid);
|
||||
|
||||
|
||||
// students are only allowed to update their own submission and only up to the deadline
|
||||
if (!(isteacher($course->id) or
|
||||
if (!(isteacher($course->id) or
|
||||
(($USER->id = $submission->userid) and ($timenow < $workshop->submissionend)
|
||||
and (($timenow < $workshop->assessmentstart) or ($timenow < $submission->timecreated + $CFG->maxeditingtime))))) {
|
||||
error("You are not authorized to update your submission");
|
||||
}
|
||||
|
||||
|
||||
// check existence of title
|
||||
if (empty($form->title)) {
|
||||
$title = get_string("notitle", "workshop");
|
||||
}
|
||||
}
|
||||
set_field("workshop_submissions", "title", $form->title, "id", $submission->id);
|
||||
set_field("workshop_submissions", "description", trim($form->description), "id", $submission->id);
|
||||
set_field("workshop_submissions", "timecreated", $timenow, "id", $submission->id);
|
||||
@@ -455,7 +459,7 @@
|
||||
print_heading(get_string("uploadsuccess", "workshop"));
|
||||
}
|
||||
// upload manager will print errors.
|
||||
}
|
||||
}
|
||||
print_continue("view.php?id=$cm->id");
|
||||
} else {
|
||||
redirect("view.php?id=$cm->id#sid=$submission->id");
|
||||
@@ -473,5 +477,5 @@
|
||||
|
||||
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
|
||||
?>
|
||||
|
||||
+10
-6
@@ -18,24 +18,28 @@
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
if (!$cm->visible and !isteacher($course->id)) {
|
||||
print_header();
|
||||
notice(get_string('activityiscurrentlyhidden'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
$strworkshops = get_string('modulenameplural', 'workshop');
|
||||
$strworkshop = get_string('modulename', 'workshop');
|
||||
$strsubmission = get_string('submission', 'workshop');
|
||||
|
||||
print_header_simple("$workshop->name : $strsubmission", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?a=$workshop->id\">$workshop->name</a> -> $strsubmission",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?a=$workshop->id\">$workshop->name</a> -> $strsubmission",
|
||||
"", "", true);
|
||||
$timenow = time();
|
||||
|
||||
$form = data_submitted("nomatch"); // POST may come from two forms
|
||||
|
||||
|
||||
// don't be picky about not having a title
|
||||
if (!$title = $form->title) {
|
||||
$title = get_string("notitle", "workshop");
|
||||
}
|
||||
|
||||
|
||||
// check that this is not a "rapid" second submission, caused by using the back button
|
||||
// only check if a student, teachers may want to submit a set of workshop examples rapidly
|
||||
if (isstudent($course->id)) {
|
||||
@@ -51,7 +55,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// get the current set of submissions
|
||||
$submissions = workshop_get_user_submissions($workshop, $USER);
|
||||
// add new submission record
|
||||
@@ -85,7 +89,7 @@
|
||||
// only copy other students assessment not the self assessment (if present)
|
||||
// copy it with feedback..
|
||||
$newassessment = workshop_copy_assessment($assessment, $newsubmission, true);
|
||||
// set the resubmission flag so student can be emailed/told about
|
||||
// set the resubmission flag so student can be emailed/told about
|
||||
// this assessment
|
||||
set_field("workshop_assessments", "resubmission", 1, "id", $newassessment->id);
|
||||
}
|
||||
|
||||
+76
-77
@@ -6,17 +6,17 @@
|
||||
displayfinalgrade (for students)
|
||||
notavailable (for students)
|
||||
studentsview
|
||||
submitexample
|
||||
submitexample
|
||||
teachersview
|
||||
showdescription
|
||||
showallsubmissions
|
||||
|
||||
|
||||
************************************************/
|
||||
|
||||
require("../../config.php");
|
||||
require("lib.php");
|
||||
require("locallib.php");
|
||||
|
||||
|
||||
require_variable($id); // Course Module ID
|
||||
optional_variable($action, '');
|
||||
optional_variable($sort, "lastname");
|
||||
@@ -37,21 +37,18 @@
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
// ...log activity...
|
||||
add_to_log($course->id, "workshop", "view", "view.php?id=$cm->id", $workshop->id, $cm->id);
|
||||
|
||||
$strworkshops = get_string("modulenameplural", "workshop");
|
||||
$strworkshop = get_string("modulename", "workshop");
|
||||
$straction = ($action) ? '-> '.get_string($action, 'workshop') : '';
|
||||
|
||||
// ...display header...
|
||||
print_header_simple("$workshop->name", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> $straction",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> $straction",
|
||||
"", "", true, update_module_button($cm->id, $course->id, $strworkshop), navmenu($course, $cm));
|
||||
|
||||
// ...and if necessary set default action
|
||||
|
||||
// ...and if necessary set default action
|
||||
|
||||
if (isteacher($course->id)) {
|
||||
if (empty($action)) { // no action specified, either go straight to elements page else the admin page
|
||||
// has the assignment any elements
|
||||
@@ -67,8 +64,8 @@
|
||||
if (!$cm->visible) {
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
if ($timenow < $workshop->submissionstart) {
|
||||
$action = 'notavailable';
|
||||
if ($timenow < $workshop->submissionstart) {
|
||||
$action = 'notavailable';
|
||||
} else if (!$action) {
|
||||
if ($timenow < $workshop->assessmentend) {
|
||||
$action = 'studentsview';
|
||||
@@ -81,6 +78,8 @@
|
||||
$action = 'notavailable';
|
||||
}
|
||||
|
||||
// ...log activity...
|
||||
add_to_log($course->id, "workshop", "view", "view.php?id=$cm->id", $workshop->id, $cm->id);
|
||||
|
||||
/****************** display final grade (for students) ************************************/
|
||||
if ($action == 'displayfinalgrade' ) {
|
||||
@@ -96,10 +95,10 @@
|
||||
echo "<td align=\"center\"><b>".get_string("assessmentsdone", "workshop")."</b></td>";
|
||||
echo "<td align=\"center\"><b>".get_string("gradeforassessments", "workshop")."</b></td>";
|
||||
}
|
||||
echo "<td align=\"center\"><b>".get_string("teacherassessments", "workshop",
|
||||
echo "<td align=\"center\"><b>".get_string("teacherassessments", "workshop",
|
||||
$course->teacher)."</b></td>";
|
||||
if ($workshop->wtype) {
|
||||
echo "<td align=\"center\"><b>".get_string("studentassessments", "workshop",
|
||||
echo "<td align=\"center\"><b>".get_string("studentassessments", "workshop",
|
||||
$course->student)."</b></td>";
|
||||
}
|
||||
echo "<td align=\"center\"><b>".get_string("gradeforsubmission", "workshop")."</b></td>";
|
||||
@@ -111,10 +110,10 @@
|
||||
echo "<td align=\"center\">".workshop_print_user_assessments($workshop, $USER, $gradinggrade)."</td>";
|
||||
echo "<td align=\"center\">$gradinggrade</td>";
|
||||
}
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
|
||||
$submission, "teacher")."</td>";
|
||||
if ($workshop->wtype) {
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
|
||||
$submission, "student")."</td>";
|
||||
}
|
||||
echo "<td align=\"center\">$grade</td>";
|
||||
@@ -128,9 +127,9 @@
|
||||
if ($workshop->showleaguetable) {
|
||||
workshop_print_league_table($workshop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************** assignment not available (for students)***********************/
|
||||
elseif ($action == 'notavailable') {
|
||||
print_heading(get_string("notavailable", "workshop"));
|
||||
@@ -164,7 +163,7 @@
|
||||
"</td></tr>";
|
||||
echo "<tr align=\"center\"><td>".get_string("enterpassword", "workshop").
|
||||
" <input type=\"password\" name=\"userpassword\" /></td></tr>";
|
||||
|
||||
|
||||
echo "<tr align=\"center\"><td>";
|
||||
echo "<input type=\"button\" value=\"".get_string("cancel").
|
||||
"\" onclick=\"parent.location='../../course/view.php?id=$course->id';\"> ";
|
||||
@@ -176,7 +175,7 @@
|
||||
}
|
||||
}
|
||||
workshop_print_assignment_info($workshop);
|
||||
|
||||
|
||||
// if the student has not yet submitted show the full description
|
||||
if (!record_exists('workshop_submissions', 'workshopid', $workshop->id, 'userid', $USER->id)) {
|
||||
print_simple_box(format_text($workshop->description, $workshop->format), 'center');
|
||||
@@ -184,23 +183,23 @@
|
||||
print_heading("<b><a href=\"view.php?id=$cm->id&action=showdescription\">".
|
||||
get_string("showdescription", 'workshop')."</a></b>");
|
||||
}
|
||||
|
||||
|
||||
// in Stage 1? - are there any teacher's submissions? and...
|
||||
// ...has student assessed the required number of the teacher's submissions
|
||||
// ...has student assessed the required number of the teacher's submissions
|
||||
if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {
|
||||
print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop",
|
||||
print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop",
|
||||
$course->teacher));
|
||||
workshop_list_teacher_submissions($workshop, $USER);
|
||||
}
|
||||
// in stage 2? - submit own first attempt
|
||||
else {
|
||||
if ($workshop->ntassessments) {
|
||||
if ($workshop->ntassessments) {
|
||||
// show assessment of the teacher's examples, there may be feedback from teacher
|
||||
print_heading(get_string("yourassessmentsofexamplesfromtheteacher", "workshop",
|
||||
print_heading(get_string("yourassessmentsofexamplesfromtheteacher", "workshop",
|
||||
$course->teacher));
|
||||
workshop_list_teacher_submissions($workshop, $USER);
|
||||
}
|
||||
// has user submitted anything yet?
|
||||
// has user submitted anything yet?
|
||||
if (!workshop_get_user_submissions($workshop, $USER)) {
|
||||
if ($timenow < $workshop->submissionend) {
|
||||
// print upload form
|
||||
@@ -209,7 +208,7 @@
|
||||
} else {
|
||||
print_heading(get_string("submissionsnolongerallowed", "workshop"));
|
||||
}
|
||||
}
|
||||
}
|
||||
// in stage 3? - grade other student's submissions, resubmit and list all submissions
|
||||
else {
|
||||
// is self assessment used in this workshop?
|
||||
@@ -218,7 +217,7 @@
|
||||
workshop_list_self_assessments($workshop, $USER);
|
||||
}
|
||||
// if peer assessments are being done then show some to assess...
|
||||
if ($workshop->nsassessments and ($workshop->assessmentstart < $timenow and $workshop->assessmentend > $timenow)) {
|
||||
if ($workshop->nsassessments and ($workshop->assessmentstart < $timenow and $workshop->assessmentend > $timenow)) {
|
||||
workshop_list_student_submissions($workshop, $USER);
|
||||
}
|
||||
// ..and any they have already done (and have gone cold)...
|
||||
@@ -239,7 +238,7 @@
|
||||
// list previous submissions
|
||||
print_heading(get_string("yoursubmissions", "workshop"));
|
||||
workshop_list_user_submissions($workshop, $USER);
|
||||
|
||||
|
||||
// are resubmissions allowed and the workshop is in submission/assessment phase?
|
||||
if ($workshop->resubmit and ($timenow > $workshop->assessmentstart and $timenow < $workshop->submissionend)) {
|
||||
// see if there are any cold assessments of the last submission
|
||||
@@ -272,20 +271,20 @@
|
||||
|
||||
/****************** submission of example by teacher only***********************/
|
||||
elseif ($action == 'submitexample') {
|
||||
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
// list previous submissions from teacher
|
||||
|
||||
// list previous submissions from teacher
|
||||
workshop_list_user_submissions($workshop, $USER);
|
||||
|
||||
|
||||
echo "<hr size=\"1\" noshade=\"noshade\" />";
|
||||
|
||||
|
||||
// print upload form
|
||||
print_heading(get_string("submitexampleassignment", "workshop").":");
|
||||
workshop_print_upload_form($workshop);
|
||||
|
||||
|
||||
print_heading("<a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\">".get_string("cancel")."</a>");
|
||||
}
|
||||
|
||||
@@ -296,7 +295,7 @@
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
|
||||
// automatically grade assessments if workshop has examples and/or peer assessments
|
||||
if ($workshop->gradingstrategy and ($workshop->ntassessments or $workshop->nsassessments)) {
|
||||
workshop_grade_assessments($workshop);
|
||||
@@ -307,10 +306,10 @@
|
||||
$changegroup = isset($_GET['group']) ? $_GET['group'] : -1; // Group change requested?
|
||||
$groupmode = groupmode($course, $cm); // Groups are being used?
|
||||
$currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
|
||||
|
||||
|
||||
/// Print settings and things in a table across the top
|
||||
echo '<table width="100%" border="0" cellpadding="3" cellspacing="0"><tr valign="top">';
|
||||
|
||||
|
||||
/// Allow the teacher to change groups (for this session)
|
||||
if ($groupmode and isteacheredit($course->id)) {
|
||||
if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
|
||||
@@ -322,18 +321,18 @@
|
||||
/// Print admin links
|
||||
echo "<td align=\"right\"><b><a href=\"view.php?id=$cm->id&action=showdescription\">".
|
||||
get_string("showdescription", 'workshop')."</a></b> \n";
|
||||
|
||||
|
||||
echo "<br /><b><a href=\"submissions.php?id=$cm->id&action=adminlist\">".
|
||||
get_string("administration")."</a></b> \n";
|
||||
|
||||
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><td>';
|
||||
workshop_print_assignment_info($workshop);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
/// Print grade tables /////////////////////////////////////////////////
|
||||
|
||||
|
||||
// display the teacher's submissions
|
||||
if ($workshop->ntassessments) {
|
||||
$table->head = array(get_string("examplesubmissions", "workshop"),
|
||||
@@ -362,19 +361,19 @@
|
||||
// Put in a submission link
|
||||
$table->data[] = array("<b><a href=\"view.php?id=$cm->id&action=submitexample\">".
|
||||
get_string("submitexampleassignment", "workshop")."</a></b>".
|
||||
helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"), "workshop", true, false, '', true),
|
||||
helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"), "workshop", true, false, '', true),
|
||||
' ', ' ');
|
||||
print_table($table);
|
||||
workshop_print_key($workshop);
|
||||
}
|
||||
|
||||
|
||||
// Get all the students
|
||||
if (!$users = get_course_students($course->id, "u.lastname, u.firstname")) {
|
||||
print_heading(get_string("nostudentsyet"));
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/// Now prepare table with student assessments and submissions
|
||||
$tablesort->data = array();
|
||||
$tablesort->sortdata = array();
|
||||
@@ -389,19 +388,19 @@
|
||||
foreach ($submissions as $submission) {
|
||||
$data = array();
|
||||
$sortdata = array();
|
||||
|
||||
|
||||
$data[] = "<a name=\"userid$user->id\" href=\"{$CFG->wwwroot}/user/view.php?id=$user->id&course=$course->id\">".
|
||||
fullname($user).'</a>';
|
||||
$sortdata['firstname'] = $user->firstname;
|
||||
$sortdata['lastname'] = $user->lastname;
|
||||
|
||||
|
||||
if ($workshop->wtype) {
|
||||
$data[] = workshop_print_user_assessments($workshop, $user, $gradinggrade);
|
||||
|
||||
|
||||
$data[] = $gradinggrade;
|
||||
$sortdata['agrade'] = $gradinggrade;
|
||||
}
|
||||
|
||||
|
||||
$data[] = workshop_print_submission_title($workshop, $submission).
|
||||
" <a href=\"submissions.php?action=adminamendtitle&id=$cm->id&sid=$submission->id\">".
|
||||
"<img src=\"$CFG->pixpath/t/edit.gif\" ".
|
||||
@@ -410,10 +409,10 @@
|
||||
"<img src=\"$CFG->pixpath/t/delete.gif\" ".
|
||||
'height="11" width="11" border="0" alt="'.get_string('delete', 'workshop').'" /></a>';
|
||||
$sortdata['title'] = $submission->title;
|
||||
|
||||
|
||||
$data[] = userdate($submission->timecreated, get_string('datestr', 'workshop'));
|
||||
$sortdata['date'] = $submission->timecreated;
|
||||
|
||||
|
||||
if (($tmp = workshop_print_submission_assessments($workshop, $submission, "teacher")) == ' ') {
|
||||
$data[] = '<a href="assess.php?id='.
|
||||
$cm->id.'&sid='.$submission->id.'">'.get_string('assess', 'workshop').'</a>';
|
||||
@@ -422,11 +421,11 @@
|
||||
$data[] = $tmp;
|
||||
$sortdata['tassmnt'] = 1; // GWD still have to fix this
|
||||
}
|
||||
|
||||
|
||||
if ($workshop->wtype) {
|
||||
$data[] = workshop_print_submission_assessments($workshop, $submission, "student");
|
||||
}
|
||||
|
||||
|
||||
$grade = workshop_submission_grade($workshop, $submission);
|
||||
$data[] = $grade;
|
||||
$sortdata['sgrade'] = $grade;
|
||||
@@ -441,7 +440,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function workshop_sortfunction($a, $b) {
|
||||
global $sort, $dir;
|
||||
if ($dir == 'ASC') {
|
||||
@@ -455,7 +454,7 @@
|
||||
foreach($tablesort->sortdata as $key => $row) {
|
||||
$table->data[] = $tablesort->data[$key];
|
||||
}
|
||||
|
||||
|
||||
if ($workshop->wtype) {
|
||||
$table->align = array ('left', 'center', 'center', 'left', 'center', 'center', 'center', 'center', 'center', 'center');
|
||||
$columns = array('firstname', 'lastname', 'agrade', 'title', 'date', 'tassmnt', 'sgrade', 'ograde');
|
||||
@@ -463,8 +462,8 @@
|
||||
$table->align = array ('left', 'left', 'center', 'center', 'center', 'center');
|
||||
$columns = array('firstname', 'lastname', 'title', 'date', 'tassmnt', 'ograde');
|
||||
}
|
||||
$table->width = "95%";
|
||||
|
||||
$table->width = "95%";
|
||||
|
||||
foreach ($columns as $column) {
|
||||
$string[$column] = get_string("$column", 'workshop');
|
||||
if ($sort != $column) {
|
||||
@@ -478,61 +477,61 @@
|
||||
$columnicon = $dir == 'ASC' ? 'down':'up';
|
||||
}
|
||||
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" alt=\"$columnicon\" />";
|
||||
|
||||
|
||||
}
|
||||
$$column = "<a href=\"view.php?id=$id&sort=$column&dir=$columndir\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
|
||||
|
||||
if ($workshop->wtype) {
|
||||
$table->head = array ("$firstname / $lastname", get_string("assmnts", "workshop"), $agrade,
|
||||
$title, $date, $tassmnt, get_string('passmnts', 'workshop'), $sgrade, $ograde);
|
||||
} else {
|
||||
$table->head = array ("$firstname / $lastname", $title, $date, $tassmnt, $ograde);
|
||||
}
|
||||
|
||||
|
||||
echo '<tr><td>';
|
||||
print_table($table);
|
||||
echo '</td></tr>';
|
||||
echo '<tr><td>';
|
||||
workshop_print_key($workshop);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
// grading grade analysis
|
||||
unset($table);
|
||||
$table->head = array (get_string("count", "workshop"), get_string("mean", "workshop"),
|
||||
get_string("standarddeviation", "workshop"), get_string("maximum", "workshop"),
|
||||
get_string("standarddeviation", "workshop"), get_string("maximum", "workshop"),
|
||||
get_string("minimum", "workshop"));
|
||||
$table->align = array ("center", "center", "center", "center", "center");
|
||||
$table->size = array ("*", "*", "*", "*", "*");
|
||||
$table->cellpadding = 2;
|
||||
$table->cellspacing = 0;
|
||||
if ($currentgroup) {
|
||||
$stats = get_record_sql("SELECT COUNT(*) as count, AVG(gradinggrade) AS mean,
|
||||
STDDEV(gradinggrade) AS stddev, MIN(gradinggrade) AS min, MAX(gradinggrade) AS max
|
||||
FROM {$CFG->prefix}groups_members g, {$CFG->prefix}workshop_assessments a
|
||||
WHERE g.groupid = $currentgroup AND a.userid = g.userid AND a.timegraded > 0
|
||||
$stats = get_record_sql("SELECT COUNT(*) as count, AVG(gradinggrade) AS mean,
|
||||
STDDEV(gradinggrade) AS stddev, MIN(gradinggrade) AS min, MAX(gradinggrade) AS max
|
||||
FROM {$CFG->prefix}groups_members g, {$CFG->prefix}workshop_assessments a
|
||||
WHERE g.groupid = $currentgroup AND a.userid = g.userid AND a.timegraded > 0
|
||||
AND a.workshopid = $workshop->id");
|
||||
} else { // no group/all participants
|
||||
$stats = get_record_sql("SELECT COUNT(*) as count, AVG(gradinggrade) AS mean,
|
||||
STDDEV(gradinggrade) AS stddev, MIN(gradinggrade) AS min, MAX(gradinggrade) AS max
|
||||
FROM {$CFG->prefix}workshop_assessments a
|
||||
$stats = get_record_sql("SELECT COUNT(*) as count, AVG(gradinggrade) AS mean,
|
||||
STDDEV(gradinggrade) AS stddev, MIN(gradinggrade) AS min, MAX(gradinggrade) AS max
|
||||
FROM {$CFG->prefix}workshop_assessments a
|
||||
WHERE a.timegraded > 0 AND a.workshopid = $workshop->id");
|
||||
}
|
||||
$table->data[] = array($stats->count, number_format($stats->mean * $workshop->gradinggrade / 100, 1),
|
||||
number_format($stats->stddev * $workshop->gradinggrade /100, 1),
|
||||
number_format($stats->max * $workshop->gradinggrade / 100, 1),
|
||||
}
|
||||
$table->data[] = array($stats->count, number_format($stats->mean * $workshop->gradinggrade / 100, 1),
|
||||
number_format($stats->stddev * $workshop->gradinggrade /100, 1),
|
||||
number_format($stats->max * $workshop->gradinggrade / 100, 1),
|
||||
number_format($stats->min* $workshop->gradinggrade / 100, 1));
|
||||
echo '<tr><td>';
|
||||
print_heading(get_string("gradinggrade", "workshop")." ".get_string("analysis", "workshop"));
|
||||
print_table($table);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
if ($workshop->showleaguetable and time() > $workshop->assessmentend) {
|
||||
workshop_print_league_table($workshop);
|
||||
if ($workshop->anonymous) {
|
||||
echo "<p>".get_string("namesnotshowntostudents", "workshop", $course->students)."</p>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
@@ -566,5 +565,5 @@
|
||||
|
||||
|
||||
print_footer($course);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php // $Id: viewassessment.php
|
||||
|
||||
require("../../config.php");
|
||||
require("lib.php");
|
||||
require("lib.php");
|
||||
require("locallib.php");
|
||||
|
||||
require_variable($aid); // Assessment ID
|
||||
optional_variable($allowcomments, false);
|
||||
optional_variable($redirect, '');
|
||||
|
||||
|
||||
if (! $assessment = get_record("workshop_assessments", "id", $aid)) {
|
||||
error("Assessment id is incorrect");
|
||||
}
|
||||
@@ -29,11 +29,15 @@
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
if (!$cm->visible and !isteacher($course->id)) {
|
||||
print_header();
|
||||
notice(get_string('activityiscurrentlyhidden'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
$strworkshops = get_string("modulenameplural", "workshop");
|
||||
$strworkshop = get_string("modulename", "workshop");
|
||||
$strassess = get_string("viewassessment", "workshop");
|
||||
|
||||
|
||||
/// Now check whether we need to display a frameset
|
||||
|
||||
if (empty($_GET['frameset'])) {
|
||||
@@ -46,17 +50,17 @@
|
||||
}
|
||||
|
||||
/// top frame with the navigation bar and the assessment form
|
||||
|
||||
|
||||
if (!empty($_GET['frameset']) and $_GET['frameset'] == "top") {
|
||||
|
||||
|
||||
print_header_simple("$workshop->name", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> -> $strassess",
|
||||
"<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$workshop->name</a> -> $strassess",
|
||||
"", '<base target="_parent" />', true);
|
||||
|
||||
|
||||
// show assessment but don't allow changes
|
||||
workshop_print_assessment($workshop, $assessment, false, $allowcomments);
|
||||
|
||||
|
||||
if (isteacher($course->id) and !isteacher($course->id, $assessment->userid)) {
|
||||
print_heading_with_help(get_string("gradeassessment", "workshop"), "gradingassessments", "workshop");
|
||||
include('assessment_grading_form.html');
|
||||
@@ -65,9 +69,9 @@
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/// print bottom frame with the submission
|
||||
|
||||
|
||||
print_header('', '', '', '', '<base target="_parent" />');
|
||||
$title = '"'.$submission->title.'" ';
|
||||
if (isteacher($course->id)) {
|
||||
@@ -76,6 +80,6 @@
|
||||
print_heading($title);
|
||||
workshop_print_submission($workshop, $submission);
|
||||
print_footer('none');
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user