function showpageTracking($id, $option, &$rows, &$lists)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $JLMS_SESSION =& JLMSFactory::getSession();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        global $my;
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $page_13_stats_shown = false;
        $page_12_stats_shown = false;
        $page_14_stats_shown = false;
        if ($lists['page'] == 12) {
            $hparams['second_tb_header'] = _JLMS_TRACKING_DOCUMENTS_STATISTICS;
        } elseif ($lists['page'] == 13) {
            $hparams['second_tb_header'] = _JLMS_TRACKING_LPATHS_STATISTICS;
        } elseif ($lists['page'] == 14) {
            $hparams['second_tb_header'] = _JLMS_TRACKING_LATEST_COURSE_ACTIVITIES_REPORT;
        } else {
            $hparams['second_tb_header'] = _JLMS_TRACK_TITLE_ACCESS . JLMS_TRACKING_getTitle($lists['page']);
        }
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=tracking&id={$id}"));
        JLMS_TMPL::ShowHeader('tracking', _JLMS_TRACK_TITLE, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
				<tr>
					<td align="right" style="text-align:right ">
						<div align="right" style="white-space:nowrap ">
						<?php 
        if ($lists['page'] == 12 || $lists['page'] == 13 || $lists['page'] == 14) {
            //only group and user filters
            if (isset($lists['filter_lpath']) && $lists['page'] == 13) {
                echo $lists['filter_lpath'] . '<br />';
            }
            if (isset($lists['filter2'])) {
                echo $lists['filter2'] . '<br />';
            }
            if (isset($lists['filter3'])) {
                echo $lists['filter3'] . '<br />';
            }
            echo $lists['filter_stu'] . '<br />';
        } else {
            echo $lists['filter_pages'] . $lists['filter'] . $lists['filter_month'] . $lists['filter_day'];
            ?>
<br />
							<?php 
            /*if(isset($lists['filter_lpath'])){
            			echo $lists['filter_lpath'].'<br />';
            		}*/
            if (isset($lists['filter2'])) {
                echo $lists['filter2'] . '<br />';
            }
            if (isset($lists['filter3'])) {
                echo $lists['filter3'] . '<br />';
            }
            echo $lists['filter_stu'] . '<br />';
        }
        ?>
						</div>
					</td>
				</tr>
			</table>
<?php 
        if ($lists['page'] == 12 || $lists['page'] == 13 || $lists['page'] == 14) {
            //do nothing
        } else {
            //show hits statistics
            ?>
	<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}";
            ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_TRACK_TBL_H_STU;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            $rr = array();
            if ($lists['is_day']) {
                foreach ($lists['months'] as $ma) {
                    echo '<' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" align="center">' . JLMS_dateToDisplay(mktime(0, 0, 0, $ma->month, $ma->day, $ma->year), true) . '</' . JLMSCSS::tableheadertag() . '>';
                    $rr[] = $ma->month;
                }
            } else {
                foreach ($lists['months'] as $ma) {
                    echo '<' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" align="center">' . month_lang(strftime('%m', mktime(0, 0, 0, $ma->month + 1, 0, 0)), 0, 2) . ', ' . $ma->year . '</' . JLMSCSS::tableheadertag() . '>';
                    $rr[] = $ma->month;
                }
            }
            ?>
				</tr>
			<?php 
            $k = 1;
            $i = 0;
            $total_counts = array();
            for ($j = 0; $j < count($lists['months']); $j++) {
                $total_counts[$j] = 0;
            }
            while ($i < count($rows)) {
                $row = $rows[$i];
                $link = '';
                $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}&amp;filter_stu=" . $row->user_id . "&amp;page=" . $lists['page'];
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td align="left" valign="middle" style="vertical-align:middle ">
						<a href="<?php 
                echo sefRelToAbs($link);
                ?>
" title="<?php 
                echo _JLMS_VIEW_DETAILS;
                ?>
">
							<?php 
                echo $row->username;
                ?>
						</a>
					</td>
					<?php 
                #$j = $lists['month']-1;
                $e = 0;
                $user = $rows[$i]->user_id;
                #$month = $rows[$i]->month;
                #$year = $rows[$i]->year;
                do {
                    if ($lists['is_day']) {
                        while (($lists['months'][$e]->day != $rows[$i]->day || $lists['months'][$e]->month != $rows[$i]->month || $lists['months'][$e]->year != $rows[$i]->year) && $e < count($lists['months'])) {
                            echo '<td align="center">0</td>';
                            $e++;
                        }
                        if ($rows[$i]->user_id == $user && $rows[$i]->day == $lists['months'][$e]->day && $rows[$i]->month == $lists['months'][$e]->month && $rows[$i]->year == $lists['months'][$e]->year) {
                            echo '<td align="center">' . $rows[$i]->count_hits . '</td>';
                            $total_counts[$e] = $total_counts[$e] + $rows[$i]->count_hits;
                        }
                    } else {
                        while (($lists['months'][$e]->month != $rows[$i]->month || $lists['months'][$e]->year != $rows[$i]->year) && $e < count($lists['months'])) {
                            echo '<td align="center">0</td>';
                            $e++;
                        }
                        if ($rows[$i]->user_id == $user && $rows[$i]->month == $lists['months'][$e]->month && $rows[$i]->year == $lists['months'][$e]->year) {
                            echo '<td align="center">' . $rows[$i]->count_hits . '</td>';
                            $total_counts[$e] = $total_counts[$e] + $rows[$i]->count_hits;
                        }
                    }
                    #$j ++;
                    $e++;
                    $i++;
                } while ($i < count($rows) && $rows[$i]->user_id == $user);
                while ($e < count($lists['months'])) {
                    echo '<td align="center">0</td>';
                    $e++;
                }
                if (isset($rows[$i]->user_id) && $rows[$i]->user_id != $user) {
                    $i--;
                }
                ?>
				</tr>
				<?php 
                $k = 3 - $k;
                $i++;
            }
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td align="left" valign="middle" style="vertical-align:middle "><?php 
            echo _JLMS_TOTAL;
            ?>
</td>
					<?php 
            for ($j = 0; $j < count($lists['months']); $j++) {
                echo '<td align="center"><strong>' . $total_counts[$j] . '</strong></td>';
            }
            ?>
				</tr>
			</table>
			<br /><br />
