]> git.mjollnir.org Git - moodle.git/commitdiff
mod-scorm MDL-16706 Eliminated inline scripts to use PAGE methods
authorsamhemelryk <samhemelryk>
Thu, 2 Jul 2009 06:40:54 +0000 (06:40 +0000)
committersamhemelryk <samhemelryk>
Thu, 2 Jul 2009 06:40:54 +0000 (06:40 +0000)
mod/scorm/datamodels/aicclib.php

index 9fdf26a5fd98d0fd3b41fd4e02980731b89617cc..acabe596fe0d30cc41ed52763c4f19764a017d70 100644 (file)
@@ -534,25 +534,8 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
     }
     $result->toc .= "\t</ul>\n";
     if ($scorm->hidetoc == 0) {
-        $result->toc .= '
-          <script type="text/javascript">
-          //<![CDATA[
-              function expandCollide(which,list,item) {
-                  var el = document.ids ? document.ids[list] : document.getElementById ? document.getElementById(list) : document.all[list];
-                  which = which.substring(0,(which.length));
-                  var el2 = document.ids ? document.ids[which] : document.getElementById ? document.getElementById(which) : document.all[which];
-                  if (el.style.display != "none") {
-                      el2.src = "'.$scormpixdir.'/plus.gif";
-                      el.style.display=\'none\';
-                      new cookie("hide:SCORMitem" + item, 1, 356, "/").set();
-                  } else {
-                      el2.src = "'.$scormpixdir.'/minus.gif";
-                      el.style.display=\'block\';
-                      new cookie("hide:SCORMitem" + item, 1, -1, "/").set();
-                  }
-              }
-          //]]>
-          </script>'."\n";
+        $result->toc .= $PAGE->requires->data_for_js('scormdata', Array('scormpixdir'=>$scormpixdir))->asap();
+        $result->toc .= $PAGE->requires->js('mod/scorm/datamodels/scorm_datamodels.js')->asap();
     }
 
     $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&amp;currentorg='.$currentorg.$modestr.'&amp;scoid=';