ChaosBrunch Termin eingebunden
This commit is contained in:
parent
11f5b6fa4f
commit
d64e305b6b
|
@ -0,0 +1,15 @@
|
|||
ChaosBrunch
|
||||
Einmal in der Woche treffen wir uns regulär zum quatschen, basteln, frickeln, programmieren, hacken, kochen, essen, …
|
||||
{{ brunchdatum }}
|
||||
11:00 - 15:00
|
||||
Chaostreff Dortmund e.V.
|
||||
------------------------
|
||||
# Treff
|
||||
|
||||
Alle zwei Wochen an einem Sonntag lädt der CTDO zum **Mitbring-Brunch** in seinen Räume im Kulturzentrum [„Langer August“](/?page=treff) ein!
|
||||
|
||||
Um **ca. 11 Uhr** geht es los, das Ende ist wie immer offen. Die Details dazu gibt es im [ctdo wiki](https://wiki.ctdo.de/events/hackerbrunch)!
|
||||
|
||||
Schaut einfach vorab im [MitbringPad](https://md.ctdo.de/brunch) rein und kündigt an was ihr auf den Tisch werft, alles kann, nichts muss!
|
||||
|
||||
Es sind sowohl alte als auch neue Menschen gerne gesehen! Bringt was zu futtern, euer aktuelles Projekt, beides oder einfach nur Neugierde mit!
|
22
index.php
22
index.php
|
@ -58,7 +58,7 @@ switch ($topic->days) {
|
|||
|
||||
$treff = $util->get_next_treff();
|
||||
$trefflink = '<a href="/?page=events&id=treff">Treff</a>';
|
||||
switch ($topic->days) {
|
||||
switch ($treff->days) {
|
||||
case 0:
|
||||
$treff_output = '<p class="topic">Der nächste '.$trefflink.' findet heute statt!</p>';
|
||||
break;
|
||||
|
@ -72,7 +72,7 @@ switch ($topic->days) {
|
|||
|
||||
$repaircafe = $util->get_next_repaircafe();
|
||||
$repaircafelink = '<a href="/?page=events&id=repaircafe">RepairCafe</a>';
|
||||
switch ($topic->days) {
|
||||
switch ($repaircafe->days) {
|
||||
case 0:
|
||||
$repaircafe_output = '<p class="topic">Das nächste '.$repaircafelink.' findet heute statt!</p>';
|
||||
break;
|
||||
|
@ -84,6 +84,20 @@ switch ($topic->days) {
|
|||
break;
|
||||
}
|
||||
|
||||
$brunch = $util->get_next_brunch();
|
||||
$brunchlink = '<a href="/?page=events&id=brunch">ChaosBrunch</a>';
|
||||
switch ($brunch->days) {
|
||||
case 0:
|
||||
$brunch_output = '<p class="topic">Das nächste '.$brunchlink.' findet heute statt!</p>';
|
||||
break;
|
||||
case 1:
|
||||
$brunch_output = '<p class="topic">Das nächste '.$brunchlink.' findet morgen statt!</p>';
|
||||
break;
|
||||
default:
|
||||
$brunch_output = '<p class="topic">Das nächste '.$brunchlink.' findet in '.$brunch->days.' Tagen ['.$brunch->date.'] statt.</p>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($_GET['page'])) {
|
||||
$page = $_GET['page'];
|
||||
$active_page = $util->str_mass_replace(array('adresse', 'irc', 'mail'), array('kontakt', 'kontakt', 'kontakt'), $page);
|
||||
|
@ -112,10 +126,10 @@ if(isset($_GET['page'])) {
|
|||
break;
|
||||
case 'events':
|
||||
if(!isset($_GET['id'])) {
|
||||
$content = $twig_pages->render('events.html.twig', [ 'topic' => $topic_output, 'treff' => $treff_output, 'repaircafe' => $repaircafe_output, 'events' => $util->generate_event_list() ]);
|
||||
$content = $twig_pages->render('events.html.twig', [ 'topic' => $topic_output, 'treff' => $treff_output, 'repaircafe' => $repaircafe_output, 'brunch' => $brunch_output, 'events' => $util->generate_event_list() ]);
|
||||
$head = $util->css_link('css/main.css').$util->css_link('css/events.css');
|
||||
} else {
|
||||
$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'])));
|
||||
$content = $util->str_mass_replace(array('{{ topicdatum }}', 'Chaostreff Dortmund e.V.', '{{ treffdatum }}', '{{ repaircafedatum }}', '{{ brunchdatum }}'), 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, $util->get_next_brunch()->date), $converter->convert($util->get_event_content($_GET['id'])));
|
||||
$head = $util->css_link('css/main.css').$util->css_link('css/event.css');
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
{{ topic | raw }}
|
||||
{{ treff | raw }}
|
||||
{{ repaircafe | raw }}
|
||||
{{ brunch | raw }}
|
||||
{{ events | raw }}
|
32
php/util.php
32
php/util.php
|
@ -90,7 +90,7 @@ class Util {
|
|||
$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')
|
||||
if(count(str_split($f)) >= 4 && $f != 'treff.md' && $f != 'topictreff.md' && $f != 'repaircafe.md' && $f != 'brunch.md')
|
||||
$output[] = $f;
|
||||
}
|
||||
return $output;
|
||||
|
@ -162,7 +162,7 @@ class Util {
|
|||
$diff = $now->diff(new DateTime());
|
||||
$days_until = $diff->format('%a');
|
||||
|
||||
$output->days = $days_until;
|
||||
$output->days = $days_until+1;
|
||||
$output->date = $now->format('Y-m-d');
|
||||
// Return an array with the count and date of the next Friday
|
||||
return $output;
|
||||
|
@ -181,11 +181,37 @@ class Util {
|
|||
|
||||
$daysUntilLastThursday = $today->diff($lastThursday)->days;
|
||||
|
||||
$output->days = $daysUntilLastThursday + 1;
|
||||
$output->days = $daysUntilLastThursday;
|
||||
$output->date = $lastThursday->format('Y-m-d');
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function get_next_brunch() {
|
||||
$now = new DateTime();
|
||||
|
||||
if ($now->format('w') == 0) {
|
||||
$nextSunday = clone $now;
|
||||
} else {
|
||||
$nextSunday = new DateTime('next Sunday');
|
||||
}
|
||||
|
||||
$weekNumber = (int)$nextSunday->format('W');
|
||||
$isEvenWeek = ($weekNumber % 2) == 0;
|
||||
|
||||
if ($isEvenWeek) {
|
||||
$nextSunday->modify('+1 week');
|
||||
}
|
||||
|
||||
$differenz = $nextSunday->diff($now);
|
||||
$days = $differenz->days;
|
||||
|
||||
$output = new stdClass();
|
||||
$output->date = $nextSunday->format('Y-m-d');
|
||||
$output->days = $days+1;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@ require __DIR__ . '/php/util.php';
|
|||
|
||||
$u = new Util();
|
||||
|
||||
echo var_dump($u->get_next_repaircafe());
|
||||
echo var_dump($u->get_next_brunch());
|
Loading…
Reference in New Issue