Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 127... Línea 127...
127
        // At the very least, the user viewing this table will be able to use bulk actions to export it, so add 'select' column.
127
        // At the very least, the user viewing this table will be able to use bulk actions to export it, so add 'select' column.
128
        $mastercheckbox = new \core\output\checkbox_toggleall('participants-table', true, [
128
        $mastercheckbox = new \core\output\checkbox_toggleall('participants-table', true, [
129
            'id' => 'select-all-participants',
129
            'id' => 'select-all-participants',
130
            'name' => 'select-all-participants',
130
            'name' => 'select-all-participants',
131
            'label' => get_string('selectall'),
131
            'label' => get_string('selectall'),
132
            'labelclasses' => 'sr-only',
132
            'labelclasses' => 'visually-hidden',
133
            'classes' => 'm-1',
133
            'classes' => 'm-1',
134
            'checked' => false,
134
            'checked' => false,
135
        ]);
135
        ]);
136
        $headers[] = $OUTPUT->render($mastercheckbox);
136
        $headers[] = $OUTPUT->render($mastercheckbox);
137
        $columns[] = 'select';
137
        $columns[] = 'select';
Línea 402... Línea 402...
402
     *
402
     *
403
     * @param int $pagesize size of page for paginated displayed table.
403
     * @param int $pagesize size of page for paginated displayed table.
404
     * @param bool $useinitialsbar do you want to use the initials bar.
404
     * @param bool $useinitialsbar do you want to use the initials bar.
405
     */
405
     */
406
    public function query_db($pagesize, $useinitialsbar = true) {
406
    public function query_db($pagesize, $useinitialsbar = true) {
-
 
407
        global $DB;
-
 
408
 
407
        list($twhere, $tparams) = $this->get_sql_where();
409
        list($twhere, $tparams) = $this->get_sql_where();
408
        $psearch = new participants_search($this->course, $this->context, $this->filterset);
410
        $psearch = new participants_search($this->course, $this->context, $this->filterset);
Línea 409... Línea -...
409
 
-
 
410
        $total = $psearch->get_total_participants_count($twhere, $tparams);
-
 
411
 
-
 
412
        $this->pagesize($pagesize, $total);
-
 
413
 
411
 
414
        $sort = $this->get_sql_sort();
-
 
415
        if ($sort) {
-
 
416
            $sort = 'ORDER BY ' . $sort;
-
 
Línea -... Línea 412...
-
 
412
        $sort = $this->get_sql_sort();
417
        }
413
 
-
 
414
        $this->use_pages = true;
-
 
415
        $rawdata = $psearch->get_participants($twhere, $tparams, $sort, $this->get_page_start(), $this->get_page_size());
Línea 418... Línea 416...
418
 
416
        $total = $rawdata->current()->fullcount ?? 0;
419
        $rawdata = $psearch->get_participants($twhere, $tparams, $sort, $this->get_page_start(), $this->get_page_size());
417
        $this->pagesize($pagesize, $total);
420
 
418
 
421
        $this->rawdata = [];
419
        $this->rawdata = [];
Línea 481... Línea 479...
481
     * @return context
479
     * @return context
482
     */
480
     */
483
    public function get_context(): context {
481
    public function get_context(): context {
484
        return $this->context;
482
        return $this->context;
485
    }
483
    }
-
 
484
 
-
 
485
    /**
-
 
486
     * Check if the user has the capability to access this table.
-
 
487
     *
-
 
488
     * @return bool Return true if capability check passed.
-
 
489
     */
-
 
490
    public function has_capability(): bool {
-
 
491
        global $CFG;
-
 
492
        require_once($CFG->dirroot . '/course/lib.php');
-
 
493
 
-
 
494
        $context = $this->course->id == SITEID ? \context_system::instance() : $this->get_context();
-
 
495
        return course_can_view_participants($context);
-
 
496
    }
486
}
497
}