<?php 
        }
        ?>
		<?php 
        if ($lists['page'] == 14 && isset($lists['page14_stats']) && !empty($lists['page14_stats'])) {
            $page_14_stats_shown = true;
            ?>
		
			<script type="text/javascript">
				function submitbutton(pressbutton){
					var form = document.adminForm;
					form.view.value = pressbutton;
					form.submit();
				}
			</script>
		
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="20">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
					<?php 
            echo _JLMS_TRACK_TBL_H_STU;
            ?>
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
					&nbsp;
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
					<?php 
            echo _JLMS_TRACK_TBL_H_ACTIVITY;
            ?>
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
					<?php 
            echo _JLMS_TRACK_TBL_H_TIME;
            ?>
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $limit = intval(mosGetParam($_GET, 'limit', $JLMS_SESSION->get('list_limit', $JLMS_CONFIG->getCfg('list_limit'))));
            $JLMS_SESSION->set('list_limit', $limit);
            $limitstart = intval(mosGetParam($_GET, 'limitstart', 0));
            $total = count($lists['page14_stats']);
            require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "classes" . DS . "lms.pagination.php";
            $pageNav = new JLMSPageNav($total, $limitstart, $limit);
            $k = 1;
            $count_activities = 0;
            $items_counter = 0;
            foreach ($lists['page14_stats'] as $latest_activity) {
                if ($count_activities >= $pageNav->limitstart && $count_activities < $pageNav->limitstart + $pageNav->limit) {
                    echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '">';
                    echo '<td>';
                    echo $pageNav->limitstart + $items_counter + 1;
                    echo '</td>';
                    echo '<td>' . $latest_activity->user . '</td>';
                    echo '<td width="16"><img src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/' . $latest_activity->icon . '" alt="i" width="16" height="16" border="0" /></td>';
                    echo '<td>' . $latest_activity->activity . '</td>';
                    echo '<td>' . JLMS_dateToDisplay($latest_activity->time, true, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s') . '</td>';
                    echo '</tr>';
                    $k = 3 - $k;
                    $items_counter++;
                }
                $count_activities++;
            }
            ?>
			<tr>
				<td colspan="5" align="center"class="<?php 
            echo JLMSCSS::_('jlmslist-footer_td');
            ?>
">
					<div align="center">
					<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}&amp;page=14";
            echo $pageNav->writePagesLinks($link);
            ?>
					</div>
				</td>
			</tr>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" class="jlms_table_no_borders">
			<tr>
				<td align="center">
					<?php 
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('csv');", 'title' => 'CSV', 'img' => 'csv');
            $controls[] = array('href' => "javascript:submitbutton('xls');", 'title' => 'XLS', 'img' => 'xls');
            JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':');
            ?>
	
				</td>
			</tr>
			</table>
		<?php 
        } elseif ($lists['page'] == 14 && !$page_14_stats_shown) {
            echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>';
        } elseif ($lists['page'] == 12 && $lists['filter_stu_val'] && isset($lists['page12_stats']) && !empty($lists['page12_stats'])) {
            $page_12_stats_shown = true;
            $max_tree_width = 0;
            if (isset($lists['page12_stats'][0])) {
                $max_tree_width = $lists['page12_stats'][0]->tree_max_width;
            }
            ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="<?php 
            echo 16 * ($max_tree_width + 1);
            ?>
" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="<?php 
            echo $max_tree_width + 1;
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="45%"><?php 
            echo _JLMS_TRACK_TBL_DOC_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_TRACK_TBL_DOC_DOWNS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_TRACK_TBL_DOC_LAST;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            $tree_modes = array();
            for ($i = 0, $n = count($lists['page12_stats']); $i < $n; $i++) {
                $row_doc = $lists['page12_stats'][$i];
                $max_tree_width = $row_doc->tree_max_width;
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<?php 
                $add_img = '';
                if ($row_doc->tree_mode_num) {
                    $g = 0;
                    $tree_modes[$row_doc->tree_mode_num - 1] = $row_doc->tree_mode;
                    while ($g < $row_doc->tree_mode_num - 1) {
                        $pref = '';
                        if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                            $pref = 'empty_';
                        }
                        $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' /></td>";
                        $g++;
                    }
                    $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row_doc->tree_mode . ".png\" width='16' height='16' /></td>";
                    $max_tree_width = $max_tree_width - $g - 1;
                }
                echo $add_img;
                ?>
					<td align="center" valign="middle" style="vertical-align:middle " width='16'>
					<?php 
                if ($row_doc->folder_flag == 1) {
                    echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/folder.png\" width='16' height='16' alt='Folder' /></span>";
                } else {
                    echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_doc->file_icon . ".png\" width='16' height='16' alt='File' /></span>";
                }
                ?>
					</td>
					<td align="left" valign="middle" <?php 
                if ($max_tree_width > 0) {
                    echo "colspan='" . ($max_tree_width + 1) . "'";
                }
                ?>
 width="35%">
					<?php 
                if ($row_doc->folder_flag || !$row_doc->folder_flag && !$row_doc->file_id) {
                    echo '<strong>' . $row_doc->doc_name . '</strong>';
                } else {
                    echo $row_doc->doc_name;
                }
                ?>
					</td>
					<td valign="middle" align="center">
						<?php 
                echo $row_doc->downloads;
                ?>
					</td>
					<td valign="middle" align="center">
						<?php 
                echo JLMS_dateToDisplay($row_doc->last_access, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s');
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 12 && !$lists['filter_stu_val'] && isset($lists['page12_stats']) && !empty($lists['page12_stats'])) {
            $page_12_stats_shown = true;
            $max_tree_width = 0;
            if (isset($lists['page12_stats'][0])) {
                $max_tree_width = $lists['page12_stats'][0]->tree_max_width;
            }
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var block_stats = 0;
var tID = '';
var url_prefix = '<?php 
            echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}";
            ?>
';
function jlms_MakeRequest(url) {
	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() { jlms_AnalizeRequest(http_request); };
	http_request.open('GET', url_prefix + url, true);
	http_request.send(null);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_stats = 0;
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'doc_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					var sec_indx = gl_el.parentNode.sectionRowIndex;
					var table = gl_el.parentNode.parentNode;
					var row = table.insertRow(sec_indx + 1);
					var cell1 = document.createElement("td");
					cell1.align = 'left';
					cell1.colSpan = "<?php 
            echo $max_tree_width + 5;
            ?>
";
					cell1.style.padding = '0px';
					cell1.style.margin = '0px';
					cell1.innerHTML = response_data;
					row.appendChild(cell1);
					gl_el.innerHTML = "<img class='JLMS_png' src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />";
				break;
			}
		} else {
		}
	}
}
var gl_el = '';
function jlms_RequestDOCS_stats( doc_id, element ) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = element.parentNode;
		jlms_MakeRequest('&task=get_docs_stats&doc_id='+doc_id+'&colspan=<?php 
            echo $max_tree_width + 2;
            ?>
');
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
JLMS_preloadImages('<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png');
//--><!]]> 
</script>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="<?php 
            echo 16 * ($max_tree_width + 1);
            ?>
" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="<?php 
            echo $max_tree_width + 1;
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="45%"><?php 
            echo _JLMS_TRACK_TBL_DOC_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="100" align="center"><?php 
            echo _JLMS_TRACK_TBL_DOC_DOWNS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="100" align="center"><?php 
            echo _JLMS_TRACK_TBL_DOC_LAST;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            $tree_modes = array();
            for ($i = 0, $n = count($lists['page12_stats']); $i < $n; $i++) {
                $row_doc = $lists['page12_stats'][$i];
                $max_tree_width = $row_doc->tree_max_width;
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
					<?php 
                if ($row_doc->folder_flag != 1) {
                    ?>
						<span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestDOCS_stats(<?php 
                    echo $row_doc->id;
                    ?>
, this);">
							<img class='JLMS_png' src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                    echo _JLMS_TRACK_VIEW_DETAILS;
                    ?>
" title="<?php 
                    echo _JLMS_TRACK_VIEW_DETAILS;
                    ?>
" />
						</span>
					<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
					</td>
					<?php 
                $add_img = '';
                if ($row_doc->tree_mode_num) {
                    $g = 0;
                    $tree_modes[$row_doc->tree_mode_num - 1] = $row_doc->tree_mode;
                    while ($g < $row_doc->tree_mode_num - 1) {
                        $pref = '';
                        if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                            $pref = 'empty_';
                        }
                        $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='line' /></td>";
                        $g++;
                    }
                    $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row_doc->tree_mode . ".png\" width='16' height='16' alt='sub' /></td>";
                    $max_tree_width = $max_tree_width - $g - 1;
                }
                echo $add_img;
                ?>
					<td align="center" valign="middle" style="vertical-align:middle " width='16'>
					<?php 
                if ($row_doc->folder_flag == 1) {
                    echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/folder.png\" width='16' height='16' alt='Folder' /></span>";
                } else {
                    echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_doc->file_icon . ".png\" width='16' height='16' alt='File' /></span>";
                }
                ?>
					</td>
					<td align="left" valign="middle" <?php 
                if ($max_tree_width > 0) {
                    echo "colspan='" . ($max_tree_width + 1) . "'";
                }
                ?>
 width="35%">
					<?php 
                if ($row_doc->folder_flag || !$row_doc->folder_flag && !$row_doc->file_id) {
                    echo '<strong>' . $row_doc->doc_name . '</strong>';
                } else {
                    echo $row_doc->doc_name;
                }
                ?>
					</td>
					<td valign="middle" align="center">
						<?php 
                echo $row_doc->downloads;
                ?>
					</td>
					<td valign="middle" align="center">
						<?php 
                echo JLMS_dateToDisplay($row_doc->last_access, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s');
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 12 && !$page_12_stats_shown) {
            echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>';
        } elseif ($lists['page'] == 13 && $lists['filter_stu_val'] && isset($lists['page13_stats']) && !empty($lists['page13_stats'])) {
            $page_13_stats_shown = true;
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--

function submitbutton(pressbutton){
	var form = document.adminForm;
	form.view.value = pressbutton;
	form.submit();
}

var block_stats = 0;
var tID = '';
var url_prefix = '<?php 
            echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}";
            ?>
';
function jlms_MakeRequest(url) {
	var http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); };
	http_request.open('GET', url_prefix + url, true);
	http_request.send(null);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_stats = 0;
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'lpath_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						var sec_indx = gl_el.parentNode.sectionRowIndex;
						var table = gl_el.parentNode.parentNode;
						var row = table.insertRow(sec_indx + 1);
						var cell1 = document.createElement("td");
						cell1.align = 'left';
						cell1.colSpan = "3";
						cell1.style.padding = '0px';
						cell1.style.margin = '0px';
						cell1.innerHTML = response_data;
						row.appendChild(cell1);
					}
					gl_el.innerHTML = "<img class='JLMS_png' src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />";
				break;
				case 'scorm_progress_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					var res_user = response.getElementsByTagName('user_id')[0].firstChild.data;
					var res_lpsc = response.getElementsByTagName('lpath_id')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						gl_el_res = document.getElementById('sc_progress_td_'+res_user+'_'+res_lpsc);
						if (gl_el_res) {
							gl_el_res.innerHTML = response_data;
						}
					}
				break;
			}
		} else {
		}
	}
}
var gl_el = '';
function jlms_RequestLP_stats( lp_id, element ) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = element.parentNode;
		jlms_MakeRequest('&task=get_lp_stats&lpath_id='+lp_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
function ChangeScormProgress( user_id, sc_id, new_stat, element) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = document.getElementById('sc_progress_td_'+user_id+'_'+sc_id);
		jlms_MakeRequest('&task=get_lp_stats&mode=scormstatus&user_id='+user_id+'&nstat='+new_stat+'&lpath_id='+sc_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
JLMS_preloadImages('<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png');
//--><!]]> 
</script>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1" colspan="3">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_LPATH_TBL_TIME_SPENT;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_LPATH_TBL_STARTING;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_LPATH_TBL_ENDING;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page13_stats']); $i < $n; $i++) {
                $row_path = $lists['page13_stats'][$i];
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->item_id) {
                    $icon_img = "toolbar/tlb_scorm";
                    $icon_alt = "scorm";
                }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
						&nbsp;
					</td>
					<td valign="middle" align="left">
						<?php 
                if ($lists['f_lpath']) {
                    echo JLMS_tracking_html::Echo_userinfo($row_path->u_name, $row_path->username, $row_path->email, 'javascript:void(0);');
                } else {
                    echo $row_path->lpath_name;
                }
                ?>
					</td>
					<?php 
                if ($lists['f_lpath']) {
                    ?>
						<td width="1%" style="white-space: nowrap;"><?php 
                    echo JLMS_getLpathProgress($row_path, $row_path->user_id ? $row_path->user_id : 0);
                    ?>
</td>
					<?php 
                } else {
                    ?>
						<td width="1%" style="white-space: nowrap;"><?php 
                    echo JLMS_getLpathProgress($row_path, $lists['filter_stu_val']);
                    ?>
</td>
					<?php 
                }
                ?>
				<?php 
                $r_img = 'btn_cancel';
                $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED;
                $time_spent = $row_path->time_spent;
                $r_start = '-';
                $r_end = '-';
                $new_s_status = '1';
                if (!$row_path->item_id) {
                    if (isset($row_path->r_status) && $row_path->r_status == 1) {
                        $r_img = 'btn_accept';
                        $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                        $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                        $r_end = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_end, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    } elseif (isset($row_path->r_status) && $row_path->r_status == 0) {
                        $r_img = 'btn_pending_cur';
                        $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    }
                } else {
                    if (isset($row_path->s_status) && $row_path->s_status == 1) {
                        $r_img = 'btn_accept';
                        $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                        $r_start = '-';
                        $r_end = '-';
                        $new_s_status = '0';
                    }
                    if ($row_path->lp_type == 1 || $row_path->lp_type == 2) {
                        $r_end = isset($row_path->r_end) && $row_path->r_end ? JLMS_dateToDisplay($row_path->r_end, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                        $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    }
                }
                ?>
					<?php 
                if ($row_path->item_id) {
                    ?>
					<td valign="middle" align="center" width="16" id="sc_progress_td_<?php 
                    echo $lists['filter_stu_val'] . "_" . $row_path->item_id;
                    ?>
">
						<a class="jlms_img_link" id="sc_progress_a_<?php 
                    echo $lists['filter_stu_val'] . "_" . $row_path->item_id;
                    ?>
" href="javascript:ChangeScormProgress(<?php 
                    echo $lists['filter_stu_val'];
                    ?>
,<?php 
                    echo $row_path->item_id;
                    ?>
,<?php 
                    echo $new_s_status;
                    ?>
,this);"><img id="sc_progress_img_<?php 
                    echo $lists['filter_stu_val'] . "_" . $row_path->item_id;
                    ?>
" align="absmiddle" class="JLMS_png" src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                    echo $r_img;
                    ?>
.png" width="16" height="16" border="0" alt="<?php 
                    echo $r_sta;
                    ?>
" title="<?php 
                    echo $r_sta;
                    ?>
" /></a>
					<?php 
                } else {
                    ?>
					<td valign="middle" align="center" width="16">
						<img class='JLMS_png' src='<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                    echo $r_img;
                    ?>
.png' width='16' height='16' alt="<?php 
                    echo $r_sta;
                    ?>
" title="<?php 
                    echo $r_sta;
                    ?>
" />
					<?php 
                }
                ?>
					</td>
					<td valign="middle" align="center" nowrap="nowrap">
						<?php 
                echo $row_path->item_id ? isset($row_path->s_score) ? $row_path->s_score . _JLMS_GB_POINTS : '&nbsp;' : '&nbsp;';
                ?>
					</td>
					<td valign="middle" align="center" nowrap="nowrap"><?php 
                echo $time_spent;
                ?>
</td>
					<td valign="middle" align="center" nowrap="nowrap"><?php 
                echo $r_start;
                ?>
</td>
					<td valign="middle" align="center" nowrap="nowrap"><?php 
                echo $r_end;
                ?>
</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" class="jlms_table_no_borders">
				<tr>
					<td align="center">
						<?php 
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('csv');", 'title' => 'CSV', 'img' => 'csv');
            $controls[] = array('href' => "javascript:submitbutton('xls');", 'title' => 'XLS', 'img' => 'xls');
            JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':');
            ?>
	
					</td>
				</tr>
			</table>
		<?php 
        } elseif ($lists['page'] == 13 && !$lists['filter_stu_val'] && isset($lists['page13_stats']) && !empty($lists['page13_stats'])) {
            $page_13_stats_shown = true;
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var block_stats = 0;
var tID = '';
var url_prefix = '<?php 
            echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}";
            ?>
';
function jlms_MakeRequest(url) {
	var http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); };
	http_request.open('GET', url_prefix + url, true);
	http_request.send(null);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_stats = 0;
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'lpath_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						var sec_indx = gl_el.parentNode.sectionRowIndex;
						var table = gl_el.parentNode.parentNode;
						var row = table.insertRow(sec_indx + 1);
						var cell1 = document.createElement("td");
						cell1.align = 'left';
						cell1.colSpan = "3";
						cell1.style.padding = '0px';
						cell1.style.margin = '0px';
						cell1.innerHTML = response_data;
						row.appendChild(cell1);
					}
					gl_el.innerHTML = "<img class='JLMS_png' src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />";
				break;
				case 'scorm_progress_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					var res_user = response.getElementsByTagName('user_id')[0].firstChild.data;
					var res_lpsc = response.getElementsByTagName('lpath_id')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						gl_el_res = document.getElementById('sc_progress_td_'+res_user+'_'+res_lpsc);
						if (gl_el_res) {
							gl_el_res.innerHTML = response_data;
						}
					}
				break;
			}
		} else {
		}
	}
}
var gl_el = '';
function jlms_RequestLP_stats( lp_id, element ) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = element.parentNode;
		jlms_MakeRequest('&task=get_lp_stats&lpath_id='+lp_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
function ChangeScormProgress( user_id, sc_id, new_stat, element) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = document.getElementById('sc_progress_td_'+user_id+'_'+sc_id);
		jlms_MakeRequest('&task=get_lp_stats&mode=scormstatus&user_id='+user_id+'&nstat='+new_stat+'&lpath_id='+sc_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
JLMS_preloadImages('<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png');
//--><!]]> 
</script>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="100%"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page13_stats']); $i < $n; $i++) {
                $row_path = $lists['page13_stats'][$i];
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->item_id) {
                    $icon_img = "toolbar/tlb_scorm";
                    $icon_alt = "scorm";
                }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
					<?php 
                if (!isset($row_path->is_link)) {
                    ?>
						<span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestLP_stats(<?php 
                    echo $row_path->id;
                    ?>
, this);">
							<img class='JLMS_png' src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                    echo _JLMS_TRACK_VIEW_DETAILS;
                    ?>
" title="<?php 
                    echo _JLMS_TRACK_VIEW_DETAILS;
                    ?>
" />
						</span>	
					<?php 
                }
                ?>
	
					</td>
					<td valign="middle" align="center">
						<span style="alignment:center; vertical-align:middle">
							<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/<?php 
                echo $icon_img;
                ?>
.png" width='16' height='16' alt="<?php 
                echo $icon_alt;
                ?>
" />
						</span>
					</td>
					<td valign="middle" align="left">
						<?php 
                echo $row_path->lpath_name;
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 13 && !$page_13_stats_shown) {
            echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>';
        } elseif ($lists['page'] == 5 && $lists['filter_stu_val'] && isset($lists['page5_stats'])) {
            ?>
			<br /><br />
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<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');
            ?>
" width="30%"><?php 
            echo _JLMS_HW_TBL_HEAD_HW;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_HW_TBL_HEAD_DATE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_HW_TBL_HEAD_ENDDATE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page5_stats']); $i < $n; $i++) {
                $row_hw = $lists['page5_stats'][$i];
                $alt = $row_hw->hw_status ? _JLMS_HW_STATUS_COMPLETED : _JLMS_HW_STATUS_INCOMPLETED;
                $image = $row_hw->hw_status ? 'btn_accept.png' : 'btn_cancel.png';
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td align="center"><?php 
                echo $i + 1;
                ?>
</td>
					<td align="left" valign="middle" style="vertical-align:middle ">
						<?php 
                echo $row_hw->hw_name;
                ?>
					</td>
					<td valign="middle" style="vertical-align:middle ">
						<?php 
                echo $row_hw->post_date;
                ?>
					</td>
					<td valign="middle" style="vertical-align:middle ">
						<?php 
                echo $row_hw->end_date;
                ?>
					</td>
					<td align="left" valign="middle" style="vertical-align:middle; text-align:left; white-space:nowrap " nowrap="nowrap">
						<?php 
                echo '<img align="absmiddle" 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 . '" />';
                if ($row_hw->hw_status) {
                    echo '&nbsp;&nbsp;' . JLMS_dateToDisplay($row_hw->hw_date, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s');
                }
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 11 && $lists['filter_stu_val'] && isset($lists['page11_stats']) && !empty($lists['page11_stats'])) {
            ?>
			<br /><br />
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1" colspan="2">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page11_stats']); $i < $n; $i++) {
                $row_path = $lists['page11_stats'][$i];
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->c_id) {
                    $icon_img = "toolbar/tlb_scorm";
                    $icon_alt = "scorm";
                }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
						<span style="alignment:center; vertical-align:middle">
							<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/<?php 
                echo $icon_img;
                ?>
.png" width='16' height='16' alt="<?php 
                echo $icon_alt;
                ?>
" />
						</span>
					</td>
					<td valign="middle" align="left">
							<?php 
                echo $row_path->c_title;
                ?>
					</td>
					
				<?php 
                $r_img = 'btn_cancel';
                $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED;
                $r_start = '-';
                $r_end = '-';
                if (!$row_path->c_id) {
                    if (isset($row_path->published) && $row_path->published == 1) {
                        $r_img = 'btn_accept';
                        $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                        $r_start = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                        $r_end = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_end, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    } elseif (isset($row_path->published) && $row_path->published == 0) {
                        $r_img = 'btn_pending_cur';
                        $r_start = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    }
                } else {
                    if (isset($row_path->published) && $row_path->published == 1) {
                        $r_img = 'btn_accept';
                        $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                        $r_start = '-';
                        $r_end = '-';
                    }
                }
                ?>
					<td valign="middle" align="center">
					<a style="border:0px;" href="<?php 
                echo sefRelToAbs("index.php?option=" . $option . "&task=quizzes&id=" . $id . "&page=reports&quiz_id=" . $row_path->c_id . "");
                ?>
"><img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                echo 'Report';
                ?>
" title="<?php 
                echo 'Report';
                ?>
" border="0" /></a>
					</td>
					<td valign="middle" align="center" width="16">
						<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                echo $r_img;
                ?>
.png" width='16' height='16' alt="<?php 
                echo $r_sta;
                ?>
" title="<?php 
                echo $r_sta;
                ?>
" />
					</td>
					<td valign="middle" align="center" nowrap="nowrap">
						<?php 
                echo $row_path->c_id ? isset($row_path->s_score) ? $row_path->s_score . _JLMS_GB_POINTS : '&nbsp;' : '&nbsp;';
                ?>
					</td>
					
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 11 && !$lists['filter_stu_val'] && isset($lists['page11_stats']) && !empty($lists['page11_stats'])) {
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var block_stats = 0;
var tID = '';
var url_prefix = '<?php 
            echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}";
            ?>
