Prepare for merge

This commit is contained in:
Markus Wang Halvorsen 2018-02-24 16:53:17 +01:00
commit 32f9653a6d
43 changed files with 711 additions and 460 deletions

6
dist/pvv.sql vendored
View File

@ -22,7 +22,5 @@ CREATE TABLE "users" (
"groups" INT DEFAULT 0
);
CREATE TABLE "motd" (
"title" TEXT,
"content" TEXT
);
INSERT INTO users (uname, groups)
VALUES ("min_test_bruker", 1);

23
dist/pvv_mysql.sql vendored Normal file
View File

@ -0,0 +1,23 @@
CREATE TABLE events (
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
`name` TEXT,
`start` TEXT,
`stop` TEXT,
`organiser` TEXT,
`location` TEXT,
`description` TEXT
);
CREATE TABLE projects (
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
`name` TEXT,
`owner` TEXT,
`owneruname` TEXT,
`description` TEXT,
`active` BOOLEAN
);
CREATE TABLE users (
`uname` TEXT,
`groups` INT DEFAULT 0
);

11
inc/agenda.php Normal file
View File

@ -0,0 +1,11 @@
<?php
require __DIR__ . '/../src/_autoload.php';
require __DIR__ . '/../sql_config.php';
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity($pdo),
]);

33
inc/include.php Normal file
View File

@ -0,0 +1,33 @@
<?php
// Set up database and user system,
// and include common files such as HTML includes or SimplSAMLphp.
require_once __DIR__ . DIRECTORY_SEPARATOR . 'agenda.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'navbar.php';
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'lib', 'OAuth2-Client', 'OAuth2Client.php']);
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'dataporten_config.php']);
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'sql_config.php']);
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'src', '_autoload.php']);
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'vendor', 'simplesamlphp', 'simplesamlphp', 'lib', '_autoload.php']);
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'nb_NO');
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$userManager = new \pvv\admin\UserManager($pdo);
$sp = 'default-sp';
$as = new SimpleSAML_Auth_Simple($sp);
use \pvv\side\Agenda;
$agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity($pdo),
]);
$months_translations = ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'];

View File

@ -1,60 +1,64 @@
<?php
function navbar($depth, $active = NULL, $sp = 'default-sp') {
require __DIR__ . '/../src/_autoload.php';
require_once __DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
require __DIR__ . '/../sql_config.php';
$result = '<img class="logo" src="' . rtrim(str_repeat('../', $depth)) . "/css/logo-disk-white.png\"/>\n";
$result .= "\t\t<ul>\n";
function navbar($depth, $active = NULL) {
$result = "\n\t<ul id=\"menu\">\n";
$menuItems = [
'Hjem' => '',
'Kalender' => 'kalender',
'Aktiviteter' => 'aktiviteter',
'Prosjekter' => 'prosjekt',
'Kontakt' => 'kontakt',
'Wiki' => 'pvv'
'Webmail' => 'https://webmail.pvv.ntnu.no/',
'Wiki' => 'pvv',
];
$as = new SimpleSAML_Auth_Simple($sp);
$attr = $as->getAttributes();
if($attr) {
$uname = $attr['uid'][0];
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$userManager = new \pvv\admin\UserManager($pdo);
$isAdmin = $userManager->isAdmin($uname);
$projectGroup = $userManager->hasGroup($uname, 'prosjekt');
$activityGroup = $userManager->hasGroup($uname, 'aktiviteter');
if($isAdmin | $projectGroup | $activityGroup) {
$menuItems['Admin'] = 'admin';
}
}
foreach($menuItems as $caption => $link) {
$result .= "\t\t\t<a href=\"" . rtrim(str_repeat('../', $depth) . $link, '/') . "/\"" . ($active === $link ? ' class="active"' : '') . ">"
. "<li>" . $caption . "</li></a>\n"
$isActive = $active === $link;
if ($caption !== 'Webmail') {
$link = rtrim(str_repeat('../', $depth) . $link, '/') . '/';
}
if ($isActive) $link = '#';
$result .= "\t\t<li" . ($isActive ? ' class="active"' : '') . '>'
. '<a href="' . $link . '">'
. $caption
. "</a></li>\n"
;
}
$result .= "\t\t\t" . '<a href="javascript:void(0);" style="font-size:15px;" id="navopen" onclick="navbar()">&#9776;</a>' . "\n";
return $result . "\t\t</ul>\n";
return $result . "\t</ul>\n";
}
function loginBar($sp = 'default-sp') {
require_once __DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
function loginBar($sp = null, $pdo = null) {
if (is_null($sp)) $sp = 'default-sp';
$result = "\n";
require_once(__DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
$as = new SimpleSAML_Auth_Simple($sp);
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 64 64">
<circle cx="32" cy="27" r="14" stroke-width="0" />
<ellipse cx="32" cy="66" rx="24" ry="28" stroke-width="0" />
</svg>
';
$attr = $as->getAttributes();
if($attr) {
$uname = $attr['uid'][0];
$result .= "\t\t<p class=\"login\">Logget inn som: " . htmlspecialchars($uname) . "</p>\n";
$isAdmin = false;
if (isset($pdo)) {
$userManager = new \pvv\admin\UserManager($pdo);
$isAdmin = $userManager->isAdmin($uname);
}
$result .= "\n\t<ul id=\"usermenu\">\n";
$result .= "\n\t\t<li><a id=\"login\" href=\"#\">${svg}" . htmlspecialchars($uname) . "</a></li>\n";
if ($isAdmin) {
$result .= "\n\t\t<li><a href=\"/admin/\">Admin</a></li>\n";
}
$result .= "\n\t\t<li><a href=\"" . htmlspecialchars($as->getLogoutURL()) . "\">Logg ut</a></li>\n";
$result .= "\n\t</ul>\n";
$result .= "\t<a id=\"login\" href=\"#usermenu\" aria-hidden=\"true\">${svg}" . htmlspecialchars($uname) . "</a>\n";
} else {
$result .= "\t\t<a class=\"login\" href=\"" . htmlspecialchars($as->getLoginURL()) . "\">Logg inn</a>\n";
$result .= "\t<a id=\"login\" href=\"" . htmlspecialchars($as->getLoginURL()) . "\">${svg}Logg inn</a>\n";
}
$result .= "\n\t<a href=\"#menu\" id=\"menu_toggle\" aria-hidden=\"true\"><big>&#9776;&nbsp;</big>MENU</a>\n";
return $result;
}

View File

@ -54,12 +54,12 @@ class DBActivity implements Activity {
public function getNextEventFrom(DateTimeImmutable $date) {
$query = 'SELECT name,start,stop,organiser,location,description FROM events WHERE start > :date ORDER BY start ASC LIMIT 1';
$query = 'SELECT id,name,start,stop,organiser,location,description FROM events WHERE start > :date ORDER BY start ASC LIMIT 1';
return $this->retrieve($date, $query);
}
public function getPreviousEventFrom(DateTimeImmutable $date) {
$query = 'SELECT name,start,stop,organiser,location,description FROM events WHERE start < :date ORDER BY start DESC LIMIT 1';
$query = 'SELECT id,name,start,stop,organiser,location,description FROM events WHERE start < :date ORDER BY start DESC LIMIT 1';
return $this->retrieve($date, $query);
}

View File

@ -49,4 +49,5 @@ abstract class Event {
public abstract function getDescription(); /* : string */
public abstract function getColor(); /* : string */
}

View File

@ -49,11 +49,15 @@ class SimpleEvent extends Event {
}
public function getDescription() {
return $this->descr;
return array_map(function ($item) {return "<p>".$item;}, $this->descr);
}
public function isDBEvent() {
return $this->isDBEvent;
}
public function getColor() {
return "#3b7";
}
}

View File

@ -41,4 +41,8 @@ class AnimekveldEvent extends Event {
];
}
public function getColor() {
return "#35a";
}
}

View File

@ -60,4 +60,8 @@ class BrettspillEvent extends Event {
];
}
public function getColor() {
return "#000";
}
}

