return ($st_submissions);
}
+//////////////////////////////////////////////////////////////////////////////////////
+function workshop_get_recent_mod_activity(&$activities, &$index, $sincetime, $courseid,
+ $workshop="0", $user="", $groupid="") {
+ // Returns all workshop posts since a given time. If workshop is specified then
+ // this restricts the results
+
+ global $CFG;
+
+ if ($workshop) {
+ $workshopselect = " AND cm.id = '$workshop'";
+ } else {
+ $workshopselect = "";
+ }
+
+ if ($user) {
+ $userselect = " AND u.id = '$user'";
+ } else {
+ $userselect = "";
+ }
+
+ $posts = get_records_sql("SELECT s.*, u.firstname, u.lastname,
+ u.picture, cm.instance, w.name, cm.section
+ FROM {$CFG->prefix}workshop_submissions s,
+ {$CFG->prefix}user u,
+ {$CFG->prefix}course_modules cm,
+ {$CFG->prefix}workshop w
+ WHERE s.timecreated > '$sincetime' $workshopselect
+ AND s.userid = u.id $userselect
+ AND w.course = '$courseid' $groupselect
+ AND cm.instance = w.id
+ AND cm.course = w.course
+ AND s.workshopid = w.id
+ ORDER BY s.id");
+
+
+ if (empty($posts)) {
+ return;
+ }
+
+ foreach ($posts as $post) {
+
+ if (empty($groupid) || ismember($groupid, $post->userid)) {
+ $tmpactivity->type = "workshop";
+ $tmpactivity->defaultindex = $index;
+ $tmpactivity->instance = $post->instance;
+ $tmpactivity->name = $post->name;
+ $tmpactivity->section = $post->section;
+
+ $tmpactivity->content->id = $post->id;
+ $tmpactivity->content->title = $post->title;
+
+ $tmpactivity->user->userid = $post->userid;
+ $tmpactivity->user->fullname = fullname($post);
+ $tmpactivity->user->picture = $post->picture;
+
+ $tmpactivity->timestamp = $post->timecreated;
+ $activities[] = $tmpactivity;
+
+ $index++;
+ }
+ }
+
+ return;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////
+function workshop_print_recent_mod_activity($activity, $course, $detail=false) {
+
+ global $CFG;
+
+ echo '<table border="0" cellpadding="3" cellspacing="0">';
+
+ if ($activity->content->parent) {
+ $openformat = "<font size=\"2\"><i>";
+ $closeformat = "</i></font>";
+ } else {
+ $openformat = "<b>";
+ $closeformat = "</b>";
+ }
+
+ echo "<tr><td bgcolor=\"$THEME->cellcontent2\" class=\"workshoppostpicture\" width=\"35\" valign=\"top\">";
+ print_user_picture($activity->user->userid, $course, $activity->user->picture);
+ echo "</td><td>$openformat";
+
+ if ($detail) {
+ echo "<img src=\"$CFG->modpixpath/$activity->type/icon.gif\" ".
+ "height=16 width=16 alt=\"$activity->name\"> ";
+ }
+ echo "<a href=\"$CFG->wwwroot/mod/workshop/view.php?"
+ . "#" . $activity->content->id . "\">".$activity->content->title;
+
+ echo "</a>$closeformat";
+
+ echo "<br><font size=\"2\">";
+ echo "<a href=\"$CFG->wwwroot/user/view.php?id=" . $activity->user->userid . "&course=" . "$course\">"
+ . $activity->user->fullname . "</a>";
+ echo " - " . userdate($activity->timestamp) . "</font></td></tr>";
+ echo "</table>";
+
+ return;
+
+}
+
//////////////////////////////////////////////////////////////////////////////////////
// Non-standard workshop functions
if (!$submission->timecreated) { // a "no submission"
return $submission->title;
- }
+ }
+ require_once("$CFG->dirroot/files/mimetypes.php");
$filearea = workshop_file_area_name($workshop, $submission);
if ($basedir = workshop_file_area($workshop, $submission)) {
if (list($file) = get_directory_list($basedir)) {
// ...the date stamp on the assessment should be in the past
if ($assessment->timecreated < $timenow) {
$n++;
- }
}
}
+ }
if ($n < min($workshop->ntassessments, workshop_count_teacher_submissions($workshop))) {
$result = false;
- }
}
- return $result;
- }
-
-//////////////////////////////////////////////////////////////////////////////////////
-function workshop_get_recent_mod_activity(&$activities, &$index, $sincetime, $courseid,
- $workshop="0", $user="", $groupid="") {
- // Returns all workshop posts since a given time. If workshop is specified then
- // this restricts the results
-
- global $CFG;
-
- if ($workshop) {
- $workshopselect = " AND cm.id = '$workshop'";
- } else {
- $workshopselect = "";
}
-
- if ($user) {
- $userselect = " AND u.id = '$user'";
- } else {
- $userselect = "";
- }
-
- $posts = get_records_sql("SELECT s.*, u.firstname, u.lastname,
- u.picture, cm.instance, w.name, cm.section
- FROM {$CFG->prefix}workshop_submissions s,
- {$CFG->prefix}user u,
- {$CFG->prefix}course_modules cm,
- {$CFG->prefix}workshop w
- WHERE s.timecreated > '$sincetime' $workshopselect
- AND s.userid = u.id $userselect
- AND w.course = '$courseid' $groupselect
- AND cm.instance = w.id
- AND cm.course = w.course
- AND s.workshopid = w.id
- ORDER BY s.id");
-
-
- if (empty($posts)) {
- return;
- }
-
- foreach ($posts as $post) {
-
- if (empty($groupid) || ismember($groupid, $post->userid)) {
- $tmpactivity->type = "workshop";
- $tmpactivity->defaultindex = $index;
- $tmpactivity->instance = $post->instance;
- $tmpactivity->name = $post->name;
- $tmpactivity->section = $post->section;
-
- $tmpactivity->content->id = $post->id;
- $tmpactivity->content->title = $post->title;
-
- $tmpactivity->user->userid = $post->userid;
- $tmpactivity->user->fullname = fullname($post);
- $tmpactivity->user->picture = $post->picture;
-
- $tmpactivity->timestamp = $post->timecreated;
- $activities[] = $tmpactivity;
-
- $index++;
- }
- }
-
- return;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////
-function workshop_print_recent_mod_activity($activity, $course, $detail=false) {
-
- global $CFG;
-
- echo '<table border="0" cellpadding="3" cellspacing="0">';
-
- if ($activity->content->parent) {
- $openformat = "<font size=\"2\"><i>";
- $closeformat = "</i></font>";
- } else {
- $openformat = "<b>";
- $closeformat = "</b>";
- }
-
- echo "<tr><td bgcolor=\"$THEME->cellcontent2\" class=\"workshoppostpicture\" width=\"35\" valign=\"top\">";
- print_user_picture($activity->user->userid, $course, $activity->user->picture);
- echo "</td><td>$openformat";
-
- if ($detail) {
- echo "<img src=\"$CFG->modpixpath/$activity->type/icon.gif\" ".
- "height=16 width=16 alt=\"$activity->name\"> ";
- }
- echo "<a href=\"$CFG->wwwroot/mod/workshop/view.php?"
- . "#" . $activity->content->id . "\">".$activity->content->title;
-
- echo "</a>$closeformat";
-
- echo "<br><font size=\"2\">";
- echo "<a href=\"$CFG->wwwroot/user/view.php?id=" . $activity->user->userid . "&course=" . "$course\">"
- . $activity->user->fullname . "</a>";
- echo " - " . userdate($activity->timestamp) . "</font></td></tr>";
- echo "</table>";
-
- return;
-
+ return $result;
}
-
+
?>