diff --git a/src/pvv/side/activity.php b/src/pvv/side/activity.php index b860fdd..6799d4f 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 0affb9d..9b10eb1 100644 --- a/src/pvv/side/event.php +++ b/src/pvv/side/event.php @@ -1,20 +1,10 @@ start = $start; - } - - public function getStart() { - return $this->start; - } - - public abstract function getStop(); /* : DateTimeImmutable */ + public function getStop(); /* : DateTime */ } diff --git a/src/pvv/side/social/animekveldactivity.php b/src/pvv/side/social/animekveldactivity.php index 89ca88c..f2a10cd 100644 --- a/src/pvv/side/social/animekveldactivity.php +++ b/src/pvv/side/social/animekveldactivity.php @@ -1,11 +1,10 @@ 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 deleted file mode 100644 index f8ad6d8..0000000 --- a/src/pvv/side/social/animekveldevent.php +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index 83b764c..0000000 --- a/src/pvv/side/social/nerdepitsaevent.php +++ /dev/null @@ -1,26 +0,0 @@ -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/anime/index.html b/www/anime/index.html index b17e0da..8289cb2 100755 --- a/www/anime/index.html +++ b/www/anime/index.html @@ -1,4 +1,5 @@ + Sosialverkstedet @@ -7,7 +8,7 @@