407 lines
12 KiB
PHP
407 lines
12 KiB
PHP
<!DOCTYPE html>
|
|
|
|
<?php
|
|
require_once ("classes/SubjectData.php");
|
|
require_once ("classes/TopicData.php");
|
|
|
|
$subjectData = SubjectData::fromName($_GET["subject"]);
|
|
$topicData = TopicData::fromName($_GET["subject"], $_GET["topic"]);
|
|
|
|
?>
|
|
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title><?php echo($topicData->displayName); ?> - <?php echo($subjectData->displayName); ?></title>
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
}
|
|
|
|
:root {
|
|
--primary: #7C3AED;
|
|
--primary-light: #9F67FF;
|
|
--primary-dark: #6D28D9;
|
|
--bg-color: #F4F7FE;
|
|
--card-bg: #ffffff;
|
|
--text-primary: #1E293B;
|
|
--text-secondary: #64748B;
|
|
--accent: #F59E0B;
|
|
}
|
|
|
|
body {
|
|
background-color: var(--bg-color);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
/* Left Sidebar Styles */
|
|
.sidebar {
|
|
width: 280px;
|
|
height: 100vh;
|
|
background: var(--primary);
|
|
padding: 2rem;
|
|
position: fixed;
|
|
left: 0;
|
|
top: 0;
|
|
transition: transform 0.3s ease;
|
|
z-index: 50;
|
|
}
|
|
|
|
.sidebar-header {
|
|
color: white;
|
|
margin-bottom: 2rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.sidebar-header i {
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.nav-link {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 1rem;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
text-decoration: none;
|
|
border-radius: 12px;
|
|
margin-bottom: 0.5rem;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.nav-link:hover {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
color: white;
|
|
transform: translateX(5px);
|
|
}
|
|
|
|
.nav-link i {
|
|
margin-right: 1rem;
|
|
font-size: 1.25rem;
|
|
}
|
|
|
|
/* Main Content Styles */
|
|
.main-content {
|
|
margin-left: 280px;
|
|
margin-right: 300px;
|
|
padding: 2rem;
|
|
flex: 1;
|
|
}
|
|
|
|
.search-container {
|
|
position: sticky;
|
|
top: 0;
|
|
background: var(--card-bg);
|
|
padding: 1rem;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
margin-bottom: 2rem;
|
|
z-index: 40;
|
|
}
|
|
|
|
.search-box {
|
|
width: 100%;
|
|
padding: 0.75rem 1rem;
|
|
border: 2px solid #E2E8F0;
|
|
border-radius: 12px;
|
|
outline: none;
|
|
font-size: 1rem;
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.search-box:focus {
|
|
border-color: var(--primary);
|
|
box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
|
|
}
|
|
|
|
/* Content Card Styles */
|
|
.content-card {
|
|
background: var(--card-bg);
|
|
border-radius: 20px;
|
|
padding: 2rem;
|
|
margin-bottom: 2rem;
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
}
|
|
|
|
.content-card:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.content-title {
|
|
font-size: 2rem;
|
|
color: var(--text-primary);
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.content-text {
|
|
color: var(--text-secondary);
|
|
line-height: 1.7;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
/* Right Sidebar Styles */
|
|
.right-sidebar {
|
|
width: 300px;
|
|
height: 100vh;
|
|
position: fixed;
|
|
right: 0;
|
|
top: 0;
|
|
padding: 2rem;
|
|
background: var(--card-bg);
|
|
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.related-topics {
|
|
background: rgba(124, 58, 237, 0.05);
|
|
padding: 1.25rem;
|
|
border-radius: 12px;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.related-topics h3 {
|
|
color: var(--primary);
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.topic-tag {
|
|
display: inline-block;
|
|
padding: 0.5rem 1rem;
|
|
background: white;
|
|
border-radius: 20px;
|
|
margin: 0.25rem;
|
|
font-size: 0.9rem;
|
|
color: var(--text-secondary);
|
|
border: 1px solid rgba(124, 58, 237, 0.2);
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.topic-tag:hover {
|
|
background: var(--primary);
|
|
color: white;
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
|
|
}
|
|
|
|
/* Exercise Section Styles */
|
|
.exercise-section {
|
|
background: linear-gradient(135deg, var(--primary-light), var(--primary));
|
|
padding: 1.5rem;
|
|
border-radius: 12px;
|
|
color: white;
|
|
margin-top: 2rem;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.exercise-section::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1));
|
|
pointer-events: none;
|
|
}
|
|
|
|
.download-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
background: rgba(255, 255, 255, 0.1);
|
|
color: white;
|
|
padding: 0.75rem 1.25rem;
|
|
border-radius: 10px;
|
|
text-decoration: none;
|
|
margin: 0.5rem;
|
|
backdrop-filter: blur(5px);
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
}
|
|
|
|
.download-btn:hover {
|
|
background: rgba(255, 255, 255, 0.2);
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
/* Responsive Design */
|
|
@media (max-width: 1200px) {
|
|
.right-sidebar {
|
|
display: none;
|
|
}
|
|
.main-content {
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.sidebar {
|
|
transform: translateX(-100%);
|
|
}
|
|
.sidebar.active {
|
|
transform: translateX(0);
|
|
}
|
|
.main-content {
|
|
margin-left: 0;
|
|
}
|
|
}
|
|
|
|
/* Active nav link style */
|
|
.nav-link.active {
|
|
background: rgba(255, 255, 255, 0.15);
|
|
color: white;
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* List style improvement */
|
|
.content-text li {
|
|
position: relative;
|
|
padding-left: 1.5rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.content-text li::before {
|
|
content: '•';
|
|
color: var(--primary);
|
|
position: absolute;
|
|
left: 0;
|
|
font-weight: bold;
|
|
}
|
|
|
|
/* Add this CSS to your existing styles */
|
|
document.head.insertAdjacentHTML('beforeend', `
|
|
<style>
|
|
mark {
|
|
background-color: rgba(124, 58, 237, 0.2);
|
|
color: inherit;
|
|
padding: 0 2px;
|
|
border-radius: 2px;
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
|
|
mark:hover {
|
|
background-color: rgba(124, 58, 237, 0.4);
|
|
}
|
|
</style>
|
|
`);
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- Left Sidebar -->
|
|
<nav class="sidebar">
|
|
<div class="sidebar-header">
|
|
<i class="fas fa-graduation-cap"></i>
|
|
<h2><?php echo($subjectData->displayName); ?></h2>
|
|
</div>
|
|
<a href="homepage.php" class="nav-link">
|
|
<i class="fas fa-home"></i> Homepage
|
|
</a>
|
|
<a href="subject.php?subject=<?php echo($subjectData->id); ?>" class="nav-link">
|
|
<i class="fas fa-book"></i> <?php echo($subjectData->displayName); ?> Übersicht
|
|
</a>
|
|
<a href="#" class="nav-link active">
|
|
<i class="fas fa-calculator"></i> <?php echo($topicData->displayName); ?>
|
|
</a>
|
|
</nav>
|
|
|
|
<!-- Main Content -->
|
|
<main class="main-content">
|
|
<div class="search-container">
|
|
<input type="text" class="search-box" id="searchInput" placeholder="Suche nach Themen, Übungen oder Hilfe..." oninput="handleContentSearch()">
|
|
</div>
|
|
|
|
<div class="content-card">
|
|
<h1 class="content-title"><?php echo($topicData->displayName); ?></h1>
|
|
<p class="content-text">
|
|
<?php echo($topicData->description); ?>
|
|
</p>
|
|
<p class="content-text">
|
|
<?php echo($topicData->article); ?>
|
|
</p>
|
|
|
|
<div class="exercise-section">
|
|
<h3 style="margin-bottom: 1rem;">Übungen herunterladen:</h3>
|
|
<div style="display: flex; flex-wrap: wrap; gap: 0.5rem;">
|
|
<?php
|
|
foreach ($topicData->files as $file) {
|
|
?>
|
|
|
|
<a href="#" class="download-btn">
|
|
<i class="fas fa-file-pdf"></i>
|
|
<?php echo($file); ?>
|
|
</a>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Right Sidebar -->
|
|
<aside class="right-sidebar">
|
|
<div class="related-topics">
|
|
<h3>Verwandte Themen</h3>
|
|
<div style="display: flex; flex-wrap: wrap; gap: 0.5rem;">
|
|
<?php
|
|
foreach ($topicData->relatedTopics as $relatedTopic) {
|
|
?>
|
|
|
|
<span class="topic-tag"><?php echo($relatedTopic); ?></span>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
|
|
<!-- Add this script at the end of the body, before the closing body tag -->
|
|
<script>
|
|
function handleContentSearch() {
|
|
const searchTerm = document.getElementById('searchInput').value.toLowerCase();
|
|
const contentElements = document.querySelectorAll('.content-text, .content-text li');
|
|
|
|
if (searchTerm.length < 2) {
|
|
// Remove all highlights if search term is too short
|
|
document.querySelectorAll('mark').forEach(mark => {
|
|
mark.outerHTML = mark.innerHTML;
|
|
});
|
|
return;
|
|
}
|
|
|
|
contentElements.forEach(element => {
|
|
let content = element.innerHTML;
|
|
// Remove existing highlights
|
|
content = content.replace(/<\/?mark>/g, '');
|
|
|
|
if (searchTerm) {
|
|
// Create a regular expression for case-insensitive search
|
|
const regex = new RegExp(`(${searchTerm})`, 'gi');
|
|
// Replace matches with highlighted text
|
|
content = content.replace(regex, '<mark>$1</mark>');
|
|
}
|
|
|
|
element.innerHTML = content;
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|