function do_ticket($theRow, $theWidth, $search = FALSE, $dist = TRUE)
{
    // returns table - 6/26/10
    global $iw_width, $nature, $disposition, $patient, $incident, $incidents;
    // 12/3/10
    $tickno = get_variable('serial_no_ap') == 0 ? "&nbsp;&nbsp;<I>(#" . $theRow['id'] . ")</I>" : "";
    // 1/25/09
    switch ($theRow['severity']) {
        //color tickets by severity
        case $GLOBALS['SEVERITY_MEDIUM']:
            $severityclass = 'severity_medium';
            break;
        case $GLOBALS['SEVERITY_HIGH']:
            $severityclass = 'severity_high';
            break;
        default:
            $severityclass = 'severity_normal';
            break;
    }
    $print = "<TABLE BORDER='0' ID='left' width='" . $theWidth . "'>\n";
    //
    $print .= "<TR CLASS='even'><TD ALIGN='left' CLASS='td_data' COLSPAN=2 ALIGN='center'><B>{$incident}: <I>" . highlight($search, $theRow['scope']) . "</B>" . $tickno . "</TD></TR>\n";
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Addr") . ":</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['tick_street']) . "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("City") . ":</TD>\t\t\t<TD ALIGN='left'>" . highlight($search, $theRow['tick_city']);
    $print .= "&nbsp;&nbsp;" . highlight($search, $theRow['tick_state']) . "</TD></TR>\n";
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Priority") . ":</TD> <TD ALIGN='left' CLASS='" . $severityclass . "'>" . get_severity($theRow['severity']);
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$nature}:&nbsp;&nbsp;" . get_type($theRow['in_types_id']);
    $print .= "</TD></TR>\n";
    $print .= "<TR CLASS='even'  VALIGN='top'><TD ALIGN='left'>" . get_text("Synopsis") . ":</TD>\t<TD ALIGN='left'>" . replace_quotes(highlight($search, nl2br($theRow['tick_descr']))) . "</TD></TR>\n";
    //	8/12/09
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Protocol") . ":</TD> <TD ALIGN='left' CLASS='{$severityclass}'>{$theRow['protocol']}</TD></TR>\n";
    // 7/16/09
    $print .= "<TR CLASS='even'  VALIGN='top'><TD ALIGN='left'>" . get_text("911 Contacted") . ":</TD>\t<TD ALIGN='left'>" . highlight($search, nl2br($theRow['nine_one_one'])) . "</TD></TR>\n";
    //	6/26/10
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>" . get_text("Reported by") . ":</TD>\t<TD ALIGN='left'>" . highlight($search, $theRow['contact']) . "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("Phone") . ":</TD>\t\t\t<TD ALIGN='left'>" . format_phone($theRow['phone']) . "</TD></TR>\n";
    $end_date = intval($theRow['problemend']) > 1 ? $theRow['problemend'] : time() - intval(get_variable('delta_mins')) * 60;
    $elapsed = my_date_diff($theRow['problemstart'], $end_date);
    $elaped_str = intval($theRow['problemend']) > 1 ? "" : "&nbsp;&nbsp;&nbsp;&nbsp;({$elapsed})";
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>" . get_text("Status") . ":</TD>\t\t<TD ALIGN='left'>" . get_status($theRow['status']) . "{$elaped_str}</TD></TR>\n";
    $by_str = $theRow['call_taker'] == 0 ? "" : "&nbsp;&nbsp;by " . get_owner($theRow['call_taker']) . "&nbsp;&nbsp;";
    // 1/7/10
    $print .= "<TR CLASS='even'><TD ALIGN='left'>" . get_text("Written") . ":</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['date']) . $by_str;
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Updated:&nbsp;&nbsp;" . format_date($theRow['updated']) . "</TD></TR>\n";
    $print .= empty($theRow['booked_date']) ? "" : "<TR CLASS='odd'><TD ALIGN='left'>Scheduled date:</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['booked_date']) . "</TD></TR>\n";
    // 10/6/09
    $print .= "<TR CLASS='even' ><TD ALIGN='left' COLSPAN='2'>&nbsp;\t<TD ALIGN='left'></TR>\n";
    // separator
    $print .= empty($theRow['fac_name']) ? "" : "<TR CLASS='odd' ><TD ALIGN='left'>{$incident} at Facility:</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['fac_name']) . "</TD></TR>\n";
    // 8/1/09
    $print .= empty($theRow['rec_fac_name']) ? "" : "<TR CLASS='even' ><TD ALIGN='left'>Receiving Facility:</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['rec_fac_name']) . "</TD></TR>\n";
    // 10/6/09
    $print .= empty($theRow['comments']) ? "" : "<TR CLASS='odd'  VALIGN='top'><TD ALIGN='left'>{$disposition}:</TD>\t<TD ALIGN='left'>" . replace_quotes(highlight($search, nl2br($theRow['comments']))) . "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("Run Start") . ":</TD>\t\t\t\t\t<TD ALIGN='left'>" . format_date($theRow['problemstart']);
    $elaped_str = intval($theRow['problemend']) > 1 ? $elapsed : "";
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End:&nbsp;&nbsp;" . format_date($theRow['problemend']) . "&nbsp;&nbsp;({$elaped_str})</TD></TR>\n";
    $locale = get_variable('locale');
    // 08/03/09
    switch ($locale) {
        case "0":
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;USNG&nbsp;&nbsp;" . LLtoUSNG($theRow['lat'], $theRow['lng']);
            break;
        case "1":
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;OSGB&nbsp;&nbsp;" . LLtoOSGB($theRow['lat'], $theRow['lng']);
            // 8/23/08, 10/15/08, 8/3/09
            break;
        case "2":
            $coords = $theRow['lat'] . "," . $theRow['lng'];
            // 8/12/09
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;UTM&nbsp;&nbsp;" . toUTM($coords);
            // 8/23/08, 10/15/08, 8/3/09
            break;
        default:
            print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />";
    }
    $print .= "<TR CLASS='odd'><TD ALIGN='left' onClick = 'javascript: do_coords(" . $theRow['lat'] . "," . $theRow['lng'] . ")'><U>" . get_text("Position") . "</U>: </TD>\n\t\t<TD ALIGN='left'>" . get_lat($theRow['lat']) . "&nbsp;&nbsp;&nbsp;" . get_lng($theRow['lng']) . $grid_type . "</TD></TR>\n";
    // 9/13/08
    $print .= "<TR><TD colspan=2 ALIGN='left'>";
    $print .= show_log($theRow[0]);
    // log
    $print .= "</TD></TR>";
    $print .= "<TR STYLE = 'display:none;'><TD colspan=2><SPAN ID='oldlat'>" . $theRow['lat'] . "</SPAN><SPAN ID='oldlng'>" . $theRow['lng'] . "</SPAN></TD></TR>";
    $print .= "</TABLE>\n";
    $print .= show_assigns(0, $theRow[0]);
    // 'id' ambiguity - 7/27/09
    $print .= show_actions($theRow[0], "date", FALSE, FALSE);
    return $print;
}
function do_inc_log_report($the_ticket_id)
{
    // 3/18/10
    global $types;
    global $w_tiny, $w_small, $w_medium, $w_large;
    // 4/14/11
    global $nature, $disposition, $patient, $incident, $incidents;
    // 4/21/11
    $tickets = $actions = $patients = $unit_names = $un_status = $unit_types = $users = $facilities = $fac_status = $fac_types = array();
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}ticket`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    //		$str_lgth_max = 10;
    //		$tick_str = ((strlen($tickets[$row['id']])) > $str_lgth_max) ? substr($row['street'], 0, $str_lgth_max). " ..." : $tickets[$row['id']] ;
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $tickets[$row['id']] = substr($row['scope'], 0, 10) . "/" . substr($row['street'], 0, 10);
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}action`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $actions[$row['id']] = substr($row['description'], 0, 20);
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}patient`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $patients[$row['id']] = substr($row['description'], 0, 20);
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}responder`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $unit_names[$row['id']] = $row['name'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}un_status`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $un_status[$row['id']] = $row['status_val'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}unit_types`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $unit_types[$row['id']] = $row['name'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}user`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $users[$row['id']] = $row['user'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}facilities`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $facilities[$row['id']] = $row['name'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}fac_status`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $fac_status[$row['id']] = $row['status_val'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}fac_types`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $fac_types[$row['id']] = $row['name'];
    }
    // ______________________________________________________________________________
    $query = "SELECT *,\n\t\t\tUNIX_TIMESTAMP(problemstart) AS problemstart,\n\t\t\tUNIX_TIMESTAMP(problemend) AS problemend,\n\t\t\tUNIX_TIMESTAMP(booked_date) AS booked_date,\t\t\n\t\t\tUNIX_TIMESTAMP(date) AS date,\n\t\t\tUNIX_TIMESTAMP(`{$GLOBALS['mysql_prefix']}ticket`.`updated`) AS updated,\n\t\t\t `{$GLOBALS['mysql_prefix']}ticket`.`description` AS `tick_descr`,\n\t\t\t `{$GLOBALS['mysql_prefix']}ticket`.`lat` AS `lat`,\n\t\t\t `{$GLOBALS['mysql_prefix']}ticket`.`lng` AS `lng`,\n\t\t\t `{$GLOBALS['mysql_prefix']}ticket`.`_by` AS `call_taker`,\n\t\t\t `{$GLOBALS['mysql_prefix']}facilities`.`name` AS `fac_name`,\n\t\t\t `rf`.`name` AS `rec_fac_name`,\n\t\t\t `rf`.`lat` AS `rf_lat`,\n\t\t\t `rf`.`lng` AS `rf_lng`,\n\t\t\t `{$GLOBALS['mysql_prefix']}facilities`.`lat` AS `fac_lat`,\n\t\t\t `{$GLOBALS['mysql_prefix']}facilities`.`lng` AS `fac_lng` FROM `{$GLOBALS['mysql_prefix']}ticket`  \n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}in_types` `ty` ON (`{$GLOBALS['mysql_prefix']}ticket`.`in_types_id` = `ty`.`id`)\t\t\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}facilities` ON (`{$GLOBALS['mysql_prefix']}facilities`.`id` = `{$GLOBALS['mysql_prefix']}ticket`.`facility`)\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}facilities` `rf` ON (`rf`.`id` = `{$GLOBALS['mysql_prefix']}ticket`.`rec_facility`) \n\t\t\tWHERE `{$GLOBALS['mysql_prefix']}ticket`.`id`= '{$the_ticket_id}' LIMIT 1";
    // 7/24/09 10/16/08 Incident location 10/06/09 Multi point routing
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    $theRow = stripslashes_deep(mysql_fetch_array($result));
    $tickno = get_variable('serial_no_ap') == 0 ? "&nbsp;&nbsp;<I>(#" . $theRow['id'] . ")</I>" : "";
    // 1/25/09
    switch ($theRow['severity']) {
        //color tickets by severity
        case $GLOBALS['SEVERITY_MEDIUM']:
            $severityclass = 'severity_medium';
            break;
        case $GLOBALS['SEVERITY_HIGH']:
            $severityclass = 'severity_high';
            break;
        default:
            $severityclass = 'severity_normal';
            break;
    }
    $print = "<TABLE BORDER='0' STYLE = 'width:800px'>\n";
    //
    $print .= "<TR CLASS='even'><TD ALIGN='left' CLASS='td_data' COLSPAN=2 ALIGN='center'><B>{$incident}: <I>{$theRow['scope']}</B>{$tickno}</TD></TR>\n";
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>Priority:</TD> <TD ALIGN='left' CLASS='" . $severityclass . "'>" . get_severity($theRow['severity']);
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$nature}:&nbsp;&nbsp;" . get_type($theRow['in_types_id']);
    $print .= "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>Protocol:</TD> <TD ALIGN='left' CLASS='{$severityclass}'>{$theRow['protocol']}</TD></TR>\n";
    // 7/16/09
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>Address:</TD>\t\t<TD ALIGN='left'>{$theRow['street']}";
    $print .= "&nbsp;&nbsp;{$theRow['city']}&nbsp;&nbsp;{$theRow['state']}</TD></TR>\n";
    $print .= "<TR CLASS='even'  VALIGN='top'><TD ALIGN='left'>Description:</TD>\t<TD ALIGN='left'>" . nl2br($theRow['tick_descr']) . "</TD></TR>\n";
    //	8/12/09
    $end_date = intval($theRow['problemend']) > 1 ? $theRow['problemend'] : time() - get_variable('delta_mins') * 60;
    $elapsed = my_date_diff($theRow['problemstart'], $end_date);
    // 5/13/10
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>Status:</TD>\t\t<TD ALIGN='left'>" . get_status($theRow['status']) . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;({$elapsed})</TD></TR>\n";
    $print .= "<TR CLASS='even'><TD ALIGN='left'>Reported by:</TD>\t<TD ALIGN='left'>{$theRow['contact']}";
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;Phone:&nbsp;&nbsp;" . format_phone($theRow['phone']) . "</TD></TR>\n";
    $by_str = $theRow['call_taker'] == 0 ? "" : "&nbsp;&nbsp;by " . get_owner($theRow['call_taker']) . "&nbsp;&nbsp;";
    // 1/7/10
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>Written:</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['date']) . $by_str;
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Updated:&nbsp;&nbsp;" . format_date($theRow['updated']) . "</TD></TR>\n";
    $print .= empty($theRow['booked_date']) ? "" : "<TR CLASS='odd'><TD ALIGN='left'>Scheduled date:</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['booked_date']) . "</TD></TR>\n";
    // 10/6/09
    $print .= !is_int($theRow['facility']) ? "" : "<TR CLASS='odd' ><TD ALIGN='left'>{$incident} at Facility:</TD>\t\t<TD ALIGN='left'>{$theRow['fac_name']}</TD></TR>\n";
    // 8/1/09
    $print .= !is_int($theRow['rec_facility']) ? "" : "<TR CLASS='even' ><TD ALIGN='left'>Receiving Facility:</TD>\t\t<TD ALIGN='left'>{$theRow['rec_fac_name']}</TD></TR>\n";
    // 10/6/09
    $print .= empty($theRow['comments']) ? "" : "<TR CLASS='odd'  VALIGN='top'><TD ALIGN='left'>{$disposition}:</TD>\t<TD ALIGN='left'>" . nl2br($theRow['comments']) . "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>Run Start:</TD><TD ALIGN='left'>" . format_date($theRow['problemstart']);
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End:&nbsp;&nbsp;" . format_date($theRow['problemend']) . "&nbsp;&nbsp;&nbsp;&nbsp;Elapsed:&nbsp;&nbsp;{$elapsed}\n\t\t\t</TD></TR>\n";
    $locale = get_variable('locale');
    // 08/03/09
    switch ($locale) {
        case "0":
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;USNG&nbsp;&nbsp;" . LLtoUSNG($theRow['lat'], $theRow['lng']);
            break;
        case "1":
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;OSGB&nbsp;&nbsp;" . LLtoOSGB($theRow['lat'], $theRow['lng']);
            // 8/23/08, 10/15/08, 8/3/09
            break;
        case "2":
            $coords = $theRow['lat'] . "," . $theRow['lng'];
            // 8/12/09
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;UTM&nbsp;&nbsp;" . toUTM($coords);
            // 8/23/08, 10/15/08, 8/3/09
            break;
        default:
            print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />";
    }
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>Position: </TD><TD ALIGN='left'>" . get_lat($theRow['lat']) . "&nbsp;&nbsp;&nbsp;" . get_lng($theRow['lng']) . $grid_type . "</TD></TR>\n";
    // 9/13/08
    $print .= "<TR><TD>&nbsp;</TD></TR></TABLE>\n";
    print $print;
    print show_actions($the_ticket_id, "date", FALSE, TRUE);
    // ($the_id, $theSort="date", $links, $display)
    $query = "\n\t\t\tSELECT *, `u`.`user` AS `thename` , \n\t\t\t\t`l`.`info` AS `log_info` , \n\t\t\t\t`l`.`id` AS `log_id` , \n\t\t\t\t`l`.`responder_id` AS `the_unit_id`,\n\t\t\t\tUNIX_TIMESTAMP( `l`.`when` ) AS `when`\n\t\t\tFROM `{$GLOBALS['mysql_prefix']}log` `l`\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` t ON ( `t`.`id` = `l`.`ticket_id` )\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}user` u ON ( `l`.`who` = `u`.`id` )\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}assigns` a ON ( `a`.`ticket_id` = `t`.`id` )\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}responder` `r` ON ( `r`.`id` = `a`.`responder_id` )\n\t\t\tWHERE `code` >= '{$GLOBALS['LOG_INCIDENT_OPEN']}'\n\t\t\tAND `l`.`ticket_id` ={$the_ticket_id}\n\t\t\tORDER BY `log_id` ASC";
    //		dump($query);
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    $evenodd = array("even", "odd");
    $i = 0;
    echo "<TABLE ALIGN='left' CELLSPACING = 1 border=0  STYLE = 'width:800px'>";
    $do_hdr = TRUE;
    $day_part = "";
    $last_id = "";
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        if ($row['log_id'] != $last_id) {
            $last_id = $row['log_id'];
            // dupe preventer
            if ($do_hdr) {
                echo "<TR CLASS='odd'><TD>&nbsp;</TD></TR>";
                echo "<TR CLASS='even'><TH COLSPAN=99> {$incident} Log</TH></TR>";
                echo "<TR CLASS='odd'>\n\t\t\t\t\t\t<TD></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;Time</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;Log code</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;" . get_text("Unit") . "/Fac'y</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;Data</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;By</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;From</b></TD>\n\t\t\t\t\t\t</TR>";
                $do_hdr = FALSE;
            }
            $temp = explode(" ", format_date($row['when']));
            $show_day = $temp[0] == $day_part ? "" : $temp[0];
            $day_part = $temp[0];
            echo "<TR CLASS = '{$evenodd[$i % 2]}'>\n\t\t\t\t<TD ALIGN='left'>{$show_day}</TD>\n\t\t\t\t<TD ALIGN='left'>&nbsp;{$temp[1]}&nbsp;</TD>\n\t\t\t\t<TD><b>&nbsp;{$types[$row['code']]}&nbsp;</b></TD>";
            switch ($row['code']) {
                case $GLOBALS['LOG_INCIDENT_OPEN']:
                case $GLOBALS['LOG_INCIDENT_CLOSE']:
                case $GLOBALS['LOG_INCIDENT_CHANGE']:
                case $GLOBALS['LOG_INCIDENT_DELETE']:
                    print "<TD></TD><TD></TD>";
                    break;
                case $GLOBALS['LOG_ACTION_ADD']:
                case $GLOBALS['LOG_ACTION_DELETE']:
                    $act_str = array_key_exists($row['log_info'], $actions) ? $actions[$row['log_info']] : "[{$row['log_info']}]";
                    print "<TD></TD><TD>&nbsp;{$act_str}&nbsp;</TD>";
                    break;
                case $GLOBALS['LOG_PATIENT_ADD']:
                case $GLOBALS['LOG_PATIENT_DELETE']:
                    $pat_str = array_key_exists($row['log_info'], $patients) ? $patients[$row['log_info']] : "[{$row['log_info']}]";
                    print "<TD></TD><TD>&nbsp;{$pat_str}&nbsp;</TD>";
                    break;
                case $GLOBALS['LOG_UNIT_STATUS']:
                case $GLOBALS['LOG_UNIT_COMPLETE']:
                case $GLOBALS['LOG_UNIT_CHANGE']:
                    $the_unit = array_key_exists($row['the_unit_id'], $unit_names) ? $unit_names[$row['the_unit_id']] : "?? {$row['the_unit_id']}";
                    $the_status = array_key_exists($row['log_info'], $un_status) ? $un_status[$row['log_info']] : "?? {$row['the_unit_id']}";
                    print "<TD>&nbsp;{$the_unit}&nbsp;</TD><TD>{$the_status}</TD>";
                    break;
                case $GLOBALS['LOG_CALL_DISP']:
                case $GLOBALS['LOG_CALL_RESP']:
                case $GLOBALS['LOG_CALL_ONSCN']:
                case $GLOBALS['LOG_CALL_CLR']:
                case $GLOBALS['LOG_CALL_RESET']:
                    //						dump($row);
                    $the_unit = array_key_exists($row['the_unit_id'], $unit_names) ? $unit_names[$row['the_unit_id']] : "?? {$row['the_unit_id']}";
                    print "<TD>&nbsp;{$the_unit}&nbsp;</TD><TD></TD>";
                    break;
                case $GLOBALS['LOG_CALL_REC_FAC_SET']:
                case $GLOBALS['LOG_CALL_REC_FAC_CHANGE']:
                case $GLOBALS['LOG_CALL_REC_FAC_UNSET']:
                case $GLOBALS['LOG_CALL_REC_FAC_CLEAR']:
                case $GLOBALS['LOG_FACILITY_INCIDENT_OPEN']:
                case $GLOBALS['LOG_FACILITY_INCIDENT_CLOSE']:
                case $GLOBALS['LOG_FACILITY_INCIDENT_CHANGE']:
                case $GLOBALS['LOG_FACILITY_DISP']:
                case $GLOBALS['LOG_FACILITY_RESP']:
                case $GLOBALS['LOG_FACILITY_ONSCN']:
                case $GLOBALS['LOG_FACILITY_CLR']:
                case $GLOBALS['LOG_FACILITY_RESET']:
                    $the_facy = array_key_exists($row['facility'], $facilities) ? $facilities[$row['facility']] : "?? {$row['facility']}";
                    print "<TD>{$the_facy}</TD><TD></TD>";
                    break;
                default:
                    print "<TD>ERROR {$row['code']} : {$row['log_id']} </TD";
            }
            // end switch()
            echo "\n\t\t\t\t\t<TD>&nbsp;{$row['thename']}&nbsp;</TD>\n\t\t\t\t\t<TD>&nbsp;{$row['from']}&nbsp;</TD>";
            echo "</TR>\n";
            $i++;
        }
    }
    // end while()
    echo "<TR><TD COLSPAN=99 ALIGN='center'><HR STYLE = 'color: blue; size: 1; width: 50%'></TD></TR>";
    echo "</TABLE>";
}
    ?>
