Bladeren bron

Minor - format code, fix PHP warning

jmontoyaa 7 jaren geleden
bovenliggende
commit
9e8c82da38
2 gewijzigde bestanden met toevoegingen van 12 en 7 verwijderingen
  1. 3 3
      main/gradebook/gradebook_view_result.php
  2. 9 4
      main/gradebook/lib/fe/resulttable.class.php

+ 3 - 3
main/gradebook/gradebook_view_result.php

@@ -108,7 +108,7 @@ if (isset($_GET['import'])) {
         Display :: display_header(get_lang('Import'));
     }
     $eval[0]->check_lock_permissions();
-    if ($_POST['formSent']) {
+    if (isset($_POST['formSent']) && $_POST['formSent']) {
         if (!empty($_FILES['import_file']['name'])) {
             $values = $import_result_form->exportValues();
             $file_type = $_POST['file_type'];
@@ -487,7 +487,7 @@ if (isset($_GET['print'])) {
     );
     exit;
 } else {
-    $resulttable = new ResultTable($eval[0], $allresults, $iscourse, $addparams);
+    $resultTable = new ResultTable($eval[0], $allresults, $iscourse, $addparams);
 }
 
 $htmlHeadXtra[] = '<script>
@@ -572,6 +572,6 @@ if ($file_type == null) {
         DisplayGradebook::display_header_result($eval[0], $currentcat[0]->get_id(), 1);
     }
     // Letter-based scores are built from lib/results_data_generator.class.php::get_score_display()
-    $resulttable->display();
+    $resultTable->display();
     Display::display_footer();
 }

+ 9 - 4
main/gradebook/lib/fe/resulttable.class.php

@@ -16,13 +16,18 @@ class ResultTable extends SortableTable
     private $iscourse;
 
     /**
-     * Constructor
+     * ResultTable constructor.
+     * @param string $evaluation
+     * @param array $results
+     * @param null|string $iscourse
+     * @param array $addparams
+     * @param bool $forprint
      */
     public function __construct(
         $evaluation,
         $results = array(),
         $iscourse,
-        $addparams = null,
+        $addparams = [],
         $forprint = false
     ) {
         parent:: __construct(
@@ -98,7 +103,7 @@ class ResultTable extends SortableTable
                     $sorting = ResultsDataGenerator::RDG_SORT_LASTNAME;
                 }
                 break;
-            // first name or last name
+                // first name or last name
             case (1 + $col_adjust):
                 if ($isWesternNameOrder) {
                     $sorting = ResultsDataGenerator::RDG_SORT_LASTNAME;
@@ -106,7 +111,7 @@ class ResultTable extends SortableTable
                     $sorting = ResultsDataGenerator::RDG_SORT_FIRSTNAME;
                 }
                 break;
-            // Score
+                // Score
             case (2 + $col_adjust):
                 $sorting = ResultsDataGenerator::RDG_SORT_SCORE;
                 break;