From b6970d3f036f9d152d633930b9fb573a693f0ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne?= Date: Wed, 17 Aug 2016 23:53:35 +0200 Subject: [PATCH 1/6] Add automatic agenda on front page. --- src/pvv/side/activity.php | 2 +- src/pvv/side/agenda.php | 83 ++++++++++++++++++++++ src/pvv/side/event.php | 16 ++++- src/pvv/side/social/animekveldactivity.php | 3 +- src/pvv/side/social/animekveldevent.php | 26 +++++++ src/pvv/side/social/nerdepitsaevent.php | 26 +++++++ www/index.php | 77 +++++--------------- 7 files changed, 168 insertions(+), 65 deletions(-) create mode 100644 src/pvv/side/agenda.php create mode 100644 src/pvv/side/social/animekveldevent.php create mode 100644 src/pvv/side/social/nerdepitsaevent.php 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

-- 2.44.1 From a4181b98ac9317889d4297c03ef542d02cbc86d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne?= Date: Wed, 17 Aug 2016 23:54:59 +0200 Subject: [PATCH 2/6] Fix typo. --- www/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/index.php b/www/index.php index 2bc016c..b13b87d 100644 --- a/www/index.php +++ b/www/index.php @@ -63,7 +63,7 @@

Opptak

Alle med tilknytning til NTNU kan bli medlem hos oss -og benytte seg av våre ressurs. +og benytte seg av våre ressurser. For å bli med i våre prosjekter og komitéer må du søke.

-- 2.44.1 From f91d62e69f25b7bfb243d5892c5efd79c6c6555c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne?= Date: Wed, 17 Aug 2016 23:58:54 +0200 Subject: [PATCH 3/6] Remove merge cruft. --- www/index.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/www/index.php b/www/index.php index b13b87d..cdfdcc4 100644 --- a/www/index.php +++ b/www/index.php @@ -1,9 +1,4 @@ -<<<<<<< e4e8b0972bbec3fff581f7a97b34315265104f3a -======= - - ->>>>>>> Add automatic agenda on front page. Programvareverkstedet -- 2.44.1 From 2b5c561369889d4c95ce6b0bf045ceefad383dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne?= Date: Thu, 18 Aug 2016 00:00:34 +0200 Subject: [PATCH 4/6] Add timezone statement to accommodate older PHP servers. --- www/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/index.php b/www/index.php index cdfdcc4..568fa34 100644 --- a/www/index.php +++ b/www/index.php @@ -1,4 +1,4 @@ - + Programvareverkstedet -- 2.44.1 From e0385a9fef76bcbd8e69d92b407af6c8f1578af3 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 18 Aug 2016 00:25:47 +0200 Subject: [PATCH 5/6] Autohyphenate

Add hyphens:auto to

to remove the ugly gaps introduced by text-align: justified. This may cause some unwanted hyphenation on e.g. email addresses. We should strive to not have long unbreakable words. For record; command for adding html tag to all relevant files: $ find -type f -exec sed -i '/DOCTYPE/ a ' {} + --- www/anime/index.html | 1 + www/css/style.css | 3 ++- www/index.php | 1 + www/kurs/index.html | 1 + www/nerdepitsa/index.html | 1 + www/prosjekt/index.html | 1 + www/soek/PR.html | 1 + www/soek/drift.html | 1 + www/soek/index.html | 1 + www/soek/styret.html | 1 + www/soek/trikom.html | 1 + www/sosiale/index.html | 1 + 12 files changed, 13 insertions(+), 1 deletion(-) diff --git a/www/anime/index.html b/www/anime/index.html index 5156bdc..8289cb2 100755 --- a/www/anime/index.html +++ b/www/anime/index.html @@ -1,4 +1,5 @@ + Sosialverkstedet diff --git a/www/css/style.css b/www/css/style.css index 0288e53..ab6106e 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -50,6 +50,7 @@ article { } article p { text-align: justify; + hyphens: auto; } article:first-child { border-radius: .5rem .5rem 0 0; @@ -145,4 +146,4 @@ a.btn:active { top: 13rem; height: 13em; } -} \ No newline at end of file +} diff --git a/www/index.php b/www/index.php index dfa291d..f529b44 100644 --- a/www/index.php +++ b/www/index.php @@ -1,4 +1,5 @@ + Programvareverkstedet diff --git a/www/kurs/index.html b/www/kurs/index.html index 1f53baf..6b7fa58 100644 --- a/www/kurs/index.html +++ b/www/kurs/index.html @@ -1,4 +1,5 @@ + Kursverkstedet diff --git a/www/nerdepitsa/index.html b/www/nerdepitsa/index.html index 94aa03e..3aedba0 100755 --- a/www/nerdepitsa/index.html +++ b/www/nerdepitsa/index.html @@ -1,4 +1,5 @@ + Sosialverkstedet diff --git a/www/prosjekt/index.html b/www/prosjekt/index.html index f12ec74..d9c48ec 100644 --- a/www/prosjekt/index.html +++ b/www/prosjekt/index.html @@ -1,4 +1,5 @@ + Prosjektverkstedet diff --git a/www/soek/PR.html b/www/soek/PR.html index 210e434..9c88ae0 100644 --- a/www/soek/PR.html +++ b/www/soek/PR.html @@ -1,4 +1,5 @@ + Prosjektverkstedet diff --git a/www/soek/drift.html b/www/soek/drift.html index 3b8b9af..8d99228 100644 --- a/www/soek/drift.html +++ b/www/soek/drift.html @@ -1,4 +1,5 @@ + Prosjektverkstedet diff --git a/www/soek/index.html b/www/soek/index.html index 8f4d2fd..ceedc24 100644 --- a/www/soek/index.html +++ b/www/soek/index.html @@ -1,4 +1,5 @@ + Prosjektverkstedet diff --git a/www/soek/styret.html b/www/soek/styret.html index bcf57b3..3d9c567 100644 --- a/www/soek/styret.html +++ b/www/soek/styret.html @@ -1,4 +1,5 @@ + Prosjektverkstedet diff --git a/www/soek/trikom.html b/www/soek/trikom.html index 4869dd2..c278a2b 100644 --- a/www/soek/trikom.html +++ b/www/soek/trikom.html @@ -1,4 +1,5 @@ + Prosjektverkstedet diff --git a/www/sosiale/index.html b/www/sosiale/index.html index 730bfb7..7cff1b0 100644 --- a/www/sosiale/index.html +++ b/www/sosiale/index.html @@ -1,4 +1,5 @@ + Sosialverkstedet -- 2.44.1 From 8ac5b801ef79f4d39efc215dc0a88fbfb1826527 Mon Sep 17 00:00:00 2001 From: helliio Date: Thu, 18 Aug 2016 00:30:59 +0200 Subject: [PATCH 6/6] added bli medlem page. updated sosiale page --- www/anime/index.html | 10 +++++----- www/css/style.css | 9 +++++++++ www/nerdepitsa/index.html | 2 +- www/sosiale/index.html | 35 +++++++++++++++++++++++++++++++---- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/www/anime/index.html b/www/anime/index.html index 5156bdc..b17e0da 100755 --- a/www/anime/index.html +++ b/www/anime/index.html @@ -7,7 +7,7 @@