jb-data.de/scripts/tplan.php
2025-08-11 22:23:30 +02:00

111 lines
No EOL
5.5 KiB
PHP

<?php
if(isset($_GET['a']))
$action=$_GET['a'];
else
$action='list';
switch($action):
case 'show';
if(isset($_GET['mid']) && $_GET['mid'] != '') {
$tourenliste = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$_GET['mid']."'");
if($tourenliste['num_rows'] == 1) {
$tourenlisterow = $GLOBALS['mysql']->query("SELECT * FROM touren");
while($tourenlisteinfo = $tourenlisterow->fetch_assoc()){
$option1.='<option value="'.$tourenlisteinfo['tour'].'" >'.$tourenlisteinfo['tour'].'</option>';
}
$template->assign('option1', $option1);
if(isset($_POST['savetour'])) {
// $GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']. SET Tour='".$_POST['Tour'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
// $GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']. SET Auflage='".$_POST['Auflage'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
// $GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']. SET Pakete='".$_POST['Pakete'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
// $GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']. SET Ladung='".$_POST['Ladung'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
// $GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']. SET Paket='".$_POST['Paket'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
// $GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']. SET Stellzeit='".$_POST['Stellzeit'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
// $GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']. SET StartRampe='".$_POST['StartRampe'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
// $GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']. SET EndeRampe='".$_POST['EndeRampe'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
$GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']." SET fahrer='".$_POST['Fahrer'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
$GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']." SET auto='".$_POST['Fahrzeug'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
$GLOBALS['mysql']->insert("UPDATE ".$tourenliste['tour']." SET infotext='".$_POST['infotext'][$_POST['savetour']]."' WHERE id='".$_POST['savetour']."'");
$success[]='Tour wurde ge&auml;ndert.'; $template->assign('success', $success);
}
$key=0;
$touren = $GLOBALS['mysql']->query("SELECT * FROM ".$tourenliste['tour']." WHERE erl='0' LIMIT 200");
while($row = $touren->fetch_assoc()){
$touren2[$key]['id']=$row['id'];
/*
$touren2[$key]['jahr']=$row['jahr'];
$touren2[$key]['monat']=$row['monat'];
$touren2[$key]['tag']=$row['tag'];
*/
$wochentag=date('l',mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']));
$touren2[$key]['wt']=$wochentag=$GLOBALS['core']->translateDate($wochentag);
$touren2[$key]['kw']=date('W', mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']));
$touren2[$key]['tag']=date('d.m.Y', mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']));
$row_fahrer = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'");
$touren2[$key]['fahrer']=$row_fahrer['name'];
$touren2[$key]['fahrer_id']=$row_fahrer['id'];
$row_fahrer_array = $GLOBALS['mysql']->query_array("SELECT * FROM mitarbeiter");
$touren2[$key]['fahrer_array']=$row_fahrer_array;
$touren2[$key]['zeit']=$row['zeit'];
/*
$touren2[$key]['gewicht1']=$row['gewicht1'];
$touren2[$key]['gewicht2']=$row['gewicht2'];
$touren2[$key]['gewicht3']=$row['gewicht3'];
$touren2[$key]['gewicht4']=$row['gewicht4'];
$touren2[$key]['gewicht5']=$row['gewicht5'];
$touren2[$key]['gesammtgewicht']=$row['gewicht1']+$row['gewicht2']+$row['gewicht3']+$row['gewicht4']+$row['gewicht5'];
*/
$row_auto = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
$touren2[$key]['kennz']=$row_auto['kz'];
$touren2[$key]['auto_id']=$row['auto'];
$row_auto_array = $GLOBALS['mysql']->query_array("SELECT * FROM fahrzeuge");
$touren2[$key]['auto_array']=$row_auto_array;
// $touren2[$key]['auto']=$row['auto'];
$touren2[$key]['infotext']=$row['infotext'];
// $touren2[$key]['afirma']=$row['afirma'];
// $touren2[$key]['erl']=$row['erl'];
$key++;
}
// Vorabanzeige resultat
// echo "<pre>";
// print_r($touren2);
// echo "</pre>";
$template->assign('touren2', $touren2);
$template->assign('content', 'tpl/ttouren_show.tpl');
} else {
$error[]='Tour existiert nicht!'; $template->assign('error', $error);
$template->assign('content', 'tpl/leer.tpl');
}
} else {
$warning[]='Es wurde keine Tour ausgew&auml;hlt!'; $template->assign('warning', $warning);
$template->assign('content', 'tpl/leer.tpl');
}
break;
case 'list';
default:
//if(isset($_POST['tour'])) { $GLOBALS['mysql']->insert("INSERT INTO touren (tour,infotitel) VALUES('".$_POST['tour']."','".$_POST['infotitel']."')"); }
//if(isset($_POST['delete'])) { $GLOBALS['mysql']->query("DELETE FROM touren WHERE id='".$_POST['delete']."'"); }
$tourenliste = $GLOBALS['mysql']->query_array("SELECT * FROM touren WHERE typ='1'");
$template->assign('tourenliste', $tourenliste);
$template->assign('content', 'tpl/ttouren_list.tpl');
endswitch;
?>