Example #1
0
if (!has_capability('local/collegestructure:manage', $systemcontext)) {
    print_error('You dont have permissions');
}

$strheading = get_string('course_exem', 'local_request');
$PAGE->navbar->add($strheading, new moodle_url('/local/request/approveexem.php'));
$PAGE->navbar->add(get_string('viewdetails', 'local_request'));
$PAGE->set_title($strheading);

$data = array();
echo $OUTPUT->header();

echo $OUTPUT->heading(get_string('viewdetails', 'local_request'));

$request = $DB->get_record('local_request_courseexem', array('id' => $id));
$student = $requestss->requestedstudent($request);

$out = array();
$contextid = context_user::instance($request->studentid);
$fs = get_file_storage();
$params = array($contextid->id, 'user', 'draft', '.');
$files = $fs->get_area_files($contextid->id, 'user', 'draft', $request->attachment);
$url = "{$CFG->wwwroot}/local/request/draftfile.php/$contextid->id/user/draft";

foreach ($files as $file) {
    $filename = $file->get_filename();
    $fileurl = $url . $file->get_filepath() . $file->get_itemid() . '/' . $filename;
    if ($filename != '.')
        $out[] = html_writer::link($fileurl, $filename);
}
$br = html_writer::empty_tag('br');