גרסה 1

This commit is contained in:
Flatlogic Bot 2025-10-24 08:37:00 +00:00
parent 2a30fbdcdb
commit 9a00d79244
7 changed files with 468 additions and 148 deletions

53
assets/css/custom.css Normal file
View File

@ -0,0 +1,53 @@
body {
font-family: 'Heebo', sans-serif;
background-color: #F8FAFC;
}
.navbar-brand {
font-weight: 700;
font-size: 1.5rem;
}
.btn-primary {
background-color: #1D4ED8;
border-color: #1D4ED8;
}
.btn-primary:hover {
background-color: #1E40AF;
border-color: #1E40AF;
}
.btn-secondary {
background-color: #F97316;
border-color: #F97316;
}
.btn-secondary:hover {
background-color: #EA580C;
border-color: #EA580C;
}
.card {
border-radius: 0.5rem;
border: 1px solid #e2e8f0;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
}
.form-control, .form-select {
border-radius: 0.5rem;
}
.form-control:focus, .form-select:focus {
border-color: #1D4ED8;
box-shadow: 0 0 0 0.25rem rgba(29, 78, 216, 0.25);
}
.table {
vertical-align: middle;
}
.duration-input-group {
direction: ltr;
}
.toast-container {
z-index: 1080;
}

81
assets/js/main.js Normal file
View File

@ -0,0 +1,81 @@
document.addEventListener('DOMContentLoaded', function () {
// Initialize toast notifications
const toastEl = document.getElementById('notificationToast');
if (toastEl) {
const toast = new bootstrap.Toast(toastEl, { delay: 3000 });
toast.show();
}
const songModalEl = document.getElementById('songModal');
if (!songModalEl) return;
const songModal = new bootstrap.Modal(songModalEl);
const modalTitle = songModalEl.querySelector('.modal-title');
const songForm = document.getElementById('songForm');
const actionInput = document.getElementById('action');
const songIdInput = document.getElementById('song_id');
// Function to reset the modal to its "Add Song" state
const resetModal = () => {
songForm.reset();
actionInput.value = 'create';
songIdInput.value = '';
modalTitle.textContent = 'הוספת שיר חדש';
};
// Handle clicks on edit buttons
document.querySelectorAll('.edit-btn').forEach(button => {
button.addEventListener('click', function () {
const song = JSON.parse(this.dataset.song);
resetModal(); // Start with a clean slate
actionInput.value = 'update';
modalTitle.textContent = 'עריכת שיר';
songIdInput.value = song.id;
document.getElementById('name').value = song.name;
document.getElementById('bpm').value = song.bpm;
if (song.song_key && song.song_key.trim() !== '') {
const keyParts = song.song_key.split(' ');
document.getElementById('key_note').value = keyParts[0];
document.getElementById('key_scale').value = keyParts[1] || 'Major';
} else {
document.getElementById('key_note').value = '';
document.getElementById('key_scale').value = 'Major';
}
document.getElementById('notes').value = song.notes;
document.getElementById('tags').value = song.tags;
if (song.duration_seconds) {
const minutes = Math.floor(song.duration_seconds / 60);
const seconds = song.duration_seconds % 60;
document.getElementById('duration_minutes').value = minutes;
document.getElementById('duration_seconds').value = seconds;
}
songModal.show();
});
});
// Handle click on the link to add the first song
const addSongBtnLink = document.getElementById('addSongBtnLink');
if(addSongBtnLink) {
addSongBtnLink.addEventListener('click', (e) => {
e.preventDefault();
resetModal();
songModal.show();
});
}
// Reset the modal form when it's opened via the main "Add Song" button
// The main button works via data-attributes, so we just need to hook into the event
songModalEl.addEventListener('show.bs.modal', function (event) {
// If the trigger was NOT an edit button, reset the form for adding.
if (event.relatedTarget && !event.relatedTarget.classList.contains('edit-btn')) {
resetModal();
}
});
});

38
db/migrate.php Normal file
View File

@ -0,0 +1,38 @@
<?php
require_once 'config.php';
try {
// 1. Connect without a database to create it
$pdo_admin = new PDO('mysql:host='.DB_HOST, DB_USER, DB_PASS, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
]);
$pdo_admin->exec("CREATE DATABASE IF NOT EXISTS `".DB_NAME."` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci");
// echo "Database '".DB_NAME."' created or already exists.\n";
// 2. Connect to the specific database to create tables
$pdo = db();
if ($pdo === null) {
throw new Exception("Failed to connect to the database. The db() function returned null.");
}
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "
CREATE TABLE IF NOT EXISTS songs (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
bpm INT,
song_key VARCHAR(50),
duration_seconds INT,
notes TEXT,
tags VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;";
$pdo->exec($sql);
// echo "Table 'songs' created successfully (if it didn\'t exist).\n";
} catch (Exception $e) {
http_response_code(500);
die("DB ERROR: " . $e->getMessage());
}

