Begin work on project pages

Also store project owners' emails as contact info
This commit is contained in:
2018-02-24 19:41:57 +01:00
parent 63200f863b
commit d984dfb89c
11 changed files with 124 additions and 7 deletions

View File

@@ -42,6 +42,7 @@ $project = new \pvv\side\Project(
'',
'kåre knoll',
'pvvadmin',
'drift@pvv.ntnu.no',
0
);
if($new == 0){
@@ -86,6 +87,9 @@ if($new == 0){
<p class="subtitle">Prosjektleder (Navn)</p>
<?= '<input type="text" name="organisername" value="' . $project->getOwner(). '" class="boxinput">' ?>
<p class="subtitle">Prosjektleder E-post</p>
<?= '<input type="text" name="organiseremail" value="' . $project->getOwnerEmail(). '" class="boxinput">' ?><br>
<p class="subtitle">Aktiv</p>
<?= '<input type="checkbox" '. ($project->getActive() ? 'checked' : '') . ' name="active"/>' ?>
</div>

View File

@@ -32,26 +32,29 @@ $title = $_POST['title'];
$desc = $_POST['desc'];
$owner = $_POST['organisername'];
$uname = $_POST['organiser'];
$email = $_POST['organiseremail'];
$active = (isset($_POST['active']) ? $_POST['active'] : 0);
$statement;
if($id == 0){
$query = 'INSERT INTO projects (name, owner, owneruname, description, active) VALUES (:title, :owner, :uname, :desc, :active)';
$query = 'INSERT INTO projects (name, owner, owneruname, owneremail, description, active) VALUES (:title, :owner, :uname, :email, :desc, :active)';
$statement = $pdo->prepare($query);
$statement->bindParam(':title', $title, PDO::PARAM_STR);
$statement->bindParam(':desc', $desc, PDO::PARAM_STR);
$statement->bindParam(':owner', $owner, PDO::PARAM_STR);
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
$statement->bindParam(':email', $email, PDO::PARAM_STR);
$statement->bindParam(':active', $active, PDO::PARAM_INT);
}else{
$query = 'UPDATE projects SET name=:title, owner=:owner, owneruname=:uname, description=:desc, active=:active WHERE id=:id';
$query = 'UPDATE projects SET name=:title, owner=:owner, owneruname=:uname, owneremail=:email, description=:desc, active=:active WHERE id=:id';
$statement = $pdo->prepare($query);
$statement->bindParam(':title', $title, PDO::PARAM_STR);
$statement->bindParam(':desc', $desc, PDO::PARAM_STR);
$statement->bindParam(':owner', $owner, PDO::PARAM_STR);
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
$statement->bindParam(':email', $email, PDO::PARAM_STR);
$statement->bindParam(':active', $active, PDO::PARAM_INT);
$statement->bindParam(':id', $id, PDO::PARAM_INT);
}