/** * Tests if the visitor is connected and if he's a training manager and return the documents. Else, return to the index page. **/ public function controlDocuments() { $pageView = new PageView(); if (isset($_SESSION['infoUser']) && $_SESSION['infoUser']['user_type'] == 'Etudiant') { echo '<script>document.location.href="../view/index.php"</script>'; } else { $accountmodel = new AccountModel(); $result = $accountmodel->nbDocuments(); if ($result[0] == 0) { echo '<script>document.location.href="../view/index.php"</script>'; } } }