<?php
$translation        = \DynCom\mysyde\common\classes\Registry::get("translation");
$formname           = "form_line_list";
$inputname          = "input_id";
$input_page_id      = (isset($_REQUEST["input_page_id"]) ? $_REQUEST["input_page_id"] : "");
?>

<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
    <input name="input_id" type="hidden" value="<?= $input_id ?>">
    <input type="hidden" class="selected_linklist_row" name="input_line_id" value="" />
    <input type="hidden" name="input_page_id" value="<?php echo $input_page_id; ?>" />

    
    <h2><?php echo $translation->get("questions"); ?></h2>
    <ul class="toolbar_menu">
        <?= button("new", $translation->get("new"), $formname, "loadCard('new_line_unit', true)", "", FALSE); ?>
        <?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_line_unit')", "", FALSE); ?>
        <?= button("delete", $translation->get("delete"), $formname, "loadCard('delete_line_unit', false, '{$translation->get('delete_unit_field_confirm')}')", "", FALSE); ?>

        <?= button("up", $translation->get("go_up"), $formname, "loadCard('moveup_line_unit')", "", FALSE); ?>
        <?= button("down", $translation->get("go_down"), $formname, "loadCard('movedown_line_unit')", "", FALSE); ?>

    </ul>

    <?
    $query  = "SELECT id, description AS '" . $translation->get("question") . "', question_type AS '" . $translation->get("question_type") . "' FROM learning_unit_question WHERE learning_unit_id = '" . $input_id . "'";
    $format = array('option', 'text', 'text', 'text', 'boolean');
    if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
        linklist($result, $formname, $format, "input_line_id", "edit_line_unit", TRUE, "update_sortorder_unit", "loadCard('delete_line_unit', false, '{$translation->get('delete_unit_field_confirm')}')", TRUE);
    }
    ?>

</form>