function show_ZipPack($option, &$row_zip, &$lists, $doc_type = 'zip')
 {
     global $Itemid, $JLMS_CONFIG;
     JLMS_TMPL::OpenMT();
     $hparams = array('show_menu' => true, 'simple_menu' => true);
     if ($doc_type == 'document_contents') {
         $toolbar[] = array('btn_type' => 'archive', 'btn_str' => _JLMS_DOWNLOAD, 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=get_outdoc&id={$row_zip->doc_id}&force=force"));
     }
     /*$back_link = sefRelToAbs("index.php?option=$option&Itemid=$Itemid&task=documents&id=$course_id");
     		if (isset($lists['lpath_id']) && $lists['lpath_id']) {
     			$back_link = sefRelToAbs("index.php?option=$option&Itemid=$Itemid&task=compose_lpath&course_id=$course_id&id=".$lists['lpath_id']);
     		}*/
     //01.12.2007 - (DEN) - Compatibility for returning from the document view to the doc.tool/course homepage/lpaths list.
     $back_link = JLMSRoute::_("index.php?option={$option}&Itemid={$Itemid}&task=outdocs" . ($row_zip->parent_id ? "&folder={$row_zip->parent_id}" : '') . "&element={$row_zip->id}");
     $toolbar[] = array('btn_type' => 'back', 'btn_js' => $back_link);
     JLMS_TMPL::ShowHeader('outdoc', $row_zip->doc_name, $hparams, $toolbar);
     if ($doc_type == 'zip') {
         JLMS_TMPL::OpenTS();
         echo '<iframe id="zip_contents" name="zip_contents" height="600" width="100%" frameborder="0" scrolling="auto" src="' . $JLMS_CONFIG->get('live_site') . "/" . _JOOMLMS_SCORM_PLAYER . "/" . $row_zip->zip_folder . "/" . $row_zip->startup_file . '">' . _JLMS_IFRAMES_REQUIRES . '</iframe>';
         JLMS_TMPL::CloseTS();
     } elseif ($doc_type == 'content') {
         JLMS_TMPL::OpenTS();
         $text = JLMS_ShowText_WithFeatures($row_zip->doc_description);
         echo $text;
         JLMS_TMPL::CloseTS();
     } elseif ($doc_type == 'document_contents') {
         JLMS_TMPL::OpenTS('', ' id="jlms_doc_contents_container"');
         echo $row_zip->doc_description;
         JLMS_TMPL::CloseTS();
     }
     JLMS_TMPL::CloseMT();
 }
function showTopicCommentsShort($data)
{
    $db =& JFactory::getDbo();
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $option = 'com_joomla_lms';
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $Itemid = $JLMS_CONFIG->get('Itemid');
    $botParams = $_JLMS_PLUGINS->getPluginParams('jc_integration');
    $obj_data = new stdClass();
    if ($botParams->get('topic_comments', 1)) {
        $comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
        if (file_exists($comments)) {
            require_once $comments;
            include_once JCOMMENTS_HELPERS . DS . 'system.php';
            $document =& JFactory::getDocument();
            $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
            $count = JComments::getCommentsCount($data->id, $data->component);
            $count = isset($count) && intval($count) ? $count : 0;
            $link = 'index.php?option=' . $option . '&task=topic&course_id=' . $data->course_id . '&topic_id=' . $data->id;
            $link .= '&short=1';
            $link .= '&Itemid=' . $Itemid;
            $user =& JFactory::getUser();
            $link_text = $count || !$user->get('id') ? str_replace('{X}', $count, _JLMS_PLUGIN_JC_COMMENTS) : _JLMS_PLUGIN_JC_ADD_COMMENTS;
            $obj_data->short = '<div class="jcomments-links"><a class="comments-link" href="' . JLMSRoute::_($link) . '" title="' . _JLMS_PLUGIN_JC_A_TITLE . '">' . $link_text . '</a></div>';
        }
    }
    if (isset($obj_data->short)) {
        JLMS_TMPL::OpenTS('', ' colspan="2" align="right"');
        echo $obj_data->short;
        JLMS_TMPL::CloseTS();
    }
    return $obj_data;
}
    function showTracking($id, $option, &$rows, &$lists, &$track_images, &$latest_activities, $msg = '')
    {
        global $my;
        $JLMS_ACL =& JLMSFactory::getACL();
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        JLMS_TMPL::OpenMT();
        $hparams = array();
        //$hparams['second_tb_header'] = _JLMS_TRACK_TITLE_ACCESS.JLMS_TRACKING_getTitle(null);
        $toolbar = array();
        if ($JLMS_ACL->CheckPermissions('tracking', 'clear_stats')) {
            $toolbar[] = array('btn_type' => 'clear', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=track_clear&amp;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="2" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
				<td width="65%" valign="top">
					<?php 
        echo JLMSCSS::h2(_JLMS_TRACKING_LATEST_COURSE_ACTIVITIES);
        ?>
					<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 
        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 
        $k = 1;
        if (!count($latest_activities)) {
            echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '"><td colspan="4">' . _JLMS_TRACKING_NO_STATISTICS . '</td></tr>';
        }
        foreach ($latest_activities as $latest_activity) {
            echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '">';
            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;
        }
        ?>
					</table>
				</td>
				<td valign="top">
					<?php 
        echo JLMSCSS::h2(_JLMS_TRACKING_STATISTICS_REPORTS);
        ?>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
						<tr>
							<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="2">
							<?php 
        echo _JLMS_TRACKING_STATISTICS_REPORTS;
        ?>
							</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						</tr>
						<tr class="<?php 
        echo JLMSCSS::_('sectiontableentry1');
        ?>
">
							<td width="16"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/tlb_tracking.png" alt="i" width="16" height="16" border="0" /></td>
							<td><a href="<?php 
        echo JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}&amp;page=12");
        ?>
"><?php 
        echo _JLMS_TRACKING_DOCUMENTS_STATISTICS;
        ?>
</a></td>
						</tr>
						<tr class="<?php 
        echo JLMSCSS::_('sectiontableentry2');
        ?>
">
							<td width="16"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/tlb_tracking.png" alt="i" width="16" height="16" border="0" /></td>
							<td><a href="<?php 
        echo JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}&amp;page=13");
        ?>
"><?php 
        echo _JLMS_TRACKING_LPATHS_STATISTICS;
        ?>
</a></td>
						</tr>
						<tr class="<?php 
        echo JLMSCSS::_('sectiontableentry1');
        ?>
">
							<td width="16"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/tlb_tracking.png" alt="i" width="16" height="16" border="0" /></td>
							<td><a href="<?php 
        echo JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}&amp;page=14");
        ?>
"><?php 
        echo _JLMS_TRACKING_LATEST_COURSE_ACTIVITIES_REPORT;
        ?>
</a></td>
						</tr>
						<tr class="<?php 
        echo JLMSCSS::_('sectiontableentry2');
        ?>
">
							<td width="16"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/tlb_quiz.png" alt="i" width="16" height="16" border="0" /></td>
							<td><a href="<?php 
        echo JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$id}&amp;page=reports");
        ?>
"><?php 
        echo _JLMS_TRACKING_QUIZZES_REPORT;
        ?>
</a></td>
						</tr>
						<tr class="<?php 
        echo JLMSCSS::_('sectiontableentry1');
        ?>
">
							<td width="16"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/tlb_quiz.png" alt="i" width="16" height="16" border="0" /></td>
							<td><a href="<?php 
        echo JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$id}&amp;page=quiz_bars");
        ?>
"><?php 
        echo _JLMS_TRACKING_QUIZZES_ANSWERS_STATISTICS;
        ?>
