<?
$formname    = "form_collection_choose_cardform";
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
$inputname   = "input_id";
?>

<div id="overlaycrumb">
    <?php if ($input_post["id"] == "") {
        echo $translation->get("new_community_board_post");
    } else {
        echo $translation->get("edit_community_board_post");
    }
    ?>
</div>

<ul class="toolbar_menu">
    <?php
    // Zurueck zur uebersicht
    button("left", $translation->get("back"), $formname, "loadCard('load_community_board_post', true)");

    // Speichern buttons
    button("save", $translation->get("save"), $formname, "loadCard('save_community_board_post', true)");
    button("save", $translation->get("save_and_close"), $formname, "jQuery('#save_and_close', jQuery('#" . $formname . "')).val(1);loadCard('save_community_board_post', true)");

    if ($input_post["id"] != "") {
        echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_community_board_post', true, '{$translation->get('delete_community_board_post_confirm')}')");
    }
    ?>
</ul>

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

$creation_date = new DateTime($input_post["creation_date"]);
?>

<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
    <input name="input_post_id" type="hidden" value="<?= $input_post["id"] ?>" />
    <input name="input_id" type="hidden" value="<?= $_REQUEST['input_id'] ?>">
    <input name="save_and_close" id="save_and_close" type="hidden" value="0" />

    <table class="cardform" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td>
                <? input($translation->get("title"), "input_title", "text", $input_post["title"]) ?> 
                <? input($translation->get("content"), "input_description", "textarea", $input_post["content"]) ?> 
                <? input($translation->get("creation_date"), "input_creation_date", "text", $creation_date->format('d.m.Y H:i'), 50, TRUE) ?> 
                <? input($translation->get("contact"), "input_creation_contact", "text", getContactFromID($input_post["creation_contact"]), 50, TRUE) ?> 
            </td>
        </tr>
        <tr>
            <td>
                <?php 
                    if ($input_post["id"] != "") {
                        loadComments($input_post['id']);
                    }
                ?>
            </td>
        </tr>
    </table>
</form>