diff --git a/src/pvv/side/activity.php b/src/pvv/side/activity.php
index 6799d4f..b860fdd 100644
--- a/src/pvv/side/activity.php
+++ b/src/pvv/side/activity.php
@@ -1,7 +1,7 @@
activities = [
+ new NerdepitsaActivity,
+ new AnimekveldActivity,
+ ];
+ }
+
+ public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) {
+ $results = [[], []];
+ do {
+ $run = false;
+ for($i = 0; $i < sizeof($this->activities); $i++) {
+ if (sizeof($results[$i])) {
+ $date = end($results[$i])->getStop();
+ } else {
+ $date = $from;
+ }
+ $next = $this->activities[$i]->getNextEventFrom($date);
+ if (isset($next) && $next->getStart() < $to) {
+ $results[$i][] = $this->activities[$i]->getNextEventFrom($date);
+ $run = true;
+ }
+ }
+ } while ($run);
+ $result = [];
+ foreach($results as $a) foreach($a as $b) $result[] = $b;
+ usort($result, function($a, $b) {
+ return ($a->getStart() < $b->getStart()) ? -1 : 1;
+ });
+ return $result;
+ }
+
+ public function getNextDays() {
+ $result = [[], [], [], [], []];
+ $events = $this->getEventsBetween(
+ (new DateTimeImmutable)->sub(new DateInterval('PT1H')),
+ (new DateTimeImmutable)->add(new DateInterval('P1M'))
+ );
+ foreach ($events as $event) {
+ $index = self::NEXT_MONTH;
+ if (self::isToday($event->getStart())) $index = self::TODAY;
+ elseif (self::isTomorrow($event->getStart())) $index = self::TOMORROW;
+ elseif (self::isThisWeek($event->getStart())) $index = self::THIS_WEEK;
+ elseif (self::isThisMonth($event->getStart())) $index = self::THIS_MONTH;
+ $result[$index][] = $event;
+ }
+ return $result;
+ }
+
+ public static function isToday(DateTimeImmutable $date) {
+ return $date->format('dmY') == date('dmY');
+ }
+
+ public static function isTomorrow(DateTimeImmutable $date) {
+ return $date->sub(new DateInterval('P1D'))->format('dmY') == date('dmY');
+ }
+
+ public static function isThisWeek(DateTimeImmutable $date) {
+ return $date->format('WY') == date('WY');
+ }
+
+ public static function isThisMonth(DateTimeImmutable $date) {
+ return $date->format('mY') == date('mY');
+ }
+
+}
diff --git a/src/pvv/side/event.php b/src/pvv/side/event.php
index 9b10eb1..0affb9d 100644
--- a/src/pvv/side/event.php
+++ b/src/pvv/side/event.php
@@ -1,10 +1,20 @@
start = $start;
+ }
+
+ public function getStart() {
+ return $this->start;
+ }
+
+ public abstract function getStop(); /* : DateTimeImmutable */
}
diff --git a/src/pvv/side/social/animekveldactivity.php b/src/pvv/side/social/animekveldactivity.php
index f2a10cd..89ca88c 100644
--- a/src/pvv/side/social/animekveldactivity.php
+++ b/src/pvv/side/social/animekveldactivity.php
@@ -1,10 +1,11 @@
format('H') > 20 || $date->format('H') == 19 && $date->format('i') > 30)
diff --git a/src/pvv/side/social/animekveldevent.php b/src/pvv/side/social/animekveldevent.php
new file mode 100644
index 0000000..f8ad6d8
--- /dev/null
+++ b/src/pvv/side/social/animekveldevent.php
@@ -0,0 +1,26 @@
+getStart()->add(new DateInterval('PT4H1800S'));
+ }
+
+ public function getName() /* : string */ {
+ return "Animekveld";
+ }
+
+ public function getLocation() /* : Location */ {
+ return "Peppes Kjøpmansgata";
+ }
+
+ public function getOrganiser() /* : User */ {
+ return "Anders Christensen";
+ }
+
+}
diff --git a/src/pvv/side/social/nerdepitsaevent.php b/src/pvv/side/social/nerdepitsaevent.php
new file mode 100644
index 0000000..83b764c
--- /dev/null
+++ b/src/pvv/side/social/nerdepitsaevent.php
@@ -0,0 +1,26 @@
+getStart()->add(new DateInterval('PT2H1800S'));
+ }
+
+ public function getName() {
+ return "Nerdepitsa";
+ }
+
+ public function getLocation() /* : Location */ {
+ return "Peppes Kjøpmansgata";
+ }
+
+ public function getOrganiser() /* : User */ {
+ return "Anders Christensen";
+ }
+
+}
diff --git a/www/index.php b/www/index.php
index dfa291d..2bc016c 100644
--- a/www/index.php
+++ b/www/index.php
@@ -1,4 +1,9 @@
+<<<<<<< e4e8b0972bbec3fff581f7a97b34315265104f3a
+=======
+
+
+>>>>>>> Add automatic agenda on front page.
Programvareverkstedet
@@ -36,69 +41,21 @@
Kommende arrangement
-
-
-
-start = $start;$this->name=$name;}
-# function getName(){return $this->name;}
-# function getStart(){return $this->start;}
-#}
-/* $evs = new Events(); */
-/* $events = $evs->getAllEvents(); */
-/* # TEST END */
-/* animekveld */
-
-/* echo "i dag".date("Y-m-d")."
"; */
-/* echo "
Flere aktiviteter