diff --git a/README.md b/README.md index 757dad1..19c83ba 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,13 @@ On Windows, you have to perform a `composer install` manually beforehand. Make s ### Dependency management -`dev.sh` will download the `composer` package manager to the php archive file `composer.phar` and run it. +`dev.sh` will ensure the git submodules have been pulled, then download the `composer` package manager to the php archive file `composer.phar` and run it. Composer will check for the php extension `pdo_sqlite` which must be enabled on your system. This usually includes installing a php-sqlite3 package and enabling it in /etc/php/php.ini: [PHP] extension=pdo_sqlite extension=sqlite3 + extension=ext-curl Composer is used as such: diff --git a/dev.sh b/dev.sh index f716c23..a613267 100755 --- a/dev.sh +++ b/dev.sh @@ -8,6 +8,11 @@ test ! -e dataporten_config.php && cp -v dist/dataporten_config.php dataporten_c test -e composer.phar || curl -O https://getcomposer.org/composer.phar +if test ! -f lib/OAuth2-Client/OAuth2Client.php ; then + echo Missing git submodules. Installing... + (set -x; git submodule update --init --recursive) || exit $? +fi + if test ! -d vendor; then php composer.phar install || exit $? cp -v dist/authsources_example.php vendor/simplesamlphp/simplesamlphp/config/authsources.php diff --git a/inc/include.php b/inc/include.php index 01d9a56..8e036c4 100644 --- a/inc/include.php +++ b/inc/include.php @@ -27,6 +27,7 @@ use \pvv\side\Agenda; $agenda = new \pvv\side\Agenda([ new \pvv\side\social\NerdepitsaActivity, new \pvv\side\social\AnimekveldActivity, + new \pvv\side\social\DriftkveldActivity, new \pvv\side\DBActivity($pdo), ]); diff --git a/src/pvv/side/social/driftkveldactivity.php b/src/pvv/side/social/driftkveldactivity.php new file mode 100644 index 0000000..97ebc73 --- /dev/null +++ b/src/pvv/side/social/driftkveldactivity.php @@ -0,0 +1,36 @@ +format('H') > 18 || $date->format('H') == 17 && $date->format('i') > 30) + return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(18, 15, 0)); + $date = $date->setTime(18, 15, 0); + if ($date->format('N') != 2) + return $this->nextDate($date->add(new DateInterval('P1D'))); + return $date; + } + + public function prevDate(DateTimeImmutable $date) { + if ($date->format('H') < 17 || $date->format('H') == 18 && $date->format('i') < 30) + return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(18, 15, 0)); + $date = $date->setTime(18, 15, 0); + if ($date->format('N') != 2) + return $this->prevDate($date->sub(new DateInterval('P1D'))); + return $date; + } + + public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ { + return new DriftkveldEvent($this->nextDate($date)); + } + + public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ { + return new DriftkveldEvent($this->prevDate($date)); + } + +} diff --git a/src/pvv/side/social/driftkveldevent.php b/src/pvv/side/social/driftkveldevent.php new file mode 100644 index 0000000..689f918 --- /dev/null +++ b/src/pvv/side/social/driftkveldevent.php @@ -0,0 +1,49 @@ +getStart()->add(new DateInterval('PT4H1800S')); + } + + public function getName() /* : string */ { + return "Driftkveld"; + } + + public function getLocation() /* : Location */ { + return "Terminalrommet / Discord / IRC"; + } + + public function getOrganiser() /* : User */ { + return "Torstein Nordgård-Hansen"; + } + + public function getURL() /* : string */ { + return '/drift/'; + } + + public function getImageURL() { + return '/sosiale/drift.jpg'; + } + + public function getDescription() { + return [ + 'Vil du drifte?', + 'Vil du være kul kis TM?', + 'Kom på driftkveld!', + '', + 'Vi møtes en gang i uka for å ta unna driftarbeid og drikke kaffe.', + 'Alle PVVere er velkommene, enten de er erfarne driftere eller helt utenforstående!' + ]; + } + + public function getColor() { + return "#35a"; + } + +} diff --git a/www/drift/index.php b/www/drift/index.php new file mode 100644 index 0000000..c2d2f0b --- /dev/null +++ b/www/drift/index.php @@ -0,0 +1,59 @@ + + + + + + + + + + + +Drifterverkstedet + +
Sosial­verk­stedet
+ + +
+ +getNextEventFrom(new DateTimeImmutable); +?> + +
+

getRelativeDate()?> Driftkveld + getImageURL()) { ?> + + +

+ + + text(implode("\n", $nextEvent->getDescription())); + ?> +
+ +
+ + diff --git a/www/sosiale/drift.jpg b/www/sosiale/drift.jpg new file mode 100644 index 0000000..4d2ad7b Binary files /dev/null and b/www/sosiale/drift.jpg differ