]> git.mjollnir.org Git - moodle.git/commitdiff
Added the lesson_get_participants() function
authorstronk7 <stronk7>
Sun, 22 Feb 2004 18:15:45 +0000 (18:15 +0000)
committerstronk7 <stronk7>
Sun, 22 Feb 2004 18:15:45 +0000 (18:15 +0000)
to properly detect all the needed users with data
in the activity in order to be able to backup them.

mod/lesson/backuplib.php
mod/lesson/lib.php
mod/lesson/restorelib.php

index 07ce4d300724724b0c813d1bb10c6946ee5a3b81..2817ea4e7edcbaf8517e5ee0441cbe7386a1a486 100644 (file)
     //                                             |                         lesson_grades
     //                                             |                  (UL, pk->id,fk->lessonid)
     //                                      lesson_pages
-    //                                  (pk->id,fk->lessonid)
+    //                                  (CL,pk->id,fk->lessonid)
     //                                             |
     //                                             |
     //                                             |
     //                                       lesson_answers
-    //                                    (pk->id,fk->pageid)
+    //                                    (CL,pk->id,fk->pageid)
     //                                             |
     //                                             |
     //                                             |
index d4800d348cdec232226e927bafd441e6363666a2..35553b4e7604503f978b72083dfc6f01e1be7bcd 100644 (file)
@@ -276,9 +276,18 @@ function lesson_get_participants($lessonid) {
 //Must return an array of user records (all data) who are participants
 //for a given instance of lesson. Must include every user involved
 //in the instance, independient of his role (student, teacher, admin...)
-//See other modules as example.
 
-    return false;
+    global $CFG;
+    
+    //Get students
+    $students = get_records_sql("SELECT DISTINCT u.*
+                                 FROM {$CFG->prefix}user u,
+                                      {$CFG->prefix}lesson_attempts a
+                                 WHERE a.lessonid = '$lessonid' and
+                                       u.id = a.userid");
+
+    //Return students array (it contains an array of unique users)
+    return ($students);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////
index 486507bf3de04e003edc85c1c842d423430c403f..64e4ec7e103c792ce2604a65e24496bc4f32d5fa 100644 (file)
     //                                             |                         lesson_grades
     //                                             |                  (UL, pk->id,fk->lessonid)
     //                                      lesson_pages
-    //                                  (pk->id,fk->lessonid)
+    //                                  (CL,pk->id,fk->lessonid)
     //                                             |
     //                                             |
     //                                             |
     //                                       lesson_answers
-    //                                    (pk->id,fk->pageid)
+    //                                    (CL,pk->id,fk->pageid)
     //                                             |
     //                                             |
     //                                             |