2017-10-22 17:57:55 +02:00
|
|
|
<?php
|
|
|
|
ini_set('display_errors', '1');
|
|
|
|
date_default_timezone_set('Europe/Oslo');
|
|
|
|
setlocale(LC_ALL, 'no_NO');
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
require __DIR__ . '/../../src/_autoload.php';
|
|
|
|
require __DIR__ . '/../../sql_config.php';
|
|
|
|
|
|
|
|
require_once(__DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
|
|
|
$as = new SimpleSAML_Auth_Simple('default-sp');
|
|
|
|
$as->requireAuth();
|
|
|
|
$attrs = $as->getAttributes();
|
|
|
|
|
|
|
|
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
|
|
|
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
|
|
|
|
2017-10-28 20:09:54 +02:00
|
|
|
$new = 0;
|
|
|
|
if(isset($_GET['new'])){
|
|
|
|
$new = $_GET['new'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$projectID = 0;
|
|
|
|
if(isset($_GET['id'])){
|
|
|
|
$projectID = $_GET['id'];
|
|
|
|
}else if($new == 0){
|
|
|
|
echo "\nID not set";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-10-22 17:57:55 +02:00
|
|
|
$project = new \pvv\side\Project(
|
|
|
|
0,
|
|
|
|
'Nytt Prosjekt',
|
|
|
|
'',
|
|
|
|
$attrs["cn"][0],
|
|
|
|
$attrs["uid"][0],
|
|
|
|
1
|
|
|
|
);
|
2017-10-28 20:09:54 +02:00
|
|
|
if($new == 0){
|
|
|
|
$project = $projectManager->getByID($projectID);
|
|
|
|
|
|
|
|
if($project->getOwnerUName() != $attrs["uid"][0]){
|
|
|
|
header('HTTP/1.0 403 Forbidden');
|
|
|
|
echo "wrong user";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
2017-10-22 17:57:55 +02:00
|
|
|
?>
|
|
|
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
<link rel="stylesheet" href="../../css/normalize.css">
|
|
|
|
<link rel="stylesheet" href="../../css/style.css">
|
|
|
|
<link rel="stylesheet" href="../../css/events.css">
|
|
|
|
<link rel="stylesheet" href="../../css/admin.css">
|
|
|
|
|
2017-10-28 17:19:40 +02:00
|
|
|
<nav>
|
|
|
|
<ul>
|
2017-10-28 14:40:17 +02:00
|
|
|
<li><a href="../index.php">hjem</a></li>
|
2017-10-22 17:57:55 +02:00
|
|
|
<li><a href="../kalender/">kalender</a></li>
|
2017-10-28 14:40:17 +02:00
|
|
|
<li><a href="../aktiviteter/">aktiviteter</a></li>
|
2017-10-22 17:57:55 +02:00
|
|
|
<li class="active"><a href="../prosjekt/">prosjekter</a></li>
|
2017-10-28 14:40:17 +02:00
|
|
|
<li><a href="../kontakt/">kontakt</a></li>
|
|
|
|
<li><a href="../pvv/">wiki</a></li>
|
2017-10-28 17:19:40 +02:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if($attrs){
|
|
|
|
$uname = $attrs["uid"][0];
|
|
|
|
echo '<p class="login">logget inn som: ' . $uname . '</p>';
|
|
|
|
}else{
|
|
|
|
echo '<a class="login" href="' . $as->getLoginURL() . '">logg inn</a>';
|
|
|
|
}
|
|
|
|
?>
|
2017-10-22 17:57:55 +02:00
|
|
|
</nav>
|
|
|
|
|
2017-10-28 14:40:17 +02:00
|
|
|
|
|
|
|
<header>Prosjekt­verk­stedet</header>
|
2017-10-22 17:57:55 +02:00
|
|
|
|
|
|
|
<main>
|
|
|
|
|
|
|
|
<article>
|
|
|
|
<h2>Nytt prosjekt</h2>
|
|
|
|
|
|
|
|
<form action="update.php", method="post">
|
|
|
|
<p class="subtitle no-chin">Prosjektnavn</p>
|
|
|
|
<p class="subnote">Gi prosjektet ditt et passende navn</p>
|
2017-10-28 20:53:49 +02:00
|
|
|
<input type="text" name="title" value="<?= $project->getName() ?>" class="boxinput" style="width:66%;"><br>
|
2017-10-22 17:57:55 +02:00
|
|
|
|
|
|
|
<p class="subtitle no-chin">Beskrivelse</p>
|
|
|
|
<p class="subnote">Hva går prosjektet ditt ut på?</p>
|
2017-10-28 20:53:49 +02:00
|
|
|
<textarea name="desc" style="width:100%" rows="8" class="boxinput"><?= $project->getDescription() ?></textarea>
|
2017-10-22 17:57:55 +02:00
|
|
|
|
2017-10-28 20:09:54 +02:00
|
|
|
<?= '<input type="hidden" name="id" value="' . $project->getID() . '" />' ?>
|
|
|
|
|
2017-10-22 17:57:55 +02:00
|
|
|
<div style="margin-top: 2em;">
|
|
|
|
<hr class="ruler">
|
|
|
|
|
2017-10-28 20:09:54 +02:00
|
|
|
<?= '<input type="submit" class="btn" value="' . ($new ? 'Opprett prosjekt' : 'Lagre endringer') . '"></a>'; ?>
|
2017-10-22 17:57:55 +02:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</article>
|
|
|
|
|
2017-10-28 14:40:17 +02:00
|
|
|
</main>
|