simpleWordsCloud/index.php

38 lines
968 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'];
2020-11-25 23:24:43 +01:00
if (!$db->loadCloud($id)) {
2020-11-23 11:01:37 +01:00
echo L::cloud_noId;
2020-11-15 21:51:28 +01:00
return;
}
2020-11-25 23:24:43 +01:00
$nbWords = $db->getCloudSize();
echo sprintf('<p class="cloud_text">%s</p>', $db->getCloudText());
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-26 16:59:44 +01:00
<input type="submit" value="<?php echo L::create_button ?>">
2020-11-15 21:51:28 +01:00
</form>
<?php
}
include('templates/footer.php');
?>