Exemplo n.º 1
0
 function show_ZipPack($course_id, $option, &$row_zip, &$lists, $doc_type = 'zip')
 {
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     $Itemid = $JLMS_CONFIG->get('Itemid');
     JLMS_TMPL::OpenMT();
     $hparams = array();
     $toolbar = array();
     if ($doc_type == 'document_contents') {
         $toolbar[] = array('btn_type' => 'archive', 'btn_str' => _JLMS_DOWNLOAD, 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=get_document&course_id={$course_id}&id={$row_zip->doc_id}&force=force"));
     }
     /*$back_link = sefRelToAbs("index.php?option=$option&Itemid=$Itemid&task=documents&id=$course_id");
     		if (isset($lists['lpath_id']) && $lists['lpath_id']) {
     			$back_link = sefRelToAbs("index.php?option=$option&Itemid=$Itemid&task=compose_lpath&course_id=$course_id&id=".$lists['lpath_id']);
     		}*/
     //01.12.2007 - (DEN) - Compatibility for returning from the document view to the doc.tool/course homepage/lpaths list.
     $back_link = 'javascript:window.history.go(-1);';
     $toolbar[] = array('btn_type' => 'back', 'btn_js' => $back_link);
     JLMS_TMPL::ShowHeader('doc', $row_zip->doc_name, $hparams, $toolbar);
     if ($doc_type == 'zip') {
         JLMS_TMPL::OpenTS();
         echo '<iframe id="zip_contents" name="zip_contents" height="600" width="100%" frameborder="0" scrolling="auto" src="' . $JLMS_CONFIG->get('live_site') . "/" . _JOOMLMS_SCORM_PLAYER . "/" . $row_zip->zip_folder . "/" . $row_zip->startup_file . '">' . _JLMS_IFRAMES_REQUIRES . '</iframe>';
         JLMS_TMPL::CloseTS();
     } elseif ($doc_type == 'content') {
         JLMS_TMPL::OpenTS();
         $text = JLMS_ShowText_WithFeatures($row_zip->doc_description);
         echo $text;
         JLMS_TMPL::CloseTS();
     } elseif ($doc_type == 'document_contents') {
         JLMS_TMPL::OpenTS('', ' id="jlms_doc_contents_container"');
         echo $row_zip->doc_description;
         JLMS_TMPL::CloseTS();
     }
     JLMS_TMPL::CloseMT();
 }
    function jlms_room_selecting($course_id, $option, $user_id, $usertype, $recorded_session, $param_book, $en_book, $msg_name, $msg_descr, $msg_access)
    {
        global $my, $JLMS_DB, $Itemid, $JLMS_CONFIG;
        $doc =& JFactory::getDocument();
        $flashcomroot = $JLMS_CONFIG->get('flascommRoot');
        $webRoot = $JLMS_CONFIG->get('live_site');
        $maxclients = $JLMS_CONFIG->get('maxConfClients');
        //include( _JOOMLMS_FRONT_HOME."/includes/flashfix.inc.php" );
        //flashfix_init("components/com_joomla_lms/includes/js" );
        if ($usertype == 1) {
            $recorded_session = "&recorded_session=" . $recorded_session;
        } else {
            $recorded_session = '';
        }
        $room_height = 643;
        if ($JLMS_CONFIG->get('is_trial')) {
            $room_height = 687;
        }
        $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/js/swfobject.js');
        ?>
		<script language="javascript" type="text/javascript">
		<!--//
			function startApp()
			{
				var y= (screen.height/2) - 359;
				var x= (screen.width/2) - 510 ;
				window.open('<?php 
        echo str_replace('&amp;', '&', sefRelToAbs("index.php?tmpl=component&option=com_joomla_lms&Itemid={$Itemid}&task=conference&mode=conference_room&course_id={$course_id}" . $recorded_session));
        ?>
','Conference_room','top='+y+', left='+x+',width=994, height=<?php 
        echo $room_height;
        ?>
, titlebar=0, menubar=no, scrollbars=0, status=1, toolbar=0, resizable=no');
				<?php 
        /* do not replace & with '&amp;' here! */
        ?>
			}
		//-->
		</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        if ($usertype == 1) {
            if ($en_book) {
                $toolbar[] = array('btn_type' => 'booking', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=conference&amp;id={$course_id}&amp;mode=booking"));
            }
        }
        $toolbar[] = array('btn_type' => 'archive', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=conference&amp;id={$course_id}&amp;mode=archive"));
        JLMS_TMPL::ShowHeader('conference', _JLMS_CONFERENCE_TITLE, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
<?php 
        $head_msg = _JLMS_CONFERENCE_WELCOME;
        $head_desc = '';
        if ($en_book) {
            if (!$param_book) {
                $head_desc = $msg_name;
                $head_msg = '';
            } elseif ($param_book) {
                $head_msg = $msg_name;
                $head_desc = $msg_descr;
                if ($msg_access && $usertype == 1) {
                    if ($head_desc) {
                        $head_desc .= "<br /><br />" . $msg_access;
                    } else {
                        $head_desc = $msg_access;
                    }
                }
            }
        }
        ?>
				<td colspan="2"><?php 
        if ($head_msg) {
            echo JLMSCSS::h2($head_msg);
        }
        if ($head_desc) {
            ?>
<div class="joomlalms_sys_message" style="text-align: left;"><?php 
            echo $head_desc;
            ?>
</div><?php 
        }
        ?>
</td>
			</tr>
<?php 
        if ($param_book) {
            ?>
			<tr>
				<td width="280"><br />
				<div id="room_enter">
					<strong><?php 
            echo _JLMS_JS_FLASH_REQUIRES;
            ?>
</strong>
				</div>
				<?php 
            $params = 'course_id=' . $course_id . '&amp;flashcommRoot=' . $flashcomroot . '&amp;maxClients=' . $maxclients . '&amp;master=' . $usertype;
            $doc->addScriptDeclaration('
					// <![CDATA[
					window.addEvent(\'domready\', function(){
						var so = new SWFObject("' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/conference/room_enter_106.swf?' . $params . '", "sotester", "220", "180", "8", "#ffffff");
						so.addVariable("allowScriptAccess", "sameDomain"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
						so.addVariable("wmode", "transparent"); 
						so.addVariable("flashvars", "hello there"); 
						so.addVariable("salign", "t"); 
						so.addVariable("menu", "false");
						so.write("room_enter");
					});
					// ]]>
				');
            ?>
	
				
				<?php 
            /*$params = 'course_id='.$course_id.'&amp;flashcommRoot='.$flashcomroot.'&amp;maxClients='.$maxclients.'&amp;master='.$usertype;
            		echo flashfix_html( 'components/com_joomla_lms/includes/conference/room_enter.swf?'.$params, 220, 180,	array( 'allowScriptAccess'=>'sameDomain', 'wmode'=>'transparent', 'bgcolor'=>'#ffffff',"flashvars"=> "hello there", 'salign'=>'t', 'menu'=>'false') // additional parameters
            		);*/
            ?>
	
				</td>
				<td align="left">
				<?php 
            $text = JLMS_ShowText_WithFeatures($JLMS_CONFIG->get('conf_description'));
            echo $text;
            ?>
				</td>
			</tr>
	<?php 
        }
        ?>
		</table>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function showCourseDetails($id, &$row, &$params, $option, &$lists, $view_type = 'view')
    {
        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
        global $Itemid, $my, $JLMS_CONFIG, $JLMS_SESSION;
        $count_modules = 0;
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) {
            if ($params->get('homework_view') && $JLMS_CONFIG->get('course_homework')) {
                $count_modules++;
            }
            if ($params->get('agenda_view')) {
                $count_modules++;
            }
            if ($params->get('dropbox_view')) {
                $count_modules++;
            }
            if ($params->get('mailbox_view')) {
                $count_modules++;
            }
            if ($params->get('certificates_view')) {
                $count_modules++;
            }
            if ($params->get('latest_forum_posts_view')) {
                $count_modules++;
            }
            if ($count_modules) {
                ?>
		
		<?php 
            }
        }
        JLMS_TMPL::OpenMT();
        $hparams = array();
        if ($view_type == 'view') {
            $hparams['simple_menu'] = true;
            $hparams['sys_msg'] = _JLMS_MESSAGE_SHORT_COURSE_INFO;
        }
        if ($view_type == 'offerWL') {
            $hparams['sys_msg'] = _JLMS_MESSAGE_OFFER_JOIN_WAITING_LIST;
        } elseif ($view_type == 'inWL') {
            $hparams['sys_msg'] = _JLMS_MESSAGE_ALREADY_IN_WATING_LIST;
            $JLMS_CONFIG->set('enableterms', 0);
        }
        if ($JLMS_SESSION->get('joomlalms_just_joined', 0)) {
            if (isset($hparams['sys_msg'])) {
                $hparams['sys_msg'] = $JLMS_SESSION->get('joomlalms_sys_message', '') . '<br />' . $hparams['sys_msg'];
            } else {
                $hparams['sys_msg'] = $JLMS_SESSION->get('joomlalms_sys_message', '');
            }
            $JLMS_SESSION->clear('joomlalms_just_joined');
        }
        $toolbar = array();
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->CheckPermissions('course', 'manage_settings')) {
            $toolbar[] = array('btn_type' => 'newtopic', 'btn_js' => "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=add_topic&amp;id={$id}", 'btn_str' => _JLMS_TOPIC_T_ADD);
            $toolbar[] = array('btn_type' => 'settings', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=settings&amp;id={$id}"));
            $toolbar[] = array('btn_type' => 'edit', 'btn_js' => ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=edit_course&amp;id={$id}&amp;is_inside=1")));
        } elseif ($view_type == 'view' || $view_type == 'offerWL' || $view_type == 'inWL') {
            $hparams['simple_menu'] = true;
            if ($my->id && $row->self_reg && JLMS_checkCourseGID($my->id, $row->gid)) {
                //check that enrollment is available and user gid is allowed
                if ($row->paid) {
                    if ($view_type != 'inWL') {
                        $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:submitbutton('subscription','');");
                    }
                } else {
                    if ($view_type != 'inWL') {
                        $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:submitbutton('course_subscribe','');");
                    }
                }
                if ($view_type != 'inWL') {
                    $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses"));
                } else {
                    $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses"));
                }
                $hparams['toolbar_position'] = 'center';
                $html_code_before_toolbar = "\n\t\t\t\t<form action='" . sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}") . "' method='post' name='adminForm_enroll'>\n\t\t\t\t<script language='javascript' type='text/javascript'>\n\t\t\t\t\t<!--\n\n\t\t\t\t\tfunction submitbutton(pressbutton) {\n\t\t\t\t\t\tvar form = document.adminForm_enroll;";
                if ($JLMS_CONFIG->get('enableterms') && !$row->paid) {
                    $html_code_before_toolbar .= "\n\t\t\t\t\t\tif( (pressbutton == 'course_subscribe') && (document.getElementById('jlms_agreement').checked == false) ){\n\t\t\t\t\t\t\talert( '" . addslashes(_JLMS_AGREEMENT) . "' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tform.task.value = pressbutton;\n\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t";
                } else {
                    $html_code_before_toolbar .= "\n\t\t\t\t\t\t\tform.task.value = pressbutton;\n\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t";
                }
                $html_code_before_toolbar .= "\n\t\t\t\t\t\t\t}\n\t\t\t\t\t//-->\n\t\t\t\t\t</script>\n\t\t\t\t\t";
                if ($JLMS_CONFIG->get('enableterms') && !$row->paid) {
                    $html_code_before_toolbar .= "\n\t\t\t\t\t<table align='center' class='jlms_table_no_borders'><tr><td width='20'>\n\t\t\t\t\t\t<input type='checkbox' name='agreement' id='jlms_agreement' />\n\t\t\t\t\t</td><td style='text-align:left'>\n\t\t\t\t\t\t<label for='jlms_agreement'>" . $JLMS_CONFIG->get('jlms_terms') . "</label>\n\t\t\t\t\t</td></tr></table>\n\t\t\t\t\t";
                }
                if ($row->paid) {
                    $html_code_before_toolbar .= "\n\t\t\t\t\t\t<input type='hidden' name='option' value='" . $option . "' />\n\t\t\t\t\t\t<input type='hidden' name='Itemid' value='" . $Itemid . "' />\n\t\t\t\t\t\t<input type='hidden' name='task' value='subscription' />\n\t\t\t\t\t\t<input type='hidden' name='cid[]' value='" . $row->id . "' />\n\t\t\t\t\t\t<input type='hidden' name='state' value='0' />\n\t\t\t\t\t\t</form>\n\t\t\t\t\t";
                } else {
                    $html_code_before_toolbar .= "\n\t\t\t\t\t\t<input type='hidden' name='option' value='" . $option . "' />\n\t\t\t\t\t\t<input type='hidden' name='Itemid' value='" . $Itemid . "' />\n\t\t\t\t\t\t<input type='hidden' name='task' value='courses' />\n\t\t\t\t\t\t<input type='hidden' name='id' value='" . $row->id . "' />\n\t\t\t\t\t\t<input type='hidden' name='state' value='0' />\n\t\t\t\t\t\t</form>\n\t\t\t\t\t";
                }
                $hparams['html_code_before_toolbar'] = $html_code_before_toolbar;
            } else {
                $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses"));
            }
        } elseif ($view_type == 'future_course') {
            $hparams['simple_menu'] = true;
            if ($row->publish_start) {
                $hparams['sys_msg'] = str_replace('{date}', JLMS_dateToDisplay($row->start_date), _JLMS_COURSE_IS_PENDING_MSG);
            } else {
                $query = "SELECT start_date FROM #__lms_users_in_groups WHERE course_id = " . $row->id . " AND user_id = " . $my->id;
                global $JLMS_DB;
                $JLMS_DB->SetQuery($query);
                $user_start = $JLMS_DB->LoadResult();
                $hparams['sys_msg'] = str_replace('{date}', JLMS_dateToDisplay($user_start), _JLMS_COURSE_USER_IS_PENDING);
            }
        }
        JLMS_TMPL::ShowHeader('course', _JLMS_COURSES_DETAILS, $hparams, $toolbar);
        $_JLMS_PLUGINS->loadBotGroup('system');
        $plugin_args = array();
        $plugin_args[] = $id;
        $_JLMS_PLUGINS->trigger('onAboveCourseDetailsPage', $plugin_args);
        if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff() && $count_modules) {
            $custom_sections = array();
            if ($JLMS_CONFIG->get('course_homework') && $params->get('homework_view')) {
                $txt = JLMS_showMyHomeWork($option, $Itemid, $lists['my_hw']);
                $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"');
            }
            if ($params->get('agenda_view')) {
                $txt = JLMS_showMyAgenda($option, $Itemid, $lists['my_announcements']);
                $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"');
            }
            if ($params->get('dropbox_view')) {
                $txt = JLMS_showMyDropBox($option, $Itemid, $lists['my_dropbox'], $lists);
                $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"');
            }
            if ($params->get('mailbox_view')) {
                $txt = JLMS_showMyMailBox($option, $Itemid, $lists['my_mailbox'], $lists);
                $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"');
            }
            if ($params->get('certificates_view')) {
                $txt = JLMS_showMyCertificates($option, $Itemid, $lists['my_certificates'], $lists);
                $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"');
            }
            if ($JLMS_CONFIG->get('plugin_forum') && $params->get('latest_forum_posts_view')) {
                $txt = JLMS_showLatestForumPosts($option, $Itemid, $lists['latest_forum_posts'], $lists);
                $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"');
            }
            JLMS_TMPL::ShowCustomSection($custom_sections, 1, 1);
        }
        $show_description = true;
        if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) {
            if (!$params->get('show_description', 1)) {
                $show_description = false;
            }
        }
        if ($show_description) {
            $text = JLMS_ShowText_WithFeatures($row->course_description);
            JLMS_TMPL::ShowSection($text);
        }
        //$_JLMS_PLUGINS->loadBotGroup('system');
        $plugin_args = array();
        $plugin_args[] = $id;
        $_JLMS_PLUGINS->trigger('onBelowCourseDescription', $plugin_args);
        /*Fix short course description + all comments*/
        if (isset($lists['short']) && !$lists['short']) {
            if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) {
                //show topics of the course
                global $JLMS_DB;
                $query = "SELECT count(*) FROM #__lms_topics WHERE course_id = {$id}";
                $JLMS_DB->SetQuery($query);
                $is_any_topic = $JLMS_DB->LoadResult();
                if ($is_any_topic) {
                    JLMS_TMPL::OpenTS();
                    $course = new JLMS_Course_HomePage($id);
                    $course->listTopics();
                    JLMS_TMPL::CloseTS();
                }
            }
        }
        //$_JLMS_PLUGINS->loadBotGroup('system');
        $plugin_args = array();
        $plugin_args[] = $id;
        $_JLMS_PLUGINS->trigger('onBelowCourseDetailsPage', $plugin_args);
        JLMS_TMPL::CloseMT();
    }
 function show_LPContent($course_id, $lpath_id, $option, &$row_lp, &$lists, $doc_type = 'content')
 {
     global $Itemid;
     JLMS_TMPL::OpenMT();
     $hparams = array();
     $toolbar = array();
     $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=compose_lpath&amp;course_id={$course_id}&amp;id={$lpath_id}"));
     JLMS_TMPL::ShowHeader('lpath', $row_lp->step_name, $hparams, $toolbar);
     if ($doc_type == 'content') {
         JLMS_TMPL::OpenTS();
         $text = JLMS_ShowText_WithFeatures($row_lp->step_description);
         echo $text;
         JLMS_TMPL::CloseTS();
     }
     JLMS_TMPL::CloseMT();
 }
Exemplo n.º 5
0
    function showMainPage_front($option, &$lists, &$my_courses, &$my_dropbox, &$my_homework, &$my_announcements, &$my_mailbox, &$my_certificates, &$latest_forum_posts)
    {
        global $Itemid, $JLMS_CONFIG;
        $JLMS_ACL =& JLMSFactory::getACL();
        ?>
		
		<table width="100%" cellpadding="0" cellspacing="3" border="0" id="jlms_mainarea" style="border-collapse: separate">
		<?php 
        if ($JLMS_CONFIG->get('lofe_show_top', true)) {
            ?>
			<tr>
				<td colspan="2" align="right"><?php 
            JLMS_showTopMenu_simple($option);
            ?>
</td>
			</tr>
		<?php 
        }
        ?>
			<tr>
				<td colspan="2" align="left">
				<?php 
        echo JLMS_ShowText_WithFeatures($lists['homepage_text']);
        ?>
<br /><br />
				</td>
			</tr>
			<?php 
        global $JLMS_DB, $my;
        if (class_exists('Jfactory')) {
            $user = JLMSFactory::getUser();
            $my->id = $user->id;
        }
        $is_ceo = $JLMS_ACL->isStaff();
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_CONFIG->get('show_statistics_reports')) {
            if ($JLMS_ACL->isTeacher()) {
                // user is a teacher - he can see reports module
            } else {
                if ($is_ceo) {
                    $JLMS_CONFIG->set('show_statistics_reports', true);
                } else {
                    $JLMS_CONFIG->set('show_statistics_reports', false);
                }
            }
        }
        $on_modules = false;
        if ($JLMS_CONFIG->get('frontpage_announcements') || $JLMS_CONFIG->get('frontpage_dropbox') || $JLMS_CONFIG->get('frontpage_homework') || $JLMS_CONFIG->get('frontpage_mailbox') || $JLMS_CONFIG->get('frontpage_certificates') || $JLMS_CONFIG->get('plugin_forum') || $JLMS_CONFIG->get('show_statistics_reports') || $JLMS_CONFIG->get('frontpage_notices_teacher')) {
            $on_modules = true;
        }
        $td_width = "100%";
        $colspan = ' colspan="2"';
        if ($on_modules) {
            $td_width = "50%";
            $colspan = '';
        }
        ?>
			<tr>
				<td width="<?php 
        echo $td_width;
        ?>
" valign="top"<?php 
        echo $colspan;
        ?>
>
					<?php 
        if ($JLMS_CONFIG->get('frontpage_courses_tree', 1) && $JLMS_CONFIG->get('frontpage_courses')) {
            joomla_lms_html::echoMyCourses_tree($option, $Itemid, $my_courses, $lists);
        } elseif ($JLMS_CONFIG->get('frontpage_courses')) {
            joomla_lms_html::echoMyCourses($option, $Itemid, $my_courses);
        } else {
            echo '&nbsp;';
        }
        echo '<br />';
        if ($JLMS_CONFIG->get('frontpage_allcourses', 1)) {
            ?>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist', 'jlms_homepage_list');
            ?>
">
						<tr><<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_HOME_COURSES_LIST;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
></tr>
						<tr class='<?php 
            echo JLMSCSS::_('sectiontableentry1');
            ?>
'><td><a href="<?php 
            echo sefRelToabs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=courses");
            ?>
" title="<?php 
            echo _JLMS_HOME_COURSES_LIST_HREF;
            ?>
"><?php 
            echo _JLMS_HOME_COURSES_LIST_HREF;
            ?>
</a></td></tr>
					</table>
					<?php 
        }
        ?>
				</td>
				<?php 
        if ($on_modules) {
            ?>
				<td width="50%" valign="top">
				<?php 
            if ($JLMS_CONFIG->get('frontpage_announcements')) {
                joomla_lms_html::echoMyAgenda($option, $Itemid, $my_announcements);
                echo '<br />';
            }
            if ($JLMS_CONFIG->get('frontpage_dropbox')) {
                joomla_lms_html::echoMyDropBox($option, $Itemid, $my_dropbox, $lists);
                echo '<br />';
            }
            if ($JLMS_CONFIG->get('frontpage_homework')) {
                joomla_lms_html::echoMyHomeWork($option, $Itemid, $my_homework);
                echo '<br />';
            }
            if ($JLMS_CONFIG->get('frontpage_mailbox')) {
                joomla_lms_html::echoMyMailBox($option, $Itemid, $my_mailbox, $lists);
                echo '<br />';
            }
            if ($JLMS_CONFIG->get('frontpage_certificates')) {
                joomla_lms_html::echoMyCertificates($option, $Itemid, $my_certificates, $lists);
                echo '<br />';
            }
            if ($JLMS_CONFIG->get('plugin_forum') && $JLMS_CONFIG->get('frontpage_latest_forum_posts')) {
                joomla_lms_html::echoLatestForumPosts($option, $Itemid, $latest_forum_posts, $lists);
                echo '<br />';
            }
            if ($JLMS_CONFIG->get('show_statistics_reports')) {
                joomla_lms_html::echoMyReports($option, $Itemid);
                echo '<br />';
            }
            if ($JLMS_CONFIG->get('frontpage_notices_teacher')) {
                joomla_lms_html::echoMyNotices($option, $Itemid, $lists['my_notices']);
            }
            ?>
				</td>
				<?php 
        }
        ?>
			</tr>
		</table>
	<?php 
    }
function JQ_PrintResultForPDF($sid)
{
    global $JLMS_DB;
    $str = "";
    $query = "SELECT sq.*, q.*, u.* FROM #__lms_quiz_r_student_quiz AS sq, #__lms_quiz_t_quiz AS q, #__users AS u" . "\n WHERE sq.c_id = '" . $sid . "' AND sq.c_quiz_id = q.c_id AND sq.c_student_id = u.id";
    $JLMS_DB->SetQuery($query);
    $info = $JLMS_DB->LoadAssocList();
    $info = $info[0];
    $quiz_id = $info['c_quiz_id'];
    $query = "SELECT quest_id FROM #__lms_quiz_r_student_quiz_pool WHERE start_id = " . $sid;
    $JLMS_DB->SetQuery($query);
    $stu_quests = $JLMS_DB->loadResultArray();
    if (count($stu_quests)) {
        $stu_quests_str = implode(',', $stu_quests);
        $query = "SELECT sum(c_point) AS total_score FROM #__lms_quiz_t_question WHERE c_id IN ({$stu_quests_str})";
        $JLMS_DB->SetQuery($query);
        $total = $JLMS_DB->LoadResult();
    } else {
        $query = "SELECT sum(c_point) AS total_score FROM #__lms_quiz_t_question WHERE c_quiz_id = '" . $quiz_id . "'";
        $JLMS_DB->SetQuery($query);
        $total = $JLMS_DB->LoadResult();
    }
    $passing_score_suffix = '';
    if (isset($info['c_passing_score']) && $info['c_passing_score']) {
        $pass_score = $info['c_passing_score'] * $total / 100;
        $pass_score_ceiled = ceil($pass_score);
        //TODO: add new language variable for 'point/points' ; 'ochko/ochka/ochkov'
        $points_str = 'points';
        $passing_score_suffix = ' (' . $pass_score_ceiled . ' ' . $points_str . ')';
    }
    $str .= "<strong>Quiz Title: </strong>" . $info['c_title'] . "<br>";
    $str .= "<strong>User Name: </strong>" . $info['username'] . "<br>";
    $str .= "<strong>Name: </strong>" . $info['name'] . "<br>";
    $str .= "<strong>User Email: </strong>" . $info['email'] . '<br>';
    $str .= "<strong>User Score: </strong>" . $info['c_total_score'] . "<br>";
    $str .= "<strong>Total Score: </strong>" . $total . "<br>";
    $str .= "<strong>Passing Score: </strong>" . $info['c_passing_score'] . "%" . $passing_score_suffix . "<br>";
    $tot_min = floor($info['c_total_time'] / 60);
    $tot_sec = $info['c_total_time'] - $tot_min * 60;
    $str .= "The user spent <strong>" . str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT) . "</strong> time taking the quiz <br>";
    if ($info['c_passed'] == 1) {
        $str .= $info['name'] . " has <strong>passed</strong> the quiz<br>";
    } else {
        $str .= $info['name'] . " has <strong>not passed</strong> the quiz<br>";
    }
    /*Integration Plugin Percentiles*/
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $_JLMS_PLUGINS->loadBotGroup('system');
    $data = new stdClass();
    $data->course_id = $info['course_id'];
    $data->quiz_id = $info['c_quiz_id'];
    $data->user_id = $info['c_student_id'];
    if ($out_plugin = $_JLMS_PLUGINS->trigger('onQuizFinish', array($data))) {
        if (count($out_plugin)) {
            $percentiles = $out_plugin[0];
            $percent = $percentiles->percent . '%';
            $str .= "<strong>Percentiles: </strong>" . $percent . "<br>";
        }
    }
    /*Integration Plugin Percentiles*/
    $query = "SELECT lqrsq.c_id FROM #__lms_quiz_r_student_question as lqrsq, #__lms_quiz_t_question as lqtq" . "\n WHERE 1" . "\n AND lqrsq.c_stu_quiz_id = '" . $sid . "'" . "\n AND lqtq.c_id = lqrsq.c_question_id" . "\n ORDER BY lqtq.ordering";
    $JLMS_DB->SetQuery($query);
    $info = $JLMS_DB->LoadObjectList();
    $total = count($info);
    $tr = array();
    $i = 0;
    for ($k1 = 0; $k1 < $total; $k1++) {
        $data = JQ_GetResults($info[$k1]->c_id);
        if (isset($data['c_question'])) {
            $tr[$i] = array();
            //$as = $tr[$i];
            $tr[$i]['#'] = $i + 1;
            $tr[$i]['Questions'] = trim(strip_tags(JLMS_ShowText_WithFeatures($data['c_question'])));
            //."[".$data['c_score'].'/'.$data['c_point']."]";
            $type = $data['c_type'];
            $answer = '';
            $text_answer = '';
            if ($type == 1 || $type == 2 || $type == 3 || $type == 12 || $type == 13) {
                for ($j = 0, $k = 'a'; $j < count($data['c_choice']); $j++, $k++) {
                    if ($data['c_choice'][$j]['c_choice_id']) {
                        $answer .= $k;
                    }
                    $text_answer .= "<strong>{$k})</strong> " . $data['c_choice'][$j]['c_choice'] . "<br />";
                }
                $text_answer .= '<br />Answer: ' . $answer;
            } elseif ($type == 4 || $type == 5) {
                for ($j = 0, $k = 'a'; $j < count($data['c_matching']); $j++, $k++) {
                    $text_answer .= "<strong>{$k})</strong> " . $data['c_matching'][$j]['c_left_text'] . " ";
                    $text_answer .= "&nbsp;&nbsp;" . $data['c_matching'][$j]['c_sel_text'] . "<br />";
                }
            } elseif ($type == 6) {
                $text_answer .= $data['c_blank']['c_answer'];
            } elseif ($type == 7) {
                if ($data['c_score']) {
                    $answer = 'right';
                } else {
                    $answer = 'wrong';
                }
                $text_answer .= $answer;
            } elseif ($type == 8) {
                $text_answer .= $data['c_survey']['c_answer'];
            } elseif ($type == 9) {
                for ($j = 0; $j < count($data['c_scale']); $j++) {
                    $mpz = $data['c_scale'][$j];
                    $text_answer .= "<strong>" . $mpz->fq . "</strong> - ";
                    $text_answer .= $mpz->fa . '<br>';
                }
            } elseif ($type == 10) {
            } elseif ($type == 11) {
                for ($j = 0, $k = 'a'; $j < count($data['c_matching']); $j++, $k++) {
                    $text_answer .= "<strong>{$k})</strong>&nbsp;" . $data['c_matching'][$j]['c_left_text'] . "";
                    $text_answer .= "&nbsp;&nbsp;" . $data['c_matching'][$j]['c_sel_text'] . "<br />";
                }
            }
            $tr[$i]['Answers'] = $text_answer;
            $tr[$i]['Points'] = $data['c_score'] . ' / ' . $data['c_point'];
            $i++;
        }
    }
    $str .= "";
    /*
    // convert UTF symbols to ISO (Joomla 1.5.x only)
    if (class_exists('JFactory')) {
    	global $JLMS_CONFIG;
    	$cur_lang = strtolower($JLMS_CONFIG->get('default_language', 'english'));
    	$sup_iso_languages_pre = array('english', 'danish', 'french', 'german', 'italian', 'norwegian', 'spanish', 'dutch');
    	$sup_iso_languages = $JLMS_CONFIG->get('iso88591_compat_languages', $sup_iso_languages_pre);
    	if (in_array($cur_lang, $sup_iso_languages) || $cur_lang ==  "english" ) {
    		if (function_exists('utf8_decode')) {
    			$do_utf = true;
    			$utf_method = 'utf8_encode';
    			$str = utf8_decode($str);
    			for ($ii = 0; $ii <= $i; $ii ++ ) {
    				if (isset($tr[$ii]['Answers'])) {
    					$tr[$ii]['Answers'] = utf8_decode($tr[$ii]['Answers']);
    				}
    				if (isset($tr[$ii]['Questions'])) {
    					$tr[$ii]['Questions'] = utf8_decode($tr[$ii]['Questions']);
    				}
    			}
    		}
    	}
    }
    */
    $str_arr->header = $str;
    $str_arr->table = $tr;
    $str_arr->colsWidths = array('#' => 10, 'Answers' => 40, 'Questions' => 40, 'Points' => 10);
    //	echo '<pre>';
    //	print_r($str_arr);
    //	echo '</pre>';
    //	die;
    return $str_arr;
}
    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&amp;Itemid=$Itemid&amp;task=show_lpath_nojs&amp;course_id=$course_id&amp;id=$lpath_id&amp;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();
    }
    function viewHWResult($row, $option, &$lists)
    {
        global $JLMS_CONFIG;
        $Itemid = $JLMS_CONFIG->get('Itemid');
        ?>
	<script language="javascript" type="text/javascript">
	<!--//--><![CDATA[//><!--
		function submitbutton( pressbutton ) {
			var form=document.adminForm;
							
			form.task.value = pressbutton;
			form.submit();				
		}
		
		function trim( str ) {
 		   return str.replace(/^\s+|\s+$/g,"");
	    }
  //--><!]]>
  </script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('hw_save_result');");
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => "javascript:submitbutton('hw_stats');");
        JLMS_TMPL::ShowHeader('homework', $row->hw->hw_name, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>

		<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
				<tr>
					<td width="50%" align="left" style="text-align:left "><br />
						<table align="left" width="80%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_UI_USERNAME;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo $row->user->username;
        ?>
</td>
						</tr>
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_UI_NAME;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo $row->user->name;
        ?>
</td>
						</tr>
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_UI_EMAIL;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo $row->user->email;
        ?>
</td>
						</tr>
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_UI_GROUP;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo $row->user->group;
        ?>
</td>
						</tr>						
						</table>
					</td>
					<td width="50%" align="left" style="text-align:left "><br />
					<table align="left" width="80%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_HW_HOMEWORK_DATE;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo JLMS_dateToDisplay($row->hw->post_date);
        ?>
</td>
						</tr>
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_HW_HOMEWORK_ENDDATE;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo JLMS_dateToDisplay($row->hw->end_date);
        ?>
</td>
						</tr>
						<tr>
							<td align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_HW_DATE_OF_COMPLETING;
        ?>
</td>
							<td align="left" style="text-align:left ">
								<?php 
        echo JLMS_dateToDisplay($row->hw_date, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s');
        ?>
							</td>
						</tr>
						</table>
					</td>
				</tr>										
				<tr>
					<td colspan="2"><br />
						<?php 
        echo JLMS_ShowText_WithFeatures($row->hw->hw_description);
        ?>
					</td>
				</tr>
				<tr>
					<td colspan="2" height="20"><br /></td>
				</tr>
				<?php 
        if ($row->hw->activity_type != _ACTIVITY_TYPE_OFFLINE) {
            ?>
				<tr>
					<td><b><?php 
            echo _JLMS_HW_LEARNERS_SUBS;
            ?>
</b></td>
					<td>						
						<?php 
            if ($row->hw->activity_type == _ACTIVITY_TYPE_WRITE) {
                echo $row->write_text;
            } else {
                if ($row->hw->activity_type == _ACTIVITY_TYPE_UPLOAD && $row->file) {
                    echo '<a href="' . sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=hw_downloadfile&hw_id={$row->hw_id}&course_id={$row->course_id}&file_id={$row->file_id}&user_id=" . $row->user_id) . '" >' . $row->file->file_name . "</a>";
                }
            }
            ?>
					</td>					
				</tr>
				<tr>
					<td colspan="2" height="20"><br /></td>
				</tr>
				<?php 
        }
        ?>
				<tr>
					<td><b><?php 
        echo _JLMS_HW_GRADE_THIS_ACTIVITY;
        ?>
</b></td>
					<td>
						<?php 
        echo $lists['grade'];
        ?>
					</td>					
				</tr>
				<tr>
					<td colspan="2" height="20"><br /></td>
				</tr>
				<tr>
					<td colspan="2">
					<?php 
        echo _JLMS_COMMENTS;
        ?>
					</td>
				</tr>								
				<tr>
					<td colspan="2">
					<?php 
        JLMS_editorArea('editor1', $row->comments, 'comments', '100%', '250', '40', '10');
        ?>
					</td>
				</tr>					
			</table>		
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="" />			
			<input type="hidden" name="course_id" value="<?php 
        echo $row->course_id;
        ?>
" />
			<input type="hidden" name="user_id" value="<?php 
        echo $row->user_id;
        ?>
" />
			<input type="hidden" name="hw_id" value="<?php 
        echo $row->hw_id;
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
Exemplo n.º 9
0
    function JQ_GetQuestData_review($q_data, $jq_language, $user_answer, $show_correct, $show_correct_answer, $q_survey)
    {
        global $JLMS_DB, $JLMS_CONFIG, $option, $Itemid;
        $ret_str = '';
        $ret_add_script = '';
        $cur_template = 'joomlaquiz_lms_template';
        if ($cur_template) {
            require_once dirname(__FILE__) . '/templates/' . $cur_template . '/jq_template.php';
            $tmp = JLMS_ShowText_WithFeatures($q_data->c_question, true, true);
            $ret_add_script .= $tmp['js'];
            $q_description = JLMS_ShowText_WithFeatures($q_data->c_question, true);
            $ret_str = "\t" . '<quest_data><![CDATA[<div>' . $q_description . '</div>]]></quest_data>' . "\n";
            $ret_str .= "\t" . '<quest_type>' . $q_data->c_type . '</quest_type>' . "\n";
            $ret_str .= "\t" . '<quest_id>' . $q_data->old_c_id . '</quest_id>' . "\n";
            //$q_data->c_id
            $ret_str .= "\t" . '<prev_quest_id>' . (isset($q_data->prev_c_id) && $q_data->prev_c_id ? $q_data->prev_c_id : 0) . '</prev_quest_id>' . "\n";
            //$q_data->c_id
            $ret_str .= "\t" . '<quest_score>' . $q_data->c_point . '</quest_score>' . "\n";
            switch ($q_data->c_type) {
                case 1:
                case 12:
                    $sql_var = '';
                    $sql_table = '';
                    $sql_where = '';
                    if ($q_data->c_type == 12) {
                        $sql_var .= ', b.imgs_name';
                        $sql_table = ', #__lms_quiz_images as b';
                        $sql_where .= ' AND a.c_choice = b.imgs_id';
                    }
                    $query = "SELECT a.c_id as value, a.c_choice as text, a.c_right, '1' as c_review" . $sql_var . " FROM #__lms_quiz_t_choice as a" . $sql_table . " WHERE a.c_question_id = '" . $q_data->c_id . "'" . $sql_where . " ORDER BY a.ordering";
                    $JLMS_DB->SetQuery($query);
                    $choice_data = $JLMS_DB->LoadObjectList();
                    $qhtml = '';
                    if ($show_correct_answer) {
                        $qhtml = JoomlaQuiz_template_class::JQ_createMChoice($choice_data, $q_data->c_type);
                    }
                    $quhtml = '';
                    if ($show_correct || $q_survey) {
                        for ($i = 0; $i < count($choice_data); $i++) {
                            if ($choice_data[$i]->value == $user_answer) {
                                $choice_data[$i]->c_right = 1;
                            } else {
                                $choice_data[$i]->c_right = 0;
                            }
                        }
                        $quhtml .= '<div style="width:100%;"><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table width="100%" align="left" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>';
                        $quhtml .= JoomlaQuiz_template_class::JQ_createMChoice($choice_data, $q_data->c_type);
                        $quhtml .= '</td></tr></table><div style="clear: both;"><!-- --></div></div>';
                    }
                    if ($q_survey) {
                        $qhtml = '';
                    }
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div style=\'width:100%;\'><table width="100%" align="left" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td><form name=\'quest_form\'>' . $qhtml . '</form></td></tr></table><div style="clear: both;"><!-- --></div></div>' . $quhtml . ']]></quest_data_user>' . "\n";
                    break;
                case 3:
                    $query = "SELECT c_id as value, c_choice as text, c_right, '1' as c_review FROM #__lms_quiz_t_choice WHERE c_question_id = '" . $q_data->c_id . "' ORDER BY ordering";
                    $JLMS_DB->SetQuery($query);
                    $choice_data = $JLMS_DB->LoadObjectList();
                    $i = 0;
                    while ($i < count($choice_data)) {
                        if ($choice_data[$i]->text == 'true' || $choice_data[$i]->text == 'True') {
                            $choice_data[$i]->text = $jq_language['quiz_simple_true'];
                        } elseif ($choice_data[$i]->text == 'false' || $choice_data[$i]->text == 'False') {
                            $choice_data[$i]->text = $jq_language['quiz_simple_false'];
                        }
                        $i++;
                    }
                    $qhtml = '';
                    if ($show_correct_answer) {
                        $qhtml = JoomlaQuiz_template_class::JQ_createMChoice($choice_data, $q_data->c_type);
                    }
                    $quhtml = '';
                    if ($show_correct) {
                        for ($i = 0; $i < count($choice_data); $i++) {
                            if ($choice_data[$i]->value == $user_answer) {
                                $choice_data[$i]->c_right = 1;
                            } else {
                                $choice_data[$i]->c_right = 0;
                            }
                        }
                        $quhtml .= '<div style="width:100%;"><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table align="left" width="100%" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>';
                        $quhtml .= JoomlaQuiz_template_class::JQ_createMChoice($choice_data, $q_data->c_type);
                        $quhtml .= '</td></tr></table><div style="clear: both;"><!-- --></div></div>';
                    }
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div style=\'width:100%;\'><table width="100%" align="left" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td><form name=\'quest_form\'>' . $qhtml . '</form></td></tr></table></div>' . $quhtml . ']]></quest_data_user>' . "\n";
                    break;
                case 2:
                case 13:
                    $sql_var = '';
                    $sql_table = '';
                    $sql_where = '';
                    if ($q_data->c_type == 13) {
                        $sql_var .= ', b.imgs_name';
                        $sql_table = ', #__lms_quiz_images as b';
                        $sql_where .= ' AND a.c_choice = b.imgs_id';
                    }
                    $query = "SELECT a.c_id as value, a.c_choice as text, a.c_right, '1' as c_review" . $sql_var . " FROM #__lms_quiz_t_choice as a" . $sql_table . " WHERE a.c_question_id = '" . $q_data->c_id . "'" . $sql_where . " ORDER BY a.ordering";
                    $JLMS_DB->SetQuery($query);
                    $choice_data = $JLMS_DB->LoadObjectList();
                    $qhtml = '';
                    if ($show_correct_answer) {
                        $qhtml = JoomlaQuiz_template_class::JQ_createMResponse($choice_data, $q_data->c_type);
                    }
                    if ($show_correct || $q_survey) {
                        for ($i = 0; $i < count($choice_data); $i++) {
                            if (in_array($choice_data[$i]->value, $user_answer)) {
                                $choice_data[$i]->c_right = 1;
                            } else {
                                $choice_data[$i]->c_right = 0;
                            }
                        }
                        $quhtml = '';
                        $quhtml .= '<div style="width:100%;"><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table width="100%" align="left" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>';
                        $quhtml .= JoomlaQuiz_template_class::JQ_createMResponse($choice_data, $q_data->c_type);
                        $quhtml .= '</td></tr></table></div>';
                    }
                    if ($q_survey) {
                        $qhtml = '';
                    }
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div style=\'width:100%;\'><table width="100%" align="left" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td><form name=\'quest_form\'>' . $qhtml . '</form></td></tr></table></div>' . $quhtml . ']]></quest_data_user>' . "\n";
                    break;
                case 4:
                    $query = "SELECT *, c_right_text as c_val FROM #__lms_quiz_t_matching WHERE c_question_id = '" . $q_data->c_id . "'" . "\n ORDER BY ordering";
                    $JLMS_DB->SetQuery($query);
                    $match_data = $JLMS_DB->LoadObjectList();
                    $shuffle_match = $match_data;
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div>' . "\n";
                    if ($show_correct_answer) {
                        $ret_str .= '<div style=\'width:100%;text-align:center\'><table id=\'quest_table\' align=\'center\' cellpadding="10" cellspacing="0" border="0" class="jlms_table_no_borders">';
                        for ($i = 0, $n = count($match_data); $i < $n; $i++) {
                            $ret_str .= '<tr><td style="padding:10px"><div id=\'cdiv_' . ($i + 1) . '\' class=\'jq_drop_pre\' align="center">' . $match_data[$i]->c_left_text . '</div></td><td style="padding:10px"><div id=\'ddiv_' . ($i + 1) . '\' class=\'jq_drag_pre\'>' . $shuffle_match[$i]->c_right_text . '</div></td></tr>';
                        }
                        $ret_str .= '</table></div>' . "\n";
                    }
                    if ($show_correct) {
                        $ret_str .= '<div style=\'width:100%;text-align:center\'><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table id=\'quest_table2\' align="center" cellpadding="10" cellspacing="0" border="0" class="jlms_table_no_borders">';
                        for ($i = 0, $n = count($match_data); $i < $n; $i++) {
                            $ret_str .= '<tr><td style="padding:10px"><div id=\'cdiv_' . ($i + 1) . '\' class=\'jq_drop_pre\'>' . $match_data[$i]->c_left_text . '</div></td><td style="padding:10px"><div id=\'ddiv_' . ($i + 1) . '\' class=\'jq_drag_pre\'>' . $user_answer[$i] . '</div></td></tr>';
                        }
                        $ret_str .= '</table></div>' . "\n";
                    }
                    $ret_str .= '<form name=\'quest_form\'></form></div>]]></quest_data_user>' . "\n";
                    break;
                case 5:
                    $query = "SELECT *, c_right_text as c_val FROM #__lms_quiz_t_matching WHERE c_question_id = '" . $q_data->c_id . "'" . "\n ORDER BY ordering";
                    $JLMS_DB->SetQuery($query);
                    $match_data = $JLMS_DB->LoadObjectList();
                    $shuffle_match = $match_data;
                    $shuffle_match1 = array();
                    $shuffle_match1[0]->c_right_text = _JLMS_QUIZ_SHOW_SELECT_YOUR_ANSWER;
                    $shuffle_match1[0]->c_val = '{0}';
                    $shuffle_match1 = array_merge($shuffle_match1, $shuffle_match);
                    $qdata = array();
                    for ($i = 0, $n = count($match_data); $i < $n; $i++) {
                        $qdata[$i]->c_left_text = $match_data[$i]->c_left_text;
                        $qdata[$i]->c_right_text = mosHTML::selectList($shuffle_match1, 'quest_match', 'class="inputbox" size="1" disabled', 'c_val', 'c_right_text', $shuffle_match1[$i + 1]->c_right_text);
                    }
                    $qhtml = '';
                    if ($show_correct_answer) {
                        $qhtml = JoomlaQuiz_template_class::JQ_createMDropDown($qdata);
                    }
                    $quhtml = '';
                    if ($show_correct) {
                        $quhtml .= '<div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table align="center" class="jlms_table_no_borders"><tr><td>';
                        for ($i = 0, $n = count($qdata); $i < $n; $i++) {
                            $qdata[$i]->c_left_text = $match_data[$i]->c_left_text;
                            $qdata[$i]->c_right_text = mosHTML::selectList($shuffle_match1, 'quest_match_u', 'class="inputbox" size="1" disabled', 'c_val', 'c_right_text', $user_answer[$i]);
                        }
                        $quhtml .= JoomlaQuiz_template_class::JQ_createMDropDown($qdata);
                        $quhtml .= '</td></tr></table>';
                    }
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div><form name=\'quest_form\'>' . $qhtml . $quhtml . '</form></div>]]></quest_data_user>' . "\n";
                    break;
                case 6:
                    $query = "SELECT t.c_text FROM #__lms_quiz_t_blank as b, #__lms_quiz_t_text as t" . "\n WHERE b.c_question_id = '" . $q_data->c_id . "' AND t.c_blank_id = b.c_id" . "\n ORDER BY t.ordering";
                    $JLMS_DB->SetQuery($query);
                    $blank_data = $JLMS_DB->LoadObjectList();
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div><form name=\'quest_form\'>' . "\n";
                    $qhtml = '';
                    if ($show_correct_answer) {
                        foreach ($blank_data as $bl_one) {
                            $qhtml .= JoomlaQuiz_template_class::JQ_createBlankReview($bl_one->c_text) . "<br />";
                        }
                    }
                    $quhtml = '';
                    if ($show_correct || $q_survey) {
                        $quhtml .= '<div><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table align="center" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>';
                        $quhtml .= JoomlaQuiz_template_class::JQ_createBlankReview($user_answer);
                        $quhtml .= '</td></tr></table></div>';
                    }
                    if ($q_survey) {
                        $qhtml = '';
                    }
                    $ret_str .= $qhtml . "\n" . "\t" . '</form>' . $quhtml . '</div>]]></quest_data_user>' . "\n";
                    break;
                case 7:
                    $query = "SELECT * FROM #__lms_quiz_t_hotspot WHERE c_question_id = '" . $q_data->c_id . "'";
                    $JLMS_DB->SetQuery($query);
                    $hotspot_data = $JLMS_DB->LoadObjectList();
                    $hs_lefttop_x = 0;
                    $hs_lefttop_y = 0;
                    $hs_rightbottom_x = 0;
                    $hs_rightbottom_y = 0;
                    if (isset($hotspot_data[0])) {
                        $hs_lefttop_x = $hotspot_data[0]->c_start_x;
                        $hs_lefttop_y = $hotspot_data[0]->c_start_y;
                        $hs_rightbottom_x = $hotspot_data[0]->c_width;
                        $hs_rightbottom_y = $hotspot_data[0]->c_height;
                    }
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div>';
                    $ret_str .= '<div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div>';
                    $ret_str .= '<center><table class="jlms_table_no_borders"><tr><td align="center"><div style="text-align:left; position:relative;">';
                    if ($show_correct) {
                        $ret_str .= '<div id="div_hotspot_rec2" style="background:url(\'' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/templates/joomlaquiz_lms_template/images/hs_round.png\'); z-index:1002; width:12px; height:12px;  position:absolute; left:' . ($user_answer[0] - 6) . 'px; top:' . ($user_answer[1] + 6) . 'px;"></div>';
                    }
                    if ($show_correct_answer) {
                        $ret_str .= '<div id="div_hotspot_rec" style="background-color:#FFFFFF; z-index:1001; ' . (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $_SERVER['HTTP_USER_AGENT']) ? "filter:alpha(opacity=50);" : '') . ' -moz-opacity:.50; opacity:.50; border:1px solid #000000; position:absolute; left:' . $hs_lefttop_x . 'px; top:' . $hs_lefttop_y . 'px; width:' . $hs_rightbottom_x . 'px; height:' . $hs_rightbottom_y . 'px; "><img src="' . $JLMS_CONFIG->get('live_site') . '/images/blank.png" border="0" width="1" height="1"></div>';
                    }
                    $ret_str .= '<form name=\'quest_form\'><img id=\'img_hotspot\' style=\'position:relative; z-index:999;\' src=\'' . $JLMS_CONFIG->get('live_site') . '/images/joomlaquiz/images/' . $q_data->c_image . '\' />' . '<input type=\'hidden\' name=\'hotspot_x\' value=\'0\' />' . '<input type=\'hidden\' name=\'hotspot_y\' value=\'0\' /></form></div></td></tr></table></center></div>]]></quest_data_user>' . "\n";
                    break;
                case 8:
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<form name=\'quest_form\'>' . "\n";
                    $qhtml = JoomlaQuiz_template_class::JQ_createSurvey(1, $user_answer);
                    $ret_str .= $qhtml . "\n" . "\t" . '</form>]]></quest_data_user>' . "\n";
                    break;
                case 9:
                    $query = "SELECT * FROM #__lms_quiz_t_scale WHERE c_question_id = '" . $q_data->c_id . "'" . "\n ORDER BY ordering";
                    $JLMS_DB->SetQuery($query);
                    $scale_data = $JLMS_DB->LoadObjectList();
                    for ($i = 0; $i < count($scale_data); $i++) {
                        $scale_data[$i]->inchek = '';
                        if ($show_correct_answer) {
                            foreach ($user_answer as $uansw) {
                                if ($uansw[0] == $scale_data[$i]->c_id) {
                                    $scale_data[$i]->inchek = $uansw[1];
                                }
                            }
                        }
                    }
                    $qhtml = JoomlaQuiz_template_class::JQ_createScale($scale_data, 1);
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div><form name=\'quest_form\'>' . $qhtml . '</form></div>]]></quest_data_user>' . "\n";
                    break;
                case 10:
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<form name=\'quest_form\'>' . "\n";
                    $ret_str .= "\n" . "\t" . '</form>]]></quest_data_user>' . "\n";
                    break;
                case 11:
                    $query = "SELECT a.*, a.c_right_text as c_val, b.imgs_name as left_name, c.imgs_name as right_name FROM #__lms_quiz_t_matching as a, #__lms_quiz_images as b, #__lms_quiz_images as c WHERE c_question_id = '" . $q_data->c_id . "' AND a.c_left_text = b.imgs_id AND a.c_right_text = c.imgs_id" . "\n ORDER BY a.ordering";
                    $JLMS_DB->SetQuery($query);
                    $match_data = $JLMS_DB->LoadObjectList();
                    $shuffle_match = $match_data;
                    $ret_str .= "\t" . '<quest_data_user><![CDATA[<div>' . "\n\r";
                    if ($show_correct_answer) {
                        $ret_str .= '<div style=\'width:100%;text-align:center\'><table id=\'quest_table\' align="center" cellpadding="10" cellspacing="0" border="0" class="jlms_table_no_borders">';
                        for ($i = 0, $n = count($match_data); $i < $n; $i++) {
                            $ret_str .= '<tr><td style="padding:10px"><div id=\'cdiv_' . ($i + 1) . '\' class=\'jq_drop_pre\' style=\'width: ' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . 'px; height: ' . $JLMS_CONFIG->get('quiz_match_max_height', 30) . 'px;\'>
						<img src="' . ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=' . $option . '&task=quizzes&page=imgs_v&id=' . $q_data->course_id . '&file_id=' . $match_data[$i]->c_left_text . '&Itemid=' . $Itemid . '&imgs_name=' . $match_data[$i]->left_name . '&pic_width=' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . '&pic_height=' . $JLMS_CONFIG->get('quiz_match_max_height', 250) . '&bg_color=dddddd') . '" border="0" alt="' . $match_data[$i]->left_name . '"/></div></td><td style="padding:10px"><div id=\'ddiv_' . ($i + 1) . '\' class=\'jq_drag_pre\' style=\'width: ' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . 'px; height: ' . $JLMS_CONFIG->get('quiz_match_max_height', 30) . 'px;\'>
						<img src="' . ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=' . $option . '&task=quizzes&page=imgs_v&id=' . $q_data->course_id . '&file_id=' . $shuffle_match[$i]->c_right_text . '&Itemid=' . $Itemid . '&imgs_name=' . $shuffle_match[$i]->right_name . '&pic_width=' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . '&pic_height=' . $JLMS_CONFIG->get('quiz_match_max_height', 250)) . '" border="0" alt="' . $shuffle_match[$i]->right_name . '"/></div></td></tr>';
                        }
                        $ret_str .= '</table></div>' . "\n";
                    }
                    if ($show_correct) {
                        $ret_str .= '<div style=\'width:100%;text-align:center\'><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table id=\'quest_table\' align="center" cellpadding="10" cellspacing="0" border="0" class="jlms_table_no_borders">';
                        for ($i = 0, $n = count($match_data); $i < $n; $i++) {
                            $ret_str .= '<tr><td style="padding:10px"><div id=\'cdiv_' . ($i + 1) . '\' class=\'jq_drop_pre\' style=\'width: ' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . 'px; height: ' . $JLMS_CONFIG->get('quiz_match_max_height', 30) . 'px;\'>
						<img src="' . ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=' . $option . '&task=quizzes&page=imgs_v&id=' . $q_data->course_id . '&file_id=' . $match_data[$i]->c_left_text . '&Itemid=' . $Itemid . '&imgs_name=' . $match_data[$i]->left_name . '&pic_width=' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . '&pic_height=' . $JLMS_CONFIG->get('quiz_match_max_height', 250)) . '&bg_color=dddddd" border="0" alt="' . $match_data[$i]->left_name . '"/></div></td><td style="padding:10px"><div id=\'ddiv_' . ($i + 1) . '\' class=\'jq_drag_pre\' style=\'width: ' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . 'px; height: ' . $JLMS_CONFIG->get('quiz_match_max_height', 30) . 'px;\'>
						<img src="' . ampreplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=' . $option . '&task=quizzes&page=imgs_v&id=' . $q_data->course_id . '&file_id=' . $user_answer[$i] . '&Itemid=' . $Itemid . '&pic_width=' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . '&pic_height=' . $JLMS_CONFIG->get('quiz_match_max_height', 250)) . '" border="0" alt=""/></div></td></tr>';
                        }
                        $ret_str .= '</table></div>' . "\n";
                    }
                    $ret_str .= '<form name=\'quest_form\'></form></div>]]></quest_data_user>' . "\n";
                    break;
            }
            $ret_str .= "\t" . '<exec_quiz_script>1</exec_quiz_script>' . "\n";
            $ret_str .= "\t" . '<quiz_script_data><![CDATA[' . $ret_add_script . ']]></quiz_script_data>' . "\n";
        }
        return $ret_str;
    }
Exemplo n.º 10
0
    function showTopic($course_id, $topic_id, $row, $lists)
    {
        global $option, $Itemid, $JLMS_CONFIG;
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $title = isset($row->id) ? $row->name : '';
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => "javascript:submitbutton('cancel_topic');");
        JLMS_TMPL::ShowHeader('doc', $title, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="details_course" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="weekly" value="0" />
			<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		</form>
		<?php 
        echo JLMS_ShowText_WithFeatures($row->description);
        ?>
		<?php 
        JLMS_TMPL::CloseTS();
        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
        $_JLMS_PLUGINS->loadBotGroup('system');
        $plugin_args = array();
        $plugin_args[] = $row->id;
        $_JLMS_PLUGINS->trigger('onBelowTopicPage', $plugin_args);
        JLMS_TMPL::CloseMT();
    }
    function JQ_ShowQuiz($option, $course_id, $quiz, $jq_language, $self_verification, $is_preview = false, $preview_quest = 0, $preview_id = '')
    {
        global $Itemid, $JLMS_CONFIG, $JLMS_DB;
        $doc =& JFactory::getDocument();
        $domready = '
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);
        $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/bits_message.js');
        if (JLMS_mootools12()) {
            $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/dragdrop_1.3.js');
        } else {
            $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/dragdrop_1.12.js');
        }
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/progressbar.js');
        }
        ?>