9
includes/footer.php Normal file
View File

@ -0,0 +1,9 @@
</main>
<footer class="text-center py-4 text-muted border-top mt-5">
<p>&copy; <?php echo date('Y'); ?> Ari Stage. Built with Flatlogic.</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>

44
includes/header.php Normal file
View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ari Stage - ניהול מופעים</title>
<meta name="description" content="מערכת ליינאפ וניהול מופעים לזמרים ומפיקים. נבנה עם Flatlogic.">
<meta name="keywords" content="ניהול הופעות, ליינאפ, רשימת שירים, ניהול שירים, מוזיקה, זמרים, מפיקים, Ari Stage, Flatlogic">
<meta property="og:title" content="Ari Stage">
<meta property="og:description" content="מערכת ליינאפ וניהול מופעים לזמרים ומפיקים.">
<meta property="og:image" content="">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body class="bg-light">
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #1D4ED8;">
<div class="container-fluid">
<a class="navbar-brand fw-bold" href="index.php">Ari Stage</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php">בית</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="songs.php">מאגר שירים</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">ליינאפים</a>
</li>
</ul>
</div>
</div>
</nav>
<main class="container my-5">

160
index.php
View File

@ -1,150 +1,14 @@
<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
<?php include 'includes/header.php'; ?>
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
</head>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
<div class="text-center">
<h1 class="display-4 fw-bold">ברוכים הבאים ל-Ari Stage</h1>
<p class="lead col-lg-6 mx-auto text-muted">
הכלי המושלם לזמרים ומפיקים לניהול מאגר השירים, יצירת ליינאפים דינמיים, וארגון הופעות.
</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center mt-5">
<a href="songs.php" class="btn btn-primary btn-lg px-4 gap-3">למאגר השירים שלי</a>
<a href="#" class="btn btn-outline-secondary btn-lg px-4 disabled">צור ליינאפ חדש</a>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
</body>
</html>
</div>
<?php include 'includes/footer.php'; ?>

231
songs.php Normal file
View File

