Sfoglia il codice sorgente

Add best score, ranking for teachers

Julio 6 anni fa
parent
commit
5d4ddb3f89

+ 14 - 4
main/gradebook/lib/GradebookUtils.php

@@ -1611,6 +1611,15 @@ class GradebookUtils
         $alleval = $cats[0]->get_evaluations($userId);
         $alllink = $cats[0]->get_links($userId);
 
+        $loadStats = [];
+        if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
+            $loadStats = [1, 2, 3];
+        } else {
+            if (api_get_configuration_value('gradebook_enable_best_score') !== false) {
+                $loadStats = [2];
+            }
+        }
+
         $gradebooktable = new GradebookTable(
             $cat,
             $allcat,
@@ -1620,15 +1629,16 @@ class GradebookUtils
             true, // $exportToPdf
             false, // showteacher
             $userId,
-            $studentList
+            $studentList,
+            $loadStats
         );
 
         $gradebooktable->userId = $userId;
 
-        if (api_is_allowed_to_edit()) {
-            $gradebooktable->td_attributes = [
+        if (api_is_allowed_to_edit(null, true)) {
+            /*$gradebooktable->td_attributes = [
                 4 => 'class=centered',
-            ];
+            ];*/
         } else {
             $gradebooktable->td_attributes = [
                 3 => 'class=centered',

+ 20 - 20
main/gradebook/lib/fe/gradebooktable.class.php

@@ -104,28 +104,28 @@ class GradebookTable extends SortableTable
 
         $model = ExerciseLib::getCourseScoreModel();
 
-        if ($this->teacherView) {
-            $this->set_header(
-                $column++,
-                get_lang('Weight'),
-                '',
-                'width="100px"'
-            );
-        } else {
-            $this->set_header($column++, get_lang('Weight'), false);
-            $this->set_header($column++, get_lang('Result'), false);
-            if (empty($model)) {
-                if (in_array(1, $this->loadStats)) {
-                    $this->set_header($column++, get_lang('Ranking'), false);
-                }
-                if (in_array(2, $this->loadStats)) {
-                    $this->set_header($column++, get_lang('BestScore'), false);
-                }
-                if (in_array(3, $this->loadStats)) {
-                    $this->set_header($column++, get_lang('Average'), false);
-                }
+        $this->set_header(
+            $column++,
+            get_lang('Weight'),
+            '',
+            'width="100px"'
+        );
+        $this->set_header($column++, get_lang('Result'), false);
+
+        if (empty($model)) {
+            if (in_array(1, $this->loadStats)) {
+                $this->set_header($column++, get_lang('Ranking'), false);
+            }
+            if (in_array(2, $this->loadStats)) {
+                $this->set_header($column++, get_lang('BestScore'), false);
             }
+            if (in_array(3, $this->loadStats)) {
+                $this->set_header($column++, get_lang('Average'), false);
+            }
+        }
 
+        if ($this->teacherView) {
+        } else {
             if (!empty($cats)) {
                 if ($this->exportToPdf == false) {
                     $this->set_header($column++, get_lang('Actions'), false);