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 viewCourses(&$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) {
            //TODO: replace this db query with usage of new lmstitles object
            $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 
        }
        ?>
		<?php 
        if ($JLMS_CONFIG->get('lms_courses_sortby', 0) == 1) {
            ?>
		function submitbutton_order(pressbutton, item_id){
			var form = document.adminForm;
			if ((pressbutton == 'fcourse_orderup') || (pressbutton == 'fcourse_orderdown')){
				if (item_id) {
				form.task.value = pressbutton;
				form.row_id.value = item_id;
				form.submit();
				}
			}
		}
		function cf_saveorder(){
			var form = document.adminForm;	
			form.task.value = 'fcourse_save_order';
					form.submit();
				//submitform('fcourse_save_order');
		}
		<?php 
        }
        ?>
	
		//--><!]]>
		</script>
<?php 
        $style = "\n\t\ttable.jlmslist td.sectiontableheader, table.jlmslist th.sectiontableheader{\n\t\t\twhite-space: nowrap;\n\t\t}";
        $doc =& JFactory::getDocument();
        $doc->addStyleDeclaration($style);
        ?>
		<form action="<?php 
        echo JURI::base() . "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%"');
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        //		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'];
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'];
        }
        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];
                    JLMS_TMPL::CloseTS();
                }
            }
        }
        $controls = array();
        //	if ($usertype == 1) {
        $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');
        }
        $controls[] = array('href' => "javascript:submitbutton('enroll','');", 'title' => _JLMS_ENROLL, 'img' => 'publish');
        JLMS_TMPL::ShowControlsFooter($controls, '', false);
        JLMS_TMPL::OpenTS();
        ?>
		
	 			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
					<tr>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center" width="1%">#</<?php 
        echo $JLMS_CONFIG->get('tableheader_tag', 'td');
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center" width="1%">&nbsp;</<?php 
        echo $JLMS_CONFIG->get('tableheader_tag', 'td');
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="35%" align="left"><?php 
        echo _JLMS_COURSES_TBL_HEAD_NAME;
        ?>
</<?php 
        echo $JLMS_CONFIG->get('tableheader_tag', 'td');
        ?>
>
						
						<?php 
        if (isset($lists['extra_columns']) && count($lists['extra_columns'])) {
            foreach ($lists['extra_columns'] as $column) {
                ?>
								<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="20%" align="left"><?php 
                echo ucfirst($column->name);
                ?>
</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
								<?php 
            }
        }
        ?>
						
						
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="20%" align="left"><?php 
        echo _JLMS_COURSES_COURSES_CAT;
        ?>
</<?php 
        echo $JLMS_CONFIG->get('tableheader_tag', 'td');
        ?>
