 
<script type="text/javascript" src="/plugins/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="/plugins/ckeditor/adapters/jquery.js"></script>
    <script type="text/javascript" src="/plugins/ckfinder/ckfinder.js"></script>
<?php

$formname = 'form_collection_cardform';
$translation = \DynCom\mysyde\common\classes\Registry::get('translation');
$inputname = 'input_id';
$input_page_id = (isset($_REQUEST['input_page_id']) ? $_REQUEST['input_page_id'] : '');

$collection_setup_id = $_GET['setup_id'];
?>

<div id="content-collection" class="collections">
<div id="overlay"></div>
<div id="overlayWrapper">
<div id="overlayContenting">
<div id="overlaycrumb" class='collection'>
 <?php    
 
button("save", $translation->get("save"), $formname, "saveCollection(false)");

?>
<form id="<?=
$formname
?>" name="<?=
$formname
?>" method="post" class='collection_form collection'>
    <input name="input_collection_id_frontend" id="input_collection_id_frontend" type="hidden" value="<?=
$input_collection['id']
?>">
    <input type="hidden" name="main_collection_setup_id" value="<?php
echo $collection_setup_id;
?>" />
    <input type="hidden" name="get_real_page_link_id" value="1" />
    <input type="hidden" name="input_page_id" value="<?php
echo $input_page_id;
?>" />

    <table class="cardform" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td>
                <?php
                input($translation->get("collection_title"), "input_description", "text", $input_collection["description"], 255);
if ($input_collection['id'] != '') {
    create_collection_groups_select($input_collection);
}
create_collection_tags();
input($translation->get('validity_from'), 'input_validity_from', 'date', datefromsql($input_collection['validity_from']), 10);
input($translation->get('validity_to'), 'input_validity_to', 'date', datefromsql($input_collection['validity_to']), 10);
create_contactform_select($contactforms, $translation->get('registration_form'), 'registration_contactform_id', $input_collection, (int) $input_collection['registration'] == 0 ? TRUE : FALSE);
?>
            </td>
            <td>
                <?php
// create_mandant_select($input_collection['id']);
if ($collection_setup['collection_type'] == 4) {
    // create_knowledegecenter_category_select($input_collection['id']);
}
?>
            </td>
        </tr>

    </table>

</form>

<div class="collectionform">
    
<?php

$query = 'SELECT * FROM main_collection_setup_content WHERE main_collection_setup_id = ' . $collection_setup_id . ' ORDER BY sorting ASC';
$result = mysqli_query($GLOBALS['mysql_con'], $query);
while ($content = @mysqli_fetch_array($result)) {
    echo '<tr><td>';
    $collectionData = array();
    if(isset($input_collection['id']) && $input_collection['id'] != ''){
        $collectionData = $input_collection;
    }
    create_collection_input_field($content, $collectionData);
    echo '</td></tr>';
}
?>
</div>

</div>
</div>
</div>
</div>
<script>
      $( "#overlaycrumb , .collectionform, .collections form#form_line_list  " ).wrapAll( "<div class='collection-main-wrapper' />");
          $( "ul.toolbar_menu.collection, .collection_form.collection " ).wrapAll( "<div class='collection-wrapper'></div>" );

      function showCollectionSavingLoader() {
          jQuery('#overlay').show();
          jQuery('#overlayWrapper').show();
          jQuery('#overlayLoader').show();
      }

      function saveCollection(_close) {

showCollectionSavingLoader();

var aFormData = new FormData();

// wird benoetigt damit die Inhalte des fckeditors uebertragen werden koennen
for (instance in CKEDITOR.instances) {
    CKEDITOR.instances[instance].updateElement();
}
 
$('#overlayContent :input').each(function() {
    if ($(this).attr("type") == "file") {
        aFormData.append($(this).attr("name"), $(this).get(0).files[0]);
    } else if ($(this).attr("type") == "checkbox") {
        if ($(this).prop("checked") === true) {
            aFormData.append($(this).attr("name"), "on");
        }
    } else {
        aFormData.append($(this).attr("name"), $(this).val());
    }
});
console.log(aFormData);
loadCard_frontend('frontend_collection', true, '', _close, aFormData);
}
</script>