2018-02-24 19:41:57 +01:00
|
|
|
<?php
|
|
|
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
|
|
|
|
|
|
|
$projectID = 0;
|
|
|
|
if(isset($_GET['id'])){
|
|
|
|
$projectID = $_GET['id'];
|
|
|
|
}else{
|
|
|
|
echo 'No project ID provided';
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2018-08-09 00:44:55 +02:00
|
|
|
require_once(__DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
|
|
|
$as = new SimpleSAML_Auth_Simple('default-sp');
|
|
|
|
$attrs = $as->getAttributes();
|
|
|
|
|
2018-02-24 19:41:57 +01:00
|
|
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
|
|
|
$project = $projectManager->getByID($projectID);
|
2018-08-12 03:43:50 +02:00
|
|
|
if (!$project) {
|
|
|
|
echo ":^)";
|
|
|
|
exit();
|
|
|
|
}
|
2018-02-24 21:09:15 +01:00
|
|
|
|
|
|
|
$members = $projectManager->getProjectMembers($projectID);
|
2018-08-19 14:51:08 +02:00
|
|
|
$normal_members = $members;
|
|
|
|
foreach($normal_members as $i => $data){
|
|
|
|
if($data['lead']){
|
|
|
|
unset($normal_members[$i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-09 00:44:55 +02:00
|
|
|
$is_owner = False;
|
|
|
|
$is_member = False;
|
|
|
|
if ($attrs){
|
|
|
|
$uname = $attrs['uid'][0];
|
|
|
|
foreach($members as $member){
|
|
|
|
if ($member['uname'] == $uname){
|
|
|
|
if ($member['owner']==1){
|
|
|
|
$is_owner = True;
|
|
|
|
}
|
|
|
|
else if ($member['owner']==0){
|
|
|
|
$is_member = True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-24 19:41:57 +01:00
|
|
|
?>
|
2018-08-09 00:44:55 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="no">
|
2018-08-14 02:09:32 +02:00
|
|
|
<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/projects.css">
|
2018-08-14 03:29:10 +02:00
|
|
|
<meta name="theme-color" content="#024" />
|
2018-08-14 02:09:32 +02:00
|
|
|
<title>Prosjektverkstedet</title>
|
|
|
|
|
|
|
|
<header>Prosjekt­verk­stedet</header>
|
|
|
|
|
2018-02-24 19:41:57 +01:00
|
|
|
|
|
|
|
<body>
|
|
|
|
<nav>
|
|
|
|
<?php echo navbar(2, 'prosjekt'); ?>
|
|
|
|
<?php echo loginbar(null, $pdo); ?>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<main class="contentsplit">
|
|
|
|
<div class="gridr">
|
|
|
|
<h2><?= $project->getName(); ?></h2>
|
2018-08-12 03:52:55 +02:00
|
|
|
<?php
|
|
|
|
$Parsedown = new \Parsedown();
|
|
|
|
echo $Parsedown->text(implode("\n", $project->getDescription()));
|
|
|
|
?>
|
2018-02-24 19:41:57 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="gridl">
|
2018-08-14 02:53:11 +02:00
|
|
|
<div class="projectmember-container">
|
|
|
|
|
2018-02-24 19:41:57 +01:00
|
|
|
<div class="projectlead">
|
2018-08-09 00:44:55 +02:00
|
|
|
<h2>Prosjektledelsen</h2>
|
2018-02-24 21:09:15 +01:00
|
|
|
<div class="projectmember">
|
2018-08-14 02:53:11 +02:00
|
|
|
<?php foreach($members as $i => $data){
|
2018-02-26 16:24:50 +01:00
|
|
|
if($data['lead']){
|
|
|
|
?>
|
2018-08-14 02:53:11 +02:00
|
|
|
<p><?= $data['name']; ?></p>
|
|
|
|
<p class="memberrole"><?= $data['role'] ?></p>
|
2018-02-26 16:24:50 +01:00
|
|
|
<p class="memberuname"><?= $data['uname']; ?></p>
|
|
|
|
<p class="memberemail"><?= $data['mail']; ?></p>
|
|
|
|
<?php }
|
|
|
|
} ?>
|
2018-02-24 19:41:57 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-08-19 14:51:08 +02:00
|
|
|
<?php
|
|
|
|
if(sizeof($normal_members) > 0){
|
|
|
|
?>
|
|
|
|
<div class="projectmembers">
|
|
|
|
<h2>Medlemmer</h2>
|
|
|
|
<?php foreach($normal_members as $i => $data){
|
|
|
|
?>
|
|
|
|
<div class="projectmember" style="border-color: #6a0;">
|
|
|
|
<p><?= $data['name']; ?></p>
|
|
|
|
<p class="memberrole"><?= $data['role'] ? $data['role'] : 'Deltaker' ?></p>
|
|
|
|
<p class="memberuname"><?= $data['uname']; ?></p>
|
|
|
|
<p class="memberemail"><?= $data['mail']; ?></p>
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!$is_owner){
|
|
|
|
?>
|
|
|
|
|
|
|
|
<form action="update.php", method="post"><p>
|
|
|
|
<input type="hidden" name="title" value="derp"/>
|
|
|
|
<input type="hidden" name="desc" value="derp"/>
|
|
|
|
<input type="hidden" name="active" value="derp"/>
|
|
|
|
<input type="hidden" name="id" value="<?= $projectID ?>"/>
|
|
|
|
<input type="submit" class="btn" name="join_or_leave" value="<?= ($is_member ? 'Forlat' : 'Bli med!') ?>"></input>
|
|
|
|
</p></form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2018-02-24 21:09:15 +01:00
|
|
|
</div>
|
2018-02-24 19:41:57 +01:00
|
|
|
</div>
|
|
|
|
</main>
|
2018-08-09 00:44:55 +02:00
|
|
|
</body>
|