simpleWordsCloud/index.php

38 lines
965 B
PHP
Raw Normal View History

2020-11-15 21:51:28 +01:00
<?php
2020-11-23 11:01:37 +01:00
include('init.php');
2020-11-15 21:51:28 +01:00
include('templates/header.php');
if (isset($_GET['id'])) {
$id = $_GET['id'];
if (!$db->isCloud($id)) {
2020-11-23 11:01:37 +01:00
echo L::cloud_noId;
2020-11-15 21:51:28 +01:00
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-23 11:01:37 +01:00
echo sprintf('<input class="cloud_words_input" type="text" id="%s" name="%s" placeholder="%s">',
$name, $name, L::save_word($i + 1)
);
2020-11-15 21:51:28 +01:00
}
?>
2020-11-23 11:01:37 +01:00
<input id="cloud_words_submit" type="submit" value="<?php echo L::save_submit ?>">
2020-11-15 21:51:28 +01:00
</form>
2020-11-23 11:01:37 +01:00
<p><?php echo L::save_message ?></p>
2020-11-15 21:51:28 +01:00
<?php
} else {
?>
2020-11-23 11:01:37 +01:00
<p><?php echo L::cloud_create_message ?></p>
2020-11-15 21:51:28 +01:00
<form method="post" action="create.php">
2020-11-23 11:01:37 +01:00
<input type="submit" value="<?php echo L::create ?>">
2020-11-15 21:51:28 +01:00
</form>
<?php
}
include('templates/footer.php');
?>