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 showUserGradebook($id, $option, &$rows, &$lists)
    {
        global $Itemid, $JLMS_CONFIG;
        $juser = JLMSFactory::getUser();
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->CheckPermissions('gradebook', 'manage')) {
            ?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	form.task.value = pressbutton;
	form.submit();
}
function submitbutton_crtf(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'gb_crtA'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
//-->
</script>
	<?php 
        }
        ?>

	<?php 
        echo '<table class="contentpane" id="joomlalms_usergradebook" style="width:100%" cellpadding="0" cellspacing="0" border="0">' . "\r\n";
        $hparams = array();
        $toolbar = array();
        if ($JLMS_ACL->CheckPermissions('gradebook', 'manage')) {
            if (count($lists['gb_rows'])) {
                $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_grades');");
            }
            $toolbar[] = array('btn_type' => 'pdf', 'btn_js' => JLMSRoute::_("index.php?option={$option}&Itemid={$Itemid}&task=gb_user_pdf&course_id={$id}&id=" . $lists['user_id']));
            $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=gradebook&id={$id}"));
        } else {
            $toolbar[] = array('btn_type' => 'pdf', 'btn_js' => JLMSRoute::_("index.php?option={$option}&Itemid={$Itemid}&task=gb_user_pdf&course_id={$id}&id=" . $lists['user_id']));
        }
        JLMS_TMPL::ShowHeader('gradebook', _JLMS_GB_TITLE, $hparams, $toolbar);
        $userinfo = array();
        $userinfo['text'] = JLMS_outputUserInfo($rows[0]->username, $rows[0]->name, $rows[0]->email, $rows[0]->ug_name, '20%');
        $crtf_txt = array();
        $crtf_txt['text'] = '';
        $crtf_txt['attrib'] = ' nowrap="nowrap"';
        if ($JLMS_ACL->CheckPermissions('gradebook', 'manage')) {
            $crtf_txt['text'] = '<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders"><tr><td width="30%" nowrap="nowrap">' . _JLMS_COURSE_COMPLETED_ADMIN . '</td>';
            $crtf_txt['text'] .= '<td>&nbsp;&nbsp;';
            $image = $rows[0]->user_certificate ? 'btn_accept.png' : 'btn_cancel.png';
            $alt = $rows[0]->user_certificate ? _JLMS_GB_USER_HAVE_CRT : _JLMS_GB_USER_HAVE_NO_CRT;
            $state = $rows[0]->user_certificate ? 0 : 1;
            $crtf_txt['text'] .= '<a class="jlms_img_link" href="javascript:submitbutton_crtf(\'gb_crtA\',' . $state . ',' . $rows[0]->user_id . ')" title="' . $alt . '"><img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" /></a>';
            $crtf_txt['text'] .= '</td></tr></table>';
        } elseif ($JLMS_ACL->CheckPermissions('gradebook', 'view') && $rows[0]->user_certificate) {
            $crtf_txt['text'] = '<table width="100%" cellpadding="0" cellspacing="0" border="0" id="usergradebook_header_crtf_info" class="jlms_table_no_borders"><tr><td width="30%">' . ($juser->get('id') == $rows[0]->user_id ? _JLMS_COURSE_COMPLETED_USER : _JLMS_COURSE_COMPLETED_ADMIN) . '</td>';
            $crtf_txt['text'] .= '<td>&nbsp;&nbsp;';
            $image = $rows[0]->user_certificate ? 'btn_accept.png' : 'btn_cancel.png';
            $alt = $rows[0]->user_certificate ? _JLMS_GB_USER_HAVE_CRT : _JLMS_GB_USER_HAVE_NO_CRT;
            $state = $rows[0]->user_certificate ? 0 : 1;
            $crtf_txt['text'] .= JLMS_gradebook_html::publishIcon($rows[0]->user_id, $id, $state, 'gb_crtA', $alt, $image, $option, '');
            $crtf_txt['text'] .= '</td></tr></table>';
        }
        $params_cs = array();
        if ($JLMS_ACL->CheckPermissions('gradebook', 'manage') && !empty($lists['enrollment_answers'])) {
            JLMS_TMPL::OpenTS('', ' id="usergradebook_header"');
            echo '<table width="100%" class="jlms_table_no_borders">';
            echo '<tr><td width="50%" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0" id="usergradebook_header_user_info" class="' . JLMSCSS::_('jlmslist') . '" style="margin:0px;padding:0px;">';
            echo '<tr><' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" colspan="2">' . _JLMS_GB_USER_INFORMATION . '</' . JLMSCSS::tableheadertag() . '></tr>';
            echo '<tr class="' . JLMSCSS::_('sectiontableentry1') . '"><td align="left">' . _JLMS_UI_USERNAME . '</td><td align="left">' . $rows[0]->username . '</td></tr>';
            echo '<tr class="' . JLMSCSS::_('sectiontableentry2') . '"><td align="left">' . _JLMS_UI_NAME . '</td><td align="left">' . $rows[0]->name . '</td></tr>';
            echo '<tr class="' . JLMSCSS::_('sectiontableentry1') . '"><td align="left">' . _JLMS_UI_EMAIL . '</td><td align="left">' . $rows[0]->email . '</td></tr>';
            echo '<tr class="' . JLMSCSS::_('sectiontableentry2') . '"><td align="left">' . _JLMS_UI_GROUP . '</td><td align="left">' . ($rows[0]->ug_name ? $rows[0]->ug_name : '&nbsp;') . '</td></tr>';
            echo '</table><br />';
            echo $crtf_txt['text'];
            echo '</td><td width="50%" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0" id="usergradebook_header_reg_info" class="' . JLMSCSS::_('jlmslist') . '" style="margin:0px;padding:0px;">';
            echo '<tr><' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" colspan="2">' . _JLMS_GB_REG_INFORMATION . '</' . JLMSCSS::tableheadertag() . '></tr>';
            $k = 1;
            foreach ($lists['enrollment_answers'] as $ea) {
                echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '"><td>' . $ea->course_question . '</td><td>' . ($ea->user_answer ? $ea->user_answer : '&nbsp;') . '</td></tr>';
                $k = 3 - $k;
            }
            echo '</table></td></tr>';
            echo '</table>';
            JLMS_TMPL::CloseTS();
        } else {
            $params_cs[] = $userinfo;
            $params_cs[] = $crtf_txt;
            JLMS_TMPL::ShowCustomSection($params_cs);
        }
        /**
         * Certificates MOD - 04.10.2007 (DEN)
         * We will show the list of all achieved certificates in the User Gradebook
         */
        global $JLMS_DB;
        $query = "SELECT count(*) FROM #__lms_certificates WHERE course_id = '" . $id . "' AND published = 1 AND crtf_type = 1 AND parent_id = 0";
        $JLMS_DB->SetQuery($query);
        $is_course_certificate = $JLMS_DB->loadResult();
        if (!empty($lists['user_quiz_certificates']) || isset($rows[0]->user_certificate) && $rows[0]->user_certificate && $is_course_certificate) {
            JLMS_TMPL::OpenTS('', ' id="usergradebook_certificates_title"');
            echo '<br />';
            echo JLMSCSS::h2(_JLMS_GB_CERTIFICATES);
            JLMS_TMPL::CloseTS();
            JLMS_TMPL::OpenTS();
            $old_format = $JLMS_CONFIG->get('date_format', 'Y-m-d');
            $new_format = $JLMS_CONFIG->get('gradebook_certificate_date', '');
            if ($new_format) {
                $JLMS_CONFIG->set('date_format', $new_format);
            }
            echo '<table class="' . JLMSCSS::_('jlmslist') . '" id="usergradebook_certificates" style="width:100%" cellpadding="0" cellspacing="0" border="0">' . "\r\n";
            $k = 2;
            foreach ($lists['user_quiz_certificates'] as $crtf_row) {
                echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '"><td width="16"><img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/btn_certificate.png" alt="certificate" width="16" height="16" /></td><td width="30%" align="left"><strong>' . $crtf_row->quiz_name . '</strong></td>' . '<td>' . JLMS_offsetDateToDisplay($crtf_row->crtf_date) . '</td>' . '<td align=\'left\'>' . ($JLMS_ACL->CheckPermissions('gradebook', 'view') ? '<a target="_blank" href="' . ampReplace($JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&no_html=1&task=print_quiz_cert&course_id={$id}&stu_quiz_id={$crtf_row->stu_quiz_id}&user_unique_id={$crtf_row->user_unique_id}") . '">' . _JLMS_GB_PRINT_CERTIFICATE . '</a>' : '') . '</td></tr>';
                $k = 3 - $k;
            }
            if (isset($rows[0]->user_certificate) && $rows[0]->user_certificate && $is_course_certificate) {
                $cert_user_id = 0;
                if (isset($lists['user_id']) && $lists['user_id']) {
                    global $my;
                    if ($my->id == $lists['user_id']) {
                    } else {
                        $cert_user_id = $lists['user_id'];
                    }
                }
                $link = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gb_get_cert&amp;id={$id}" . ($cert_user_id ? "&amp;user_id={$cert_user_id}" : '')));
                echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '"><td width="16"><img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/btn_certificate.png" alt="certificate" width="16" height="16" /></td><td width="30%" align="left"><strong>' . _JLMS_GB_COURSE_CERTIFICATE . '</strong></td>' . '<td>' . JLMS_offsetDateToDisplay($rows[0]->user_certificate_date) . '</td>' . '<td align=\'left\'>' . ($JLMS_ACL->CheckPermissions('gradebook', 'view') ? '<a target="_blank" href="' . $link . '">' . _JLMS_GB_PRINT_CERTIFICATE . '</a>' : '&nbsp;') . '</td></tr>';
            }
            JLMS_TMPL::CloseMT();
            JLMS_TMPL::CloseTS();
            $JLMS_CONFIG->set('date_format', $old_format);
        }
        /* END of Certificates MOD */
        if (count($lists['sc_rows'])) {
            $k = 2;
            $is_shown = 0;
            foreach ($lists['sc_rows'] as $sc_row) {
                if ($sc_row->show_in_gradebook) {
                    $is_shown++;
                    if ($is_shown == 1) {
                        JLMS_TMPL::OpenTS('', ' id="usergradebook_scorms_title"');
                        echo '<br />';
                        echo JLMSCSS::h2(_JLMS_GB_SCORM_RESULTS);
                        JLMS_TMPL::CloseTS();
                        JLMS_TMPL::OpenTS();
                        echo '<table class="' . JLMSCSS::_('jlmslist') . '" id="usergradebook_scorms" style="width:100%" cellpadding="0" cellspacing="0" border="0">' . "\r\n";
                    }
                    $j = 0;
                    while ($j < count($rows[0]->scorm_info)) {
                        if ($rows[0]->scorm_info[$j]->gbi_id == $sc_row->item_id) {
                            if ($rows[0]->scorm_info[$j]->user_status == -1) {
                                echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '"><td width="30%" align="left"><strong>' . $sc_row->lpath_name . '</strong></td>' . '<td align=\'left\' colspan="2">' . '-' . '</td></tr>';
                                $k = 3 - $k;
                            } else {
                                $image = $rows[0]->scorm_info[$j]->user_status ? 'btn_accept.png' : 'btn_cancel.png';
                                $alt = $rows[0]->scorm_info[$j]->user_status ? 'btn_accept' : 'btn_cancel';
                                $img = JLMS_gradebook_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false);
                                echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '"><td width="30%" align="left"><strong>' . $sc_row->lpath_name . '</strong></td>' . '<td width="16">' . $img . '</td>' . '<td align=\'left\'>' . '<b>' . $rows[0]->scorm_info[$j]->user_grade . "</b> (" . $rows[0]->scorm_info[$j]->user_pts . _JLMS_GB_POINTS . ")" . '</td></tr>';
                                $k = 3 - $k;
                            }
                        }
                        $j++;
                    }
                }
            }
            if ($is_shown) {
                JLMS_TMPL::CloseMT();
                JLMS_TMPL::CloseTS();
            }
        }
        if (count($lists['quiz_rows'])) {
            JLMS_TMPL::OpenTS('', ' id="usergradebook_quizzes_title"');
            echo '<br />';
            echo JLMSCSS::h2(_JLMS_GB_QUIZ_RESULTS);
            JLMS_TMPL::CloseTS();
            JLMS_TMPL::OpenTS();
            /*Integration Plugin Percentiles*/
            if (isset($lists['chart_percentiles']->show) && $lists['chart_percentiles']->show) {
                JLMS_TMPL::OpenTS();
                echo $lists['chart_percentiles']->chart;
                JLMS_TMPL::CloseTS();
            }
            /*Integration Plugin Percentiles*/
            echo '<table class="' . JLMSCSS::_('jlmslist') . '" id="usergradebook_quizzes" style="width:100%" cellpadding="0" cellspacing="0" border="0">' . "\r\n";
            $k = 2;
            foreach ($lists['quiz_rows'] as $quiz_row) {
                $j = 0;
                while ($j < count($rows[0]->quiz_info)) {
                    if ($rows[0]->quiz_info[$j]->gbi_id == $quiz_row->c_id) {
                        //						if ($rows[0]->quiz_info[$j]->user_status == -1) {
                        //							echo '<tr class="'.JLMSCSS::_('sectiontableentry'.$k).'"><td width="30%" align="left"><strong>'.$quiz_row->c_title.'</strong></td>'
                        //							. '<td align=\'left\' colspan="2">'
                        //							. '-'
                        //							. '</td></tr>';
                        //							$k = 3 - $k;
                        //						} else {
                        //							$image = $rows[0]->quiz_info[$j]->user_status ? 'btn_accept.png' : 'btn_cancel.png';
                        //							$alt = $rows[0]->quiz_info[$j]->user_status ? 'btn_accept' : 'btn_cancel';
                        //							$img = JLMS_gradebook_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false );
                        echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '"><td width="30%" align="left"><strong>' . $quiz_row->c_title . '</strong></td>';
                        //old functional
                        //							echo '<td width="16">'. $img.'</td>';
                        //							echo '<td align=\'left\'>'
                        //							. '<b>' . $rows[0]->quiz_info[$j]->user_grade . "</b> (" . $rows[0]->quiz_info[$j]->user_pts_full .")";
                        //							/*Integration Plugin Percentiles*/
                        //							if (isset($rows[0]->quiz_info[$j]->user_percentile)) {
                        //								echo ' - '.$rows[0]->quiz_info[$j]->user_percentile;
                        //							}
                        //							/*Integration Plugin Percentiles*/
                        //							echo '</td>';
                        //new functional
                        echo '<td>';
                        echo JLMS_showQuizStatus($rows[0]->quiz_info[$j]);
                        echo '</td>';
                        if (isset($rows[0]->quiz_info[$j]->user_unique_id)) {
                            $show_print = false;
                            if (isset($rows[0]->quiz_info[$j]->allow_user_pdf_print) && $rows[0]->quiz_info[$j]->allow_user_pdf_print) {
                                $show_print = true;
                            } elseif ($JLMS_ACL->CheckPermissions('gradebook', 'manage')) {
                                $show_print = true;
                            } elseif ($JLMS_ACL->isStaff()) {
                                $show_print = true;
                            }
                            if ($show_print) {
                                echo '' . '<td><a target="_blank" href="' . $JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&amp;option=com_joomla_lms&amp;Itemid=' . $Itemid . '&amp;no_html=1&amp;task=print_quiz_result&amp;course_id=' . $quiz_row->course_id . '&amp;stu_quiz_id=' . $rows[0]->quiz_info[$j]->stu_quiz_id . '&amp;user_unique_id=' . $rows[0]->quiz_info[$j]->user_unique_id . '">' . _JLMS_PRINT_RESULTS . '</a></td>';
                            } else {
                                echo '<td>';
                                echo '&nbsp;';
                                echo '</td>';
                            }
                        } else {
                            echo '<td>';
                            echo '&nbsp;';
                            echo '</td>';
                        }
                        echo '</tr>';
                        $k = 3 - $k;
                        //						}
                    }
                    $j++;
                }
            }
            JLMS_TMPL::CloseMT();
            JLMS_TMPL::CloseTS();
        }
        if (count($lists['gb_rows'])) {
            JLMS_TMPL::OpenTS('', ' id="usergradebook_grades_title"');
            echo '<br />';
            echo JLMSCSS::h2(_JLMS_GB_GBI_RESULTS);
            JLMS_TMPL::CloseTS();
            JLMS_TMPL::OpenTS();
            ?>
			<form action="<?php 
            echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
            ?>
" method="post" name="adminForm">

			<?php 
            echo '<table class="' . JLMSCSS::_('jlmslist') . '" id="usergradebook_grades" style="width:100%" cellpadding="0" cellspacing="0" border="0">' . "\r\n";
            $k = 2;
            foreach ($lists['gb_rows'] as $gb_row) {
                $j = 0;
                while ($j < count($rows[0]->grade_info)) {
                    if ($rows[0]->grade_info[$j]->gbi_id == $gb_row->id) {
                        echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '"><td width="30%" align="left"><strong>' . $gb_row->gbi_name . '</strong></td>' . '<td align=\'left\' colspan="2">' . ($JLMS_ACL->CheckPermissions('gradebook', 'manage') ? JLMS_gradebook_html::Create_SelectList($id, $rows[0]->grade_info[$j]->scale_id, $gb_row->id) : $rows[0]->grade_info[$j]->user_grade);
                        echo '</td></tr>';
                        $k = 3 - $k;
                    }
                    $j++;
                }
            }
            JLMS_TMPL::CloseMT();
            ?>
				<input type="hidden" name="option" value="<?php 
            echo $option;
            ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
            echo $Itemid;
            ?>
" />
				<input type="hidden" name="task" value="gradebook" />
				<input type="hidden" name="state" value="0" />
				<input type="hidden" name="cid2" value="0" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="id" value="<?php 
            echo $id;
            ?>
" />
				<input type="hidden" name="user_id" value="<?php 
            echo $lists['user_id'];
            ?>
" />
			</form>	
			<?php 
            JLMS_TMPL::CloseTS();
            JLMS_TMPL::CloseMT();
        } else {
            JLMS_TMPL::CloseMT();
            ?>
			<form action="<?php 
            echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
            ?>
" method="post" name="adminForm">
				<input type="hidden" name="option" value="<?php 
            echo $option;
            ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
            echo $Itemid;
            ?>
" />
				<input type="hidden" name="task" value="gradebook" />
				<input type="hidden" name="state" value="0" />
				<input type="hidden" name="cid2" value="0" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="id" value="<?php 
            echo $id;
            ?>
" />
				<input type="hidden" name="user_id" value="<?php 
            echo $lists['user_id'];
            ?>
" />
			</form>	
			<?php 
        }
        ?>
	
<?php 
    }