Ver código fonte

Adicionado table view que lista os grade importer

Felipe-cavalieri 5 anos atrás
pai
commit
bb0295d054
1 arquivos alterados com 47 adições e 0 exclusões
  1. 47 0
      view.php

+ 47 - 0
view.php

@@ -56,6 +56,53 @@ echo $output->heading($heading);
 //tabela com as notas vem aqui
 echo 'parte principal do importador de notas';
 
+require_once($CFG->libdir . '/tablelib.php');
+
+$data = array();
+$data["Prova"] = array();
+$data["Prova"][] = array("P1", "7", "fulanoP1.pdf");
+$data["Prova"][] = array("P2", "7", "fulanoP2.pdf");
+$data["Prova"][] = array("P3", "7", "fulanoP3.pdf");
+$data["Exercicio"][] = array("E1", "-", "fulanoE1.pdf.pdf");
+$data["Exercicio"][] = array("E2", "-", "fulanoE2.pdf.pdf");
+$data["teste"][] = array("E1", "-", "fulanoE1.pdf.pdf");
+$data["teste"][] = array("E2", "-", "fulanoE2.pdf.pdf");
+
+$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);
+
 /// Finish the page
 echo $output->footer();