Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 38... Línea 38...
38
class assign_grading_table extends table_sql implements renderable {
38
class assign_grading_table extends table_sql implements renderable {
39
    /** @var assign $assignment */
39
    /** @var assign $assignment */
40
    private $assignment = null;
40
    private $assignment = null;
41
    /** @var int $perpage */
41
    /** @var int $perpage */
42
    private $perpage = 10;
42
    private $perpage = 10;
-
 
43
    /** @var int[] $pagingoptions Available pagination options */
-
 
44
    private $pagingoptions = [10, 20, 50, 100];
43
    /** @var int $rownum (global index of current row in table) */
45
    /** @var int $rownum (global index of current row in table) */
44
    private $rownum = -1;
46
    private $rownum = -1;
45
    /** @var renderer_base for getting output */
47
    /** @var renderer_base for getting output */
46
    private $output = null;
48
    private $output = null;
47
    /** @var stdClass gradinginfo */
49
    /** @var stdClass gradinginfo */
Línea 56... Línea 58...
56
    private $hasgrade = false;
58
    private $hasgrade = false;
57
    /** @var array $groupsubmissions - A static cache of group submissions */
59
    /** @var array $groupsubmissions - A static cache of group submissions */
58
    private $groupsubmissions = array();
60
    private $groupsubmissions = array();
59
    /** @var array $submissiongroups - A static cache of submission groups */
61
    /** @var array $submissiongroups - A static cache of submission groups */
60
    private $submissiongroups = array();
62
    private $submissiongroups = array();
61
    /** @var string $plugingradingbatchoperations - List of plugin supported batch operations */
-
 
62
    public $plugingradingbatchoperations = array();
-
 
63
    /** @var array $plugincache - A cache of plugin lookups to match a column name to a plugin efficiently */
63
    /** @var array $plugincache - A cache of plugin lookups to match a column name to a plugin efficiently */
64
    private $plugincache = array();
64
    private $plugincache = array();
65
    /** @var array $scale - A list of the keys and descriptions for the custom scale */
65
    /** @var array $scale - A list of the keys and descriptions for the custom scale */
66
    private $scale = null;
66
    private $scale = null;
67
    /** @var bool true if the user has this capability. Otherwise false. */
67
    /** @var bool true if the user has this capability. Otherwise false. */
Línea 86... Línea 86...
86
        global $CFG, $PAGE, $DB, $USER;
86
        global $CFG, $PAGE, $DB, $USER;
Línea 87... Línea 87...
87
 
87
 
Línea 88... Línea 88...
88
        parent::__construct('mod_assign_grading-' . $assignment->get_context()->id);
88
        parent::__construct('mod_assign_grading-' . $assignment->get_context()->id);
-
 
89
 
89
 
90
        $this->is_persistent(true);
Línea 90... Línea 91...
90
        $this->is_persistent(true);
91
        $this->set_attribute('id', 'submissions');
91
        $this->assignment = $assignment;
92
        $this->assignment = $assignment;
92
 
93
 
Línea 97... Línea 98...
97
 
98
 
98
        // Check if we have the elevated view capablities to see the blind details.
99
        // Check if we have the elevated view capablities to see the blind details.
99
        $this->hasviewblind = has_capability('mod/assign:viewblinddetails',
100
        $this->hasviewblind = has_capability('mod/assign:viewblinddetails',
Línea 100... Línea -...
100
                $this->assignment->get_context());
-
 
101
 
-
 
102
        foreach ($assignment->get_feedback_plugins() as $plugin) {
-
 
103
            if ($plugin->is_visible() && $plugin->is_enabled()) {
-
 
104
                foreach ($plugin->get_grading_batch_operations() as $action => $description) {
-
 
105
                    if (empty($this->plugingradingbatchoperations)) {
-
 
106
                        $this->plugingradingbatchoperations[$plugin->get_type()] = array();
-
 
107
                    }
-
 
108
                    $this->plugingradingbatchoperations[$plugin->get_type()][$action] = $description;
-
 
109
                }
-
 
110
            }
101
                $this->assignment->get_context());
111
        }
102
 
112
        $this->perpage = $perpage;
103
        $this->perpage = $perpage;
Línea 113... Línea 104...
113
        $this->quickgrading = $quickgrading && $this->hasgrade;
104
        $this->quickgrading = $quickgrading && $this->hasgrade;
Línea 122... Línea 113...
122
 
113
 
123
        if ($rowoffset) {
114
        if ($rowoffset) {
124
            $this->rownum = $rowoffset - 1;
115
            $this->rownum = $rowoffset - 1;
Línea -... Línea 116...
-
 
116
        }
-
 
117
 
-
 
118
        $userid = optional_param('userid', null, PARAM_INT);
-
 
119
        $groupid = groups_get_course_group($assignment->get_course(), true);
-
 
120
        // If the user ID is set, it indicates that a user has been selected. In this case, override the user search
-
 
121
        // string with the full name of the selected user.
125
        }
122
        $usersearch = $userid ? fullname(\core_user::get_user($userid)) : optional_param('search', '', PARAM_NOTAGS);
126
 
123
        $assignment->set_usersearch($userid, $groupid, $usersearch);
127
        $users = array_keys( $assignment->list_participants($currentgroup, true));
124
        $users = array_keys( $assignment->list_participants($currentgroup, true));
128
        if (count($users) == 0) {
125
        if (count($users) == 0) {
129
            // Insert a record that will never match to the sql is still valid.
126
            // Insert a record that will never match to the sql is still valid.
Línea 322... Línea 319...
322
                }
319
                }
Línea 323... Línea 320...
323
 
320
 
324
                $where .= '))';
321
                $where .= '))';
Línea -... Línea 322...
-
 
322
                $params['submitted'] = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
-
 
323
 
-
 
324
            } else if ($filter == ASSIGN_FILTER_GRADED) {
-
 
325
                $where .= ' AND (s.timemodified IS NOT NULL AND
-
 
326
                                 s.timemodified < g.timemodified AND g.grade IS NOT NULL)';
325
                $params['submitted'] = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
327
                $params['submitted'] = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
326
 
328
 
Línea 327... Línea 329...
327
            } else if ($filter == ASSIGN_FILTER_GRANTED_EXTENSION) {
329
            } else if ($filter == ASSIGN_FILTER_GRANTED_EXTENSION) {
328
                $where .= ' AND uf.extensionduedate > 0 ';
330
                $where .= ' AND uf.extensionduedate > 0 ';
Línea 379... Línea 381...
379
        $headers = array();
381
        $headers = array();
Línea 380... Línea 382...
380
 
382
 
381
        // Select.
383
        // Select.
382
        if (!$this->is_downloading() && $this->hasgrade) {
384
        if (!$this->is_downloading() && $this->hasgrade) {
-
 
385
            $columns[] = 'select';
-
 
386
            // The displayed text for the column header. Hidden to assistive technologies.
-
 
387
            $visibleheader = html_writer::span(get_string('select'), '', ['aria-hidden' => 'true']);
-
 
388
            // The actual accessible name for the column header which provides more context about the column's purpose to
-
 
389
            // screen reader users.
-
 
390
            $bulkactionsselection = html_writer::span(get_string('bulkactionsselection', 'assign'), 'visually-hidden');
383
            $columns[] = 'select';
391
 
384
            $headers[] = get_string('select') .
392
            // The select all checkbox.
-
 
393
            $selectalllabel = html_writer::label(get_string('selectall'), 'selectall', false, ['class' => 'visually-hidden']);
-
 
394
            $selectallcheckbox = html_writer::empty_tag(
-
 
395
                'input',
-
 
396
                [
-
 
397
                    'type' => 'checkbox',
-
 
398
                    'id' => 'selectall',
-
 
399
                    'name' => 'selectall',
-
 
400
                ],
-
 
401
            );
385
                    '<div class="selectall"><label class="accesshide" for="selectall">' . get_string('selectall') . '</label>
402
            $headers[] = $visibleheader . $bulkactionsselection .
386
                    <input type="checkbox" id="selectall" name="selectall" title="' . get_string('selectall') . '"/></div>';
403
                html_writer::div($selectalllabel . $selectallcheckbox, 'selectall');
Línea 387... Línea -...
387
        }
-
 
388
 
404
        }
389
        // User picture.
405
 
390
        if ($this->hasviewblind || !$this->assignment->is_blind_marking()) {
-
 
391
            if (!$this->is_downloading()) {
-
 
392
                $columns[] = 'picture';
-
 
393
                $headers[] = get_string('pictureofuser');
406
        if ($this->hasviewblind || !$this->assignment->is_blind_marking()) {
394
            } else {
407
            if ($this->is_downloading()) {
395
                $columns[] = 'recordid';
408
                $columns[] = 'recordid';
Línea 396... Línea 409...
396
                $headers[] = get_string('recordid', 'assign');
409
                $headers[] = get_string('recordid', 'assign');
397
            }
410
            }
398
 
411
 
399
            // Fullname.
-
 
400
            $columns[] = 'fullname';
412
            // Fullname.
401
            $headers[] = get_string('fullname');
413
            $columns[] = 'fullname';
402
 
414
            $headers[] = get_string('fullname');
403
            // Participant # details if can view real identities.
415
            // Participant # details if can view real identities.
404
            if ($this->assignment->is_blind_marking()) {
416
            if ($this->assignment->is_blind_marking()) {
Línea 470... Línea 482...
470
            }
482
            }
471
            // Add a column to show if this grade can be changed.
483
            // Add a column to show if this grade can be changed.
472
            $columns[] = 'gradecanbechanged';
484
            $columns[] = 'gradecanbechanged';
473
            $headers[] = get_string('gradecanbechanged', 'assign');
485
            $headers[] = get_string('gradecanbechanged', 'assign');
474
        }
486
        }
475
        if (!$this->is_downloading() && $this->hasgrade) {
-
 
476
            // We have to call this column userid so we can use userid as a default sortable column.
-
 
477
            $columns[] = 'userid';
-
 
478
            $headers[] = get_string('edit');
-
 
479
        }
-
 
Línea 480... Línea 487...
480
 
487
 
481
        // Submission plugins.
488
        // Submission plugins.
482
        if ($assignment->is_any_submission_plugin_enabled()) {
489
        if ($assignment->is_any_submission_plugin_enabled()) {
483
            $columns[] = 'timesubmitted';
490
            $columns[] = 'timesubmitted';
Línea 547... Línea 554...
547
        }
554
        }
Línea 548... Línea 555...
548
 
555
 
549
        // Set the columns.
556
        // Set the columns.
550
        $this->define_columns($columns);
557
        $this->define_columns($columns);
-
 
558
        $this->define_headers($headers);
-
 
559
        $this->column_class('fullname', 'username');
-
 
560
        $this->column_class('status', 'status');
551
        $this->define_headers($headers);
561
        $this->column_class('grade', 'grade');
552
        foreach ($extrauserfields as $extrafield) {
562
        foreach ($extrauserfields as $extrafield) {
553
             $this->column_class($extrafield, $extrafield);
563
             $this->column_class($extrafield, $extrafield);
554
        }
564
        }
555
        $this->no_sorting('recordid');
565
        $this->no_sorting('recordid');
Línea 761... Línea 771...
761
     *
771
     *
762
     * @param string $grade
772
     * @param string $grade
763
     * @param boolean $editable
773
     * @param boolean $editable
764
     * @param int $userid The user id of the user this grade belongs to
774
     * @param int $userid The user id of the user this grade belongs to
765
     * @param int $modified Timestamp showing when the grade was last modified
775
     * @param int $modified Timestamp showing when the grade was last modified
-
 
776
     * @param float $deductedmark The deducted mark if penalty is applied
766
     * @return string The formatted grade
777
     * @return string The formatted grade
767
     */
778
     */
768
    public function display_grade($grade, $editable, $userid, $modified) {
779
    public function display_grade($grade, $editable, $userid, $modified, float $deductedmark = 0) {
769
        if ($this->is_downloading()) {
780
        if ($this->is_downloading()) {
770
            if ($this->assignment->get_instance()->grade >= 0) {
781
            if ($this->assignment->get_instance()->grade >= 0) {
771
                if ($grade == -1 || $grade === null) {
782
                if ($grade == -1 || $grade === null) {
772
                    return '';
783
                    return '';
773
                }
784
                }
Línea 780... Línea 791...
780
                    $scale = '';
791
                    $scale = '';
781
                }
792
                }
782
                return $scale;
793
                return $scale;
783
            }
794
            }
784
        }
795
        }
785
        return $this->assignment->display_grade($grade, $editable, $userid, $modified);
796
        return $this->assignment->display_grade($grade, $editable, $userid, $modified, $deductedmark);
786
    }