View File

@ -43,4 +43,8 @@ class NerdepitsaEvent extends Event {
];
}
public function getColor() {
return "#c35";
}
}

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../../inc/navbar.php';
require __DIR__ . '/../../../src/_autoload.php';
require __DIR__ . '/../../../sql_config.php';

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../../inc/navbar.php';
require __DIR__ . '/../../../src/_autoload.php';
require __DIR__ . '/../../../sql_config.php';

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../../src/_autoload.php';
require __DIR__ . '/../../../sql_config.php';
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);

View File

@ -1,7 +1,7 @@
<?php
ini_set('display_errors', '1');
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
error_reporting(E_ALL);
require __DIR__ . '/../../../inc/navbar.php';
require __DIR__ . '/../../../src/_autoload.php';
@ -32,7 +32,6 @@ $users = $userManager->getAllUserData();
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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">
<link rel="stylesheet" href="../../css/admin.css">
</head>
@ -90,4 +89,4 @@ $users = $userManager->getAllUserData();
<input type="submit" class="btn" value="Lagre">
</form>
</main>
</body>
</body>

View File

@ -1,7 +1,7 @@
<?php
ini_set('display_errors', '1');
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
error_reporting(E_ALL);
require __DIR__ . '/../../../src/_autoload.php';
require __DIR__ . '/../../../sql_config.php';

View File

