Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / mod / resource / type / ims / javascript.php
blobe5666453ded89f1b82ba667bf4779fd06f040d30
1 <?php /// $Id $
2 /// Load IMS required Javascript libraries, adding them
3 /// before the standard one ($standard_javascript)
5 if (!defined('MOODLE_INTERNAL')) {
6 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
9 /// We use this globals to be able to generate the proper JavaScripts
10 global $jsarg, $standard_javascript;
12 /// Let's know if we are using a customcorners theme. It implies new calculations
13 /// within the resizeiframe function.
14 if (!empty($THEME->customcorners)) {
15 $customcorners = 'true';
16 } else {
17 $customcorners = 'false';
20 /// Load IMS needed JavaScript
21 /// The dummy LMS API hack to stop some SCORM packages giving errors.
22 echo "<script type=\"text/javascript\" src=\"$CFG->wwwroot/mod/resource/type/ims/dummyapi.js\"></script>\n";
23 /// The resize iframe script
24 echo " <script type=\"text/javascript\" src=\"$CFG->wwwroot/mod/resource/type/ims/resize.js\"></script>\n";
25 echo " <script type=\"text/javascript\">
26 window.onresize = function() {
27 resizeiframe($jsarg, $customcorners);
29 window.name='ims-cp-page';
31 // Set Interval until ims-containerdiv and (ims-contentframe or ims-contentframe-no-nav) is available
32 function waiting() {
33 var cd = document.getElementById('ims-containerdiv');
34 var cf = document.getElementById('ims-contentframe');
35 var cfnv = document.getElementById('ims-contentframe-no-nav');
37 if (cd && (cf || cfnv)) {
38 resizeiframe($jsarg, $customcorners);
39 clearInterval(ourInterval);
40 return true;
42 return false;
45 var ourInterval = setInterval('waiting()', 100);
46 </script>\n";
48 /// Load standard JavaScript
49 include("$standard_javascript");