797
    }
Línea 787... Línea 798...
787
 
798
 
788
    /**
799
    /**
789
     * Get the team info for this user.
800
     * Get the team info for this user.
Línea 880... Línea 891...
880
    /**
891
    /**
881
     * Format a user picture for display.
892
     * Format a user picture for display.
882
     *
893
     *
883
     * @param stdClass $row
894
     * @param stdClass $row
884
     * @return string
895
     * @return string
-
 
896
     * @deprecated since Moodle 4.5
-
 
897
     * @todo Final deprecation in Moodle 6.0. See MDL-82336.
885
     */
898
     */
-
 
899
    #[\core\attribute\deprecated(
-
 
900
        replacement: null,
-
 
901
        since: '4.5',
-
 
902
        reason: 'Picture column is merged with fullname column'
-
 
903
    )]
886
    public function col_picture(stdClass $row) {
904
    public function col_picture(stdClass $row) {
-
 
905
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
887
        return $this->output->user_picture($row);
906
        return $this->output->user_picture($row);
888
    }
907
    }
Línea 889... Línea 908...
889
 
908
 
890
    /**
909
    /**
Línea 894... Línea 913...
894
     * @return string
913
     * @return string
895
     */
914
     */
896
    public function col_fullname($row) {
915
    public function col_fullname($row) {
897
        if (!$this->is_downloading()) {
916
        if (!$this->is_downloading()) {
898
            $courseid = $this->assignment->get_course()->id;
917
            $courseid = $this->assignment->get_course()->id;
899
            $link = new moodle_url('/user/view.php', array('id' => $row->id, 'course' => $courseid));
918
            $fullname = $this->output->render(\core_user::get_profile_picture($row, null,
900
            $fullname = $this->output->action_link($link, $this->assignment->fullname($row));
919
                ['courseid' => $courseid, 'includefullname' => true]));
901
        } else {
920
        } else {
902
            $fullname = $this->assignment->fullname($row);
921
            $fullname = $this->assignment->fullname($row);
903
        }
922
        }
Línea 904... Línea 923...
904
 
923
 
Línea 919... Línea 938...
919
    public function col_select(stdClass $row) {
938
    public function col_select(stdClass $row) {
920
        $selectcol = '<label class="accesshide" for="selectuser_' . $row->userid . '">';
939
        $selectcol = '<label class="accesshide" for="selectuser_' . $row->userid . '">';
921
        $selectcol .= get_string('selectuser', 'assign', $this->assignment->fullname($row));
940
        $selectcol .= get_string('selectuser', 'assign', $this->assignment->fullname($row));
922
        $selectcol .= '</label>';
941
        $selectcol .= '</label>';
923
        $selectcol .= '<input type="checkbox"
942
        $selectcol .= '<input type="checkbox"
-
 
943
                              class="ignoredirty"
924
                              id="selectuser_' . $row->userid . '"
944
                              id="selectuser_' . $row->userid . '"
925
                              name="selectedusers"
945
                              name="selectedusers"
926
                              value="' . $row->userid . '"/>';
946
                              value="' . $row->userid . '"/>';
927
        $selectcol .= '<input type="hidden"
947
        $selectcol .= '<input type="hidden"
928
                              name="grademodified_' . $row->userid . '"
948
                              name="grademodified_' . $row->userid . '"
Línea 980... Línea 1000...
980
     * Format a column of data for display.
1000
     * Format a column of data for display.
981
     *
1001
     *
982
     * @param stdClass $row
1002
     * @param stdClass $row
983
     * @return string
1003
     * @return string
984
     */
1004
     */
985
    public function col_grade(stdClass $row) {
1005
    public function col_grade(stdClass $row): string {
986
        $o = '';
-
 
987
 
-
 
988
        $link = '';
-
 
989
        $separator = $this->output->spacer(array(), true);
-
 
990
        $grade = '';
-
 
991
        $gradingdisabled = $this->assignment->grading_disabled($row->id, true, $this->gradinginfo);
1006
        $gradingdisabled = $this->assignment->grading_disabled($row->id, true, $this->gradinginfo);
-
 
1007
        $displaygrade = $this->display_grade($row->grade, $this->quickgrading && !$gradingdisabled, $row->userid, $row->timemarked);
Línea 992... Línea 1008...
992
 
1008
 
-
 
1009
        if (!$this->is_downloading() && $this->hasgrade) {
993
        if (!$this->is_downloading() && $this->hasgrade) {
1010
            $urlparams = [
994
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1011
                'id' => $this->assignment->get_course_module()->id,
995
                               'rownum' => 0,
1012
                'rownum' => 0,
-
 
1013
                'action' => 'grader',
Línea 996... Línea 1014...
996
                               'action' => 'grader');
1014
            ];
997
 
1015
 
998
            if ($this->assignment->is_blind_marking()) {
1016
            if ($this->assignment->is_blind_marking()) {
999
                if (empty($row->recordid)) {
1017
                if (empty($row->recordid)) {
1000
                    $row->recordid = $this->assignment->get_uniqueid_for_user($row->userid);
1018
                    $row->recordid = $this->assignment->get_uniqueid_for_user($row->userid);
1001
                }
1019
                }
1002
                $urlparams['blindid'] = $row->recordid;
1020
                $urlparams['blindid'] = $row->recordid;
1003
            } else {
1021
            } else {
1004
                $urlparams['userid'] = $row->userid;
-
 
1005
            }
1022
                $urlparams['userid'] = $row->userid;
1006
 
-
 
1007
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
-
 
1008
            $link = '<a href="' . $url . '" class="btn btn-primary">' . get_string('gradeverb') . '</a>';
-
 
Línea 1009... Línea 1023...
1009
            $grade .= $link . $separator;
1023
            }
1010
        }
1024
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
1011
 
-
 
1012
        $grade .= $this->display_grade($row->grade,
-
 
Línea -... Línea 1025...
-
 
1025
 
-
 
1026
            // The container with the grade information.
-
 
1027
            $gradecontainer = $this->output->container($displaygrade, 'w-100');
-
 
1028
 
-
 
1029
            $menu = new action_menu();
-
 
1030
            $menu->set_owner_selector('.gradingtable-actionmenu');
-
 
1031
            $menu->set_boundary('window');
-
 
1032
            $menu->set_kebab_trigger(get_string('gradeactions', 'assign'));
-
 
1033
            $menu->set_additional_classes('ps-2 ms-auto');
-
 
1034
            // Prioritise the menu ahead of all other actions.
-
 
1035
            $menu->prioritise = true;
-
 
1036
            // Add the 'Grade' action item to the contextual menu.
-
 
1037
            $menu->add(new action_menu_link_secondary($url, null, get_string('gradeverb')));
-
 
1038
            // The contextual menu container.
-
 
1039
            $contextualmenucontainer = $this->output->container($this->output->render($menu), 'd-flex');
-
 
1040
 
1013
                                       $this->quickgrading && !$gradingdisabled,
1041
            return $this->output->container($gradecontainer . $contextualmenucontainer, ['class' => 'd-flex']);
1014
                                       $row->userid,
1042
        }
Línea 1015... Línea 1043...
1015
                                       $row->timemarked);
1043
        // The table data is being downloaded, or the user cannot grade; therefore, only the formatted grade for display
1016
 
1044
        // is returned.
1017
        return $grade;
1045
        return $displaygrade;
Línea 1026... Línea 1054...
1026
    public function col_finalgrade(stdClass $row) {
1054
    public function col_finalgrade(stdClass $row) {
1027
        $o = '';
1055
        $o = '';
Línea 1028... Línea 1056...
1028
 
1056
 
1029
        $grade = $this->get_gradebook_data_for_user($row->userid);
1057
        $grade = $this->get_gradebook_data_for_user($row->userid);
1030
        if ($grade) {
1058
        if ($grade) {
1031
            $o = $this->display_grade($grade->grade, false, $row->userid, $row->timemarked);
1059
            $o = $this->display_grade($grade->grade, false, $row->userid, $row->timemarked, $grade->deductedmark);
Línea 1032... Línea 1060...
1032
        }
1060
        }
1033
 
1061
 
Línea 1080... Línea 1108...
1080
     *
1108
     *
1081
     * @param stdClass $row
1109
     * @param stdClass $row
1082
     * @return string
1110
     * @return string
1083
     */
1111
     */
1084
    public function col_status(stdClass $row) {
1112
    public function col_status(stdClass $row) {
-
 
1113
        global $USER;
-
 
1114
 
1085
        $o = '';
1115
        $o = '';
Línea 1086... Línea 1116...
1086
 
1116
 
1087
        $instance = $this->assignment->get_instance($row->userid);
1117
        $instance = $this->assignment->get_instance($row->userid);
Línea 1117... Línea 1147...
1117
        $displaystatus = $status;
1147
        $displaystatus = $status;
1118
        if ($displaystatus == 'new') {
1148
        if ($displaystatus == 'new') {
1119
            $displaystatus = '';
1149
            $displaystatus = '';
1120
        }
1150
        }
Línea -... Línea 1151...
-
 
1151
 
-
 
1152
        // Generate the output for the submission contextual (action) menu.
-
 
1153
        $actionmenu = '';
-
 
1154
        if (!$this->is_downloading() && $this->hasgrade) {
-
 
1155
 
-
 
1156
            $submissionsopen = $this->assignment->submissions_open(
-
 
1157
                userid: $row->id,
-
 
1158
                skipenrolled: true,
-
 
1159
                submission: $submission ? $submission : $row,
-
 
1160
                flags: $row,
-
 
1161
                gradinginfo: $this->gradinginfo
-
 
1162
            );
-
 
1163
            $caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);
-
 
1164
 
-
 
1165
            $baseactionurl = new moodle_url('/mod/assign/view.php', [
-
 
1166
                'id' => $this->assignment->get_course_module()->id,
-
 
1167
                'userid' => $row->id,
-
 
1168
                'sesskey' => sesskey(),
-
 
1169
                'page' => $this->currpage,
-
 
1170
            ]);
-
 
1171
 
-
 
1172
            $menu = new action_menu();
-
 
1173
            $menu->set_owner_selector('.gradingtable-actionmenu');
-
 
1174
            $menu->set_boundary('window');
-
 
1175
            $menu->set_kebab_trigger(get_string('submissionactions', 'assign'));
-
 
1176
            $menu->set_additional_classes('ps-2 ms-auto');
-
 
1177
            // Prioritise the menu ahead of all other actions.
-
 
1178
            $menu->prioritise = true;
-
 
1179
 
-
 
1180
            // Hide for offline assignments.
-
 
1181
            if ($this->assignment->is_any_submission_plugin_enabled()) {
-
 
1182
 
-
 
1183
                if ($submissionsopen && $USER->id != $row->id && $caneditsubmission) {
-
 
1184
                    // Edit submission action link.
-
 
1185
                    $baseactionurl->param('action', 'editsubmission');
-
 
1186
                    $description = get_string('editsubmission', 'assign');
-
 
1187
                    $menu->add(new action_menu_link_secondary($baseactionurl, null, $description));
-
 
1188
                }
-
 
1189
 
-
 
1190
                if (!$row->status || $row->status == ASSIGN_SUBMISSION_STATUS_DRAFT
-
 
1191
                        || !$this->assignment->get_instance()->submissiondrafts) {
-
 
1192
                    // Allow/prevent submission changes action link.
-
 
1193
                    $baseactionurl->param('action', $row->locked ? 'unlock' : 'lock');
-
 
1194
                    $description = $row->locked ? get_string('allowsubmissionsshort', 'assign') :
-
 
1195
                        get_string('preventsubmissionsshort', 'assign');
-
 
1196
                    $menu->add(new action_menu_link_secondary($baseactionurl, null, $description));
-
 
1197
                }
-
 
1198
            }
-
 
1199
 
-
 
1200
            if (($this->assignment->get_instance()->duedate || $this->assignment->get_instance()->cutoffdate) &&
-
 
1201
                    $this->hasgrantextension) {
-
 
1202
                // Grant extension action link.
-
 
1203
                $baseactionurl->param('action', 'grantextension');
-
 
1204
                $description = get_string('grantextension', 'assign');
-
 
1205
                $menu->add(new action_menu_link_secondary($baseactionurl, null, $description));
-
 
1206
            }
-
 
1207
 
-
 
1208
            if ($row->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED &&
-
 
1209
                    $this->assignment->get_instance()->submissiondrafts) {
-
 
1210
                // Revert submission to draft action link.
-
 
1211
                $baseactionurl->param('action', 'reverttodraft');
-
 
1212
                $description = get_string('reverttodraftshort', 'assign');
-
 
1213
                $menu->add(new action_menu_link_secondary($baseactionurl, null, $description));
-
 
1214
            }
-
 
1215
 
-
 
1216
            if ($row->status == ASSIGN_SUBMISSION_STATUS_DRAFT && $this->assignment->get_instance()->submissiondrafts &&
-
 
1217
                    $caneditsubmission && $submissionsopen && $row->id != $USER->id) {
-
 
1218
                // Submit for grading action link.
-
 
1219
                $baseactionurl->param('action', 'submitotherforgrading');
-
 
1220
                $description = get_string('submitforgrading', 'assign');
-
 
1221
                $menu->add(new action_menu_link_secondary($baseactionurl, null, $description));
-
 
1222
            }
-
 
1223
 
-
 
1224
            $ismanual = $this->assignment->get_instance()->attemptreopenmethod == ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL;
-
 
1225
            $hassubmission = !empty($row->status);
-
 
1226
            $notreopened = $hassubmission && $row->status != ASSIGN_SUBMISSION_STATUS_REOPENED;
-
 
1227
            $isunlimited = $this->assignment->get_instance()->maxattempts == ASSIGN_UNLIMITED_ATTEMPTS;
-
 
1228
            $hasattempts = $isunlimited || $row->attemptnumber < $this->assignment->get_instance()->maxattempts - 1;
-
 
1229
 
-
 
1230
            if ($ismanual && $hassubmission && $notreopened && $hasattempts) {
-
 
1231
                // Allow another attempt action link.
-
 
1232
                $baseactionurl->param('action', 'addattempt');
-
 
1233
                $description = get_string('addattempt', 'assign');
-
 
1234
                $menu->add(new action_menu_link_secondary($baseactionurl, null, $description));
-
 
1235
            }
-
 
1236
 
-
 
1237
            if ($this->assignment->is_any_submission_plugin_enabled()) {
-
 
1238
                if ($USER->id != $row->id && $caneditsubmission && !empty($row->status)) {
-
 
1239
                    // Remove submission action link. This action link should be always placed as the last item
-
 
1240
                    // within the contextual menu.
-
 
1241
                    $baseactionurl->param('action', 'removesubmissionconfirm');
-
 
1242
                    $description = get_string('removesubmission', 'assign');
-
 
1243
                    $menu->add(new action_menu_link_secondary($baseactionurl, null, $description,
-
 
1244
                        ['class' => 'text-danger']));
-
 
1245
                }
-
 
1246
            }
-
 
1247
 
-
 
1248
            $actionmenu = $this->output->render($menu);
-
 
1249
        }
-
 
1250
 
-
 
1251
        $actionmenucontainer = $this->output->container($actionmenu, 'd-flex');
-
 
1252
 
-
 
1253
        // Generate the output for the submission information.
1121
 
1254
        $submissioninfo = '';
Línea 1122... Línea 1255...
1122
        if ($this->assignment->is_any_submission_plugin_enabled()) {
1255
        if ($this->assignment->is_any_submission_plugin_enabled()) {
1123
 
1256
 
-
 
1257
            $submissioninfo .= $this->output->container(get_string('submissionstatus_' . $displaystatus, 'assign'),
1124
            $o .= $this->output->container(get_string('submissionstatus_' . $displaystatus, 'assign'),
1258
                ['class' => 'submissionstatus' . $displaystatus]);
1125
                                           array('class' => 'submissionstatus' .$displaystatus));
1259
 
1126
            if ($due && $timesubmitted > $due && $status != ASSIGN_SUBMISSION_STATUS_NEW) {
1260
            if ($due && $timesubmitted > $due && $status != ASSIGN_SUBMISSION_STATUS_NEW) {
1127
                $usertime = format_time($timesubmitted - $due);
1261
                $usertime = format_time($timesubmitted - $due);
1128
                $latemessage = get_string('submittedlateshort',
1262
                $latemessage = get_string('submittedlateshort',
1129
                                          'assign',
1263
                                          'assign',
1130
                                          $usertime);
1264
                                          $usertime);
1131
                $o .= $this->output->container($latemessage, 'latesubmission');
1265
                $submissioninfo .= $this->output->container($latemessage, 'latesubmission');
1132
            } else if ($timelimitenabled && $instance->timelimit && !empty($submission->timestarted)
1266
            } else if ($timelimitenabled && $instance->timelimit && !empty($submission->timestarted)
1133
                && ($timesubmitted - $submission->timestarted > $instance->timelimit)
1267
                && ($timesubmitted - $submission->timestarted > $instance->timelimit)
1134
                && $status != ASSIGN_SUBMISSION_STATUS_NEW) {
1268
                && $status != ASSIGN_SUBMISSION_STATUS_NEW) {
1135
                $usertime = format_time($timesubmitted - $submission->timestarted - $instance->timelimit);
-
 
1136
                $latemessage = get_string('submittedlateshort',
-
 
1137
                    'assign',
1269
                $usertime = format_time($timesubmitted - $submission->timestarted - $instance->timelimit);
1138
                    $usertime);
1270
                $latemessage = get_string('submittedlateshort', 'assign', $usertime);
1139
                $o .= $this->output->container($latemessage, 'latesubmission');
1271
                $submissioninfo .= $this->output->container($latemessage, 'latesubmission');
1140
            }
1272
            }
1141
            if ($row->locked) {
1273
            if ($row->locked) {
1142
                $lockedstr = get_string('submissionslockedshort', 'assign');
1274
                $lockedstr = get_string('submissionslockedshort', 'assign');
Línea 1143... Línea 1275...
1143
                $o .= $this->output->container($lockedstr, 'lockedsubmission');
1275
                $submissioninfo .= $this->output->container($lockedstr, 'lockedsubmission');
1144
            }
1276
            }
1145
 
1277
 
1146
            // Add status of "grading" if markflow is not enabled.
1278
            // Add status of "grading" if markflow is not enabled.
1147
            if (!$instance->markingworkflow) {
1279
            if (!$instance->markingworkflow) {
1148
                if ($row->grade !== null && $row->grade >= 0) {
1280
                if ($row->grade !== null && $row->grade >= 0) {
1149
                    if ($row->timemarked < $row->timesubmitted) {
1281
                    if ($row->timemarked < $row->timesubmitted) {
1150
                        $o .= $this->output->container(get_string('gradedfollowupsubmit', 'assign'), 'gradingreminder');
1282
                        $submissioninfo .= $this->output->container(get_string('gradedfollowupsubmit', 'assign'), 'gradingreminder');
1151
                    } else {
1283
                    } else {
1152
                        $o .= $this->output->container(get_string('graded', 'assign'), 'submissiongraded');
1284
                        $submissioninfo .= $this->output->container(get_string('graded', 'assign'), 'submissiongraded');
1153
                    }
1285
                    }
1154
                } else if (!$timesubmitted || $status == ASSIGN_SUBMISSION_STATUS_NEW) {
1286
                } else if (!$timesubmitted || $status == ASSIGN_SUBMISSION_STATUS_NEW) {
1155
                    $now = time();
1287
                    $now = time();
1156
                    if ($due && ($now > $due)) {
1288
                    if ($due && ($now > $due)) {
1157
                        $overduestr = get_string('overdue', 'assign', format_time($now - $due));
1289
                        $overduestr = get_string('overdue', 'assign', format_time($now - $due));
1158
                        $o .= $this->output->container($overduestr, 'overduesubmission');
1290
                        $submissioninfo .= $this->output->container($overduestr, 'overduesubmission');
1159
                    }
1291
                    }
Línea 1160... Línea 1292...
1160
                }
1292
                }
1161
            }
1293
            }
1162
        }
1294
        }
1163
 
1295
 
1164
        if ($instance->markingworkflow) {
1296
        if ($instance->markingworkflow) {
1165
            $o .= $this->col_workflowstatus($row);
1297
            $submissioninfo .= $this->col_workflowstatus($row);
1166
        }
1298
        }
1167
        if ($row->extensionduedate) {
1299
        if ($row->extensionduedate) {
-
 
1300
            $userdate = userdate($row->extensionduedate);
-
 
1301
            $extensionstr = get_string('userextensiondate', 'assign', $userdate);
-
 
1302
            $submissioninfo .= $this->output->container($extensionstr, 'extensiondate');
-
 
1303
        }
Línea 1168... Línea 1304...
1168
            $userdate = userdate($row->extensionduedate);
1304
        // The container with the submission information.
1169
            $extensionstr = get_string('userextensiondate', 'assign', $userdate);
1305
        $submissoninfocontainer = $this->output->container($submissioninfo, 'submissioninfo w-100');
1170
            $o .= $this->output->container($extensionstr, 'extensiondate');
1306
 
Línea 1231... Línea 1367...
1231
    /**
1367
    /**
1232
     * Format a column of data for display.
1368
     * Format a column of data for display.
1233
     *
1369
     *
1234
     * @param stdClass $row
1370
     * @param stdClass $row
1235
     * @return string
1371
     * @return string
-
 
1372
     * @deprecated since Moodle 4.5
-
 
1373
     * @todo Final deprecation in Moodle 6.0. See MDL-82336.
1236
     */
1374
     */
-
 
1375
    #[\core\attribute\deprecated(
-
 
1376
        replacement: null,
-
 
1377
        since: '4.5',
-
 
1378
        reason: 'Userid column is merged with status and grade columns'
-
 
1379
    )]
1237
    public function col_userid(stdClass $row) {
1380
    public function col_userid(stdClass $row) {
1238
        global $USER;
1381
        global $USER;
Línea -... Línea 1382...
-
 
1382
 
1239
 
1383
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
Línea 1240... Línea 1384...
1240
        $edit = '';
1384
        $edit = '';
Línea 1241... Línea 1385...
1241
 
1385
 
Línea 1276... Línea 1420...
1276
            $group = false;
1420
            $group = false;
1277
            $this->get_group_and_submission($row->id, $group, $submission, -1);
1421
            $this->get_group_and_submission($row->id, $group, $submission, -1);
1278
        }
1422
        }
Línea 1279... Línea 1423...
1279
 
1423
 
1280
        $submissionsopen = $this->assignment->submissions_open($row->id,
1424
        $submissionsopen = $this->assignment->submissions_open($row->id,
1281
                                                               true,
1425
            true,
1282
                                                               $submission,
1426
            $submission,
1283
                                                               $flags,
1427
            $flags,
1284
                                                               $this->gradinginfo);
1428
            $this->gradinginfo);
Línea 1285... Línea 1429...
1285
        $caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);
1429
        $caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);
1286
 
1430
 
1287
        // Hide for offline assignments.
1431
        // Hide for offline assignments.
1288
        if ($this->assignment->is_any_submission_plugin_enabled()) {
1432
        if ($this->assignment->is_any_submission_plugin_enabled()) {
1289
            if (!$row->status ||
1433
            if (!$row->status ||
Línea 1290... Línea 1434...
1290
                    $row->status == ASSIGN_SUBMISSION_STATUS_DRAFT ||
1434
                $row->status == ASSIGN_SUBMISSION_STATUS_DRAFT ||
1291
                    !$this->assignment->get_instance()->submissiondrafts) {
1435
                !$this->assignment->get_instance()->submissiondrafts) {
1292
 
1436
 
1293
                if (!$row->locked) {
1437
                if (!$row->locked) {
1294
                    $urlparams = array('id' => $this->assignment->get_course_module()->id,
1438
                    $urlparams = array('id' => $this->assignment->get_course_module()->id,
1295
                                       'userid' => $row->id,
1439
                        'userid' => $row->id,
1296
                                       'action' => 'lock',
1440
                        'action' => 'lock',
Línea 1297... Línea 1441...
1297
                                       'sesskey' => sesskey(),
1441
                        'sesskey' => sesskey(),
1298
                                       'page' => $this->currpage);
1442
                        'page' => $this->currpage);
1299
                    $url = new moodle_url('/mod/assign/view.php', $urlparams);
1443
                    $url = new moodle_url('/mod/assign/view.php', $urlparams);
1300
 
1444
 
1301
                    $description = get_string('preventsubmissionsshort', 'assign');
1445
                    $description = get_string('preventsubmissionsshort', 'assign');
1302
                    $actions['lock'] = new action_menu_link_secondary(
1446
                    $actions['lock'] = new action_menu_link_secondary(
1303
                        $url,
1447
                        $url,
1304
                        $noimage,
1448
                        $noimage,
1305
                        $description
1449
                        $description
1306
                    );
1450
                    );
1307
                } else {
1451
                } else {
1308
                    $urlparams = array('id' => $this->assignment->get_course_module()->id,
1452
                    $urlparams = array('id' => $this->assignment->get_course_module()->id,
1309
                                       'userid' => $row->id,
1453
                        'userid' => $row->id,
1310
                                       'action' => 'unlock',
1454
                        'action' => 'unlock',
1311
                                       'sesskey' => sesskey(),
1455
                        'sesskey' => sesskey(),
1312
                                       'page' => $this->currpage);
1456
                        'page' => $this->currpage);
1313
                    $url = new moodle_url('/mod/assign/view.php', $urlparams);
1457
                    $url = new moodle_url('/mod/assign/view.php', $urlparams);
Línea 1319... Línea 1463...
1319
                    );
1463
                    );
1320
                }
1464
                }
1321
            }
1465
            }
Línea 1322... Línea 1466...
1322
 
1466
 
1323
            if ($submissionsopen &&
1467
            if ($submissionsopen &&
1324
                    $USER->id != $row->id &&
1468
                $USER->id != $row->id &&
1325
                    $caneditsubmission) {
1469
                $caneditsubmission) {
1326
                $urlparams = array('id' => $this->assignment->get_course_module()->id,
1470
                $urlparams = array('id' => $this->assignment->get_course_module()->id,
1327
                                   'userid' => $row->id,
1471
                    'userid' => $row->id,
1328
                                   'action' => 'editsubmission',
1472
                    'action' => 'editsubmission',
1329
                                   'sesskey' => sesskey(),
1473
                    'sesskey' => sesskey(),
1330
                                   'page' => $this->currpage);
1474
                    'page' => $this->currpage);
1331
                $url = new moodle_url('/mod/assign/view.php', $urlparams);
1475
                $url = new moodle_url('/mod/assign/view.php', $urlparams);
1332
                $description = get_string('editsubmission', 'assign');
1476
                $description = get_string('editsubmission', 'assign');
1333
                $actions['editsubmission'] = new action_menu_link_secondary(
1477
                $actions['editsubmission'] = new action_menu_link_secondary(
1334
                    $url,
1478
                    $url,
1335
                    $noimage,
1479
                    $noimage,
1336
                    $description
1480
                    $description
1337
                );
1481
                );
1338
            }
1482
            }
1339
            if ($USER->id != $row->id &&
1483
            if ($USER->id != $row->id &&
1340
                    $caneditsubmission &&
1484
                $caneditsubmission &&
1341
                    !empty($row->status)) {
1485
                !empty($row->status)) {
1342
                $urlparams = array('id' => $this->assignment->get_course_module()->id,
1486
                $urlparams = array('id' => $this->assignment->get_course_module()->id,
1343
                                   'userid' => $row->id,
1487
                    'userid' => $row->id,
1344
                                   'action' => 'removesubmissionconfirm',
1488
                    'action' => 'removesubmissionconfirm',
1345
                                   'sesskey' => sesskey(),
1489
                    'sesskey' => sesskey(),
1346
                                   'page' => $this->currpage);
1490
                    'page' => $this->currpage);
1347
                $url = new moodle_url('/mod/assign/view.php', $urlparams);
1491
                $url = new moodle_url('/mod/assign/view.php', $urlparams);
1348
                $description = get_string('removesubmission', 'assign');
1492
                $description = get_string('removesubmission', 'assign');
1349
                $actions['removesubmission'] = new action_menu_link_secondary(
1493
                $actions['removesubmission'] = new action_menu_link_secondary(
1350
                    $url,
1494
                    $url,
Línea 1353... Línea 1497...
1353
                );
1497
                );
1354
            }
1498
            }
1355
        }
1499
        }
1356
        if (($this->assignment->get_instance()->duedate ||
1500
        if (($this->assignment->get_instance()->duedate ||
1357
                $this->assignment->get_instance()->cutoffdate) &&
1501
                $this->assignment->get_instance()->cutoffdate) &&
1358
                $this->hasgrantextension) {
1502
            $this->hasgrantextension) {
1359
             $urlparams = array('id' => $this->assignment->get_course_module()->id,
1503
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1360
                                'userid' => $row->id,
1504
                'userid' => $row->id,
1361
                                'action' => 'grantextension',
1505
                'action' => 'grantextension',
1362
                                'sesskey' => sesskey(),
1506
                'sesskey' => sesskey(),
1363
                                'page' => $this->currpage);
1507
                'page' => $this->currpage);
1364
             $url = new moodle_url('/mod/assign/view.php', $urlparams);
1508
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
1365
             $description = get_string('grantextension', 'assign');
1509
            $description = get_string('grantextension', 'assign');
1366
             $actions['grantextension'] = new action_menu_link_secondary(
1510
            $actions['grantextension'] = new action_menu_link_secondary(
1367
                 $url,
1511
                $url,
1368
                 $noimage,
1512
                $noimage,
1369
                 $description
1513
                $description
1370
             );
1514
            );
1371
        }
1515
        }
1372
        if ($row->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED &&
1516
        if ($row->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED &&
1373
                $this->assignment->get_instance()->submissiondrafts) {
1517
            $this->assignment->get_instance()->submissiondrafts) {
1374
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1518
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1375
                               'userid' => $row->id,
1519
                'userid' => $row->id,
1376
                               'action' => 'reverttodraft',
1520
                'action' => 'reverttodraft',
1377
                               'sesskey' => sesskey(),
1521
                'sesskey' => sesskey(),
1378
                               'page' => $this->currpage);
1522
                'page' => $this->currpage);
1379
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
1523
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
1380
            $description = get_string('reverttodraftshort', 'assign');
1524
            $description = get_string('reverttodraftshort', 'assign');
1381
            $actions['reverttodraft'] = new action_menu_link_secondary(
1525
            $actions['reverttodraft'] = new action_menu_link_secondary(
1382
                $url,
1526
                $url,
1383
                $noimage,
1527
                $noimage,
1384
                $description
1528
                $description
1385
            );
1529
            );
1386
        }
1530
        }