>
						<?php 
        if (!$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
            if ($show_course_publish_dates) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="6%" align="left" nowrap="nowrap"><?php 
                echo _JLMS_COURSES_ST_DATE;
                ?>
</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="6%" align="left" nowrap="nowrap"><?php 
                echo _JLMS_COURSES_END_DATE;
                ?>
</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
						<?php 
            }
        }
        ?>
						<?php 
        if ($price_fee_type == 1) {
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="4%" align="left" nowrap="nowrap"><?php 
            echo _JLMS_COURSES_FEETYPE;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<?php 
        } else {
            if ($price_fee_type == 2) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="4%" align="left" nowrap="nowrap"><?php 
                echo _JLMS_COURSES_PRICE;
                ?>
</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>							
						<?php 
            }
        }
        if ($JLMS_CONFIG->get('lms_courses_sortby', 0) == 1) {
            if ($JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 colspan="2" width="5%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
">
									<?php 
                echo _JLMS_REORDER;
                ?>
									</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
									<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="2%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
">
									<?php 
                echo _JLMS_ORDER;
                ?>
									</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
									<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="1%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
">
									<a href="javascript:cf_saveorder();"><img src="<?php 
                echo $lms_img_path;
                ?>
/toolbar/tlb_filesave.png" border="0" width="16" height="16" alt="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" title="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" /></a>
									</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
        }
        if ($JLMS_ACL->CheckPermissions('lms', 'create_course')) {
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="40" align="center"><?php 
            echo _JLMS_COURSES_PUBLISHED_COURSE;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="40" align="center"><?php 
            echo _JLMS_COURSES_DELETE_COURSE;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="40" align="center"><?php 
            echo _JLMS_COURSES_EDIT_COURSE;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="30" align="center"><?php 
            echo _JLMS_COURSES_EXPORT;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<?php 
        }
        ?>
					</tr>
				<?php 
        $k = 1;
        $iii = 0;
        $number_of_columns_in_table = 0;
        $show_paid_courses = $JLMS_CONFIG->get('show_paid_courses', 1);
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $number_of_columns_in_table = 0;
            $course_usertype = 0;
            if (in_array($row->id, $JLMS_CONFIG->get('teacher_in_courses', array(0)))) {
                $course_usertype = 1;
            } elseif (in_array($row->id, $JLMS_CONFIG->get('student_in_courses', array(0)))) {
                $course_usertype = 2;
            }
            //$course_usertype = JLMS_GetUserType($my->id, $row->id);
            if (!$show_paid_courses && !$course_usertype && $row->paid) {
                continue;
            }
            $course_descr = strip_tags($row->course_description);
            if (strlen($course_descr) > 100) {
                $course_descr = substr($course_descr, 0, 100) . "...";
            }
            $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=details_course&id=" . $row->id);
            $checked = '';
            if ($course_usertype) {
                $bg = '';
                if ($course_usertype == 1) {
                    $checked = '<img class="JLMS_png" src="' . $lms_img_path . '/toolbar/tlb_courses.png" width="16" height="16" border="0" alt="" title="" />';
                    $pres_icons->my = 1;
                } elseif ($course_usertype == 2) {
                    $checked = '<img class="JLMS_png" src="' . $lms_img_path . '/buttons/btn_complete.png" width="16" height="16" border="0" alt="" title="" />';
                    $pres_icons->already = 1;
                }
            } elseif ($row->self_reg == 0) {
                $checked = "<a href='mailto:" . $row->email . "'><img class='JLMS_png' src=\"" . $lms_img_path . "/dropbox/dropbox_corr.png\" width='16' height='16' border='0' alt='' title='' /></a>";
                $pres_icons->mail = 1;
            } else {
                if ($row->in_wl) {
                    $checked = '<img class="JLMS_png" src="' . $lms_img_path . '/buttons/btn_waiting.png" width="16" height="16" border="0" alt="" title="" />';
                    $pres_icons->wl = 1;
                } else {
                    $can_enroll = JLMS_checkCourseGID($my->id, $row->gid);
                    if ($can_enroll) {
                        $checked = mosHTML::idBox($i, $row->id);
                    } else {
                        $checked = "<a href='mailto:" . $row->email . "'><img class='JLMS_png' src=\"" . $lms_img_path . "/dropbox/dropbox_corr.png\" width='16' height='16' border='0' alt='' title='' /></a>";
                        $pres_icons->mail = 1;
                    }
                }
            }
            ?>
					<?php 
            if ($show_short_description && !$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                ?>
					<tr valign="middle" style="vertical-align:middle" class="<?php 
                echo JLMSCSS::_('sectiontableentry2');
                ?>
">
					<?php 
            } else {
                ?>
					<tr valign="middle" style="vertical-align:middle" class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">					
					<?php 
            }
            $number_of_columns_in_table = $number_of_columns_in_table + 4;
            // index, checkbox, name,category
            ?>
						<td align="center"><?php 
            echo $pageNav->limitstart + $iii + 1;
            ?>
</td>
						<td align="center"><?php 
            echo $checked;
            ?>
</td>
						<td align="left" class="jlms_coursename_cont_td">
							<a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo str_replace('"', '&quot;', $row->course_name);
            ?>
">
								<?php 
            echo $row->course_name;
            ?>
							</a>
							<br />
							<?php 
            if ($show_course_author) {
                ?>
								<span class="small"><?php 
                echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                ?>
</span>
							<?php 
            }
            ?>
							<?php 
            if (isset($row->plugin_course_list_extra_information) && count($row->plugin_course_list_extra_information)) {
                echo '<br />';
                $fields = $row->plugin_course_list_extra_information;
                $c = 1;
                foreach ($fields as $field) {
                    echo '<span class="small">' . $field->name . ': ' . $field->value . '</span>';
                    if ($c < count($fields)) {
                        echo '<br />';
                    }
                    $c++;
                }
            }
            ?>
						</td>
						
						<?php 
            if (isset($lists['extra_columns']) && count($lists['extra_columns'])) {
                foreach ($lists['extra_columns'] as $column) {
                    ?>
								<td align="left">
								<?php 
                    if (isset($row->plugin_course_list_extra_column) && count($row->plugin_course_list_extra_column)) {
                        $fields = $row->plugin_course_list_extra_column;
                        foreach ($fields as $field) {
                            //										echo $field->name.' '.$column->value;
                            //										echo '<br />';
                            if ($column->value == $field->name) {
                                echo $field->value;
                            }
                        }
                    }
                    ?>
								</td>
							<?php 
                }
            }
            ?>
						
						<td align="left"><?php 
            echo $row->c_category ? $row->c_category : '&nbsp;';
            ?>
</td>
						<?php 
            if (!$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                if ($show_course_publish_dates) {
                    $number_of_columns_in_table = $number_of_columns_in_table + 2;
                    ?>
								<td align="center" nowrap="nowrap"><?php 
                    echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '&nbsp;';
                    ?>
</td>
								<td align="center" nowrap="nowrap"><?php 
                    echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '&nbsp;';
                    ?>
</td>
								<?php 
                }
            }
            if ($price_fee_type) {
                if ($price_fee_type == 1) {
                    $number_of_columns_in_table++;
                    ?>
							<td align="center"><?php 
                    echo $row->paid ? _JLMS_COURSES_PAID : _JLMS_COURSES_FREE;
                    ?>
</td>
							<?php 
                } else {
                    if ($price_fee_type == 2) {
                        $number_of_columns_in_table++;
                        ?>
							<td align="center"><?php 
                        echo $row->paid ? $jlms_cs . sprintf('%.2f', round($row->course_price, 2)) : _JLMS_COURSES_FREE;
                        ?>
</td>	
							<?php 
                    }
                }
            }
            if ($JLMS_CONFIG->get('lms_courses_sortby', 0) == 1) {
                if ($JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                    $number_of_columns_in_table = $number_of_columns_in_table + 4;
                    //up, down, number(colspan=2)
                    ?>
								<td>
								<?php 
                    echo JLMS_orderUpIcon($i, $row->id, true, 'fcourse_orderup');
                    ?>
								</td>
								<td>
								<?php 
                    echo JLMS_orderDownIcon($i, $n, $row->id, true, 'fcourse_orderdown');
                    ?>
								</td>
								<td align="center" colspan="2">
								<input type="text" name="order[]" size="5" value="<?php 
                    echo $row->ordering;
                    ?>
" class="text_area" style="text-align: center" />
								<input type="checkbox" name="t_chk[]" value="<?php 
                    echo $row->id;
                    ?>
" style="visibility:hidden; display:none;" checked="checked" />
								</td>
							<?php 
                }
            }
            if ($JLMS_ACL->CheckPermissions('lms', 'create_course')) {
                $number_of_columns_in_table = $number_of_columns_in_table + 4;
                // publish, delete, edit, export
                ?>
			
						<td align="center" valign="middle">
							<?php 
                if ($course_usertype == 1) {
                    $time_p = $row->publish_start || $row->publish_end;
                    $alt = $row->published ? $time_p ? _JLMS_STATUS_PUB : _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                    $image = $row->published ? $time_p ? 'btn_publish_wait.png' : 'btn_accept.png' : 'btn_cancel.png';
                    $add_options = '';
                    $html_txt = '';
                    $html_txt_title = '';
                    if ($time_p) {
                        $html_txt_title = $alt;
                        $is_expired = false;
                        $is_future_course = false;
                        $html_txt = '<table cellpadding=0 cellspacing=0 border=0>';
                        if ($row->publish_start) {
                            $html_txt .= '<tr><td align=left>' . _JLMS_START_DATE . '&nbsp;</td><td align=left>' . $row->start_date . '</td></tr>';
                            $s_date = strtotime($row->start_date);
                            if ($s_date > time()) {
                                $is_future_course = true;
                            }
                        } else {
                            $html_txt .= '<tr><td align=left>' . _JLMS_START_DATE . '&nbsp;</td><td align=left>-</td></tr>';
                        }
                        if ($row->publish_end) {
                            $html_txt .= '<tr><td align=left>' . _JLMS_END_DATE . '&nbsp;</td><td align=left>' . $row->end_date . '</td></tr>';
                            $e_date = strtotime($row->end_date);
                            if ($e_date < time()) {
                                $is_expired = true;
                            }
                        } else {
                            $html_txt .= '<tr><td align=left>' . _JLMS_END_DATE . '&nbsp;</td><td align=left>-</td></tr>';
                        }
                        if ($is_expired) {
                            $alt = _JLMS_STATUS_EXPIRED;
                            $html_txt_title = _JLMS_STATUS_EXPIRED;
                            $image = 'btn_expired.png';
                        } elseif ($is_future_course) {
                            $alt = _JLMS_STATUS_FUTURE_COURSE;
                            if (!$row->published) {
                                $alt .= ' / ' . _JLMS_STATUS_UNPUB;
                            }
                            $html_txt_title = $alt;
                            $image = 'btn_expired.png';
                            if ($JLMS_CONFIG->get('show_future_courses', false) && $is_future_course && $row->published) {
                                $image = 'btn_publish_wait.png';
                            }
                        }
                        $html_txt .= '</table>';
                    }
                    $state = $row->published ? 0 : 1;
                    $plink = JLMSRoute::_("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=change_course&amp;state=" . $state . "&amp;id=" . $row->id);
                    $inside_tag = '<img class="JLMS_png" src="' . $lms_img_path . '/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" title="' . $alt . '" />';
                    echo JLMS_toolTip($html_txt_title, $html_txt, $inside_tag, $plink, 1, 30, true, 'jlms_ttip jlms_img_link');
                    ?>
							<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						<td align="center" valign="middle">
							<?php 
                if ($course_usertype == 1) {
                    ?>
							<a class="jlms_img_link" href="javascript:submitbutton('delete_course',<?php 
                    echo $row->id;
                    ?>
);" title="<?php 
                    echo _JLMS_DELETE;
                    ?>
"><img class="JLMS_png" src="<?php 
                    echo $lms_img_path;
                    ?>
/toolbar/btn_delete.png" width="16" height="16" border="0" alt="<?php 
                    echo _JLMS_DELETE;
                    ?>
" title="<?php 
                    echo _JLMS_DELETE;
                    ?>
" /></a>
							<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						<td align="center" valign="middle">
							<?php 
                if ($course_usertype == 1) {
                    ?>
							<a class="jlms_img_link" href="javascript:submitbutton('edit_course',<?php 
                    echo $row->id;
                    ?>
);" title="<?php 
                    echo _JLMS_EDIT;
                    ?>
"><img class="JLMS_png" src="<?php 
                    echo $lms_img_path;
                    ?>
/toolbar/btn_edit.png" width="16" height="16" border="0" alt="<?php 
                    echo _JLMS_EDIT;
                    ?>
" title="<?php 
                    echo _JLMS_EDIT;
                    ?>
" /></a>
							<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						<td align="center" valign="middle">
							<?php 
                if ($course_usertype == 1) {
                    ?>
							<a class="jlms_img_link" href="javascript:submitbutton('export_course_pre',<?php 
                    echo $row->id;
                    ?>
);" title="<?php 
                    echo _JLMS_EDIT;
                    ?>
"><img class="JLMS_png" src="<?php 
                    echo $lms_img_path;
                    ?>
/toolbar/btn_export.png" width="16" height="16" border="0" alt="<?php 
                    echo _JLMS_COURSES_EXPORT;
                    ?>
" title="<?php 
                    echo _JLMS_COURSES_EXPORT;
                    ?>
" /></a>
							<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						<?php 
            }
            ?>
					</tr>
					<?php 
            if (!$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                if ($show_short_description) {
                    if (strlen($row->course_sh_description)) {
                        ?>
						<tr class="<?php 
                        echo JLMSCSS::_('sectiontableentry1');
                        ?>
">
							<td>&nbsp;</td>
							<td colspan="<?php 
                        echo $number_of_columns_in_table ? $number_of_columns_in_table - 1 : $colspan_sh_description;
                        ?>
" style="text-align: justify;">
								<?php 
                        echo $row->course_sh_description;
                        ?>
							</td>
						</tr>
						<?php 
                    }
                }
            }
            ?>
					<?php 
            $k = 3 - $k;
            $iii++;
        }
        ?>
				<?php 
        if ($pageNav->isMultiPages()) {
            ?>
					<tr>
						<?php 
            if ($JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                $colspan_sh_description = $colspan_sh_description + 7;
            }
            ?>
						<td class="<?php 
            echo JLMSCSS::_('jlmslist-footer_td');
            ?>
" colspan="<?php 
            echo $number_of_columns_in_table ? $number_of_columns_in_table : $colspan_sh_description + 1;
            ?>
" align="center">
							<div align="center" style="text-align:center">
							<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
            echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . ' ' . $pageNav->getPagesCounter();
            ?>
							</div>
							<br />
							<div align="center" style="text-align:center">
							<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
            echo $pageNav->writePagesLinks($link);
            ?>
							</div>
						</td>
					</tr>
				<?php 
        }
        ?>
				</table>
				
	<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::ShowControlsFooter($controls);
        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 showCourseLPath($course_id, $lpath_id, &$lpath, &$conds, $option)
    {
        global $Itemid, $JLMS_CONFIG;
        ?>

<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;

	// do field validation
	if (((pressbutton == 'lpath_item_delete') || (pressbutton == 'lpath_item_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 == 'lpath_item_orderup') || (pressbutton == 'lpath_item_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
/*
Ordering (Max)
*/
function checkAll_button( n ) {
	for ( var j = 0; j <= n; j++ ) {
		box = eval( "document.adminForm.cb" + j );
		if ( box ) {
			if ( box.checked == false ) {
				box.checked = true;
			}
		} else {
			alert("You cannot change the order of items, as an item in the list is `Checked Out`");
			return;
		}
	}
	submitform('lpath_item_saveorder');
}
var TreeArray1 = new Array();
var TreeArray2 = new Array();
var Is_ex_Array = new Array();
<?php 
        $i = 1;
        foreach ($lpath as $lpath_row) {
            echo "TreeArray1[" . $i . "] = " . $lpath_row->parent_id . ";";
            echo "TreeArray2[" . $i . "] = " . $lpath_row->id . ";";
            echo "Is_ex_Array[" . $i . "] = 1;" . "\n";
            $i++;
        }
        ?>
function Hide_Folder(fid) {
	var vis_style = 'hidden';var dis_style = 'none';var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			Hide_Folder(TreeArray2[i]); }
		i++; }
}
function Show_Folder(fid) {
	var vis_style = 'visible';var dis_style = '';var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			NoChange_Folder(TreeArray2[i]); }
		i++; }
}
function NoChange_Folder(fid) {
	var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) {
			vis_style = 'visible';dis_style = '';j = 1; }
		i++; }
	i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			if (j == 1) { NoChange_Folder(TreeArray2[i]);
			} else { Hide_Folder(TreeArray2[i]); } }
		i++; }
}

