$file = $CFG->dirroot . '/'.$CFG->admin.'/xmldb/actions/' . $action . '/' . $action . '.js';
$wwwfile = $CFG->wwwroot . '/'.$CFG->admin.'/xmldb/actions/' . $action . '/' . $action . '.js';
if (file_exists($file) && is_readable($file)) {
- echo '<script type="text/javascript" src="' . $wwwfile . '"></script>' . "\n";
+ require_js($wwwfile);
} else {
/// Try to load the postaction javascript if exists
if ($postaction) {
$file = $CFG->dirroot . '/'.$CFG->admin.'/xmldb/actions/' . $postaction . '/' . $postaction . '.js';
$wwwfile = $CFG->wwwroot . '/'.$CFG->admin.'/xmldb/actions/' . $postaction . '/' . $postaction . '.js';
if (file_exists($file) && is_readable($file)) {
- echo '<script type="text/javascript" src="' . $wwwfile . '"></script>' . "\n";
+ require_js($wwwfile);
}
}
}
}
function calendar_overlib_html() {
- return '<div id="overDiv" style="position: absolute; visibility: hidden; z-index:1000;"></div>'
- .'<script type="text/javascript" src="'.CALENDAR_URL.'overlib.cfg.php"></script>';
+ require_js(CALENDAR_URL . 'overlib.cfg.php');
+ return '<div id="overDiv" style="position: absolute; visibility: hidden; z-index:1000;"></div>';
}
function calendar_set_referring_course($courseid) {
require_js(array('yui_yahoo','yui_event','yui_connection','yui_dom'));
// Need to do this after the header because it requires the YUI stuff
// to be loaded already
- print '<script type="text/javascript" src="completion.js"></script>'.
- '<script type="text/javascript">completion_strsaved="'.get_string('saved','completion').
- '"; completion_strtitley="'.get_string('completion-title-manual-y','completion').
- '"; completion_strtitlen="'.get_string('completion-title-manual-n','completion').
- '"; completion_stralty="'.get_string('completion-alt-manual-y','completion').
- '"; completion_straltn="'.get_string('completion-alt-manual-n','completion').
- '"; </script>';
+ require_js($CFG->wwwroot . '/course/completion.js');
+ print_js_config(array(
+ 'completion_strsaved' => get_string('saved','completion'),
+ 'completion_strtitley' => get_string('completion-title-manual-y','completion'),
+ 'completion_strtitlen' => get_string('completion-title-manual-n','completion'),
+ 'completion_stralty' => get_string('completion-alt-manual-y','completion'),
+ 'completion_straltn' => get_string('completion-alt-manual-n','completion'),
+ ));
}
// Course wrapper start.
// At the bottom because we want to process sections and activities
// after the relevant html has been generated. We're forced to do this
// because of the way in which lib/ajax/ajaxcourse.js is written.
- echo '<script type="text/javascript" ';
- echo "src=\"{$CFG->wwwroot}/lib/ajax/ajaxcourse.js\"></script>\n";
+ require_js($CFG->wwwroot . '/lib/ajax/ajaxcourse.js');
$COURSE->javascriptportal->print_javascript($course->id);
}
print_paging_bar($numusers, $report->page, $studentsperpage, $report->pbarurl);
}
-$reporthtml = '<script src="functions.js" type="text/javascript"></script>';
+require_js('functions.js');
-$reporthtml .= '<div id="grader_report_message"></div>' . "\n";
+$reporthtml = '<div id="grader_report_message"></div>' . "\n";
$reporthtml .= '<table id="user-grades" class="gradestable flexible boxaligncenter generaltable">';
$reporthtml .= '<thead>';
$reporthtml .= $report->get_headerhtml();