<script language="JavaScript" type="text/javascript">
<!--//--><![CDATA[//><!--
	var stu_quiz_id = 0;

	// *** DRAG'and'DROP CODE *** //
<?php 
        if ($quiz->if_dragdrop_exist) {
            ?>
	var kol_drag_elems = 0;
	var drag_array = new Array(kol_drag_elems);
	var coord_left = new Array(kol_drag_elems);
	var coord_top = new Array(kol_drag_elems);
	var ids_in_cont = new Array(kol_drag_elems);
	var cont_for_ids = new Array(kol_drag_elems);
	var answ_ids = new Array(kol_drag_elems);
	var cont_index = 0;
	var last_drag_id = '';
	var last_drag_id_drag = '';
	
	/*drag&drop mootools realised*/
	function excute_draggable(){
		var DD = new QuizDragDrop('cont', {dropitems: 'jq_drop', dragitems: 'jq_drag'});
	}
	
	function js_in_array(n, ha){
		for(h in ha){
			if(ha[h]==n){
				return true;
			}
		}
		return false;
	}

//});
	/*drag&drop mootools realised*/
	
<?php 
        }
        ?>
	// *** end of DRAG'and'DROP CODE *** //
	var kol_main_elems = 0;
	var main_ids_array = new Array(kol_main_elems); //for likert quest
	// *** MESSAGES *** (addslashes ???)
	var mes_complete_this_part = '<?php 
        echo $jq_language['mes_complete_this_part'];
        ?>
