function JLMS_sreportGradeFV($option, &$rows, &$pageNav, &$lists, $levels, $filt_group, $filt_cat, $user_id, $is_full)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        JLMS_TMPL::OpenMT();
        $lists['user_id'] = isset($lists['user_id']) ? $lists['user_id'] : 0;
        if ($is_full) {
            $hparams = array('show_menu' => false);
        } else {
            $hparams = array('simple_menu' => true);
        }
        $toolbar = array();
        $page_heading = _JLMS_REPORTS_USER . ' ' . date("Y-m-d H:i:s");
        if ($JLMS_CONFIG->get('is_trial', false) && $JLMS_CONFIG->get('trial_reports_heading_text', '')) {
            $page_heading = _JLMS_REPORTS_USER . $JLMS_CONFIG->get('trial_reports_heading_text', '');
        }
        JLMS_TMPL::ShowHeader('tracking', $page_heading, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
	<script language="javascript" type="text/javascript">
	<!--//--><![CDATA[//><!--
			var old_filters = new Array();
			function read_filter(){
				var form = document.adminForm;
				var count_levels = '<?php 
        echo count($levels);
        ?>
';
				for(var i=0;i<parseInt(count_levels);i++){
					if(form['filter_id_'+i] != null){
						old_filters[i] = form['filter_id_'+i].value;
					}
				}
			}
			function write_filter(){
				var form = document.adminForm;
				var count_levels = '<?php 
        echo count($levels);
        ?>
';
				var j;
				for(var i=0;i<parseInt(count_levels);i++){
					if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
						j = i;
					}
					if(i > j){
						if(form['filter_id_'+i] != null){
							form['filter_id_'+i].value = 0;
						}
					}
				}
			}
			function submitFormView(){
				var form = document.adminForm;
			//	form.view.value = view;
				form.task.value='report_grade';
				form.submit();
			}
	//--><!]]>
	</script>
	<?php 
        $action_url = $is_full ? $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&amp;option={$option}&amp;Itemid={$Itemid}" : sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
			<form action="<?php 
        echo $action_url;
        ?>
" method="post" name="adminForm">
			
				<table cellpadding="0" cellspacing="0" border="0" id="TheTable" <?php 
        echo $is_full ? "" : 'width="100%"';
        ?>
 class="jlms_table_no_borders">
					<?php 
        if (!$is_full) {
            ?>
					<tr>
						<td align="<?php 
            echo $is_full ? "left" : "right";
            ?>
" <?php 
            echo !$is_full ? 'colspan="2"' : '';
            ?>
>
							<table <?php 
            echo $is_full ? '' : 'width="30%"';
            ?>
 class="jlms_table_no_borders">
								<tr>
									<td valign="top" <?php 
            echo $is_full ? 'width="400"' : 'width="40%"';
            ?>
>
										<table width="100%" border="0" class="jlms_table_no_borders">
											<tr>
												<td <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap">
													Report Type:
												</td>
												<td>
													<?php 
            echo JLMS_switchType($option);
            ?>
												</td>
											</tr>
										</table>		
									</td>
								</tr>
							</table>	
						</td>
					</tr>
					<?php 
        }
        ?>
					<tr>
						<td align="left">
							<table <?php 
        echo $is_full ? '' : 'width="100%"';
        ?>
 class="jlms_table_no_borders">
								<tr>
									<td valign="top" <?php 
        echo $is_full ? 'width="400"' : 'width="40%"';
        ?>