function Ex_Folder(fid) {
	var i = 1;var j = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; } i ++; }
	if (j == 1) {
		Show_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('chapter_expand.png','chapter_collapse.png').replace('<?php 
        echo _JLMS_LPATH_EXP_CHAP;
        ?>
', '<?php 
        echo _JLMS_LPATH_COLL_CHAP;
        ?>
');
			StStr = StStr.replace('chapter_expand.png','chapter_collapse.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_LPATH_COLLAPSE;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_LPATH_COLL_CHAP;
        ?>
';
		}
	} else {
		Hide_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('chapter_collapse.png','chapter_expand.png').replace('<?php 
        echo _JLMS_LPATH_COLL_CHAP;
        ?>
', '<?php 
        echo _JLMS_LPATH_EXP_CHAP;
        ?>
');
			StStr = StStr.replace('chapter_collapse.png','chapter_expand.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/learnpath/chapter_expand.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_LPATH_EXPAND;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_LPATH_EXP_CHAP;
        ?>
';
		}
	}
	i = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) ) {
			if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0; } else { Is_ex_Array[i] = 1; } }
		i++; }
}
JLMS_preloadImages('<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/learnpath/chapter_expand.png','<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png');
//-->
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('lpath', _JLMS_LPATH_TITLE_LP, $hparams);
        $max_tree_width = 0;
        if (isset($lpath[0])) {
            $max_tree_width = $lpath[0]->tree_max_width;
        }
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid;
        ?>
" method="post" name="adminForm">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
			<tr>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="<?php 
        echo 16 * ($max_tree_width + 1);
        ?>
" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="<?php 
        echo $max_tree_width + 1;
        ?>
">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="30%"><?php 
        echo _JLMS_LPATH_TBL_HEAD_NAME_LP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="2" width="1"><?php 
        echo _JLMS_REORDER;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="1"><?php 
        echo _JLMS_ORDER;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="1">
					<a class="jlms_img_link" href="javascript:checkAll_button(<?php 
        echo count($lpath) - 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 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="2" width="1">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="60%"><?php 
        echo _JLMS_LPATH_TBL_HEAD_DESCR_LP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
			</tr>
		<?php 
        $k = 1;
        $tree_modes = array();
        for ($i = 0, $n = count($lpath); $i < $n; $i++) {
            $row_path = $lpath[$i];
            $max_tree_width = $row_path->tree_max_width;
            $link = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=details_course&amp;id=" . $row_path->id;
            //ne zabyt' sefRelToAbs
            $checked = mosHTML::idBox($i, $row_path->id);
            ?>
			
			<tr id="tree_row_<?php 
            echo $row_path->id;
            ?>
" class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
				<td align="center" valign="middle"><?php 
            echo $i + 1;
            ?>
</td>
				<td valign="middle"><?php 
            if (!isset($row_path->is_link)) {
                echo $checked;
            }
            ?>
</td>
				<?php 
            $add_img = '';
            if ($row_path->tree_mode_num) {
                $g = 0;
                $tree_modes[$row_path->tree_mode_num - 1] = $row_path->tree_mode;
                while ($g < $row_path->tree_mode_num - 1) {
                    $pref = '';
                    if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                        $pref = 'empty_';
                    }
                    $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='line' border='0' /></td>";
                    $g++;
                }
                $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row_path->tree_mode . ".png\" width='16' height='16' border='0' alt='sub' /></td>";
                $max_tree_width = $max_tree_width - $g - 1;
            }
            echo $add_img;
            ?>
				<td valign="middle" align="center" width="16"><div align="center" style="vertical-align:middle;"><?php 
            switch ($row_path->step_type) {
                case 1:
                    echo "<span id='tree_div_" . $row_path->id . "' style='text-align:center; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row_path->id . "," . $row_path->id . ",true)'><img id='tree_img_" . $row_path->id . "' class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png\" width='16' height='16' border='0' alt='chapter' /></span>";
                    break;
                case 2:
                    if (isset($row_path->folder_flag) && $row_path->folder_flag == 2) {
                        echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/file_zippack.png\" width='16' height='16' border='0' alt='zip package' /></span>";
                    } else {
                        echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_path->file_icon . ".png\" width='16' height='16' border='0' alt='file' /></span>";
                    }
                    break;
                case 3:
                    echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/link_world.png\" width='16' height='16' border='0' alt='link' /></span>";
                    break;
                case 4:
                    echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/file_content.png\" width='16' height='16' border='0' alt='content' /></span>";
                    break;
                case 5:
                    echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/tlb_quiz.png\" width='16' height='16' border='0' alt='quiz' /></span>";
                    break;
                case 6:
                    echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/tlb_scorm.png\" width='16' height='16' border='0' alt='scorm' /></span>";
                    break;
            }
            ?>
				</div>
				</td>
				<td width="30%" align="left" valign="middle" <?php 
            if ($max_tree_width > 0) {
                echo "colspan='" . ($max_tree_width + 1) . "'";
            }
            ?>
>
					<?php 
            if ($row_path->step_type == 1) {
                echo "<strong>" . $row_path->doc_name . "</strong>";
            } elseif ($row_path->step_type == 2) {
                if ($row_path->folder_flag == 2 && $row_path->file_id) {
                    $link_download = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_zip&amp;course_id=" . $course_id . "&amp;id=" . $row_path->item_id);
                    echo '<a target="_blank" href="' . $link_download . '" title="' . _JLMS_T_A_VIEW_ZIP_PACK . '">' . $row_path->doc_name . '</a>';
                } elseif ((!$row_path->folder_flag || $row_path->folder_flag == 3) && !$row_path->file_id) {
                    if (!isset($row_path->is_link)) {
                        $link_download = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_content&amp;course_id=" . $course_id . "&amp;id=" . $row_path->item_id);
                        echo '<a target="_blank" href="' . $link_download . '" title="' . _JLMS_T_A_VIEW_CONTENT . '">' . $row_path->doc_name . '</a>';
                    } else {
                        echo $row_path->doc_name;
                    }
                } else {
                    if (!isset($row_path->is_link)) {
                        $link_download = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_document&amp;course_id=" . $course_id . "&amp;id=" . $row_path->item_id . "&amp;lpath_id=" . $lpath_id);
                        echo '<a href="' . $link_download . '" title="' . _JLMS_T_A_DOWNLOAD . '">' . $row_path->doc_name . '</a>';
                    } else {
                        echo $row_path->doc_name;
                    }
                }
            } elseif ($row_path->step_type == 3) {
                echo '<a target="_blank" href="' . $row_path->link_href . '" title="' . _JLMS_T_A_VIEW_LINK . '">' . $row_path->doc_name . '</a>';
            } elseif ($row_path->step_type == 4) {
                echo '<a href="' . sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=show_lp_content&amp;course_id=" . $course_id . "&amp;lpath_id=" . $row_path->lpath_id . "&amp;id=" . $row_path->id) . '" title="' . _JLMS_T_A_VIEW_CONTENT . '">' . $row_path->doc_name . '</a>';
            } else {
                echo $row_path->doc_name;
            }
            ?>
				</td>
				<td valign="middle" style="vertical-align:middle;"><?php 
            if ($row_path->allow_up == 1) {
                echo JLMS_orderUpIcon(1, $row_path->id, true, 'lpath_item_orderup');
            } else {
                echo '&nbsp;';
            }
            ?>
</td>
				<td valign="middle" style="vertical-align:middle;"><?php 
            if ($row_path->allow_down == 1) {
                echo JLMS_orderDownIcon(1, 3, $row_path->id, true, 'lpath_item_orderdown');
            } else {
                echo '&nbsp;';
            }
            ?>
</td>
				<td valign="middle" style="vertical-align:middle;" colspan="2">
					<?php 
            //					if ($row_path->step_type != 1) {
            ?>
						<input type="text" name="order[]" size="5" value="<?php 
            echo $row_path->ordering;
            ?>
" class="inputbox" style="text-align: center" />
					<?php 
            //					}
            ?>
				</td>
				<td valign="middle" style="vertical-align:middle ">
					<?php 
            if ($row_path->step_type == 1) {
                ?>
						<a class="jlms_img_link" href="<?php 
                echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=add_lpath_step&amp;course_id=" . $row_path->course_id . "&amp;id=" . $row_path->lpath_id . "&amp;parent=" . $row_path->id;
                ?>
" title="<?php 
                echo _JLMS_LPATH_LINK_ADDSTEP_TITLE;
                ?>
"><img class="JLMS_png" src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/btn_add.png" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_LPATH_LINK_ADDSTEP_TITLE;
                ?>
" title="<?php 
                echo _JLMS_LPATH_LINK_ADDSTEP_TITLE;
                ?>
" /></a>
					<?php 
            } else {
                echo '&nbsp;';
            }
            ?>
				</td>
				<td valign="middle" style="vertical-align:middle ">
					<?php 
            $cond_link = sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=lpath_step_cond&amp;course_id={$course_id}&amp;lpath_id={$lpath_id}&amp;id={$row_path->id}");
            $cond_descr = _JLMS_LPATH_FLWINDOW_NOCOND;
            $cond_title = _JLMS_LPATH_TITLE_FLWINDOW;
            $cond_img = 'btn_warning';
            if ($row_path->is_condition) {
                $cond_img = 'btn_cond_present';
                $y = 0;
                $is_cond_descr = false;
                $cond_descr = '<table cellpadding=0 cellspacing=0 border=0>';
                while ($y < count($conds)) {
                    if ($conds[$y]->step_id == $row_path->id) {
                        $ref_name = '';
                        $u = 0;
                        while ($u < count($lpath)) {
                            if ($lpath[$u]->id == $conds[$y]->ref_step) {
                                $ref_name = $lpath[$u]->step_name;
                                break;
                            }
                            $u++;
                        }
                        if (isset($conds[$y]->cond_time) && $conds[$y]->cond_time) {
                            $ref_name .= ' (' . _JLMS_LPATH_CONDTYPE_SPENT . ' ' . $conds[$y]->cond_time . ' ' . _JLMS_LPATH_CONDTYPE_TIME_SPENT_MIN . ')';
                        }
                        $cond_descr .= '<tr><td>' . _JLMS_LPATH_CONDTYPE_COMPLETE_W . '&nbsp;</td><td>' . $ref_name . '</td></tr>';
                        $is_cond_descr = true;
                    }
                    $y++;
                }
                $cond_descr .= '</table>';
                if (!$is_cond_descr) {
                    $cond_descr = _JLMS_LPATH_FLWINDOW_NOCOND;
                }
            }
            $img_inside_tag = '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $cond_img . '.png" width="16" height="16" border="0" alt="cond" />';
            echo JLMS_toolTip($cond_title, JLMS_txt2overlib($cond_descr), $img_inside_tag, $cond_link);
            ?>
				</td>
				<td width="60%" valign="middle" style="vertical-align:middle; "><?php 
            echo strlen($row_path->step_shortdescription) ? $row_path->step_shortdescription : '&nbsp;';
            ?>
