monitor-frontend/index.php.bak
2018-08-04 10:53:24 +02:00

211 lines
7.1 KiB
PHP
Executable File

<?php
require_once("config.inc.php");
// Filter Datum/Zeit erstellen
if( !$_GET["filter"] && !$_SESSION["filter"] )
{
$filter = 1;
}
elseif( !$_GET["filter"] && $_SESSION["filter"] )
{
$filter = $_SESSION["filter"];
}
elseif( $_GET["filter"] )
{
$filter = $_GET["filter"];
$_SESSION["filter"] = $_GET["filter"];
}
// Filter organisation
if( !$_GET["org_filter"] && !$_SESSION["org_filter"] )
{
$org_filter = '';
}
elseif( !$_GET["org_filter"] && $_SESSION["org_filter"] )
{
if( $_SESSION["org_filter"] == 'AND (org = "BF" OR org = "FF")' )
{
$org_filter = 'ff';
}
else
{
$org_filter = $_SESSION["org_filter"];
}
}
elseif( $_GET["org_filter"] && $_GET["org_filter"] != 'all' )
{
$org_filter = $_GET["org_filter"];
$_SESSION["org_filter"] = $_GET["org_filter"];
}
elseif( $_GET["org_filter"] == 'all' )
{
$org_filter = '';
$_SESSION["org_filter"] = '';
}
// Filter Status anzeigen
if( $_GET["stat"] == '' && !$_SESSION["stat"] )
{
$stat = '0';
}
elseif( $_GET["stat"] == '' && $_SESSION["stat"] )
{
$stat = $_SESSION["stat"];
}
elseif( $_GET["stat"] != '' )
{
$stat = $_GET["stat"];
$_SESSION["stat"] = $_GET["stat"];
}
// Wenn Aktualisierung ohne Ausgabe
if( $_GET["nooutput"] ) { $filter = 1; $stat = 1; }
$show_filter = filter_zeit($filter);
$show_filter = " WHERE a.zeit > '$show_filter' ";
$refresh = '
<input type=button name="refresh" value="Aktualisieren" onClick="history.go()">
';
$nav_org_filter = '
<select name="org_filter" onChange="MM_jumpMenu(\'parent\',this,0)">
<option value="'.$_SERVER["php_self"].'?filter='.$filter.'&org_filter=ff&stat=0"'; if( $org_filter == 'ff' && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>Feuerwehr</option>
<option value="'.$_SERVER["php_self"].'?filter='.$filter.'&org_filter=rd&stat=0"'; if( $org_filter == 'rd' && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>Rettungsdienst</option>
<option value="'.$_SERVER["php_self"].'?filter='.$filter.'&org_filter=all&stat=0"'; if( !$org_filter && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>FW und RD</option>
</select>
';
$nav_filter = '
<select id="filter" name="filter" onChange="MM_jumpMenu(\'parent\',this,0)">
<option value="'.$_SERVER["php_self"].'?filter=48&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 48 ) $nav_filter .= 'selected'; $nav_filter .= '>48</option>
<option value="'.$_SERVER["php_self"].'?filter=24&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 24 ) $nav_filter .= 'selected'; $nav_filter .= '>24</option>
<option value="'.$_SERVER["php_self"].'?filter=10&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 10 ) $nav_filter .= 'selected'; $nav_filter .= '>10</option>
<option value="'.$_SERVER["php_self"].'?filter=5&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 5 ) $nav_filter .= 'selected'; $nav_filter .= '>5</option>
<option value="'.$_SERVER["php_self"].'?filter=2&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 2 ) $nav_filter .= 'selected'; $nav_filter .= '>2</option>
<option value="'.$_SERVER["php_self"].'?filter=1&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 1 ) $nav_filter .= 'selected'; $nav_filter .= '>1</option>
</select>
';
$java_script .= "
<script type=\"text/javascript\" language=\"javascript\">
var http_request = false;
var http_request2 = false;
function toggleindicator(status){
//Diese Variable definiert wie lange der Indicator mindestens da sein soll.
var timetowait = 2100;
if(status=='off') {
var vergangen = new Date().getTime() - time
if( vergangen >=timetowait) {
document.getElementById(\"loading-indicator\").style.display='none';
} else {
setTimeout(toggleindicator(\"off\"),timetowait - vergangen);
}
} else {
document.getElementById(\"loading-indicator\").style.display='';
document.getElementById(\"loading-indicator\").style.position='absolute';
document.getElementById(\"loading-indicator\").style.left='40%';
document.getElementById(\"loading-indicator\").style.top='100px';
time = new Date().getTime();
}
}
/// second Request
function macheSecondaryRequest() {
var url = 'get_other.php';
http_request2 = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request2 = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
http_request2 = new ActiveXObject(\"Msxml2.XMLHTTP\");
} catch (e) {
try {
http_request2 = new ActiveXObject(\"Microsoft.XMLHTTP\");
} catch (e) {}
}
}
if (!http_request2) {
alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
return false;
}
http_request2.open('GET', url, true);
http_request2.onreadystatechange = alertSecondaryInhalt;
http_request2.send(null);
window.setTimeout(\"macheSecondaryRequest()\",60000);
}
function alertSecondaryInhalt() {
if (http_request2.readyState == 4) {
var answer = http_request2.responseText;
if(document.getElementById(\"onlUsers\").innerHTML != answer){
document.getElementById(\"onlUsers\").innerHTML = answer;
}
else{
document.getElementById(\"onlUsers\").innerHTML = \"\";
}
}
}
function macheRequest() {
var url = 'get.php?".$_SERVER['QUERY_STRING']."';
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject(\"Msxml2.XMLHTTP\");
} catch (e) {
try {
http_request = new ActiveXObject(\"Microsoft.XMLHTTP\");
} catch (e) {}
}
}
if (!http_request) {
alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
return false;
}
http_request.open('GET', url, true);
http_request.onreadystatechange = alertInhalt;
http_request.send(null);
if (document.getElementById(\"filter\").options[5].selected == true) {
window.setTimeout(\"macheRequest()\",10000);
}
}
function alertInhalt() {
if (http_request.readyState == 4) {
var answer = http_request.responseText;
if(document.getElementById(\"inhalt\").innerHTML != answer){
document.getElementById(\"inhalt\").innerHTML = answer;
}
else{
document.getElementById(\"inhalt\").innerHTML = \"\";
}
if(document.getElementById(\"loading-indicator\").style.display=='')
{
toggleindicator(\"off\");
}
}
}
</script>
";
eval ("dooutput(\"".gettemplate($template_dir."rahmen")."\");");
?>