>
										<table width="100%" border="0" class="jlms_table_no_borders">
											<?php 
        if ($is_full) {
            ?>
											<tr>
												<td <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap">
													Report Type:
												</td>
												<td>
													<?php 
            echo JLMS_switchType($option);
            ?>
												</td>
											</tr>
											<?php 
        }
        ?>
											<tr>
												<td <?php 
        echo $is_full ? 'width="100"' : 'width="20%"';
        ?>
 nowrap="nowrap">
													<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo isset($levels[0]->cat_name) && $levels[0]->cat_name != '' ? $levels[0]->cat_name : _JLMS_COURSES_COURSES_GROUPS;
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS;
        }
        ?>
												</td>
												<td>
													<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo $lists['filter_0'];
        } else {
            echo $lists['jlms_course_cats'];
        }
        ?>
												</td>
											</tr>
											<?php 
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    ?>
														<tr>
															<td <?php 
                    echo $is_full ? 'width="100"' : 'width="20%"';
                    ?>
 nowrap="nowrap">
																<?php 
                    echo isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS;
                    ?>
															</td>
															<td>
																<?php 
                    echo $lists['filter_' . $i];
                    ?>
															</td>
														</tr>
														<?php 
                }
            }
        }
        ?>
										</table>
									</td>
									<td valign="top" <?php 
        echo $is_full ? 'width="400"' : 'width="40%"';
        ?>
>
										<table width="100%" border="0" class="jlms_table_no_borders">
											<?php 
        if ($is_full) {
            ?>
											<tr>
												<td colspan="2">
													&nbsp;
												</td>
											</tr>
											<?php 
        }
        if ($JLMS_CONFIG->get('use_global_groups', 1)) {
            ?>
											<tr>
												<td <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap" style="padding-left: 5px;">
													<?php 
            echo _JLMS_USER_GROUP_INFO;
            ?>
												</td>
												<td>
													<?php 
            echo $lists['filter'];
            ?>
												</td>
											</tr>
											<?php 
        }
        ?>
											<tr>
												<td <?php 
        echo $is_full ? 'width="100"' : 'width="20%"';
        ?>
 nowrap="nowrap" style="padding-left: 5px;">
													<?php 
        echo _JLMS_USERS_TBL_HEAD_USERNAME . ':';
        ?>
												</td>
												<td>
													<?php 
        echo $lists['jlms_filt_user'];
        ?>
												</td>
											</tr>
										</table>
									</td>
									<?php 
        if (!$is_full) {
            ?>
									<td style="padding-left:15px;" align="right">
										<?php 
            $link = $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=" . $option . "&amp;Itemid={$Itemid}&amp;task=report_grade&amp;is_full=1";
            if ($filt_group) {
                $link .= "&amp;filt_group=" . $filt_group;
            }
            if ($user_id) {
                $link .= "&amp;filt_user="******"<?php 
            echo $link;
            ?>
" target="_blank" title="<?php 
            echo _JLMS_FULL_VIEW_BUTTON;
            ?>
"><?php 
            echo _JLMS_FULL_VIEW_BUTTON;
            ?>
</a>
									</td>
									<?php 
        }
        ?>
								</tr>
							</table>
						</td>
					</tr>
				</table>

				<?php 
        $max_row = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $latest_max_row = 0;
            $sc_rows = array();
            if (count($lists['sc_rows'][$i])) {
                $j = 0;
                foreach ($lists['sc_rows'][$i] as $sc_row) {
                    if ($sc_row->show_in_gradebook) {
                        $sc_rows[$j] = $sc_row;
                        $j++;
                    }
                }
            }
            $latest_max_row = $latest_max_row + count($sc_rows);
            $latest_max_row = $latest_max_row + count($lists['quiz_rows'][$i]);
            $latest_max_row = $latest_max_row + count($lists['gb_rows'][$i]);
            if ($latest_max_row > $max_row) {
                $max_row = $latest_max_row;
            }
        }
        ?>

				<table cellpadding="0" cellspacing="0" border="0" width="100%" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
				<?php 
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            ?>
						<tr style="border: 0px none;">
							<td colspan="<?php 
            echo $max_row + 1;
            ?>
" style="border: 0px none;">
							<br />
								<?php 
            echo JLMSCSS::h2($row->course_name);
            ?>
								<span class="small"><?php 
            echo _JLMS_REPORTS_ACCESSED_TIMES . " " . $lists['hits'][$i];
            ?>
</span>
							</td>
						</tr>
						<tr class="jlms_report_fullview_row">
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader', 'first_td');
            ?>
