Compare commits
2 Commits
e3f2f638bc
...
1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00fd8dc1cf | ||
| d274d5988c |
37
.github/copilot-instructions.production.md
vendored
Normal file
37
.github/copilot-instructions.production.md
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Copilot Instructions for Workshop-Wahlen (Production)
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
This WordPress plugin manages workshop elections for Konfi-Castle events. It provides an admin backend (elections, workshops, participants, teamers, assignments) and a participant frontend.
|
||||||
|
|
||||||
|
## Architecture & Components
|
||||||
|
- **Main file:** `konficastle-workshopwahl.php` – Initializes hooks, loads assets, admin menus.
|
||||||
|
- **Backend:**
|
||||||
|
- `includes/` with modules for elections, workshops, participants, teamers, assignments, data management, force assignment
|
||||||
|
- Core assignment logic: `includes/zuteilungslogik.php`
|
||||||
|
- **Frontend:**
|
||||||
|
- Shortcodes: `[konficastle_workshopwahl wahl=ID]`, `[konficastle_workshop_ergebnis wahl=ID]`
|
||||||
|
- **Database:** Tables are created via `install.php`, prefix: `kc_`
|
||||||
|
|
||||||
|
## Key Patterns & Workflows
|
||||||
|
- **Admin tabs:** Navigation via `kc_admin_tabs()`
|
||||||
|
- **Naming:** Functions and tables use `kc_` prefix
|
||||||
|
- **Force assignments:** Manual assignments take precedence
|
||||||
|
- **Test data:** Only user ID 1 can generate via admin (`admin-data.php`)
|
||||||
|
- **CSV export:** Possible via admin assignments
|
||||||
|
- **Teamer password:** Managed via admin, hash in WP options
|
||||||
|
|
||||||
|
## Examples & Entry Points
|
||||||
|
- **Admin menu:** `konficastle-workshopwahl.php`, `includes/admin-wahlen.php`
|
||||||
|
- **Assignment logic:** `includes/zuteilungslogik.php`
|
||||||
|
- **Frontend form:** `includes/frontend-form.php`
|
||||||
|
|
||||||
|
## Notes for AI Agents
|
||||||
|
- Always use `$wpdb->prefix` for DB tables
|
||||||
|
- Backend logic is modular, each entity has its own file
|
||||||
|
- No complex JS logic in frontend, validation is server-side
|
||||||
|
- For changes to assignment logic: use test scenarios via test data admin page
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
See README.md for further details.
|
||||||
48
README.md
48
README.md
@@ -1,2 +1,50 @@
|
|||||||
# Workshop-Wahlen
|
# Workshop-Wahlen
|
||||||
|
|
||||||
|
## Überblick
|
||||||
|
|
||||||
|
Dieses WordPress-Plugin ermöglicht die Verwaltung und Durchführung von Workshop-Wahlen für Konfi-Castle-Events. Es bietet ein vollständiges Backend für Admins (Wahlen, Workshops, Teilnehmer, Teamer, Zuteilungen) und ein Frontend-Formular für Teilnehmer.
|
||||||
|
|
||||||
|
## Architektur & Hauptkomponenten
|
||||||
|
|
||||||
|
- **Haupt-Plugin-Datei:** `konficastle-workshopwahl.php` – Registriert Hooks, lädt Assets, initialisiert Admin-Menüs.
|
||||||
|
- **Backend-Module (im `includes/`-Verzeichnis):**
|
||||||
|
- `admin-wahlen.php`, `admin-workshops.php`, `admin-teilnehmer.php`, `admin-teamer.php`, `admin-zuteilungen.php`, `admin-data.php`, `force-zuteilung.php`: Jeweils eigene Admin-Seiten für die Verwaltung der zugehörigen Entitäten.
|
||||||
|
- `zuteilungslogik.php`: Kernlogik für die automatische Zuteilung von Teilnehmern zu Workshops (inkl. Force-Zuteilungen und Kapazitätsprüfung).
|
||||||
|
- **Frontend:**
|
||||||
|
- `frontend-form.php`: Shortcode `[konficastle_workshopwahl wahl=ID]` für das Teilnehmer-Formular.
|
||||||
|
- `frontend-ergebnis.php`: Shortcode `[konficastle_workshop_ergebnis wahl=ID]` für Ergebnisanzeige.
|
||||||
|
- **Styles & Assets:**
|
||||||
|
- `assets/`: Enthält CSS für Admin und Frontend.
|
||||||
|
|
||||||
|
## Datenbank & Installation
|
||||||
|
|
||||||
|
- Tabellen werden über `install.php` beim Aktivieren angelegt (z.B. `kc_wahlen`, `kc_workshops`, `kc_teilnehmer`, `kc_zuteilung`, ...).
|
||||||
|
- Tabellenpräfix wird dynamisch über `$wpdb->prefix` verwendet.
|
||||||
|
|
||||||
|
## Entwickler-Workflows
|
||||||
|
|
||||||
|
- **Testdaten:** Über die Admin-Seite "Datenverwaltung" (`admin-data.php`) können Testdaten generiert werden (nur User ID 1).
|
||||||
|
- **CSV-Export:** Zuteilungen können über die Admin-Seite exportiert werden (`admin-zuteilungen.php`).
|
||||||
|
- **Zuteilungslogik:** Anpassungen an der Kernlogik erfolgen in `zuteilungslogik.php`.
|
||||||
|
- **Shortcodes:**
|
||||||
|
- `[konficastle_workshopwahl wahl=ID]` – Teilnehmer-Frontend
|
||||||
|
- `[konficastle_workshop_ergebnis wahl=ID]` – Ergebnisanzeige
|
||||||
|
|
||||||
|
## Besondere Konventionen & Hinweise
|
||||||
|
|
||||||
|
- **Namensschema:** Alle Plugin-Funktionen und Tabellen sind mit `kc_` (Konfi-Castle) prefixiert.
|
||||||
|
- **Admin-Tabs:** Navigation zwischen Admin-Seiten über `kc_admin_tabs()`.
|
||||||
|
- **Force-Zuteilungen:** Manuelle Zuweisungen haben Vorrang vor automatischer Logik.
|
||||||
|
- **Teamer-Passwort:** Verwaltung über eigene Admin-Seite, Passwort-Hash in WP-Optionen.
|
||||||
|
- **Frontend-Validierung:** Erfolgt serverseitig, keine komplexe JS-Logik im Frontend.
|
||||||
|
|
||||||
|
## Einstiegspunkte & Beispiele
|
||||||
|
|
||||||
|
- **Admin-Menüstruktur:** Siehe `konficastle-workshopwahl.php` und `includes/admin-wahlen.php`.
|
||||||
|
- **Zuteilungslogik:** Siehe `includes/zuteilungslogik.php` (Funktionen wie `kc_run_zuteilung`).
|
||||||
|
- **Frontend-Formular:** Siehe `includes/frontend-form.php` (Shortcode-Handler).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Für Detailfragen zu Datenbankstruktur, Shortcodes oder Zuteilungslogik siehe die jeweiligen Dateien im `includes/`-Verzeichnis.
|
||||||
|
|
||||||
|
|||||||
@@ -1,68 +1,68 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
Plugin Name: Workshopwahl
|
* Plugin Name: Workshop-Wahlen
|
||||||
Description: Workshop wahl plugin mit zuteilungsfunktion
|
* Description: Workshop-Wahl-System für Konfi-Castle.com
|
||||||
Version: 1.0
|
* Version: 1.0
|
||||||
Author: Linus Nilson
|
* Author: Linus Maximilian Nilson
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('ABSPATH')) exit;
|
if (!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
// Stylesheet einbinden
|
// Stylesheet einbinden
|
||||||
add_action('admin_enqueue_scripts', function($hook) {
|
add_action('admin_enqueue_scripts', function($hook) {
|
||||||
// Nur auf den Plugin-Seiten laden (optional: prüfe $hook!)
|
// Nur auf den Plugin-Seiten laden (optional: prüfe $hook!)
|
||||||
if (strpos($hook, 'kc_') !== false) {
|
if (strpos($hook, 'kc_') !== false) {
|
||||||
wp_enqueue_style(
|
wp_enqueue_style(
|
||||||
'kc-admin-style',
|
'kc-admin-style',
|
||||||
plugin_dir_url(__FILE__) . 'assets/kc-admin-style.css',
|
plugin_dir_url(__FILE__) . 'assets/kc-admin-style.css',
|
||||||
[],
|
[],
|
||||||
filemtime(plugin_dir_path(__FILE__) . 'assets/kc-admin-style.css')
|
filemtime(plugin_dir_path(__FILE__) . 'assets/kc-admin-style.css')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
add_action('admin_enqueue_scripts', function($hook) {
|
add_action('admin_enqueue_scripts', function($hook) {
|
||||||
// Nur für unser Plugin-Menü!
|
// Nur für unser Plugin-Menü!
|
||||||
if (strpos($hook, 'kc_') === false) return;
|
if (strpos($hook, 'kc_') === false) return;
|
||||||
wp_enqueue_script('select2', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js', ['jquery'], null, true);
|
wp_enqueue_script('select2', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js', ['jquery'], null, true);
|
||||||
wp_enqueue_style('select2', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css');
|
wp_enqueue_style('select2', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_action('wp_enqueue_scripts', function() {
|
add_action('wp_enqueue_scripts', function() {
|
||||||
wp_enqueue_style('kc-workshopwahl-form', plugins_url('assets/frontend-form.css', __FILE__));
|
wp_enqueue_style('kc-workshopwahl-form', plugins_url('assets/frontend-form.css', __FILE__));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Zentrale Admin-Menüstruktur
|
// Zentrale Admin-Menüstruktur
|
||||||
add_action('admin_menu', function() {
|
add_action('admin_menu', function() {
|
||||||
add_menu_page('Wahlen', 'Wahlen', 'manage_options', 'kc_wahlen', 'kc_wahlen_page');
|
add_menu_page('Wahlen', 'Wahlen', 'manage_options', 'kc_wahlen', 'kc_wahlen_page');
|
||||||
|
|
||||||
add_submenu_page('kc_wahlen', 'Teamer', 'Teamer', 'manage_options', 'kc_teamer', 'kc_teamer_page');
|
add_submenu_page('kc_wahlen', 'Teamer', 'Teamer', 'manage_options', 'kc_teamer', 'kc_teamer_page');
|
||||||
|
|
||||||
add_submenu_page('kc_wahlen', 'Workshops', 'Workshops', 'manage_options', 'kc_workshops', 'kc_workshops_page');
|
add_submenu_page('kc_wahlen', 'Workshops', 'Workshops', 'manage_options', 'kc_workshops', 'kc_workshops_page');
|
||||||
|
|
||||||
add_submenu_page('kc_wahlen', 'Teilnehmer', 'Teilnehmer', 'manage_options', 'kc_teilnehmer', 'kc_teilnehmer_page');
|
add_submenu_page('kc_wahlen', 'Teilnehmer', 'Teilnehmer', 'manage_options', 'kc_teilnehmer', 'kc_teilnehmer_page');
|
||||||
|
|
||||||
add_submenu_page('kc_wahlen', 'Force-Zuteilung', 'Force-Zuteilung', 'manage_options', 'kc_force_zuteilung', 'kc_force_zuteilung_page');
|
add_submenu_page('kc_wahlen', 'Force-Zuteilung', 'Force-Zuteilung', 'manage_options', 'kc_force_zuteilung', 'kc_force_zuteilung_page');
|
||||||
|
|
||||||
add_submenu_page('kc_wahlen', 'Zuteilungen', 'Zuteilungen', 'manage_options', 'kc_zuteilungen', 'kc_zuteilungen_page');
|
add_submenu_page('kc_wahlen', 'Zuteilungen', 'Zuteilungen', 'manage_options', 'kc_zuteilungen', 'kc_zuteilungen_page');
|
||||||
|
|
||||||
// Data management (test data) - visible only to super-admin (we'll check inside page)
|
// Data management (test data) - visible only to super-admin (we'll check inside page)
|
||||||
add_submenu_page('kc_wahlen', 'Datenverwaltung', 'Datenverwaltung', 'manage_options', 'kc_data', 'kc_data_page');
|
add_submenu_page('kc_wahlen', 'Datenverwaltung', 'Datenverwaltung', 'manage_options', 'kc_data', 'kc_data_page');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Includes – jede Admin-Seite ruft oben kc_admin_tabs() auf!
|
// Includes – jede Admin-Seite ruft oben kc_admin_tabs() auf!
|
||||||
require_once plugin_dir_path(__FILE__).'includes/admin-wahlen.php';
|
require_once plugin_dir_path(__FILE__).'includes/admin-wahlen.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/admin-workshops.php';
|
require_once plugin_dir_path(__FILE__).'includes/admin-workshops.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/admin-teilnehmer.php';
|
require_once plugin_dir_path(__FILE__).'includes/admin-teilnehmer.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/admin-teamer.php';
|
require_once plugin_dir_path(__FILE__).'includes/admin-teamer.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/force-zuteilung.php';
|
require_once plugin_dir_path(__FILE__).'includes/force-zuteilung.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/admin-zuteilungen.php';
|
require_once plugin_dir_path(__FILE__).'includes/admin-zuteilungen.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/frontend-form.php';
|
require_once plugin_dir_path(__FILE__).'includes/frontend-form.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/frontend-ergebnis.php';
|
require_once plugin_dir_path(__FILE__).'includes/frontend-ergebnis.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/zuteilungslogik.php';
|
require_once plugin_dir_path(__FILE__).'includes/zuteilungslogik.php';
|
||||||
require_once plugin_dir_path(__FILE__).'includes/admin-data.php';
|
require_once plugin_dir_path(__FILE__).'includes/admin-data.php';
|
||||||
require_once plugin_dir_path(__FILE__).'install.php';
|
require_once plugin_dir_path(__FILE__).'install.php';
|
||||||
Reference in New Issue
Block a user