Aktivietsadministrasjon
= ($new == 1 ? "Ny hendelse" : "Rediger hendelse"); ?>
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $userManager = new \pvv\admin\UserManager($pdo); require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php'); $as = new \SimpleSAML\Auth\Simple('default-sp'); $as->requireAuth(); $attrs = $as->getAttributes(); $uname = $attrs['uid'][0]; $name = $attrs['cn'][0]; if(!$userManager->hasGroup($uname, 'aktiviteter')){ echo 'Her har du ikke lov\'t\'å\'værra!!!'; exit(); } $customActivity = new \pvv\side\DBActivity($pdo); $new = 0; if(isset($_GET['new'])){ $new = $_GET['new']; } $eventID = 0; if(isset($_GET['id'])){ $eventID = $_GET['id']; }else if($new == 0){ echo "\nID not set"; exit(); } $today = new DateTimeImmutable; $today = $today->setTime(18, 15); $defaultStart = $today->format("Y-m-d H:15:00"); $inTwoHours = $today->add(new DateInterval('PT1H45M')); $defaultEnd = $inTwoHours->format("Y-m-d H:00:00"); $event; if($new == 0){ $event = $customActivity->getEventByID($eventID); } else { $event = new \pvv\side\SimpleEvent( 0, '', $today, $inTwoHours, '', '', '' ); } ?>