1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
<?php // $Id: index.php,v 1.22 2005/07/06 15:31:06 thepurpleblob Exp $
require("../../config.php");
require("lib.php");
require("locallib.php");
$id = required_param('id',PARAM_INT); // course
if (! $course = get_record("course", "id", $id)) {
error("Course ID is incorrect");
}
require_course_login($course);
add_to_log($course->id, "workshop", "view all", "index.php?id=$course->id", "");
$strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop");
$strweek = get_string("week");
$strtopic = get_string("topic");
$strname = get_string("name");
if (isstudent($course->id)) {
$strinfo = get_string("grade");
} else {
$strinfo = get_string("phase", "workshop");
}
$strdeadline = get_string("deadline", "workshop");
$strsubmitted = get_string("submitted", "assignment");
print_header_simple("$strworkshops", "", "$strworkshops", "", "", true, "", navmenu($course));
if (! $workshops = get_all_instances_in_course("workshop", $course)) {
notice("There are no workshops", "../../course/view.php?id=$course->id");
die;
}
$timenow = time();
if ($course->format == "weeks") {
$table->head = array ($strweek, $strname, $strinfo, $strsubmitted, $strdeadline);
$table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT");
} elseif ($course->format == "topics") {
$table->head = array ($strtopic, $strname, $strinfo, $strsubmitted, $strdeadline);
$table->align = array ("CENTER", "LEFT", "left", "LEFT", "LEFT");
} else {
$table->head = array ($strname, $strinfo, $strsubmitted, $strdeadline);
$table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
}
foreach ($workshops as $workshop) {
if (isteacher($course->id, $USER->id)) { // teacher see info (students see grade)
$info = workshop_phase($workshop, 'short');
if (time() > $workshop->submissionstart) {
if ($num = workshop_count_student_submissions_for_assessment($workshop, $USER)) {
$info .= " [".get_string("unassessed", "workshop", $num)."]";
}
}
}
$due = userdate($workshop->submissionend);
if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
foreach ($submissions as $submission) {
if ($submission->timecreated <= $workshop->submissionend) {
$submitted = userdate($submission->timecreated);
}
else {
$submitted = "<font color=\"red\">".userdate($submission->timecreated)."</font>";
}
if (!$workshop->visible) {
//Show dimmed if the mod is hidden
$link = "<a class=\"dimmed\" href=\"view.php?id=$workshop->coursemodule\">".format_string($workshop->name,true)."</a><br />";
} else {
//Show normal if the mod is visible
$link = "<a href=\"view.php?id=$workshop->coursemodule\">".format_string($workshop->name,true)."</a><br />";
}
if (isstudent($course->id)) {
$link .= " ($submission->title)"; // show students the title of their submission(s)
$gradinggrade = workshop_gradinggrade($workshop, $USER);
$grade = workshop_submission_grade($workshop, $submission);
if ($workshop->wtype) {
if (workshop_count_assessments($submission)) {
$info = get_string("gradeforassessments", "workshop").
": $gradinggrade/$workshop->gradinggrade; ".get_string("gradeforsubmission",
"workshop").": $grade/$workshop->grade";
} else {
$info = get_string("gradeforassessments", "workshop").
": $gradinggrade/$workshop->gradinggrade; ".get_string("gradeforsubmission",
"workshop").": ".get_string("noassessments", "workshop");
}
} else { // simple assignemnt, don't show grading grade
$info = get_string("gradeforsubmission", "workshop").": $grade/$workshop->grade";
}
if ($workshop->releasegrades > $timenow) {
$info = get_string("notavailable", "workshop");
}
}
if ($course->format == "weeks" or $course->format == "topics") {
$table->data[] = array ($workshop->section, $link, $info, $submitted, $due);
}
else {
$table->data[] = array ($link, $info, $submitted, $due);
}
if (isteacher($course->id)) {
// teacher only needs to see one "submission"
break;
}
}
}
else { // no submission
$submitted = get_string("no");
if (!$workshop->visible) {
//Show dimmed if the mod is hidden
$link = "<a class=\"dimmed\" href=\"view.php?id=$workshop->coursemodule\">".format_string($workshop->name,true)."</a>";
} else {
//Show normal if the mod is visible
$link = "<a href=\"view.php?id=$workshop->coursemodule\">".format_string($workshop->name,true)."</a>";
}
if (isstudent($course->id)) {
$info = '0';
}
if ($course->format == "weeks" or $course->format == "topics") {
$table->data[] = array ($workshop->section, $link, $info, $submitted, $due);
}
else {
$table->data[] = array ($link, $info, $submitted, $due);
}
}
}
echo "<br />";
print_table($table);
print_footer($course);
?>
|