Groundwork for project members
Tools for adding/removing members are coming soon (tm)
This commit is contained in:
parent
d984dfb89c
commit
30c8aa2032
|
@ -11,13 +11,20 @@ CREATE TABLE "events" (
|
|||
CREATE TABLE "projects" (
|
||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
"name" TEXT,
|
||||
"description" TEXT,
|
||||
"owner" TEXT,
|
||||
"owneruname" TEXT,
|
||||
"owneremail" TEXT,
|
||||
"description" TEXT,
|
||||
"active" BOOLEAN
|
||||
);
|
||||
|
||||
CREATE TABLE "projectmembers" (
|
||||
"projectid" INTEGER,
|
||||
"membername" TEXT,
|
||||
"memberuname" TEXT,
|
||||
"role" TEXT
|
||||
)
|
||||
|
||||
CREATE TABLE "users" (
|
||||
"uname" TEXT,
|
||||
"groups" INT DEFAULT 0
|
||||
|
|
|
@ -11,13 +11,20 @@ CREATE TABLE events (
|
|||
CREATE TABLE projects (
|
||||
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||
`name` TEXT,
|
||||
`description` TEXT,
|
||||
`owner` TEXT,
|
||||
`owneruname` TEXT,
|
||||
`owneremail` TEXT,
|
||||
`description` TEXT,
|
||||
`active` BOOLEAN
|
||||
);
|
||||
|
||||
CREATE TABLE projectmembers (
|
||||
`projectid` INTEGER,
|
||||
`name` TEXT,
|
||||
`uname` TEXT,
|
||||
`role` TEXT
|
||||
)
|
||||
|
||||
CREATE TABLE users (
|
||||
`uname` TEXT,
|
||||
`groups` INT DEFAULT 0
|
||||
|
|
|
@ -74,4 +74,18 @@ class ProjectManager{
|
|||
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public function getProjectMembers($id){
|
||||
$query = 'SELECT * FROM projectmembers WHERE projectid=:id';
|
||||
$statement = $this->pdo->prepare($query);
|
||||
$statement->bindParam(':id', $id, PDO::PARAM_STR);
|
||||
$statement->execute();
|
||||
|
||||
$members = [];
|
||||
foreach($statement->fetchAll() as $dbUsr){
|
||||
$members[] = ['name' => $dbUsr['name'], 'uname' => $dbUsr['uname'], 'role' => $dbUsr['role']];
|
||||
}
|
||||
|
||||
return $members;
|
||||
}
|
||||
}
|
|
@ -65,35 +65,36 @@
|
|||
border-left: 0;
|
||||
}
|
||||
|
||||
.projectowner {
|
||||
.projectmember {
|
||||
margin-bottom: 1em;
|
||||
padding: 0 .5em 0 .5em;
|
||||
overflow: hidden;
|
||||
border-left: 4px solid #35a;
|
||||
}
|
||||
|
||||
.projectowner p {
|
||||
.projectmember p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.projectowner p {
|
||||
.projectmember p {
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
.projectowner p:first-child {
|
||||
.projectmember p:first-child {
|
||||
font-size: 1em;
|
||||
margin-bottom: .2em;
|
||||
}
|
||||
|
||||
.owneruname, .owneremail {
|
||||
.memberuname, .memberemail {
|
||||
display: inline-block;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.owneruname {
|
||||
.memberuname {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.owneremail {
|
||||
.memberemail {
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ if($new == 0){
|
|||
<textarea name="desc" style="width:100%" rows="8" class="boxinput"><?= implode($project->getDescription(), "\n"); ?></textarea>
|
||||
|
||||
<?= '<input type="hidden" name="id" value="' . $project->getID() . '" />' ?>
|
||||
<input type="hidden" name="active" value="1"/>
|
||||
|
||||
<div style="margin-top: 2em;">
|
||||
<hr class="ruler">
|
||||
|
|
|
@ -11,6 +11,8 @@ if(isset($_GET['id'])){
|
|||
|
||||
$projectManager = new \pvv\side\ProjectManager($pdo);
|
||||
$project = $projectManager->getByID($projectID);
|
||||
|
||||
$members = $projectManager->getProjectMembers($projectID);
|
||||
?>
|
||||
|
||||
<head>
|
||||
|
@ -36,15 +38,24 @@ $project = $projectManager->getByID($projectID);
|
|||
<div class="gridl">
|
||||
<div class="projectlead">
|
||||
<h2>Prosjektledelse</h2>
|
||||
<div class="projectowner">
|
||||
<div class="projectmember">
|
||||
<p>Prosjekteier</p>
|
||||
<p class="ownername"><?= $project->getOwner() ?></p>
|
||||
<p class="owneruname"><?= $project->getOwnerUName(); ?></p>
|
||||
<p class="owneremail"><?= $project->getOwnerEmail(); ?></p>
|
||||
<p class="membername"><?= $project->getOwner() ?></p>
|
||||
<p class="memberuname"><?= $project->getOwnerUName(); ?></p>
|
||||
<p class="memberemail"><?= $project->getOwnerEmail(); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="projectmembers">
|
||||
<h2>Medlemmer</h2>
|
||||
<?php foreach($members as $i => $data){ ?>
|
||||
<div class="projectmember">
|
||||
<p><?= $data['role'] ?></p>
|
||||
<p class="membername"><?= $data['name'] ?></p>
|
||||
<p class="memberuname"><?= $data['uname'] ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
|
@ -16,11 +16,8 @@ $as = new SimpleSAML_Auth_Simple('default-sp');
|
|||
$as->requireAuth();
|
||||
$attrs = $as->getAttributes();
|
||||
|
||||
$id = 0;
|
||||
if(isset($_POST['id'])){
|
||||
$id = $_POST['id'];
|
||||
$active = $_POST['active'];
|
||||
}
|
||||
$id = $_POST['id'];
|
||||
$active = $_POST['active'];
|
||||
|
||||
$title = $_POST['title'];
|
||||
$desc = $_POST['desc'];
|
||||
|
@ -30,7 +27,7 @@ $owneremail = $attrs['mail'][0];
|
|||
|
||||
$statement;
|
||||
if($id == 0){
|
||||
$query = 'INSERT INTO projects (name, owner, owneruname, owneremail, description, active) VALUES (:title, :owner, :owneruname, :desc, 1)';
|
||||
$query = 'INSERT INTO projects (name, owner, owneruname, owneremail, description, active) VALUES (:title, :owner, :owneruname, :owneremail, :desc, 1)';
|
||||
$statement = $pdo->prepare($query);
|
||||
|
||||
$statement->bindParam(':title', $title, PDO::PARAM_STR);
|
||||
|
|
Loading…
Reference in New Issue