Verlinkungen zu Editoren eingebaut

This commit is contained in:
Matthias Grief
2025-01-01 14:42:07 +01:00
parent 52ffc6694d
commit 362a5034bc
5 changed files with 67 additions and 10 deletions

View File

@@ -15,7 +15,14 @@ session_start();
<link href="assets/css/styles.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/katex.min.css"
integrity="sha384-veTAhWILPOotXm+kbR5uY7dRamYLJf58I7P+hJhjeuc7hsMAkJHTsPahAl0hBST0" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/katex.min.js"
integrity="sha384-v6mkHYHfY/4BWq54f7lQAdtIsoZZIByznQ3ZqN38OL4KCsrxo31SLlPiak7cj/Mg"
crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/contrib/auto-render.min.js"
integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
</head>
@@ -82,9 +89,19 @@ session_start();
<?php
}
?>
</div>
<?php
if (isset($_SESSION['user']) && $_SESSION['user']->isLoggedIn()) {
?>
<a href="subjectEditor.php"
class="fixed z-90 w-14 h-14 bottom-20 right-5 flex items-center justify-center text-4xl text-white rounded-lg bg-[var(--primary-color)] hover:bg-[var(--accent-color)] transition duration-300">
<span class="pb-1.5">&plus;</span>
</a>
<?php
}
?>
<footer class="sticky top-[100vh] w-full bg-white/80 backdrop-blur-lg shadow-sm p-5">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="flex justify-between">

View File

@@ -27,7 +27,14 @@ $topics = $subjectData->topics;
<link href="assets/css/subject.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/katex.min.css"
integrity="sha384-veTAhWILPOotXm+kbR5uY7dRamYLJf58I7P+hJhjeuc7hsMAkJHTsPahAl0hBST0" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/katex.min.js"
integrity="sha384-v6mkHYHfY/4BWq54f7lQAdtIsoZZIByznQ3ZqN38OL4KCsrxo31SLlPiak7cj/Mg"
crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/contrib/auto-render.min.js"
integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
<script src="assets/js/sidebar.js"></script>
<script src="assets/js/search.js"></script>
</head>
@@ -124,6 +131,21 @@ $topics = $subjectData->topics;
</div>
</div>
<?php
if (isset($_SESSION['user']) && $_SESSION['user']->isLoggedIn()) {
?>
<a href="subjectEditor.php?subject=<?php echo $subjectData->id ?>"
class="fixed z-90 w-14 h-14 bottom-40 right-5 flex items-center justify-center text-4xl text-white rounded-lg bg-[var(--primary-color)] hover:bg-[var(--accent-color)] transition duration-300">
<span class="pb-1.5">&#9998;</span>
</a>
<a href="topicEditor.php?subject=<?php echo $subjectData->id ?>"
class="fixed z-90 w-14 h-14 bottom-20 right-5 flex items-center justify-center text-4xl text-white rounded-lg bg-[var(--primary-color)] hover:bg-[var(--accent-color)] transition duration-300">
<span class="pb-1.5">&plus;</span>
</a>
<?php
}
?>
<footer class="sticky top-[100vh] lg:ms-[280px] w-full lg:w-auto bg-white/80 backdrop-blur-lg shadow-sm p-5">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="flex justify-between">

View File

@@ -15,8 +15,8 @@ $defaultValues['icon'] = "";
$errors = array();
if (isset($_GET['subjectId'])) {
$editingSubject = $allSubjects[$_GET['subjectId']];
if (isset($_GET['subject'])) {
$editingSubject = $allSubjects[$_GET['subject']];
$defaultValues['displayName'] = $editingSubject->getDisplayName();
$defaultValues['id'] = $editingSubject->getId();

View File

@@ -36,12 +36,17 @@ if (!isset($topicData)) {
<!--<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>-->
<script src="assets/js/sidebar.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/katex.min.css" integrity="sha384-veTAhWILPOotXm+kbR5uY7dRamYLJf58I7P+hJhjeuc7hsMAkJHTsPahAl0hBST0" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/katex.min.js" integrity="sha384-v6mkHYHfY/4BWq54f7lQAdtIsoZZIByznQ3ZqN38OL4KCsrxo31SLlPiak7cj/Mg" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/contrib/auto-render.min.js" integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/katex.min.css"
integrity="sha384-veTAhWILPOotXm+kbR5uY7dRamYLJf58I7P+hJhjeuc7hsMAkJHTsPahAl0hBST0" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/katex.min.js"
integrity="sha384-v6mkHYHfY/4BWq54f7lQAdtIsoZZIByznQ3ZqN38OL4KCsrxo31SLlPiak7cj/Mg"
crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.18/dist/contrib/auto-render.min.js"
integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("DOMContentLoaded", function () {
renderMathInElement(document.body, {
// customised options
// • auto-render specific keys, e.g.:
@@ -57,7 +62,7 @@ if (!isset($topicData)) {
{left: "\\[", right: "\\]", display: true}
],
// • rendering keys, e.g.:
throwOnError : false
throwOnError: false
});
});
</script>
@@ -167,6 +172,17 @@ if (!isset($topicData)) {
</div>
</main>
<?php
if (isset($_SESSION['user']) && $_SESSION['user']->isLoggedIn()) {
?>
<a href="topicEditor.php?subject=<?php echo $subjectData->id ?>&topic=<?php echo $topicData->id ?>"
class="fixed z-90 w-14 h-14 bottom-20 right-5 flex items-center justify-center text-4xl text-white rounded-lg bg-[var(--primary-color)] hover:bg-[var(--accent-color)] transition duration-300">
<span class="pb-1.5">&#9998;</span>
</a>
<?php
}
?>
<footer class="sticky top-[100vh] lg:ms-[280px] w-full lg:w-auto bg-white/80 backdrop-blur-lg shadow-sm p-5">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="flex justify-between">

View File

@@ -31,6 +31,8 @@ if (isset($_GET['subject']) && isset($_GET['topic'])) {
$defaultValues['relatedTopics'] = implode(", ", $editingTopic->getRelatedTopics());
$defaultValues['article'] = $editingTopic->getFinishedArticle();
}
} else if(isset($_GET['subject'])) {
$defaultValues['subjectId'] = $_GET['subject'];
}
if($_SERVER['REQUEST_METHOD'] == 'POST') {