Included journal_get_participants() function.

This commit is contained in:
stronk7
2003-09-07 21:36:03 +00:00
parent eaa3298b07
commit 058a2215ef
+29
View File
@@ -428,4 +428,33 @@ function journal_print_feedback($course, $entry, $grades) {
echo "</TD></TR></TABLE>";
}
function journal_get_participants($journalid) {
//Returns the users with data in one journal
//(users with records in journal_entries, students and teachers)
global $CFG;
//Get students
$students = get_records_sql("SELECT DISTINCT u.*
FROM {$CFG->prefix}user u,
{$CFG->prefix}journal_entries j
WHERE j.journal = '$journalid' and
u.id = j.userid");
//Get teachers
$teachers = get_records_sql("SELECT DISTINCT u.*
FROM {$CFG->prefix}user u,
{$CFG->prefix}journal_entries j
WHERE j.journal = '$journalid' and
u.id = j.teacher");
//Add teachers to students
if ($teachers) {
foreach ($teachers as $teacher) {
$students[$teacher->id] = $teacher;
}
}
//Return students array (it contains an array of unique users)
return ($students);
}
?>