$returnurl = new moodle_url('/local/myacademics/index.php'); if ($mform->is_cancelled()) { redirect($returnurl); } if ($data) { $grades = $request->myacademics_grades($data->programid, $data->semesterid); $data = array(); foreach ($grades as $grade) { $result = array(); $result[] = $DB->get_field('local_clclasses', 'fullname', array('id' => $grade->classid)); $result[] = $DB->get_field('local_semester', 'fullname', array('id' => $grade->semesterid)); $result[] = $DB->get_field('local_program', 'fullname', array('id' => $grade->programid)); $result[] = $grade->coursetotal; $result[] = $grade->percentage; $result[] = $grade->gradeletter; $wgp = $request->total_grade_points($grade->gradepoint, $grade->classid); $result[] = $wgp; $data[] = $result; $totalgradepoints = $totalgradepoints + $wgp; $credits = $request->total_grade_credits($grade->classid); $totalcredits = $totalcredits + $credits; } $table = new html_table(); $table->head = array( get_string('course', 'local_cobaltcourses'), get_string('semester', 'local_semesters'), get_string('program', 'local_programs'), get_string('score', 'local_gradesubmission'), get_string('percentage', 'local_request'), get_string('gradeletter', 'local_gradesubmission'), get_string('gradepoint', 'local_request')