';
function jlms_MakeRequest(url) {
	var http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); };
	http_request.open('GET', url_prefix + url, true);
	http_request.send(null);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_stats = 0;
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'lpath_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						var sec_indx = gl_el.parentNode.sectionRowIndex;
						var table = gl_el.parentNode.parentNode;
						var row = table.insertRow(sec_indx + 1);
						var cell1 = document.createElement("td");
						cell1.align = 'left';
						cell1.colSpan = "4";
						cell1.style.padding = '0px';
						cell1.style.margin = '0px';
						cell1.innerHTML = response_data;
						row.appendChild(cell1);
					}
					gl_el.innerHTML = "<img class='JLMS_png' src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />";
				break;
				case 'scorm_progress_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					var res_user = response.getElementsByTagName('user_id')[0].firstChild.data;
					var res_lpsc = response.getElementsByTagName('quiz_id')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						gl_el_res = document.getElementById('quizid_'+res_lpsc);
						if (gl_el_res) {
							gl_el_res.innerHTML = response_data;
						}
					}
				break;
			}
		} else {
		}
	}
}
var gl_el = '';
function jlms_RequestQuiz_stats( lp_id, element ) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = element.parentNode;
		jlms_MakeRequest('&task=get_quiz_stats&quiz_id='+lp_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}

