moodle_local_treestudyplan/doc.php

34 lines
833 B
PHP
Raw Normal View History

2023-06-30 22:47:08 +02:00
<?php
require_once("../../config.php");
require_once($CFG->libdir.'/weblib.php');
$systemcontext = context_system::instance();
$PAGE->set_url("/local/treestudyplan/doc.php",array());
2023-07-02 22:58:54 +02:00
$PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/devstyles.css'));
2023-06-30 22:47:08 +02:00
$PAGE->set_pagelayout('base');
$PAGE->set_context($systemcontext);
require_login();
$pi = $_SERVER['PATH_INFO'];
$file = $CFG->dirroot."/local/treestudyplan/doc".$pi;
// Fallback to index
if(!file_exists($file)){
$file = $CFG->dirroot."/local/treestudyplan/doc/index.htm";
}
$mime = mime_content_type($file);
$text_types = ["text/html","text/plain"];
if( in_array($mime,$text_types))
{
print $OUTPUT->header();
print file_get_contents($file);
print $OUTPUT->footer();
}
else {
header("Content-type: {$mime}");
print file_get_contents($file);
}