" style="text-align:center; white-space:nowrap"><?php 
            echo _JLMS_REPORTS_CONCLUSION_ROW;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<?php 
            $sc_num = 0;
            $i_row = 0;
            foreach ($lists['sc_rows'][$i] as $sc_row) {
                if ($sc_row->show_in_gradebook) {
                    $sc_num++;
                    echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . JLMS_reports_html::Echo_tbl_header($sc_row->lpath_name) . '</' . JLMSCSS::tableheadertag() . '>';
                    $i_row++;
                }
            }
            foreach ($lists['quiz_rows'][$i] as $quiz_row) {
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . JLMS_reports_html::Echo_tbl_header($quiz_row->c_title) . '</' . JLMSCSS::tableheadertag() . '>';
                $i_row++;
            }
            foreach ($lists['gb_rows'][$i] as $gb_row) {
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . JLMS_reports_html::Echo_tbl_header($gb_row->gbi_name) . '</' . JLMSCSS::tableheadertag() . '>';
                $i_row++;
            }
            if ($i_row < $max_row) {
                for ($jj = $i_row; $jj < $max_row; $jj++) {
                    echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">&nbsp;<!--x--></' . JLMSCSS::tableheadertag() . '>';
                }
            }
            ?>
						</tr>
					<?php 
            $k = 1;
            ?>
						<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k, 'jlms_report_fullview_row_bottom');
            ?>
">
							<td align="center" valign="middle" style=" text-align:center; vertical-align:middle" class="first_td">
								<?php 
            $image = $row->user_certificate ? 'btn_accept.png' : 'btn_cancel.png';
            $alt = '';
            $state = $row->user_certificate ? 0 : 1;
            echo JLMS_reports_html::publishIcon($row->user_id, 0, $state, 'gb_crt', $alt, $image, $option);
            ?>
							</td>
							<?php 
            $sc_num2 = 0;
            foreach ($lists['sc_rows'][$i] as $sc_row) {
                if ($sc_row->show_in_gradebook) {
                    $j = 0;
                    while ($j < count($row->scorm_info)) {
                        if ($row->scorm_info[$j]->gbi_id == $sc_row->item_id) {
                            if ($sc_num2 < $sc_num) {
                                if ($row->scorm_info[$j]->user_status == -1) {
                                    echo '<td align=\'center\' style="text-align:center">-</td>';
                                } else {
                                    $image = $row->scorm_info[$j]->user_status ? 'btn_accept.png' : 'btn_cancel.png';
                                    $alt = $row->scorm_info[$j]->user_status ? 'btn_accept' : 'btn_cancel';
                                    $alt .= '" align="top';
                                    $img = JLMS_reports_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false);
                                    echo '<td style="vertical-align:middle; text-align:center" nowrap="nowrap">' . $img . '&nbsp;<strong>' . $row->scorm_info[$j]->user_grade . "</strong> (" . $row->scorm_info[$j]->user_pts . ")" . '</td>';
                                }
                                $sc_num2++;
                            }
                        }
                        $j++;
                    }
                }
            }
            foreach ($lists['quiz_rows'][$i] as $quiz_row) {
                $j = 0;
                while ($j < count($row->quiz_info)) {
                    if ($row->quiz_info[$j]->gbi_id == $quiz_row->c_id) {
                        if ($row->quiz_info[$j]->user_status == -1) {
                            echo '<td align=\'center\' style="text-align:center">-</td>';
                        } else {
                            //											$image = $row->quiz_info[$j]->user_status ? 'btn_accept.png' : 'btn_cancel.png';
                            //											$alt = $row->quiz_info[$j]->user_status ? 'btn_accept' : 'btn_cancel';
                            //											$alt .= '" align="top';
                            //											$img = JLMS_reports_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false );
                            //
                            //											echo '<td style="vertical-align:middle; text-align:center" nowrap="nowrap">'.$img
                            //											. '&nbsp;<strong>' . $row->quiz_info[$j]->user_grade . "</strong> (" . $row->quiz_info[$j]->user_pts_full .")"
                            //											. '</td>';
                            echo '<td style="vertical-align:middle; text-align:center" nowrap="nowrap">';
                            echo JLMS_showQuizStatus($row->quiz_info[$j], 50);
                            echo '</td>';
                        }
                    }
                    $j++;
                }
            }
            $j = 0;
            while ($j < count($row->grade_info)) {
                echo '<td align=\'center\' valign="middle" style="vertical-align:middle;text-align:center "><strong>' . $row->grade_info[$j]->user_grade . '</strong></td>';
                $j++;
            }
            if ($i_row < $max_row) {
                for ($jj = $i_row; $jj < $max_row; $jj++) {
                    echo '<td align=\'center\' style="text-align:center;">&nbsp;<!--x--></td>';
                }
            }
            ?>
						</tr>
					<?php 
            $k = 3 - $k;
        }
        ?>
					</table>
					<?php 
        if (!$lists['user_id']) {
            echo '<div class="joomlalms_page_tip"  style="text-align:center">' . _JLMS_REPORTS_SELECT_USER . '</div>';
        }
        ?>
				<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
				<input type="hidden" name="task" value="report_grade" />
				<input type="hidden" name="state" value="0" />
				<input type="hidden" name="view" value="" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="is_full" value="<?php 
        echo $is_full;
        ?>
