]> git.mjollnir.org Git - moodle.git/commitdiff
Repeated fixes made in stable:
authormoodler <moodler>
Wed, 8 Sep 2004 06:43:57 +0000 (06:43 +0000)
committermoodler <moodler>
Wed, 8 Sep 2004 06:43:57 +0000 (06:43 +0000)
  - moved two functions from locallib.php to lib.php
  - include mimetypes.php so mimeinfo works

mod/workshop/lib.php
mod/workshop/locallib.php

index 2cb311695c8a8df0bc8bdb8607302f02ec738ba9..b09be734a145d0194d51e490ae49cbdcc969a885 100644 (file)
@@ -1019,6 +1019,109 @@ function workshop_get_participants($workshopid) {
     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
index ac1eb0473b320e583fb8bb8190d44cde22ecfc21..3bafd0cbbbb41c680f8674c675cb7352a8626337 100644 (file)
@@ -2558,8 +2558,9 @@ function workshop_print_submission_title($workshop, $submission) {
     
     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)) {
@@ -2741,118 +2742,15 @@ function workshop_test_user_assessments($workshop, $user) {
                 // ...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;
 }
-
+    
 
 ?>