</td>
			</tr>
			<?php 
            $k = 3 - $k;
        }
        ?>
		</table>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="lpath_add_chapter" />
			<input type="hidden" name="id" value="<?php 
        echo $lpath_id;
        ?>
" />
			<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="row_id" value="0" />
			<input type="hidden" name="boxchecked" value="0" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        $link_new = ampReplace(sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=new_lpath_chapter&amp;id=" . $lpath_id . "&amp;course_id=" . $course_id));
        $controls = array();
        //$controls[] = array('href' => $link_new, 'onclick' => "", 'title' => _JLMS_LPATH_LINK_NEW_CHAP, 'img' => 'add');
        $controls[] = array('href' => "javascript:submitbutton('add_lpath_step');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_ADDSTEP_TITLE, 'img' => 'add');
        $controls[] = array('href' => "javascript:submitbutton('lpath_item_delete');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_DEL_ITEM, 'img' => 'delete');
        $controls[] = array('href' => "javascript:submitbutton('lpath_item_edit');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_EDIT_ITEM, 'img' => 'edit');
        //$controls[] = array('href' => "spacer");
        JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=learnpaths&amp;id=" . $course_id));
        JLMS_TMPL::CloseMT();
    }
    function JQ_editQuest_Pool_GQP($row, $lists, $option, $page, $course_id, $q_om_type, $qtype_str, $rows, $pageNav, $levels)
    {
        global $Itemid;
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			
			if (pressbutton == 'cancel_quest') {
				form.page.value = pressbutton;
				form.submit();
			}
			if (pressbutton == 'preview_quest') {
					if (form.c_id.value == '0') {
						alert("<?php 
        echo _JLMS_QUIZ_SAVE_QUEST_FIRST;
        ?>
");
					} else {
						window.open('index.php?option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
&task=quizzes&id=<?php 
        echo $course_id;
        ?>
&page=view_preview&c_id=<?php 
        echo $row->c_id;
        ?>
');
						return;
					}
			}		
			if (pressbutton == 'save_quest') {
			// do field validation
				if (form.boxchecked.value == 0){
					alert( "<?php 
        echo _JLMS_QUIZ_SELECT_QUESTIONS;
        ?>
" );
				} 
				else {
					form.page.value = pressbutton;
					form.submit();
				}
			}
		}
		function jlms_jq_isChecked(isitchecked){
			if (isitchecked == true){
				document.adminForm.boxchecked.value++;
			}
			else {
				document.adminForm.boxchecked.value = document.adminForm.boxchecked.value - 1;
			}
		}
		function checkAllQ( n, fldName ) {
			if (!fldName) {
				fldName = 'cb';
			}
			var f = document.adminForm;
			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.adminForm.boxchecked.value = n2;
			} else {
				document.adminForm.boxchecked.value = 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['level_id_'+i] != null){
					old_filters[i] = form['level_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['level_id_'+i] != null && form['level_id_'+i].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['level_id_'+i] != null){
						form['level_id_'+i].value = 0;	
					}
				}
			}
		}
		//-->
		</script>	
		
		<?php 
        //FLMS multicat
        $multicat = array();
        $i = 0;
        foreach ($lists as $key => $item) {
            if (substr($key, 0, 6) == 'level_') {
                $multicat[] = $lists['level_' . $i];
                $i++;
            }
        }
        $toolbar = JLMS_quiz_admin_html_class::GetQuestEdit_Toolbar(0, false, true);
        $h = $row->c_id ? _JLMS_QUIZ_QUEST_EDIT_TITLE : _JLMS_QUIZ_QUEST_NEW_TITLE;
        JLMS_quiz_admin_html_class::showQuizHead($course_id, $option, $h, true, $toolbar);
        ?>
		
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
				<table width="100%" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td width="20%" valign="middle" ><?php 
        echo _JLMS_QUIZ_QUEST_QUIZ;
        ?>
</td><td><?php 
        echo $lists['quiz'];
        ?>
</td>
					</tr>
					
					<tr>
						<td  valign="middle" >
							<?php 
        echo _JLMS_QUIZ_TBL_QUEST_PUBLISH;
        ?>
:
						</td>
						<td>
							<?php 
        echo $lists['published'];
        ?>
						</td>
					</tr>
						
					<tr>
						<td colspan="2" class="contentheading">
						<?php 
        echo _JLMS_QUIZ_SELECT_QUEST_FROM_POOL;
        ?>
						</td>
					</tr>
				</table>
				<table width="100%" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td>
							<?php 
        $link_page = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$course_id}&amp;page=add_quest&amp;c_type=21";
        $link_page .= $lists['qtype_id'] ? "&amp;qtype_id=" . $lists['qtype_id'] : '';
        $i = 0;
        $data = get_object_vars($lists['data']);
        foreach ($data as $key => $value) {
            if (substr($key, 0, 6) == 'level_' && $value) {
                $link_page .= "&amp;level_id_" . $i . "=" . $value;
                $i++;
            }
        }
        echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link_page) . $pageNav->getPagesCounter();
        echo '<br />';
        echo $lists['qtype'];
        ?>
		
						</td>	
						<td align="right">						
							<table border="0">
							<?php 
        for ($i = 0; $i < count($multicat); $i++) {
            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['level_' . $i] . "";
            JLMS_TMPL::CloseTS();
        }
        ?>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="2">							
						
							<table width="100%" cellpadding="0" cellspacing="0" border="0">
									<tr>
										<td width="20" class="sectiontableheader" align="center">#</td>
										<td width="20" class="sectiontableheader" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAllQ(<?php 
        echo count($rows);
        ?>
);" /></td>
										<td class="sectiontableheader"><?php 
        echo _JLMS_QUIZ_TBL_QUEST_TEXT;
        ?>
</td>
								<?php 
        if (isset($lists['filtered_quiz']) && $lists['filtered_quiz']) {
            ?>
										<td class="sectiontableheader" width="1%"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_PUBLISH;
            ?>
</td>
										<td class="sectiontableheader" colspan="2" width="1%"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_REORDER;
            ?>
</td>
										<td class="sectiontableheader" width="1%"><?php 
            echo 'Order';
            ?>
</td>
										<td class="sectiontableheader" width="1%"><a href="javascript:submitbutton_allorder(<?php 
            echo count($rows) - 1;
            ?>
)"><img width="16" height="16" border="0" alt="Save Order" src="<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/filesave.png"/></a></td>
								<?php 
        }
        ?>
										<td class="sectiontableheader"><?php 
        echo _JLMS_QUIZ_TBL_QUEST_TYPE;
        ?>
</td>
										<td class="sectiontableheader"><?php 
        echo _JLMS_QUIZ_TBL_Q_CAT;
        ?>
</td>
										<td class="sectiontableheader" width="20">ID</td>
									</tr>
								<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $quiz_task = 'setup_quest';
            $img_published = $row->published ? 'btn_accept.png' : 'btn_cancel.png';
            $task_published = $row->published ? 'unpublish_quest' : 'publish_quest';
            $alt_published = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
            $state = $row->published ? 0 : 1;
            $checked = '<input type="checkbox" id="cb' . $i . '" name="cid[]" value="' . $row->c_id . '" onclick="jlms_jq_isChecked(this.checked);" />';
            /*mosHTML::idBox( $i, $row->c_id);*/
            ?>
									<tr class="<?php 
            echo "sectiontableentry{$k}";
            ?>
">
										<td align="center"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
										<td><?php 
            echo $checked;
            ?>
</td>
										<td align="left">
											<?php 
            mosMakeHtmlSafe($row->c_question);
            ?>
											<?php 
            //											$link = 'index.php?option='.$option.'&task=quizzes&page=editA_quest_gqp&c_id='.$row->c_id; //not use
            if (isset($row->right_answer) && $row->right_answer) {
                if ($row->c_question) {
                    $quest_desc = $row->c_question . '<br />';
                }
                $quest_desc .= '<span class="tip-title-inner">' . _JLMS_QUIZ_CORRECT_ANSWER . '</span> ' . $row->right_answer;
            } else {
                $quest_desc = $row->c_question;
            }
            //$quest_desc = isset($row->right_answer) && $row->right_answer ? (_JLMS_QUIZ_CORRECT_ANSWER . ' ' . $row->right_answer) : $row->c_question;
            $link = '#';
            echo JLMS_toolTip(substr(strip_tags($row->c_question), 0, 70), $quest_desc, '', $link);
            ?>
										</td>
								<?php 
            if (isset($lists['filtered_quiz']) && $lists['filtered_quiz']) {
                ?>
										<td valign="middle" align="center"><?php 
                echo JLMS_quiz_admin_html_class::QuizPublishIcon($row->c_id, $id, $state, $task_published, $alt_published, $img_published, $option);
                ?>
</td>
										<td valign="middle" align="center"><?php 
                echo JLMS_orderUpIcon($i, $row->c_id, true, 'quest_orderup');
                ?>
</td>
										<td valign="middle" align="center"><?php 
                echo JLMS_orderDownIcon($i, $n, $row->c_id, true, 'quest_orderdown');
                ?>
</td>
										<td colspan="2">
											<input type="text" name="order[]" size="5" value="<?php 
                echo $row->ordering;
                ?>
" class="inputbox" style="text-align: center" />
										</td>
								<?php 
            }
            ?>
										<td align="left">
											<?php 
            echo $row->qtype_full;
            ?>
										</td>
										<td align="left">
											<?php 
            echo $row->c_category ? $row->c_category : '&nbsp;';
            ?>
										</td>
										<td><?php 
            echo $row->c_id;
            ?>
</td>
									</tr>
									<?php 
            $k = 3 - $k;
        }
        ?>
								</table>
								<table width="100%">
									<tr>
										<td align="center"><div align="center">
										<?php 
        echo $pageNav->writePagesLinks($link_page);
        ?>
 
										</div>
										</td>
									</tr>
								</table>						
						
						</td>
					</tr>
					</table>
				<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
				<input type="hidden" name="task" value="quizzes" />
				<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
				<input type="hidden" name="page" value="editA_quest_gqp" />
				<input type="hidden" name="c_type" value="<?php 
        echo $q_om_type;
        ?>
