diff --git a/src/pvv/side/activity.php b/src/pvv/side/activity.php
index b860fdd..9fd6a46 100644
--- a/src/pvv/side/activity.php
+++ b/src/pvv/side/activity.php
@@ -5,10 +5,8 @@ use \DateTimeImmutable;
interface Activity {
- public function getName(); /* : string */
+ public function getNextEventFrom(DateTimeImmutable $date) /* : Event */;
- public function getLocation(); /* : Location */
-
- public function getOrganiser(); /* : User */
+ public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */;
}
diff --git a/src/pvv/side/dbactivity.php b/src/pvv/side/dbactivity.php
index 8b4929f..5362e06 100644
--- a/src/pvv/side/dbactivity.php
+++ b/src/pvv/side/dbactivity.php
@@ -4,7 +4,7 @@ namespace pvv\side;
use \DateTimeImmutable;
use \PDO;
-class DBActivity implements RepeatingActivity {
+class DBActivity implements Activity {
public function __construct(PDO $pdo) {
$this->pdo = $pdo;
@@ -48,18 +48,4 @@ class DBActivity implements RepeatingActivity {
return "User";
}
- /*
- public function getAllEvents(){
- global $url, $user,$pass,$db;
- $events = array();
- $mysqli = new mysqli($url,$user,$pass,$db);
- $result = $mysqli->query("SELECT name,start,stop,organiser,location FROM events");
- while($row = $result->fetch_assoc()){
- $ev = new OnceEvent($row['name'],$row['start'],$row['stop'],$row['organiser'],$row['location']);
- array_push($events,$ev);
- }
- #array_sort($events);
- return $events;
- }
- */
}
diff --git a/src/pvv/side/event.php b/src/pvv/side/event.php
index 0affb9d..76eab76 100644
--- a/src/pvv/side/event.php
+++ b/src/pvv/side/event.php
@@ -3,7 +3,7 @@ namespace pvv\side;
use \DateTimeImmutable;
-abstract class Event implements Activity {
+abstract class Event {
private $start;
@@ -17,4 +17,6 @@ abstract class Event implements Activity {
public abstract function getStop(); /* : DateTimeImmutable */
+ public abstract function getURL(); /* : string */
+
}
diff --git a/src/pvv/side/events.php b/src/pvv/side/events.php
deleted file mode 100644
index 68e8320..0000000
--- a/src/pvv/side/events.php
+++ /dev/null
@@ -1,21 +0,0 @@
-query("SELECT name,start,stop,organiser,location FROM events");
- while($row = $result->fetch_assoc()){
- $ev = new OnceEvent($row['name'],$row['start'],$row['stop'],$row['organiser'],$row['location']);
- array_push($events,$ev);
- }
- #array_sort($events);
- return $events;
- }
-}
-
-?>
diff --git a/src/pvv/side/onceevent.php b/src/pvv/side/onceevent.php
deleted file mode 100644
index 3b41413..0000000
--- a/src/pvv/side/onceevent.php
+++ /dev/null
@@ -1,30 +0,0 @@
-name = $name;
- $this->start = $start;
- $this->end = $end;
- $this->org = $org;
- $this->log = $loc;
- }
- public function getStart(){
- return $this->start;
- }
- public function getStop(){
- return $this->end;
- }
- public function getOrganiser(){
- return $this->org;
- }
- public function getLocation(){
- return $this->loc;
- }
- public function getName(){
- return $this->name;
- }
-
-}
-
diff --git a/src/pvv/side/repeatingactivity.php b/src/pvv/side/repeatingactivity.php
deleted file mode 100644
index 9bcda82..0000000
--- a/src/pvv/side/repeatingactivity.php
+++ /dev/null
@@ -1,12 +0,0 @@
-name = $name;
+ $this->start = $start;
+ $this->end = $end;
+ $this->org = $org;
+ $this->log = $loc;
+ }
+
+ public function getStart(){
+ return $this->start;
+ }
+
+ public function getStop(){
+ return $this->end;
+ }
+
+ public function getOrganiser(){
+ return $this->org;
+ }
+
+ public function getLocation(){
+ return $this->loc;
+ }
+
+ public function getName(){
+ return $this->name;
+ }
+
+}
diff --git a/src/pvv/side/social/animekveldactivity.php b/src/pvv/side/social/animekveldactivity.php
index 3f2f590..11a0e37 100644
--- a/src/pvv/side/social/animekveldactivity.php
+++ b/src/pvv/side/social/animekveldactivity.php
@@ -1,11 +1,11 @@
format('H') > 20 || $date->format('H') == 19 && $date->format('i') > 30)
@@ -33,16 +33,4 @@ class AnimekveldActivity implements RepeatingActivity {
return new AnimekveldEvent($this->prevDate($date));
}
- public function getName() /* : string */ {
- return "Animekveld";
- }
-
- public function getLocation() /* : Location */ {
- return "Koserommet";
- }
-
- public function getOrganiser() /* : User */ {
- return "Liang Zhu";
- }
-
}
diff --git a/src/pvv/side/social/animekveldevent.php b/src/pvv/side/social/animekveldevent.php
index f9dd0ba..cabbb37 100644
--- a/src/pvv/side/social/animekveldevent.php
+++ b/src/pvv/side/social/animekveldevent.php
@@ -23,4 +23,8 @@ class AnimekveldEvent extends Event {
return "Liang Zhu";
}
+ public function getURL() /* : string */ {
+ return '/anime/';
+ }
+
}
diff --git a/src/pvv/side/social/brettspillactivity.php b/src/pvv/side/social/brettspillactivity.php
index 19a31f3..7242f36 100644
--- a/src/pvv/side/social/brettspillactivity.php
+++ b/src/pvv/side/social/brettspillactivity.php
@@ -1,11 +1,11 @@
format('H') > 20 || $date->format('H') == 19 && $date->format('i') > 30)
@@ -33,16 +33,4 @@ class BrettspillActivity implements RepeatingActivity {
return new BrettspillEvent($this->prevDate($date));
}
- public function getName() /* : string */ {
- return "Brettspillkveld";
- }
-
- public function getLocation() /* : Location */ {
- return "Koserommet";
- }
-
- public function getOrganiser() /* : User */ {
- return "PVV";
- }
-
}
diff --git a/src/pvv/side/social/brettspillevent.php b/src/pvv/side/social/brettspillevent.php
index a9bd58d..d9d49f3 100644
--- a/src/pvv/side/social/brettspillevent.php
+++ b/src/pvv/side/social/brettspillevent.php
@@ -23,4 +23,8 @@ class BrettspillEvent extends Event {
return "PVV";
}
+ public function getURL() /* : string */ {
+ return '/brettspill/';
+ }
+
}
diff --git a/src/pvv/side/social/nerdepitsaactivity.php b/src/pvv/side/social/nerdepitsaactivity.php
index 4984d96..d320a51 100644
--- a/src/pvv/side/social/nerdepitsaactivity.php
+++ b/src/pvv/side/social/nerdepitsaactivity.php
@@ -1,11 +1,11 @@
format('H') > 19)
@@ -37,16 +37,4 @@ class NerdepitsaActivity implements RepeatingActivity {
return new NerdepitsaEvent($this->prevDate($date));
}
- public function getName() /* : string */ {
- return "Nerdepitsa";
- }
-
- 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
index 83b764c..9614de4 100644
--- a/src/pvv/side/social/nerdepitsaevent.php
+++ b/src/pvv/side/social/nerdepitsaevent.php
@@ -23,4 +23,8 @@ class NerdepitsaEvent extends Event {
return "Anders Christensen";
}
+ public function getURL() /* : string */ {
+ return '/nerdepitsa/';
+ }
+
}
diff --git a/src/pvv/side/sql_config_example.php b/src/pvv/side/sql_config_example.php
deleted file mode 100644
index ea7c6a6..0000000
--- a/src/pvv/side/sql_config_example.php
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/www/index.php b/www/index.php
index 370bc3b..e4f8536 100644
--- a/www/index.php
+++ b/www/index.php
@@ -1,8 +1,9 @@
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$agenda = new \pvv\side\Agenda([
@@ -31,7 +32,13 @@ $agenda = new \pvv\side\Agenda([
- - I DAG: nerdepitsa
+getNextDays() as $period => $events) {
+ $event = reset($events);
+ echo '
- ' . strtoupper($translation[$period]) . ': ' . $event->getName() . '';
+ break;
+}
+?>
@@ -50,25 +57,27 @@ $agenda = new \pvv\side\Agenda([
Kommende arrangement