" />
	
			</form>
	<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function JQ_showQuizList_Stu(&$rows, &$lists, &$pageNav, $option, $id)
    {
        global $Itemid, $JLMS_CONFIG;
        JLMS_quiz_admin_html_class::showQuizHead($id, $option, _JLMS_QUIZ_STU_TITLE, false);
        ?>
		
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
<?php 
        if (!empty($rows) || $lists['used_category_filter']) {
            ?>
		<br />
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
				<td>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
					<tr>
						<td align="right" style="text-align:left ">
							<div align="right" style="white-space:nowrap ">
							<?php 
            echo _JLMS_QUIZ_FILTER_BY_CAT . '&nbsp;' . $lists['category'];
            ?>
							<noscript>
								<input type="submit" name="OK" value="OK" />
							</noscript>
							</div>
						</td>
					</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td width="100%">
				<?php 
            $quizzes_colspan = 6;
            ?>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
" style="margin-top:0px; padding-top:0px;">
					<tr>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_QUIZ_TBL_Q_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_QUIZ_TBL_Q_CAT;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_QUIZ_TBL_Q_P_SCORE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_QUIZ_YOUR_RESULTS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            $k = 1;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $row = $rows[$i];
                $link = sefRelToAbs('index.php?option=' . $option . '&amp;Itemid=' . $Itemid . '&amp;task=show_quiz&amp;id=' . $id . '&amp;quiz_id=' . $row->c_id);
                ?>
					<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
						<td align="center"><?php 
                echo $pageNav->limitstart + $i + 1;
                ?>
</td>
						<td align="left">
							<a href="<?php 
                echo $link;
                ?>
" title="<?php 
                echo str_replace('"', '&quot;', $row->c_title);
                ?>
">
							<?php 
                echo $row->c_title;
                ?>
							</a>
						<?php 
                if ($JLMS_CONFIG->get('show_quizzes_authors', 0)) {
                    ?>
						<br />
						<span class="small"><?php 
                    echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->author_name;
                    ?>
</span>
						<?php 
                }
                ?>
						</td>
						<td align="left">
							<?php 
                echo $row->c_category ? $row->c_category : '&nbsp;';
                ?>
						</td>
						<td align="left">
							<?php 
                echo $row->c_passing_score . '%';
                ?>
						</td>
						<?php 
                /*
                <td align="center" width="36" nowrap="nowrap">
                	<?php 
                	if(!isset($row->user_score)) { $row->user_score = 0; }
                	if(!isset($row->quiz_max_score)) { $row->quiz_max_score = 0; }	
                	
                	echo ($row->user_passed == -1) ? "&nbsp;-&nbsp;" : ($row->user_score."&nbsp;/&nbsp;".$row->quiz_max_score);?>
                </td>
                <td align="left">	 
                	<?php if(!isset($row->link_certificate)) {
                	 	echo (isset($row->user_passed) && ($row->user_passed == 1))?('<img class="JLMS_png" width="16" height="16" border="0" alt="passed" src="'.$JLMS_CONFIG->get('live_site').'/components/com_joomla_lms/lms_images/toolbar/btn_accept.png"/>'):('<img class="JLMS_png" width="16" height="16" border="0" alt="failed" src="'.$JLMS_CONFIG->get('live_site').'/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png"/>');
                	 }
                	 echo (isset($row->link_certificate))?$row->link_certificate:''?>
                </td>
                */
                ?>
						<td width="1%">
							<?php 
                echo JLMS_showQuizStatus($row);
                ?>
						</td>
					</tr>
					<?php 
                $k = 3 - $k;
            }
            ?>
				<tr>
					<td align="center" colspan="<?php 
            echo $quizzes_colspan;
            ?>
" class="<?php 
            echo JLMSCSS::_('jlmslist-footer_td');
            ?>
">
						<div align="center" style="white-space:nowrap">
						<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$id}";
            echo _JLMS_PN_DISPLAY_NUM . '&nbsp;' . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
            echo '<br />';
            echo $pageNav->writePagesLinks($link);
            ?>
 
						</div>
					</td>
				</tr>
				</table>
				</td>
			</tr>
		</table>
