44 lines
990 B
PHP
44 lines
990 B
PHP
<?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;
|
|
}
|
|
$nbWords = $db->getCloudSize($id);
|
|
echo sprintf('<p class="cloud_text">%s</p>', $db->getCloudText($id));
|
|
?>
|
|
<form class="cloud_words" method="post" action="save.php">
|
|
<input type="hidden" id="fid" name="fid" value="<?php echo $id;?>">
|
|
<?php
|
|
for ($i=0;$i<$nbWords;$i++) {
|
|
$name = 'fword' . $i;
|
|
echo '<div>';
|
|
echo sprintf('<label for="%s">Mot %d</label>', $name, $i+1);
|
|
echo sprintf('<input type="text" id="%s" name="%s">', $name, $name);
|
|
echo '</div>';
|
|
}
|
|
?>
|
|
<input type="submit" value="Submit">
|
|
</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');
|
|
?>
|