1387
        if ($row->status == ASSIGN_SUBMISSION_STATUS_DRAFT &&
1531
        if ($row->status == ASSIGN_SUBMISSION_STATUS_DRAFT &&
1388
                $this->assignment->get_instance()->submissiondrafts &&
1532
            $this->assignment->get_instance()->submissiondrafts &&
1389
                $caneditsubmission &&
1533
            $caneditsubmission &&
1390
                $submissionsopen &&
1534
            $submissionsopen &&
1391
                $row->id != $USER->id) {
1535
            $row->id != $USER->id) {
1392
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1536
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1393
                               'userid' => $row->id,
1537
                'userid' => $row->id,
1394
                               'action' => 'submitotherforgrading',
1538
                'action' => 'submitotherforgrading',
1395
                               'sesskey' => sesskey(),
1539
                'sesskey' => sesskey(),
1396
                               'page' => $this->currpage);
1540
                'page' => $this->currpage);
1397
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
1541
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
1398
            $description = get_string('submitforgrading', 'assign');
1542
            $description = get_string('submitforgrading', 'assign');
1399
            $actions['submitforgrading'] = new action_menu_link_secondary(
1543
            $actions['submitforgrading'] = new action_menu_link_secondary(
1400
                $url,
1544
                $url,
1401
                $noimage,
1545
                $noimage,
Línea 1409... Línea 1553...
1409
        $isunlimited = $this->assignment->get_instance()->maxattempts == ASSIGN_UNLIMITED_ATTEMPTS;
1553
        $isunlimited = $this->assignment->get_instance()->maxattempts == ASSIGN_UNLIMITED_ATTEMPTS;
1410
        $hasattempts = $isunlimited || $row->attemptnumber < $this->assignment->get_instance()->maxattempts - 1;
1554
        $hasattempts = $isunlimited || $row->attemptnumber < $this->assignment->get_instance()->maxattempts - 1;
Línea 1411... Línea 1555...
1411
 
1555
 
1412
        if ($ismanual && $hassubmission && $notreopened && $hasattempts) {
1556
        if ($ismanual && $hassubmission && $notreopened && $hasattempts) {
1413
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1557
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1414
                               'userid' => $row->id,
1558
                'userid' => $row->id,
1415
                               'action' => 'addattempt',
1559
                'action' => 'addattempt',
1416
                               'sesskey' => sesskey(),
1560
                'sesskey' => sesskey(),
1417
                               'page' => $this->currpage);
1561
                'page' => $this->currpage);
1418
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
1562
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
1419
            $description = get_string('addattempt', 'assign');
1563
            $description = get_string('addattempt', 'assign');
1420
            $actions['addattempt'] = new action_menu_link_secondary(
1564
            $actions['addattempt'] = new action_menu_link_secondary(
1421
                $url,
1565
                $url,
Línea 1460... Línea 1604...
1460
 
1604
 
1461
        $summary = $plugin->view_summary($item, $showviewlink);
1605
        $summary = $plugin->view_summary($item, $showviewlink);
1462
        $separator = '';
1606
        $separator = '';
1463
        if ($showviewlink) {
1607
        if ($showviewlink) {
1464
            $viewstr = get_string('view' . substr($plugin->get_subtype(), strlen('assign')), 'assign');
1608
            $viewstr = get_string('view' . substr($plugin->get_subtype(), strlen('assign')), 'assign');
1465
            $icon = $this->output->pix_icon('t/preview', $viewstr);
1609
            $icon = $this->output->pix_icon('t/viewdetails', $viewstr);
1466
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1610
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
1467
                                                     'sid' => $item->id,
1611
                                                     'sid' => $item->id,
1468
                                                     'gid' => $item->id,
1612
                                                     'gid' => $item->id,
1469
                                                     'plugin' => $plugin->get_type(),
1613
                                                     'plugin' => $plugin->get_type(),
Línea 1690... Línea 1834...
1690
        if (!empty($this->setup)) {
1834
        if (!empty($this->setup)) {
1691
            return;
1835
            return;
1692
        }
1836
        }
1693
        parent::setup();
1837
        parent::setup();
1694
    }
1838
    }
-
 
1839
 
-
 
1840
    /**
-
 
1841
     * Returns the html for the paging bar.
-
 
1842
     *
-
 
1843
     * @return string
-
 
1844
     */
-
 
1845
    public function get_paging_bar(): string {
-
 
1846
        global $OUTPUT;
-
 
1847
 
-
 
1848
        if ($this->use_pages) {
-
 
1849
            $pagingbar = new paging_bar($this->totalrows, $this->currpage, $this->pagesize, $this->baseurl);
-
 
1850
            $pagingbar->pagevar = $this->request[TABLE_VAR_PAGE];
-
 
1851
            return $OUTPUT->render($pagingbar);
-
 
1852
        }
-
 
1853
 
-
 
1854
        return '';
-
 
1855
    }
-
 
1856
 
-
 
1857
    /**
-
 
1858
     * Returns the html for the paging selector.
-
 
1859
     *
-
 
1860
     * @return string
-
 
1861
     */
-
 
1862
    public function get_paging_selector(): string {
-
 
1863
        global $OUTPUT;
-
 
1864
 
-
 
1865
        if ($this->use_pages) {
-
 
1866
            $pagingoptions = [...$this->pagingoptions, $this->perpage]; // To make sure the actual page size is within the options.
-
 
1867
            $pagingoptions = array_unique($pagingoptions);
-
 
1868
            sort($pagingoptions);
-
 
1869
            $pagingoptions = array_combine($pagingoptions, $pagingoptions);
-
 
1870
            $maxperpage = get_config('assign', 'maxperpage');
-
 
1871
            if (isset($maxperpage) && $maxperpage != -1) {
-
 
1872
                // Remove any options that are greater than the maxperpage.
-
 
1873
                $pagingoptions = array_filter($pagingoptions, fn($value) => $value <= $maxperpage);
-
 
1874
            } else {
-
 
1875
                $pagingoptions[-1] = get_string('all');
-
 
1876
            }
-
 
1877
 
-
 
1878
            $data = [
-
 
1879
                'baseurl' => $this->baseurl->out(false),
-
 
1880
                'options' => array_map(fn($key, $name): array => [
-
 
1881
                    'name' => $name,
-
 
1882
                    'value' => $key,
-
 
1883
                    'selected' => $key == $this->perpage,
-
 
1884
                ], array_keys($pagingoptions), $pagingoptions),
-
 
1885
            ];
-
 
1886
 
-
 
1887
            return $OUTPUT->render_from_template('mod_assign/grading_paging_selector', $data);
-
 
1888
        }
-
 
1889
 
-
 
1890
        return '';
-
 
1891
    }
-
 
1892
 
-
 
1893
    /**
-
 
1894
     * Finish the HTML output.
-
 
1895
     * This function is essentially a copy of the parent function except the paging bar not being rendered.
-
 
1896
     *
-
 
1897
     * @return void
-
 
1898
     */
-
 
1899
    public function finish_html(): void {
-
 
1900
        if (!$this->started_output) {
-
 
1901
            // No data has been added to the table.
-
 
1902
            $this->print_nothing_to_display();
-
 
1903
        } else {
-
 
1904
            // Print empty rows to fill the table to the current pagesize.
-
 
1905
            // This is done so the header aria-controls attributes do not point to
-
 
1906
            // non-existent elements.
-
 
1907
            $emptyrow = array_fill(0, count($this->columns), '');
-
 
1908
            while ($this->currentrow < $this->pagesize) {
-
 
1909
                $this->print_row($emptyrow, 'emptyrow');
-
 
1910
            }
-
 
1911
 
-
 
1912
            echo html_writer::end_tag('tbody');
-
 
1913
            echo html_writer::end_tag('table');
-
 
1914
            if ($this->responsive) {
-
 
1915
                echo html_writer::end_tag('div');
-
 
1916
            }
-
 
1917
            $this->wrap_html_finish();
-
 
1918
 
-
 
1919
            if (in_array(TABLE_P_BOTTOM, $this->showdownloadbuttonsat)) {
-
 
1920
                echo $this->download_buttons();
-
 
1921
            }
-
 
1922
 
-
 
1923
            // Render the dynamic table footer.
-
 
1924
            echo $this->get_dynamic_table_html_end();
-
 
1925
        }
-
 
1926
    }
-
 
1927
 
-
 
1928
    /**
-
 
1929
     * Start the HTML output.
-
 
1930
     * This function is essentially a copy of the parent function except the paging bar not being rendered.
-
 
1931
     *
-
 
1932
     * @return void
-
 
1933
     */
-
 
1934
    public function start_html(): void {
-
 
1935
        // Render the dynamic table header.
-
 
1936
        echo $this->get_dynamic_table_html_start();
-
 
1937
 
-
 
1938
        // Render button to allow user to reset table preferences.
-
 
1939
        echo $this->render_reset_button();
-
 
1940
 
-
 
1941
        // Do we need to print initial bars?
-
 
1942
        $this->print_initials_bar();
-
 
1943
 
-
 
1944
        if (in_array(TABLE_P_TOP, $this->showdownloadbuttonsat)) {
-
 
1945
            echo $this->download_buttons();
-
 
1946
        }
-
 
1947
 
-
 
1948
        $this->wrap_html_start();
-
 
1949
        // Start of main data table.
-
 
1950
 
-
 
1951
        if ($this->responsive) {
-
 
1952
            echo html_writer::start_tag('div', ['class' => 'table-responsive']);
-
 
1953
        }
-
 
1954
        echo html_writer::start_tag('table', $this->attributes) . $this->render_caption();
-
 
1955
    }
1695
}
1956
}