</a></td>
						</tr>
					</table>
				</td>
			</tr>
			</table><br />
			<?php 
        echo JLMSCSS::h2(_JLMS_TRACK_TITLE_ACCESS . JLMS_TRACKING_getTitle(null));
        ?>
			<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 
        $lists['filter_month'] = str_replace('<option value="0" selected="selected"></option>', '<option value="0" selected="selected">&nbsp;</option>', $lists['filter_month']);
        $lists['filter_month'] = str_replace('<option value="0"></option>', '<option value="0">&nbsp;</option>', $lists['filter_month']);
        ?>
							<?php 
        echo $lists['filter'];
        ?>
&nbsp;<?php 
        echo $lists['filter_month'] . '<br />';
        if (isset($lists['filter2'])) {
            echo $lists['filter2'] . '<br />';
        }
        if (isset($lists['filter3'])) {
            echo $lists['filter3'] . '<br />';
        }
        echo $lists['filter_stu'];
        ?>
						</div>
					</td>
				</tr>
			</table>
	<?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_DATE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=1");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_DOCS;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_DOCS;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=2");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_LINKS;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_LINKS;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=3");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_DROP;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_DROP;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=4");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_LPATH;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_LPATH;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=5");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_HW;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_HW;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=6");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_ANNOUNC;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_ANNOUNC;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=7");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_CONF;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_CONF;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=8");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_CHAT;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_CHAT;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=9");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_LPPLAY;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_LPPLAY;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=10");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_FORUM;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_FORUM;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><a href="<?php 
        echo sefRelToAbs($link . "&amp;page=11");
        ?>
" title="<?php 
        echo _JLMS_TRACK_TBL_H_QUIZ;
        ?>
"><?php 
        echo _JLMS_TRACK_TBL_H_QUIZ;
        ?>
</a></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><?php 
        echo _JLMS_TOTAL;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				</tr>
			<?php 
        $k = 1;
        $i = 0;
        $total_counts = array();
        for ($j = 0; $j < 11; $j++) {
            $total_counts[$j] = 0;
        }
        while ($i < count($rows)) {
            $row = $rows[$i];
            $subtotal = 0;
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}&amp;filter_month={$row->month}";
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td align="left" valign="middle" style="vertical-align:middle ">
					<?php 
            if ($lists['is_month']) {
                echo JLMS_dateToDisplay(mktime(0, 0, 0, $lists['month'], $row->month, $lists['year']), true);
            } else {
                echo '<a href="' . sefRelToAbs($link) . '" title="' . _JLMS_VIEW_DETAILS . '">' . month_lang(strftime("%m", mktime(0, 0, 0, $row->month + 1, 0, 0)), 0, 2) . '</a>';
            }
            ?>
					</td>
					<?php 
            $j = 1;
            $month = $rows[$i]->month;
            $year = $rows[$i]->year;
            do {
                while ($j < $rows[$i]->page_id) {
                    echo '<td align="center">0</td>';
                    $j++;
                }
                if ($rows[$i]->month == $month && $rows[$i]->year == $year) {
                    echo '<td align="center">' . $rows[$i]->count_hits . '</td>';
                    $total_counts[$j - 1] = $total_counts[$j - 1] + $rows[$i]->count_hits;
                    $subtotal = $subtotal + $rows[$i]->count_hits;
                }
                $j++;
                $i++;
            } while ($i < count($rows) && $rows[$i]->month == $month && $rows[$i]->year == $year);
            while ($j <= 11) {
                echo '<td align="center">0</td>';
                $j++;
            }
            echo '<td align="center"><strong>' . $subtotal . '</strong></td>';
            if (isset($rows[$i]->month) && $rows[$i]->month != $month) {
                $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 
        $subtotal = 0;
        for ($j = 0; $j < 11; $j++) {
            echo '<td align="center"><strong>' . $total_counts[$j] . '</strong></td>';
            $subtotal = $subtotal + $total_counts[$j];
        }
        echo '<td align="center"><strong>' . $subtotal . '</strong></td>';
        ?>
				</tr>
			</table><br />
			<?php 
        if (!empty($track_images)) {
            echo "<table cellpadding='0' cellspacing='0' border='0' width='100%' class='jlms_table_no_borders'>";
            $i = 0;
            foreach ($track_images as $ti) {
                if ($i == 0) {
                    echo "<tr><td align='center' valign='top'>";
                } elseif ($i == 2) {
                    echo "</td><td align='center' valign='top'>";
                } elseif ($i == 3) {
                    echo "</td></tr><tr><td colspan='2' align='center' valign='top'>";
                } elseif ($i == 4) {
                    echo "</td></tr><tr><td colspan='2' align='center' valign='top'>";
                }
                ?>
					<?php 
                echo JLMSCSS::h2($ti->title);
                ?>
					<img src="<?php 
                echo $JLMS_CONFIG->get('live_site') . "/" . $JLMS_CONFIG->get('temp_folder', '') . "/{$ti->filename}";
                ?>
" width="<?php 
                echo $ti->width;
                ?>
" height="<?php 
                echo $ti->height;
                ?>
" alt="<?php 
                echo $ti->alt;
                ?>
" title="<?php 
                echo $ti->alt;
                ?>
" border='0' />
				<?php 
                if ($i == 4) {
                    echo "</td></tr>";
                }
                $i++;
            }
            if (count($track_images) == 4) {
                echo "</td></tr>";
            }
            echo "</table>";
        } elseif ($msg) {
            echo '<div class="joomlalms_sys_message">' . $msg . '</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="tracking" />
		<input type="hidden" name="state" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function viewCourses_blog(&$rows, &$pageNav, $option, $usertype, $lists, $levels)
    {
        global $Itemid, $JLMS_CONFIG, $my, $JLMS_DB, $acl;
        $JLMS_ACL =& JLMSFactory::getACL();
        $pres_icons = new stdClass();
        $pres_icons->mail = 0;
        $pres_icons->already = 0;
        $pres_icons->my = 0;
        $pres_icons->wl = 0;
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        //		$show_fee_col = $JLMS_CONFIG->get('show_fee_column', 1);
        $price_fee_type = $JLMS_CONFIG->get('price_fee_type', 1);
        $show_short_description = $JLMS_CONFIG->get('show_short_description', 0);
        $show_course_publish_dates = $JLMS_CONFIG->get('show_course_publish_dates', 0);
        $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign');
        $colspan_sh_description = 4;
        if ($show_course_publish_dates) {
            $colspan_sh_description = 6;
        }
        if (!$price_fee_type) {
            $colspan_sh_description = $colspan_sh_description - 1;
        }
        $show_course_author = $JLMS_CONFIG->get('show_course_authors', 1);
        $course_id = mosGetParam($_REQUEST, 'c_id', '');
        if ($course_id) {
            $query = "SELECT course_name FROM #__lms_courses WHERE id = '{$course_id}'";
            $JLMS_DB->setQuery($query);
            $course_name = $JLMS_DB->loadResult();
        }
        //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++;
                }
            }
        }
        ?>
		
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		function submitbutton(pressbutton, course_id) {
			var form = document.adminForm;
			if ( (pressbutton == 'delete_course') || (pressbutton == 'edit_course') || (pressbutton == 'export_course_pre') ) {
				form.id.value = course_id;
				form.task.value = pressbutton;
				form.submit();
			}
			else if( (pressbutton == 'enroll') && (form.boxchecked.value == '0') ){
				alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
			}
			else {
				if (pressbutton == 'enroll'){
					form.task.value = 'subscription';
					form.submit();
				}
			}
		}
		<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            ?>
		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;	
					}
				}
			}
		}
		<?php 
        }
        ?>
		//--><!]]>
		</script>

		<form action="<?php 
        echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('course', _JLMS_COURSES_COURSES_LIST, $params);
        JLMS_TMPL::ShowPageTip('courses');
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        //		echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox( $link );
        //		echo _JLMS_COURSES_FILTER." : ".$lists['courses_type'];
        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) . " " . $lists['filter_0'] . "&nbsp;&nbsp;";
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'] . "&nbsp;&nbsp;";
        }
        JLMS_TMPL::CloseTS();
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                    echo (isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i] . "&nbsp;&nbsp;";
                    JLMS_TMPL::CloseTS();
                }
            }
        }
        $controls = array();
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->CheckPermissions('lms', 'create_course')) {
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=add_course"), 'title' => _JLMS_COURSES_NEW, 'img' => 'add');
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=course_import"), 'title' => _JLMS_COURSES_IMPORT, 'img' => 'courseimport');
            $controls[] = array('href' => 'spacer');
            JLMS_TMPL::ShowControlsFooter($controls, '', false);
        }
        //$controls[] = array('href' => "javascript:submitbutton('enroll','');", 'title' => _JLMS_ENROLL, 'img' => 'publish');
        JLMS_TMPL::OpenTS('', ' style="padding: 5px;"');
        if (JLMS_J16version()) {
            ?>
		<div class="lms_courses_blog">
			<div class="blog-featured">
				<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
				<div class="items-leading">
					<?php 
                $lead_indx = 0;
                foreach ($rows as $row) {
                    if (isset($row->leading_course) && $row->leading_course) {
                        $leading = 'leading-' . $lead_indx;
                        ?>
							<div class="<?php 
                        echo $leading;
                        ?>
">
								<h2>
									<a href="<?php 
                        echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
										<?php 
                        echo $row->course_name;
                        ?>
									</a>
									<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
									<div class="clr"><!-- --></div>
								</h2>
								<dl class="article-info">
									<?php 
                        if ($show_course_author) {
                            ?>
										<dd class="createdby">
											<?php 
                            echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                            ?>
										</dd>
										<?php 
                        }
                        ?>
								</dl>
								<?php 
                        echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                        ?>
								<div class="item-separator"><!-- --></div>
							</div>
							<?php 
                        $lead_indx++;
                    }
                }
                ?>
				</div>
				<?php 
            }
            $class = 'items-row';
            $cols_class = 'cols-' . $lists['menu_params']->get('num_columns', 2);
            $row_class = 'row-0';
            $class = $class . ' ' . $cols_class . ' ' . $row_class;
            ?>
				<div class="<?php 
            echo $class;
            ?>