<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="task" value="quizzes" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		</form>
		<?php 
        JLMS_quiz_admin_html_class::showQuizFooter();
        ?>
		<?php 
    }
    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 
    }
Пример #4
0
function JLMS_REP_exportXLS($hits, $tot_hits = array(), $users, $courses, $reporting_header)
{
    global $JLMS_DB, $JLMS_CONFIG, $task, $option;
    $results = array();
    switch ($task) {
        case 'report_access':
            $users_str = implode(',', $users);
            $courses_str = implode(',', $courses);
            $JLMS_DB->setQuery('SELECT course_name FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name');
            $crs_name = $JLMS_DB->loadResultArray();
            $JLMS_DB->setQuery('SELECT * FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name');
            $crs_options = $JLMS_DB->loadObjectList();
            $results['title_courses'] = array();
            $i = 0;
            foreach ($crs_name as $key => $c_name) {
                $view_is_course = 1;
                if ($JLMS_CONFIG->get('flms_integration', 1)) {
                    $params = new JLMSParameters($crs_options[$key]->params);
                    $view_is_course = $params->get('show_in_report', 1);
                }
                if ($view_is_course) {
                    $results['title_courses'][$i]['course_name'] = $c_name;
                    $i++;
                }
            }
            $results['results'] = array();
            $results['results_hit'] = array();
            $j = 0;
            foreach ($users as $usr_id) {
                $JLMS_DB->setQuery('SELECT username, name, email FROM #__users WHERE id =' . $usr_id);
                $usrname = $JLMS_DB->LoadObject();
                $results['results'][$j]['username'] = $usrname->username;
                $results['results'][$j]['name'] = $usrname->name;
                //$results['results'][$j]['email'] = $usrname->email;
                $count = 0;
                $k = 0;
                foreach ($courses as $key => $course_id) {
                    $count++;
                    $hit_num = 0;
                    for ($i = 0; $i < count($hits); $i++) {
                        if ($hits[$i]->c_id == $course_id && $hits[$i]->usr_id == $usr_id) {
                            $hit_num = $hits[$i]->hits;
                            break;
                            // by DEN
                        } else {
                            if ($hits[$i]->c_id == $course_id && $usr_id == 'total') {
                                $hit_num = $hits[$i]->hits;
                                break;
                            }
                        }
                    }
                    $view_is_course = 1;
                    if ($JLMS_CONFIG->get('flms_integration', 1)) {
                        $params = new JLMSParameters($crs_options[$key]->params);
                        $view_is_course = $params->get('show_in_report', 1);
                    }
                    if ($view_is_course) {
                        $results['results_hit'][$j][$k] = $hit_num;
                    }
                    $k++;
                }
                $j++;
            }
            $results_total_hits = array();
            $k = 0;
            foreach ($courses as $course_id) {
                $results_total_hits[$k]['hits'] = 0;
                foreach ($tot_hits as $hit) {
                    if ($course_id == $hit->c_id) {
                        $results_total_hits[$k]['hits'] = $hit->hits;
                    }
                }
                $k++;
            }
            $results['results_total_hits'] = $results_total_hits;
            break;
        case 'report_certif':
            $users_str = implode(',', $users);
            $courses_str = implode(',', $courses);
            if (!$courses_str) {
                $courses_str = '0';
            }
            if (!$users_str) {
                $users_str = '0';
            }
            $query = "SELECT h.user_id as usr_id,h.course_id as c_id FROM #__lms_certificate_users as h LEFT JOIN #__users as u ON h.user_id=u.id LEFT JOIN #__lms_courses as c ON h.course_id = c.id WHERE h.course_id IN (" . $courses_str . ") AND h.user_id IN  (" . $users_str . ")  ORDER BY h.course_id,h.user_id";
            $JLMS_DB->SetQuery($query);
            $hits = $JLMS_DB->LoadObjectLIST();
            $JLMS_DB->setQuery('SELECT course_name FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name');
            $crs_name = $JLMS_DB->loadResultArray();
            $JLMS_DB->setQuery('SELECT * FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name');
            $crs_options = $JLMS_DB->loadObjectList();
            $results['title_courses'] = array();
            $i = 0;
            foreach ($crs_name as $key => $c_name) {
                $view_is_course = 1;
                if ($JLMS_CONFIG->get('flms_integration', 1)) {
                    $params = new JLMSParameters($crs_options[$key]->params);
                    $view_is_course = $params->get('show_in_report', 1);
                }
                if ($view_is_course) {
                    $results['title_courses'][$i]['course_name'] = $c_name;
                    $i++;
                }
            }
            $results['results'] = array();
            $results['results_hit'] = array();
            $j = 0;
            foreach ($users as $usr_id) {
                $JLMS_DB->setQuery('SELECT username,name, email FROM #__users WHERE id =' . $usr_id);
                $usrname = $JLMS_DB->LoadObject();
                $course_hits = 0;
                $results['results'][$j]['username'] = $usrname->username;
                $results['results'][$j]['name'] = $usrname->name;
                //$results['results'][$j]['email'] = $usrname->email;
                $count = 0;
                $k = 0;
                foreach ($courses as $key => $course_id) {
                    $count++;
                    $hit_num = _JLMS_NO_ALT_TITLE;
                    for ($i = 0; $i < count($hits); $i++) {
                        if ($hits[$i]->c_id == $course_id && $hits[$i]->usr_id == $usr_id) {
                            $hit_num = _JLMS_YES_ALT_TITLE;
                            break;
                            // by DEN
                        }
                    }
                    $view_is_course = 1;
                    if ($JLMS_CONFIG->get('flms_integration', 1)) {
                        $params = new JLMSParameters($crs_options[$key]->params);
                        $view_is_course = $params->get('show_in_report', 1);
                    }
                    if ($view_is_course) {
                        $results['results_hit'][$j][$k] = $hit_num;
                        $k++;
                    }
                }
                $j++;
            }
            break;
        case 'report_grade':
            $course_info = array();
            $course_info_hits = array();
            $title_headers = array();
            $data_grade = array();
            $rows = array();
            if (isset($reporting_header['data_grade']['rowz']) && isset($reporting_header['data_grade']['lists']) && count($reporting_header['data_grade']['rowz']) && count($reporting_header['data_grade']['lists'])) {
                $rows = $reporting_header['data_grade']['rowz'];
                $lists = $reporting_header['data_grade']['lists'];
                for ($i = 0; $i < count($rows); $i++) {
                    $row = $rows[$i];
                    $course_info[$i]['course_name'] = $row->course_name;
                    $course_info[$i]['hits'] = $lists['hits'][$i];
                    /*
                    $course_info[$i][] = $row->course_name;
                    $course_info[$i][] = $lists['hits'][$i];
                    $course_info_hits[$i][] = $lists['hits'][$i];
                    */
                    $title_headers[$i][] = _JLMS_REPORTS_CONCLUSION_ROW;
                    $data_grade[$i][] = $row->user_certificate ? _CMN_YES : _CMN_NO;
                    $sc_num = 0;
                    $sc_num2 = 0;
                    foreach ($lists['sc_rows'][$i] as $sc_row) {
                        if ($sc_row->show_in_gradebook) {
                            $title_headers[$i][] = $sc_row->lpath_name;
                            $sc_num++;
                            $j = 0;
                            while ($j < count($row->scorm_info)) {
                                if ($row->scorm_info[$j]->gbi_id == $sc_row->item_id) {
                                    if ($sc_num2 < $sc_num) {
                                        if ($row->scorm_info[$j]->user_status == -1) {
                                            $data_grade[$i][] = '-';
                                        } else {
                                            $user_status = '';
                                            $user_status .= $row->scorm_info[$j]->user_status ? _CMN_YES : _CMN_NO;
                                            $user_status .= isset($row->scorm_info[$j]->user_grade) ? ' ' . $row->scorm_info[$j]->user_grade : '';
                                            $user_status .= isset($row->scorm_info[$j]->user_pts) ? ' (' . $row->scorm_info[$j]->user_pts . ')' : '';
                                            $data_grade[$i][] = $user_status;
                                        }
                                        $sc_num2++;
                                    }
                                }
                                $j++;
                            }
                        }
                    }
                    foreach ($lists['quiz_rows'][$i] as $quiz_row) {
                        $title_headers[$i][] = $quiz_row->c_title;
                        $j = 0;
                        while ($j < count($row->quiz_info)) {
                            if ($row->quiz_info[$j]->gbi_id == $quiz_row->c_id) {
                                if ($row->quiz_info[$j]->user_status == -1) {
                                    $data_grade[$i][] = '-';
                                } else {
                                    $user_status = '';
                                    //									$user_status .= $row->quiz_info[$j]->user_status ? _CMN_YES : _CMN_NO;
                                    //									$user_status .= ' '.$row->quiz_info[$j]->user_grade.' ';
                                    //									$user_status .= '('.$row->quiz_info[$j]->user_pts_full.')';
                                    $user_status = JLMS_showQuizStatus($row->quiz_info[$j], '', 1);
                                    $data_grade[$i][] = $user_status;
                                }
                            }
                            $j++;
                        }
                    }
                    foreach ($lists['gb_rows'][$i] as $gb_row) {
                        $title_headers[$i][] = $gb_row->gbi_name;
                    }
                    $j = 0;
                    while ($j < count($row->grade_info)) {
                        $data_grade[$i][] = $row->grade_info[$j]->user_grade;
                        $j++;
                    }
                }
            }
            $results['course_info'] = $course_info;
            $results['title_headers'] = $title_headers;
            $results['data_grade'] = $data_grade;
            $results['data'] = array();
            foreach ($course_info as $n => $ci) {
                $results['data'][$n][] = $title_headers[$n];
                $results['data'][$n][] = $data_grade[$n];
            }
            break;
    }
    //echo '<pre>';
    //print_r($results);
    //print_r($reporting_header);
    //echo '</pre>';
    //die;
    global $task;
    if ($task == 'report_access') {
        $tmpl_name = 'access_report';
        $prefix_title = str_replace("_", " ", $tmpl_name);
    } else {
        if ($task == 'report_certif') {
            $tmpl_name = 'completion_report';
            $prefix_title = str_replace("_", " ", $tmpl_name);
        } else {
            if ($task == 'report_grade') {
                $tmpl_name = 'user_report';
                $prefix_title = str_replace("_", " ", $tmpl_name);
            }
        }
    }
    JLMS_reporting::exportXLS($results, $reporting_header, $tmpl_name, $prefix_title);
}
Пример #5
0
    function showQuizRow(&$k, $row, $i, $topic_id, $checked = null, $manage = 1, $span = 1)
    {
        global $option, $Itemid, $JLMS_CONFIG;
        $usertype = $JLMS_CONFIG->get('current_usertype', 0);
        $course_id = intval(mosGetParam($_REQUEST, 'id', 0));
        $k = 3 - $k;
        if ($usertype == 1) {
            $link = sefRelToAbs('index.php?option=' . $option . '&amp;Itemid=' . $Itemid . '&amp;task=quizzes&amp;id=' . $course_id . '&amp;page=setup_quest&amp;quiz_id=' . $row->id);
        }
        if ($usertype == 2) {
            $link = sefRelToAbs('index.php?option=' . $option . '&amp;Itemid=' . $Itemid . '&amp;task=show_quiz&amp;id=' . $course_id . '&amp;quiz_id=' . $row->id);
            $manage = 0;
            $checked = null;
        }
        if (!$checked && $manage == 1) {
            $checked = mosHTML::idBox($topic_id * 1000 + $i, $row->link_id);
        }
        // 01.12.2007 '$i' chenged to '$topic_id*1000+$i' by DEN - to avoid dublicate id's
        ?>
		<tr class="<?php 
        echo JLMSCSS::_('sectiontableentry' . $k);
        ?>
">
			<td width='1%' align="center"><?php 
        if ($usertype != 2) {
            echo $i + 1;
        } else {
            echo '&nbsp;';
        }
        ?>
</td>
			<?php 
        if ($checked) {
            echo "<td width='1%'>{$checked}</td>";
        }
        ?>
			<td width="1%"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/tlb_quiz.png" alt='quiz' /></td>
			<td align="left" valign="middle" colspan="<?php 
        echo $span;
        ?>
">
				<a href="<?php 
        echo $link;
        ?>
" title="<?php 
        echo str_replace('"', '&quot;', $row->c_title);
        ?>
">
				<?php 
        echo $row->c_title;
        ?>
				</a>
			</td>
			<?php 
        if ($usertype != 2) {
            //teacher/admin table handler
            ?>
				<?php 
            if ($manage == 1) {
                ?>
					<td valign="middle" class="controltd"><?php 
                if ($row->allow_up == 1 && $manage == 1) {
                    echo JLMS_orderIcon_element($topic_id, $course_id, 'orderup_element', _JLMS_TOPIC_I_MOVEUP, $row->ordering);
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
					<td valign="middle" class="controltd"><?php 
                if ($row->allow_down == 1 && $manage == 1) {
                    echo JLMS_orderIcon_element($topic_id, $course_id, 'orderdown_element', _JLMS_TOPIC_I_MOVEDOWN, $row->ordering);
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
					<?php 
                $state = publishUtility($row->published, $row->show);
                ?>
					<td valign="middle" class="controltd"><?php 
                echo JLMS_showHideIcon($row->link_id, $course_id, $topic_id, $state, 'change_element', $option);
                ?>
</td>
				<?php 
            }
            ?>
				<td align="center">-</td>
				<td align="center">-</td>
			<?php 
        } else {
            //user/student table handler
            ?>
				<td align="center">
					<?php 
            echo JLMS_showQuizStatus($row, 50);
            /* 
            if ($row->status == -1) {
            	echo '<img class="JLMS_png" width="16" height="16" border="0" alt="Not Completed" src="'.$JLMS_CONFIG->get('live_site').'/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png"/>';
            } elseif ($row->status == 0) {
            	echo '<img class="JLMS_png" width="16" height="16" border="0" alt="Failed" src="'.$JLMS_CONFIG->get('live_site').'/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png"/>';
            } elseif ($row->status == 1) {
            	if (isset($row->link_certificate) && $row->link_certificate) {
            		echo $row->link_certificate;
            	} else {
            		echo '<img class="JLMS_png" width="16" height="16" border="0" alt="Success" src="'.$JLMS_CONFIG->get('live_site').'/components/com_joomla_lms/lms_images/toolbar/btn_accept.png"/>';
            	}
            }
            if ($row->points != -1) {
            	echo '<br />'.$row->points;
            } else {
            	//echo '<br /> - ';
            }
            */
            ?>
				</td>
				<td align="center" valign="middle" nowrap="nowrap"><?php 
            echo isset($row->start_date) ? $row->start_date : '-';
            ?>
</td>
				<td align="center" valign="middle" nowrap="nowrap"><?php 
            echo isset($row->end_date) ? $row->end_date : '-';
            ?>
</td>
			<?php 
        }
        ?>
			<td><?php 
        $descr = strip_tags($row->c_description);
        if (strlen($descr) > 75) {
            $descr = substr($descr, 0, 75) . "...";
        }
        echo $descr ? $descr : '&nbsp;';
        ?>
			</td>
		</tr>		
		<?php 
    }