</TD></TR>
			<TR CLASS = 'odd'><TD CLASS="td_label">As of:</TD>	<TD><?php 
    print format_date($row['updated']);
    ?>
</TD></TR>
<?php 
    if (my_is_float($lat)) {
        ?>
		
			<TR CLASS = "even"><TD CLASS="td_label"  onClick = 'javascript: do_coords(<?php 
        print "{$lat},{$lng}";
        ?>
)'><U>Lat/Lng</U>:</TD><TD>
				<INPUT TYPE="text" NAME="show_lat" VALUE="<?php 
        print get_lat($lat);
        ?>
" SIZE=11 disabled />&nbsp;
				<INPUT TYPE="text" NAME="show_lng" VALUE="<?php 
        print get_lng($lng);
        ?>
" SIZE=11 disabled />&nbsp;

<?php 
        $usng_val = LLtoUSNG($row['lat'], $row['lng']);
        $osgb_val = LLtoOSGB($row['lat'], $row['lng']);
        $utm_val = toUTM("{$row['lat']}, {$row['lng']}");
        $locale = get_variable('locale');
        switch ($locale) {
            case "0":
                ?>
Exemplo n.º 4
0
function get_implementing_partners_coordinates()
{
    $ip_coordinates = array();
    $args_implementing_partners = array('post_type' => 'implementing_partner', 'posts_per_page' => -1);
    $query_implementing_partners = new WP_Query($args_implementing_partners);
    if ($query_implementing_partners->have_posts()) {
        while ($query_implementing_partners->have_posts()) {
            $query_implementing_partners->the_post();
            global $post;
            $lat = get_lat($post->ID, '_lat_meta');
            $lng = get_lng($post->ID, '_lng_meta');
            $ip_coordinates[$post->post_name] = array('lat' => $lat, 'lng' => $lng, 'permalink' => get_permalink($post->ID), 'implementingPartner' => get_the_title());
        }
    }
    wp_reset_query();
    return json_encode($ip_coordinates);
}
Exemplo n.º 5
0
                ?>
 onChange = 'set_signal2(this.options[this.selectedIndex].text); this.options[0].selected=true;'>	<!--  11/17/10 -->
				<OPTION VALUE=0 SELECTED>Select</OPTION>
<?php 
                while ($row_sig = stripslashes_deep(mysql_fetch_assoc($result_sigs))) {
                    print "\t<OPTION VALUE='{$row_sig['code']}'>{$row_sig['code']}|" . shorten($row_sig['text'], 32) . "</OPTION>\n";
                    // pipe separator
                }
                ?>
			</SELECT>
			</TD></TR>
<?php 
            }
            // end if (mysql_num_rows($result_sigs)>0)
            print "<TR CLASS='odd'>\n\t\t\t\t<TD CLASS='td_label' COLSPAN=2 onClick = 'javascript: do_coords(document.edit.frm_lat.value ,document.edit.frm_lng.value  )'><U><A HREF=\"#\" TITLE=\"Position - Lat and Lng for Incident position. Click to show all position data.\">Position</A></U>:</TD><TD>";
            print "<INPUT SIZE='13' TYPE='text' NAME='show_lat' VALUE='" . get_lat($row['lat']) . "' DISABLED>\n";
            print "<INPUT SIZE='13' TYPE='text' NAME='show_lng' VALUE='" . get_lng($row['lng']) . "' DISABLED>&nbsp;&nbsp;";
            $locale = get_variable('locale');
            // 08/03/09
            switch ($locale) {
                case "0":
                    $usng = LLtoUSNG($row['lat'], $row['lng']);
                    print "<B><SPAN ID = 'USNG' onClick = 'do_usng()'><U><A HREF='#' TITLE='US National Grid Co-ordinates.'>USNG</A></U>:&nbsp;</SPAN></B><INPUT SIZE='19' TYPE='text' NAME='frm_ngs' VALUE='{$usng}'></TD></TR>";
                    // 9/13/08, 5/2/09
                    break;
                case "1":
                    $osgb = LLtoOSGB($row['lat'], $row['lng']);
                    print "<B><SPAN ID = 'OSGB' ><U><A HREF='#' TITLE='United Kingdom Ordnance Survey Grid Reference.'>OSGB</A></U>:&nbsp;</SPAN></B><INPUT SIZE='19' TYPE='text' NAME='frm_osgb' VALUE='{$osgb}' DISABLED ></TD></TR>";
                    // 9/13/08, 5/2/09
                    break;
                default:
Exemplo n.º 6
0
//This script retrieves the values from Cosm with the help of PachubeAPI and cosm_id_and_values_f.php.
//Former ist from https://github.com/cosm/cosm-js, the latter contains self-defined functions.
//functions from Cosm
include 'PachubeAPI.php';
//self-defined functions to get the values
include 'cosm_id_und_werte_f.php';
$pachube = new PachubeAPI("QgvMiPLj6wDkY3k2JSPpD3-rMAuSAKxLbVlLMVhxTURMOD0g");
//$alle contains all meta-information about all feeds with the tag 'munster' (ID,Title, see http://cosm.com/docs/v2/feed/list.html for further information) .
$alle = $pachube->getFeedsList("json", 0, 100000, "summary", "munster", "munster");
//array: contains all IDs with the tag 'munster'.
$ids = get_ids($alle);
//echo count($ids);
//array: contains the values for every ID in JSON format.
$json = get_json($ids);
//The following two arrays contain the coordinates. The values below are self-explaining.
$lat = get_lat($json);
$lon = get_lon($json);
$timestamp = get_timestamp($json);
$NO2 = get_NO2($json);
$CO = get_CO($json);
$O3 = get_O3($json);
$names = get_Name($json);
/*
for($i=0;$i<count($ids);$i++){
echo $ids[$i]."</br>";
echo $temperature[$i]."T"."</br>";
echo $humidity[$i]."H"."</br>";
}
for($i=0;$i<count($ids);$i++){
echo $ids[$i]."</br>";
echo $temperature[$i]."T"."</br>";
Exemplo n.º 7
0
/**
 * Regresa toda la información de las fotos de Juan Guzmán
 * @return JSON $infoPhotos
 */
function get_photos_info()
{
    $info_photos = array();
    $args_apas = array('post_type' => 'foto-jg', 'posts_per_page' => -1);
    $query_mapas = new WP_Query($args_apas);
    if ($query_mapas->have_posts()) {
        while ($query_mapas->have_posts()) {
            $query_mapas->the_post();
            global $post;
            $lat = get_lat($post->ID);
            $lng = get_lng($post->ID);
            $lugar = get_lugar($post->ID);
            $fecha = get_fecha($post->ID);
            $decada = get_decada($post->ID);
            $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
            $info_photos[$post->post_name] = array('title' => $post->post_title, 'lat' => $lat, 'lng' => $lng, 'lugar' => $lugar, 'fecha' => $fecha, 'decada' => $decada, 'img_url' => $image[0], 'permalink' => get_permalink($post->ID));
        }
    }
    wp_reset_query();
    return json_encode($info_photos);
}
Exemplo n.º 8
0
/**
* Here we add all the javascript that needs to be run on the footer.
**/
function footer_scripts()
{
    global $post;
    if (wp_script_is('functions', 'done')) {
        ?>
		<script type="text/javascript">


			<?php 
        if (is_home()) {
            ?>
				/*------------------------------------*\
					#HOME
				\*------------------------------------*/

				//toggleElementOnSscroll( $('header'), '.hero__text');
				toggleElementOnSscroll( $('.image-bg--hero'), '.btn--map--float');

				$(window).scroll(function(){
					//toggleElementOnSscroll( $('header'), '.hero__text');
					toggleElementOnSscroll( $('.image-bg--hero'), '.btn--map--float');
				});

			<?php 
        }
        ?>

			<?php 
        if (is_archive()) {
            ?>
				/*------------------------------------*\
					#MAP
				\*------------------------------------*/

				addAllMarkers();

			<?php 
        }
        ?>


			<?php 
        if (is_single()) {
            ?>
				/*------------------------------------*\
					#SINGLE
				\*------------------------------------*/

				window.fbAsyncInit = function() {
					FB.init({
						appId      : '1487150328256182',
						xfbml      : true,
						version    : 'v2.4'
					});
				};

				(function(d, s, id){
				     var js, fjs = d.getElementsByTagName(s)[0];
				     if (d.getElementById(id)) {return;}
				     js = d.createElement(s); js.id = id;
				     js.src = "//connect.facebook.net/en_US/sdk.js";
				     fjs.parentNode.insertBefore(js, fjs);
				}(document, 'script', 'facebook-jssdk'));


				/**
				 * Triggered events
				**/

				// Pasar a función
				var lat = <?php 
            echo get_lat(get_the_ID());
            ?>
;
				var lng = <?php 
            echo get_lng(get_the_ID());
            ?>
;
				var decada = <?php 
            echo get_decada(get_the_ID());
            ?>
;
				var isAerial = <?php 
            echo get_vista_aerea(get_the_ID());
            ?>
;
				var heading = <?php 
            echo get_heading(get_the_ID());
            ?>
;

				showSingleMap( lat, lng, heading, isAerial, decada );

				$('.js-fb-share').click( function(){
					FB.ui(
					{
						method: 'share',
						name: '<?php 
            echo get_the_title();
            ?>
',
						href: '<?php 
            echo the_permalink();
            ?>
'
					}, function(response){ console.log( response )});
				});

			<?php 
        }
        ?>
		</script>
<?php 
    }
}