Events eingebunden und funktionell.
This commit is contained in:
parent
9969bfcc15
commit
11f5b6fa4f
|
@ -0,0 +1,9 @@
|
||||||
|
Testeintrag
|
||||||
|
Ein wunderbarer Testeintrag.
|
||||||
|
2023-05-10 - 2023-05-16
|
||||||
|
16:00 - 20:00
|
||||||
|
Chaostreff Dortmund e.V.
|
||||||
|
------------------------
|
||||||
|
# Testeintrag
|
||||||
|
|
||||||
|
Dies ist ein wundervoller Test!
|
|
@ -0,0 +1,26 @@
|
||||||
|
RepairCafe
|
||||||
|
“ Wegwerfen? Denk’ste! „
|
||||||
|
{{ repaircafedatum }}
|
||||||
|
19:00 - 23:00
|
||||||
|
Chaostreff Dortmund e.V.
|
||||||
|
------------------------
|
||||||
|
# RepairCafe
|
||||||
|
|
||||||
|
![ctdo repaircafe logo](/images/events/ctdo-logo-reperaturcafe.png)
|
||||||
|
|
||||||
|
Seit Ende Juni 2014 bietet der Chaostreff Dortmund an jedem letzten Donnerstag im Monat ab 19 Uhr ein Repair Café an. Dazu ist jeder eingeladen, defekte Geräte, sei es der Küchenmixer, Notebook oder der alte Plattenspieler, mitzubringen und selber zu reparieren. Technischen Sachverstand, Rat und auch Tat wird es von uns geben. Wir helfen wo wir können – reparieren müsst ihr aber selber – das ist der Grundgedanke des Repair Cafés. Als Stärkung haben wir natürlich Getränke und Snacks.
|
||||||
|
|
||||||
|
Bereits Anfang Juni 2014 startete unser Repair Cafe, welches wir im Rahmen des Projekts Selber Machen! speziell für Kinder und Jugendliche zwischen 8 und 16 Jahren angeboten haben.
|
||||||
|
|
||||||
|
Seit dem Start des normalen Repair Cafes für jedermann/frau konnten wir bereits einigen Geräten neues Leben einhauchen. Manchmal ist es nur eine kalte Lötstelle, ein gebrochenes Kabel oder eine defekte Sicherung, die das gesamte Gerät lahmlegen. Im Wiki gibt es weitere Informationen zum Repair Cafe.
|
||||||
|
|
||||||
|
Hier noch mal auf einen Blick:
|
||||||
|
|
||||||
|
Repair Café: jeden letzten Donnerstag im Monat ab 19 Uhr im Chaostreff Dortmund
|
||||||
|
Wir sind auch auf [www.repaircafe.org](https://www.repaircafe.org/) eingetragen.
|
||||||
|
|
||||||
|
Du findest uns in der Braunschweiger Str 22, 44145 Dortmund im „Langen August“. Geh durch das große rote Tor und klingel beim „Chaostreff“. Zweites OG. Per E-Mail kannst du uns über die [Mailingliste](/?page=mail) erreichen.
|
||||||
|
|
||||||
|
Anmeldung nicht erforderlich!
|
||||||
|
|
||||||
|
Achtung: Bei Smartphones, Tablets und zum Großteil bei Apple Produkten können wir leider nicht behilflich sein.
|
|
@ -0,0 +1,9 @@
|
||||||
|
TopicTreff (Plenum)
|
||||||
|
Der Topictreff ist das zweimal im Monat stattfindende Plenum des CTDO.
|
||||||
|
{{ topicdatum }}
|
||||||
|
20:00 - 21:00
|
||||||
|
Chaostreff Dortmund e.V.
|
||||||
|
------------------------
|
||||||
|
# TopicTreff (Plenum)
|
||||||
|
|
||||||
|
Der Topictreff ist das zweimal im Monat stattfindende Plenum des CTDO. Aktuelle Themen können im [Wiki](https://wiki.ctdo.de/de/verein/topictreff) eingesehen werden.
|
|
@ -0,0 +1,13 @@
|
||||||
|
Treff
|
||||||
|
Einmal in der Woche treffen wir uns regulär zum quatschen, basteln, frickeln, programmieren, hacken, kochen, essen, …
|
||||||
|
{{ treffdatum }}
|
||||||
|
19:00 - ende offen
|
||||||
|
Chaostreff Dortmund e.V.
|
||||||
|
------------------------
|
||||||
|
# Treff
|
||||||
|
|
||||||
|
Einmal in der Woche treffen wir uns regulär zum quatschen, basteln, frickeln, programmieren, hacken, kochen, essen, …
|
||||||
|
|
||||||
|
Los gehts wenn Jemand da ist (meist ab 19 Uhr). Ende offen.
|
||||||
|
|
||||||
|
Es darf jeder kommen, egal ob Mitglied oder nicht. Wenn du unsicher bist, ob Jemand da ist, wie lange Jemand bleibt: ruf gerne an, oder frage im Chat nach.
|
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
42
index.php
42
index.php
|
@ -43,15 +43,44 @@ if(gettype($raumstatus_b) == "boolean") {
|
||||||
}
|
}
|
||||||
|
|
||||||
$topic = $util->get_next_topic();
|
$topic = $util->get_next_topic();
|
||||||
|
$topiclink = '<a href="/?page=events&id=topictreff">Topictreff</a>';
|
||||||
switch ($topic->days) {
|
switch ($topic->days) {
|
||||||
case 0:
|
case 0:
|
||||||
$topic_output = '<p class="topic">Der nächste Topictreff findet heute statt!</p>';
|
$topic_output = '<p class="topic">Der nächste '.$topiclink.' findet heute statt!</p>';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$topic_output = '<p class="topic">Der nächste Topictreff findet morgen statt!</p>';
|
$topic_output = '<p class="topic">Der nächste '.$topiclink.' findet morgen statt!</p>';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$topic_output = '<p class="topic">Der nächste Topictreff findet in '.$topic->days.' Tagen ['.$topic->date.'] statt.</p>';
|
$topic_output = '<p class="topic">Der nächste '.$topiclink.' findet in '.$topic->days.' Tagen ['.$topic->date.'] statt.</p>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$treff = $util->get_next_treff();
|
||||||
|
$trefflink = '<a href="/?page=events&id=treff">Treff</a>';
|
||||||
|
switch ($topic->days) {
|
||||||
|
case 0:
|
||||||
|
$treff_output = '<p class="topic">Der nächste '.$trefflink.' findet heute statt!</p>';
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$treff_output = '<p class="topic">Der nächste '.$trefflink.' findet morgen statt!</p>';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$treff_output = '<p class="topic">Der nächste '.$trefflink.' findet in '.$treff->days.' Tagen ['.$treff->date.'] statt.</p>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$repaircafe = $util->get_next_repaircafe();
|
||||||
|
$repaircafelink = '<a href="/?page=events&id=repaircafe">RepairCafe</a>';
|
||||||
|
switch ($topic->days) {
|
||||||
|
case 0:
|
||||||
|
$repaircafe_output = '<p class="topic">Das nächste '.$repaircafelink.' findet heute statt!</p>';
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$repaircafe_output = '<p class="topic">Das nächste '.$repaircafelink.' findet morgen statt!</p>';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$repaircafe_output = '<p class="topic">Das nächste '.$repaircafelink.' findet in '.$repaircafe->days.' Tagen ['.$repaircafe->date.'] statt.</p>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,11 +111,11 @@ if(isset($_GET['page'])) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'events':
|
case 'events':
|
||||||
if(!isset($_GET['e'])) {
|
if(!isset($_GET['id'])) {
|
||||||
$content = $twig_pages->render('events.html.twig', [ 'topic' => $topic_output, 'events' => $util->generate_post_list() ]);
|
$content = $twig_pages->render('events.html.twig', [ 'topic' => $topic_output, 'treff' => $treff_output, 'repaircafe' => $repaircafe_output, 'events' => $util->generate_event_list() ]);
|
||||||
$head = $util->css_link('css/main.css').$util->css_link('css/events.css');
|
$head = $util->css_link('css/main.css').$util->css_link('css/events.css');
|
||||||
} else {
|
} else {
|
||||||
$content = $converter->convert($util->get_post_content($_GET['e']));
|
$content = $util->str_mass_replace(array('{{ topicdatum }}', 'Chaostreff Dortmund e.V.', '{{ treffdatum }}', '{{ repaircafedatum }}'), array($util->get_next_topic()->date, $util->html_link('/?page=treff', '', 'Chaostreff Dortmund e.V.', FALSE), $util->get_next_treff()->date, $util->get_next_repaircafe()->date), $converter->convert($util->get_event_content($_GET['id'])));
|
||||||
$head = $util->css_link('css/main.css').$util->css_link('css/event.css');
|
$head = $util->css_link('css/main.css').$util->css_link('css/event.css');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -130,6 +159,7 @@ if(isset($_GET['page'])) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$content = $twig_pages->render('404.html.twig', ['page' => $_GET['page']]);
|
$content = $twig_pages->render('404.html.twig', ['page' => $_GET['page']]);
|
||||||
|
$head = $util->css_link('css/main.css');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
<h1>Events</h1>
|
<h1>Events</h1>
|
||||||
{{ topic | raw }}
|
{{ topic | raw }}
|
||||||
|
{{ treff | raw }}
|
||||||
|
{{ repaircafe | raw }}
|
||||||
{{ events | raw }}
|
{{ events | raw }}
|
91
php/util.php
91
php/util.php
|
@ -38,6 +38,7 @@ class Util {
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Posts
|
||||||
function scan_for_posts() {
|
function scan_for_posts() {
|
||||||
$s = scandir(__DIR__ . '/../posts/', SCANDIR_SORT_DESCENDING);
|
$s = scandir(__DIR__ . '/../posts/', SCANDIR_SORT_DESCENDING);
|
||||||
$output = array();
|
$output = array();
|
||||||
|
@ -69,7 +70,7 @@ class Util {
|
||||||
$desc = $lines[1];
|
$desc = $lines[1];
|
||||||
$date = $lines[2];
|
$date = $lines[2];
|
||||||
$signatur = $lines[3];
|
$signatur = $lines[3];
|
||||||
$output .= '<div class="eventblock"><h3 class="a">'.$signatur.'</h3><h3 class="b">'.$date.'</h3><a href="?page=blog&id='.str_replace('.md', '', $event).'"><h2>'.$title.'</h2><p>'.$desc.'</p></a></div>';
|
$output .= '<div class="eventblock"><h3 class="a">'.$signatur.'</h3><h3 class="b">'.$date.'</h3><a href="?page=blog&id='.str_replace('.md', '', $events[$i]).'"><h2>'.$title.'</h2><p>'.$desc.'</p></a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
|
@ -82,6 +83,56 @@ class Util {
|
||||||
$output .= $lines[$i] . "\n";
|
$output .= $lines[$i] . "\n";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
//Posts end
|
||||||
|
|
||||||
|
//Events
|
||||||
|
function scan_for_events() {
|
||||||
|
$s = scandir(__DIR__ . '/../events/', SCANDIR_SORT_DESCENDING);
|
||||||
|
$output = array();
|
||||||
|
foreach ($s as $f) {
|
||||||
|
if(count(str_split($f)) >= 4 && $f != 'treff.md' && $f != 'topictreff.md' && $f != 'repaircafe.md')
|
||||||
|
$output[] = $f;
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generate_event_list($limit = -1) {
|
||||||
|
$events = $this->scan_for_events();
|
||||||
|
$output = "";
|
||||||
|
if ($limit == -1) {
|
||||||
|
foreach ($events as $event) {
|
||||||
|
$lines = file(__DIR__ . '/../events/' . $event);
|
||||||
|
$title = $lines[0];
|
||||||
|
$desc = $lines[1];
|
||||||
|
$date = $lines[2];
|
||||||
|
$veranstaltungsort = $lines[4];
|
||||||
|
$output .= '<div class="eventblock"><a href="?page=events&id='.str_replace('.md', '', $event).'"><h3 class="a">'.$veranstaltungsort.'</h3><h3 class="b">'.$date.'</h3><h2>'.$title.'</h2><p>'.$desc.'</p></a></div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($limit > count($events))
|
||||||
|
$limit = count($events);
|
||||||
|
for ($i = 0; $i < $limit; $i++) {
|
||||||
|
$lines = file(__DIR__ . '/../events/' . $event);
|
||||||
|
$title = $lines[0];
|
||||||
|
$desc = $lines[1];
|
||||||
|
$date = $lines[2];
|
||||||
|
$veranstaltungsort = $lines[4];
|
||||||
|
$output .= '<div class="eventblock"><a href="?page=events&id='.str_replace('.md', '', $event).'"><h3 class="a">'.$veranstaltungsort.'</h3><h3 class="b">'.$date.'</h3><h2>'.$title.'</h2><p>'.$desc.'</p></a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_event_content($id) {
|
||||||
|
$lines = file(__DIR__ . '/../events/' . str_replace('.', '', $id) . '.md');
|
||||||
|
$output = "";
|
||||||
|
$output .= '## Datum/Zeit'."\n\n";
|
||||||
|
$output .= $lines[2]."\n".$lines[3]."\n\n## Veranstaltungsort\n\n".$lines[4]."\n\n";
|
||||||
|
for ($i = 6; $i < count($lines); $i++)
|
||||||
|
$output .= $lines[$i] . "\n";
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
//Events end
|
||||||
|
|
||||||
function get_next_topic() {
|
function get_next_topic() {
|
||||||
$output = new stdClass();
|
$output = new stdClass();
|
||||||
|
@ -98,6 +149,44 @@ class Util {
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_next_treff() {
|
||||||
|
$output = new stdClass();
|
||||||
|
// Get current date and time
|
||||||
|
$now = new DateTime();
|
||||||
|
|
||||||
|
// Find the next Friday
|
||||||
|
$now->modify('next Friday');
|
||||||
|
|
||||||
|
// Calculate the number of days until the next Friday
|
||||||
|
$diff = $now->diff(new DateTime());
|
||||||
|
$days_until = $diff->format('%a');
|
||||||
|
|
||||||
|
$output->days = $days_until;
|
||||||
|
$output->date = $now->format('Y-m-d');
|
||||||
|
// Return an array with the count and date of the next Friday
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_next_repaircafe() {
|
||||||
|
$output = new stdClass();
|
||||||
|
$today = new DateTime();
|
||||||
|
$lastDayOfMonth = clone $today;
|
||||||
|
$lastDayOfMonth->modify('last day of this month');
|
||||||
|
$lastThursday = clone $lastDayOfMonth;
|
||||||
|
|
||||||
|
while ($lastThursday->format('w') != 4) { // Thursday is represented by 4 (0-6, where 0 is Sunday)
|
||||||
|
$lastThursday->modify('-1 day');
|
||||||
|
}
|
||||||
|
|
||||||
|
$daysUntilLastThursday = $today->diff($lastThursday)->days;
|
||||||
|
|
||||||
|
$output->days = $daysUntilLastThursday + 1;
|
||||||
|
$output->date = $lastThursday->format('Y-m-d');
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -4,4 +4,4 @@ require __DIR__ . '/php/util.php';
|
||||||
|
|
||||||
$u = new Util();
|
$u = new Util();
|
||||||
|
|
||||||
echo var_dump($u->scan_for_posts());
|
echo var_dump($u->get_next_repaircafe());
|
Loading…
Reference in New Issue