simpleWordsCloud/index.php

37 lines
968 B
PHP

<?php
include('init.php');
include('templates/header.php');
if (isset($_GET['id'])) {
$id = $_GET['id'];
if (!$db->loadCloud($id)) {
echo L::cloud_noId;
return;
}
$nbWords = $db->getCloudSize();
echo sprintf('<p class="cloud_text">%s</p>', $db->getCloudText());
?>
<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 sprintf('<input class="cloud_words_input" type="text" id="%s" name="%s" placeholder="%s">',
$name, $name, L::save_word($i + 1)
);
}
?>
<input id="cloud_words_submit" type="submit" value="<?php echo L::save_submit ?>">
</form>
<p><?php echo L::save_message ?></p>
<?php
} else {
?>
<p><?php echo L::cloud_create_message ?></p>
<form method="post" action="create.php">
<input type="submit" value="<?php echo L::create_button ?>">
</form>
<?php
}
include('templates/footer.php');
?>