Files
SE-LTD/.scratch/legacy/se/csvexport.php
T
2026-06-22 13:29:30 +02:00

332 lines
6.7 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
session_start();
session_destroy();
include("verbind.php");
error_reporting(0);
header("Content-Type: text/html; charset=utf-8");
define("csv_delimeter", ",");
$iname= $_GET['inf'];
$is= $_GET['is'];
$monat= $_GET['mo'];
$jahr= $_GET['ja'];
// $wl= $_GET['wl'];
$abweichung= $_GET['ab'];
$anz= $_GET['anz'];
$ausw= $_GET['ausw'];
$sd= $_GET['sd'];
$ed= $_GET['ed'];
$st= $_GET['st'];
if (empty($monat)) {$monat = $anz;}
?>
<html>
<head>
<link rel="stylesheet" href="style.css" media="screen">
<link rel="stylesheet" href="tigra_calendar/tcal.css" media="screen">
<script type="text/javascript"src="dygraph/dygraph.js"></script>
<script type="text/javascript"src="Suggest/ajax.js"></script>
<script type="text/javascript"src="Suggest/suggest.js"></script>
<script type="text/javascript"src="Suggest/jquery.js"></script>
<link rel="stylesheet" src="dygraph/dygraph.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" async>
function show(id)
{
if (document.getElementById(id).style.display=='none')
{document.getElementById(id).style.display='block'; }
else
{ document.getElementById(id).style.display='none'; }
}
//]]>
</script>
<script type="text/javascript" async>
function test() {
location.href = 'index.php?op=1';
};
</script>
<script type="text/javascript"src="tigra_calendar/tcal.js"></script>
</head>
<body>
<?php
echo "<div class='topindex'>";
echo "<img class='bild' usemap= 'Mapi' src='bilder/logo.png' alt='SE'/>";
?>
<a href="index.php" ><?php echo " <span class='rechtsmen'><img class='bildbot' usemap= 'Mapi' src='bilder/home.png' alt='SE'/> </span>";?></a>
<?php
echo "<div class='titel'>";
echo "<div class='titelfett'>CSV-Export</div>";
echo "<br>";
echo "$name";
echo "<br>";
echo "$name2";
echo "<br>";
echo "$text";
echo "</div>";
echo "</div>";
/*
echo "<a href='index.php?ds=0&ausw=0' ><div class='loginbutton'>Startseite</div></a>" ;
echo "<a href='index.php?ausw=$ausw&is=$is' ><div class='loginbutton'>Zurück</div></a>";
echo "<a href='graph.csv' download= 'CSV-$monat.csv' ><div class='loginbutton'>CSV Export</div></a>";
echo "<a href='exportgraph.php?ausw=$ausw&is=$is&ab=0' ><div class='loginbutton'>aktueller Monat</div></a>";
?>
<div class='loginbutton'>
<a href="javascript:show('zeige2')" ><?php echo "▼ Andere Zeiten ";?></a>
</div>
<?php
echo "<div id='zeige2' class='zeigezwei' style='display: none;'>";
?>
<a href="javascript:show('zeige2')" ><?php echo "<img src='bilder/x.jpg' class ='fensterzu' alt='SE'/>";?></a>
<?php
//echo "<br><br>";
echo "Entweder";
echo "<form accept-charset='utf-8' action='exportgraph.php?ausw=$ausw&is=$is' method='post'> ";
echo "<div class='zeiteingabe'>";
echo "<input name='startdatum' value='$zstart' type='text' size='10' maxlength='11' class= 'tcal' placeholder ='Startdatum'required> ";
echo "</div>";
echo "<div class='zeiteingabe'>";
echo "<input name='endedatum' value= '$zende' type='text' size='10' maxlength='11' class= 'tcal' placeholder ='Endedatum'required> ";
echo "</div>";
echo "<div class='eintrag'>";
echo "<input type='submit' name'submit' value='anzeigen'>";
echo "</div>";
echo "</form>";
echo "oder";
echo "<form accept-charset='utf-8' action='exportgraph.php?ausw=$ausw&is=$is' method='post'> ";
echo "<div class='zeiteingabe'>";
echo "<input name='starttage' type='text' size='4' maxlength='3' required> Tage bis heute";
echo "</div>";
echo "<div class='eintrag'>";
echo "<input type='submit' name'submit' value='anzeigen'>";
echo "</div>";
echo "</form>";
echo "</div>";
echo "<div class='loginbutton'> ";
echo "<select class= 'isp' size='1' name='jumpit' onchange='document.location.href=this.value'> ";
echo "<option value='index.php?is=$is&ausw=0' >Freie Auswahl</option>";
//if ($is==0){$gwahl= "!= 0 ";} else {$gwahl= "= $is";}
$sql = "SELECT ID, name, ddc FROM jumpgruppe WHERE ID>1 ORDER BY ID ";
foreach ($pdo->query($sql) as $row) {
if ( $ausw==$row['ID']) {$markiert2= 'selected'; } else {$markiert2='';}
$auswahl = $row['name'];
$ddc = $row['ddc'];
$ind = $row['ID'];
//$markiert2='';
echo "<option value='exportgraph.php?is=$is&ausw=$ind&st=$st&sd=$sd&ed=$ed' $markiert2>$auswahl</option> ";
}
echo "</select></div>";
*/
echo "<div class='kasten2'>";
echo "Langzeitdaten von $iname <br> ";
$abplus= $abweichung+1;
$abminus= $abweichung-1;
if (empty($anz)) {
echo "<a href='exportgraph.php?ausw=$ausw&is=$is&ab=$abminus' > ◀ </a>";
}
echo " $monat $jahr ";
if (empty($anz)) {
echo "<a href='exportgraph.php?ausw=$ausw&is=$is&ab=$abplus' > ▶︎ ︎</a>";
}
echo "<div class='kasteninnen'>";
echo "<a href='graphcsv.csv' download= 'CSV-$monat.csv'><Div class='button'>CSV Export</div></a>";
echo "</div>";
//echo "<a href='index.php?ausw=$ausw&is=$is' ><div class='loginbutton'>Zurück</div></a>";
echo "</div>";
echo "<div class='kasten3'>";
echo "<div class='kasteninnen'>";
/*
?>
<style>
.csvTable{
font-size: 10pt;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
color: #777;
}
.csvTable th{
text-align:left;
border-bottom: 1px solid #ccc;
}
.csvTable td{
border-bottom: 1px solid #ccc;
}
</style>
<?php
$hasTitle = true;
echo '<table border="0" cellspacing="0" cellpadding="5" width="auto" class="csvTable">';
$handle = fopen("graph.csv", "r");
$start = 0;
while (($data = fgetcsv($handle, 5000, ";")) !== FALSE)
{
echo '<tr>' . "\n";
for ( $x = 0; $x < count($data); $x++)
{
if ($start == 0 && $hasTitle == true)
echo '<th>'.$data[$x].'</th>' . "\n";
else
echo '<td>'.$data[$x].'</td>' . "\n";
}
$start++;
echo '</tr>' . "\n";
}
fclose($handle);
echo '</table>';
*/
?>
<style>
table, th, td {padding:3px;
border: 1px solid green;
border-collapse: collapse;
text-align:center;
}
</style>
<?php
echo "Teilansicht der aktuellen CSV mit maximal 6 Spalten und 200 Zeilen";
echo "<table>";
$zal=0;
$handle = fopen ("graphcsv.csv","r");
while ($zal<201 && ($data = fgetcsv ($handle, 1000, ",")) !== FALSE ){
echo "<tr><td><a href=\"".$data[0].".php"."\">".$data[0]."</a></td>" ;
echo "<td>".$data[1]."</td>" ;
echo "<td>".$data[2]."</td>" ;
echo "<td>".$data[3]."</td>" ;
echo "<td>".$data[4]."</td>" ;
echo "<td>".$data[5]."</td>" ;
echo "<td>".$data[6]."</td></tr>" ;
$zal++;
}
fclose ($handle);
echo "</table>";
echo "</div>";
echo "</div>";
echo "</body>";
?>
</html>