" />
				<input type="hidden" name="boxchecked" value="0" />
		</form>
		<?php 
        JLMS_quiz_admin_html_class::showQuizFooter();
        ?>
		<?php 
    }
    function showCourseDocuments($id, $option, &$rows, &$lists, &$possibilities)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $db =& JFactory::getDbo();
        $user = JLMSFactory::getUser();
        $JLMS_ACL =& JLMSFactory::getACL();
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        $rows_c = $lists['collapsed_folders'];
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'doc_delete') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else if((pressbutton == 'doc_delete')){
		if(confirm('<?php 
        echo _JLMS_OUTDOCS_JS_CONFIRM_DELETE;
        ?>
')){
			form.task.value = pressbutton;
			form.submit();
		}	
	} else if ((pressbutton == 'edit_doc') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_doc'){
		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_doc'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
function submitbutton_order(pressbutton, item_id) {
	var form = document.adminForm;
	if ((pressbutton == 'doc_orderup') || (pressbutton == 'doc_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
function cf_saveorder(){
	var form = document.adminForm;	
	form.task.value = 'doc_saveorder';
	form.submit();
}

var TreeArray1 = new Array();
var TreeArray2 = new Array();
var Is_ex_Array = new Array();
<?php 
        $i = 1;
        foreach ($rows as $row) {
            if ($row->p_view) {
                echo "TreeArray1[" . $i . "] = " . $row->parent_id . ";";
                echo "TreeArray2[" . $i . "] = " . $row->id . ";";
                if (in_array($row->id, $rows_c)) {
                    echo "Is_ex_Array[" . $i . "] = 0;";
                } else {
                    echo "Is_ex_Array[" . $i . "] = 1;";
                }
                $i++;
            }
        }
        ?>
function Hide_Folder(fid) {
	var vis_style = 'hidden';
	var dis_style = 'none';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			Hide_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function Show_Folder(fid) {
	var vis_style = 'visible';
	var dis_style = '';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			if (getObj('tree_row_'+TreeArray2[i])) {
				getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
				getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			}
			NoChange_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function NoChange_Folder(fid) {
	var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) {
			vis_style = 'visible';
			dis_style = '';
			j = 1;
		}
		i ++;
	}
	i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			if (j == 1) { NoChange_Folder(TreeArray2[i]);
			} else { Hide_Folder(TreeArray2[i]); }
		}
		i ++;
	}
}
function Ex_Folder(fid) {
	var i = 1;
	var j = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; }
		i ++;
	}
	if (j == 1) {
		Show_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('expandall.png','collapseall.png').replace('<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
');
			StStr = StStr.replace('expandall.png','collapseall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/collapseall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_COLLAPSE;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
';
		}
	} else {
		Hide_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('collapseall.png','expandall.png').replace('<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
');
			StStr = StStr.replace('collapseall.png','expandall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/expandall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_EXPAND;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
';
		}
	}
	i = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) ) {
			if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0;
			} else { Is_ex_Array[i] = 1; }
		}
		i ++;
	}
}
<?php 
        if ($possibilities->manage && count($rows)) {
            ?>
var docs_save_blocked = false;
function Docs_WriteSysMsg(mes) {
	if (jlms_writetxt('joomlalms_sys_message', mes)) {
		getObj('joomlalms_sys_message_container').style.display = '';
		getObj('joomlalms_sys_message_container').style.visibility = 'visible';
	}
}
function Docs_save_view() {
	if (!docs_save_blocked) {
		var prepare_str = '';
		Docs_WriteSysMsg("<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' />");
		i = 1;
		var ps_pref = '';
		while (i < TreeArray2.length) {
			if (Is_ex_Array[i] == 0) {
				prepare_str = ''+ prepare_str + ps_pref + TreeArray2[i];
				ps_pref = '-';
			}
			i ++;
		}
		Docs_MakeRequest(prepare_str);
	}
}
function Docs_analize_req(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var mes = response.getElementsByTagName('message')[0].firstChild.data
		} else {
			var mes = "Request failed";
		}
		Docs_WriteSysMsg(mes);
		docs_save_blocked = false;
	}
}

function Docs_MakeRequest(req_str) {
	docs_save_blocked = true;
	var http_request = false;
	if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	} else if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { Docs_analize_req(http_request); };
	var lp_url_prefix2 = '';
	var post_target = '<?php 
            echo $JLMS_CONFIG->get('ajax_settings_request_safe_path');
            ?>
';
	var url = 'task=documents_view_save&id=<?php 
            echo $id;
            ?>
&folders='+req_str;
	http_request.open("POST", post_target, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", url.length);
	//http_request.setRequestHeader("Connection", "close");
	http_request.send(url);
}
<?php 
        }
        ?>
JLMS_preloadImages('<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/expandall.png','<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/collapseall.png'<?php 
        echo ", '" . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator') . "'";
        ?>
);
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        if ($JLMS_ACL->CheckPermissions('docs', 'manage') && count($rows)) {
            // this feature is available only for users who has 'documents' manage permission (for entire tool)
            $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:Docs_save_view();", 'btn_title' => _JLMS_DOCS_SAVE_VIEW_TITLE);
        }
        JLMS_TMPL::ShowHeader('docs', _JLMS_DOCS_COURSE_DOCS, $hparams, $toolbar);
        $max_tree_width = 0;
        if (isset($rows[0])) {
            $max_tree_width = $rows[0]->tree_max_width;
        }
        JLMS_TMPL::OpenTS();
        ?>
			<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid;
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">
<?php 
        if (!empty($rows)) {
            ?>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" id="jlms_doc_non_scr" 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 ($possibilities->manage || $possibilities->publish) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="20" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
"><input type="checkbox" value="0" name="fake_checkbox" style="visibility:hidden" /></<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
					<?php 
            for ($th_i = 0; $th_i < $max_tree_width + 1; $th_i++) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="16" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
">&nbsp;</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="45%"><span style="display:block; width:150px; text-align:left;"><?php 
            echo _JLMS_DOCS_TBL_DOCNAME;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            if ($possibilities->order) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" colspan="2" width="1">
						<?php 
                echo JText::_(_JLMS_REORDER);
                ?>
						</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">
							<?php 
                echo _JLMS_ORDER;
                ?>
						</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">
						<a href="javascript:saveorder(<?php 
                echo count($rows) - 1;
                ?>
, 'doc_saveorder');">
							<img src="<?php 
                echo $lms_img_path;
                ?>
