3 require("../../config.php");
5 require("locallib.php");
7 $id = required_param('id',PARAM_INT
); // course
9 if (! $course = get_record("course", "id", $id)) {
10 error("Course ID is incorrect");
13 require_course_login($course);
15 add_to_log($course->id
, "workshop", "view all", "index.php?id=$course->id", "");
17 $strworkshops = get_string("modulenameplural", "workshop");
18 $strworkshop = get_string("modulename", "workshop");
19 $strweek = get_string("week");
20 $strtopic = get_string("topic");
21 $strname = get_string("name");
22 $strinfo = get_string("grade")."/".$strinfo = get_string("phase", "workshop");
23 $strdeadline = get_string("deadline", "workshop");
24 $strsubmitted = get_string("submitted", "assignment");
27 $navlinks[] = array('name' => $strworkshops, 'link' => '', 'type' => 'activity');
28 $navigation = build_navigation($navlinks);
30 print_header_simple("$strworkshops", "", $navigation, "", "", true, "", navmenu($course));
32 if (! $workshops = get_all_instances_in_course("workshop", $course)) {
33 notice("There are no workshops", "../../course/view.php?id=$course->id");
39 if ($course->format
== "weeks") {
40 $table->head
= array ($strweek, $strname, $strinfo, $strsubmitted, $strdeadline);
41 $table->align
= array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT");
42 } elseif ($course->format
== "topics") {
43 $table->head
= array ($strtopic, $strname, $strinfo, $strsubmitted, $strdeadline);
44 $table->align
= array ("CENTER", "LEFT", "left", "LEFT", "LEFT");
46 $table->head
= array ($strname, $strinfo, $strsubmitted, $strdeadline);
47 $table->align
= array ("LEFT", "LEFT", "LEFT", "LEFT");
50 foreach ($workshops as $workshop) {
51 if (workshop_is_teacher($workshop, $USER->id
)) { // teacher see info (students see grade)
52 $info = workshop_phase($workshop, 'short');
53 if (time() > $workshop->submissionstart
) {
54 if ($num = workshop_count_student_submissions_for_assessment($workshop, $USER)) {
55 $info .= " [".get_string("unassessed", "workshop", $num)."]";
60 $due = userdate($workshop->submissionend
);
62 if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
63 foreach ($submissions as $submission) {
64 if ($submission->timecreated
<= $workshop->submissionend
) {
65 $submitted = userdate($submission->timecreated
);
68 $submitted = "<span class=\"redfont\">".userdate($submission->timecreated
)."</span>";
70 if (!$workshop->visible
) {
71 //Show dimmed if the mod is hidden
72 $link = "<a class=\"dimmed\" href=\"view.php?id=$workshop->coursemodule\">".format_string($workshop->name
,true)."</a><br />";
74 //Show normal if the mod is visible
75 $link = "<a href=\"view.php?id=$workshop->coursemodule\">".format_string($workshop->name
,true)."</a><br />";
77 if (workshop_is_student($workshop)) {
78 $link .= " ($submission->title)"; // show students the title of their submission(s)
79 $gradinggrade = workshop_gradinggrade($workshop, $USER);
80 $grade = workshop_submission_grade($workshop, $submission);
81 if ($workshop->wtype
) {
82 if (workshop_count_assessments($submission)) {
83 $info = get_string("gradeforassessments", "workshop").
84 ": $gradinggrade/$workshop->gradinggrade; ".get_string("gradeforsubmission",
85 "workshop").": $grade/$workshop->grade";
87 $info = get_string("gradeforassessments", "workshop").
88 ": $gradinggrade/$workshop->gradinggrade; ".get_string("gradeforsubmission",
89 "workshop").": ".get_string("noassessments", "workshop");
91 } else { // simple assignemnt, don't show grading grade
92 $info = get_string("gradeforsubmission", "workshop").": $grade/$workshop->grade";
94 if ($workshop->releasegrades
> $timenow) {
95 $info = get_string("notavailable", "workshop");
98 if ($course->format
== "weeks" or $course->format
== "topics") {
99 $table->data
[] = array ($workshop->section
, $link, $info, $submitted, $due);
102 $table->data
[] = array ($link, $info, $submitted, $due);
104 if (workshop_is_teacher($workshop)) {
105 // teacher only needs to see one "submission"
110 else { // no submission
111 $submitted = get_string("no");
112 if (!$workshop->visible
) {
113 //Show dimmed if the mod is hidden
114 $link = "<a class=\"dimmed\" href=\"view.php?id=$workshop->coursemodule\">".format_string($workshop->name
,true)."</a>";
116 //Show normal if the mod is visible
117 $link = "<a href=\"view.php?id=$workshop->coursemodule\">".format_string($workshop->name
,true)."</a>";
119 if (workshop_is_student($workshop)) {
122 if ($course->format
== "weeks" or $course->format
== "topics") {
123 $table->data
[] = array ($workshop->section
, $link, $info, $submitted, $due);
126 $table->data
[] = array ($link, $info, $submitted, $due);
134 print_footer($course);