Make it possible to view projects in more detail

This commit is contained in:
Peder Bergebakken Sundt 2018-08-09 00:44:55 +02:00
parent adab82964d
commit 34668cb0ea
3 changed files with 40 additions and 6 deletions

View File

@ -1,3 +1,9 @@
a.nostyle {
text-decoration: none;
color:inherit;
cursor: pointer;
}
.project-card {
position: relative;
box-sizing: border-box;

View File

@ -90,13 +90,13 @@ $projects = $projectManager->getAll();
$owner = $projectManager->getProjectOwner($project->getID());
?>
<div class="project-card">
<a class="nostyle" href="info.php?id=<?= $project->getID() ?>"><div class="project-card">
<div class="card-content">
<h4 class="project-title"><?= $project->getName(); ?></h4>
<p><?= implode('<br>',array_slice($project->getDescription(), 0, 2)); ?></p>
</div>
<p class="project-organizer">Organisert av <?= $owner['name']; ?></p>
</div>
</div></a>
<?php } ?>
</div>
<center>

View File

@ -9,12 +9,32 @@ if(isset($_GET['id'])){
exit();
}
require_once(__DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
$as = new SimpleSAML_Auth_Simple('default-sp');
$attrs = $as->getAttributes();
$projectManager = new \pvv\side\ProjectManager($pdo);
$project = $projectManager->getByID($projectID);
$members = $projectManager->getProjectMembers($projectID);
$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;
}
}
}
}
?>
<!DOCTYPE html>
<html lang="no">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../css/normalize.css">
@ -37,7 +57,7 @@ $members = $projectManager->getProjectMembers($projectID);
<div class="gridl">
<div class="projectlead">
<h2>Prosjektledelse</h2>
<h2>Prosjektledelsen</h2>
<div class="projectmember">
<?php foreach($members as $i => $data){
if($data['lead']){
@ -56,12 +76,20 @@ $members = $projectManager->getProjectMembers($projectID);
<?php foreach($members as $i => $data){
if($data['lead']){ continue; }
?>
<div class="projectmember">
<div class="projectmember" style="border-color: #6a0;">
<p><?= $data['role'] ? $data['role'] : 'Deltaker' ?></p>
<p class="membername"><?= $data['name']; ?></p>
<p class="memberuname"><?= $data['uname']; ?></p>
<p class="memberemail"><?= $data['mail']; ?></p>
</div>
<?php } ?>
<p><form action="update.php", method="post">
<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>
</form></p>
</div>
</div>
</main>