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

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

<ul class="toolbar_menu">
	<?php
	if (is_page_edit() || is_component_edit()) {
		button("left", $translation->get("back"), $formname, "loadCard('edit_content_page', true)");
	}
	?>

	<?= button("save", $translation->get("save"), $formname, "loadCard('save_intranet', true)"); ?>


	<?= button("save", $translation->get("save_and_close"), $formname, "loadCard('save_intranet', true, '', true)"); ?>
	<li>
		<ul>
			<?= button("reset", $translation->get("restore"), $formname, "?action=edit_iframe", "", false); ?>
		</ul>
	</li>
</ul>

<?php

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

//Arrays für Select füllen
$type_array = array(
	1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27
);
$type_name_array = array(
	0 => "Kontaktdaten",
	1 => "Schwarzes Brett",
	2 => "Kontakt bearbeiten",
	3 => "Essenslieferung",
	4 => "Profil",
	5 => "Infoboard",
	6 => "Knowledgecenter",
	7 => "Firmeninformationen",
	8 => "Meine Kontakte",
	9 => "Knowledgecenter - Weitere Beiträge",
	10 => "E-Learning",
	11 => "Zertifikate - Kontaktkarte",
	12 => "Essenslieferung Übersicht",
	13 => "Zukünftige Termine",
	14 => "E-Learning - Kontaktkarte",
	15 => "Playground",
	16 => "Tasks",
	17 => "Tasks Vorschau",
	18 => "Knowledgecenter - Custom Feed",
	19 => "Arbeitsplatz Übersicht",
	20 => "Personenkarten",
	21 => "Organigramm",
	22 => "PDF Suchen",
	23 => "PDF Vorschau",
	24 => "QM Updates",
	25 => "QR-Code",
	26 => "Ticketcenter"
);

$input_description = (empty($input_intranet['description']) ? $type_name_array[$input_intranet['type']] : $input_intranet['description']);

?>

<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
	<input name="input_id" type="hidden" value="<?= $input_intranet["id"] ?>">
	<input name="input_page_id" type="hidden" value="<?= $input_page_id ?>">
	<input type="hidden" name="input_component_id" value="<?php echo $input_component_id; ?>" />
	<input name="data-sitepartid" type="hidden" value="15">
	<input type="hidden" name="get_real_page_link_id" value="1" />

	<table class="cardform" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td>
				<div class='label'><label for="input_description"><?= $translation->get('description') ?></label></div>
				<div class='input'><input type="text" name="input_description" id="input_description" value="<?= $input_description ?>" class="text"></div>
				<? input_select($translation->get('content_type'),'input_type',$type_array, $type_name_array, $input_intranet['type']); ?>
				<?php
				if ($input_intranet['id'] != "" && $input_intranet['type'] == 12 || $input_intranet['type'] == 15) { // E-Learning - Kontaktkarte
					echo input('Mit Personenkarte anzeigen', "input_learning_certificate_type", "checkbox", $input_intranet["learning_certificate_type"], 255);
					echo input('Anzahl der Zertifikate', "input_sitepart_items", "number", $input_intranet["sitepart_items"], 255);
				}
				if ($input_intranet['id'] != "" && $input_intranet['type'] == 14) { // Zukünftige Termine
					echo input('Nur der Termine der einzelnen Person', "input_appointment_type", "checkbox", $input_intranet["appointment_type"], 255);
					echo input('Anzahl der Termine', "input_sitepart_items", "number", $input_intranet["sitepart_items"], 255);
				}
				?>
			</td>
		</tr>
	</table>
</form>