Prosjektadministrasjon
Prosjekter
-
getID();
?>
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]; if(!$userManager->hasGroup($uname, 'prosjekt')){ echo 'Her har du ikke lov\'t\'å\'værra!!!'; exit(); } $projectManager = new \pvv\side\ProjectManager($pdo); $projects = $projectManager->getAll(); $page = 1; if(isset($_GET['page'])){ $page = $_GET['page']; } $filterTitle = ''; if(isset($_POST['title'])){ $filterTitle = $_POST['title']; } $filterOrganiser = ''; if(isset($_POST['organiser'])){ $filterOrganiser = $_POST['organiser']; } // filter $projects = array_values(array_filter( $projects, function($project) use ($filterTitle, $filterOrganiser){ return (preg_match('/.*'.$filterTitle.'.*/i', $project->getName()) and preg_match('/.*'.$filterOrganiser.'.*/i', $project->getOwner())); } )); ?>