@ -0,0 +1,231 @@
<?php
session_start();
require_once 'db/config.php';
// --- Logic ---
$pdo = db();
$notification = null;
// Handle POST requests for CUD operations
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$action = $_POST['action'] ?? '';
try {
if ($action === 'create' || $action === 'update') {
$name = trim($_POST['name'] ?? '');
if (empty($name)) {
throw new Exception("שם השיר הוא שדה חובה.");
}
$bpm = !empty($_POST['bpm']) ? (int)$_POST['bpm'] : null;
$key_note = $_POST['key_note'] ?? '';
$key_scale = $_POST['key_scale'] ?? '';
$song_key = trim($key_note . ' ' . $key_scale);
$notes = trim($_POST['notes'] ?? '');
$tags = trim($_POST['tags'] ?? '');
$minutes = !empty($_POST['duration_minutes']) ? (int)$_POST['duration_minutes'] : 0;
$seconds = !empty($_POST['duration_seconds']) ? (int)$_POST['duration_seconds'] : 0;
$duration_seconds = ($minutes * 60) + $seconds;
if ($action === 'create') {
$stmt = $pdo->prepare("INSERT INTO songs (name, bpm, song_key, duration_seconds, notes, tags) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->execute([$name, $bpm, $song_key, $duration_seconds, $notes, $tags]);
$_SESSION['notification'] = ['message' => 'השיר נוצר בהצלחה!', 'type' => 'success'];
} else { // update
$id = (int)($_POST['id'] ?? 0);
if ($id > 0) {
$stmt = $pdo->prepare("UPDATE songs SET name=?, bpm=?, song_key=?, duration_seconds=?, notes=?, tags=? WHERE id=?");
$stmt->execute([$name, $bpm, $song_key, $duration_seconds, $notes, $tags, $id]);
$_SESSION['notification'] = ['message' => 'השיר עודכן בהצלחה!', 'type' => 'success'];
}
}
} elseif ($action === 'delete') {
$id = (int)($_POST['id'] ?? 0);
if ($id > 0) {
$stmt = $pdo->prepare("DELETE FROM songs WHERE id=?");
$stmt->execute([$id]);
$_SESSION['notification'] = ['message' => 'השיר נמחק בהצלחה.', 'type' => 'danger'];
}
}
} catch (Exception $e) {
$_SESSION['notification'] = ['message' => 'אירעה שגיאה: ' . $e->getMessage(), 'type' => 'danger'];
}
// Redirect to avoid form resubmission
header("Location: songs.php");
exit();
}
// Check for notification from session
if (isset($_SESSION['notification'])) {
$notification = $_SESSION['notification'];
unset($_SESSION['notification']);
}
// Fetch all songs to display
$songs = $pdo->query("SELECT * FROM songs ORDER BY name ASC")->fetchAll();
function format_duration($seconds) {
if ($seconds === null || $seconds < 0) return '00:00';
$mins = floor($seconds / 60);
$secs = $seconds % 60;
return sprintf('%02d:%02d', $mins, $secs);
}
// --- Presentation ---
include 'includes/header.php';
?>
<!-- Notification Toast -->
<?php if ($notification): ?>
<div class="toast-container position-fixed bottom-0 start-50 translate-middle-x p-3">
<div id="notificationToast" class="toast align-items-center text-bg-<?php echo htmlspecialchars($notification['type']); ?> border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">
<?php echo htmlspecialchars($notification['message']); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
<?php endif; ?>
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h2">מאגר השירים</h1>
<button id="addSongBtn" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#songModal"><i class="bi bi-plus-circle me-2"></i>הוסף שיר חדש</button>
</div>
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover">
<thead class="table-light">
<tr>
<th>שם השיר</th>
<th>BPM</th>
<th>סולם</th>
<th>משך</th>
<th>תגים</th>
<th>פעולות</th>
</tr>
</thead>
<tbody>
<?php if (empty($songs)): ?>
<tr>
<td colspan="6" class="text-center text-muted py-4">עדיין אין שירים במאגר. <a href="#" id="addSongBtnLink">הוסף את השיר הראשון שלך!</a></td>
</tr>
<?php else: ?>
<?php foreach ($songs as $song): ?>
<tr>
<td class="fw-bold"><?php echo htmlspecialchars($song['name']); ?></td>
<td><?php echo htmlspecialchars($song['bpm']); ?></td>
<td><?php echo htmlspecialchars($song['song_key']); ?></td>
<td><?php echo format_duration($song['duration_seconds']); ?></td>
<td>
<?php foreach(explode(',', $song['tags']) as $tag): ?>
<?php if(trim($tag)): ?>
<span class="badge bg-secondary bg-opacity-25 text-dark-emphasis"><?php echo htmlspecialchars(trim($tag)); ?></span>
<?php endif; ?>
<?php endforeach; ?>
</td>
<td>
<button class="btn btn-sm btn-outline-primary edit-btn" data-song='<?php echo htmlspecialchars(json_encode($song), ENT_QUOTES, 'UTF-8'); ?>'>
<i class="bi bi-pencil"></i>
</button>
<form action="songs.php" method="POST" class="d-inline" onsubmit="return confirm('האם אתה בטוח שברצונך למחוק את השיר?');">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="id" value="<?php echo $song['id']; ?>">
<button type="submit" class="btn btn-sm btn-outline-danger">
<i class="bi bi-trash"></i>
</button>
</form>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Add/Edit Song Modal -->
<div class="modal fade" id="songModal" tabindex="-1" aria-labelledby="songModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<form id="songForm" action="songs.php" method="POST">
<input type="hidden" name="action" id="action" value="create">
<input type="hidden" name="id" id="song_id">
<div class="modal-header">
<h5 class="modal-title" id="songModalLabel">הוספת שיר חדש</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label for="name" class="form-label">שם השיר <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label for="bpm" class="form-label">BPM</label>
<input type="number" class="form-control" id="bpm" name="bpm">
</div>
<div class="col-md-4 mb-3">
<label class="form-label">סולם</label>
<div class="input-group">
<select class="form-select" id="key_note" name="key_note">
<option value="" selected disabled>תו</option>
<option value="C">C</option>
<option value="C#">C#</option>
<option value="D">D</option>
<option value="D#">D#</option>
<option value="E">E</option>
<option value="F">F</option>
<option value="F#">F#</option>
<option value="G">G</option>
<option value="G#">G#</option>
<option value="A">A</option>
<option value="A#">A#</option>
<option value="B">B</option>
</select>
<select class="form-select" id="key_scale" name="key_scale">
<option value="Major">Major</option>
<option value="Minor">Minor</option>
</select>
</div>
</div>
<div class="col-md-4 mb-3">
<label class="form-label">משך (mm:ss)</label>
<div class="input-group duration-input-group">
<input type="number" class="form-control text-center" id="duration_minutes" name="duration_minutes" placeholder="00" min="0" max="59">
<span class="input-group-text">:</span>
<input type="number" class="form-control text-center" id="duration_seconds" name="duration_seconds" placeholder="00" min="0" max="59">
</div>
</div>
</div>
<div class="mb-3">
<label for="tags" class="form-label">תגים / סגנון</label>
<input type="text" class="form-control" id="tags" name="tags" placeholder="מופרד בפסיקים, לדוגמה: רוק, קאבר, שקט">
</div>
<div class="mb-3">
<label for="notes" class="form-label">הערות</label>
<textarea class="form-control" id="notes" name="notes" rows="3"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">ביטול</button>
<button type="submit" class="btn btn-primary">שמור שיר</button>
</div>
</form>
<form id="deleteForm" action="songs.php" method="POST" class="d-none">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="id">
</form>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>