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


$sorting_values = array(
    $translation->get("collection_sorting_keep"),
    $translation->get("collection_sorting_change_top"),
    $translation->get("collection_sorting_change_bottom")
);

$query = "SELECT * FROM main_infopoint_pages WHERE id = '" . $input_line['id'] . "'";
$result =  @mysqli_query($GLOBALS['mysql_con'], $query);
$input_text = @mysqli_fetch_array($result);

$preset_values = array();
$preset_values_id = array();
$query = "SELECT * FROM main_infopoint_presets";
$result =  @mysqli_query($GLOBALS['mysql_con'], $query);

while ($row = @mysqli_fetch_array($result)) {
    $preset_values[] = $row['description'];
    $preset_values_id[] = $row['id'];
}

?>

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

<ul class="toolbar_menu">
    <?php

    // Speichern buttons
    button("save", $translation->get("save"), $formname, "loadCard('save_page', true)");

    button("save", $translation->get("save_and_close"), $formname, "loadCard('save_page', true, '', true)");

    if ($input_line["id"] != "") {
        echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_page', true, '{$translation->get('delete_page')}', true)");
    }
    ?>
</ul>
<div class="clearfix"></div>

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

<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
    <input name="input_id" type="hidden" value="<?= $input_line["id"] ?>" />
    <input name="type" type="hidden" value=<?= $input_line["type"] ?> />
    <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("description"), "input_description", "text", $input_line["description"], 255);
                input_select($translation->get("collection_change_sorting"), "input_change_sorting", $values = array_keys($sorting_values), $value_names = array_values($sorting_values), "", FALSE, FALSE);
                input_select($translation->get("default_active"), "input_default_active", $values = array('1', '0'), $value_names = array($translation->get("yes"), $translation->get("no")), $input_line["default_active"]);
                ?>
            </td>

            <td>
                <?php
                if ($input_line["id"] != "") {
                    show_changed_on($input_line["id"], "main_infopoint_pages");
                    show_changed_by($input_line["id"], "main_infopoint_pages");
                }
                ?>
            </td>
        </tr>
    </table>
    <?php
        create_infopoint_input_field($input_line['id']);
    ?>
</form>