60 lines
1.6 KiB
PHP
60 lines
1.6 KiB
PHP
<?php
|
|
session_start ();
|
|
include_once 'clazz/Zincluder.php';
|
|
|
|
try{
|
|
|
|
$discuts = Discussion::getVisibleDiscuts($_SESSION['session_id'] ?? NULL,$_SESSION['session_mdp'] ?? NULL);
|
|
|
|
}catch(SQLProcessingException $e){
|
|
var_dump($e);
|
|
echo $e->getHtmlMessage();
|
|
$_SESSION ['current_error'] = $e->getHtmlMessage();
|
|
header ( 'Location:' . ($e->getPreferredRedirection() ?? 'index.php') );
|
|
exit;
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<?php include 'includes/meta.php'; ?>
|
|
</head>
|
|
|
|
<body>
|
|
<?php include 'includes/header.php'; ?>
|
|
<br />
|
|
|
|
<?php
|
|
foreach ($discuts['discuts'] as $discut) {
|
|
echo '<a href="discut.php?d=' . $discut['ID'] . '">' . $discut['name'] . ' par ' . $discut['creatorPseudo'] . '</a><br/>';
|
|
}
|
|
?>
|
|
|
|
<br />
|
|
|
|
|
|
|
|
<?php if($discuts['canCreate']){?>
|
|
<span id="createNewDiscBefore">Creer une nouvelle discussion</span>
|
|
|
|
<form id="createNewDiscForm" action="executor.php?action=createDiscussion" method="post">
|
|
<label for="newDiscText"></label><input id="newDiscText" type="text" name="name" />
|
|
<input type="submit" value="Créer la discussion" />
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
//Creer nouvelle discussion click event //TODO upgrade to jquery
|
|
var span = document.getElementById('createNewDiscBefore');
|
|
span.addEventListener('click',function(){
|
|
document.getElementById('createNewDiscBefore').style.display = 'none';
|
|
document.getElementById('createNewDiscForm').style.display = 'block';
|
|
});
|
|
</script>
|
|
<br />
|
|
<br />
|
|
<?php }?>
|
|
|
|
<?php include 'includes/footer.php'; ?>
|
|
</body>
|
|
</html>
|