function showElementsList($course_id, $topic_id, $elements, $linked_elements)
    {
        global $Itemid, $option, $max_lvl, $JLMS_CONFIG;
        $max_lvl = 1;
        //work out chapters... TODO
        //work out documents
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $title = '';
        $title = _JLMS_TOPIC_T_LINK_ELEMENT;
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('add_submit_topic_element');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('details_course');");
        JLMS_TMPL::ShowHeader('doc', $title, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<form name="adminForm" method="post" action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid;
        ?>
">
		<table border="0" cellpadding="0" cellspacing="0" width="100%" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
		<?php 
        $k = 2;
        //documents section
        $element_group = $elements[_DOCUMENT_ID];
        $i = 0;
        $is_any_elements = 0;
        if (!empty($element_group)) {
            foreach ($element_group as $element) {
                if (@in_array($element->id, $linked_elements[_DOCUMENT_ID])) {
                    continue;
                }
                if ($i == 0) {
                    ?>
				<tr>
					<td colspan="7"><?php 
                    echo JLMSCSS::h2(_JLMS_TOPIC_E_DOCUMENTS);
                    ?>
</td>
				</tr>	
				<?php 
                }
                $tmp = _DOCUMENT_ID . '_' . $element->id;
                $checked = '<input type="checkbox" id="doc_cb' . $i . '" name="cid[]" value="' . $tmp . '" onclick="isChecked(this.checked);" />';
                JLMS_topic_html::showDocumentRow($k, $element, $i, 0, $checked, _ROW_RO, 0, 1, 0);
                $i++;
            }
        }
        $is_any_elements = $is_any_elements + $i;
        //links section
        $element_group = $elements[_LINK_ID];
        $i = 0;
        if (!empty($element_group)) {
            foreach ($element_group as $element) {
                if (@in_array($element->id, $linked_elements[_LINK_ID])) {
                    continue;
                }
                if ($i == 0) {
                    ?>
				<tr>
					<td colspan="7"><?php 
                    echo JLMSCSS::h2(_JLMS_TOPIC_E_LINKS);
                    ?>
</td>
				</tr>	
				<?php 
                }
                $tmp = _LINK_ID . '_' . $element->id;
                $checked = '<input type="checkbox" id="link_cb' . $i . '" name="cid[]" value="' . $tmp . '" onclick="isChecked(this.checked);" />';
                JLMS_topic_html::showLinkRow($k, $element, $i, 0, $checked, _ROW_RO);
                $i++;
            }
        }
        $is_any_elements = $is_any_elements + $i;
        //quizs section
        $element_group = $elements[_QUIZ_ID];
        $i = 0;
        if (!empty($element_group)) {
            foreach ($element_group as $element) {
                if (@in_array($element->id, $linked_elements[_QUIZ_ID])) {
                    continue;
                }
                if ($i == 0) {
                    ?>
				<tr>
					<td colspan="7"><?php 
                    echo JLMSCSS::h2(_JLMS_TOPIC_E_QUIZZES);
                    ?>
</td>
				</tr>	
				<?php 
                }
                $tmp = _QUIZ_ID . '_' . $element->id;
                $checked = '<input type="checkbox" id="quiz_cb' . $i . '" name="cid[]" value="' . $tmp . '" onclick="isChecked(this.checked);" />';
                JLMS_topic_html::showQuizRow($k, $element, $i, 0, $checked, _ROW_RO);
                $i++;
            }
        }
        $is_any_elements = $is_any_elements + $i;
        //Lpaths section
        $element_group = isset($elements[_LPATH_ID]) ? $elements[_LPATH_ID] : array();
        $i = 0;
        if (!empty($element_group)) {
            foreach ($element_group as $element) {
                if (@in_array($element->id, $linked_elements[_LPATH_ID])) {
                    continue;
                }
                if ($i == 0) {
                    ?>
				<tr>
					<td colspan="7"><?php 
                    echo JLMSCSS::h2(_JLMS_TOPIC_E_LPATHS);
                    ?>
</td>
				</tr>	
				<?php 
                }
                $tmp = _LPATH_ID . '_' . $element->id;
                $checked = '<input type="checkbox" id="lpath_cb' . $i . '" name="cid[]" value="' . $tmp . '" onclick="isChecked(this.checked);" />';
                JLMS_topic_html::showLPathRow($k, $element, $i, 0, $checked, _ROW_RO);
                $i++;
            }
        }
        $is_any_elements = $is_any_elements + $i;
        if (!$is_any_elements) {
            ?>
				<tr>
					<td colspan="7"><?php 
            echo '<div class="joomlalms_user_message">' . _JLMS_TOPICS_NO_ELEMENTS . '</div>';
            ?>
</td>
				</tr>	
		<?php 
        }
        ?>
		</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="add_submit_topic_element" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="topic_id" value="<?php 
        echo $topic_id;
        ?>
" />
		<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
		<?php 
        $is_curtopic = intval(mosgetparam($_REQUEST, 't_id', 0));
        echo "<input type='hidden' name='t_id' value='" . $is_curtopic . "' />";
        ?>
		</form>
		<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }