insert("UPDATE tourenliste SET auto='".$_POST['car']."' WHERE id='".$_POST['tourID']."'"); $row_tourl = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); $ttemp=$row_tourl['tour']; $ta_id= array_search($ttemp, array_column($a_touren, 'id')); $atemp=$_POST['car']; $aa_id= array_search($atemp, array_column($a_fahrzg, 'id')); $back['lastnote']="Fahrzeug ".$a_fahrzg[$aa_id]['kz']." für Tour ".$row_tourx['tour']." gespeichert."; $back['success'] = true; $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; case 'user_save'; // $ttemp=$row['tour']; $ta_id= array_search($ttemp, array_column($a_touren, 'id')); // $atemp=$row['auto']; $aa_id= array_search($atemp, array_column($a_fahrzg, 'id')); // $mtemp=$row['fahrer']; $ma_id= array_search($mtemp, array_column($a_fahrer, 'id')); $GLOBALS['mysql']->insert("UPDATE tourenliste SET fahrer='".$_POST['user']."' WHERE id='".$_POST['tourID']."'"); $row_tourl = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); $ttemp=$row_tourl['tour']; $ta_id= array_search($ttemp, array_column($a_touren, 'id')); $atemp=$_POST['car']; $aa_id= array_search($atemp, array_column($a_fahrzg, 'id')); $back['lastnote']="Fahrer ".$a_fahrer[$ma_id]['name']." für Tour ".$row_tourx['tour']." gespeichert."; $back['success'] = true; $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; case 'load_car_icon'; //echo $_POST['tourID']; $touri = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); //$unixdate=mktime(0,0,0, $touri['monat'],$touri['tag'],$touri['jahr']); if($touri['auto']==0) { $anzeige=1; } else { $cari = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$touri['auto']."'"); if($cari['aktiv']==0) { $anzeige=1; } else { //$plani = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE timestamp LIKE '".$unixdate." %' and fid='".$touri['auto']."'"); $plani = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE tag='".$touri['tag']."' and monat='".$touri['monat']."' and jahr='".$touri['jahr']."' and fid='".$touri['auto']."'"); if($plani['num_rows']== 0) { if($cari['besitz']<3) { $ttest = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$touri['tag']."' and monat='".$touri['monat']."' and jahr='".$touri['jahr']."' and auto='".$touri['auto']."' and typ='".$touri['typ']."'"); if($ttest['num_rows']>1) { $anzeige=2; } else { $anzeige=3; } } else { $anzeige=5; } } else { $fplani = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner_bez WHERE id='".$plani['grund']."'"); if($fplani['aktiv']== 0) { $anzeige=1; } //fahrzeug nicht verfügbar if($fplani['aktiv']== 1) { $anzeige=2; } //fahrzeug verfügbar, aber Eintrag if($fplani['aktiv']== 2) { $anzeige=4; } //an Druckhaus bzw fremder standort } } } if($anzeige==0) { $back['htmlresult']=' '; } if($anzeige==1) { $back['htmlresult']=' '; } if($anzeige==2) { $back['htmlresult']=' '; } if($anzeige==3) { $back['htmlresult']=' '; } if($anzeige==4) { $back['htmlresult']=' '; } if($anzeige==5) { $back['htmlresult']=' '; } $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; //--------------------- user icon nachladen case 'load_user_icon'; //echo $_POST['tourID']; $touri2 = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); if($touri2['fahrer']==0) { $anzeige=1; } else { $useri2 = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$touri2['fahrer']."'"); if($useri2['aktiv']==0) { $anzeige=1; //Fahrer nicht aktiv / ausgeschieden } else { $plani = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$touri2['tag']."' and monat='".$touri2['monat']."' and jahr='".$touri2['jahr']."' and mid='".$touri2['fahrer']."'"); if($plani['num_rows']== 0) { if($useri2['rs']>0) { $mtest = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$touri2['tag']."' and monat='".$touri2['monat']."' and jahr='".$touri2['jahr']."' and fahrer='".$touri2['fahrer']."' and typ='".$touri2['typ']."'"); if($mtest['num_rows']>1) { $anzeige=2; } else { $anzeige=3; } } else { $anzeige=2; } } else { $plani = $GLOBALS['mysql']->query_single("SELECT * FROM planer_bez WHERE id='".$plani['grund']."'"); if($plani['nichtda']== 1) { $anzeige=1; } elseif($plani['nichtda']== 8) { $anzeige=1; } elseif($plani['nichtda']==19) { $anzeige=1; } else { $anzeige=2; } } } } if($anzeige==0) { $back['htmlresult']=' '; } if($anzeige==1) { $back['htmlresult']=' '; } if($anzeige==2) { $back['htmlresult']=' '; } if($anzeige==3) { $back['htmlresult']=' '; } $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; case 'load_free_cars'; default: //--------------------- freie Fahrzeuge Nachts $key=0; //-- trp nachts $tempcar = $GLOBALS['mysql']->query("SELECT * FROM fahrzeuge WHERE aktiv=1 and besitz<3 and typ>2 ORDER BY id"); while($row = $tempcar->fetch_assoc()) { $istabfrage = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE timestamp LIKE '".$_POST['date']." %' AND auto='".$row['id']."' and typ>5 and typ!=18"); $pauto = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE timestamp LIKE '".$_POST['date']." %' and fid='".$row['id']."'"); if($istabfrage['num_rows']== 0) { if($pauto['num_rows']== 0) { $seite['trp'][$key]=$row['kz']." (".$row['hersteller']." ".$row['name'].")"; $key++; } } } echo json_encode($seite); endswitch; ?>