all_data = $all_data; $this->monitord_ini = $monitord_ini; } /** * @brief Writes down a box holding and showing all information given by status telegram * * @author Martin Diedrich (mdiedrich) */ function write_status_display_element() { echo '
' . substr($this->all_data['kennung'], -4, 2) . ' / ' . substr($this->all_data['kennung'], -2, 2) . '
' . $this->all_data['status'] . '
' . $this->get_fms_organisation(substr($this->all_data['kennung'], 0, 1)) . ' // ' . substr($this->all_data['kennung'], 1, 3) . '
' . $this->all_data['uhrzeit'] . '
' . (($this->all_data['status'] != 1 && $this->all_data['status'] != 2 && $this->all_data['status'] != 6) ? ('
' . ($this->all_data['text'] != '' ? substr($this->all_data['text'], 0) : 'Keine Einsatzinformationen vorhanden') . '
') : '
Ohne Einsatz
') . '
'; } /** * @brief "kennung" might be calculated to an organization such as DRK, Feuerwehr etc. - done herein * * @author Martin Diedrich (mdiedrich) */ function get_fms_organisation($orgs) { switch($orgs) { case 1 : return 'POL'; case 2 : return 'BP'; case 3 : return 'BKA'; case 4 : return 'KAT'; case 5 : return 'ZOL'; case 6 : return 'FW'; case 7 : return 'THW'; case 8 : return 'ASB'; case 9 : return 'DRK'; case 'A' : return 'JUH'; case 'B' : return 'MHD'; case 'C' : return 'DLR'; case 'D' : return 'RD'; case 'E' : return 'ZVS'; case 'F' : return 'FWI'; } } } /** * @brief Module to display received FMS status calls on callsign based tableaus * * This module shows received FMS status calls on big tableaus. Customizable by css style information and its respective ini-secion * @author Martin Diedrich (mdiedrich) * @date 12-2009 */ class monitord_status_display_manager extends monitord_webfrontend_module { /** * @brief The module's main output method, fills main content part with colored boxes * * @author Martin Diedrich (mdiedrich) */ function output_content() { $query = $this->get_db_function(); $result = mysql_query($query, $this->dbconn); if(!$result) { throw new exception('Database query failed:
' . mysql_error() . ':
"' . $query . '"', $this->monitord_ini['failcodes']['dbquery']); } if(mysql_affected_rows() == 0) { echo '
Es befinden sich derzeit keine Einträge in der Datenbank,
die zu den Filterkriterien passen.
'; } else { while($res = mysql_fetch_assoc($result)) { $tmp_display_element = new monitord_status_display_element($res, $this->monitord_ini); $tmp_display_element->write_status_display_element(); echo "\n"; } echo '

Die Anzeige zeigt nur die letzten als FMS-Telegramm ausgesendeten Statusmeldungen an!
Momentanes Zeitfenster: ' . $this->module_ini['main']['past_hrs'] . ' Stunden

'; $this->write_legend(); } } /** * @brief Generates SQL-Query for its qiven type or purpose (here: FMS status telegrams) * * @author Martin Diedrich (mdiedrich) */ function get_db_function() { if(false) { return "SELECT id, kennung, status, uhrzeit, beschreibung FROM (SELECT max(id) AS id, kennung, SUBSTRING(kennung, 1, 1) AS orgs, SUBSTRING(kennung, 5, 2) AS ortk, SUBSTRING(kennung, 7, 2) AS fzgk FROM monitord_fms WHERE kennung REGEXP '[0-9A-F]{1}" . mysql_real_escape_string($this->module_ini['main']['region']) . "[0-9A-F]{4}' AND richtung = '0' AND status < 10 AND uhrzeit > DATE_SUB(now(), INTERVAL " . mysql_real_escape_string($this->module_ini['main']['past_hrs']) . " HOUR) GROUP BY kennung ORDER BY ortk ASC, fzgk ASC) kid LEFT JOIN monitord_fms USING (id, kennung) LEFT JOIN monitord_mappings USING (kennung) ORDER BY kennung DESC"; } else { return "SELECT id, kennung, status, uhrzeit, beschreibung, tmp1.text FROM (SELECT max(id) AS id, kennung, SUBSTRING(kennung, 1, 1) AS orgs, SUBSTRING(kennung, 5, 2) AS ortk, SUBSTRING(kennung, 7, 2) AS fzgk FROM monitord_fms WHERE kennung REGEXP '[0-9A-F]{1}" . mysql_real_escape_string($this->module_ini['main']['region']) . "[0-9A-F]{4}' AND richtung = '0' AND status < 10 AND uhrzeit > DATE_SUB(now(), INTERVAL " . mysql_real_escape_string($this->module_ini['main']['past_hrs']) . " HOUR) GROUP BY kennung ORDER BY ortk ASC, fzgk ASC) kid LEFT JOIN monitord_fms USING (id, kennung) LEFT JOIN monitord_mappings USING (kennung) LEFT JOIN (SELECT kennung, text FROM (SELECT max(id) AS id FROM monitord_fms fms WHERE status = 10 AND richtung = 1 GROUP BY kennung) tmp1 LEFT JOIN monitord_fms USING(id)) tmp1 USING (kennung)"; } } /** * @brief writes a legend telling status - plain text * * @author Martin Diedrich (mdiedrich) */ function write_legend() { echo ''; echo '' . "\n"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '' . "\n"; echo '
1 - Frei auf Funk2 - Frei an Wache3 - Einsatz übernommen4 - Am Einsatzort5 - Sprechwunsch6 - Nicht einsatzbereit7 - Mit Patient zum KH8 - Am Krankenhaus
' . "\n\n"; } /** * @brief Module initialization * * @author Martin Diedrich (mdiedrich) */ function initialize() { $this->moduletitle = "Statusdisplay"; $this->revision = '$Revision$'; $this->date = '$Date$'; } } ?>