view.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
  3. require_once(dirname(__FILE__).'/lib.php');
  4. global $DB;
  5. $id = optional_param('id', 0, PARAM_INT); // course_module ID, or
  6. $g = optional_param('g', 0, PARAM_INT); // gradeimporter instance ID, should be named as the first character of the module
  7. if ($id) {
  8. if (! $cm = get_coursemodule_from_id('gradeimporter', $id)) {
  9. error('Course Module ID was incorrect');
  10. }
  11. if (! $course = $DB->get_record('course', array('id'=> $cm->course))) {
  12. error('Course is misconfigured');
  13. }
  14. if (! $gradeimporter = $DB->get_record('gradeimporter', array('id'=> $cm->instance) ) ) {
  15. error('Course module is incorrect');
  16. }
  17. } else if ($g) {
  18. if (! $gradeimporter = $DB->get_record('gradeimporter', array('id'=> $g)) ){
  19. error('Course module is incorrect');
  20. }
  21. if (! $course = $DB->get_record('course', array('id'=> $gradeimporter->course)) ) {
  22. error('Course is misconfigured');
  23. }
  24. if (! $cm = get_coursemodule_from_instance('gradeimporter', $gradeimporter->id, $course->id)) {
  25. error('Course Module ID was incorrect');
  26. }
  27. } else {
  28. error('You must specify a course_module ID or an instance ID');
  29. }
  30. require_login($course, true, $cm);
  31. $context = context_module::instance($cm->id);
  32. /// Print the page header
  33. $PAGE->set_url('/mod/gradeimporter/view.php', array('id' => $cm->id));
  34. $PAGE->set_title(format_string($gradeimporter->name));
  35. $PAGE->set_heading(format_string($course->fullname));
  36. $PAGE->set_context($context);
  37. /// Print the main part of the page
  38. $output = $PAGE->get_renderer('mod_folder');
  39. echo $output->header();
  40. $heading = get_string('displayingview', 'gradeimporter', $gradeimporter->name);
  41. echo $output->heading($heading);
  42. //tabela com as notas vem aqui
  43. echo 'parte principal do importador de notas';
  44. /// Finish the page
  45. echo $output->footer();