Version 2
This commit is contained in:
84
pagecontent/list-download.php
Normal file
84
pagecontent/list-download.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
$id = '';
|
||||
$string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJLKMNOPQRSTUVW0123456789";
|
||||
for ($i = 1; $i <= 256; $i++)
|
||||
{
|
||||
$zufallszahl = rand(0, 62);
|
||||
$zufallszahl = substr($string, $zufallszahl, 1);
|
||||
$id = $id . $zufallszahl;
|
||||
}
|
||||
|
||||
$myfile = fopen("temporary/" . $id . ".csv", "w") or die("Fehler beim Erstellen der Datei!");
|
||||
|
||||
$sql = "SELECT
|
||||
`value`
|
||||
FROM
|
||||
`VokabelBox2Content`
|
||||
WHERE
|
||||
`id` = '$list'";
|
||||
$result_articles = $conn->query($sql);
|
||||
while ($articleDb = mysqli_fetch_object($result_articles))
|
||||
{
|
||||
$value = $articleDb->value;
|
||||
}
|
||||
|
||||
$file = $articleDb->Ordner . '
|
||||
"Deutsch","Englisch"
|
||||
|
||||
';
|
||||
|
||||
fwrite($myfile, $file);
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT
|
||||
`value`
|
||||
FROM
|
||||
`VokabelBox2Content`
|
||||
WHERE
|
||||
`type` = 'voc' AND `path`= '$userid/lang/$list/' ORDER BY `lastedit` DESC";
|
||||
|
||||
|
||||
|
||||
$result_articles = $conn->query($sql);
|
||||
while ($articleDb = mysqli_fetch_object($result_articles))
|
||||
{
|
||||
|
||||
$voc = json_decode($articleDb->value, true);
|
||||
|
||||
$Sprache1 = html_entity_decode($voc[0]['1']);
|
||||
$Sprache2 = html_entity_decode($voc[0]['2']);
|
||||
|
||||
htmlspecialchars_decode($Sprache1);
|
||||
htmlspecialchars_decode($Sprache2);
|
||||
|
||||
$Sprache1 = str_replace("\"", "\"\"", $Sprache1);
|
||||
$Sprache2 = str_replace("\"", "\"\"", $Sprache2);
|
||||
|
||||
$file = "\"$Sprache1\",\"$Sprache2\"";
|
||||
fwrite($myfile, $file);
|
||||
|
||||
fwrite($myfile, "\r\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose($myfile);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="fixed-title">
|
||||
<h2>Liste herunterladen</h2>
|
||||
</div>
|
||||
<div class="fixed-title-spacer" align="center">
|
||||
<h4>Aktuell steht lediglich der Download als CSV-Datei zur Verfügung. Solche Dateien können mit allen Programmen geöffnet werden, welche Tabellen anzeigen können.<br>Es ist jedoch zu beachten, dass beim Import in ein Tabellen-Kalkulationsprogramm korrekte Einstellungen vorgenommen werden müssen.</h4>
|
||||
<br>
|
||||
<h4>Wenn Ihr Programm Sie nach Trennoptionen fragt, setzen Sie bitte:<br>-<u>nur</u> Komma als Trenner<br>-<u>doppelte Anführungszeichen</u> als Texttrenner.</h4>
|
||||
<br>
|
||||
<h4>Im Normalfall konfigurieren Programme diese Einstellungen aber von selbst.</h4>
|
||||
<div class="form">
|
||||
<button class="default-button" onclick="window.location.href='temporary/<?php echo $id ?>.csv'">Download .csv</button>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user