@ -1,8 +1,5 @@
<?php
require __DIR__ . '/../../inc/navbar.php';
require __DIR__ . '/../../src/_autoload.php';
require_once __DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
require __DIR__ . '/../../sql_config.php';
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@ -18,7 +15,8 @@ $projectGroup = $userManager->hasGroup($uname, 'prosjekt');
$activityGroup = $userManager->hasGroup($uname, 'aktiviteter');
if(!($isAdmin | $projectGroup | $activityGroup)){
echo 'Her har du ikke lov\'t\'å\'værra!!!';
header('Content-Type: text/plain', true, 403);
echo "Her har du ikke lov't'å'værra!!!\r\n";
exit();
}
?>
@ -27,7 +25,6 @@ if(!($isAdmin | $projectGroup | $activityGroup)){
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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">
<link rel="stylesheet" href="../css/admin.css">
</head>
@ -35,7 +32,7 @@ if(!($isAdmin | $projectGroup | $activityGroup)){
<body>
<nav id="navbar">
<?php echo navbar(1, 'admin'); ?>
<?php echo loginbar(); ?>
<?php echo loginbar(null, $pdo); ?>
</nav>
<main>
@ -60,4 +57,4 @@ if(!($isAdmin | $projectGroup | $activityGroup)){
?>
<ul>
</main>
</body>
</body>

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../../inc/navbar.php';
require __DIR__ . '/../../../src/_autoload.php';
require __DIR__ . '/../../../sql_config.php';

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../../inc/navbar.php';
require __DIR__ . '/../../../src/_autoload.php';
require __DIR__ . '/../../../sql_config.php';

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../../src/_autoload.php';
require __DIR__ . '/../../../sql_config.php';
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);

View File

@ -1,18 +1,5 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
require_once __DIR__ . '/../../inc/navbar.php';
require_once __DIR__ . '/../../src/_autoload.php';
require_once __DIR__ . '/../../sql_config.php';
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
use \pvv\side\Agenda;
$agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity($pdo),
]);
<?php namespace pvv\side;
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
$year = (isset($_GET['year']))
? $_GET['year']
@ -34,7 +21,6 @@ $day = (isset($_GET['day']))
<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/nav.css">
<link rel="stylesheet" href="../css/events.css">
</head>
@ -46,6 +32,7 @@ $day = (isset($_GET['day']))
<main>
<?php
use \DateTimeImmutable;
$events = ($day==-1)
? $agenda->getNextOfEach(new \DateTimeImmutable)
: $agenda->getEventsBetween(

View File

@ -1,11 +1,8 @@
<!DOCTYPE html>
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
use \pvv\side\Agenda;
?>
<!DOCTYPE html>
<html lang="no">
<title>Sosialverkstedet</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@ -46,12 +43,7 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
</main>
<nav><ul>
<li><a href="../">hjem</a></li>
<!--<li><a href="../prosjekt/">prosjekter</a></li>-->
<li><a href="../kalender/">kalender</a></li>
<li class="active"><a href="../aktiviteter/">aktiviteter</a></li>
<li><a href="../prosjekt/">prosjekter</a></li>
<li><a href="../kontakt/">kontakt</a></li>
<li><a href="../pvv/">wiki</a></li>
<nav>
<?= navbar(1, 'aktiviteter'); ?>
<?= loginbar($sp, $pdo); ?>
</nav>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';
use \pvv\side\Agenda;

View File

@ -35,7 +35,7 @@ figure.calendar {
min-height: 4.8em;
font-size: 0.8em;
color: #444;
overflow: hidden;
}
.calendar ul li.header {
@ -57,7 +57,7 @@ figure.calendar {
.calendar ul li.active {
color: #222;
border-color: #456;
border-color: #679;
box-shadow: 0 0 3px #89f;
}
@ -65,8 +65,31 @@ figure.calendar {
background-color: #fff;
}
.calendar ul li section::before {
content: "\26AB ";
color: #038;
.calendar ul li .day{
display: inline-block;
width: 1.75em;
height: 1.75em;
text-align: center;
line-height: 1.75em;
background: #9ab;
color: white;
border-radius: 0.875em;
margin-bottom: 0.1em;
font-size: 0.8em;
}
.calendar ul li.active .day{
background: #248;
}
.calendar ul li section {
line-height: 1.5em;
background: #038;
color: white;
border-radius: 0.75em;
text-align: center;
white-space: nowrap;
}
.calendar ul li section + section {
margin-top: 0.1em;
}

View File

@ -1,8 +1,8 @@
h2 a {
h2 a, h4 a {
color: black;
text-decoration: none;
}
h2 a:hover {
h2 a:hover, h4 a:hover {
text-decoration: underline;
}
h2 em {
@ -32,9 +32,19 @@ h2 img {
article:first-child h2 img {
max-width: 10em;
}
h4 {
margin-top: 0;
margin-bottom: -0.6em;
}
.subtext {
h2 + .subtext {
margin: -1.5em 0 1em 0;
}
p + .subtext {
margin: -0.5em 0 1em 0;
}
.subtext {
padding: 0;
list-style: none;
clear: left;
@ -51,6 +61,38 @@ article:first-child h2 img {
font-weight: normal;
}
.events:before {
height: 1px;
width: 100%;
display: block;
content: " ";
background-image: -webkit-linear-gradient(left, transparent, rgba(0,0,0,.1), transparent);
background-image: -moz-linear-gradient(left, transparent, rgba(0,0,0,.1), transparent);
background-image: -o-linear-gradient(left, transparent, rgba(0,0,0,.1), transparent);
margin: 0;
padding: 0;
border: 0;
}
.events {
margin-top: -1.5em;
margin-left: 0.3em;
margin-bottom: 2em;
list-style: none;
padding: 0;
}
.events >li {
padding-left: 0.5em;
border-left: 4px solid #35a;
margin-top: 0.9em;
}
.events li p {
text-align: left;
}
.events .subtext {
margin-bottom: 0;
}
@media screen and (max-width: 50rem) {
h2 img {
display: none;

View File

@ -1,5 +1,6 @@
header {
margin: 0;
margin-top: 3em;
padding: 3vh 15vw;
width: 70vw;
background-color: #002244;

View File

@ -1,169 +0,0 @@
nav {
position: fixed;
z-index: 99;
top: 0;
width: 100vw;
height: 50px;
background-color: #002244;
overflow: hidden;
}
nav * {
background-color: #002244;
color: #fff;
margin: 0;
padding: 0;
}
nav h2 {
display: inline-block;
position: fixed;
top: 0;
margin-left: .65em;
line-height: 5vh;
color: #002244;
}
nav .logo{
position: fixed;
top: 6px;
left: 6px;
width: 38px;
height: 38px;
}
nav ul {
position: fixed;
top: 0;
left: 50px;
width: 100vw;
height: 45px;
list-style: none;
}
nav li {
height: 100%;
line-height: 50px;
}
nav a, nav p {
display: inline-block;
height: 40px;
margin: 0 .7em;
text-decoration: none;
font-size: 1.2em;
text-align: center;
border-bottom: 2px solid rgba(255, 255, 255, 0);
transition: border-bottom .3s ease;
}
nav a:hover {
border-bottom: 2px solid rgba(255, 255, 255, 1);
transition: border-bottom .3s ease;
}
nav a.active {
border-bottom: 2px solid rgba(255, 255, 255, 1);
transition: none;
}
nav .login {
position: fixed;
top: 0;
right: 0;
height: 45px;
line-height: 55px;
}
nav p.login {
right: .5em;
}
#navopen {
display: none;
}
@media(max-width: 800px){
nav .logo {
visibility: hidden;
}
nav .login {
display: none;
}
nav ul {
left: 0px;
height: 50px;
}
nav a {
display: none;
border-bottom: none;
text-align: left;
margin: 0;
}
nav a:hover {
border-bottom: none;
}
nav a.active {
display: block;
height: 50px;
line-height: 50px;
padding: 0 .5em;
border-bottom: none;
}
#navopen {
display: block;
position: fixed;
top: 0;
right: 0;
line-height: 50px;
text-align: center;
width: 50px;
height: 50px;
margin: 0;
padding: 0;
background-color: #002244;
}
.opennav a {
display: block;
text-align: left;
margin: 0;
padding: 0 .5em;
}
.opennav a:hover {
background-color: #00407F;
}
.opennav a:hover li {
background-color: #00407F;
}
.opennav a.active:hover {
background-color: #002244;
}
.opennav a.active:hover li {
background-color: #002244;
}
.opennav .login {
position: relative;
display: block;
border-top: 1px solid gray;
}
}

Binary file not shown.

BIN
www/css/raleway-latin.woff2 Normal file

Binary file not shown.

View File

@ -1,3 +1,196 @@
/* latin-ext */
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 400;
src: local('Raleway'), local('Raleway-Regular'), url("/css/raleway-latin-ext.woff2") format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 400;
src: local('Raleway'), local('Raleway-Regular'), url() format('woff2');
src: local('Raleway'), local('Raleway-Regular'), url("/css/raleway-latin.woff2") format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+2215;
}
h1, h2, h3, h4, h5, h6, li, a.btn, p.login{
font-family: Raleway, sans-serif;
font-style: normal;
font-variant: normal;
}
nav, #menu {
padding: 0;
}
nav {
background: #024;
position: absolute;
width: 100%;
top: 0;
left: 0;
right: 0;
height: 3em;
display: table;
white-space: nowrap;
}
nav #menu, nav #login {
display: table-cell;
}
nav #login, nav #usermenu a {
padding: 0 .75em;
margin: 0;
}
nav #login {
text-align: right;
}
nav #menu {
margin: .1em auto 0 auto;
text-align: center;
margin: 0;
z-index: 3; /* Make appear under #login */
width: 100%; /* Claim as much of the CSS table as possible */
}
nav li {
display: inline-block;
margin: auto .25em;
}
nav #menu_toggle {
margin: 0;
display: none;
}
nav li, nav #menu_toggle, nav #login {
line-height: 3em;
height: 3em;
}
nav a {
display: inline-block;
margin: auto;
color: white;
fill: white; /* SVG icon */
text-decoration: none;
margin: 0 .75em;
}
nav li.active, nav li:hover {
border-bottom: 2px solid white;
}
nav #usermenu {
display: none;
position: absolute;
top: 0;
right: 0;
margin: 0;
background: #fff;
padding: 0;
z-index: 5; /* Make appear over #login */
}
nav #login {
z-index: 4; /* Make appear under #usermenu and over #menu */
}
nav #usermenu li:first-child, nav #usermenu li:first-child a {
line-height: 3em;
height: 3em;
}
nav #usermenu li, nav #usermenu li a {
line-height: 2em;
height: 2em;
color: #024;
fill: #024; /* SVG icon */
border: none;
display: block;
margin: 0;
}
nav #usermenu:target {
display: block;
}
/* Style #login when #usermenu is targeted */
/* Requires #login to appear after #usermenu, directly under nav */
nav #usermenu:target ~ #login {
color: #024;
fill: #024; /* SVG icon */
background: white;
}
nav #usermenu li:hover {
background: #eee;
}
nav #usermenu li:first-child:hover {
background: transparent;
}
@media(max-width: 800px){
nav #menu, nav #menu li.active, nav #menu_toggle, nav #login {
position: absolute;
}
nav #menu li.active {
top: -3em; /* -3em for absolute, 0 for fixed.. huh? */
left: 0;
background: transparent;
}
nav li.active, nav li:hover {
border: none;
}
nav #menu {
text-align: left;
top: 3em;
left: 0;
right: 0;
padding: 0;
}
nav #menu:target {
top: 0;
padding-top: 3em;
}
nav #menu li, nav #menu li a {
margin-left: 0;
display: block;
}
nav #menu li a {
padding-left: 1em;
}
nav #menu li {
display: none;
background: #024;
}
nav #menu li:hover {
background: #1a3957;
}
nav #menu li.active:hover {
background: transparent;
}
nav #menu:target li.active:hover {
background: rgba(255,255,255,.1);
}
nav #menu:target li, nav #menu li.active {
display: block;
}
nav #menu_toggle {
display: block;
top: 0;
left: 0;
right: 0;
}
nav #menu:target li.active {
right: 0;
top: 0;
}
nav #menu_toggle {
text-align: center;
}
nav #menu_toggle:hover, nav #login:hover {
background: rgba(255,255,255,.1);
}
nav #login {
right: 0;
top: 0;
}
}
body {
overflow-y: scroll;
overflow-x: hidden;
@ -17,6 +210,9 @@ main {
main h2 {
color: #002244;
z-index: 2; /* Make appear under #menu */
position: relative;
}
article {

BIN
www/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

57
www/hendelser/index.php Normal file
View File

@ -0,0 +1,57 @@
<?php namespace pvv\side;
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
$translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden', 'Neste måned'];
?>
<!DOCTYPE html>
<html lang="no">
<title>Hendelsesverkstedet</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/events.css">
<header>Hendelses&shy;verk&shy;stedet</header>
<main>
<article>
<?php
$description_paragraphs = 1; //description length
foreach($agenda->getNextDays() as $period => $events) {
if ($events) { ?>
<h2><?= $translation[$period] ?></h2>
<ul class="events">
<?php foreach($events as $event) {?>
<li style="border-color: <?= $event->getColor() ?>">
<h4><strong>
<?php if ($event->getURL()) { ?>
<a href="<?= $event->getURL() ?>"><?= $event->getName() ?></a>
<?php } else { ?>
<?= $event->getName() ?>
<?php } ?>
</strong></h4>
<?php $description = $event->getDescription(); ?>
<?php if ($description_paragraphs) array_splice($description, $description_paragraphs); ?>
<?= implode($description, "</p>\n<p>") ?>
<ul class="subtext">
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong>
<li>Sted: <strong><?= $event->getLocation() ?></strong>
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong>
</ul>
<?php } ?>
</ul>
<?php } ?>
<?php } ?>
</article>
</main>
<nav>
<?= navbar(1, 'hendelser'); ?>
<?= loginbar($sp, $pdo); ?>
</nav>

View File

@ -1,18 +1,9 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../inc/navbar.php';
require __DIR__ . '/../src/_autoload.php';
require __DIR__ . '/../sql_config.php';
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);
$agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity($pdo),
]);
$motdfetcher = new \pvv\side\MOTD($pdo);
$motd = $motdfetcher->getMOTD();
@ -26,26 +17,15 @@ $motd = $motdfetcher->getMOTD();
<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/nav.css">
<link rel="stylesheet" href="css/splash.css">
<link rel="stylesheet" href="css/landing.css">
<script>
function navbar() {
var x = document.getElementById("navbar");
if (x.className === "opennav") {
x.className = "";
} else {
x.className = "opennav";
}
}
</script>
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<nav id="navbar" class="">
<?php echo navbar(0, ''); ?>
<?php echo loginbar(); ?>
<?php echo loginbar(null, $pdo); ?>
</nav>
<header>
@ -74,7 +54,11 @@ $motd = $motdfetcher->getMOTD();
<ul>
<?php foreach($events as $event) { $counter2++ ?>
<li>
<a href="<?= htmlspecialchars($event->getURL()) ?>"><?= $event->getName(); ?></a>
<?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>';
@ -112,4 +96,4 @@ $motd = $motdfetcher->getMOTD();
</div>
</main>
</body>
</html>
</html>

View File

@ -1,19 +1,5 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
require_once __DIR__ . '/../../inc/navbar.php';
require_once __DIR__ . '/../../src/_autoload.php';
require_once __DIR__ . '/../../sql_config.php';
use \pvv\side\Agenda;
$months_translations = ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'];
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity($pdo),
]);
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
$year = (isset($_GET['year']))
? $_GET['year']
@ -37,7 +23,6 @@ $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
<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/nav.css">
<link rel="stylesheet" href="../css/events.css">
<link rel="stylesheet" href="../css/calendar.css">
</head>
@ -47,10 +32,10 @@ $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
<?php echo navbar(1, 'kalender'); ?>
<?php echo loginbar(); ?>
</nav>
<main>
<h2 style="text-align:center;">Aktiviteter for <?=$months_translations[$month-1]?> <?=$year?></h2>
<p><?php
$pmonth = $month-1;
$nmonth = $month+1;
@ -62,45 +47,44 @@ $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
<a class="btn noselect" href="../kalender?year=<?=$pyear?>&amp;month=<?=$pmonth?>">Forrige måned</a>
<a class="btn noselect" style="float:right;" href="../kalender?year=<?=$nyear?>&amp;month=<?=$nmonth?>">Neste måned</a>
</p>
<figure class="calendar">
<ul>
<li class="header noselect">Mandag
<li class="header noselect">Tirsdag
<li class="header noselect">Onsdag
<li class="header noselect">Torsdag
<li class="header noselect">Fredag
<li class="header noselect">Lørdag
<li class="header noselect">Søndag
<?php if ($days_before_the_first != 0) { ?>
<li class="outOfMonth" style="grid-column: 1/<?=$days_before_the_first+1?>;">
<?php } ?>
<?php for ($day=1; $day <= $days_in_month; $day++) { ?>
<?php $events = $agenda->getEventsBetween(
new DateTimeImmutable("$year-$month-$day 00:00:00"),
new DateTimeImmutable("$year-$month-$day 23:59:59")); ?>
<?php if ($day==$day_of_month) { ?>
<li class="active">
<?php } else { ?>
<li>
<?php } ?>
<?php if (sizeof($events)!=0) { ?>
<a href="../aktiviteter/?<?="year=$year&amp;month=$month&amp;day=$day"?>"><div>
<span class="noselect"><?= $day ?>.</span>
<?php foreach($events as $event) { ?>
<section><?=$event->getName()?></section>
<ul>
<li class="header noselect">mandag
<li class="header noselect">tirsdag
<li class="header noselect">onsdag
<li class="header noselect">torsdag
<li class="header noselect">fredag
<li class="header noselect">lørdag
<li class="header noselect">søndag
<?php if ($days_before_the_first != 0) { ?>
<li class="outOfMonth" style="grid-column: 1/<?=$days_before_the_first+1?>;">
<?php } ?>
<?php for ($day=1; $day <= $days_in_month; $day++) { ?>
<?php $events = $agenda->getEventsBetween(
new DateTimeImmutable("$year-$month-$day 00:00:00"),
new DateTimeImmutable("$year-$month-$day 23:59:59")); ?>
<?php if ($day==$day_of_month) { ?>
<li class="active">
<?php } else { ?>
<li>
<?php } ?>
</div></a>
<?php } else { ?>
<span class="noselect"><?= $day ?>.</span>
<?php } ?>
<?php } ?>
</ul>
<?php if (sizeof($events)!=0) { ?>
<a href="../aktiviteter/?<?="year=$year&amp;month=$month&amp;day=$day"?>"><div>
<span class="noselect day"><?= $day ?>.</span>
<?php foreach($events as $event) { ?>
<section style="background: <?=$event->getColor()?>"><?=$event->getName()?></section>
<?php } ?>
</div></a>
<?php } else { ?>
<span class="noselect day"><?= $day ?>.</span>
<?php } ?>
<?php } ?>
</ul>
</figure>
</main>
</body>
<body>

View File

@ -1,11 +1,7 @@
<!DOCTYPE html>
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../../inc/navbar.php';
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
?>
<!DOCTYPE html>
<html lang="no">
<head>
@ -14,7 +10,6 @@ require __DIR__ . '/../../sql_config.php';
<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/nav.css">
<link rel="stylesheet" href="../css/events.css">
</head>
@ -24,7 +19,6 @@ require __DIR__ . '/../../sql_config.php';
<?php echo loginbar(); ?>
</nav>
<main>
<h2>Kommunikasjon</h2>
<p>
@ -40,4 +34,4 @@ require __DIR__ . '/../../sql_config.php';
Det er også mulig å ta i bruk analog kontakt ved å møte opp <a href="https://use.mazemap.com/?v=1&left=10.4032&right=10.4044&top=63.4178&bottom=63.4172&campusid=1&zlevel=2&sharepoitype=point&sharepoi=10.40355%2C63.41755%2C2&utm_medium=longurl"> stripa</a>.
</p>
</main>
</body>
</body>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

View File

@ -1,11 +1,8 @@
<!DOCTYPE html>
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
use \pvv\side\Agenda;
?>
<!DOCTYPE html>
<html lang="no">
<title>Sosialverkstedet</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@ -25,8 +22,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
?>
<article>
<h2><img src="../sosiale/nerdepitsa.jpg"><em><?= $nextEvent->getRelativeDate()?></em> Nerdepitsa</h2>
<ul class="subtext">
<li>Tid:
@ -48,11 +43,7 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
</main>
<nav><ul>
<li><a href="../">hjem</a></li>
<!--<li><a href="../prosjekt/">prosjekter</a></li>-->
<li class="active"><a href="../aktiviteter/">aktiviteter</a></li>
<li><a href="../prosjekt/">prosjekter</a></li>
<li><a href="../kontakt/">kontakt</a></li>
<li><a href="../pvv/">wiki</a></li>
<nav>
<?= navbar(1, 'aktiviteter'); ?>
<?= loginbar($sp, $pdo); ?>
</nav>

63
www/om/index.php Normal file
View File

@ -0,0 +1,63 @@
<?php
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
?>
<!DOCTYPE html>
<html lang=no>
<style>
p {hyphens: auto;}
</style>
<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/events.css">
<header>Programvareverkstedet</header>
<main>
<article>
<h2>Om Programvareverkstedet</h2>
<p>Velkommen til Programvareverkstedets nettside. Programvareverkstedet (PVV) er en studentorganisasjon ved Norges Teknisk-Naturvitenskapelige Universitet (NTNU). PVVs formål er å skape et miljø for datainteresserte personer tilknyttet universitetet. Nåværende og tidligere studenter ved NTNU, samt ansatte ved NTNU og tilstøtende miljø, kan bli medlemmer.</p>
</article>
<article>
<h2>Hva betyr det å være et medlem av PVV?</h2>
<p>Alle medlemmer av PVV får brukerkonto PVV sine maskiner, epostadresse (<code lang="">brukernavn@pvv.ntnu.no</code> og <code lang="">brukernavn@pvv.org</code>) og 757 MB diskplass, som blant annet kan brukes til hjemmesider. Dersom du går tom for diskplass er det mulig å kjøpe utvidet diskkvote. For å aktivere brukerkonto PVV, man møte opp lokalene slik at man får satt passord.
<p>I tillegg får man tilgang til PVVs to oppholdsrom, rom 226 og 229 i Sentralbygg 2 (se kart over andre etasje i SBII). rom 229 er det seks arbeidsstasjoner som kjører Linux, macOS, FreeBSD, samt bordplass, nettverksuttak og egen Wifi AP for laptoper. rom 226 er det sofakrok med TV og diverse spillkonsoller.
<p>Dersom du ønsker å lære Unix er det god anledning til det PVV. Vi har et sterkt faglig miljø, med mange svært kunnskapsrike personer, som stort sett ikke har noe imot å hjelpe nybegynnere. Man kan større privilegier her enn stud-maskinene, for eksempel gjennom å bli med i PVV-drift.
<p>PVV har gratis kaffe for medlemmer. Vi organiserer kurs og andre arrangementer. De aller fleste arrangementene er gratis.
<p>PVV har også ei relativt innholdsrik boksamling til disposisjon for medlemmene, samt ei bokhylle full av blad og tegneserier. (For tiden abonnerer vi Lunch tegneserie). Vi har i tillegg et romslig bokbudsjett, dersom du har forslag til bøker/blad vi burde kjøpe inn er det bare å sende en mail til styret (<code lang="">pvv@pvv.ntnu.no</code>). Ta en titt hva som står i bokhyllen.
<p>PVV har også en del brettspill du kan prøve.
</article>
<article>
<h2>Hvordan bli medlem</h2>
<p>Første steg for å bli medlem i PVV er å betale medlemskontingent.
<p>Medlemskontingenten er kr 50,00 per år. Det er også mulig å bli livstidsmedlem ved å betale kr 1024,00 én gang. Kontingent betales til konto <code lang="">8601.11.16916</code>. Betalingen merkes med NTNU brukernavn.
<p>Det er mulig å betale for flere år samtidig ved å betale et helt multiplum av kr 50.
<p>Kontingentinnbetalinger blir registrert i medlemsdatabasen, og det er lurt å sjekke at betalingen din dukker opp her (merk at det kan ta litt tid fra du betaler til kasserer får beskjed om det, og deretter litt tid før kasserer fører betalingen inn i regnskap og medlemsdatabase).
<p>
<a class="btn" href="../paamelding/">Registrer deg som bruker</a>
</p>
</article>
</main>
<nav>
<?= navbar(1); ?>
<?= loginbar($sp, $pdo); ?>
</nav>

View File

@ -1,11 +1,8 @@
<?php
require_once __DIR__ . '/../../inc/navbar.php';
require_once __DIR__ . '/../../lib/OAuth2-Client/OAuth2Client.php';
require_once __DIR__ . '/../../dataporten_config.php';
require_once __DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
session_start();
$as = new SimpleSAML_Auth_Simple('default-sp');
$attrs = $as->getAttributes();
$oauth2 = new Kasperrt\Oauth2($dataportenConfig);
@ -20,7 +17,7 @@ if (isset($_GET['login'])) {
die();
}
if (isset($_GET['code'])) {
$token = $oauth2 -> get_access_token();
$token = $oauth2 -> get_access_token(htmlspecialchars($_GET['state']), htmlspecialchars($_GET['code']));
$_SESSION['userdata'] = $oauth2 -> get_identity($token, 'https://auth.dataporten.no/userinfo');
header('Location: ' . $dataportenConfig["redirect_uri"]);
@ -28,11 +25,22 @@ if (isset($_GET['code'])) {
}
if (isset($_SESSION['userdata'])) { // if logged in with feide
$mailHeaders = "MIME-Version: 1.0" . "\r\n";
$mailHeaders .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$mailHeaders .= 'From: <spikkjeposche@pvv.ntnu.no>' . "\r\n";
$mailHeaders .= 'Cc: <' . htmlspecialchars($_SESSION['userdata']['user']['email']) .'>' . "\r\n";
$mailParams = "-fspikkjeposche@pvv.ntnu.no";
$mailTo = "nybruker@pvv.ntnu.no";
$mailSubject = "Nytt medlem for PVV";
$mailBody
= "Hei, jeg vil bli medlem på PVV.\n"
. "Navn: " . htmlspecialchars($_SESSION['userdata']['user']['name']) . "\n"
. "Brukernavn: " . htmlspecialchars($_SESSION['userdata']['user']['userid_sec'][0]) . "\n"
. "Epost: " . htmlspecialchars($_SESSION['userdata']['user']['email']) . "\n";
. "Epost: " . htmlspecialchars($_SESSION['userdata']['user']['email']) . "\n"
. "Jeg skal betale medlemsavgiften, og kommer innom PVVs lokaler for å aktivere kontoen min";
if (isset($_GET['send_mail'])) { // if logged in with feide
mail($mailTo, $mailSubject, $mailBody, $mailHeaders, $mailParams);
}
}
?>
@ -63,6 +71,32 @@ if (isset($_SESSION['userdata'])) { // if logged in with feide
For å aktivere din brukerkonto PVV, du møte opp
lokalene våre slik at vi kan satt et passord.
</p>
<?php if($attrs) { //logged in with pvv account?>
<p>
Du er logget in som <i><?= htmlspecialchars($attrs['uid'][0]) ?></i>,
og trenger klart ikke sende melding om å ny PVV bruker.
</p>
<?php } elseif (isset($_SESSION['userdata'])) { //logged in with feide ?>
<?php if (! isset($_GET['send_mail'])) { ?>
<h3>Meldingen som du sender:</h3>
<code>
Til: <?=$mailTo?><br>
Fra: nettsiden<br>
Tittel: <?=$mailSubject?><br>
<br/>
<?= nl2br($mailBody) ?>
</code><br>
<br>
<a class="btn" href=".?send_mail#sent">Send!</a>
<?php } else { // not logged in?>
<p id="sent">
Meldingen har blitt sendt!
</p>
<?php }?>
<?php } else { // not logged in?>
<a class="btn" href=".?login">Hent navn og epost fra Feide</a>
<?php }?>
<h3>Meldingen du kan sende:</h3>
@ -84,6 +118,5 @@ if (isset($_SESSION['userdata'])) { // if logged in with feide
<?php } else { // not logged in?>
<a class="btn" href=".?login">æ kanj itj lææv uten piær!</a>
<?php }?>
</main>
</body>

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../inc/navbar.php';
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';

View File

@ -1,13 +1,7 @@
<?php
error_reporting(E_ALL);
date_default_timezone_set('Europe/Oslo');
require __DIR__ . '/../../inc/navbar.php';
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';
require_once dirname(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);
$projectManager = new \pvv\side\ProjectManager($pdo);
$projects = $projectManager->getAll();
?>
@ -22,7 +16,7 @@ $projects = $projectManager->getAll();
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="../css/nav.css">
<link rel="stylesheet" href="../css/splash.css">
<link rel="stylesheet" href="../css/projects.css"
<link rel="stylesheet" href="../css/projects.css">
</head>
<body>
@ -64,7 +58,6 @@ $projects = $projectManager->getAll();
</div>
<p class="project-organizer">Organisert av<br><?= $project->getOwner(); ?></p>
</div>
<?php } ?>
<?php
}

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../inc/navbar.php';
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';
@ -39,80 +39,78 @@ $projects = array_values(array_filter(
));
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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/splash.css">
<link rel="stylesheet" href="../css/admin.css">
</head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../css/normalize.css">
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="../css/events.css">
<link rel="stylesheet" href="../css/admin.css">
<body>
<nav>
<?php echo navbar(1, 'prosjekt'); ?>
<?php echo loginbar(); ?>
</nav>
<header>Prosjekt&shy;verkstedet</header>
<main>
<main>
<article class="gridsplit">
<div class="gridl">
<h2 class="no-chin">Mine Prosjekter</h2>
<hr class="ruler">
<div class="gridsplit">
<div class="gridl">
<ul class="event-list">
<?php
$counter = 0;
$pageLimit = 4;
<ul class="event-list">
<?php
$counter = 0;
$pageLimit = 4;
for($i = ($pageLimit * ($page - 1)); $i < count($projects); $i++){
if($counter == $pageLimit){
break;
}
$project = $projects[$i];
$projectID = $project->getID();
?>
<li>
<div class="event">
<div class="event-info">
<h3 class="no-chin"><?= '<a href="edit.php?id=' . $project->getID() . '">' . $project->getName() . '</a>'; ?></h3>
<p><?= implode($project->getDescription(), "<br>"); ?></p>
</div>
</div>
</li>
<?php
$counter++;
}
?>
</ul>
<?php
if($page != 1){
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '">Forrige side</a>';
for($i = ($pageLimit * ($page - 1)); $i < count($projects); $i++){
if($counter == $pageLimit){
break;
}
if(($counter == $pageLimit) and (($pageLimit * $page) < count($projects))){
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '">Neste side</a>';
}
?>
</div>
$project = $projects[$i];
$projectID = $project->getID();
?>
<div class="gridr">
<h2>Verktøy</h2>
<a class="btn" href="edit.php?new=1">Lag prosjekt</a>
<h2>Filter</h2>
<form action="." method="post">
<p class="no-chin">Navn</p>
<?= '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">' ?><br>
<div style="margin-top: 2em;">
<input type="submit" class="btn" value="Filtrer"></input>
<li>
<div class="event">
<div class="event-info">
<h3 class="no-chin"><?= '<a href="edit.php?id=' . $project->getID() . '">' . $project->getName() . '</a>'; ?></h3>
<p><?= $project->getDescription(); ?></p>
</div>
</div>
</form>
</li>
<?php
$counter++;
}
?>
</ul>
<?php
if($page != 1){
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '">Forrige side</a>';
}
if(($counter == $pageLimit) and (($pageLimit * $page) < count($projects))){
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '">Neste side</a>';
}
?>
</div>
<div class="gridr">
<h2>Verktøy</h2>
<a class="btn" href="edit.php?new=1">Lag prosjekt</a>
<h2>Filter</h2>
<form action="." method="post">
<p class="no-chin">Navn</p>
<?= '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">' ?><br>
<div style="margin-top: 2em;">
<input type="submit" class="btn" value="Filtrer"></input>
</div>
</div class="gridsplit">
</main>
</body>
</form>
</div>
</article>
</main>
<nav>
<?= navbar(1, 'prosjekt'); ?>
<?= loginbar(); ?>
</nav>

View File

@ -1,6 +1,6 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);