';
	var mes_loading = '<?php 
        echo $jq_language['quiz_load_data'];
        ?>
';
	var mes_failed = '<?php 
        echo $jq_language['quiz_failed'];
        ?>
';
	var mes_please_wait = '<?php 
        echo $jq_language['mes_please_wait'];
        ?>
';
	var mes_time_is_up = '<?php 
        echo $jq_language['quiz_mes_timeout'];
        ?>
';
	var mes_quest_number = '<?php 
        echo $jq_language['quiz_question_number'];
        ?>
';
	var mes_quest_points = '<?php 
        echo $jq_language['quiz_question_points'];
        ?>
';
	// *** some script variables ***
	var user_email_to = '';
	var user_unique_id = '';
	var cur_quest_type = '';
	var saved_prev_quest_data = '';
	var saved_prev_quest_exec_quiz_script = '';
	var save_prev_quest_exec_quiz_script_data = '';
	var saved_prev_res_data = '';
	var saved_prev_quest_id = 0;
	var saved_prev_quest_type = 0;
	var saved_prev_quest_score = 0;
	var saved_prev_quest_num = 0;
	var cur_quest_id = 0;
	var cur_quest_score = 0;
	var cur_quest_num = 0;
	var quiz_count_quests = 0;
	var cur_impscale_ex = 0;
	var response;
	var prev_correct = 0;
	var allow_attempt = 0;
	var timer_sec = <?php 
        echo isset($quiz->resume_timer_value) && $quiz->resume_timer_value ? $quiz->resume_timer_value : 0;
        ?>