">
				<?php 
            $n = 1;
            for ($i = 0; $i < count($rows); $i++) {
                $row = $rows[$i];
                if (!isset($row->leading_course) || !$row->leading_course) {
                    ?>
					
						<?php 
                    $column_class = 'item';
                    $column_class .= ' ' . 'column-' . $n;
                    ?>
						<div class="<?php 
                    echo $column_class;
                    ?>
">
							<h2>
								<a href="<?php 
                    echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                    ?>
" title="<?php 
                    echo $row->course_name;
                    ?>
">
									<?php 
                    echo $row->course_name;
                    ?>
								</a>
								<?php 
                    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                    $_JLMS_PLUGINS->loadBotGroup('system');
                    $plugin_args = array();
                    $plugin_args[] = $row->id;
                    $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                    ?>
								<div class="clr"><!-- --></div>
							</h2>
							<dl class="article-info">
								<?php 
                    if ($show_course_author) {
                        ?>
									<dd class="createdby">
										<?php 
                        echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                        ?>
									</dd>
									<?php 
                    }
                    ?>
							</dl>
							
							<?php 
                    echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                    ?>
							<div class="item-separator"><!-- --></div>
						</div>
						<?php 
                    if ($lists['menu_params']->get('num_columns', 2) == $n) {
                        ?>
							<span class="row-separator"><!-- --></span>
							<?php 
                        $n = 1;
                    } else {
                        $n++;
                    }
                }
            }
            ?>
				</div>
			</div>
		</div>
		<?php 
        } else {
            ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
			<tr>
				<td colspan="<?php 
                echo is_object($lists['menu_params']) && method_exists($lists['menu_params'], 'get') ? $lists['menu_params']->get('num_columns', 2) : 2;
                ?>
" valign="top">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $row = $rows[$x];
                    if (isset($row->leading_course) && $row->leading_course) {
                        ?>
							<div class="course_info">
								<table width="100%" cellpadding="0" cellspacing="0" border="0">
									<tr>
										<td class="contentheading">
											<a href="<?php 
                        echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
												<?php 
                        echo $row->course_name;
                        ?>
											</a>
										</td>
									</tr>
								</table>
								<?php 
                        if ($show_course_author) {
                            ?>
								<div class="course_author">
									<span class="small"><?php 
                            echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                            ?>
</span>
								</div>
								<?php 
                        }
                        ?>
								<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
								<div class="course_sh_dsc">
									<?php 
                        echo $row->course_sh_description;
                        ?>
								</div>
							</div>
							<span class="article_separator">&nbsp;</span>
							<?php 
                    }
                }
                ?>
				</td>
			</tr>
			<?php 
            }
            ?>
	
			<tr>
				<?php 
            $divider = '';
            $menu_params_columns = is_object($lists['menu_params']) && method_exists($lists['menu_params'], 'get') ? $lists['menu_params']->get('num_columns', 2) : 2;
            for ($z = 0; $z < $menu_params_columns; $z++) {
                if ($z > 0) {
                    $divider = ' column_separator';
                }
                ?>
				<td class="article_column<?php 
                echo $divider;
                ?>
" valign="top" width="<?php 
                echo intval(100 / $menu_params_columns);
                ?>
%">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $n = $x * $menu_params_columns + $z;
                    if (isset($rows[$n])) {
                        $row = $rows[$n];
                        if (!isset($row->leading_course) || !$row->leading_course) {
                            ?>
								<div class="course_info">
									<table width="100%" cellpadding="0" cellspacing="0" border="0">
										<tr>
											<td class="contentheading">
												<a href="<?php 
                            echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                            ?>
" title="<?php 
                            echo $row->course_name;
                            ?>
">
													<?php 
                            echo $row->course_name;
                            ?>
												</a>
											</td>
										</tr>
									</table>
									<?php 
                            if ($show_course_author) {
                                ?>
									<div class="course_author">
										<span class="small"><?php 
                                echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                                ?>
</span>
									</div>
									<?php 
                            }
                            ?>
									<?php 
                            $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                            $_JLMS_PLUGINS->loadBotGroup('system');
                            $plugin_args = array();
                            $plugin_args[] = $row->id;
                            $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                            ?>
									<div class="course_sh_dsc">
										<?php 
                            echo $row->course_sh_description;
                            ?>
									</div>
								</div>
								<span class="article_separator">&nbsp;</span>
								<?php 
                        }
                    }
                }
                ?>
				</td>
				<?php 
            }
            ?>
			</tr>
		</table>
	<?php 
        }
        ?>
	
	<center>
	<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo _JLMS_PN_DISPLAY_NUM . ' ' . $pageNav->getLimitBox($link);
        echo $pageNav->writePagesCounter();
        ?>
	</center>
	<center>
		<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo $pageNav->writePagesLinks($link);
        ?>
	</center>
	<?php 
        JLMS_TMPL::CloseTS();
        if ($pres_icons->already || $pres_icons->mail || $pres_icons->my || $pres_icons->wl) {
            JLMS_TMPL::OpenTS('', ' align="left"');
            ?>
			<div class="joomlalms_info_legend">
			<?php 
            if ($pres_icons->already) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/buttons/btn_complete.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
" title="<?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
.
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->mail) {
                ?>
				<div style="text-align:left ">
					<img class='JLMS_png' src="<?php 
                echo $lms_img_path;
                ?>
/dropbox/dropbox_corr.png" align="top" width='16' height='16' border='0' alt='' title='' />
					&nbsp;- <?php 
                echo _JLMS_COURSES_ADMIN_SENT;
                ?>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->my) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/toolbar/tlb_courses.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" title="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
.
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->wl) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/buttons/btn_waiting.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" title="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_IN_WL;
                ?>
