Pārlūkot izejas kodu

update access restriction that didn't allow students to download their feedback files

bernardo 4 gadi atpakaļ
vecāks
revīzija
663316550c
4 mainītis faili ar 147 papildinājumiem un 52 dzēšanām
  1. 73 6
      lang/pt_br/gradeimporter.php
  2. 2 3
      locallib.php
  3. 1 1
      version.php
  4. 71 42
      view.php

+ 73 - 6
lang/pt_br/gradeimporter.php

@@ -1,9 +1,76 @@
 <?php
-$string['gradeimporter'] = 'Importador de notas';
+$string['gradeimporter'] = 'Importador de Notas';
+$string['pluginname'] = 'Importador de Notas';
 
-$string['moduleName'] = 'Importador de notas';
-$string['moduleNamePlural'] = 'Importadores de notas';
+$string['modulename'] = 'Importador de Notas';
+$string['modulenameplural'] = 'Importadores de Notas';
 
-$string['gradeimporterintro'] = 'Esse módulo facilita a
-            disponibilização de notas de atividades para os alunos';
-$string['gradeimportername'] = 'Importador de Notas';
+$string['gradeimporterintro'] = 'Esse módulo permite ao professor disponibilizar resultados de atividades e a correção aos alunos, podendo também adicionar notas e comentários';
+$string['gradeimportername'] = 'Importador de Notas';
+$string['pluginadministration'] ='Administração do Importador de Notas';
+$string['displayingview'] = 'Notas disponíveis';
+
+//submission.php
+$string['invalidgradeimporterid'] = 'ID do Importador de Notas inválido';
+$string['submissionadded'] = 'Submissão adicionada ao Banco de Dados';
+$string['newsubmission'] = 'Nova Submissão';
+
+//formStrings
+
+    //Generic 
+    $string['description'] = 'Descrição';
+    $string['visibility'] = 'Alunos podem ver isto?';
+    $string['name'] = 'Nome';
+    $string['yes'] = 'Sim';
+    $string['no'] = 'Não';
+
+    //Generic error Messages
+    $string['error_nameField'] = 'Insira um nome';
+
+
+    //gradeImporter form
+    $string['general'] = 'Informações Gerais';
+    $string['visibilityOn'] = 'Alunos podem ver isto';
+    $string['visibilityOff'] = 'Alunos não podem ver isto';
+    
+    //subtypes
+        $string['exam'] = 'Prova';
+        $string['activity'] = 'Atividade';
+
+    //gradeImporter form errors
+
+
+
+    //submission form
+    $string['gradebookN'] = 'Esta submissão vai para o quadro de notas';
+    $string['gradebookY'] = 'Esta submissão não vai para o quadro de notas';
+    $string['submissionFiles'] = 'Arquivo de correção para o aluno';
+    $string['submissionDescription'] = 'Descrição da Submissão';
+    $string['submissionType'] = 'Tipo de Submissão';
+    $string['visibilityYN'] = 'Visibilidade';
+    $string['csvdelimiter'] = 'Delimitador do CSV';
+    $string['filehandling'] = 'Arquivos';
+    $string['gradebookYN'] = 'Quadro de notas';
+    $string['visibilityYN'] = 'Alunos podem ver isto?';
+
+
+    //submission form help buttons
+    $string['submissionType_help'] = 'Escolha o tipo da submissão (ex: Prova, Atividade, Lista, etc.)'; 
+    $string['submissionFiles_help'] = 'Deve conter apenas um arquivo .zip com um csv de configuração e os arquivos de cada aluno';
+    $string['csvdelimiter_help'] = 'Delimitador do arquivo CSV';
+    $string['gradebookYN_help'] = 'Sim, resultados vão para o quadro de notas \n Não, resultados não vão para o quadro de notas';
+    $string['visibilityYN_help'] = 'Sim, os alunos podem ver a submissão \n Não, os alunos não podem ver a submissão';
+
+    //submission form errors
+
+
+//Submission type 
+    $string['newsubtype'] = 'Novo tipo de Submissão';
+
+    //Submission type help
+    $string['newsubtype_help'] = 'Vai para o formulário de novo tipo de submissão';
+
+//events string
+    $string['eventmodelsubmissioncreated'] = 'Submissão criada';
+
+$string['downloadconfigcsv'] = 'Descarregar modelo do CSV de configuração';

+ 2 - 3
locallib.php

@@ -10,7 +10,7 @@ namespace gradeimporter{
           $sql = "
           SELECT gf.id gf_id,
                 gf.grade,
-                gf.comment,
+                gf.comment gf_comment,
                 gf.contextid gf_contextid,
                 gf.fileid gf_fileid,
                 gf.name gf_name,
@@ -36,8 +36,7 @@ namespace gradeimporter{
                 
                 $fileurl = buildurl ($cmid, $id, $value->gf_id, $value->gf_name);
                 
-                $data[$value->gst_name][] = array($value->gs_name, $value->grade, $fileurl);
-                //$data[$value->gst_name][] = array($value->gs_name, $value->grade, $value->fileid);
+                $data[$value->gst_name][] = array($value->gs_name, $value->grade, $value->gf_comment, $fileurl);
             }
           }
 

+ 1 - 1
version.php

@@ -2,7 +2,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 20191114;
+$plugin->version = 20191119;
 $plugin->requires = 2014021100;
 $plugin->release = 'v1.0';
 $plugin->component = 'mod_gradeimporter';

+ 71 - 42
view.php

@@ -52,7 +52,7 @@
 
 
 
-    if ($action==1 && has_capability('mod/gradeimporter:edit', $context)){
+    if ($action==1 && has_capability('mod/gradeimporter:view', $context)){
       //download feedback file
       $fs = get_file_storage();
       $file = $fs->get_file($context->id, 'mod_gradeimporter', 'gradeimporter_feedback', $fileid, '/', $filename);
@@ -60,6 +60,7 @@
         send_stored_file($file, 86400, 0, true);
       }
     } else if ($action == 2 && has_capability('mod/gradeimporter:edit', $context)){
+      //download students csv with their id
       exportCSV($context);
     }
 
@@ -70,15 +71,6 @@
     $PAGE->set_title(format_string($gradeimporter->name));
     $PAGE->set_heading(format_string($course->fullname));
     $PAGE->set_context($context);
-    /*$button = '';
-    if (has_capability('mod/gradeimporter:edit', $context)) {
-      $urlparams = array('id'=>$id, 'page'=>$page, 'editing'=>$editing ? '0' : '1');
-      $url = new moodle_url('/mod/gradeimporter/view.php', $urlparams);
-      $strediting = get_string('turnediting'.($editing ? 'off' : 'on'));
-      $button = $OUTPUT->single_button($url, $strediting, 'get'). ' ';
-    }
-    $PAGE->set_button($button);*/
-/// Print the main part of the page
 
 $output = $PAGE->get_renderer('mod_folder');
 echo $output->header();
@@ -115,51 +107,88 @@ require_once($CFG->libdir . '/tablelib.php');
 require_once(dirname(__FILE__).'/locallib.php');
 use \gradeimporter\feedback;
 
-// $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");
-
 $data = feedback::get_comments($cm->id, $id);
 
-$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) {
+if (has_capability('mod/gradeimporter:edit', $context)){
+  //loads teacher view
+  $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();
-      $cell->colspan = 5;
+      $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;
+        }
+      }
     }
-    $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);
+  }
+} else {
+  //loads student view
+  $table = new html_table();
+  $table->attributes['class'] = 'generaltable mod_index';
+  $table->head  = array ("Tipo", "Nome", "Nota", "Comentários", "Arquivos");
+  $table->align = array ('center', '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();