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