Projects/nettsiden-old
Projects
/
nettsiden-old
Archived
8
0
Fork 0

Merge pull request #19 from Programvareverkstedet/calendarChanges

Lagt til hackekveld fjerdehver uke
This commit is contained in:
Felix Albrigtsen 2022-03-15 13:11:13 +01:00 committed by GitHub
commit ab6edd92e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 0 deletions

View File

@ -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\HackekveldActivity,
new \pvv\side\social\DriftkveldActivity,
new \pvv\side\DBActivity($pdo),
]);

View File

@ -0,0 +1,40 @@
<?php //declare(strict_types=1);
namespace pvv\side\social;
use \pvv\side\Activity;
use \DateTimeImmutable;
use \DateInterval;
class HackekveldActivity implements Activity {
public function nextDate(DateTimeImmutable $date) {
if ($date->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(16, 15, 0);
if ($date->format('N') != 6)
return $this->nextDate($date->add(new DateInterval('P1D')));
if ($date->format('W') % 4 - 3)
return $this->nextDate($date->add(new DateInterval('P7D')));
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') != 6)
return $this->prevDate($date->sub(new DateInterval('P1D')));
if ($date->format('W') % 4 - 3)
return $this->prevDate($date->sub(new DateInterval('P7D')));
return $date;
}
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
return new HackekveldEvent($this->nextDate($date));
}
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
return new HackekveldEvent($this->prevDate($date));
}
}

View File

@ -0,0 +1,45 @@
<?php //declare(strict_types=1);
namespace pvv\side\social;
use \pvv\side\Event;
use \DateInterval;
class HackekveldEvent extends Event {
public function getStop() {
return $this->getStart()->add(new DateInterval('PT4H1800S'));
}
public function getName() /* : string */ {
return "Hackekveld";
}
public function getLocation() /* : Location */ {
return "Terminalrommet / Discord / IRC";
}
public function getOrganiser() /* : User */ {
return "PVV";
}
public function getURL() /* : string */ {
return '#';
}
public function getImageURL() {
return '/pvv-logo.png';
}
public function getDescription() {
return [
'Mange PVV-medlemmer liker å programmere.',
'Hvis du også liker å programmere, så bli med! Her kan du jobbe med dine egne prosjekter eller starte noe med andre nerder her på huset. Vi møtes for en hyggelig prat, mye god programmering og delsponset pizza.'
];
}
public function getColor() {
return "#35a";
}
}