/toolbar/tlb_filesave.png" border="0" width="16" height="16" alt="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" title="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" />
						</a>
						</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
					<?php 
            if ($possibilities->manage || $possibilities->publish) {
                ?>
						<<?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');
                ?>
"><?php 
                echo _JLMS_DOCS_TBL_STARTING;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
"><?php 
                echo _JLMS_DOCS_TBL_ENDING;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="60%"><span style="display:block; width:110px;"><?php 
            echo _JLMS_DOCS_TBL_DESCR;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            $k = 1;
            $tree_modes = array();
            $visible_folder = true;
            //$next_row_is_visible = true;
            $vis_mode = 0;
            $doc_number = 1;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $row = $rows[$i];
                if ($row->p_view) {
                    // if user can view this item
                    $max_tree_width = $row->tree_max_width;
                    $link = '';
                    $link_title = '';
                    if ($row->folder_flag == 2) {
                        $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_zip&amp;course_id=" . $id . "&amp;id=" . $row->id);
                        $link_title = _JLMS_T_A_VIEW_ZIP_PACK;
                    } elseif ((!$row->folder_flag || $row->folder_flag == 3) && $row->file_id) {
                        $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_document&amp;course_id=" . $id . "&amp;id=" . $row->id);
                        $link_title = _JLMS_DOCS_LINK_DOWNLOAD;
                    } elseif ((!$row->folder_flag || $row->folder_flag == 3) && !$row->file_id) {
                        $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_content&amp;course_id=" . $id . "&amp;id=" . $row->id);
                        $link_title = _JLMS_T_A_VIEW_CONTENT;
                    }
                    $time_p = $row->publish_start || $row->publish_end;
                    $alt = $row->published ? $time_p ? _JLMS_STATUS_PUB2 : _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                    $image = $row->published ? $time_p ? 'btn_publish_wait.png' : 'btn_accept.png' : 'btn_cancel.png';
                    //($time_p?'btn_unpublish_wait.png':'btn_cancel.png');
                    $start_date_txt = '';
                    $end_date_txt = '';
                    $released_info_txt = '';
                    if ($row->is_time_related) {
                        $released_info_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;
                        $released_info_time = false;
                        if ($sp_days) {
                            $released_info_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS;
                            $released_info_time = true;
                        }
                        if ($sp_hours) {
                            $released_info_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS;
                            $released_info_time = true;
                        }
                        if ($sp_mins) {
                            $released_info_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES;
                            $released_info_time = true;
                        }
                        if ($released_info_time) {
                            $released_info_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT;
                        }
                    }
                    if ($time_p) {
                        $is_expired = false;
                        if ($row->publish_end) {
                            $end_date_txt = _JLMS_COURSES_END_DATE . ': ' . $row->end_date;
                            $e_date = strtotime($row->end_date);
                            if ($e_date < time()) {
                                $is_expired = true;
                            }
                        }
                        if ($row->publish_start) {
                            $start_date_txt = _JLMS_COURSES_ST_DATE . ': ' . $row->start_date;
                        }
                        if ($is_expired) {
                            $alt = _JLMS_STATUS_EXPIRED;
                            $image = 'btn_expired.png';
                        } elseif ($row->publish_start && !$is_expired) {
                            $s_date = strtotime($row->start_date);
                            if ($s_date > time()) {
                                $alt = _JLMS_STATUS_UPCOMING;
                                $image = 'btn_expired.png';
                            }
                        }
                    }
                    $state = $row->published ? 0 : 1;
                    $checked = mosHTML::idBox($i, $row->id);
                    $manage_item = false;
                    $publish_item = false;
                    if ($row->p_manage) {
                        //JLMS_ACL->CheckPermissions('docs', 'manage')) {
                        $manage_item = true;
                    }
                    if ($row->p_publish) {
                        //$JLMS_ACL->CheckPermissions('docs', 'publish')) {
                        $publish_item = true;
                    }
                    if ($JLMS_ACL->CheckPermissions('docs', 'only_own_items') && $row->owner_id != $user->get('id')) {
                        $manage_item = false;
                        $publish_item = false;
                    } elseif ($JLMS_ACL->CheckPermissions('docs', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($db, $row->owner_id)) {
                        $manage_item = false;
                        $publish_item = false;
                    }
                    if (!$publish_item && !$manage_item) {
                        $checked = '&nbsp;';
                    }
                    // Collapsed/Expanded view
                    $tree_row_style = '';
                    $visible_folder = true;
                    //$next_row_is_visible;
                    //$next_row_is_visible = true;
                    if ($vis_mode) {
                        if ($row->tree_mode_num < $vis_mode) {
                            $vis_mode = 0;
                        }
                    }
                    if (in_array($row->id, $rows_c)) {
                        //$next_row_is_visible = false;
                        if ($vis_mode) {
                            if ($row->tree_mode_num < $vis_mode) {
                                $vis_mode = $row->tree_mode_num;
                            } else {
                                $visible_folder = false;
                            }
                        } else {
                            $vis_mode = $row->tree_mode_num + 1;
                        }
                    } elseif ($vis_mode) {
                        if ($row->tree_mode_num >= $vis_mode) {
                            $visible_folder = false;
                        } else {
                            $vis_mode = 0;
                        }
                    }
                    if (!$visible_folder) {
                        $tree_row_style = ' style="visibility:hidden;display:none"';
                    }
                    ?>
					<tr id="tree_row_<?php 
                    echo $row->id;
                    ?>
" class="<?php 
                    echo JLMSCSS::_('sectiontableentry' . $k);
                    ?>
"<?php 
                    echo $tree_row_style;
                    ?>
>
						<td align="center" valign="middle"><?php 
                    echo $doc_number;
                    ?>
</td>
					<?php 
                    if ($possibilities->manage || $possibilities->publish) {
                        ?>
						<td valign="middle"><?php 
                        echo $row->p_manage || $row->p_publish ? $checked : '<input type="checkbox" value="0" name="fake_checkbox' . $row->id . '" style="visibility:hidden" />';
                        ?>
</td>
					<?php 
                    }
                    ?>
						<?php 
                    $add_img = '';
                    if ($row->tree_mode_num) {
                        $g = 0;
                        $tree_modes[$row->tree_mode_num - 1] = $row->tree_mode;
                        while ($g < $row->tree_mode_num - 1) {
                            $pref = '';
                            if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                                $pref = 'empty_';
                            }
                            $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='" . $pref . "line' /></td>";
                            $g++;
                        }
                        $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row->tree_mode . ".png\" width='16' height='16' alt='sub" . $row->tree_mode . "' /></td>";
                        $max_tree_width = $max_tree_width - $g - 1;
                    }
                    echo $add_img;
                    ?>
						<td align="center" valign="middle" width='16'>
						<?php 
                    if ($row->folder_flag == 1) {
                        $collapse_img = 'collapseall.png';
                        $collapse_alt = _JLMS_DOCS_COLL_FOLDER;
                        if (in_array($row->id, $rows_c)) {
                            $collapse_img = 'expandall.png';
                            $collapse_alt = _JLMS_DOCS_EXP_FOLDER;
                        }
                        echo "<a class='jlms_img_link' id='tree_div_" . $row->id . "' style='alignment:center; width:16px; font-weight:bold; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row->id . "," . $row->id . ",true)' href='javascript:void(0);'><img class='JLMS_png' id='tree_img_" . $row->id . "' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/docs/{$collapse_img}\" width='13' height='13' border='0' alt='" . $collapse_alt . "' title='" . $collapse_alt . "' /></a>";
                    } else {
                        echo "<span style='alignment:center; width:16px; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row->file_icon . ".png\" width='16' height='16' alt='{$row->file_icon}' /></span>";
                    }
                    ?>
						</td>
						<td align="left" valign="middle" <?php 
                    if ($max_tree_width > 0) {
                        echo "colspan='" . ($max_tree_width + 1) . "'";
                    }
                    ?>
 width="<?php 
                    echo $row->tree_mode_num == $row->tree_max_width ? '85' : '45';
                    ?>
%">
						<span style='font-weight:bold; vertical-align:middle;'>
						<?php 
                    if ($row->folder_flag == 1) {
                        echo '&nbsp;<strong>' . $row->doc_name . '</strong>';
                    } else {
                        if (!isset($row->is_link)) {
                            ?>
							<a href="<?php 
                            echo $link;
                            ?>
" title="<?php 
                            echo str_replace('"', '&quot;', $row->doc_name);
                            ?>
">
								&nbsp;<?php 
                            echo $row->doc_name;
                            ?>
							</a>
						<?php 
                        } else {
                            echo $row->doc_name;
                        }
                    }
                    ?>
						</span>
						<?php 
                    if ($JLMS_CONFIG->get('show_docs_authors', 0) && $row->author_name) {
                        ?>
						<br />
						<span class="small"><?php 
                        echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->author_name;
                        ?>
</span>
						<?php 
                    }
                    ?>
						</td>
					<?php 
                    if ($possibilities->order) {
                        ?>
						<td valign="middle" style="vertical-align:middle "><?php 
                        if ($row->allow_up == 1 && $row->p_order) {
                            echo JLMS_orderUpIcon(1, $row->id, true, 'doc_orderup');
                        } else {
                            echo '&nbsp;';
                        }
                        ?>
</td>
						<td valign="middle" style="vertical-align:middle "><?php 
                        if ($row->allow_down == 1 && $row->p_order) {
                            echo JLMS_orderDownIcon(1, 3, $row->id, true, 'doc_orderdown');
                        } else {
                            echo '&nbsp;';
                        }
                        ?>
</td>
						<td valign="middle" align="center" style="vertical-align:middle; text-align: center; " colspan="2">
							<input type="text" name="order[]" size="5" value="<?php 
                        echo $row->ordering;
                        ?>
" class="inputbox" style="text-align: center;" />
						</td>
					<?php 
                    }
                    ?>
					<?php 
                    if ($possibilities->manage || $possibilities->publish) {
                        ?>
						<td valign="middle">
						<?php 
                        if ($publish_item) {
                            $title = $alt;
                            $content = '';
                            if ($start_date_txt) {
                                $content .= $start_date_txt . '<br />';
                            }
                            if ($end_date_txt) {
                                $content .= $end_date_txt . '<br />';
                            }
                            if ($released_info_txt) {
                                $content .= $released_info_txt . '<br />';
                            }
                            if ($row->is_time_related) {
                                if ($image == 'btn_accept.png') {
                                    $image = 'btn_publish_wait.png';
                                }
                            }
                            $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 . '" />';
                            $link = 'javascript:submitbutton_change2(\'change_doc\',' . $state . ',' . $row->id . ')';
                            echo JLMS_toolTip($title, $content, $name, $link);
                        } else {
                            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 . '" />';
                        }
                        ?>
						</td>
						<td align="center" nowrap='nowrap' valign="middle"><?php 
                        echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-';
                        ?>
</td>
						<td align="center" nowrap='nowrap' valign="middle"><?php 
                        echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-';
                        ?>
</td>
					<?php 
                    }
                    ?>
						<td><?php 
                    $doc_descr = strip_tags($row->doc_description);
                    $doc_descr = trim($doc_descr);
                    if (!$row->folder_flag && !$row->file_id) {
                        if (strlen($doc_descr) > 75) {
                            $doc_descr = substr($doc_descr, 0, 75) . "...";
                        }
                    }
                    echo $doc_descr ? $doc_descr : '&nbsp;';
                    ?>
						</td>
					</tr>
					<?php 
                    $k = 3 - $k;
                    $doc_number++;
                }
                // end "if ($row->p_view)"
            }
            ?>
				</table>