JLMS_preloadImages('<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png', 'components/com_joomla_lms/lms_images/toolbar/btn_cancel.png');
//--><!]]> 
</script>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" ><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page11_stats']); $i < $n; $i++) {
                $row_path = $lists['page11_stats'][$i];
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->c_id) {
                    $icon_img = "toolbar/tlb_quiz";
                    $icon_alt = "scorm";
                }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
						<span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestQuiz_stats(<?php 
                echo $row_path->c_id;
                ?>
, this);">
							<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                echo _JLMS_TRACK_VIEW_DETAILS;
                ?>
" title="<?php 
                echo _JLMS_TRACK_VIEW_DETAILS;
                ?>
" />
						</span>	
					</td>
					<td valign="middle" align="center">
						<span style="alignment:center; vertical-align:middle">
							<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/<?php 
                echo $icon_img;
                ?>
.png" width='16' height='16' alt="<?php 
                echo $icon_alt;
                ?>
" />
						</span>
					</td>
					<td valign="middle" align="left">
						<?php 
                echo $row_path->c_title;
                ?>
					</td>
					<td valign="middle" align="center">
					<a class="jlms_img_link" style="border:0px;" href="<?php 
                echo sefRelToAbs("index.php?option=" . $option . "&task=quizzes&id=" . $id . "&page=reports&quiz_id=" . $row_path->c_id . "");
                ?>
"><img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                echo 'Report';
                ?>
" title="<?php 
                echo 'Report';
                ?>
" border="0" /></a>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        }
        ?>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="tracking" />
			<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
			
			<input type="hidden" name="page" value="<?php 
        echo $lists['page'];
        ?>
" />
			<input type="hidden" name="view" value="" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function show_calendar_week($id, $option, $rows, $date)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $month = date('m', $date);
        $day = date('j', $date);
        $year = date('Y', $date);
        $choose_date = JLMS_dateToDisplay(date('Y-m-d', $date));
        $date_format_fdow = $JLMS_CONFIG->get('date_format_fdow');
        /*<script type="text/javascript" src="<?php echo $JLMS_CONFIG->get('live_site');?>/includes/js/joomla.javascript.js "></script>*/
        ?>
		<script type="text/javascript" language="javascript">
		<!--
		function td_hover(elem){
			getObj(elem).style['background'] = '#EEEEEE';
			getObj(elem).style.color = '#000000';
			//getObj(elem).style.cursor = 'pointer';
		}
		//function out to other days
		function td_out(elem){
			getObj(elem).style['background'] = '';
			getObj(elem).style.color = '';
		}
		//function out to weekneds days
		function td_out2(elem){
			getObj(elem).style['background'] = '#E1CDCD';
			getObj(elem).style.color = '';
		}
		//function out to current day
		function td_out3(elem){
			getObj(elem).style['background'] = '#FBA179';
			getObj(elem).style.color = '';
		}
		-->
		</script>	
		<script language="javascript" type="text/javascript">
		<!--//
		function quick_date(){
			document.forms.jlms_agenda_form_day.submit();
		}	//-->
		</script>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="jlms_agenda_form_day">
		<table cellpadding="0" cellspacing="0" border="0" style="height:20px" class="jlms_table_no_borders">
			<tr>
				<td valign="middle" align="center" width="18">
				<?php 
        echo JLMS_HTML::_('calendar.calendar', $choose_date, 'cal', 'jlms_choose', null, null, 'statictext');
        ?>
				
				</td><td valign="middle" align="center" width="18">
				<span onclick="quick_date()" style=" cursor:pointer" title="<?php 
        echo _JLMS_AGENDA_GO_DATE;
        ?>
">
				<img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/loopnone.png" alt="<?php 
        echo _JLMS_AGENDA_GO_DATE;
        ?>
" title="<?php 
        echo _JLMS_AGENDA_GO_DATE;
        ?>
" id="go_date" border="0" width="16" height="16" class="JLMS_png" />
				</span>
				</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="agenda" />
		<input type="hidden" name="mode" value="view_week" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		</form>
		<?php 
        $wday = JDDayOfWeek(GregorianToJD($month, $day, $year), 0);
        if ($date_format_fdow == 1) {
            if ($wday == 0) {
                $wday = 7;
            }
            $mon_day_num = strtotime("-" . ($wday - 1) . " day", $date);
            $sun_day_num = strtotime("+" . (7 - $wday) . " day", $date);
            $num_sat = 5;
            $num_sun = 6;
        } else {
            $mon_day_num = strtotime("-" . $wday . " day", $date);
            $sun_day_num = strtotime("+" . (6 - $wday) . " day", $date);
            $num_sat = 0;
            $num_sun = 6;
        }
        ?>
		<!-- Shablon calendaria. -->
		<table cellpadding="0" cellspacing="0" width="100%">
			<tr style="background: url('<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/bg.jpg') #cccccc repeat-x; font-weight:bold; color:white;height:20px " valign="middle">
				<td valign="middle" align="center">
				<a class="jlms_img_link" href="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;mode=view_week&amp;id=" . $id . "&amp;date=" . JLMS_dateToDisplay(strtotime("-1 week", $date), true));
        ?>
">
				<img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/ag_previous.png" class="JLMS_png" alt="<?php 
        echo _JLMS_AGENDA_PREVIOUSWEEK;
        ?>
" title="<?php 
        echo _JLMS_AGENDA_PREVIOUSWEEK;
        ?>
" width="16" height="16"  border="0"/>
				</a>
				</td>
				<td align="center" style="text-align:center" valign="middle" colspan="5">
				(<?php 
        echo day_month_lang(date('w d m Y', $mon_day_num), 0, 1, 5, 2) . "&nbsp;&nbsp;-&nbsp;&nbsp;" . day_month_lang(date('w d m Y', $sun_day_num), 0, 1, 5, 2);
        ?>
)
				</td>
				<td valign="middle" align="center">
				<a class="jlms_img_link" href="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;mode=view_week&amp;id=" . $id . "&amp;date=" . JLMS_dateToDisplay(strtotime("+1 week", $date), true));
        ?>
">
				<img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/ag_next.png" class="JLMS_png" alt="<?php 
        echo _JLMS_AGENDA_NEXTWEEK;
        ?>
" title="<?php 
        echo _JLMS_AGENDA_NEXTWEEK;
        ?>
" width="16" height="16"  border="0"/>
				</a></td>
			</tr>	
		<!-- cycle of rows -->
		<?php 
        echo "<tr>";
        $i = 0;
        $br_right = '';
        for ($i; $i < 7; $i++) {
            if ($i == 6) {
                $br_right = ';border-right:1px solid #B3B3B3';
            }
            echo "<td style='width:14%;text-align:center; height:15px;background:#cccccc;border-bottom:1px solid #B3B3B3; border-left:1px solid #B3B3B3 {$br_right}' >" . month_lang(strftime('%m %Y', strtotime("+{$i} day", $mon_day_num)), 0, 2) . "<br />" . day_month_lang(date("w", strtotime("+{$i} day", $mon_day_num)), 0, 1, 0, 0) . "</td>";
        }
        echo "</tr>";
        $i = 0;
        echo "<tr>";
        for ($i; $i < 7; $i++) {
            if ($i == $num_sat || $i == $num_sun) {
                $color = '';
                if ($i == 6) {
                    $color = "border-right:1px solid #B3B3B3;  ";
                }
                $color .= "background:#E1CDCD;border-left:1px solid #B3B3B3; border-bottom:1px solid #B3B3B3; ";
                $w = '2';
            } else {
                $color = 'border-bottom:1px solid #B3B3B3; border-left:1px solid #B3B3B3;';
                $w = '';
            }
            if (date("" . $year . "-" . $month . "-" . $i . "", $date) == date('Y-m-d')) {
                $color = "background:#FBA179;border:1px solid #B3B3B3;";
                $w = '3';
            }
            $today = '';
            if (date('Y-m-d', strtotime("+{$i} day", $mon_day_num)) == date('Y-m-d')) {
                $color = "background:#FBA179;border-left:1px solid #B3B3B3;border-bottom:1px solid #B3B3B3;";
                $w = '3';
                //$today = _JLMS_AGENDA_TODAY;
            }
            //if ($i == 0){ echo "<tr>";}
            echo "<td style='" . $color . "width:14%; height:40px;' valign='top' id='day" . $i . "' onmouseover=\"td_hover('day" . $i . "')\" onmouseout=\"td_out" . $w . "('day" . $i . "')\">" . $today . "<br />";
            $k = 0;
            while (isset($rows[$k]) && $k < count($rows)) {
                if (strtotime("+{$i} day", $mon_day_num) >= strtotime($rows[$k]->start_date) && strtotime("+{$i} day", $mon_day_num) <= strtotime($rows[$k]->end_date)) {
                    $title = substr($rows[$k]->title, 0, 12);
                    $title .= strlen($rows[$k]->title) > 12 ? "..." : '';
                    $descr = strip_tags($rows[$k]->content);
                    $overlib_descr = substr($descr, 0, 120) . (strlen($descr) > 120 ? "..." : '');
                    $overlib_descr = JLMS_txt2overlib($overlib_descr);
                    $overlib_title = JLMS_txt2overlib($rows[$k]->title);
                    $link = sefRelToAbs("index.php?option={$option}&amp;&amp;Itemid={$Itemid}&amp;task=agenda&amp;id={$id}&amp;agenda_id=" . $rows[$k]->agenda_id . "&amp;date=" . date("Y-m", $date) . "#anc" . $rows[$k]->agenda_id . '-' . date("Y-m", $date) . "");
                    echo JLMS_toolTip($overlib_title, $overlib_descr, $title, $link);
                    echo '<br />';
                }
                $k++;
            }
            echo "</td>";
        }
        echo "</tr>";
        ?>
		</table>
	<?php 
    }
