added brettspillkvled event
This commit is contained in:
@@ -38,11 +38,11 @@ class AnimekveldActivity implements RepeatingActivity {
|
||||
}
|
||||
|
||||
public function getLocation() /* : Location */ {
|
||||
return "Peppes Kjøpmansgata";
|
||||
return "Koserommet";
|
||||
}
|
||||
|
||||
public function getOrganiser() /* : User */ {
|
||||
return "Anders Christensen";
|
||||
return "Liang Zhu";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,11 +16,11 @@ class AnimekveldEvent extends Event {
|
||||
}
|
||||
|
||||
public function getLocation() /* : Location */ {
|
||||
return "Peppes Kjøpmansgata";
|
||||
return "Koserommet";
|
||||
}
|
||||
|
||||
public function getOrganiser() /* : User */ {
|
||||
return "Anders Christensen";
|
||||
return "Liang Zhu";
|
||||
}
|
||||
|
||||
}
|
||||
|
48
src/pvv/side/social/brettspillactivity.php
Normal file
48
src/pvv/side/social/brettspillactivity.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php //declare(strict_types=1);
|
||||
namespace pvv\side\social;
|
||||
|
||||
use \pvv\side\RepeatingActivity;
|
||||
use \DateTimeImmutable;
|
||||
use \DateInterval;
|
||||
|
||||
class BrettspillActivity implements RepeatingActivity {
|
||||
|
||||
public function nextDate(DateTimeImmutable $date) {
|
||||
if ($date->format('H') > 20 || $date->format('H') == 19 && $date->format('i') > 30)
|
||||
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(19, 30, 0));
|
||||
$date = $date->setTime(19, 30, 0);
|
||||
if ($date->format('N') != 4)
|
||||
return $this->nextDate($date->add(new DateInterval('P1D')));
|
||||
return $date;
|
||||
}
|
||||
|
||||
public function prevDate(DateTimeImmutable $date) {
|
||||
if ($date->format('H') < 19 || $date->format('H') == 20 && $date->format('i') < 30)
|
||||
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(19, 30, 0));
|
||||
$date = $date->setTime(19, 30, 0);
|
||||
if ($date->format('N') != 4)
|
||||
return $this->prevDate($date->sub(new DateInterval('P1D')));
|
||||
return $date;
|
||||
}
|
||||
|
||||
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||
return new BrettspillEvent($this->nextDate($date));
|
||||
}
|
||||
|
||||
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||
return new BrettspillEvent($this->prevDate($date));
|
||||
}
|
||||
|
||||
public function getName() /* : string */ {
|
||||
return "Brettspillkveld";
|
||||
}
|
||||
|
||||
public function getLocation() /* : Location */ {
|
||||
return "Koserommet";
|
||||
}
|
||||
|
||||
public function getOrganiser() /* : User */ {
|
||||
return "PVV";
|
||||
}
|
||||
|
||||
}
|
26
src/pvv/side/social/brettspillevent.php
Normal file
26
src/pvv/side/social/brettspillevent.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php //declare(strict_types=1);
|
||||
namespace pvv\side\social;
|
||||
|
||||
use \pvv\side\Event;
|
||||
|
||||
use \DateInterval;
|
||||
|
||||
class BrettspillEvent extends Event {
|
||||
|
||||
public function getStop() {
|
||||
return $this->getStart()->add(new DateInterval('PT4H1800S'));
|
||||
}
|
||||
|
||||
public function getName() /* : string */ {
|
||||
return "Brettspillkveld";
|
||||
}
|
||||
|
||||
public function getLocation() /* : Location */ {
|
||||
return "Koserommet";
|
||||
}
|
||||
|
||||
public function getOrganiser() /* : User */ {
|
||||
return "PVV";
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user