Merge pull request #19 from Programvareverkstedet/calendarChanges
Lagt til hackekveld fjerdehver uke
This commit is contained in:
commit
ab6edd92e1
@ -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),
|
||||
]);
|
||||
|
40
src/pvv/side/social/hackekveldactivity.php
Normal file
40
src/pvv/side/social/hackekveldactivity.php
Normal 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));
|
||||
}
|
||||
|
||||
}
|
45
src/pvv/side/social/hackekveldevent.php
Normal file
45
src/pvv/side/social/hackekveldevent.php
Normal 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";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user