;
	var stop_timer = 0;
	var result_is_shown = 0;
	var max_quiz_time = <?php 
        echo $quiz->c_time_limit ? $quiz->c_time_limit * 60 : 3600;
        ?>
;
	var quiz_blocked = 0; // set block after each question (release after 2 seconds).
	var url_prefix = '<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&Itemid={$Itemid}&jlms=1&task=quiz_ajax_action&id={$course_id}";
        ?>
';//'components/com_joomlaquiz/ajax_quiz.php';
	var mCfg_live_site = '';
	
	var stu_quiz_id = 0;
	var user_unique_id = 0;
	
	var quiz_progress = 0; // progressbar value
	
	var review = 0;

	function jq_MakeRequest(url, do_clear) {
		//if (do_clear == 1) jq_UpdateTaskDiv('clear');
		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;
		}
		if (do_clear == 1) {
			jq_showLoading();
		}
		quiz_blocked == 1;
		http_request.onreadystatechange = function() { jq_AnalizeRequest(http_request); };
		<?php 
        if ($is_preview) {
            ?>
		var url_prefix2 = 'preview_id=<?php 
            echo $preview_id;
            ?>
';
		<?php 
        } else {
            ?>
		var url_prefix2 = 'user_unique_id=' + user_unique_id;
		<?php 
        }
        ?>
		http_request.open('POST', mCfg_live_site + url_prefix, true);
		//http_request.send(null);
		http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http_request.setRequestHeader("Content-length", url_prefix2.length + url.length);
		//http_request.setRequestHeader("Content-Encoding", "utf-8");
		//http_request.setRequestHeader("Connection", "close"); - if close - bug in IE7 - it hungs up
		http_request.send(url_prefix2 + url);
	}
	function jq_AnalizeRequest(http_request) {
		if (http_request.readyState == 4) {
			if ((http_request.status == 200)) {
				//alert(http_request.responseText);
				if(http_request.responseXML.documentElement == null){
					try {
						http_request.responseXML.loadXML(http_request.responseText)
					} catch (e) {
						/*alert('error');*/
					}
				}

				response  = http_request.responseXML.documentElement;
				var task = response.getElementsByTagName('task')[0].firstChild.data;
				ShowMessage('error_messagebox',0,'');

				switch (task) {
					case 'resume':

						user_unique_id = response.getElementsByTagName('user_unique_id')[0].firstChild.data;
						stu_quiz_id = response.getElementsByTagName('stu_quiz_id')[0].firstChild.data;

						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;

						quiz_count_quests = response.getElementsByTagName('quiz_count_quests')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						
						<?php 
        if ($quiz->c_slide) {
            ?>
							getObj('jq_quiz_result_container').innerHTML = response.getElementsByTagName('quiz_panel_data')[0].firstChild.data;
						<?php 
        }
        ?>

						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						quiz_progress = response.getElementsByTagName('progress_quests_done')[0].firstChild.data;

						<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
						progressbar.setProgress(quiz_progress);
						<?php 
        }
        ?>

						jq_QuizContinue();
						jq_Start_TickTackResume();
					break;

					case 'start':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						user_unique_id = response.getElementsByTagName('user_unique_id')[0].firstChild.data;
						stu_quiz_id = response.getElementsByTagName('stu_quiz_id')[0].firstChild.data;
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						quiz_count_quests = response.getElementsByTagName('quiz_count_quests')[0].firstChild.data;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						getObj('jq_quiz_container').innerHTML = '';
						if (cur_quest_type == 7) {
							var div_insidey=document.createElement("div");
							div_insidey.id = 'quest_div_hs';
							getObj('jq_quiz_container').appendChild(div_insidey);
						}
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';

						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						getObj('jq_quiz_container').appendChild(div_inside1);

						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('next');
						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
						jq_Start_TickTack();
						<?php 
        if ($quiz->c_slide) {
            ?>
							getObj('jq_quiz_result_container').innerHTML = response.getElementsByTagName('quiz_panel_data')[0].firstChild.data;
						<?php 
        }
        ?>
					break;
					case 'seek_quest':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						getObj('jq_quiz_container').innerHTML = '';
						if (cur_quest_type == 7) {
							var div_insidey=document.createElement("div");
							div_insidey.id = 'quest_div_hs';
							getObj('jq_quiz_container').appendChild(div_insidey);
						}
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';
						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						getObj('jq_quiz_container').appendChild(div_inside1);
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('next');

						quiz_progress = response.getElementsByTagName('progress_quests_done')[0].firstChild.data;
						<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
							progressbar.setProgress(quiz_progress);
						<?php 
        }
        ?>

						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
					break;
					case 'review_start':
						quiz_blocked = 1;
						review = 1;
						setTimeout("jq_releaseBlock()", 1000);
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						quiz_count_quests = response.getElementsByTagName('quiz_count_quests')[0].firstChild.data;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						
						
						getObj('jq_quiz_container').innerHTML = '';
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';
						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						getObj('jq_quiz_container').appendChild(div_inside1);
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						quiz_review_correct = response.getElementsByTagName('quiz_review_correct')[0].firstChild.data;
						getObj('jq_quiz_result_reviews').innerHTML = quiz_review_correct;
						getObj('jq_quiz_result_reviews').style.display = 'block';
						getObj('jq_quiz_result_reviews').style.visibility = 'visible';
						getObj('jq_quiz_explanation').innerHTML = response.getElementsByTagName('quiz_review_explanation')[0].firstChild.data;;
						getObj('jq_quiz_explanation').style.display = 'block';
						getObj('jq_quiz_explanation').style.visibility = 'visible';
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('review_next');
						
						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
						
						<?php 
        if ($quiz->c_slide) {
            ?>
							//getObj('jq_panel_link_container').style.visibility = 'visible';
						<?php 
        }
        ?>
					break;
					case 'review_next':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						prev_quest_id = response.getElementsByTagName('prev_quest_id')[0].firstChild.data;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						
						getObj('jq_quiz_container').innerHTML = '';
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';
						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						getObj('jq_quiz_container').appendChild(div_inside1);
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						quiz_review_correct = response.getElementsByTagName('quiz_review_correct')[0].firstChild.data;
						getObj('jq_quiz_result_reviews').innerHTML = quiz_review_correct;
						getObj('jq_quiz_result_reviews').style.display = 'block';
						getObj('jq_quiz_result_reviews').style.visibility = 'visible';
						getObj('jq_quiz_explanation').innerHTML = response.getElementsByTagName('quiz_review_explanation')[0].firstChild.data;;
						getObj('jq_quiz_explanation').style.display = 'block';
						getObj('jq_quiz_explanation').style.visibility = 'visible';
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('review_next');
						
						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
					break;
					case 'review_finish':
						quiz_blocked = 1;
						review = 0;
						setTimeout("jq_releaseBlock()", 1000);
						jq_UpdateTaskDiv('finish');
						var quiz_cont = getObj('jq_quiz_container');
						quiz_cont.innerHTML = saved_prev_res_data;//'<form name=\'quest_form\'><\/form>'+saved_prev_res_data;
					break;
					case 'next':
						quiz_blocked = 1;

						quiz_progress = response.getElementsByTagName('progress_quests_done')[0].firstChild.data;
						<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
						progressbar.setProgress(quiz_progress);
						<?php 
        }
        ?>

						setTimeout("jq_releaseBlock()", 1000);
						prev_correct = response.getElementsByTagName('quiz_prev_correct')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						quest_feedback = response.getElementsByTagName('quest_feedback')[0].firstChild.data;
						if (quest_feedback == '1') {
							var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
							var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
							jq_UpdateTaskDiv_htm(quiz_menu);
							if (prev_correct == '1') {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' border=0>";
							<?php 
        }
        ?>
								quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
								jq_UpdateTaskDiv('continue');
							} else {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png' border=0>";
							<?php 
        }
        ?>
								quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
								allow_attempt = response.getElementsByTagName('quiz_allow_attempt')[0].firstChild.data;
								if (allow_attempt == '1') { allow_attempt = 0; jq_UpdateTaskDiv('back_continue');
								} else { allow_attempt = 0; jq_UpdateTaskDiv('continue'); }
							}
						} else {
							var qmb = '';
							var qfrf = response.getElementsByTagName('quest_feedback_repl_func')[0].firstChild.data;
							if (prev_correct == '1') {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' border=0>";
							<?php 
        }
        ?>
							} else {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png' border=0>";
							<?php 
        }
        ?>
							}
							eval(qfrf);
						}
					break;
					<?php 
        if ($is_preview) {
            ?>
					case 'quest_preview':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						quiz_count_quests = response.getElementsByTagName('quiz_count_quests')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
						quiz_cont.innerHTML = '';//<form name=\'quest_form\'></form>';
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						var quiz_cont = getObj('jq_quiz_container');
						quiz_cont.innerHTML = '';
						if (cur_quest_type == 7) {
							var div_insidey=document.createElement("div");
							div_insidey.id = 'quest_div_hs';
							getObj('jq_quiz_container').appendChild(div_insidey);
						}
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';
						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data +response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						quiz_cont.appendChild(div_inside1);
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('next');
						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
					break;
					case 'preview_finish':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						prev_correct = response.getElementsByTagName('quiz_prev_correct')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						if (prev_correct == '1') {
							quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
							jq_UpdateTaskDiv('preview_back');
						} else {
							quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
							jq_UpdateTaskDiv('preview_back');
						}
					break;
					<?php 
        }
        ?>
					case 'no_attempts':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('next_no_attempts');
					break;
					case 'email_results':
						quiz_blocked = 1;
						//setTimeout("jq_releaseBlock()", 1000);
						var email_msg = response.getElementsByTagName('email_msg')[0].firstChild.data;
						ShowMessage('error_messagebox', 1, email_msg);
					break;
					case 'time_is_up':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
														
						stu_quiz_id = response.getElementsByTagName('stu_quiz_id')[0].firstChild.data;
						user_unique_id = response.getElementsByTagName('user_unique_id')[0].firstChild.data;
						
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('continue_finish');
					break;
					case 'finish':
						quiz_blocked = 1;

						quiz_progress = response.getElementsByTagName('progress_quests_done')[0].firstChild.data;
						<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
						progressbar.setProgress(quiz_progress);
						<?php 
        }
        ?>

						setTimeout("jq_releaseBlock()", 1000);
						prev_correct = response.getElementsByTagName('quiz_prev_correct')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						quest_feedback = response.getElementsByTagName('quest_feedback')[0].firstChild.data;
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						if (quest_feedback == '1') {
							var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
							var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
							jq_UpdateTaskDiv_htm(quiz_menu);
							if (prev_correct == '1') {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' border=0>";
							<?php 
        }
        ?>
								//stop_timer = 1;
								quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
								jq_UpdateTaskDiv('continue_finish');
							} else {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png' border=0>";
							<?php 
        }
        ?>
								quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
								allow_attempt = response.getElementsByTagName('quiz_allow_attempt')[0].firstChild.data;
								if (allow_attempt == '1') {
									allow_attempt = 0;
									jq_UpdateTaskDiv('back_continue_finish');
								} else {
									allow_attempt = 0;
									//stop_timer = 1;
									jq_UpdateTaskDiv('continue_finish');
								}
							}
						} else {
							var qmb = '';
							var qfrf = response.getElementsByTagName('quest_feedback_repl_func')[0].firstChild.data;
							if (prev_correct == '1') {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' border=0>";
							<?php 
        }
        ?>
							} else {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png' border=0>";
							<?php 
        }
        ?>
							}
							eval(qfrf);
						}
					break;
					case 'results':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 100);
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						stop_timer = 1;
						getObj('jq_time_tick_container').style.visibility = "hidden";
						jq_UpdateTaskDiv('finish');
						var finish_msg = response.getElementsByTagName('finish_msg')[0].firstChild.data;
						var quiz_results = response.getElementsByTagName('quiz_results')[0].firstChild.data;
						var quiz_footer = response.getElementsByTagName('quiz_footer')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						quiz_cont.innerHTML = quiz_results+finish_msg+quiz_footer;//'<form name=\'quest_form\'><\/form>'+quiz_results+finish_msg+quiz_footer;
						saved_prev_res_data = quiz_results+finish_msg+quiz_footer;
					break;
					case 'failed':
						ShowMessage('error_messagebox', 1, mes_failed);
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
					break;
					default:
					break;
				}
			} else {
				ShowMessage('error_messagebox', 1, '<?php 
        echo $jq_language['quiz_failed_request'];
        ?>
');
			}
		}
	}
	function jq_releaseBlock() { quiz_blocked = 0; }
	function jq_Start_TickTack() {
		timer_sec = 1;
		getObj('jq_time_tick_container').innerHTML = '00:01';
		getObj('jq_time_tick_container').style.visibility = "visible";
		setTimeout("jq_Continue_TickTack()", 1000);
	}
	function jq_Start_TickTackResume() {
		jq_ParseTickTackTimer(timer_sec);
		getObj('jq_time_tick_container').style.visibility = "visible";
		setTimeout("jq_Continue_TickTack()", 1000);
	}
	function jq_Continue_TickTack() {
		if (stop_timer == 1) {
			getObj('jq_time_tick_container').style.visibility = "hidden";
		} else {
			timer_sec ++;
			if ( max_quiz_time && (timer_sec > max_quiz_time) ) {
				getObj('jq_time_tick_container').innerHTML = mes_time_is_up;
			} else {
				jq_ParseTickTackTimer(timer_sec);
				setTimeout("jq_Continue_TickTack()", 1000);
			}
		}
	}
	function jq_ParseTickTackTimer(timer_sec) {
		var timer_hours = parseInt(timer_sec/3600);
		var timer_min = parseInt(timer_sec/60) - (timer_hours*60);
		var plus_sec = timer_sec - (timer_min*60) - (timer_hours*3600);
		if (timer_min < 0) { timer_min = timer_min*(-1); }
		if (plus_sec < 0) { plus_sec = plus_sec*(-1); }
		if (timer_hours < 0) { timer_hours = timer_hours*(-1); }
		var time_str_hours = '';
		if (timer_hours) {
			time_str_hours = timer_hours + '';
			if (time_str_hours.length == 1) time_str_hours = '0'+time_str_hours;
			time_str_hours = time_str_hours + ':';
		}
		var time_str = timer_min + '';
		if (time_str.length == 1) time_str = '0'+time_str;
		time_str2 = plus_sec + '';
		if (time_str2.length == 1) time_str2 = '0'+time_str2;
		getObj('jq_time_tick_container').innerHTML = time_str_hours + time_str + ':' + time_str2;
	}

		function jq_ResumeQuizOn(resume_id, unique_id, last_question) {
	<?php 
        if ($quiz->c_email_to == 2) {
            ?>
		/*var jq_email_cont = getObj('jq_user_email');
		var re_email = /[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}/;
		if (!re_email.test(jq_email_cont.value)) {
			alert("Please enter a correct e-mail address");
			return;
		}
		user_email_to = jq_email_cont.value;*/
	<?php 
        }
        ?>
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();//
			timerID = setTimeout("jq_ResumeQuiz("+resume_id+", '"+unique_id+"', "+last_question+")", 300);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
		}
	}
	function jq_ResumeQuiz(resume_id, unique_id, last_question) { 
		jq_MakeRequest('&atask=resume_quiz&quiz=<?php 
        echo $quiz->c_id;
        ?>
&resume_id='+resume_id+'&unique_id='+unique_id+'&last_question='+last_question,1); 
	}

	
	function jq_StartQuizOn() {
	<?php 
        if ($quiz->c_email_to == 2) {
            ?>
		/*var jq_email_cont = getObj('jq_user_email');
		var re_email = /[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}/;
		if (!re_email.test(jq_email_cont.value)) {
			alert("Please enter a correct e-mail address");
			return;
		}
		user_email_to = jq_email_cont.value;*/
	<?php 
        }
        ?>
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();//
			timerID = setTimeout("jq_StartQuiz()", 300);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
		}
	}
	function jq_StartQuiz() { jq_MakeRequest('&atask=start&quiz=<?php 
        echo $quiz->c_id;
        ?>
',1); }
	
	function jq_StartQuizOn_selfver() {
	<?php 
        if ($quiz->c_email_to == 2) {
            ?>
		/*var jq_email_cont = getObj('jq_user_email');
		var re_email = /[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}/;
		if (!re_email.test(jq_email_cont.value)) {
			alert("Please enter a correct e-mail address");
			return;
		}
		user_email_to = jq_email_cont.value;*/
	<?php 
        }
        ?>
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();//
			timerID = setTimeout("jq_StartQuiz_selfver()", 300);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
		}
	}
	
	function implode( glue, pieces ) {
	    return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces );
	}
	
	function jq_StartQuiz_selfver(){ 
		var form = document.selfverForm;
		var string_params = '';
		
		if(form.c_pool_type.value == 1){
			string_params = '&mode_self=1&pool_num='+form.pool_qtype_number.value;
		} else if(form.c_pool_type.value == 2){
			if (form['pool_cat_id[]'].length) {
				var arr_cat_id = new Array(form['pool_cat_id[]'].length);
				var arr_cat_number = new Array(form['pool_cat_number[]'].length);
				for (var i = 0; i<form['pool_cat_number[]'].length; i++) {
						if (form['pool_cat_number[]'][i].value > 0) { 
							arr_cat_id[i] = form['pool_cat_id[]'][i].value;
							arr_cat_number[i] = form['pool_cat_number[]'][i].value; 
						} 
				}
				string_params = '&mode_self=2&cats_id='+implode(',', arr_cat_id)+'&pool_num='+implode(',', arr_cat_number);
			} else if (form['pool_cat_id[]'].value > 0) { 
				var arr_cat_id;
				var arr_cat_number;
				arr_cat_id = form['pool_cat_id[]'].value;
				arr_cat_number = form['pool_cat_number[]'].value;
				string_params = '&mode_self=3&cats_id='+arr_cat_id+'&pool_num='+arr_cat_number;
			} 
		}
		jq_MakeRequest('&atask=start&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+string_params,1);
	}
	
	
	function JQ_gotoQuestionOn(qid) {
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();//
			timerID = setTimeout("JQ_gotoQuestion("+qid+")", 300);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
			setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function JQ_gotoQuestion(qid){
		if(review){
			jq_MakeRequest('&atask=review_next&prev=1&quiz=<?php 
        echo $quiz->c_id;
        ?>
&stu_quiz_id='+stu_quiz_id+'&quest_id='+qid, 1 ); 
		} else {
			jq_MakeRequest('&atask=goto_quest&quiz=<?php 
        echo $quiz->c_id;
        ?>
&stu_quiz_id='+stu_quiz_id+'&seek_quest_id='+qid, 1 ); 
		}
	}
	function jq_emailResults() {
		if (!quiz_blocked) {
			ShowMessage('error_messagebox', 1, mes_loading);
			jq_MakeRequest('&atask=email_results&quiz=<?php 
        echo $quiz->c_id;
        ?>
&stu_quiz_id='+stu_quiz_id<?php 
        echo $quiz->c_email_to == 2 ? "+'&email_address='+user_email_to" : '';
        ?>
,0);
		} else {
			//ShowMessage('error_messagebox', 1, mes_please_wait);// setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function jq_startReview() {
		if (!quiz_blocked) {
			jq_MakeRequest('&atask=review_start&quiz=<?php 
        echo $quiz->c_id;
        ?>
&stu_quiz_id='+stu_quiz_id, 1);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait); setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function jq_QuizReviewNext() {
		if (!quiz_blocked) {
			jq_MakeRequest('&atask=review_next&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id, 1);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
			setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function jq_QuizReviewPrev() {
		if (!quiz_blocked) {
			jq_MakeRequest('&atask=review_next&prev=1&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+prev_quest_id, 1);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
			setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function jq_Check_selectRadio(rad_name, form_name) {
		var tItem = eval('document.'+form_name);
		if (tItem) {
			var selItem = eval('document.'+form_name+'.'+rad_name);
			if (selItem) {
				if (selItem.length) { var i;
					for (i = 0; i<selItem.length; i++) {
						if (selItem[i].checked) {
							if (selItem[i].value > 0) { return selItem[i].value; } } }
				} else if (selItem.checked) { return selItem.value; } }
			return false; }
		return false;
	}
	function jq_Check_selectCheckbox(check_name, form_name) {
		selItem = eval('document.'+form_name+'.'+check_name);
		var rrr = '';
		if (selItem) {
			if (selItem.length) { var i;
				for (i = 0; i<selItem.length; i++) {
					if (selItem[i].checked) {
						if (selItem[i].value > 0) { rrr = rrr + selItem[i].value + ', '; }
					}}
				rrr = rrr.substring(0, rrr.length - 2);
			} else if (selItem.checked) { rrr = rrr + selItem.value; }}
		return rrr;
	}
	function jq_Check_valueItem(item_name, form_name) {
		selItem = eval('document.'+form_name+'.'+item_name);
		var rrr = '';
		if (selItem) {
			if (selItem.length) { var i;
				for (i = 0; i<selItem.length; i++) {
					if (selItem[i].value == '{0}') return '';
					rrr = rrr + selItem[i].value + '```';
				}
				rrr = rrr.substring(0, rrr.length - 3);
			} else { rrr = rrr + selItem.value;	}}
		return rrr;
	}
	function jq_QuizNextOn() { // Two steps CHECK (delete this func in the future)
		switch (cur_quest_type) {
			case '1': //Multi choice
			case '12':
				if (!jq_Check_selectRadio('quest_choice', 'quest_form') && !document.quest_form.ismandatory.value) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '2': //Multi Response
			case '13':
				var res = jq_Check_selectCheckbox('quest_choice', 'quest_form');
				if (res == '') {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '3': //true-false
				if (!jq_Check_selectRadio('quest_choice', 'quest_form')) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '4': // Drag'AND'Drop
			case '11':
				var i_id; var i_value; var complete = true;
				for (i=0; i<kol_drag_elems; i++) {
					if ( (ids_in_cont[i] > 0) && (ids_in_cont[i] <= kol_drag_elems) ) {
						//alert(ids_in_cont[i] + ' - ' + cont_for_ids[ids_in_cont[i] - 1] + ' - ' + answ_ids[ids_in_cont[i]])
						if (cont_for_ids[ids_in_cont[i] - 1] == i+1) { ;
						} else { complete = false; }
					} else { complete = false; }
				}
				if (!complete) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;
				}
			break;
			case '5': //drop-down
				var res = jq_Check_valueItem('quest_match', 'quest_form');
				if (res == '') {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;
				}
			break;
			case '6': //fill in the blank
				var blank_item = document.quest_form.quest_blank;
				var res = TRIM_str(blank_item.value);
				if (res == '' && !document.quest_form.ismandatory.value) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '7': //hotspot question
				var hs_x = parseInt(document.quest_form.hotspot_x.value);
				var hs_y = parseInt(document.quest_form.hotspot_y.value);
				if ((hs_x == 0) && (hs_y == 0)) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '8': //survey question
				var answer = document.quest_form.survey_box.value;
				if (TRIM_str(answer) == '' && !document.quest_form.ismandatory.value) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '10':
			break;
			/*case '11':
				var i_id; var i_value; var complete = true;
				for (i=0; i<kol_drag_elems; i++) {
					if ( (ids_in_cont[i] > 0) && (ids_in_cont[i] <= kol_drag_elems) ) {
						//alert(ids_in_cont[i] + ' - ' + cont_for_ids[ids_in_cont[i] - 1] + ' - ' + answ_ids[ids_in_cont[i]])
						if (cont_for_ids[ids_in_cont[i] - 1] == i+1) { ;
						} else { complete = false; }
					} else { complete = false; }
				}
				if (!complete) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;*/
		}
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();
			quiz_blocked = 1;
			timerID = setTimeout("jq_QuizNext()", 300);
		} else { ShowMessage('error_messagebox', 1, mes_please_wait); setTimeout("jq_releaseBlock()", 1000); }
	}

	function jq_QuizContinue() {

		cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
		saved_prev_quest_type = cur_quest_type;
		cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
		saved_prev_quest_id = cur_quest_id;
		cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
		saved_prev_quest_score = cur_quest_score;
		cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
		saved_prev_quest_num = cur_quest_num;
		skip_next_quest = response.getElementsByTagName('quiz_skip_next_quest')[0].firstChild ? response.getElementsByTagName('quiz_skip_next_quest')[0].firstChild.data : 0;
		var quiz_cont = getObj('jq_quiz_container');
		quiz_cont.innerHTML = '';
		if (cur_quest_type == 7) {
			var div_insidey=document.createElement("div");
			div_insidey.id = 'quest_div_hs';
			getObj('jq_quiz_container').appendChild(div_insidey);
		}
		var div_inside1=document.createElement("div");
		div_inside1.id = 'quest_div';
		div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data +response.getElementsByTagName('quest_data_user')[0].firstChild.data;
		saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
		quiz_cont.appendChild(div_inside1);
<?php 
        //Max: modign skip question
        ?>
		if(parseInt(skip_next_quest)){
	<?php 
        $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 ($quiz->c_slide) {
            $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
        }
        $m_str = JLMS_ShowToolbar($toolbar, false);
        ?>
			var subject = '<?php 
        echo str_replace('/', '\\/', addslashes($m_str));
        ?>
';
			html_replace = subject.split('__skip__').join(skip_next_quest);
			jq_UpdateTaskDiv_htm(html_replace);
		} else {
	<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
        if ($quiz->c_slide) {
            $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
        }
        $m_str = JLMS_ShowToolbar($toolbar, false);
        ?>
			
			jq_UpdateTaskDiv_htm('<?php 
        echo str_replace('/', '\\/', addslashes($m_str));
        ?>
');
		}

			jq_UpdateTaskDiv('next');
		
		var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
		saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
		if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
			var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
			saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
			eval(v_quiz_script_data);
		}
	}
	function jq_QuizContinueFinish() {
		jq_MakeRequest('&atask=finish_stop&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&user_unique_id='+user_unique_id, 1);
	}
	function jq_QuizBack() {
		cur_quest_id = saved_prev_quest_id;
		cur_quest_type = saved_prev_quest_type;
		cur_quest_score = saved_prev_quest_score;
		cur_quest_num = saved_prev_quest_num;
		var quiz_cont = getObj('jq_quiz_container');
		quiz_cont.innerHTML = '';
		if (cur_quest_type == 7) {
			var div_insidey=document.createElement("div");
			div_insidey.id = 'quest_div_hs';
			getObj('jq_quiz_container').appendChild(div_insidey);
		}
		var div_inside1=document.createElement("div");
		div_inside1.id = 'quest_div';
		div_inside1.innerHTML = saved_prev_quest_data;
		quiz_cont.appendChild(div_inside1);
<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
        if ($quiz->c_slide) {
            $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
        }
        $m_str = JLMS_ShowToolbar($toolbar, false);
        ?>
		jq_UpdateTaskDiv_htm('<?php 
        echo str_replace('/', '\\/', addslashes($m_str));
        ?>
');
		jq_UpdateTaskDiv('next');
		var is_exec_quiz_script = saved_prev_quest_exec_quiz_script;
		if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
			var v_quiz_script_data = saved_prev_quest_exec_quiz_script_data;
			eval(v_quiz_script_data);
		}
	}
	function URLencode(sStr) {
		return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
	}
	function TRIM_str(sStr) {
		return (sStr.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
	}
	function jq_QuizNext() { //send 'TASK = next'
		<?php 
        if ($is_preview) {
            ?>
		var jq_task = 'next_preview';
		<?php 
        } else {
            ?>
		var jq_task = 'next';
		<?php 
        }
        ?>
		switch (cur_quest_type) {
			case '1':
			case '12':
			var answer = jq_Check_selectRadio('quest_choice', 'quest_form');
				if (answer || document.quest_form.ismandatory.value != '0') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '3':
				var answer = jq_Check_selectRadio('quest_choice', 'quest_form');
				if (answer) {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '2':
			case '13':
				var answer = jq_Check_selectCheckbox('quest_choice', 'quest_form');
				if (answer != '') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '4':
			case '11':
				var i_id;
				var i_value;
				var answer = '';
				var complete = true;
				var mas_ans = new Array(kol_drag_elems);
				for (i=0; i<kol_drag_elems; i++) {
					mas_ans[i] = 0;
					if ( (ids_in_cont[i] > 0) && (ids_in_cont[i] <= kol_drag_elems) ) {
						if (cont_for_ids[ids_in_cont[i] - 1] == i+1) {
							mas_ans[i] = ids_in_cont[i];
							answer = answer + answ_ids[ids_in_cont[i]] + '```';
						} else { complete = false; }
					} else { complete = false; }
				}
				if (!complete) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					setTimeout("jq_releaseBlock()", 1000);
					return false;
				} else {
					answer = answer.substring(0, answer.length - 3);
					answer = URLencode(answer);
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				}
			break;
			case '5':
				var answer = jq_Check_valueItem('quest_match', 'quest_form');
				answer = URLencode(answer);
				if (answer != '') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '6':
				var blank_item = document.quest_form.quest_blank;
				var answer = URLencode(TRIM_str(blank_item.value));
				if (answer != '' || document.quest_form.ismandatory.value != '0') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '7':
				var hs_x = parseInt(document.quest_form.hotspot_x.value);
				var hs_y = parseInt(document.quest_form.hotspot_y.value);
				if ((hs_x != 0) && (hs_y != 0)) {
					var answer = hs_x + ',' + hs_y;
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '8':
				var answer = URLencode(TRIM_str(document.quest_form.survey_box.value));
				if (answer != '' || document.quest_form.ismandatory.value != '0') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '9':
				var complete = true;
				var scale_count = parseInt(document.quest_form.scale_count.value);
				var answer = new Array(scale_count);
				for(i=0;i<scale_count;i++)
				{
					var cur_answer = jq_Check_selectRadio('ch_scale_'+i, 'quest_form');
					if(!cur_answer)
						complete = false;
					else
						answer[i] = cur_answer;	
				}
				if (!complete && document.quest_form.ismandatory.value!='1') {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					setTimeout("jq_releaseBlock()", 1000);
					return false;
				} else {
					
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				}
			break;	
			case '10':
				jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer=0', 1);
			break;
			default:
				ShowMessage('error_messagebox', 1, '<?php 
        echo $jq_language['quiz_unknown_error'];
        ?>
');
				setTimeout("jq_releaseBlock()", 1000);
			break;
		}
	}

	function jq_showLoading() {
		ShowMessage('error_messagebox', 0, '&nbsp;');

		getObj('jq_quiz_result_reviews').style.visibility = 'hidden';
		getObj('jq_quiz_explanation').style.visibility = 'hidden';
		getObj('jq_quiz_result_reviews').style.display = 'none';
		getObj('jq_quiz_explanation').style.display = 'none';
		getObj('jq_quiz_container').innerHTML = '<br /><br /><center><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/loading.gif" height="32" width="32" border="0" alt="loading" /><\/center>';
	}

	function jq_UpdateTaskDiv_htm(htm_txt) {
		getObj('jq_quiz_task_container').innerHTML = htm_txt;
	}

	function jq_UpdateTaskDiv(task) {
		switch (task) {
			case 'start':
				getObj('jq_quiz_task_container').innerHTML = jq_StartButton('jq_StartQuizOn()', '<?php 
        echo $jq_language['quiz_start'];
        ?>
');
			break;
			case 'resume':
			case 'next':
				//getObj('jq_quiz_task_container').innerHTML = jq_NextButton('jq_QuizNextOn()', '<?php 
        echo $jq_language['quiz_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";
				getObj('jq_question_id_container').style.visibility = "hidden";

				<?php 
        if ($JLMS_CONFIG->get('quizzes_show_quest_id', 0) == 1) {
            ?>

					quest_id_gqp = response.getElementsByTagName('quest_id_gqp')[0].firstChild.data;				
					quest_id_pool = response.getElementsByTagName('quest_id_pool')[0].firstChild.data;	

					if(quest_id_gqp > 0) {
						getObj('jq_question_id_container').innerHTML = "<?php 
            echo $JLMS_CONFIG->get('quizzes_quest_id_title', 0);
            ?>
"+quest_id_gqp;
					}
					if(quest_id_pool > 0) {
						getObj('jq_question_id_container').innerHTML = "<?php 
            echo $JLMS_CONFIG->get('quizzes_quest_id_title', 0);
            ?>
"+quest_id_pool;
					}

					if(quest_id_gqp > 0 || quest_id_pool > 0) {
						getObj('jq_question_id_container').style.display = "block";
						getObj('jq_question_id_container').style.visibility = "visible";
					}
					else {
						getObj('jq_question_id_container').style.display = "none";
						getObj('jq_question_id_container').style.visibility = "hidden";
					}

				<?php 
        }
        ?>
				<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
				getObj('progress_bar').style.display = "block";
				<?php 
        }
        ?>
			break;
			case 'review_next':
				//getObj('jq_quiz_task_container').innerHTML = jq_ContinueButton('jq_QuizReviewNext()', '<?php 
        echo $jq_language['quiz_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 'next_no_attempts':
				//getObj('jq_quiz_task_container').innerHTML = jq_ContinueButton('jq_QuizContinue()', '<?php 
        echo $jq_language['quiz_continue'];
        ?>
');
			break;
			case 'finish':
				<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
				getObj('progress_bar').style.display = "none";
				if (getObj('jq_question_id_container')) { getObj('jq_question_id_container').style.visibility = "hidden"; }
				<?php 
        }
        ?>
			case 'clear':
				getObj('jq_quiz_task_container').innerHTML = "";
				getObj('jq_quest_num_container').style.visibility = "hidden";
				getObj('jq_points_container').style.visibility = "hidden";
				getObj('jq_question_id_container').style.visibility = "hidden";
			break;
			case 'continue':
			break;
			case 'continue_finish':
			break;
			case 'back_continue':
				//getObj('jq_quiz_task_container').innerHTML = jq_ContinueButton('jq_QuizContinue()', '<?php 
        echo $jq_language['quiz_continue'];
        ?>
')+jq_BackButton('jq_QuizBack()', '<?php 
        echo $jq_language['quiz_back'];
        ?>
');
			break;
			case 'back_continue_finish':
				//getObj('jq_quiz_task_container').innerHTML = jq_ContinueButton('jq_QuizContinueFinish()', '<?php 
        echo $jq_language['quiz_continue'];
        ?>
')+jq_BackButton('jq_QuizBack()', '<?php 
        echo $jq_language['quiz_back'];
        ?>
');
			break;
			<?php 
        if ($is_preview) {
            ?>
			case 'preview_back':
				//getObj('jq_quiz_task_container').innerHTML = jq_BackButton('JQ_previewQuest()', '<?php 
            echo $jq_language['quiz_back'];
            ?>
');
			break;
			<?php 
        }
        ?>
		}
		<?php 
        if ($quiz->c_slide) {
            ?>
		if (result_is_shown == 1) { jq_ShowPanel(); }
		<?php 
        }
        ?>
		if (task == 'finish') {
			//var obj_plc = getObj('jq_panel_link_container');
			//if (obj_plc) obj_plc.style.visibility = 'hidden';
		}
	}
	function jq_NextButton(task, text) {
		return "<div id=\"jq_next_link_container\" onclick=\""+task+"\"><div class=\"back_button\" id=\"jq_quiz_task_link_container\"><a href=\"javascript: void(0)\">"+text+"<\/a><\/div><br /><\/div>";
	}
	function jq_ContinueButton(task, text) {
		return "<div id=\"jq_continue_link_container\" onclick=\""+task+"\"><div class=\"back_button\" id=\"jq_quiz_task_link_container\"><a href=\"javascript: void(0)\">"+text+"<\/a><\/div><br /><\/div>";
	}
	function jq_StartButton(task, text) {
		return "<div id=\"jq_start_link_container\" onclick=\""+task+"\"><div class=\"back_button\" id=\"jq_quiz_task_link_container\"><a href=\"javascript: void(0)\">"+text+"<\/a><\/div><br /><\/div>";
	}
	function jq_BackButton(task, text) {
		return "<div id=\"jq_back_link_container\" onclick=\""+task+"\"><div class=\"back_button\" id=\"jq_quiz_task_link_container\"><a href=\"javascript: void(0)\">"+text+"<\/a><\/div><br /><\/div>";
	}
	function jq_ShowPanel_go() {
		var jq_quiz_c_cont = getObj('jq_quiz_container');
		if (jq_quiz_c_cont) { jq_quiz_c_cont.style.visibility = 'hidden'; jq_quiz_c_cont.style.display = 'none';}
		var jq_quiz_r_c = getObj('jq_quiz_result_container');
		if (jq_quiz_r_c) { jq_quiz_r_c.style.visibility = 'visible'; jq_quiz_r_c.style.display = 'block';}
	}
	function jq_HidePanel_go() {
		var jq_quiz_r_c = getObj('jq_quiz_result_container');
		if (jq_quiz_r_c) { jq_quiz_r_c.style.visibility = 'hidden'; jq_quiz_r_c.style.display = 'none';}
		var jq_quiz_c_cont = getObj('jq_quiz_container');
		if (jq_quiz_c_cont) { jq_quiz_c_cont.style.visibility = 'visible'; jq_quiz_c_cont.style.display = 'block';}
	}
	function jq_ShowPanel() {
<?php 
        if ($quiz->c_slide) {
            ?>
	
		if (result_is_shown == 1) { jq_HidePanel_go(); result_is_shown = 0;	}
		else { jq_ShowPanel_go();	result_is_shown = 1; }
<?php 
        }
        ?>
	}
<?php 
        if ($is_preview) {
            ?>
	function JQ_previewQuest() {
		jq_MakeRequest('&atask=preview_quest&quiz=<?php 
            echo $quiz->c_id;
            ?>
'+'&preview_id=<?php 
            echo $preview_id;
            ?>
&quest_id=<?php 
            echo $preview_quest;
            ?>
', 1);
	}
<?php 
        }
        ?>

//--><!]]>
</script>
<div>
	<?php 
        $quiz->template_name = 'joomlaquiz_lms_template';
        if ($quiz->template_name) {
            require dirname(__FILE__) . '/templates/' . $quiz->template_name . '/jq_template.php';
            //$url_link = 'index.php?option='.$option.'&task=quiz_action&id='.$course_id.'&atask=start&quiz='.$quiz->c_id.'&Itemid='.$Itemid.'';
            //no-js functionality commented in JoomlaLMS 1.1.0 (due to the lost of bugs and lack of usage)
            $url_link = 'javascript:void(0);';
            $page = strval(mosGetParam($_REQUEST, 'page', ''));
            $task_cont = '';
            if ($page != 'view_preview') {
                $task_cont .= "\n\t\t\t<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"right\" style=\"text-align: right;\" class=\"jlms_table_no_borders\">\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>";
                if ($self_verification != '') {
                    $task_cont .= "<input type='image' src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_start.png' name='atask' value='start'/>";
                    $task_cont .= "<input type='hidden' name='task' value='quiz_action'/>";
                    $task_cont .= "<input type='hidden' name='id' value='" . $course_id . "'/>";
                    $task_cont .= "<input type='hidden' name='quiz' value='" . $quiz->c_id . "'/>";
                    $task_cont .= "<input type='hidden' name='atask' value='start'/>";
                } else {
                    $task_cont .= "<a style=\"cursor: pointer;\" href=\"" . sefRelToAbs($url_link) . "\">\n\t\t\t\t\t\t\t\t<img width=\"32\" height=\"32\" border=\"0\" title=\"" . _JLMS_START_ALT_TITLE . "\" alt=\"" . _JLMS_START_ALT_TITLE . "\" src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_start.png\" class=\"JLMS_png\"/>\n\t\t\t\t\t\t\t</a>";
                }
                $task_cont .= "</td>\n\t\t\t\t\t\t<td valign=\"middle\" style=\"vertical-align: middle;\">";
                if ($self_verification != '') {
                    $task_cont .= "&nbsp;" . _JLMS_START_ALT_TITLE . "&nbsp;";
                } else {
                    $task_cont .= "<a style=\"cursor: pointer;\" href=\"" . sefRelToAbs($url_link) . "\">&nbsp;" . _JLMS_START_ALT_TITLE . "&nbsp;</a>";
                }
                $task_cont .= "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>";
            }
            $query = "SELECT a.*, 'joomlaquiz_lms_template' as template_name FROM #__lms_quiz_t_quiz as a WHERE a.c_id = " . $quiz->c_id . " and a.course_id = " . $course_id;
            $JLMS_DB->SetQuery($query);
            $quiz_params = $JLMS_DB->LoadObjectList();
            $descr_cont = isset($quiz_params[0]->c_description) ? $quiz_params[0]->c_description : '';
            $descr_cont = JLMS_ShowText_WithFeatures($descr_cont);
            $progress_bar_js = true;
            //by Max
            if ($preview_quest) {
                $progress_bar_js = false;
            }
            echo JoomlaQuiz_template_class::JQ_MainScreen($descr_cont, $task_cont, $self_verification, $progress_bar_js);
            if ($is_preview) {
                ?>
			<script language="JavaScript" type="text/javascript">
			<!--//--><![CDATA[//><!--
				var jq_quiz_c_t = getObj('jq_quiz_container_title');
				if (jq_quiz_c_t) jq_quiz_c_t.innerHTML = "<?php 
                echo addslashes($quiz->c_title);
                ?>
";
				var jq_quiz_c_d = getObj('jq_quiz_container_description');
				if (jq_quiz_c_d) jq_quiz_c_d.innerHTML = "<?php 
                echo "Click <a href='javascript:void(0)' onclick='JQ_previewQuest();'>here<\\/a> to preview the question";
                ?>
";
			//--><!]]>
			</script>
			</div>
			<?php 
            } else {
                $quiz_params = new JLMSParameters($quiz->params);
                if ($quiz_params->get('sh_self_verification', 0) == 1) {
                    $toolbar = array();
                    if ($quiz->attempts_of_this_quiz < $quiz->c_max_numb_attempts || $quiz->c_max_numb_attempts == 0) {
                        $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:jq_StartQuizOn_selfver(); return false;");
                    }
                } else {
                    $toolbar = array();
                    if ($quiz->attempts_of_this_quiz < $quiz->c_max_numb_attempts || $quiz->c_max_numb_attempts == 0) {
                        $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:jq_StartQuizOn(); return false;");
                    }
                }
                //if(isset($quiz->resume_quiz) && $quiz->resume_quiz && $quiz->last_question)
                if (isset($quiz->resume_quiz) && $quiz->resume_quiz && !$quiz->c_total_time) {
                    $toolbar[] = array('btn_type' => 'resume', 'btn_js' => "javascript:jq_ResumeQuizOn(" . $quiz->resume_quiz . ",'" . $quiz->unique_id . "', " . $quiz->last_question . "); return false;");
                }
                $m_str = JLMS_ShowToolbar($toolbar, false);
                //				$m_str = addslashes($m_str);
                //				$m_str = addslashes($m_str);
                $domready2 = '
				jq_UpdateTaskDiv_htm("' . str_replace('/', '\\/', addslashes($m_str)) . '");
				var jq_quiz_c_t = getObj(\'jq_quiz_container_title\');
				if (jq_quiz_c_t) jq_quiz_c_t.innerHTML = "' . addslashes($quiz->c_title) . '";
				var jq_quiz_c_d = getObj(\'jq_quiz_container_description\');
//				if (jq_quiz_c_d) jq_quiz_c_d.innerHTML = "' . str_replace("\n", '', str_replace("\r", '', str_replace("/", "\\/", addslashes($quiz->c_description)))) . '";
				var jq_qiuz_c_selfver = getObj(\'jq_quiz_container_selfver\');
				if (jq_qiuz_c_selfver) jq_qiuz_c_selfver.innerHTML = "' . str_replace("\n", '', str_replace("\r", '', str_replace("/", "\\/", addslashes($self_verification)))) . '";
				';
                $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready2);
                ?>

			</div>
<?php 
            }
            //TODO: replace getObj with mootools $ operand.... !!!!!! NOTE !!!!!!!!!!!! we should update DOM using $ only after ondomready !!!
        }
    }