$context = get_context_instance(CONTEXT_COURSE, $id); require_capability('moodle/grade:export', $context); require_capability('gradeexport/sl:view', $context); if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) { if (!groups_is_member($groupid, $USER->id)) { print_error('cannotaccessgroup', 'grades'); } } $courseName = $course->fullname; $courseName_xx = htmlspecialchars($courseName); $section = required_param('section', PARAM_TEXT); // SL section to synchronize $readFile = new sl_roster($DB, $url, $teacherid, $username, $password); $studentList = $readFile->getStudentsOfPeriod($section); $sectionList = $readFile->getSectionNames(); $assignmentIdMap1 = $readFile->getAssignmentMap($section); $gMods = $readFile->lookUpCourseGradeItems($id, $assignmentIdMap1); $gModMap = $readFile->getCourseGradeItemMap($id); $combinedMap = array(); foreach ($assignmentIdMap1 as $key => $val) { $combinedMap[$key] = $key; } foreach ($gModMap as $key => $val) { $combinedMap[$key] = $key; } ksort($combinedMap); echo <<<PAGE_HEAD <html><body> <p></p><ul> <h3>School Loop Synchronization - Assignments</h3>
if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) { if (!groups_is_member($groupid, $USER->id)) { print_error('cannotaccessgroup', 'grades'); } } echo "<html><body><p><a href=\"../../report/user/index.php?id={$id}\">The Course User Report</a></p><ul>\n"; $fileloc1 = "SampleRoster.xml"; $fileloc2 = "http://bobcat:8080/wu/samples/SampleRoster.xml"; $username = ""; $password = ""; //sample (test) values $secid = "en442-01"; $secid2 = "en442-02"; $student1 = 21; $readFile = new sl_roster($DB, $fileloc2, 502, $username, $password); $assignmentIdMap1 = $readFile->getAssignmentMap($secid); $assignmentIdMap2 = $readFile->getAssignmentMap($secid2); print_tablez("Sections from Schoolloop", $readFile->getSectionNames()); print_tablez("Assignments for {$secid}", $assignmentIdMap1); print_tablez("Assignments for {$secid2}", $assignmentIdMap2); $studentList = $readFile->getStudentsOfPeriod($secid); print_tabley("Section {$secid} - Students from Schoolloop", $studentList, array('firstName', 'lastName', 'moodleId', 'studentId', 'systemID')); $studentList2 = $readFile->getStudentsOfPeriod($secid2); print_tabley("Section {$secid2} - Students from Schoolloop", $studentList2, array('firstName', 'lastName', 'moodleId', 'studentId', 'systemID')); $cMods = $readFile->lookUpCourseModules($id, $assignmentIdMap1); print_tabley("Modules for course {$id} (system id from {$secid})", $cMods, array('id', 'module', 'name', 'systemID')); $gMods = $readFile->lookUpCourseGradeItems($id, $assignmentIdMap1); print_tabley("Grade Items course {$id} (system id from {$secid})", $gMods, array('id', 'module', 'name', 'systemID')); $grade = $DB->get_records('grade_items', array('courseid' => $id)); print_tablex("Grades Items for Course {$id}", $grade, array('courseid', 'itemname', 'iteminstance', 'itemmodule')); echo '<hr/>';