config('domain')));
    }
    public function get(): void
    {
        $opensim = new OpenSim($this->app->db());
        $table = '
| Name | GrĂ¼nder | Aktionen | 
|---|
';
        
        $statementGroups = $this->app->db()->prepare("SELECT Name,FounderID,os_groups_membership.GroupID FROM os_groups_groups JOIN os_groups_membership ON os_groups_groups.GroupID = os_groups_membership.GroupID WHERE PrincipalID = ?");
        $statementGroups->execute(array($_SESSION['UUID']));
    
        $csrf = $this->app->csrfField();
        while ($rowGroups = $statementGroups->fetch()) {
            $table = $table.'| '.htmlspecialchars($rowGroups['Name']).' | '.htmlspecialchars($opensim->getUserName($rowGroups['FounderID'])).' |  | 
';
        }
    
        $this->app->template('__dashboard.php')->vars([
            'title' => 'Gruppen',
            'username' => $_SESSION['DISPLAYNAME']
        ])->unsafeVar('child-content', $table.'
')->render();
    }
    public function post(): void
    {
        if (isset($_POST['leave'])) {
            $validator = new FormValidator(array(
                'group' => array('required' => true, 'regex' => '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/')
            ));
            if ($validator->isValid($_POST)) {
                $statementMembership = $this->app->db()->prepare("DELETE FROM os_groups_membership WHERE GroupID = ? AND PrincipalID = ?");
                $statementMembership->execute(array($_REQUEST['group'], $_SESSION['UUID']));
            }
        }
        header('Location: index.php?page=groups');
    }
}