<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
				<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
				<input type="hidden" name="task" value="" />
				<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>
			<noscript>
			<style type="text/css">
			 #jlms_doc_non_scr tr.sectiontableentry1, #jlms_doc_non_scr tr.sectiontableentry2 {
			 display: table-row !important;
			 visibility:visible !important;
			 }
			</style>
			<!--[if IE]>
			<style type="text/css">
			 #jlms_doc_non_scr tr.sectiontableentry1, #jlms_doc_non_scr tr.sectiontableentry2 {
				 display: block !important;
				 visibility:visible !important;
			 }
			</style>
			<![endif]-->
			</noscript>
<?php 
        JLMS_TMPL::CloseTS();
        $controls = array();
        if ($possibilities->publish) {
            $controls[] = array('href' => "javascript:submitbutton_change('change_doc',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish');
            $controls[] = array('href' => "javascript:submitbutton_change('change_doc',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish');
            if ($possibilities->manage) {
                $controls[] = array('href' => 'spacer');
            }
        }
        if ($possibilities->create) {
            $link_foldernew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_folder&amp;id={$id}"));
            $link_filenew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_document&amp;id={$id}"));
            $controls[] = array('href' => $link_foldernew, 'title' => _JLMS_DOCS_LNK_NEW_FOLDER, 'img' => 'foldernew');
            $controls[] = array('href' => $link_filenew, 'title' => _JLMS_DOCS_LNK_NEW_DOC, 'img' => 'filenew');
        }
        if ($possibilities->manage) {
            $controls[] = array('href' => "javascript:submitbutton('doc_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete');
            $controls[] = array('href' => "javascript:submitbutton('edit_doc');", 'title' => _JLMS_EDIT, 'img' => 'edit');
        }
        if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
            $controls[] = array('href' => "javascript:submitbutton('add_doclink');", 'title' => _JLMS_DOCS_ADD_FROM_LIBRARY, 'img' => 'add_library');
        }
        if (count($controls)) {
            JLMS_TMPL::ShowControlsFooter($controls);
        }
        JLMS_TMPL::CloseMT();
    }
    function showCourseDocuments($option, &$rows, &$lists, $is_teacher)
    {
        global $Itemid, $my, $JLMS_CONFIG;
        $JLMS_ACL =& JLMSFactory::getACL();
        $is_teacher = $JLMS_ACL->isTeacher();
        $can_do_everything = $JLMS_ACL->CheckPermissions('library', 'only_own_items') ? false : ($is_teacher ? true : false);
        $rows_c = $lists['collapsed_folders'];
        ?>
		
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'outdoc_delete') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else if((pressbutton == 'outdoc_delete')){
		if(confirm('<?php 
        echo _JLMS_OUTDOCS_JS_CONFIRM_DELETE;
        ?>
')){
			form.task.value = pressbutton;
			form.submit();
		}
	} else if ((pressbutton == 'edit_outdoc') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_outdoc'){
		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_outdoc'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
function submitbutton_order(pressbutton, item_id) {
	var form = document.adminForm;
	if ((pressbutton == 'outdoc_orderup') || (pressbutton == 'outdoc_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}

var TreeArray1 = new Array();
var TreeArray2 = new Array();
var Is_ex_Array = new Array();
<?php 
        $i = 1;
        foreach ($rows as $row) {
            echo "TreeArray1[" . $i . "] = " . $row->parent_id . ";";
            echo "TreeArray2[" . $i . "] = " . $row->id . ";";
            if (in_array($row->id, $rows_c)) {
                echo "Is_ex_Array[" . $i . "] = 0;";
            } else {
                echo "Is_ex_Array[" . $i . "] = 1;";
            }
            $i++;
        }
        ?>
function Hide_Folder(fid) {
	var vis_style = 'hidden';
	var dis_style = 'none';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			Hide_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function Show_Folder(fid) {
	var vis_style = 'visible';
	var dis_style = '';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			if (getObj('tree_row_'+TreeArray2[i])) {
				getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
				getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			}
			NoChange_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function NoChange_Folder(fid) {
	var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) {
			vis_style = 'visible';
			dis_style = '';
			j = 1;
		}
		i ++;
	}
	i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			if (j == 1) { NoChange_Folder(TreeArray2[i]);
			} else { Hide_Folder(TreeArray2[i]); }
		}
		i ++;
	}
}
function Ex_Folder(fid) {
	var i = 1;
	var j = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; }
		i ++;
	}
	if (j == 1) {
		Show_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('expandall.png','collapseall.png').replace('<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
');
			StStr = StStr.replace('expandall.png','collapseall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/collapseall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_COLLAPSE;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
';
		}
	} else {
		Hide_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('collapseall.png','expandall.png').replace('<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
');
			StStr = StStr.replace('collapseall.png','expandall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/expandall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_EXPAND;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
';
		}
	}
	i = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) ) {
			if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0;
			} else { Is_ex_Array[i] = 1; }
		}
		i ++;
	}
}
JLMS_preloadImages('<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/expandall.png','<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/collapseall.png'<?php 
        if ($is_teacher) {
            echo ", '" . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator') . "'";
        }
        ?>
);
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array('show_menu' => true, 'simple_menu' => true);
        $toolbar = array();
        JLMS_TMPL::ShowHeader('outdocs', _JLMS_TOOLBAR_LIBRARY, $hparams, $toolbar);
        $max_tree_width = 0;
        if (isset($rows[0])) {
            $max_tree_width = $rows[0]->tree_max_width;
        }
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        $is_teacher = $JLMS_ACL->isTeacher();
        ?>
			<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid;
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">
<?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 JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><input type="checkbox" style="visibility:hidden;" /></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            //}
            ?>
						<?php 
            for ($th_i = 0; $th_i < $max_tree_width + 1; $th_i++) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="1%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
"><span style="display: block; width: 16px;">&nbsp;</span></<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="45%"><span style="display: block; width: 150px; text-align: left;"><?php 
            echo _JLMS_DOCS_TBL_DOCNAME;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="2">&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');
            ?>
"><?php 
            echo _JLMS_DOCS_TBL_STARTING;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_DOCS_TBL_ENDING;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            //}
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="60%"><?php 
            echo _JLMS_DOCS_TBL_DESCR;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            $k = 1;
            $tree_modes = array();
            $visible_folder = true;
            //$next_row_is_visible = true;
            $vis_mode = 0;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $row = $rows[$i];
                $max_tree_width = $row->tree_max_width;
                $link = '';
                $link_title = '';
                if ($row->folder_flag == 2) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_zip&amp;id=" . $row->id);
                    $link_title = _JLMS_T_A_VIEW_ZIP_PACK;
                } elseif (!$row->folder_flag && $row->file_id) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_outdoc&amp;id=" . $row->id);
                    $link_title = _JLMS_DOCS_LINK_DOWNLOAD;
                } elseif (!$row->folder_flag && !$row->file_id) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=outdocs_view_content&amp;id=" . $row->id);
                    $link_title = _JLMS_T_A_VIEW_CONTENT;
                } elseif ($row->folder_flag == 3 && $row->file_id) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=playerSCORMFiles&amp;id=" . $row->file_id . "&amp;doc_id=" . $row->id);
                    $link_title = _JLMS_T_A_VIEW_CONTENT;
                }
                $time_p = $row->publish_start || $row->publish_end;
                $alt = $row->published ? $time_p ? _JLMS_STATUS_PUB2 : _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                $image = $row->published ? $time_p ? 'btn_publish_wait.png' : 'btn_accept.png' : 'btn_cancel.png';
                //($time_p?'btn_unpublish_wait.png':'btn_cancel.png');
                if ($time_p) {
                    $is_expired = false;
                    if ($row->publish_start) {
                        $s_date = strtotime($row->start_date);
                        if ($s_date > time()) {
                            $is_expired = true;
                        }
                    }
                    if ($row->publish_end && !$is_expired) {
                        $e_date = strtotime($row->end_date);
                        if ($e_date < time()) {
                            $is_expired = true;
                        }
                    }
                    if ($is_expired) {
                        $alt = _JLMS_STATUS_EXPIRED;
                        $image = 'btn_expired.png';
                    }
                }
                $state = $row->published ? 0 : 1;
                $checked = mosHTML::idBox($i, $row->id);
                // Collapsed/Expanded view
                $tree_row_style = '';
                $visible_folder = true;
                //$next_row_is_visible;
                //$next_row_is_visible = true;
                if ($vis_mode) {
                    if ($row->tree_mode_num < $vis_mode) {
                        $vis_mode = 0;
                    }
                }
                if (in_array($row->id, $rows_c)) {
                    //$next_row_is_visible = false;
                    if ($vis_mode) {
                        if ($row->tree_mode_num < $vis_mode) {
                            $vis_mode = $row->tree_mode_num;
                        } else {
                            $visible_folder = false;
                        }
                    } else {
                        $vis_mode = $row->tree_mode_num + 1;
                    }
                } elseif ($vis_mode) {
                    if ($row->tree_mode_num >= $vis_mode) {
                        $visible_folder = false;
                    } else {
                        $vis_mode = 0;
                    }
                }
                if (!$visible_folder) {
                    $tree_row_style = ' style="visibility:hidden;display:none"';
                }
                ?>
					<tr id="tree_row_<?php 
                echo $row->id;
                ?>
" class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
"<?php 
                echo $tree_row_style;
                ?>
>
						<td align="center" valign="middle"><?php 
                echo $i + 1;
                ?>
</td>
					
						<td valign="middle"><?php 
                if ($my->id == $row->owner_id || $can_do_everything) {
                    echo $checked;
                }
                ?>
