I found in the documentation that javascript files can be included like this:
// Print title and header
$PAGE->set_pagelayout('standard');
$PAGE->set_title("$course->shortname: График");
$PAGE->set_heading($COURSE->fullname);
$PAGE->requires->css($CFG->dirroot.'/grafik/javascript/tcal.css');
$PAGE->requires->js($CFG->dirroot.'/grafik/javascript/language.js',true);
$PAGE->requires->js($CFG->dirroot.'/grafik/javascript/tcal.js',true);
echo $OUTPUT->header();
However, by doing this in one of my modules, I get this error:
More information about this error
- line 368 of /lib/outputrequirementslib.php: coding_exception thrown
- line 325 of /lib/outputrequirementslib.php: call to page_requirements_manager->js_fix_url()
- line 37 of /grafik/view.php: call to page_requirements_manager->js()
But the file is right there as you can see:
root@dreamwave-Aspire-5738:/var/www/moodle/grafik/javascript# ls
img index.html language.js tcal.css tcal.js
Why is this happening ? How do I include my js files?