<? 
$formname        = "form_learning_card";
$main_layout_id     = $GLOBALS["language"]["main_layout_id"];
$learning_id = $input_learning["id"];
$translation        = \DynCom\mysyde\common\classes\Registry::get("translation");
?>

<div id="overlaycrumb">
    <?php if ($input_learning["id"] == "") {
        echo $translation->get("new_menuitem_headline");
    } else {
        echo $translation->get("edit_menuitem");
    }
    ?>
    <div id="closeoverlay" onclick="disableOverlay();"></div>
</div>

<ul class="toolbar_menu">
    <?= button("save", $translation->get("save"), $formname, "loadCard('save_learning', true)"); ?>
    <?= button("save", $translation->get("save_and_close"), $formname, "loadCard('save_learning', true, '', true)"); ?>
    <li>
        <ul>
            <?= button("delete", $translation->get("delete"), $formname, "loadCard('delete_learning', true, '{$translation->get('delete_navitem_confirm')}', true)", "", FALSE); ?>
        </ul>
    </li>
</ul>


<?php
if ($messages !== null) {
    if (count($messages)) {
            echo '<div id="overlayMessages">' . join("\r\n", $messages) . '</div>';
    } 
  }
?>

<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
    <input name="input_learning_id" type="hidden" value="<?= $input_learning["id"] ?>">
    <input name="input_main_layout_id" type="hidden" value="<?= $main_layout_id ?>">

    <table class="cardform" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td class="w-100">
                <? input($translation->get("name"), "input_description", "text", $input_learning["description"], 100) ?>
                <? input($translation->get("tags"), "input_tags", "text", $input_learning["tags"], 100) ?>
                <? input($translation->get("image"), "input_image", "file", $input_learning["image"], 45, $disabled);
                    $valFile = '';
                    if($input_learning['image'] != '' && $input_learning['image'] != NULL){
                        $valFile = $input_learning['image'];
                    }
                ?>
                <input type="hidden" name="input_image_old" value="<?=$valFile;?>">
                <?php
                    if($input_learning["image"] != NULL && $input_learning["image"] != ''){
                        echo "<div class='img_container learning_image'><img class='img-fluid' src='/userdata/learning/".$input_learning["image"]."'></div>";
                        echo button("delete", $translation->get("delete_image"), $formname, "loadCard('delete_image', true, '{$translation->get('delete_image')}', false)", "", FALSE);
                    }
                ?>
                <div class="learning_active">
                    <? input($translation->get("active"), "input_active", "checkbox", $input_learning["active"]) ?>
                </div>
                <?= create_mandant_select($input_learning['id']); ?>
            </td>
        </tr>
    </table>
</form>