.
				</div>
			<?php 
            }
            ?>
			</div>
	<?php 
            JLMS_TMPL::CloseTS();
        }
        JLMS_TMPL::CloseMT();
        ?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="id" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="itemid" value="" />
		<input type="hidden" name="row_id" value="0" />
	</form>
	<?php 
    }
    function showCourseLinks($id, $option, &$rows)
    {
        $user = JLMSFactory::getUser();
        $db =& JFactory::getDbo();
        $JLMS_ACL =& JLMSFactory::getACL();
        $JLMS_CONFIG = JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ( ((pressbutton == 'link_delete') || (pressbutton == 'pre_link_edit')) && (form.boxchecked.value == "0")){
		alert("<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
");
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_order(pressbutton, item_id) {
	var form = document.adminForm;
	if ((pressbutton == 'link_orderup') || (pressbutton == 'link_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_link'){
		if (form.boxchecked.value == "0") {
			alert("<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
");
		} else {
			form.task.value = pressbutton;
			form.state.value = state;
			form.submit();
		}
	}
}
function submitbutton_change2(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'change_link'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('link', _JLMS_LINKS_COURSE_LINKS, $hparams);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
<?php 
        if (!empty($rows)) {
            ?>
			<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 $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
				<?php 
            if ($JLMS_ACL->CheckPermissions('links', 'manage') || $JLMS_ACL->CheckPermissions('links', 'publish')) {
                ?>
					<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="20" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
                echo count($rows);
                ?>
);" /></<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
				<?php 
            }
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="40%"><?php 
            echo _JLMS_LINKS_TBL_HEAD_LINK;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
				<?php 
            if ($JLMS_ACL->CheckPermissions('links', 'publish')) {
                ?>
					<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">&nbsp;</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
				<?php 
            }
            if ($JLMS_ACL->CheckPermissions('links', 'order')) {
                ?>
					<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" colspan="2" width="1">&nbsp;</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
				<?php 
            }
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="60%"><?php 
            echo _JLMS_LINKS_TBL_HEAD_DESCR;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
				</tr>
			<?php 
            $there_were_squeezeboxes = false;
            $k = 1;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $is_squeezebox = false;
                $row = $rows[$i];
                $link = $row->link_href;
                if ($row->link_type == 2) {
                    $link = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=view_inline_link&course_id={$id}&id={$row->id}");
                }
                if ($row->link_type == 3) {
                    $is_squeezebox = true;
                    $there_were_squeezeboxes = true;
                }
                $alt = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                $image = $row->published ? 'btn_accept.png' : 'btn_cancel.png';
                $state = $row->published ? 0 : 1;
                if ($row->is_time_related) {
                    $tooltip_txt = _JLMS_WILL_BE_RELEASED_IN;
                    $showperiod = $row->show_period;
                    $ost1 = $showperiod % (24 * 60);
                    $sp_days = ($showperiod - $ost1) / (24 * 60);
                    $ost2 = $showperiod % 60;
                    $sp_hours = ($ost1 - $ost2) / 60;
                    $sp_mins = $ost2;
                    $release_time_info = false;
                    if ($sp_days) {
                        $tooltip_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS;
                        $release_time_info = true;
                    }
                    if ($sp_hours) {
                        $tooltip_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS;
                        $release_time_info = true;
                    }
                    if ($sp_mins) {
                        $tooltip_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES;
                        $release_time_info = true;
                    }
                    if ($release_time_info) {
                        $tooltip_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT;
                    }
                }
                $checked = mosHTML::idBox($i, $row->id);
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td align="center"><?php 
                echo $i + 1;
                ?>
</td>
				<?php 
                if ($JLMS_ACL->CheckPermissions('links', 'manage') || $JLMS_ACL->CheckPermissions('links', 'publish')) {
                    $show_check = true;
                    if ($JLMS_ACL->CheckPermissions('links', 'only_own_items') && $row->owner_id != $user->get('id')) {
                        $show_check = false;
                    } elseif ($JLMS_ACL->CheckPermissions('links', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($db, $row->owner_id)) {
                        $show_check = false;
                    }
                    ?>
					<td>
					<?php 
                    echo $show_check ? $checked : '&nbsp;';
                    ?>
					</td>
				<?php 
                }
                ?>
					<td align="left">
						<?php 
                if ($is_squeezebox) {
                    $tmp_params = new JLMSParameters($row->params);
                    $x_size = 0;
                    $y_size = 0;
                    if (is_object($tmp_params) && $tmp_params->get('display_width')) {
                        $x_size = intval($tmp_params->get('display_width'));
                    } elseif (isset($tmp_params->display_width)) {
                        $x_size = intval($tmp_params->display_width);
                    }
                    if (is_object($tmp_params) && $tmp_params->get('display_height')) {
                        $y_size = intval($tmp_params->get('display_height'));
                    } elseif (isset($tmp_params->display_height)) {
                        $y_size = intval($tmp_params->display_height);
                    }
                    ?>
							<a class="jlms_modal" rel="{handler:'iframe', size:{x:<?php 
                    echo $x_size;
                    ?>
,y:<?php 
                    echo $y_size;
                    ?>
}}" href="<?php 
                    echo $link;
                    ?>
" title="<?php 
                    echo str_replace('"', '&quot;', $row->link_name);
                    ?>
">
								<?php 
                    echo $row->link_name;
                    ?>
							</a>
						<?php 
                } else {
                    ?>
							<?php 
                    if ($link) {
                        ?>
							<a <?php 
                        echo !$row->link_type ? 'target="_blank" ' : ' ';
                        ?>
href="<?php 
                        echo $link;
                        ?>
" title="<?php 
                        echo str_replace('"', '&quot;', $row->link_name);
                        ?>
">
								<?php 
                        echo $row->link_name;
                        ?>
							</a>
							<?php 
                    } else {
                        echo $row->link_name;
                    }
                    ?>
						<?php 
                }
                ?>
						<?php 
                if ($JLMS_CONFIG->get('show_links_authors', 0)) {
                    ?>
						<br />
						<span class="small"><?php 
                    echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->author_name;
                    ?>
</span>
						<?php 
                }
                ?>
					</td>
				<?php 
                if ($JLMS_ACL->CheckPermissions('links', 'publish')) {
                    ?>
					<td valign="middle">
					<?php 
                    if ($JLMS_ACL->CheckPermissions('links', 'only_own_items') && $row->owner_id != $user->get('id')) {
                        ?>
						<img class="JLMS_png" src="<?php 
                        echo $JLMS_CONFIG->get('live_site');
                        ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                        echo $image;
                        ?>
" width="16" height="16" border="0" alt="<?php 
                        echo $alt;
                        ?>
" />
					<?php 
                    } elseif ($JLMS_ACL->CheckPermissions('links', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($db, $row->owner_id)) {
                        ?>
						<img class="JLMS_png" src="<?php 
                        echo $JLMS_CONFIG->get('live_site');
                        ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                        echo $image;
                        ?>
" width="16" height="16" border="0" alt="<?php 
                        echo $alt;
                        ?>
" />
					<?php 
                    } else {
                        if ($row->is_time_related) {
                            if ($row->published) {
                                $image = 'btn_publish_wait.png';
                            }
                            $tooltip_link = 'javascript:submitbutton_change2(\'change_link\',' . $state . ',' . $row->id . ')';
                            $tooltip_name = '<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 . '" />';
                            echo JLMS_toolTip($alt, $tooltip_txt, $tooltip_name, $tooltip_link);
                        } else {
                            echo '<a href="javascript:submitbutton_change2(\'change_link\',' . $state . ',' . $row->id . ')" title="' . $alt . '">';
                            echo '<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 . '" />';
                            echo '</a>';
                        }
                    }
                    ?>
					</td>
				<?php 
                }
                if ($JLMS_ACL->CheckPermissions('links', 'order')) {
                    ?>
					<td><?php 
                    echo JLMS_orderUpIcon($i, $row->id, true, 'link_orderup');
                    ?>
</td>
					<td><?php 
                    echo JLMS_orderDownIcon($i, $n, $row->id, true, 'link_orderdown');
                    ?>
</td>
				<?php 
                }
                ?>
					<td><?php 
                echo $row->link_description ? $row->link_description : '&nbsp;';
                ?>
</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
<?php 
            if ($there_were_squeezeboxes) {
                JLMS_initialize_SqueezeBox(false);
            }
        } 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="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="setup_category" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
			<input type="hidden" name="row_id" value="0" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="cid2" value="0" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        if ($id && ($JLMS_ACL->CheckPermissions('links', 'manage') || $JLMS_ACL->CheckPermissions('links', 'publish'))) {
            $link_new = JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=pre_create_link&amp;id={$id}");
            $controls = array();
            if ($JLMS_ACL->CheckPermissions('links', 'publish')) {
                $controls[] = array('href' => "javascript:submitbutton_change('change_link',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish');
                $controls[] = array('href' => "javascript:submitbutton_change('change_link',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish');
                if ($JLMS_ACL->CheckPermissions('links', 'manage')) {
                    $controls[] = array('href' => 'spacer');
                }
            }
            if ($JLMS_ACL->CheckPermissions('links', 'manage')) {
                $controls[] = array('href' => $link_new, 'onclick' => "", 'title' => _JLMS_LINKS_IMG_NEW_LINK, 'img' => 'add');
                $controls[] = array('href' => "javascript:submitbutton('link_delete');", 'title' => _JLMS_LINKS_IMG_DEL_LINK, 'img' => 'delete');
                $controls[] = array('href' => "javascript:submitbutton('pre_link_edit');", 'title' => _JLMS_LINKS_IMG_EDIT_LINK, 'img' => 'edit');
            }
            JLMS_TMPL::ShowControlsFooter($controls);
        }
        JLMS_TMPL::CloseMT();
    }
    function showCourseLPaths($course_id, $option, &$lpaths)
    {
        global $Itemid, $my, $JLMS_DB, $JLMS_CONFIG;
        $JLMS_ACL =& JLMSFactory::getACL();
        ?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
		
			if ( ((pressbutton == 'edit_lpath') || (pressbutton == 'lpath_delete') ) && (form.boxchecked.value == "0")) {
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
			} else {
				if( pressbutton == 'lpath_delete' ) {
					if (confirm('<?php 
        echo _JLMS_ALERT_DELETE_ITEM;
        ?>
')) {
						form.task.value = pressbutton;
						form.submit();
					}
				}
				else {	
						form.task.value = pressbutton;
						form.submit();
				}
			}	
}
	
function submitbutton_order(pressbutton, item_id) {
	var form = document.adminForm;
	if ((pressbutton == 'lpath_orderup') || (pressbutton == 'lpath_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_lpath'){
		if (form.boxchecked.value == 0 || form.boxchecked.value == "0") {
			alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
		} else {
			form.task.value = pressbutton;
			form.state.value = state;
			form.submit();
		}
	}
}
function submitbutton_change2(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'change_lpath'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
function submitbutton_allorder(n) {
	var form = document.adminForm;

	for ( var j = 0; j <= n; j++ ) {
		box = eval( "document.adminForm.cb" + j );
		if ( box ) {
			if ( box.checked == false ) {
				box.checked = true;
			}
		}
	}
	form.task.value = 'lpath_saveorederall';
	form.submit();
}
//-->
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('lpath', _JLMS_LPATH_TITLE, $hparams);
        JLMS_TMPL::OpenTS();
        //temporary check for number of items
        $num_items = 0;
        $there_were_squeezeboxes = false;
        for ($i = 0, $n = count($lpaths); $i < $n; $i++) {
            $row_path = $lpaths[$i];
            $is_hidden = false;
            if ($row_path->item_id) {
                $tmp_params = new JLMSParameters($row_path->lp_params);
                if ($tmp_params->get('hide_in_list', 0) == 1) {
                    $is_hidden = true;
                }
            }
            if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) {
                $task = 'compose_lpath';
                $title = _JLMS_LPATH_LINK_TITLE_COMPOSE;
            } elseif ($JLMS_ACL->CheckPermissions('lpaths', 'view')) {
                $task = 'show_lpath';
                $title = _JLMS_LPATH_LINK_TITLE_VIEW;
                if ($is_hidden) {
                    continue;
                }
            }
            if (isset($row_path->is_hidden) && $row_path->is_hidden && !$JLMS_ACL->CheckPermissions('lpaths', 'view_all')) {
                continue;
            }
            $num_items++;
        }
        ?>
			<form action="<?php 
        echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
<?php 
        if ($num_items) {
            ?>
				<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 
            if ($JLMS_ACL->CheckPermissions('lpaths', 'manage') || $JLMS_ACL->CheckPermissions('lpaths', 'publish')) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="25" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
                echo count($lpaths);
                ?>
);" /></<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" 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 
            if ($JLMS_ACL->CheckPermissions('lpaths', 'publish')) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">&nbsp;</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
					<?php 
            if ($JLMS_ACL->CheckPermissions('lpaths', 'order')) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">&nbsp;</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">&nbsp;</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1"><?php 
                echo _JLMS_REORDER;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1"><a class="jlms_img_link" href="javascript:submitbutton_allorder(<?php 
                echo count($lpaths) - 1;
                ?>
)"><img width="16" height="16" border="0" title="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" alt="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/filesave.png"/></a></<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
					<?php 
            if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">&nbsp;</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
					<?php 
            if (!$JLMS_ACL->CheckPermissions('lpaths', 'manage')) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">&nbsp;</<?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();
                ?>
>
					<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_TBL_HEAD_DESCR;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            $k = 1;
            $i_counter = 0;
            for ($i = 0, $n = count($lpaths); $i < $n; $i++) {
                $row_path = $lpaths[$i];
                $is_hidden = false;
                $is_squeezebox = false;
                if ($row_path->item_id) {
                    $tmp_params = new JLMSParameters($row_path->lp_params);
                    if ($tmp_params->get('hide_in_list', 0) == 1) {
                        $is_hidden = true;
                    }
                    if (isset($row_path->scorm_params)) {
                        $tmp_params2 = new JLMSParameters($row_path->scorm_params);
                        if ($tmp_params2->get('scorm_layout', 0) == 1) {
                            $is_squeezebox = true;
                            $there_were_squeezeboxes = true;
                        }
                    }
                }
                $manage_item = false;
                if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) {
                    $manage_item = true;
                }
                if ($JLMS_ACL->CheckPermissions('lpaths', 'only_own_items') && $row_path->owner_id != $my->id) {
                    $manage_item = false;
                } elseif ($JLMS_ACL->CheckPermissions('lpaths', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($JLMS_DB, $row_path->owner_id)) {
                    $manage_item = false;
                }
                if ($manage_item) {
                    $task = 'compose_lpath';
                    $title = _JLMS_LPATH_LINK_TITLE_COMPOSE;
                } elseif ($JLMS_ACL->CheckPermissions('lpaths', 'view')) {
                    $task = 'show_lpath';
                    $title = _JLMS_LPATH_LINK_TITLE_VIEW;
                    if ($is_hidden && !$JLMS_ACL->CheckPermissions('lpaths', 'view_all')) {
                        continue;
                    }
                }
                if (isset($row_path->is_hidden) && $row_path->is_hidden && !$JLMS_ACL->CheckPermissions('lpaths', 'view_all')) {
                    continue;
                }
                $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=" . $task . "&course_id=" . $course_id . "&id=" . $row_path->id;
                // sefRelToAbs() - est' nige
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->item_id) {
                    $title = _JLMS_LPATH_LINK_TITLE_SCORM;
                    //$link = "index.php?option=".$option."&Itemid=".$Itemid."&task=player_scorm&course_id=".$course_id."&id=".$row_path->item_id."&lp_type=".$row_path->lp_type;
                    $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=show_lpath&course_id=" . $course_id . "&id=" . $row_path->id;
                    //."&lp_type=".$row_path->lp_type;
                    $icon_img = "toolbar/tlb_scorm";
                    $icon_alt = "scorm";
                }
                $checked = mosHTML::idBox($i_counter, $row_path->id);
                $alt = $row_path->published ? $is_hidden ? _JLMS_STATUS_PUBLISHED_AND_HIDDEN : _JLMS_LPATH_STATUS_PUB : _JLMS_LPATH_STATUS_UNPUB;
                $image = $row_path->published ? $is_hidden ? 'btn_publish_hidden.png' : 'btn_accept.png' : 'btn_cancel.png';
                $state = $row_path->published ? 0 : 1;
                $released_info_txt = '';
                if ($row_path->is_time_related) {
                    $released_info_txt = _JLMS_WILL_BE_RELEASED_IN;
                    $showperiod = $row_path->show_period;
                    $ost1 = $showperiod % (24 * 60);
                    $sp_days = ($showperiod - $ost1) / (24 * 60);
                    $ost2 = $showperiod % 60;
                    $sp_hours = ($ost1 - $ost2) / 60;
                    $sp_mins = $ost2;
                    $release_time_info = false;
                    if ($sp_days) {
                        $released_info_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS;
                        $release_time_info = true;
                    }
                    if ($sp_hours) {
                        $released_info_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS;
                        $release_time_info = true;
                    }
                    if ($sp_mins) {
                        $released_info_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES;
                        $release_time_info = true;
                    }
                    if ($release_time_info) {
                        $released_info_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT;
                    }
                    if ($image == 'btn_accept.png') {
                        $image = 'btn_publish_wait.png';
                    }
                }
                $publish_icon = '&nbsp;';
                if ($JLMS_ACL->CheckPermissions('lpaths', 'publish')) {
                    /*$publish_icon = '<a href="javascript:submitbutton_change2(\'change_lpath\','.$state.','.$row_path->id.')" title="'.$alt.'">';
                    		$publish_icon .= '<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.'" />';
                    		$publish_icon .= '</a>';*/
                    $title_tt = $alt;
                    $content_tt = $released_info_txt;
                    if (isset($row_path->is_prereqs) && $row_path->is_prereqs) {
                        if ($content_tt) {
                            $content_tt .= '<br />';
                        }
                        $content_tt .= _JLMS_STATUS_CONFIGURED_PREREQUISITES;
                    }
                    $name_tt = '<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 . '" />';
                    $link_tt = 'javascript:submitbutton_change2(\'change_lpath\',' . $state . ',' . $row_path->id . ')';
                    $publish_icon = JLMS_toolTip($title_tt, $content_tt, $name_tt, $link_tt);
                }
                if ($JLMS_ACL->CheckPermissions('lpaths', 'only_own_items') && $row_path->owner_id != $my->id) {
                    $checked = '&nbsp;';
                    $publish_icon = '&nbsp;';
                } elseif ($JLMS_ACL->CheckPermissions('lpaths', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($JLMS_DB, $row_path->owner_id)) {
                    $checked = '&nbsp;';
                    $publish_icon = '&nbsp;';
                }
                ?>
					<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
						<td valign="middle" align="center"><?php 
                echo $i_counter + 1;
                ?>
</td>
					<?php 
                if ($JLMS_ACL->CheckPermissions('lpaths', 'manage') || $JLMS_ACL->CheckPermissions('lpaths', 'publish')) {
                    ?>
						<td valign="middle" align="center"><?php 
                    if (!isset($row_path->is_link)) {
                        echo $checked;
                    }
                    ?>
</td>
					<?php 
                }
                ?>
						<td valign="middle" align="center">
							<span style="vertical-align:middle; text-align:center">
								<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 
                if (isset($row_path->is_link) && $row_path->is_link) {
                    echo $row_path->lpath_name;
                } elseif ($is_squeezebox) {
                    $x_size = 0;
                    $y_size = 0;
                    if (isset($row_path->scorm_width)) {
                        $x_size = $row_path->scorm_width;
                        if ($x_size == 100) {
                            //settings from 1.0.6 version (means 100% width)
                            $x_size = 0;
                        }
                    }
                    if (isset($row_path->scorm_height)) {
                        $y_size = $row_path->scorm_height;
                    }
                    ?>
									<a href="<?php 
                    echo sefRelToAbs($link);
                    ?>
" class="scorm_modal" rel="{handler:'iframe', size:{x:<?php 
                    echo $x_size;
                    ?>
,y:<?php 
                    echo $y_size;
                    ?>
}}" title="<?php 
                    echo str_replace('"', '&quot;', $row_path->lpath_name);
                    ?>
">
										<?php 
                    echo $row_path->lpath_name;
                    ?>
									</a>
							<?php 
                } else {
                    ?>
									<a href="<?php 
                    echo sefRelToAbs($link);
                    ?>
" title="<?php 
                    echo str_replace('"', '&quot;', $row_path->lpath_name);
                    ?>
">
										<?php 
                    echo $row_path->lpath_name;
                    ?>
									</a>
							<?php 
                }
                ?>
							
							<?php 
                if ($JLMS_CONFIG->get('show_lpaths_authors', 0)) {
                    ?>
							<br />
							<span class="small"><?php 
                    echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row_path->author_name;
                    ?>
</span>
							<?php 
                }
                ?>
						</td>
					<?php 
                if ($JLMS_ACL->CheckPermissions('lpaths', 'publish')) {
                    ?>
						<td valign="middle">
							<?php 
                    echo $publish_icon;
                    ?>
						</td>
					<?php 
                }
                ?>
					<?php 
                if ($JLMS_ACL->CheckPermissions('lpaths', 'order')) {
                    ?>
						<td valign="middle"><?php 
                    echo JLMS_orderUpIcon($i_counter, $row_path->id, true, 'lpath_orderup');
                    ?>
</td>
						<td valign="middle"><?php 
                    echo JLMS_orderDownIcon($i_counter, $n, $row_path->id, true, 'lpath_orderdown');
                    ?>
</td>
						<td colspan="2">
							<input type="text" name="order[]" size="5" value="<?php 
                    echo $row_path->ordering;
                    ?>
" class="inputbox" style="text-align: center" />
						</td>
					<?php 
                }
                ?>
					<?php 
                if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) {
                    ?>
						<td valign="middle">
						<?php 
                    if ($manage_item && ($row_path->item_id && $row_path->lp_type != 2 || !$row_path->item_id)) {
                        $download_message = _JLMS_LPATH_LINK_TITLE_DOWN_SCORM;
                        if (!$row_path->item_id) {
                            $download_message = _JLMS_LPATH_EXPORT_LP;
                        }
                        ?>
						<a class="jlms_img_link" href="<?php 
                        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=download_scorm&amp;course_id={$course_id}&amp;id={$row_path->id}");
                        ?>
" title="<?php 
                        echo $download_message;
                        ?>
"><img class='JLMS_png' src="<?php 
                        echo $JLMS_CONFIG->get('live_site');
                        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_export.png" border="0" width="16" height="16" alt="<?php 
                        echo $download_message;
                        ?>
" title="<?php 
                        echo $download_message;
                        ?>
" /></a>
						<?php 
                    } else {
                        echo '&nbsp;';
                    }
                    ?>
						</td>
					<?php 
                }
                ?>
					<?php 
                if (!$JLMS_ACL->CheckPermissions('lpaths', 'manage')) {
                    $r_img = 'btn_cancel';
                    $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED;
                    $r_start = '-';
                    $r_end = '-';
                    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;
                            if ($row_path->r_start) {
                                $r_start = JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s');
                            }
                            if ($row_path->r_end) {
                                $r_end = 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';
                            if ($row_path->r_start) {
                                $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 = '-';
                        }
                        if ($row_path->lp_type == 1 || $row_path->lp_type == 2) {
                            if (isset($row_path->r_end) && $row_path->r_end) {
                                $r_end = JLMS_dateToDisplay($row_path->r_end, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s');
                            }
                            if (isset($row_path->r_start) && $row_path->r_start) {
                                $r_start = JLMS_dateToDisplay($row_path->r_start, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s');
                            }
                        }
                    }
                    ?>
						<td valign="middle" align="center" width="16">
							<?php 
                    //Show Status Lapths/Scorms //by Max - 25.02.2011
                    joomla_lms_html::ShowStatusAs($row_path);
                    ?>
	
						</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>
					<?php 
                }
                ?>
						<td valign="middle"><?php 
                echo $row_path->lpath_shortdescription ? $row_path->lpath_shortdescription : '&nbsp;';
                ?>
</td>
					</tr>
					<?php 
                $k = 3 - $k;
                $i_counter++;
            }
            ?>
				</table>
<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        if ($there_were_squeezeboxes) {
            JLMS_initialize_SqueezeBox();
        }
        ?>
				<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
				<input type="hidden" name="task" value="learnpaths" />
				<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="row_id" value="0" />
				<input type="hidden" name="state" value="0" />
				<input type="hidden" name="cid2" value="0" />
			</form>
<?php 
        JLMS_TMPL::CloseTS();
        if ($JLMS_ACL->CheckPermissions('lpaths', 'manage') || $JLMS_ACL->CheckPermissions('lpaths', 'publish')) {
            $link_new = JLMSRoute::_("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=new_lpath&amp;id=" . $course_id);
            $link_new_scorm = JLMSRoute::_("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=new_lpath_scorm&amp;id=" . $course_id);
            $link_new_scormlib = JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_scorm_from_library&amp;id=" . $course_id);
            $controls = array();
            if ($JLMS_ACL->CheckPermissions('lpaths', 'publish')) {
                $controls[] = array('href' => "javascript:submitbutton_change('change_lpath',1);", 'title' => _JLMS_LPATH_SET_PUB, 'img' => 'publish');
                $controls[] = array('href' => "javascript:submitbutton_change('change_lpath',0);", 'title' => _JLMS_LPATH_SET_UNPUB, 'img' => 'unpublish');
                if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) {
                    $controls[] = array('href' => 'spacer');
                }
            }
            if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) {
                $controls[] = array('href' => ampReplace($link_new), 'onclick' => "", 'title' => _JLMS_LPATH_DO_NEW_LP, 'img' => 'add_lpath');
                //TODO: translate 'Import SCORM package'
                $controls[] = array('href' => ampReplace($link_new_scorm), 'onclick' => "", 'title' => _JLMS_LPATH_IMPORT_SCORM, 'img' => 'add_scorm');
                $controls[] = array('href' => $link_new_scormlib, 'title' => _JLMS_SCORM_ADD_A_SCORM_PACKAGE_FROM_THE_LIBRARY, 'img' => 'add_library');
                $controls[] = array('href' => 'spacer');
                $controls[] = array('href' => "javascript:submitbutton('lpath_delete');", 'title' => _JLMS_LPATH_DO_DEL_LP, 'img' => 'delete');
                $controls[] = array('href' => "javascript:submitbutton('edit_lpath');", 'title' => _JLMS_LPATH_DO_EDIT_LP, 'img' => 'edit');
            }
            JLMS_TMPL::ShowControlsFooter($controls);
        }
        JLMS_TMPL::CloseMT();
    }
function JLMS_orderIcon_element($topic_id, $course_id, $task, $alt, $ordering)
{
    global $option, $Itemid, $JLMS_CONFIG;
    $t_id = intval(mosGetParam($_REQUEST, 't_id', 0));
    $link = JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task={$task}&amp;id={$course_id}&amp;topic_id={$topic_id}&amp;element_ordering={$ordering}" . ($t_id ? "&amp;t_id=" . $t_id : ""));
    $ret_str = '';
    $ret_str = '<a class="jlms_img_link" href="' . $link . '" title="' . $alt . '">';
    $img = $task == 'orderdown_element' ? 'btn_downarrow.png' : 'btn_uparrow.png';
    $ret_str .= '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $img . '" width="16" height="16" border="0" alt="' . $alt . '" />';
    $ret_str .= '</a>';
    return $ret_str;
}
    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 
    }
    function showTopicsList($course_id, $topics, $links, $elements, $span = 1)
    {
        global $option, $Itemid, $max_lvl, $JLMS_CONFIG;
        //	echo '<pre>'; var_dump($elements);die;
        $usertype = $JLMS_CONFIG->get('current_usertype', 0);
        $date_format = $JLMS_CONFIG->get('date_format_fdow', 1);
        ?>
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		function topicSubmit ($topic_id, $task) {
			var $form = document.forms['topicForm_'+$topic_id];
			$form.task.value = $task;
			$form.submit();
		}
		function topicDelete ($topic_id) {
			var $form = document.forms['topicForm_'+$topic_id];
			$form.task.value = 'delete_topic';
			$form.submit();
		}
		function topicAdd ($topic_id) {
			var $form = document.forms['topicForm_'+$topic_id];
			$form.task.value = 'add_topic_element';
			$form.submit();
		}
		function topicChange ($topic_id, $def) {
			var $form = document.forms['topicForm_'+$topic_id];
			$form.task.value = 'change_element';
			$form.state.value = $def;
			$form.submit();
		}
		//same for isChecked function but has FORM name param
		function isChecked_mod(isitchecked, $form_name){
			if (isitchecked == true){
				document.forms[$form_name].boxchecked.value++;
			}
			else {
				document.forms[$form_name].boxchecked.value--;
			}
		}
		function checkAll_mod( n, fldName, $form_name ) {
			if (!fldName) {
				fldName = 'cb';
			}
			var f = document.forms[$form_name];
			var c = f.toggle.checked;
			var n2 = 0;
			for (i=0; i < n; i++) {
				cb = eval( 'f.' + fldName + '' + i );
				if (cb) {
					cb.checked = c;
					n2++;
				}
			}
			if (c) {
				document.forms[$form_name].boxchecked.value = n2;
			} else {
				document.forms[$form_name].boxchecked.value = 0;
			}
		}
		//--><!]]>
		</script>
		<?php 
        $topics_count = count($topics);
        foreach ($topics as $topic) {
            $topic_publish = publishUtility($topic->published, -1, $topic->publish_start, $topic->publish_end, $topic->start_date, $topic->end_date);
            ?>
		<div id="topicmain_<?php 
            echo $topic->id;
            ?>
" class="topicmaindiv<?php 
            echo $usertype != 2 && $topic_publish->state == 1 ? 2 : '';
            ?>
">
			<a name="topic_<?php 
            echo $topic->id;
            ?>
"><!--x--></a>
			<?php 
            echo JLMSCSS::h2($topic->name);
            ?>
			
			<div class="contentmain">
				<form name="topicForm_<?php 
            echo $topic->id;
            ?>
" method="post" action="<?php 
            echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
            ?>
">
				<?php 
            if ($topic->publish_start || $topic->publish_end || $topic->description || isset($links[$topic->id]) && count($links[$topic->id])) {
                ?>
				
				<div class="topics">
					
					<?php 
                JLMS_TMPL::OpenMT();
                $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                $_JLMS_PLUGINS->loadBotGroup('system');
                $plugin_args = array();
                $plugin_args[] = $topic->id;
                $_JLMS_PLUGINS->trigger('onAboveTopicDescription', $plugin_args);
                JLMS_TMPL::CloseMT();
                ?>
	
					<?php 
                if ($topic->publish_start || $topic->publish_end) {
                    ?>
					<div class="topic_createdate">
						<?php 
                    //if ($topic->publish_start) echo _JLMS_TOPIC_T_STARTS_ON.date("Y-m-d",strtotime($topic->start_date));
                    //if ($topic->publish_end) echo _JLMS_TOPIC_T_ENDS_ON.date("Y-m-d",strtotime($topic->end_date));
                    // 06.12.2007 - (DEN)
                    if ($topic->publish_start) {
                        echo _JLMS_TOPIC_T_STARTS_ON . ' ' . JLMS_dateToDisplay($topic->start_date) . ($topic->publish_end ? '&nbsp;' : '');
                    }
                    if ($topic->publish_end) {
                        echo _JLMS_TOPIC_T_ENDS_ON . ' ' . JLMS_dateToDisplay($topic->end_date);
                    }
                    ?>
					</div>
					<?php 
                }
                ?>
					<?php 
                if ($topic->description && isset($links[$topic->id]) && count($links[$topic->id])) {
                    ?>
					<div class="topic_description">
						<?php 
                    echo JLMS_ShowText_WithFeatures($topic->description);
                    #echo JLMS_ShowText_WithFeatures('{readmore title="FIRST"}text{readmore}text{/readmore}'); //for test
                    ?>
						<?php 
                    if (isset($links[$topic->id]) && count($links[$topic->id])) {
                        echo '<br />';
                    }
                    ?>
						<div class="topic_elements">
							<?php 
                    echo JLMS_topic_html::showTopicElements($course_id, $topic, $links, $elements, $span);
                    ?>
						</div>
						<?php 
                    global $JLMS_topic_readmore_closeTag, $JLMS_count_begin_tags, $JLMS_count_end_tags;
                    if ($JLMS_topic_readmore_closeTag) {
                        if (isset($JLMS_count_begin_tags) && isset($JLMS_count_end_tags)) {
                            $stop = 0;
                            if ($JLMS_count_begin_tags > $JLMS_count_end_tags) {
                                $stop = $JLMS_count_begin_tags - $JLMS_count_end_tags;
                            }
                            $i = 0;
                            while ($i < $stop) {
                                echo '<div class="clr"><!-- --></div>' . "\n";
                                echo '</div>' . "\n";
                                $i++;
                            }
                        }
                    }
                    ?>
					</div>
					<?php 
                } else {
                    if (!$topic->description && isset($links[$topic->id]) && count($links[$topic->id])) {
                        ?>
						<div class="topic_elements">
							<?php 
                        //echo JLMS_topic_html::showTopicElements($course_id, $topic, $links, $elements, $span=1);
                        echo JLMS_topic_html::showTopicElements($course_id, $topic, $links, $elements, $span);
                        ?>
						</div>
					<?php 
                    } else {
                        if ($topic->description && (!isset($links[$topic->id]) || !count($links[$topic->id]))) {
                            ?>
						<div class="topic_description">
						<?php 
                            echo JLMS_ShowText_WithFeatures($topic->description);
                            ?>
						<?php 
                            if (isset($links[$topic->id]) && count($links[$topic->id])) {
                                echo '<br />';
                            }
                            ?>
						<?php 
                            global $JLMS_topic_readmore_closeTag, $JLMS_count_begin_tags, $JLMS_count_end_tags;
                            if ($JLMS_topic_readmore_closeTag) {
                                if (isset($JLMS_count_begin_tags) && isset($JLMS_count_end_tags)) {
                                    $stop = 0;
                                    if ($JLMS_count_begin_tags > $JLMS_count_end_tags) {
                                        $stop = $JLMS_count_begin_tags - $JLMS_count_end_tags;
                                    }
                                    $i = 0;
                                    while ($i < $stop) {
                                        echo '<div class="clr"><!-- --></div>' . "\n";
                                        echo '</div>' . "\n";
                                        $i++;
                                    }
                                }
                            }
                            ?>
					</div>
					<?php 
                        }
                    }
                }
                ?>
				</div>
				<?php 
            }
            ?>
				<input type="hidden" name="option" value="<?php 
            echo $option;
            ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
            echo $Itemid;
            ?>
" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="id" value="<?php 
            echo $course_id;
            ?>
" />
				<input type="hidden" name="state" value="0" />
				<input type="hidden" name="topic_id" value="<?php 
            echo $topic->id;
            ?>
" />
				<input type="hidden" name="topic_ordering" value="<?php 
            echo $topic->ordering;
            ?>
" />
				<?php 
            $is_curtopic = intval(mosgetparam($_REQUEST, 't_id', 0));
            echo "<input type='hidden' name='t_id' value='" . $is_curtopic . "' />";
            ?>
	
				</form>			
				<?php 
            $controls = array();
            $controls[] = array('href' => "javascript:if(document.topicForm_{$topic->id}.boxchecked.value==0){alert('" . str_replace(' ', '%20', _JLMS_TOPIC_E_NO_ELEMENTS_CHOSEN) . "');}else{topicChange({$topic->id},0);}", 'title' => _JLMS_PUBLISH_ELEMENT, 'img' => 'publish');
            $controls[] = array('href' => "javascript:if(document.topicForm_{$topic->id}.boxchecked.value==0){alert('" . str_replace(' ', '%20', _JLMS_TOPIC_E_NO_ELEMENTS_CHOSEN) . "');}else{topicChange({$topic->id},1);}", 'title' => _JLMS_UNPUBLISH_ELEMENT, 'img' => 'unpublish');
            $controls[] = array('href' => "javascript:if(document.topicForm_{$topic->id}.boxchecked.value==0){alert('" . str_replace(' ', '%20', _JLMS_TOPIC_E_NO_ELEMENTS_CHOSEN) . "');}else{topicSubmit({$topic->id},'delete_topic_element');}", 'title' => _JLMS_DELETE_ELEMENT, 'img' => 'delete');
            $controls[] = array('href' => "javascript:topicAdd({$topic->id});", 'title' => _JLMS_ADD_ELEMENTS, 'img' => 'add');
            $controls[] = array('href' => 'spacer');
            $controls[] = array('href' => 'spacer');
            $publish_options = publishUtility_topic($topic->published, $topic->publish_start, $topic->publish_end, $topic->start_date, $topic->end_date);
            $controls[] = array('href' => JLMSRoute::_("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=publish_topic&amp;state=" . (1 - $publish_options->state) . "&amp;id=" . $course_id . "&amp;topic_id={$topic->id}"), 'title' => $publish_options->state == 1 ? _JLMS_TOPIC_PUBLISHED : _JLMS_TOPIC_UNPUBLISHED, 'img' => $publish_options->state == 1 ? 'publish' : 'unpublish');
            $controls[] = array('href' => "javascript:if(confirm('" . str_replace(' ', '%20', _JLMS_TOPIC_T_CONFIRM_DELETE) . "')){topicDelete({$topic->id});}", 'title' => _JLMS_TOPIC_T_DELETE, 'img' => 'delete');
            global $Itemid, $option;
            $course_id = intval(mosGetParam($_REQUEST, 'id', 0));
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=edit_topic&amp;id={$course_id}&amp;topic_id={$topic->id}"), 'title' => _JLMS_TOPIC_T_EDIT, 'img' => 'edit');
            if ($topic->ordering > 0) {
                $controls[] = array('href' => "javascript:topicSubmit({$topic->id},'orderup_topic')", 'title' => _JLMS_TOPIC_T_MOVEUP, 'img' => 'up');
            }
            if ($topic->ordering < $topics_count - 1) {
                $controls[] = array('href' => "javascript:topicSubmit({$topic->id},'orderdown_topic')", 'title' => _JLMS_TOPIC_T_MOVEDOWN, 'img' => 'down');
            }
            if ($usertype == 2) {
                $controls = array();
            }
            JLMS_TMPL::ShowControlsFooterC($controls);
            ?>
			</div>
		</div>
			<?php 
        }
    }