2026-06-29 08:46:11 +02:00
|
|
|
<?php
|
|
|
|
|
$formname = "form_facility_card";
|
|
|
|
|
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
|
|
|
|
$inputname = "input_id";
|
|
|
|
|
|
|
|
|
|
$currentId = (int)($input_role["id"] ?? 0);
|
|
|
|
|
|
|
|
|
|
// Alle Einrichtungen außer der aktuellen laden
|
|
|
|
|
$allEinrichts = [];
|
|
|
|
|
$qAll = mysqli_query($GLOBALS['mysql_con'],
|
|
|
|
|
"SELECT id, description FROM organigramm_einricht ORDER BY description ASC");
|
|
|
|
|
while ($row = mysqli_fetch_assoc($qAll)) {
|
|
|
|
|
if ((int)$row['id'] !== $currentId) {
|
|
|
|
|
$allEinrichts[] = $row;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Bereits verknüpfte Einrichtungen laden
|
|
|
|
|
$preselect = [];
|
|
|
|
|
if ($currentId > 0) {
|
|
|
|
|
$qLinked = mysqli_query($GLOBALS['mysql_con'],
|
|
|
|
|
"SELECT linked_einricht_id FROM organigramm_einricht_link WHERE einricht_id = $currentId");
|
|
|
|
|
while ($row = mysqli_fetch_assoc($qLinked)) {
|
|
|
|
|
$preselect[] = $row['linked_einricht_id'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<div id="overlaycrumb">
|
|
|
|
|
<?php if ($input_role["id"] == "") {
|
|
|
|
|
echo $translation->get("new_facility");
|
|
|
|
|
} else {
|
|
|
|
|
echo $translation->get("edit_facility");
|
|
|
|
|
} ?>
|
|
|
|
|
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<ul class="toolbar_menu">
|
|
|
|
|
<?= button("save", $translation->get("save"), $formname, "loadCard('save', true)"); ?>
|
|
|
|
|
<?= button("save", $translation->get("save_and_close"), $formname, "loadCard('save', true, '', true)"); ?>
|
|
|
|
|
<li>
|
|
|
|
|
<ul>
|
|
|
|
|
<?php if ($input_role["id"] != ""): ?>
|
|
|
|
|
<?= button("delete", $translation->get("delete"), $formname, "loadCard('delete', true, '{$translation->get('delete_role_confirm')}', true)", "", FALSE); ?>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<?= button("reset", $translation->get("restore"), $formname, "?action=edit", "", FALSE); ?>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<?php if ($messages !== null && count($messages)): ?>
|
|
|
|
|
<div id="overlayMessages"><?= join("\r\n", $messages) ?></div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
|
|
|
|
<input name="input_id" type="hidden" value="<?= $input_role["id"] ?>">
|
|
|
|
|
|
|
|
|
|
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
|
|
|
|
<div>
|
|
|
|
|
<? input($translation->get("description"), "input_description", "text", $input_role["description"], 100) ?>
|
|
|
|
|
</div>
|
|
|
|
|
<tr>
|
|
|
|
|
<div class="label">Verknüpfte Einrichtungen</div>
|
|
|
|
|
<div class="einricht-link bc-select-ui ui fluid multiple search selection dropdown" style="clear:both; display:inline-block;">
|
|
|
|
|
<input type="hidden" name="linked_einrichts">
|
|
|
|
|
<i class="dropdown icon"></i>
|
|
|
|
|
<div class="default text">Einrichtungen auswählen…</div>
|
|
|
|
|
<div class="menu">
|
|
|
|
|
<?php foreach ($allEinrichts as $e): ?>
|
|
|
|
|
<div class="item" data-value="<?= (int)$e['id'] ?>">
|
|
|
|
|
<?= htmlspecialchars($e['description']) ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="/plugins/jquery/jquery-3.5.1.min.js"></script>
|
|
|
|
|
<script type="text/javascript" src="/plugins/Semantic-UI-master/semantic.min.js"></script>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="/plugins/Semantic-UI-master/bc-semantic.css?time=<?= filemtime($_SERVER['DOCUMENT_ROOT'] . '/plugins/Semantic-UI-master/bc-semantic.css') ?>">
|
|
|
|
|
<script>
|
|
|
|
|
var $y = jQuery.noConflict();
|
|
|
|
|
$y(document).ready(function () {
|
|
|
|
|
var $drop = $y('.einricht-link.ui.fluid.multiple.dropdown');
|
|
|
|
|
var $hidden = $y('input[name="linked_einrichts"]');
|
|
|
|
|
|
|
|
|
|
$drop.dropdown({
|
|
|
|
|
onChange: function (value) {
|
|
|
|
|
$hidden.val(value);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var preselect = <?= json_encode($preselect) ?>.map(String);
|
|
|
|
|
if (preselect.length) {
|
|
|
|
|
$drop.dropdown('set selected', preselect);
|
|
|
|
|
$hidden.val(preselect.join(','));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|