Projects/nettsiden-old
Projects
/
nettsiden-old
Archived
8
0
Fork 0
This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
nettsiden-old/www/index.php

100 lines
3.5 KiB
PHP
Raw Normal View History

<?php
2018-02-13 19:10:15 +01:00
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
$translation = ['i dag', 'i morgen', 'denne uka', 'neste uke', 'denne måneden', 'neste måned'];
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
2018-02-13 16:58:54 +01:00
$motdfetcher = new \pvv\side\MOTD($pdo);
$motd = $motdfetcher->getMOTD();
?>
2017-11-13 13:21:51 +01:00
2016-08-19 22:00:46 +02:00
<!DOCTYPE html>
<html lang="no">
2017-11-13 13:21:51 +01:00
<head>
<title>Programvareverkstedet</title>
<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="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/splash.css">
<link rel="stylesheet" href="css/landing.css">
2018-02-24 16:53:17 +01:00
<link rel="shortcut icon" href="favicon.ico">
2017-11-13 13:21:51 +01:00
</head>
2016-08-15 17:43:41 +02:00
2017-11-13 13:21:51 +01:00
<body>
2017-11-13 23:13:24 +01:00
<nav id="navbar" class="">
2017-11-13 13:21:51 +01:00
<?php echo navbar(0, ''); ?>
2018-02-24 16:53:17 +01:00
<?php echo loginbar(null, $pdo); ?>
2017-11-13 13:21:51 +01:00
</nav>
2016-08-15 17:43:41 +02:00
2017-11-13 13:21:51 +01:00
<header>
2017-11-13 22:01:33 +01:00
<img class="logo" src="css/logo-white.png"/>
2017-11-13 14:18:08 +01:00
<div class="info">
<h2>Velkommen til Programvare&shy;verkstedet</h2>
<p>Programvareverkstedet (PVV) er en studentorganisasjon ved NTNU som vil skape et miljø for datainteresserte personer tilknyttet universitetet.</p>
<p>Nåværende og tidligere studenter ved NTNU, samt ansatte ved NTNU og tilstøtende miljø, kan bli medlemmer.</p>
2017-11-13 13:21:51 +01:00
<ul class="essentials">
<a class="btn" href="om/"><li>Om PVV</li></a>
<a class="btn join" href="paamelding/"><li>Bli medlem</li></a>
<a class="btn" href="https://use.mazemap.com/?v=1&amp;left=10.4032&amp;right=10.4044&amp;top=63.4178&amp;bottom=63.4172&amp;campusid=1&amp;zlevel=2&amp;sharepoitype=point&amp;sharepoi=10.40355%2C63.41755%2C2&amp;utm_medium=longurl"><li>Veibeskrivelse</li></a>
</ul>
</div>
2017-11-13 14:18:08 +01:00
</header>
2016-08-15 17:43:41 +02:00
<main class="contentsplit">
<div class="gridr">
<h2>Kommende aktiviteter</h2>
<div class="calendar-events">
<?php $counter1 = 0; ?>
<?php $counter2 = 0; ?>
<?php foreach($agenda->getNextDays() as $period => $events) if ($events && $counter1 < 3 && $counter2 < 10) { $counter1++ ?>
<p class="no-chin"><?= $translation[$period] ?></p>
<hr>
<ul>
<?php foreach($events as $event) { $counter2++ ?>
<li>
2018-02-24 16:53:17 +01:00
<?php if ($event->getURL()) { ?>
<a href="<?= htmlspecialchars($event->getURL()) ?>"><?= $event->getName(); ?></a>
<?php } else { ?>
<strong><?= $event->getName(); ?></strong>
<?php } ?>
<?php /* <a class="icon subscribe">+</a> */ ?>
<?php if ($period !== \pvv\side\Agenda::TODAY) {
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
echo '<span class="date">' . strftime('%a', $event->getStart()->getTimestamp()) . '</span>';
} else {
echo '<span class="date">' . strftime('%e. %b', $event->getStart()->getTimestamp()) . '</span>';
}
2017-11-13 13:21:51 +01:00
} else {
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
2017-11-13 13:21:51 +01:00
}
?>
</li>
<?php } ?>
</ul>
<?php } ?>
</div>
<p><a class="btn" href="kalender/">Flere aktiviteter</a></p>
</div>
2018-02-13 16:58:54 +01:00
<div class="gridl">
<?php
$title = $motd["title"];
2016-08-15 17:43:41 +02:00
2018-02-13 17:02:03 +01:00
echo "<h2>";
if($title == ""){
echo "Dagens melding";
}else{
echo $title;
2018-02-13 16:58:54 +01:00
}
echo "</h2>";
2018-02-14 17:55:41 +01:00
echo "<p>" . implode($motd["content"], "<br>") . "</p>";
2018-02-13 16:58:54 +01:00
?>
</div>
2017-11-13 13:21:51 +01:00
</main>
</body>
2018-02-24 16:53:17 +01:00
</html>