function JLMS_playerSCORM($id, $option) { global $JLMS_DB, $my, $JLMS_CONFIG, $Itemid, $JLMS_SESSION; $course_id = $JLMS_CONFIG->get('course_id'); $usertype = $JLMS_CONFIG->get('current_usertype', 0); $lpath_id = intval(mosGetParam($_REQUEST, 'lpath_id', 0)); $int_skip_resume = intval(mosGetParam($_REQUEST, 'int_skip_resume', 0)); $scorm = null; //new stdClass(); if ($course_id && ($usertype == 1 || $usertype == 2) && JLMS_CheckSCORM($id, $lpath_id, $course_id, $scorm, $usertype)) { if (!empty($scorm)) { // 11.04.2007 (parameter 'redirect_to_learnpath' used to avoid redirect cycles from course home to LP and back $JLMS_SESSION->clear('redirect_to_learnpath'); // sleep one second. SCORM could send some requests on onCloasPage event. We need wait for these requests to be processed. #sleep(2); $scoid = intval(mosGetParam($_REQUEST, 'scoid', 0)); $mode = 'normal'; //strval(mosGetParam($_REQUEST, 'mode','normal'));//optional_param('mode', 'normal', PARAM_ALPHA); $currentorg = strval(mosGetParam($_REQUEST, 'currentorg', '')); //, PARAM_RAW); $newattempt = strval(mosGetParam($_REQUEST, 'newattempt', 'on')); require_once _JOOMLMS_FRONT_HOME . "/includes/n_scorm/lms_scorm.play.php"; $query = "SELECT * FROM #__lms_learn_paths WHERE id = '" . $lpath_id . "' AND course_id = '" . $course_id . "'"; $JLMS_DB->SetQuery($query); $lpath_data = $JLMS_DB->LoadObjectList(); $box_view = false; if (count($lpath_data) == 1) { $pathway = array(); $pathway[] = array('name' => $lpath_data[0]->lpath_name, 'link' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=player_scorm&id={$id}&course_id={$course_id}&lpath_id=" . $lpath_data[0]->id)); JLMSAppendPathWay($pathway); } if (isset($scorm->params)) { $params = new JLMSParameters($scorm->params); if ($params->get('scorm_layout', 0) && $params->get('scorm_layout', 0) == 1) { $box_view = true; } } if ($box_view) { // SqueezeBox view - don't show Heading. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; echo '<html xmlns="http://www.w3.org/1999/xhtml" style="margin:0;padding:0"><head>'; $iso_site = 'charset=utf-8'; if (defined('_ISO')) { $iso_site = _ISO; if (!$iso_site) { $iso_site = 'charset=utf-8'; } } echo '<meta http-equiv="Content-Type" content="text/html; ' . $iso_site . '" />'; echo '</head><body style="margin:0;padding:0">'; } else { JLMS_ShowHeading(); } /*JLMS_TMPL::OpenMT(); $hparams = array(); JLMS_TMPL::ShowHeader('scorm', $scorm->scorm_name, $hparams); */ $skip_resume = $int_skip_resume ? true : false; JLMS_SCORM_PLAY_MAIN($scorm, $option, $course_id, $lpath_id, $scoid, $mode, $currentorg, $newattempt, false, false, $box_view, $skip_resume); if ($box_view) { echo '</body></html>'; JLMS_die(); } //JLMS_TMPL::CloseMT(); } else { JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=learnpaths&id={$course_id}")); } } else { JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=learnpaths&id={$course_id}")); } }
function JLMS_SwitchUserType($usertype, $option) { global $my, $JLMS_SESSION, $JLMS_CONFIG; //if (JLMS_GetUserType_simple($my->id, true) == 1 || $usertype == 6) { if ($JLMS_CONFIG->get('main_usertype') == 1 || $usertype == 6) { $Itemid = $JLMS_CONFIG->get('Itemid'); $course_id = $JLMS_CONFIG->get('course_id'); $JLMS_SESSION->set('switch_usertype', $usertype); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; echo '<html xmlns="http://www.w3.org/1999/xhtml"><head>'; echo '<title>' . _JLMS_REDIRECTING . '</title>'; $iso_site = 'charset=utf-8'; echo '<meta http-equiv="Content-Type" content="text/html; ' . $iso_site . '" />'; echo '</head><body>'; if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { if ($_SERVER['HTTP_REFERER'] == sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid) || $_SERVER['HTTP_REFERER'] == sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid) || $_SERVER['HTTP_REFERER'] == $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&Itemid=" . $Itemid || $_SERVER['HTTP_REFERER'] == str_replace('&', '&', sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid))) { $jlms_task = $JLMS_SESSION->get('jlms_task', ''); switch ($jlms_task) { case 'agenda': case 'documents': case 'learnpaths': case 'links': case 'quizzes': case 'dropbox': case 'attendance': case 'course_forum': case 'conference': case 'chat': case 'gradebook': case 'mailbox': $url_redirect_pre = str_replace('&', '&', sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task={$jlms_task}&id={$course_id}")); break; default: $url_redirect_pre = str_replace('&', '&', sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=details_course&id={$course_id}")); break; } } else { $url_redirect_pre = $_SERVER['HTTP_REFERER']; } $url_redirect = $url_redirect_pre; $js_redirect = "window.top.location.href = '" . str_replace('&', '&', $url_redirect_pre) . "';"; } else { $url_redirect = 'javascript:window.history.go(-1);'; $js_redirect = 'window.history.go(-1);'; } echo '<br /><br /><br /><br /><br /><center><table><tr><td align="left"><span style="alignment:left" id="r_span">' . _JLMS_REDIRECTING . '</span></td></tr><tr><td align="center"><a href="' . $url_redirect . '">' . _JLMS_CLICK_HERE_TO_REDIRECT . '</a></td></tr></table></center>'; echo ' <script type="text/javascript"> <!--//--><![CDATA[//><!-- function jlms_redirect() { window.status = "' . _JLMS_REDIRECTING . '" + myvar; document.getElementById("r_span").innerHTML = "' . _JLMS_REDIRECTING . '" + myvar; myvar = myvar + " ."; var timerID = setTimeout("jlms_redirect();", 100); if (timeout > 0) { timeout -= 1; } else { clearTimeout(timerID); window.status = ""; ' . $js_redirect . ' } } var myvar = ""; var timeout = 15; jlms_redirect(); //--><!]]> </script>'; echo '</body></html>'; JLMS_die(); } }