</td>
					
						<?php 
                $add_img = '';
                if ($row->tree_mode_num) {
                    $g = 0;
                    $tree_modes[$row->tree_mode_num - 1] = $row->tree_mode;
                    while ($g < $row->tree_mode_num - 1) {
                        $pref = '';
                        if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                            $pref = 'empty_';
                        }
                        $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='" . $pref . "line' /></td>";
                        $g++;
                    }
                    $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row->tree_mode . ".png\" width='16' height='16' alt='sub" . $row->tree_mode . "' /></td>";
                    $max_tree_width = $max_tree_width - $g - 1;
                }
                echo $add_img;
                ?>
						<td align="center" valign="middle" width='16'>
						<?php 
                if ($row->folder_flag == 1) {
                    $collapse_img = 'collapseall.png';
                    $collapse_alt = _JLMS_DOCS_COLL_FOLDER;
                    if (in_array($row->id, $rows_c)) {
                        $collapse_img = 'expandall.png';
                        $collapse_alt = _JLMS_DOCS_EXP_FOLDER;
                    }
                    echo "<span id='tree_div_" . $row->id . "' style='alignment:center; width:16px; font-weight:bold; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row->id . "," . $row->id . ",true)'><img class='JLMS_png' id='tree_img_" . $row->id . "' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/docs/{$collapse_img}\" width='13' height='13' alt='" . $collapse_alt . "' title='" . $collapse_alt . "' /></span>";
                } else {
                    echo "<span style='alignment:center; width:16px; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row->file_icon . ".png\" width='16' height='16' alt='{$row->file_icon}' /></span>";
                }
                ?>
						</td>
						<td align="left" valign="middle" <?php 
                if ($max_tree_width > 0) {
                    echo "colspan='" . ($max_tree_width + 1) . "'";
                }
                ?>
 width="45%">
						<span style='font-weight:bold; vertical-align:middle;'>
						<?php 
                if ($row->folder_flag == 1) {
                    echo '&nbsp;<strong>' . $row->doc_name . '</strong>';
                } else {
                    ?>
							<?php 
                    if ($is_teacher && $row->outdoc_share || !$is_teacher && $row->outdoc_share == 2 || $my->id == $row->owner_id || $can_do_everything) {
                        $add_link_params = '';
                        if ($row->folder_flag == 3 && isset($row->scorm_params) && $row->scorm_params) {
                            $tmp_params = new JLMSParameters($row->scorm_params);
                            if ($tmp_params->get('scorm_layout', 0) == 1) {
                                $x_size = 0;
                                $y_size = 0;
                                if (isset($row->scorm_width) && $row->scorm_width > 100) {
                                    $x_size = $row->scorm_width;
                                }
                                if (isset($row->scorm_height) && $row->scorm_height > 100) {
                                    $y_size = $row->scorm_height;
                                }
                                $add_link_params = ' class="scorm_modal" rel="{handler:\'iframe\', size:{x:' . $x_size . ',y:' . $y_size . '}}"';
                                JLMS_initialize_SqueezeBox();
                            }
                        }
                        if ($link) {
                            ?>
							<a href="<?php 
                            echo $link;
                            ?>
"<?php 
                            echo $add_link_params;
                            ?>
 title="<?php 
                            echo str_replace('"', '&quot;', $row->doc_name);
                            ?>
">
<?php 
                        }
                        ?>
							<?php 
                    }
                    ?>
								&nbsp;<?php 
                    echo $row->doc_name;
                    ?>
								<?php 
                    if ($is_teacher && $row->outdoc_share || !$is_teacher && $row->outdoc_share == 2 || $my->id == $row->owner_id || $can_do_everything) {
                        if ($link) {
                            ?>
							</a>
<?php 
                        }
                        ?>
						<?php 
                    }
                }
                ?>
						</span>
						<?php 
                if ($JLMS_CONFIG->get('show_library_authors', 0) && $row->author_name) {
                    ?>
						<br />
						<span class="small"><?php 
                    echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->author_name;
                    ?>
</span>
						<?php 
                }
                ?>

						</td>
					<?php 
                //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
                ?>
						<td valign="middle" style="vertical-align:middle "><?php 
                if ($row->allow_up == 1 && ($my->id == $row->owner_id || $can_do_everything)) {
                    echo JLMS_orderUpIcon(1, $row->id, true, 'outdoc_orderup');
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
						<td valign="middle" style="vertical-align:middle "><?php 
                if ($row->allow_down == 1 && ($my->id == $row->owner_id || $can_do_everything)) {
                    echo JLMS_orderDownIcon(1, 3, $row->id, true, 'outdoc_orderdown');
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
						<td valign="middle">
							<?php 
                if ($my->id == $row->owner_id || $can_do_everything) {
                    echo '<a class="jlms_img_link" href="javascript:submitbutton_change2(\'change_outdoc\',' . $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>';
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						
						<td align="center" nowrap='nowrap' valign="middle"><?php 
                echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-';
                ?>
</td>
						<td align="center" nowrap='nowrap' valign="middle"><?php 
                echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-';
                ?>
</td>
					<?php 
                //}
                ?>
						<td><?php 
                $doc_descr = strip_tags($row->doc_description);
                if (!$row->folder_flag && !$row->file_id) {
                    if (strlen($doc_descr) > 75) {
                        $doc_descr = substr($doc_descr, 0, 75) . "...";
                    }
                }
                echo $doc_descr ? $doc_descr : '&nbsp;';
                ?>
						</td>
					</tr>
					<?php 
                $k = 3 - $k;
            }
            ?>
				</table>
<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
				<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
				<input type="hidden" name="task" value="" />
				<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('docs', 'manage')) {
        if ($is_teacher) {
            $link_foldernew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_outfolder"));
            $link_filenew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_outdocs"));
            $link_scormnew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_scorm"));
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton_change('change_outdoc',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish');
            $controls[] = array('href' => "javascript:submitbutton_change('change_outdoc',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish');
            $controls[] = array('href' => 'spacer');
            $controls[] = array('href' => $link_foldernew, 'title' => _JLMS_DOCS_LNK_NEW_FOLDER, 'img' => 'foldernew');
            $controls[] = array('href' => $link_filenew, 'title' => _JLMS_DOCS_LNK_NEW_DOC, 'img' => 'filenew');
            $controls[] = array('href' => "javascript:submitbutton('outdoc_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete');
            $controls[] = array('href' => "javascript:submitbutton('edit_outdoc');", 'title' => _JLMS_EDIT, 'img' => 'edit');
            $controls[] = array('href' => $link_scormnew, 'title' => _JLMS_DOCS_NEW_SCORM_PACKAGE, 'img' => 'add_scorm');
            JLMS_TMPL::ShowControlsFooter($controls);
            //}
        }
        JLMS_TMPL::CloseMT();
    }
    function showGBItems($course_id, $option, &$rows)
    {
        global $Itemid, $my;
        ?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ( ((pressbutton == 'gbi_edit') || (pressbutton == 'gbi_delete') ) && (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 == 'gbi_orderup') || (pressbutton == 'gbi_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
//-->
</script>

<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gradebook&amp;id={$course_id}"));
        JLMS_TMPL::ShowHeader('gradebook', _JLMS_GBI_TITLE, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
				<tr>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" /></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_GBI_TBL_HEAD_NAME;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_GBI_TBL_HEAD_CAT;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<?php 
        /*<td class="sectiontableheader"><?php echo _JLMS_GBI_TBL_HEAD_POINTS;?></td>*/
        ?>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="2" width="1">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_GBI_TBL_HEAD_DESCR;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				</tr>
			<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $title = _JLMS_GB_EDIT_ITEM;
            $link = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=gbi_editA&amp;course_id=" . $course_id . "&amp;id=" . $row->id;
            // sefRelToAbs() - est' nige
            $checked = mosHTML::idBox($i, $row->id);
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td valign="middle" align="center"><?php 
            echo $i + 1;
            ?>
</td>
					<td valign="middle"><?php 
            echo $checked;
            ?>
</td>
					<td valign="middle" align="left">
						<a href="<?php 
            echo sefRelToAbs($link);
            ?>
" title="<?php 
            echo $title;
            ?>
">
							<?php 
            echo $row->gbi_name;
            ?>
						</a>
					</td>
					<td valign="middle"><?php 
            echo $row->gb_category;
            ?>
</td>
					<?php 
            /*<td valign="middle"><?php echo $row->gbi_points;?></td>*/
            ?>
					<td valign="middle"><?php 
            echo JLMS_orderUpIcon($i, $row->id, true, 'gbi_orderup');
            ?>
</td>
					<td valign="middle"><?php 
            echo JLMS_orderDownIcon($i, $n, $row->id, true, 'gbi_orderdown');
            ?>
</td>
					<td valign="middle"><?php 
            echo $row->gbi_description ? $row->gbi_description : '&nbsp;';
            ?>
</td>
				</tr>
				<?php 
            $k = 3 - $k;
        }
        ?>
			</table>

			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="gb_items" />
			<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" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->CheckPermissions('gradebook', 'manage')) {
            $controls = array();
            $link_new = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=gbi_new&amp;id=" . $course_id;
            $controls[] = array('href' => sefRelToAbs($link_new), 'title' => _JLMS_GB_NEW_ITEM, 'img' => 'add');
            $controls[] = array('href' => "javascript:submitbutton('gbi_delete')", 'title' => _JLMS_GB_DEL_ITEM, 'img' => 'delete');
            $controls[] = array('href' => "javascript:submitbutton('gbi_edit');", 'title' => _JLMS_GB_EDIT_ITEM, 'img' => 'edit');
            JLMS_TMPL::ShowControlsFooter($controls);
        }
        JLMS_TMPL::CloseMT();
    }