function showLPath_MainPage($course_id, $lpath_id, $option, &$lpath_data, &$lpath_contents, &$quizzes_data) { $JLMS_CONFIG =& JLMSFactory::getConfig(); $Itemid = $JLMS_CONFIG->get('Itemid'); $lp_params = new JLMSParameters($lpath_data->lp_params); $show_lpath_contents_at_the_left = $lp_params->get('navigation_type', 0) ? true : false; $is_quiz = count($quizzes_data) ? true : false; $is_drag_drop = false; $c_time_limit = 0; $inside_lp = 1; $c_slide = false; //pri starte quiza $c_generated_panel = true; // Contents of quiz will be generated on 'satrt' action $c_slide_update = false; $quiz_id = 0; foreach ($quizzes_data as $qd) { $quiz_id = $qd->c_id; foreach ($qd->panel_data as $q) { if ($q->c_type == 4) { $is_drag_drop = true; break; } } } require_once _JOOMLMS_FRONT_HOME . "/includes/ajax_features.class.php"; // preloading QUIZ languge (28.02.2007 new method) (all quizzes messages now in global quiz language) global $JLMS_LANGUAGE; JLMS_require_lang($JLMS_LANGUAGE, 'quiz.lang', $JLMS_CONFIG->get('default_language')); require dirname(__FILE__) . '/includes/quiz/quiz_language.php'; global $jq_language; $e = true; // enable force echo $AF = new JLMS_Ajax_Features(); $AF->set('c_slide', $c_slide); $AF->set('c_generated_panel', $c_generated_panel); $AF->set('c_slide_update', $c_slide_update); $AF->set('quiz_id', $quiz_id); if ($is_quiz) { $AF->GetInclude_Msgs($e); } $AF->JS_open($e); $AF->GetFunc_JS_in_array($e); $AF->GetFunc_RFE($e); if ($is_quiz) { $document =& JFactory::getDocument(); $document->addStyleSheet($JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms/includes/quiz/templates/joomlaquiz_lms_template/jq_template.css'); echo "function jlms_gotoQuestion(qid) { if (stu_step_type == 5 && user_unique_id && quiz_id) { jlms_SwitchOpenedContents();JQ_gotoQuestionOn(qid);} }"; $AF->QUIZ_JS_DrDr_Code($e); $AF->QUIZ_preloadMsgs($e, $jq_language); $AF->QUIZ_doInitialize($e, $JLMS_CONFIG->getCfg('live_site') . "/index.php?tmpl=component&option={$option}&inside_lp={$inside_lp}&Itemid={$Itemid}&jlms=1&task=quiz_ajax_action&id={$course_id}", ''); /* We must override this func (to reduce JS weigth) $AF->QUIZ_MakeRequest($e); */ ?> function jq_MakeRequest(url, do_clear) { if (do_clear == 1) { jq_showLoading(); } quiz_blocked == 1; jlms_MakeRequest('jq_AnalizeRequest', url, 'quiz'); } <?php $req_tasks = array('start', 'seek_quest', 'review_start', 'review_next', 'review_finish', 'next', 'no_attempts', 'email_results', 'time_is_up', 'finish', 'results', 'failed'); $AF->QUIZ_AnalizeRequest($e, 'jq_AnalizeRequest', $req_tasks); $AF->QUIZ_releaseblock($e); $AF->QUIZ_StartTickTack($e); $AF->QUIZ_ContinueTickTack($e); //$AF->QUIZ_StartQuizOn($e); $AF->QUIZ_StartQuizOn($e); $AF->QUIZ_StartQuiz($e); $AF->QUIZ_GoToQuestionOn($e); $AF->QUIZ_GoToQuestion($e); $AF->QUIZ_EmailResults($e); $AF->QUIZ_StartReview($e); $AF->QUIZ_ReviewNext($e); $AF->QUIZ_ReviewPrev($e); $AF->QUIZ_Check_selectRadio($e); $AF->QUIZ_Check_selectCheckbox($e); $AF->QUIZ_Check_valueItem($e); $AF->QUIZ_QuizNextOn($e); $toolbar = array(); $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);"); if ($inside_lp && !$show_lpath_contents_at_the_left) { $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');"); } else { if ($c_slide && !$show_lpath_contents_at_the_left) { $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();"); } } $m_str_no_skip = JLMS_ShowToolbar($toolbar); //8.10.08 - (Max) - dva toolbars dlia skip i standart $toolbar = array(); $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);"); $toolbar[] = array('btn_type' => 'skip', 'btn_js' => "javascript:JQ_gotoQuestion(__skip__);void(0);"); if ($inside_lp && !$show_lpath_contents_at_the_left) { $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');"); } else { if ($c_slide && !$show_lpath_contents_at_the_left) { $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();"); } } $m_str_skip = JLMS_ShowToolbar($toolbar); $AF->QUIZ_QuizContinue($e, $m_str_no_skip, $m_str_skip); $cf_url = "'&atask=finish_stop&quiz='+quiz_id+'&stu_quiz_id='+stu_quiz_id"; $AF->QUIZ_QuizContinueFinish($e, $cf_url); $toolbar = array(); $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);"); if ($inside_lp && !$show_lpath_contents_at_the_left) { $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');"); } else { if ($c_slide && !$show_lpath_contents_at_the_left) { $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();"); } } $m_str = JLMS_ShowToolbar($toolbar); $AF->QUIZ_QuizBack($e, $m_str); $AF->QUIZ_Next($e); $AF->QUIZ_showLoading($e); /* $AF->QUIZ_UpdateTaskDiv_htm($e); $AF->QUIZ_UpdateTaskDiv($e, $c_slide);*/ // We must override task div functionality for quiz ?> function jq_UpdateTaskDiv_htm(htm_txt) { getObj('jlms_lpath_menu').innerHTML = htm_txt; } function jq_UpdateTaskDiv(task) { switch (task) { case 'start': getObj('jlms_lpath_menu').innerHTML = jq_StartButton('jq_StartQuizOn()', mes_quiz_start); break; case 'next': getObj('jq_quest_num_container').innerHTML = mes_quest_number.replace("{X}", cur_quest_num).replace("{Y}", quiz_count_quests); getObj('jq_quest_num_container').style.visibility = "visible"; getObj('jq_points_container').innerHTML = mes_quest_points.replace("{X}", cur_quest_score); getObj('jq_points_container').style.visibility = "visible"; <?php if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) { ?> if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; } <?php } ?> break; case 'review_next': getObj('jq_quest_num_container').innerHTML = mes_quest_number.replace("{X}", cur_quest_num).replace("{Y}", quiz_count_quests); getObj('jq_quest_num_container').style.visibility = "visible"; getObj('jq_points_container').innerHTML = mes_quest_points.replace("{X}", cur_quest_score); getObj('jq_points_container').style.visibility = "visible"; break; case 'continue': <?php if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) { ?> if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; } <?php } ?> break; case 'continue_finish': <?php if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) { ?> if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; } <?php } ?> break; case 'finish': getObj('jlms_lpath_menu').innerHTML = lp_menu_item_contents; getObj('jq_quest_num_container').style.visibility = 'hidden'; getObj('jq_points_container').style.visibility = 'hidden'; <?php if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) { ?> if (getObj('progress_bar')) { getObj('progress_bar').style.display = "none"; } <?php } ?> break; case 'clear': getObj('jlms_lpath_menu').innerHTML = ''; getObj('jq_quest_num_container').style.visibility = 'hidden'; getObj('jq_points_container').style.visibility = 'hidden'; break; } <?php if ($c_slide) { ?> if (result_is_shown == 1) { jq_ShowPanel(); } <?php } ?> } <?php $AF->QUIZ_NextButton($e); $AF->QUIZ_ContinueButton($e); $AF->QUIZ_StartButton($e); $AF->QUIZ_BackButton($e); if ($c_slide) { $AF->QUIZ_ShowPanel_go($e); $AF->QUIZ_HidePanel_go($e); $AF->QUIZ_ShowPanel($e); } } $AF->GetFunc_JS_URLencode($e); $AF->GetFunc_JS_TRIM_str($e); $AF->JS_close($e); $lpc_btn = $AF->Get_LPContents_btn(false); $toolbar = array(); $toolbar[] = array('btn_type' => 'next', 'btn_js' => "javascript:ajax_action('next_lpathstep');"); if (!$show_lpath_contents_at_the_left) { $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');"); } $rs = JLMS_ShowToolbar($toolbar); $rs = str_replace('"components/com_joomla_lms', '"' . $JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms', $rs); $lpc_btn = str_replace('/', '\\/', str_replace('"', "\\\"", $rs)); ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- var timer_KeepAL = 990066; <?php /* variable timer_keepAl was added 21.08.2007 - for keeping joomla session whilst SCORM playing */ ?> var lp_menu_item_contents = "<?php echo $lpc_btn; ?> "; var jlms_contents_visible = 0; var jlms_contents_visible_only = 0; var jlms_lpath = <?php echo $lpath_id; ?> ; var jlms_course = <?php echo $course_id; ?> ; function ajax_action(pressbutton) { if ((jlms_blocked == 1) && (pressbutton != 'contents_lpath') && (pressbutton != 'get_document')) { if (jlms_allow_pending_task == 1) { if (jlms_is_pending_task == 0) { jlms_is_pending_task = 1; jlms_pending_task = pressbutton; } } } else { jlms_blocked = 1; if ((pressbutton != 'contents_lpath') && (pressbutton != 'get_document')) { $('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'}); } switch (pressbutton) { case 'lpath_restart': <?php if (!$show_lpath_contents_at_the_left) { ?> jlms_SwitchOpenedContents(); <?php } ?> jlms_MakeRequest('jlms_AnalizeRequest', '&action=restart_lpath&id='+jlms_lpath, 'lpath'); break; case 'start_lpath': <?php if (!$show_lpath_contents_at_the_left) { ?> jlms_SwitchOpenedContents(); <?php } ?> jlms_MakeRequest('jlms_AnalizeRequest', '&action=start_lpath&id='+jlms_lpath, 'lpath'); break; case 'next_lpathstep': <?php if (!$show_lpath_contents_at_the_left) { ?> jlms_SwitchOpenedContents(); <?php } ?> jlms_MakeRequest('jlms_AnalizeRequest', '&action=next_lpathstep&id='+jlms_lpath+'&step_id='+stu_step_id, 'lpath'); break; case 'prev_lpathstep': <?php if (!$show_lpath_contents_at_the_left) { ?> jlms_SwitchOpenedContents(); <?php } ?> jlms_MakeRequest('jlms_AnalizeRequest', '&action=prev_lpathstep&id='+jlms_lpath+'&step_id='+stu_step_id, 'lpath'); break; case 'lpath_seek': <?php if (!$show_lpath_contents_at_the_left) { ?> jlms_SwitchOpenedContents(); <?php } ?> jlms_MakeRequest('jlms_AnalizeRequest', '&action=seek_lpathstep&id='+jlms_lpath+'&step_id='+seek_step_id, 'lpath'); break; case 'contents_lpath': jlms_blocked = 0; <?php if (!$show_lpath_contents_at_the_left) { ?> jlms_SwitchContents(); <?php } else { ?> jlms_SwitchContents2(); <?php } ?> break; case 'get_document': jlms_blocked = 0; /*window.open('index.php?tmpl=component&no_html=1&option=<?php echo $option; ?> &Itemid=<?php echo $Itemid; ?> &task=show_lpath&action=get_lpath_doc&user_unique_id=' + user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course+'&doc_id='+get_doc_id+'&step_id='+stu_step_id ,null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");*/ window.location.href = '<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /index.php?tmpl=component&no_html=1&option=<?php echo $option; ?> &Itemid=<?php echo $Itemid; ?> &task=show_lpath&action=get_lpath_doc&user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course+'&doc_id='+get_doc_id+'&step_id='+stu_step_id; //return true; void(0); break; default: jlms_blocked = 0; break; } } } <?php if (JLMS_mootools12()) { $fxFunc = 'Tween'; } else { $fxFunc = 'Style'; } $additon_js = ' var mySlide_contents2; var mySlide_contents2_width_start = 0; var mySlide_contents2_width_end = 0; var mySlide_contents3; var mySlide_contents2_mode = 2; var mySlide_contents3_margin_start = 0; var mySlide_contents3_margin_end = 10; var mySlide_contents4; var winScroller2 = new Fx.Scroll(window); function jlms_prepare_el_mySlide_contents2() { mySlide_contents2 = new Fx.' . $fxFunc . '(\'jlms_lpath_contents_container\', \'width\'); mySlide_contents2_width_start = $(\'jlms_lpath_contents_container\').getStyle(\'width\'); mySlide_contents3_margin_start = $(\'jlms_lpath_descr\').getStyle(\'margin-left\'); mySlide_contents3 = new Fx.' . $fxFunc . '(\'jlms_lpath_descr\', \'margin-left\'); mySlide_contents4 = new Fx.' . $fxFunc . '(\'jlms_lpath_completion_msg_container\', \'margin-left\'); $(\'jlms_lpath_completion_msg_container\').setStyles({\'margin-left\': \'0\'}); $(\'jlms_lpath_descr\').setStyles({\'margin-left\': \'0\'}); //mySlide_contents2.hide(); //$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'}); } function jlms_SwitchContents2() { if (mySlide_contents2_mode == 2) { $(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'}); mySlide_contents2.start(0, mySlide_contents2_width_start); mySlide_contents3.start(0, mySlide_contents3_margin_start); mySlide_contents4.start(0, mySlide_contents3_margin_start); mySlide_contents2_mode = 1; $(\'left_nav_collapser_container\').setStyles({visibility: \'visible\',display: \'\'}); } else if (mySlide_contents2_mode == 1) { mySlide_contents2.start(mySlide_contents2_width_end); mySlide_contents3.start(mySlide_contents3_margin_end); mySlide_contents4.start(mySlide_contents3_margin_end); $(\'left_nav_collapser_container\').setStyles({visibility: \'hidden\',display: \'none\'}); mySlide_contents2_mode = 0; } else { $(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'}); mySlide_contents2.start(mySlide_contents2_width_start); mySlide_contents3.start(mySlide_contents3_margin_start); mySlide_contents4.start(mySlide_contents3_margin_start); mySlide_contents2_mode = 1; $(\'left_nav_collapser_container\').setStyles({visibility: \'visible\',display: \'\'}); } } '; if (JLMS_mootools12()) { $setHTML = 'set(\'html\','; } else { $setHTML = 'setHTML('; } $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js); $domready = ' jlms_prepare_el_mySlide_contents2(); '; $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready); ?> <?php if ($JLMS_CONFIG->get('web20_effects', true) && !$show_lpath_contents_at_the_left) { $additon_js = ' var mySlide_contents; function jlms_prepare_el_mySlide_contents() { mySlide_contents = new Fx.Slide(\'jlms_lpath_contents_container\'); mySlide_contents.hide(); $(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'}); } '; $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js); $domready = ' jlms_prepare_el_mySlide_contents(); '; $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready); ?> function jlms_SwitchOpenedContents() { if ($defined(mySlide_contents)) { var type = typeof mySlide_contents; if (type == 'object') { mySlide_contents.hide(); } } else { jlms_prepare_el_mySlide_contents(); } } function jlms_SwitchContentsOnly(par) { if (par == 'show') { mySlide_contents.slideIn(); } else { mySlide_contents.hide(); } } function jlms_SwitchContents() { mySlide_contents.toggle(); } <?php } elseif ($show_lpath_contents_at_the_left) { ?> function jlms_SwitchOpenedContents() { jlms_SwitchContents(); } function jlms_SwitchContentsOnly(par) { if (par == 'show') { if (jlms_contents_visible == 1) { } else { var vis_style1 = 'visible'; var disp_style1 = ''; var jlcc = getObj('jlms_lpath_contents_container'); jlcc.style.visibility = vis_style1; jlcc.style.display = disp_style1; } } } function jlms_SwitchContents() { if (jlms_contents_visible == 1) { } else { var vis_style1 = 'visible'; var disp_style1 = ''; var vis_style2 = 'visible'; var disp_style2 = ''; var jlcc = getObj('jlms_lpath_contents_container'); var jldc = getObj('jlms_lpath_descr'); jlcc.style.visibility = vis_style1; jlcc.style.display = disp_style1; jldc.style.visibility = vis_style2; jldc.style.display = disp_style2; if (jlms_contents_visible == 1) { jlms_contents_visible = 0;} else { jlms_contents_visible = 1; } } } <?php } else { ?> function jlms_SwitchOpenedContents() { if (jlms_contents_visible == 1) { jlms_SwitchContents(); } } function jlms_SwitchContentsOnly(par) { if (par == 'show') { var vis_style1 = 'visible'; var disp_style1 = ''; } else { var vis_style1 = 'hidden'; var disp_style1 = 'none'; } var jlcc = getObj('jlms_lpath_contents_container'); jlcc.style.visibility = vis_style1; jlcc.style.display = disp_style1; } function jlms_SwitchContents() { var vis_style1 = 'visible'; var disp_style1 = ''; var vis_style2 = 'hidden'; var disp_style2 = 'none'; if (jlms_contents_visible == 1) { var vis_style2 = 'visible'; var disp_style2 = ''; var vis_style1 = 'hidden'; var disp_style1 = 'none'; } var jlcc = getObj('jlms_lpath_contents_container'); var jldc = getObj('jlms_lpath_descr'); jlcc.style.visibility = vis_style1; jlcc.style.display = disp_style1; jldc.style.visibility = vis_style2; jldc.style.display = disp_style2; if (jlms_contents_visible == 1) { jlms_contents_visible = 0;} else { jlms_contents_visible = 1; } } <?php } ?> function jlms_SwitchContentsOnly2(par) { if (par == 'show') { mySlide_contents2.slideIn(); } else { mySlide_contents2.hide(); } } var stu_step_id = 0; var stu_last_cur_id = 0; var stu_step_type = 0; var jlms_blocked = 0; var jlms_is_pending_task = 0; var jlms_pending_task = ''; var jlms_allow_pending_task = 1; var seek_step_id = 0; var get_doc_id = 0; var lp_url_prefix = '<?php echo $JLMS_CONFIG->get('live_site'); ?> /index.php?option=<?php echo $option; ?> &Itemid=<?php echo $Itemid; ?> '; var lp_user_unique_id = ''; var user_start_id = 0; var mCfg_live_site = ''; function jlms_MakeRequest(onstate, url, mr_type) { var http_request = false; if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } else if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } if (!http_request) { return false; } http_request.onreadystatechange = function() { eval(onstate+'(http_request);') }; var lp_url_prefix2 = ''; var post_target = '<?php echo $JLMS_CONFIG->get('live_site'); ?> /index.php?jlms=1'; if (mr_type == 'lpath') { jlms_blocked == 1; jlms_showLoading(); lp_url_prefix2 = 'jlms=1&option=<?php echo $option; ?> &Itemid=<?php echo $Itemid; ?> &task=show_lpath&user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course; post_target = mCfg_live_site + lp_url_prefix; } else if (mr_type == 'quiz'){ lp_url_prefix2 = 'user_unique_id=' + user_unique_id + '&lp_user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&lpath_id='+jlms_lpath+'&step_id='+stu_step_id; post_target = mCfg_live_site + url_prefix; } //http_request.open('GET', mCfg_live_site + lp_url_prefix + lp_url_prefix2 + url, true); //http_request.send(null); http_request.open("POST", post_target, false); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", lp_url_prefix2.length + url.length); //http_request.setRequestHeader("Connection", "close"); - if close - bug in IE7 - it hungs up http_request.send(lp_url_prefix2 + url); if (mr_type == 'lpath') { jlms_allow_pending_task = 0; } } function jlms_AnalizeRequest(http_request) { if (http_request.readyState == 4) { if ((http_request.status == 200)) { jlms_WStatus(''); if(http_request.responseXML.documentElement == null){ try { //alert(http_request.responseXML.parseError.reason); http_request.responseXML.loadXML(http_request.responseText) } catch (e) { /*alert("Can't load");*/ } } response = http_request.responseXML.documentElement; var task = jlms_RFE(response,'task'); jlms_blocked = 1; jlms_allow_pending_task = 1; setTimeout("jlms_releaseBlock()", 1000); <?php if (!$show_lpath_contents_at_the_left) { ?> jlms_SwitchOpenedContents(); <?php } ?> switch (task) { case 'start_restart': case 'start': if ($('joomlalms_sys_message_container')) { //hide course enrollment message (if autoredirect to lpath enabled) $('joomlalms_sys_message_container').setStyles({visibility: 'hidden',display: 'none'}); } lp_user_unique_id = jlms_RFE(response,'user_unique_id'); user_start_id = jlms_RFE(response,'user_start_id'); stu_step_type = jlms_RFE(response,'step_type'); if (stu_step_type == 5) { quiz_blocked = 0; timer_sec = 0; stop_timer = 0; quiz_id = jlms_RFE(response,'step_item_id'); } prev_step_type = stu_step_type; stu_step_id = jlms_RFE(response,'step_id'); stu_last_cur_id = stu_step_id; prev_step_id = stu_step_id; jlms_ChangeFrontPage(response); if (task == 'start_restart') { $('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'}); jlms_setPendingSteps('cancel',response); jlms_setPendingSteps('quiz',response); } jlms_setPendingSteps('pending',response); jlms_setPendingSteps('accept',response); break; case 'restart': $('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'}); jlms_ChangeFrontPage(response); getObj('jlms_lpath_contents').innerHTML = jlms_RFE(response,'contents_data'); jlms_setPendingSteps('pending',response); break; case 'check_cond': lp_user_unique_id = jlms_RFE(response,'user_unique_id'); user_start_id = jlms_RFE(response,'user_start_id'); //stu_step_id = jlms_RFE(response,'step_id'); //prev_step_id = stu_step_id; jlms_ChangeFrontPage(response); jlms_changePendingSteps(); //jlms_setPendingSteps('pending',response); jlms_setPendingSteps('accept',response); break; case 'seek_step': case 'next_step': user_unique_id = ''; quiz_id = 0; stu_step_type = jlms_RFE(response,'step_type'); if (stu_step_type == 5) { quiz_id = jlms_RFE(response,'step_item_id'); } prev_step_type = stu_step_type; stu_step_id = jlms_RFE(response,'step_id'); prev_step_id = stu_step_id; jlms_ChangeFrontPage(response); jlms_setPendingSteps('pending',response); jlms_setPendingSteps('accept',response); break; case 'finish_lpath_quick':// without break; lp_user_unique_id = jlms_RFE(response,'user_unique_id'); user_start_id = jlms_RFE(response,'user_start_id'); case 'finish_lpath': jlms_ChangeFrontPage(response); var is_show_cmsg = jlms_RFE(response,'show_completion_msg'); if (is_show_cmsg == 1 || is_show_cmsg == '1') { var cmsg_txt = jlms_RFE(response,'lpath_completion_msg'); $('jlms_lpath_completion_msg_container').<?php echo $setHTML; ?> cmsg_txt); $('jlms_lpath_completion_msg_container').setStyles({visibility: 'visible',display: ''}); } jlms_setPendingSteps('accept',response); <?php if (!$show_lpath_contents_at_the_left) { ?> jlms_SwitchContentsOnly('show'); <?php } ?> break; case 'failed': getObj('jlms_lpath_descr').innerHTML = '<div class="joomlalms_sys_message"><?php echo str_replace('/', '\\/', _JLMS_LPATH_LOAD_DATA_ERROR); ?> <\/div>'; //getObj('jlms_lpath_menu').innerHTML = jlms_RFE(response,'menu_contents'); break; default: getObj('jlms_lpath_descr').innerHTML = '<div class="joomlalms_sys_message"><?php echo str_replace('/', '\\/', _JLMS_LPATH_LOAD_DATA_ERROR); ?> <\/div>'; getObj('jlms_lpath_menu').innerHTML = ''; break; } } else { alert('Bad Request status'); } } } function jlms_RFE(response,elem_name) { return response.getElementsByTagName(''+elem_name)[0].firstChild ? response.getElementsByTagName(''+elem_name)[0].firstChild.data : 0; } var is_collapser_timer = 0; <?php echo JLMSCSS::h2_js(); //JLMSCSS_h2_js function ?> function jlms_ChangeFrontPage(response) { var head_data = jlms_RFE(response,'step_name'); if (head_data != '') { getObj('jlms_lpath_head').innerHTML = JLMSCSS_h2_js(head_data); } var tmp_div = document.createElement("div"); tmp_div.id = 'temporary_div_tst'; tmp_div.innerHTML = jlms_RFE(response,'step_descr'); tmp_div.style.width = '100%'; getObj('jlms_lpath_descr').innerHTML = ''; getObj('jlms_lpath_descr').appendChild(tmp_div); //getObj('jlms_lpath_descr').innerHTML = jlms_RFE(response,'step_descr'); getObj('jlms_lpath_menu').innerHTML = jlms_RFE(response,'menu_contents'); var temp_script = jlms_RFE(response,'step_exec_script'); if (temp_script == 1 || temp_script == '1') { var exec_script = jlms_RFE(response,'step_exec_script_contents'); var new_script_el = document.createElement("script"); new_script_el.text = exec_script; new_script_el.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(new_script_el); //eval(exec_script); } <?php if ($show_lpath_contents_at_the_left) { ?> jlms_ChangeCollapserHeight(0); <?php } ?> if (window.set_height) { set_height(); } jlms_ScrollBrowserWindow(); setTimeout("jlms_ScrollBrowserWindow()", 300); } function jlms_ScrollBrowserWindow() { window.scrollTo(0,$('jlms_topdiv').getTop()); } function jlms_ChangeCollapserHeight(by_timer) { var leftnav_h, main_st_h = 0; leftnav_h = $('jlms_lpath_contents_container').getStyle('height').toInt(); main_st_h = $('jlms_lpath_descr').getStyle('height').toInt(); if (leftnav_h < main_st_h) { leftnav_h = main_st_h; } $('left_nav_collapser_container').setStyle('height', leftnav_h+'px'); if (is_collapser_timer == 1) { if (by_timer == 1) { setTimeout("jlms_ChangeCollapserHeight(1)", 300); } } else { is_collapser_timer = 1; setTimeout("jlms_ChangeCollapserHeight(1)", 300); } } function jlms_releaseBlock() { jlms_blocked = 0; if (jlms_is_pending_task == 1) { if (jlms_pending_task != '') { jlms_is_pending_task = 0; eval("ajax_action('"+jlms_pending_task+"')"); jlms_pending_task = ''; } } } function jlms_showLoading() { jlms_SwitchContentsOnly('hide'); getObj('jlms_lpath_descr').innerHTML = '<br \/><br \/><center><img src="<?php echo str_replace('/', '\\/', $JLMS_CONFIG->get('live_site')); ?> \/components\/com_joomla_lms\/lms_images\/loading.gif" height="32" width="32" border="0" alt="loading" \/><\/center>'; } function jlms_setPendingSteps(step_type, response) { var st = 'pending_steps'; var prfx = 'jlms_step_'; var is_lp = true; switch (step_type) { case 'pending': st = 'pending_steps'; break; case 'accept': st = 'completed_steps'; break; case 'cancel': st = 'incompleted_steps'; break; case 'quiz': st = 'incompleted_quests'; prfx = 'quest_result_'; is_lp = false; break; } if (is_lp) { var steps_ids; steps_ids = jlms_RFE(response,st); var arr = steps_ids.split(','); var i = 0; while (i < arr.length ) { if (getObj(prfx+arr[i])) { getObj(prfx+arr[i]).innerHTML = '<img class=\'JLMS_png\' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'.png" height="16" width="16" border="0" alt="'+step_type+'" />'; } i ++; } if (step_type == 'pending') { var r = getObj(prfx+stu_step_id); if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'_cur.png" height="16" width="16" border="0" alt="'+step_type+'" />';} if (stu_last_cur_id != stu_step_id) { r = getObj(prfx+stu_last_cur_id); if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'.png" height="16" width="16" border="0" alt="'+step_type+'" />';} } stu_last_cur_id = stu_step_id; } } else { var steps_ids; steps_ids = jlms_RFE(response,st); var arr = steps_ids.split(','); var i = 0; while (i < arr.length ) { if (getObj(prfx+arr[i])) { getObj(prfx+arr[i]).innerHTML = '-'; } i ++; } } } function jlms_changePendingSteps() { r = getObj('jlms_step_'+stu_last_cur_id); if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_pending.png" height="16" width="16" border="0" alt="pending" />';} } JLMS_preloadImages('<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/loading.gif','<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/buttons/btn_back.png','<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/buttons/btn_restart.png', '<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_pending.png', '<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png'); //--><!]]> </script> <?php JLMS_TMPL::OpenMT(); $hparams = array(); //$toolbar = array(); //$toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:ajax_action('start_lpath');"); JLMS_TMPL::ShowHeader('lpath', '', $hparams); //JLMS_TMPL::ShowToolbar($toolbar, 'right', true, $lpath_data->lpath_name, 2); //JLMS_TMPL::CloseMT(); JLMS_TMPL::OpenTS(); ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders"> <tr> <td align="left" valign="middle" id="jlms_lpath_head" width="100%"> <?php echo JLMSCSS::h2($lpath_data->lpath_name); ?> </td> <td align="right" style="text-align:right " valign="middle" id="jlms_lpath_menu"> <?php $toolbar = array(); $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:void(0);"); //$toolbar[] = array('btn_type' => 'start', 'btn_js' => sefrelToAbs("index.php?option=$option&Itemid=$Itemid&task=show_lpath_nojs&course_id=$course_id&id=$lpath_id&action=start_lpath")); //no-js functionality commented (version 1.1.0) due to the lots of bugs, lack of usage/testing echo JLMS_ShowToolbar($toolbar); ?> </td> </tr> </table> <?php JLMS_TMPL::CloseTS(); JLMS_TMPL::OpenTS(); $toolbar = array(); $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:ajax_action('start_lpath');"); $rs = JLMS_ShowToolbar($toolbar); $rs = str_replace('"components/com_joomla_lms', '"' . $JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms', $rs); $lpc_btn = str_replace('/', '\\/', str_replace('"', "\\\"", $rs)); $additon_js = ' var lp_menu_item_contents_pre = "' . $lpc_btn . '"; '; $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js); $domready = ' $(\'jlms_lpath_menu\').innerHTML = lp_menu_item_contents_pre; if (document.constructor) { document.constructor.prototype.write = function() { }; } else { document.write = function() { }; } '; $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready); if ($show_lpath_contents_at_the_left) { ?> <div id="jlms_lpath_contents_container" style="visibility:hidden; display:none; width:203px; float:left; overflow-x:hidden; margin-right: -1px"> <?php global $JLMS_CONFIG; $JLMS_CONFIG->set('show_lpath_contents_at_the_left', $show_lpath_contents_at_the_left); ?> <?php JLMS_course_lpathstu_html::showLPath_contents($lpath_contents, $quizzes_data); ?> <br /> </div> <div id="left_nav_collapser_container" style="width:7px; float:left; overflow-x:hidden; visibility:hidden; display:none "> <a id="left_nav_collapser" href="javascript:jlms_SwitchContents2();"><img class="collapse_button_maximized_xxx" border="1" width="1" height="1" src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/spacer.png"/></a> </div> <div id="jlms_lpath_completion_msg_container" class="jlms_lpath_completion_message" style="visibility:hidden; display:none; margin-left:210px; width:auto;"> <!--x--> </div> <div id="jlms_lpath_descr" style="margin-left:210px; width:auto;"> <?php $text = JLMS_ShowText_WithFeatures($lpath_data->lpath_description); echo $text; ?> </div> <br /> <?php } else { ?> <div id="jlms_lpath_completion_msg_container" class="jlms_lpath_completion_message" style="visibility:hidden; display:none"> <!--x--> </div> <div id="jlms_lpath_contents_container" style="visibility:hidden; display:none; width:100%"> <?php JLMS_course_lpathstu_html::showLPath_contents($lpath_contents, $quizzes_data); ?> <br /> </div> <div id="jlms_lpath_descr" style="width:100%"> <?php $text = JLMS_ShowText_WithFeatures($lpath_data->lpath_description); echo $text; ?> </div> <?php } JLMS_TMPL::CloseTS(); JLMS_TMPL::CloseMT(); }