123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?php
- require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
- require_once(dirname(__FILE__).'/lib.php');
- global $DB;
- $id = optional_param('id', 0, PARAM_INT);
- $g = optional_param('g', 0, PARAM_INT);
- if ($id) {
- if (! $cm = get_coursemodule_from_id('gradeimporter', $id)) {
- error('Course Module ID was incorrect');
- }
- if (! $course = $DB->get_record('course', array('id'=> $cm->course))) {
- error('Course is misconfigured');
- }
- if (! $gradeimporter = $DB->get_record('gradeimporter', array('id'=> $cm->instance) ) ) {
- error('Course module is incorrect');
- }
- } else if ($g) {
- if (! $gradeimporter = $DB->get_record('gradeimporter', array('id'=> $g)) ){
- error('Course module is incorrect');
- }
- if (! $course = $DB->get_record('course', array('id'=> $gradeimporter->course)) ) {
- error('Course is misconfigured');
- }
- if (! $cm = get_coursemodule_from_instance('gradeimporter', $gradeimporter->id, $course->id)) {
- error('Course Module ID was incorrect');
- }
- } else {
- error('You must specify a course_module ID or an instance ID');
- }
- require_login($course, true, $cm);
- $context = context_module::instance($cm->id);
-
- $PAGE->set_cm($cm);
- $PAGE->set_url('/mod/gradeimporter/view.php', array('id' => $cm->id));
- $PAGE->set_title(format_string($gradeimporter->name));
- $PAGE->set_heading(format_string($course->fullname));
- $PAGE->set_context($context);
-
- $output = $PAGE->get_renderer('mod_folder');
- echo $output->header();
- $heading = get_string('displayingview', 'gradeimporter', $gradeimporter->name);
- echo $output->heading($heading);
- if (has_capability('mod/gradeimporter:edit', $context)) {
- $url = new moodle_url('/mod/gradeimporter/submission.php');
- $newSubmission = '<form action="'. $url . '">'.
- '<input type="hidden" name="id" value="'. $gradeimporter->id .'" />'.
- '<input type="hidden" name="cmid" value="'.$cm->id.'" />'.
- '<input type="hidden" name="page" value="0" />'.
- '<input type="submit" Value="'.get_string('newsubmission', 'gradeimporter').'" />'.
- '</form>';
- echo $newSubmission;
- }
- echo 'parte principal do importador de notas';
- require_once($CFG->libdir . '/tablelib.php');
- require_once(dirname(__FILE__).'/locallib.php');
- use \gradeimporter\feedback;
- $data = feedback::get_comments();
- if (!feedback::is_capability()) {
- $table = new html_table();
- $table->attributes['class'] = 'generaltable mod_index';
- $table->head = array ("Tipo", "Nome", "Nota", "Arquivos");
- $table->align = array ('center', 'center', 'center', 'center');
- if (count($data)) {
- $current = "";
- foreach ($data as $tipo => $cells) {
- if ($current != "" && $current != $tipo) {
- $row = new html_table_row();
- $cell = new html_table_cell();
- $cell->colspan = 5;
- $row->cells[] = $cell;
- $table->data[] = $row;
- }
- $current = $tipo;
- $row = new html_table_row();
- $cell = new html_table_cell($tipo);
- $cell->rowspan = count($cells)+1;
- $row->cells[] = $cell;
- $table->data[] = $row;
- foreach ($cells as $cell) {
- $row = new html_table_row();
- foreach ($cell as $value) {
- $cell = new html_table_cell($value);
- $row->cells[] = $cell;
- }
- $table->data[] = $row;
- }
- }
- }
- echo html_writer::table($table);
- }
- if (feedback::is_capability()) {
-
-
-
-
-
-
-
-
-
- $table = new html_table();
- $table->attributes['class'] = 'generaltable mod_index';
- $table->head = array ("Aluno", "Tipo", "Nome", "Nota", "Arquivos");
- $table->align = array ('center', 'center', 'center', 'center', 'center');
- if (count($data)) {
- $currentAluno = "";
- foreach ($data as $aluno => $datas) {
- if ($currentAluno != "" && $currentAluno != $aluno) {
- $row = new html_table_row();
- $cell = new html_table_cell();
- $cell->colspan = 6;
- $row->cells[] = $cell;
- $table->data[] = $row;
- }
- $t = count($datas);
- foreach ($datas as $tipo => $cells) {$t += count($cells);};
- $currentAluno = $aluno;
- $row = new html_table_row();
- $cell = new html_table_cell($aluno);
- $cell->rowspan = $t+1;
- $row->cells[] = $cell;
- $table->data[] = $row;
- foreach ($datas as $tipo => $cells) {
- $row = new html_table_row();
- $cell = new html_table_cell($tipo);
- $cell->rowspan = count($cells)+1;
- $row->cells[] = $cell;
- $table->data[] = $row;
- foreach ($cells as $cell) {
- $row = new html_table_row();
- foreach ($cell as $value) {
- $row->cells[] = new html_table_cell($value);
- }
- $table->data[] = $row;
- }
- }
- }
- }
- echo html_writer::table($table);
- }
- echo $output->footer();
|