2020-11-15 21:51:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include('templates/header.php');
|
|
|
|
include('db.php');
|
|
|
|
|
|
|
|
$db = new DataBase();
|
|
|
|
if (!$db->isInit()) {
|
|
|
|
echo 'Error db init';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$db->buildTables();
|
|
|
|
if (isset($_GET['id'])) {
|
|
|
|
$id = $_GET['id'];
|
|
|
|
if (!$db->isCloud($id)) {
|
|
|
|
echo 'NO CLOUD';
|
|
|
|
return;
|
|
|
|
}
|
2020-11-16 21:31:59 +01:00
|
|
|
$nbWords = $db->getCloudSize($id);
|
|
|
|
echo sprintf('<p class="cloud_text">%s</p>', $db->getCloudText($id));
|
2020-11-15 21:51:28 +01:00
|
|
|
?>
|
2020-11-16 21:31:59 +01:00
|
|
|
<form class="cloud_words" method="post" action="save.php">
|
2020-11-15 21:51:28 +01:00
|
|
|
<input type="hidden" id="fid" name="fid" value="<?php echo $id;?>">
|
|
|
|
<?php
|
|
|
|
for ($i=0;$i<$nbWords;$i++) {
|
|
|
|
$name = 'fword' . $i;
|
2020-11-16 22:13:13 +01:00
|
|
|
echo sprintf('<input class="cloud_words_input" type="text" id="%s" name="%s" placeholder="Mot %d">', $name, $name, $i+1);
|
2020-11-15 21:51:28 +01:00
|
|
|
}
|
|
|
|
?>
|
2020-11-16 22:13:13 +01:00
|
|
|
<input id="cloud_words_submit" type="submit" value="Enregistrer">
|
2020-11-15 21:51:28 +01:00
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
?>
|
|
|
|
<p>Voulez-vous créer un nouveau nuage de mots?</p>
|
|
|
|
<form method="post" action="create.php">
|
|
|
|
<input type="submit" value="Créer">
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
include('templates/footer.php');
|
|
|
|
?>
|