Am I the only one who needs to see all of a student's assignments from all classes for a given week?

Am I the only one who needs to see all of a student's assignments from all classes for a given week?

by J m -
Number of replies: 1

Back in 1.8 (or 1.9, I can't remember), I wrote an SQL query that selected all of student's assignments from all the classes for a given week based upon the user's id.

Off all the searches I have done on Google to find a query like that, I've found nothing.  I only bring it up because with new assignment types in 2.5, I can only get the old Advanced Uploading types.

Am I really the only one that thinks that a student should see an assignment sheet that shows all their assignments for that week?

The parents use that to help their children know what to do for homework.

SELECT cx.id as context_id, a.id as assignment_id, a.course, a.id, a.name, a.intro, c.id, c.fullname, u.id, u.username, u.firstname, u.lastname, u.email, u.country, u.firstaccess, u.lastaccess, u.lastlogin, u.currentlogin, u.timemodified, cs.section

FROM mdl_course c,mdl_context cx, mdl_assignment a, mdl_role_assignments ra, mdl_user u, mdl_course_modules cm, mdl_course_sections cs

 

WHERE c.id = cx.instanceid AND c.id = a.course AND a.id = cm.instance AND cm.section = cs.id AND cm.section = cs.id AND cx.id = ra.contextid AND ra.userid = u.id AND cx.contextlevel = '50'AND u.id = 23 AND cm.visible = 1 AND cs.section = 3 AND c.idnumber = 1

Thanks for ideas and sorry for the display.  I didn't know know how to format it for the forum.

 

Average of ratings: -
In reply to J m

Re: Am I the only one who needs to see all of a student's assignments from all classes for a given week?

by J m -

I was able to get it with the SQL below when I figured out mdl_assign held the assignments made with just "assignment" when adding a new assignment instead of advanced uploading of assignments, which are kept in mdl_assignment.

$strSQL2 = '(SELECT a.course as course_number_alias, cx.id as context_id, a.id as assignment_id, a.course, a.id, a.name, a.intro, c.id, c.fullname, u.id, u.username, u.firstname, u.lastname, u.email, u.country, u.firstaccess, u.lastaccess, u.lastlogin, u.currentlogin, u.timemodified, cs.section ';

$strSQL2 .= 'FROM ';
$strSQL2 .= 'mdl_course c, mdl_context cx, mdl_assignment a, mdl_role_assignments ra, mdl_user u, ';
$strSQL2 .= 'mdl_course_modules cm, mdl_course_sections cs ';
$strSQL2 .= 'WHERE ';
$strSQL2 .= 'c.id = cx.instanceid ';
$strSQL2 .= 'AND ' ;
$strSQL2 .= 'c.id = a.course ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'a.id = cm.instance ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cm.section = cs.id ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cm.section = cs.id ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cx.id = ra.contextid ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'ra.userid = u.id ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cx.contextlevel = \'50\'';
$strSQL2 .= 'AND ';
$strSQL2 .= 'u.id = '. $USER->id . ' ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cm.visible = 1 ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cs.section = ' . $weeknumber . ' ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'c.idnumber = ' . $semester . ') ';
$strSQL2 .= 'UNION ';
$strSQL2 .= '(SELECT a.course as course_number_alias, cx.id as context_id, a.id as assignment_id, a.course, a.id, a.name, a.intro, c.id, c.fullname, u.id, u.username, u.firstname, u.lastname, u.email, u.country, u.firstaccess, u.lastaccess, u.lastlogin, u.currentlogin, u.timemodified, cs.section ';
$strSQL2 .= 'FROM ';
$strSQL2 .= 'mdl_course c, mdl_context cx, mdl_assign a, mdl_role_assignments ra, mdl_user u, ';
$strSQL2 .= 'mdl_course_modules cm, mdl_course_sections cs ';
$strSQL2 .= 'WHERE ';
$strSQL2 .= 'c.id = cx.instanceid ';
$strSQL2 .= 'AND ' ;
$strSQL2 .= 'c.id = a.course ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'a.id = cm.instance ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cm.section = cs.id ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cm.section = cs.id ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cx.id = ra.contextid ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'ra.userid = u.id ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cx.contextlevel = \'50\'';
$strSQL2 .= 'AND ';
$strSQL2 .= 'u.id = '. $USER->id . ' ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cm.visible = 1 ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'cs.section = ' . $weeknumber . ' ';
$strSQL2 .= 'AND ';
$strSQL2 .= 'c.idnumber = ' . $semester . ') ';
$strSQL2 .= 'ORDER BY course_number_alias ';

I also discovered "My Courses" which is helpful but not quite was we needed.