$table->column_class('course', 'datelist_course');
    $table->column_class('scheduler', 'datelist_scheduler');
    $table->setup();
    // Get extra query parameters from flexible_table behaviour.
    $where = $table->get_sql_where();
    $sort = $table->get_sql_sort();
    $table->pagesize($limit, $numrecords);
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort}";
    }
    $results = $DB->get_records_sql($sql, $params);
    foreach ($results as $id => $row) {
        $courseurl = new moodle_url('/course/view.php', array('id' => $row->courseid));
        $coursedata = html_writer::link($courseurl, $row->courseshort);
        $schedulerurl = new moodle_url('/mod/scheduler/view.php', array('a' => $row->schedulerid));
        $schedulerdata = html_writer::link($schedulerurl, format_string($row->name));
        $a = mod_scheduler_renderer::slotdatetime($row->starttime, $row->duration);
        $whendata = get_string('slotdatetime', 'scheduler', $a);
        $whourl = new moodle_url('/mod/scheduler/view.php', array('what' => 'viewstudent', 'a' => $row->schedulerid, 'appointmentid' => $row->id));
        $whodata = html_writer::link($whourl, $row->studentfullname);
        $whatdata = format_string($row->notes);
        $gradedata = $row->scale == 0 ? '' : $output->format_grade($row->scale, $row->grade);
        $dataset = array($coursedata, $schedulerdata, $whendata, format_string($row->appointmentlocation), $whodata, $row->studentdepartment, $whatdata, $gradedata, format_text($row->appointmentnote, $row->appointmentnoteformat));
        $table->add_data($dataset);
    }
    $table->print_html();
    echo $output->continue_button($returnurl);
} else {
    notice(get_string('noresults', 'scheduler'), $returnurl);
}
echo $output->footer();
 public function get_value(scheduler_slot $slot, $appointment)
 {
     return mod_scheduler_renderer::usertime($slot->endtime);
 }