Merge pull request #13 from Programvareverkstedet/driftkveld
Fast driftkveld i kalender
This commit is contained in:
commit
5ade47f6dd
@ -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:
|
||||
|
||||
|
5
dev.sh
5
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
|
||||
|
@ -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),
|
||||
]);
|
||||
|
||||
|
36
src/pvv/side/social/driftkveldactivity.php
Normal file
36
src/pvv/side/social/driftkveldactivity.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php //declare(strict_types=1);
|
||||
namespace pvv\side\social;
|
||||
|
||||
use \pvv\side\Activity;
|
||||
use \DateTimeImmutable;
|
||||
use \DateInterval;
|
||||
|
||||
class DriftkveldActivity implements Activity {
|
||||
|
||||
public function nextDate(DateTimeImmutable $date) {
|
||||
if ($date->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));
|
||||
}
|
||||
|
||||
}
|
49
src/pvv/side/social/driftkveldevent.php
Normal file
49
src/pvv/side/social/driftkveldevent.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php //declare(strict_types=1);
|
||||
namespace pvv\side\social;
|
||||
|
||||
use \pvv\side\Event;
|
||||
|
||||
use \DateInterval;
|
||||
|
||||
class DriftkveldEvent extends Event {
|
||||
|
||||
public function getStop() {
|
||||
return $this->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";
|
||||
}
|
||||
|
||||
}
|
59
www/drift/index.php
Normal file
59
www/drift/index.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||
use \pvv\side\Agenda;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="no">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="stylesheet" href="../css/normalize.css">
|
||||
<link rel="stylesheet" href="../css/style.css">
|
||||
<link rel="stylesheet" href="../css/nav.css">
|
||||
<link rel="stylesheet" href="../css/events.css">
|
||||
<meta name="theme-color" content="#024" />
|
||||
<title>Drifterverkstedet</title>
|
||||
|
||||
<header>Sosial­verk­stedet</header>
|
||||
|
||||
|
||||
<main>
|
||||
|
||||
<?php
|
||||
$activity = new \pvv\side\social\DriftkveldActivity;
|
||||
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
||||
?>
|
||||
|
||||
<article>
|
||||
<h2><em><?= $nextEvent->getRelativeDate()?></em> Driftkveld
|
||||
<?php if ($nextEvent->getImageURL()) { ?>
|
||||
<img src="<?= $nextEvent->getImageURL() ?>">
|
||||
<?php } ?>
|
||||
</h2>
|
||||
<ul class="subtext">
|
||||
<li>Tid:
|
||||
<strong>
|
||||
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
||||
</strong>
|
||||
<li>Sted:
|
||||
<strong>
|
||||
<?= $nextEvent->getLocation();?>
|
||||
</strong>
|
||||
<li>Arrangør:
|
||||
<strong>
|
||||
<?= $nextEvent->getOrganiser();?>
|
||||
</strong>
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
$Parsedown = new \Parsedown();
|
||||
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
|
||||
?>
|
||||
</article>
|
||||
|
||||
</main>
|
||||
|
||||
<nav>
|
||||
<?= navbar(1, 'aktiviteter'); ?>
|
||||
<?= loginbar($sp, $pdo); ?>
|
||||
</nav>
|
BIN
www/sosiale/drift.jpg
Normal file
BIN
www/sosiale/drift.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 MiB |
Loading…
Reference in New Issue
Block a user