EIANotesApp/Views/Notes/showNoteDetails.phtml
2025-06-16 15:11:33 +02:00

43 lines
1.8 KiB
PHTML

<?php include dirname(__DIR__).'/header.phtml'; ?>
<?php
$parsedown = new Parsedown();
$parsedown->setSafeMode(true);
?>
<div class="container">
<?php if (isset($note) && $note): ?>
<div class="note-details">
<div class="note-header">
<h2><?php echo htmlspecialchars($note['title'] ?? ''); ?></h2>
<div class="note-meta">
<?php if (($isAdmin ?? false) && isset($note['owner_username'])): ?>
<span class="note-owner">Owner: <?php echo htmlspecialchars($note['owner_username']); ?></span>
<?php endif; ?>
<span class="note-date">
Last updated: <?php echo isset($note['updated_at']) ? date("d.m.Y H:i", strtotime($note['updated_at'])) : 'N/A'; ?>
</span>
</div>
</div>
<div class="note-content">
<?php echo $parsedown->text($note['content'] ?? ''); ?>
</div>
<div class="note-actions">
<a href="?controller=NotesController&page=showNotes" class="button">Back to Notes</a>
<?php if (isset($note['id'])): ?>
<a href="?controller=NotesController&page=editNote&note_id=<?php echo (int)$note['id']; ?>" class="button">Edit Note</a>
<?php endif; ?>
</div>
</div>
<?php else: ?>
<div class="error-message">
<h2>Note Not Found</h2>
<p><?php echo htmlspecialchars($error ?? 'The requested note could not be found.'); ?></p>
<a href="?controller=NotesController&page=showNotes" class="button">Back to Notes</a>
</div>
<?php endif; ?>
</div>
<?php include dirname(__DIR__).'/footer.phtml'; ?>