diff --git a/README.md b/README.md index 757dad1..35a1700 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Composer will check for the php extension `pdo_sqlite` which must be enabled on [PHP] extension=pdo_sqlite extension=sqlite3 + extension=ext-curl Composer is used as such: diff --git a/inc/include.php b/inc/include.php index 01d9a56..a80ec96 100644 --- a/inc/include.php +++ b/inc/include.php @@ -27,6 +27,7 @@ use \pvv\side\Agenda; $agenda = new \pvv\side\Agenda([ new \pvv\side\social\NerdepitsaActivity, new \pvv\side\social\AnimekveldActivity, + new \pvv\side\social\Driftkveld, new \pvv\side\DBActivity($pdo), ]); diff --git a/src/pvv/side/social/driftkveldactivity.php b/src/pvv/side/social/driftkveldactivity.php new file mode 100644 index 0000000..97ebc73 --- /dev/null +++ b/src/pvv/side/social/driftkveldactivity.php @@ -0,0 +1,36 @@ +format('H') > 18 || $date->format('H') == 17 && $date->format('i') > 30) + return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(18, 15, 0)); + $date = $date->setTime(18, 15, 0); + if ($date->format('N') != 2) + return $this->nextDate($date->add(new DateInterval('P1D'))); + return $date; + } + + public function prevDate(DateTimeImmutable $date) { + if ($date->format('H') < 17 || $date->format('H') == 18 && $date->format('i') < 30) + return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(18, 15, 0)); + $date = $date->setTime(18, 15, 0); + if ($date->format('N') != 2) + return $this->prevDate($date->sub(new DateInterval('P1D'))); + return $date; + } + + public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ { + return new DriftkveldEvent($this->nextDate($date)); + } + + public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ { + return new DriftkveldEvent($this->prevDate($date)); + } + +} diff --git a/src/pvv/side/social/driftkveldevent.php b/src/pvv/side/social/driftkveldevent.php new file mode 100644 index 0000000..689f918 --- /dev/null +++ b/src/pvv/side/social/driftkveldevent.php @@ -0,0 +1,49 @@ +getStart()->add(new DateInterval('PT4H1800S')); + } + + public function getName() /* : string */ { + return "Driftkveld"; + } + + public function getLocation() /* : Location */ { + return "Terminalrommet / Discord / IRC"; + } + + public function getOrganiser() /* : User */ { + return "Torstein Nordgård-Hansen"; + } + + public function getURL() /* : string */ { + return '/drift/'; + } + + public function getImageURL() { + return '/sosiale/drift.jpg'; + } + + public function getDescription() { + return [ + 'Vil du drifte?', + 'Vil du være kul kis TM?', + 'Kom på driftkveld!', + '', + 'Vi møtes en gang i uka for å ta unna driftarbeid og drikke kaffe.', + 'Alle PVVere er velkommene, enten de er erfarne driftere eller helt utenforstående!' + ]; + } + + public function getColor() { + return "#35a"; + } + +} diff --git a/www/drift/index.php b/www/drift/index.php new file mode 100644 index 0000000..c2d2f0b --- /dev/null +++ b/www/drift/index.php @@ -0,0 +1,59 @@ + + + + + + + + + + + +Drifterverkstedet + +
Sosial­verk­stedet
+ + +
+ +getNextEventFrom(new DateTimeImmutable); +?> + +
+

getRelativeDate()?> Driftkveld + getImageURL()) { ?> + + +

+ + + text(implode("\n", $nextEvent->getDescription())); + ?> +
+ +
+ + diff --git a/www/sosiale/drift.jpg b/www/sosiale/drift.jpg new file mode 100644 index 0000000..4d2ad7b Binary files /dev/null and b/www/sosiale/drift.jpg differ