added brettspillkvled event

This commit is contained in:
Liang Zhu 2016-08-19 23:46:30 +02:00
parent 10fdc27b2b
commit 29f0afa31f
6 changed files with 88 additions and 10 deletions

View File

@ -38,11 +38,11 @@ class AnimekveldActivity implements RepeatingActivity {
} }
public function getLocation() /* : Location */ { public function getLocation() /* : Location */ {
return "Peppes Kjøpmansgata"; return "Koserommet";
} }
public function getOrganiser() /* : User */ { public function getOrganiser() /* : User */ {
return "Anders Christensen"; return "Liang Zhu";
} }
} }

View File

@ -16,11 +16,11 @@ class AnimekveldEvent extends Event {
} }
public function getLocation() /* : Location */ { public function getLocation() /* : Location */ {
return "Peppes Kjøpmansgata"; return "Koserommet";
} }
public function getOrganiser() /* : User */ { public function getOrganiser() /* : User */ {
return "Anders Christensen"; return "Liang Zhu";
} }
} }

View 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";
}
}

View 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";
}
}

View File

@ -8,6 +8,7 @@ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$agenda = new \pvv\side\Agenda([ $agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity, new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity, new \pvv\side\social\AnimekveldActivity,
new \pvv\side\social\BrettspillActivity,
new \pvv\side\DBActivity($pdo), new \pvv\side\DBActivity($pdo),
]); ?> ]); ?>
<!DOCTYPE html> <!DOCTYPE html>

View File

@ -46,18 +46,21 @@
<p><a class="btn" href="#b_spill">Vår samling</a> <p><a class="btn" href="#b_spill">Vår samling</a>
<ul id="b_spill" class="collapsable"> <ul id="b_spill" class="collapsable">
<li>Dominion <li>Dominion*
<li>Three cheers for master <li>Three cheers for master
<li>Avalon <li>Avalon
<li>Cards aginst humanity <li>Hanabi
<li>Cards aginst humanity*
<li>Citadels <li>Citadels
<li>Munchkin <li>Munchkin**
<li>Exploding kittens <li>Exploding kittens**
<li>Aye dark overlord <li>Aye dark overlord
<li>Settlers of catan <li>Settlers of catan*
<li>Risk <li>Risk**
<li>og mange flere... <li>og mange flere...
</ul> </ul>
<p>* Vi har flere ekspansjon til spillet
<P>** Vi har flere varianter av spillet
<p><a class="btn" href="#">Påminn meg</a> <p><a class="btn" href="#">Påminn meg</a>
</article> </article>