Example #3
0
function saveTopic($course_id)
{
    global $option, $Itemid, $JLMS_DB, $JLMS_CONFIG;
    $usertype = $JLMS_CONFIG->get('current_usertype', 0);
    if ($course_id == $JLMS_CONFIG->get('course_id') && $usertype == 1) {
        $topic_description = strval(JLMS_getParam_LowFilter($_POST, 'description', ''));
        $topic_description = JLMS_ProcessText_LowFilter($topic_description);
        $topic_name_post = isset($_REQUEST['name']) ? strval($_REQUEST['name']) : '';
        $topic_name_post = get_magic_quotes_gpc() ? stripslashes($topic_name_post) : $topic_name_post;
        $topic_name_post = ampReplace(strip_tags($topic_name_post));
        $row = new JLMS_Topic($JLMS_DB);
        $row->bind($_POST);
        $row->name = $topic_name_post;
        $row->description = $topic_description;
        $row->start_date = mosGetParam($_REQUEST, 'start_date', '0000-00-00');
        $row->start_date = JLMS_dateToDB($row->start_date);
        $row->end_date = mosGetParam($_REQUEST, 'end_date', '0000-00-00');
        $row->end_date = JLMS_dateToDB($row->end_date);
        $days = intval(mosGetParam($_POST, 'days', ''));
        $hours = intval(mosGetParam($_POST, 'hours', ''));
        $mins = intval(mosGetParam($_POST, 'mins', ''));
        if ($row->is_time_related) {
            $row->show_period = JLMS_HTML::_('showperiod.getminsvalue', $days, $hours, $mins);
        }
        //----> ordering implementation
        if (mosGetParam($_POST, 'weekly', 0)) {
            //----> 06.12.2007 - DEN - 14.12.2007 - Replaced by TPETb
            $number = intval(mosGetParam($_POST, 'number', 0));
            if ($number > 50) {
                $number = 50;
            }
            //<----
            if ($number <= 0) {
                $number = 1;
            }
            //fool-check
        } else {
            $number = 1;
            //fool-check
        }
        $ordering = $row->ordering;
        //moveup topics with higher ordering
        $query = "UPDATE #__lms_topics SET ordering=ordering+{$number} WHERE course_id={$course_id} AND ordering>={$ordering}";
        $JLMS_DB->setQuery($query);
        $JLMS_DB->query();
        //<----
        if (mosGetParam($_POST, 'weekly', 0)) {
            $fix = 2 - $JLMS_CONFIG->get('date_format_fdow', 1);
            $first_date = strtotime($row->start_date);
            $first_day = date("w", $first_date);
            $next_date = date("Y-m-d", mktime(0, 0, 0, date("m", $first_date), date("d", $first_date) + 7 - 1 - $first_day + $fix, date("Y", $first_date)));
            $row->publish_end = 1;
            $row->end_date = $next_date;
            if (empty($_POST['name'])) {
                $date_1 = intval(strftime("%d", $first_date)) . ' ' . month_lang(strftime("%m", $first_date), 0, 2);
                $date_2 = intval(strftime("%d", strtotime($next_date))) . ' ' . month_lang(strftime("%m", strtotime($next_date)), 0, 2);
                $name = $date_1 . ' - ' . $date_2;
                $row->name = $name;
            } else {
                $row->name = $topic_name_post;
            }
        }
        $row->store();
        if (mosGetParam($_POST, 'weekly', 0)) {
            for ($i = 2; $i <= $number; $i++) {
                $row = new JLMS_Topic($JLMS_DB);
                $first_date = strtotime($next_date);
                $row->start_date = date("Y-m-d", mktime(0, 0, 0, date("m", $first_date), date("d", $first_date) + 1, date("Y", $first_date)));
                $next_date = date("Y-m-d", mktime(0, 0, 0, date("m", $first_date), date("d", $first_date) + 7, date("Y", $first_date)));
                $row->course_id = $course_id;
                $row->published = 1;
                $row->publish_start = 1;
                $row->publish_end = 1;
                $row->end_date = $next_date;
                if (empty($_POST['name_' . $i])) {
                    $date_1 = intval(strftime("%d", strtotime($row->start_date))) . ' ' . month_lang(strftime("%B", strtotime($row->start_date)), 0, 2);
                    $date_2 = intval(strftime("%d", strtotime($row->end_date))) . ' ' . month_lang(strftime("%B", strtotime($row->end_date)), 0, 2);
                    $name = $date_1 . ' - ' . $date_2;
                    $row->name = $name;
                } else {
                    $row->name = isset($_POST['name_' . $i]) ? strval($_POST['name_' . $i]) : '';
                    $row->name = get_magic_quotes_gpc() ? stripslashes($row->name) : $row->name;
                    $row->name = ampReplace(strip_tags($row->name));
                }
                $row->description = $topic_description;
                $ordering++;
                $row->ordering = $ordering;
                $row->store();
            }
        }
        fixTopicOrder($course_id);
        if ($_POST['id']) {
            $msg = _JLMS_TOPIC_T_EDITED;
        } else {
            $msg = _JLMS_TOPIC_T_CREATED;
        }
        if (mosGetParam($_POST, 'weekly', 0)) {
            $msg = _JLMS_TOPIC_T_SERIES_CREATED;
        }
    } else {
        $msg = '';
        //_JLMS_TOPIC_HACK;
    }
    JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=details_course&id={$course_id}#topic_{$row->id}"), $msg);
}
Example #4
0
 function _dateGenerateSelectLists($name, $date, $currFormat)
 {
     if ($date == '-') {
         $timestamp = time();
     } else {
         $timestamp = strtotime($date);
     }
     $format = JLMS_dateGetFormat(2);
     $addFormat = '';
     if (strpos($currFormat, '%H') !== false) {
         $format .= ' H';
     }
     if (strpos($currFormat, '%M') !== false) {
         $format .= ':i';
     }
     //Generate SelectList of days
     $str_days = "<select name='" . $name . "day' id='" . $name . "dd' onchange=\"jlms_getDate('" . $name . "','" . $format . "')\">";
     for ($i = 1; $i <= 31; $i++) {
         $check1 = '';
         if ($date != '') {
             if ($i == intval(date('j', $timestamp))) {
                 $check1 = " selected='selected'";
             }
         } elseif ($i == date("j")) {
             $check1 = " selected='selected'";
         }
         $str_days .= "<option value='{$i}'" . $check1 . ">{$i}</option>";
     }
     $str_days .= '</select>';
     //Generate SelectList of months
     $str_months = "<select name='" . $name . "month' id='" . $name . "mm' onchange=\"jlms_getDate('" . $name . "','" . $format . "')\">";
     $first_day = mktime(1, 1, 1, 1, 1, 06);
     for ($j = 0; $j < 12; $j++) {
         $check2 = '';
         if ($date != '') {
             if ($j + 1 == intval(date('n', $timestamp))) {
                 $check2 = " selected='selected'";
             }
         } elseif ($j + 1 == date("n")) {
             $check2 = " selected='selected'";
         }
         $str_months .= "<option value='" . $j . "'{$check2}>" . month_lang(strftime("%m", strtotime("+" . $j . " month", $first_day)), 0, 2) . "</option>";
     }
     $str_months .= '</select>';
     //generate SelectList of Years
     $str_years = "<select name='" . $name . "year' id='" . $name . "yy' onchange=\"jlms_getDate('" . $name . "','" . $format . "')\">";
     for ($k = 2006; $k < 2021; $k++) {
         $check3 = '';
         if ($date != '') {
             if ($k == intval(date('Y', $timestamp))) {
                 $check3 = " selected='selected'";
             }
         } elseif ($k == date("Y")) {
             $check3 = " selected='selected'";
         }
         $str_years .= "<option value='{$k}'{$check3}>" . $k . "</option>";
     }
     $str_years .= '</select>';
     $str_hours = '';
     if (strpos($format, 'H') !== false) {
         //generate SelectList of Hours
         $str_hours = "<select name='" . $name . "hour' id='" . $name . "hh' onchange=\"jlms_getDate('" . $name . "','" . $format . "')\">";
         for ($k = 0; $k < 24; $k++) {
             $check4 = '';
             if ($date != '') {
                 if ($k == intval(date('H', $timestamp))) {
                     $check4 = " selected='selected'";
                 }
             } elseif ($k == date("H")) {
                 $check4 = " selected='selected'";
             }
             if ($k < 10) {
                 $str_hours .= "<option value='0{$k}'{$check4}>0" . $k . "</option>";
             } else {
                 $str_hours .= "<option value='{$k}'{$check4}>" . $k . "</option>";
             }
         }
         $str_hours .= '</select>';
     }
     $str_mins = '';
     if (strpos($format, 'i') !== false) {
         //generate SelectList of Minutes
         $str_mins = "<select name='" . $name . "minute' id='" . $name . "ii' onchange=\"jlms_getDate('" . $name . "','" . $format . "')\">";
         for ($k = 0; $k < 60; $k++) {
             $check5 = '';
             if ($date != '') {
                 if ($k == intval(date('i', $timestamp))) {
                     $check5 = " selected='selected'";
                 }
             } elseif ($k == date("i")) {
                 $check5 = " selected='selected'";
             }
             if ($k < 10) {
                 $str_mins .= "<option value='0{$k}'{$check5}>0" . $k . "</option>";
             } else {
                 $str_mins .= "<option value='{$k}'{$check5}>" . $k . "</option>";
             }
         }
         $str_mins .= '</select>';
     }
     $trans = array('Y' => $str_years, 'm' => $str_months, 'd' => $str_days, 'H' => $str_hours, 'i' => $str_mins, "-" => " ");
     $ret = strtr($format, $trans);
     return $ret;
 }
 public function GetRejectedChequesBalanceByCavesAndMonths($date, $monthCount)
 {
     $provMapper = new Gyuser_Model_ProvidersDataMapper();
     $provs = $provMapper->GetAllProviders();
     $table = $this->getDbTable();
     $providers = array();
     $provider = array();
     $months = array();
     $monthsSet = false;
     foreach ($provs as $prov) {
         $tempDate = $date;
         $prec = array();
         for ($i = 0; $i < $monthCount; $i++) {
             $flDatesArr = findPrevMonthFirstAndLastDay($tempDate);
             $select = $table->select();
             $select->setIntegrityCheck(false);
             $select->from(array('chk' => 'cheques'), array('balance', 'rejected_cost'));
             $select->where('chk.status =?', 3);
             $select->where('chk.provider_id =?', $prov->id);
             $select->where('chk.date >=?', $flDatesArr[0]);
             $select->where('chk.date <=?', $flDatesArr[1]);
             $resultSet = $table->fetchAll($select);
             $balance = 0;
             if ($resultSet) {
                 foreach ($resultSet as $row) {
                     $balance += $row->balance - $row->rejected_cost;
                 }
             }
             $prec[] = $balance;
             $tempDate = $flDatesArr[0];
             if (!$monthsSet) {
                 $months[] = month_lang($flDatesArr[2]);
             }
         }
         $provider['name'] = $prov->name;
         $provider['data'] = array_reverse($prec);
         $providers[] = $provider;
         $monthsSet = true;
     }
     $result['provs'] = $providers;
     $result['months'] = array_reverse($months);
     return $result;
 }
 public function GetOperationsAmountByPrevMonths($date, $monthCount)
 {
     $table = $this->getDbTable();
     $result = array();
     for ($i = 0; $i < $monthCount; $i++) {
         if (!$i) {
             $flDatesArr = findFirstAndLastDay($date);
         } else {
             $flDatesArr = findPrevMonthFirstAndLastDay($date);
         }
         $select = $table->select();
         $select->setIntegrityCheck(false);
         $select->from(array('opr' => 'operations'), array('amount', 'cave_id'));
         $select->where('opr.state_order_id = 11 OR opr.state_order_id = 9 OR opr.state_order_id = 10 ');
         $select->where('opr.date >=?', $flDatesArr[0]);
         if (!$i) {
             $select->where('opr.date <?', $flDatesArr[1]);
         } else {
             $select->where('opr.date <=?', $flDatesArr[1]);
         }
         $resultSet = $table->fetchAll($select);
         $caveAmount = 0;
         $soloAmount = 0;
         if ($resultSet) {
             foreach ($resultSet as $row) {
                 if ($row->cave_id) {
                     $caveAmount += $row->amount / 2;
                 } else {
                     $soloAmount += $row->amount;
                 }
             }
         }
         $result[month_lang($flDatesArr[2])] = array('cave' => $caveAmount, 'solo' => $soloAmount);
         $date = $flDatesArr[0];
     }
     return $result;
 }