Files
intranet/web/intranet_repo/projects/developerpanel/developer.php
T

112 lines
3.7 KiB
PHP

<?php /* Name: developer.php
Beschreibung: Entwicklungsprozess (Bearbeitungsseite)
- inkl. Aufruf von button_edit.php */
// Initialisierung
require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/general_files/initialise.php';
?>
<!DOCTYPE html>
<html lang="de" dir="ltr">
<head>
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/projects/_central/php/html_head.php'; ?>
</head>
<body class="theme-green">
<?php /* Besondere Entwickler-Rechte checken */
// Fetch user details
$sql = "SELECT * FROM user_permissions up INNER JOIN user_general_information ugi ON up.user_id = ugi.user_id WHERE up.user_id = {$_SESSION["user_id"]}";
$result = $pdo->query($sql);
$isDeveloper = $result->fetch(PDO::FETCH_ASSOC);
// Check if the user has developer access (Entwickler = 1)
if ($isDeveloper["Entwickler"] == 1) {
$sql_groups = "SELECT * FROM user_permissions";
$stmt = $pdo->prepare($sql_groups);
$stmt->execute();
$groups = $stmt->fetchAll(PDO::FETCH_ASSOC);
} else {
header("Location: {$g_httpHomePath}");
exit();
}
?>
<?php // Es folgen ab hier die HTML-Ausgaben beginnend mit dem HTML-Header: ?>
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/projects/_central/php/header.php'; ?>
<?php // Header (erweitert): Titel der Seite mit Funktionsaufruf ?>
<div class="header_title ht_dev text_white" id="header_title">
<div class="flexrow fullwidth" style="justify-content:space-between !important;">
<div class="header_title_text">Entwicklungsprozess</div>
<div class="small_text" style="margin-right:8px;margin-left:8px;align-self:center;">
<?php echo "$p_nac_base // $p_version ($p_status)" ?>
</div>
</div>
</div>
<?php // Die oberen Standard-Overlays müssen vor dem Content-Bereich platziert sein. ?>
<div class="content" id="base">
<div class="content_flexcontainer">
<div class="flexright">
<?php // Info-Panel einbinden
require_once 'developer_info.php'; ?>
<?php // Info-Panel einbinden
//require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/_templates/playground/table_openClose.php'; ?>
</div>
<div class="flexleft">
<?php // TODO: Durch die Developer-Textpanels iterieren
// TODO: Dev-Texte werden später noch in die Datenbank integriert
$edit_id = 1;
$filename = "work/todo.txt";
$filecontent = file_get_contents($filename);
$filecontent_output = markdownFormat($filecontent);
if (isset($_POST['speichern'])) {
$filecontent = $_POST['filecontent'];
file_put_contents($filename, $filecontent); //Speichern + Bearbeitungsmodus verlassen
header("Location: {$g_httpCurrentCleanUrl}");
exit();
}
?>
<div class="content_panel" id="1">
<div class="flexrow_right fullwidth">
<?php require $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/projects/_central/php/snippets/button_edit.php'; ?>
</div>
<?php if ( (isset($_GET['action']) && $_GET['action'] == 'edit') &&
(isset($edit_id) && $edit_id == 1) ) { ?>
<form class="display_within_dev" action="" method="post" id="<?php echo $edit_id; ?>">
<textarea id="filecontent" name="filecontent" autofocus><?php echo $filecontent; ?></textarea>
<div>
<input class="button" type="submit" value="Speichern" name="speichern">
<input class="button" type="button" value="Abbrechen" onclick="window.location.href=window.location.href.split('?')[0];">
</div>
</form>
<?php } else { ?>
<div class="content_panel_output"><?php echo $filecontent_output; ?></div>
<?php } ?>
</div>
</div>
</div>
</div> <!-- EOD: content -->
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/projects/_central/php/footer.php'; ?>
</body>
</html>