Ejemplo n.º 1
0
function outputStatistics($rra)
{
    global $rra_cf, $rra_name, $ds_name, $rra_pdp, $html;
    if (sizeof($rra)) {
        if (!$html) {
            echo "\n";
            printf("%10s %16s %10s %7s %7s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s\n", "Size", "DataSource", "CF", "Samples", "NonNan", "Avg", "StdDev", "MaxValue", "MinValue", "MaxStdDev", "MinStdDev", "StdKilled", "VarKilled", "StdDevAvg", "VarAvg");
            printf("%10s %16s %10s %7s %7s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s\n", "----------", "---------------", "----------", "-------", "-------", "----------", "----------", "----------", "----------", "----------", "----------", "----------", "----------", "----------", "----------");
            foreach ($rra as $rra_key => $dses) {
                if (sizeof($dses)) {
                    foreach ($dses as $dskey => $ds) {
                        printf("%10s %16s %10s %7s %7s " . ($ds["average"] < 1000000.0 ? "%10s " : "%10.4e ") . ($ds["standard_deviation"] < 1000000.0 ? "%10s " : "%10.4e ") . (isset($ds["max_value"]) ? $ds["max_value"] < 1000000.0 ? "%10s " : "%10.4e " : "%10s ") . (isset($ds["min_value"]) ? $ds["min_value"] < 1000000.0 ? "%10s " : "%10.4e " : "%10s ") . (isset($ds["max_cutoff"]) ? $ds["max_cutoff"] < 1000000.0 ? "%10s " : "%10.4e " : "%10s ") . (isset($ds["min_cutoff"]) ? $ds["min_cutoff"] < 1000000.0 ? "%10s " : "%10.4e " : "%10s ") . "%10s %10s " . (isset($ds["avgnksampled"]) ? $ds["avgnksamples"] < 1000000.0 ? "%10s " : "%10.4e " : "%10s ") . (isset($ds["variance_avg"]) ? $ds["variance_avg"] < 1000000.0 ? "%10s " : "%10.4e " : "%10s ") . "\n", displayTime($rra_pdp[$rra_key]), $ds_name[$dskey], $rra_cf[$rra_key], $ds["totalsamples"], isset($ds["numsamples"]) ? $ds["numsamples"] : "0", $ds["average"] != "N/A" ? round($ds["average"], 2) : $ds["average"], $ds["standard_deviation"] != "N/A" ? round($ds["standard_deviation"], 2) : $ds["standard_deviation"], isset($ds["max_value"]) ? round($ds["max_value"], 2) : "N/A", isset($ds["min_value"]) ? round($ds["min_value"], 2) : "N/A", $ds["max_cutoff"] != "N/A" ? round($ds["max_cutoff"], 2) : $ds["max_cutoff"], $ds["min_cutoff"] != "N/A" ? round($ds["min_cutoff"], 2) : $ds["min_cutoff"], $ds["stddev_killed"], $ds["variance_killed"], $ds["avgnksamples"] != "N/A" ? round($ds["avgnksamples"], 2) : $ds["avgnksamples"], isset($ds["variance_avg"]) ? round($ds["variance_avg"], 2) : "N/A");
                    }
                }
            }
            echo "\n";
        } else {
            printf("<tr><th style='width:10%%;'>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n", "Size", "DataSource", "CF", "Samples", "NonNan", "Avg", "StdDev", "MaxValue", "MinValue", "MaxStdDev", "MinStdDev", "StdKilled", "VarKilled", "StdDevAvg", "VarAvg");
            foreach ($rra as $rra_key => $dses) {
                if (sizeof($dses)) {
                    foreach ($dses as $dskey => $ds) {
                        printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>" . ($ds["average"] < 1000000.0 ? "%s</td><td>" : "%.4e</td><td>") . ($ds["standard_deviation"] < 1000000.0 ? "%s</td><td>" : "%.4e</td><td>") . (isset($ds["max_value"]) ? $ds["max_value"] < 1000000.0 ? "%s</td><td>" : "%.4e</td><td>" : "%s</td><td>") . (isset($ds["min_value"]) ? $ds["min_value"] < 1000000.0 ? "%s</td><td>" : "%.4e</td><td>" : "%s</td><td>") . (isset($ds["max_cutoff"]) ? $ds["max_cutoff"] < 1000000.0 ? "%s</td><td>" : "%.4e</td><td>" : "%s</td><td>") . (isset($ds["min_cutoff"]) ? $ds["min_cutoff"] < 1000000.0 ? "%s</td><td>" : "%.4e</td><td>" : "%s</td><td>") . "%s</td><td>%s</td><td>" . (isset($ds["avgnksampled"]) ? $ds["avgnksamples"] < 1000000.0 ? "%s</td><td>" : "%.4e</td><td>" : "%s</td><td>") . (isset($ds["variance_avg"]) ? $ds["variance_avg"] < 1000000.0 ? "%s</td></tr>\n" : "%.4e</td></tr>\n" : "%s</td></tr>\n") . "\n", displayTime($rra_pdp[$rra_key]), $ds_name[$dskey], $rra_cf[$rra_key], $ds["totalsamples"], isset($ds["numsamples"]) ? $ds["numsamples"] : "0", $ds["average"] != "N/A" ? round($ds["average"], 2) : $ds["average"], $ds["standard_deviation"] != "N/A" ? round($ds["standard_deviation"], 2) : $ds["standard_deviation"], isset($ds["max_value"]) ? round($ds["max_value"], 2) : "N/A", isset($ds["min_value"]) ? round($ds["min_value"], 2) : "N/A", $ds["max_cutoff"] != "N/A" ? round($ds["max_cutoff"], 2) : $ds["max_cutoff"], $ds["min_cutoff"] != "N/A" ? round($ds["min_cutoff"], 2) : $ds["min_cutoff"], $ds["stddev_killed"], $ds["variance_killed"], $ds["avgnksamples"] != "N/A" ? round($ds["avgnksamples"], 2) : $ds["avgnksamples"], isset($ds["variance_avg"]) ? round($ds["variance_avg"], 2) : "N/A");
                    }
                }
            }
        }
    }
}
while ($row = pg_fetch_object($result)) {
    echo "\t<tr class=even pointer>\n";
    echo "\t\t<td align=left>{$row->alarmid}</td>";
    echo "\t\t<td align=left>{$row->ip}</td>";
    //$deviceCategory = deviceCat($row->nodesysoid);
    //echo "\t\t<td align=left>$deviceCategory</td>";
    //	echo "\t\t<td align=left>$row->deviceid</td>";
    $d = getDeviceCate($row->logs);
    echo "\t\t<td align=left>{$d}</td>";
    //$seve=visulize_severe($row->severity);
    $v = visulize_severe($row->severity);
    echo "\t\t<td align=left>{$v}</td>";
    //	$service = service_id($row->serviceid);
    echo "\t\t<td align=left>{$row->mac}</td>";
    //$alarmtype = alarm_type($row->alarmtype);
    $alarmTime = displayTime($row->time);
    echo "\t\t<td align=left>{$alarmTime}</td>";
    echo "\t\t<td align=left>{$row->logs}</td>";
    //	echo "\t\t<td align=center><a href=php_scripts/alarm_acknowledge_dialog.php?alarmid=$row->alarmid target=_blank ><img src=images/2c_go.png width=25 height=25></a></td>";
    echo "\t\t<td align=center><a href=php_scripts/curl_acknowlegeAlarm.php?alarmid={$row->alarmid} target=_blank ><img src=images/2c_go.png width=25 height=25></a></td>";
    echo "\t</tr>\n";
}
pg_free_result($result);
pg_close($dbconn);
function displayTime($t)
{
    if (strlen($t) == 13) {
        # code...
        $year = substr($t, 0, 4);
        $month = substr($t, 4, 2);
        $day = substr($t, 6, 2);
        default:
            # code...
            return $s;
            break;
    }
}
?>



	<table width="80%" class="table table-striped table-bordered table-condensed">

		<tr>
			<td><b>Last Scaned Time </td>
			<td> <?php 
echo displayTime($time);
?>
</td>	
			<td>    </td>
		</tr>

		<tr>
			<td><b>Public IP </td>
			<td> <?php 
echo $recordip;
?>
</td>	
			<td>    </td>
		</tr>

		<tr>
            // grab hours based on date and location
            // returns: OPEN_TIME, CLOSE_TIME, IS_CLOSED, TYPE, CATEGORY
            $today = getHoursByDate($currentdate, $location1, $type1);
            $widget = '
<div class="hours-widget">
  <p><strong>Today\'s Hours:</strong> &nbsp;';
            // if hours returned
            if ($today) {
                // display library hours as closed, 24 hrs or a range
                if ($today[0]['is_closed'] == 1) {
                    $widget .= 'Closed All Day</p>';
                } else {
                    if ($today[0]['open_time'] == $today[0]['close_time'] && $today[0]['is_closed'] == 0) {
                        $widget .= 'Open 24 Hrs</p>';
                    } else {
                        $widget .= displayTime($today[0]['open_time']) . ' - ' . displayTime($today[0]['close_time']) . '</p>';
                    }
                }
                //closes if-elseif-else
                // if no return
            } else {
                $widget .= 'N/A';
            }
            //closes if-else
            $widget .= '
</div>';
        } else {
            if ($display == 'status') {
                // grab status based on date, time and location (library hours only)
                $status = displayCurrentStatus($currentdate, $currenttime, $location1);
                $widget = '
    }
    return $year . "-" . $month . "-" . $day . " " . $hour . ":" . $min . ":" . $sec;
}
require "jpgraphplot.php";
require "daemon_db_init.php";
$item = $_GET['item'];
$id = $_SESSION['deviceid'];
$slot = "'" . $_GET['slot'] . "'";
$query = "SELECT \ndaemonsnmpelinkftx.time,\ndaemonsnmpelinkftx.{$item}\nFROM \npublic.daemonsnmpelinkftx\nWHERE daemonsnmpelinkftx.deviceid={$id}\nAND daemonsnmpelinkftx.slot={$slot};";
$time = [];
$abc = [];
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
$arr = pg_fetch_all($result);
$number = count($arr);
while ($row = pg_fetch_object($result)) {
    $time[] = displayTime($row->time);
    $abc[] = floatval($row->{$item});
}
pg_free_result($result);
pg_close($dbconn);
if ($number >= 20) {
    # code...
    $time = array_slice($time, sizeof($time) - 20);
    $abc = array_slice($abc, sizeof($abc) - 20);
}
$file = "graphPool/smaple" . date('YmdGis') . ".jpg";
plotGraph($item, $time, $abc, $file);
?>

<!DOCTYPE html>
<html lang="en">
Ejemplo n.º 6
0
							</div>
							<div class="box-right">
								<?php 
echo displaydateformatlong($rowLog['LOGIN_DATE']);
?>
							</div>
						</div>
						<div class="row cf">
							<div class="box-left">
								<?php 
echo $time;
?>
							</div>
							<div class="box-right">
								<?php 
echo displayTime($rowLog['LOGIN_DATE']);
?>
							</div>
						</div>
					</div>
					<div class="box-btn cf">
						<div class="row cf">
							<div class="box-left">
								<a href="account-edit.php" class="ed"><?php 
echo $edit;
?>
</a>
							</div>
							<div class="box-right">
								<a href="logout.php" class="lu"><?php 
echo $exit;
             }
             //closes if-else
         }
         //closes if-else
         $print .= '</span>';
         // now display the hours, first checking for TBD or closed booleans
         if ($results[$i]['is_tbd'] == 1) {
             $print .= '<span class="closed">N/A</span></p>';
         } else {
             if ($results[$i]['is_closed'] == 1) {
                 $print .= '<span class="closed">Closed</span></p>';
             } else {
                 if ($results[$i]['is_closed'] == 0 && $results[$i]['open_time'] == $results[$i]['close_time']) {
                     $print .= 'Open 24 Hours';
                 } else {
                     $print .= displayTime($results[$i]['open_time']) . '-' . displayTime($results[$i]['close_time']) . '</p>';
                 }
             }
         }
         //closes if-else
         //reset match to false to start the loop over
         $match = false;
     }
 }
 //closes if-elseif-else
 //**** ENDING IMAGE/MESSAGE ****
 // add additional info and close the column div during final iteration
 if ($i == $count - 1) {
     // add qr code and "printed on" to full version
     if ($version == "full") {
         $print .= '
                                        <?php 
        echo $redeem_row['top_up_serial_code'];
        ?>
                                    </div>
                                </td>
                                <td>
                                    <div class="table-text-overflow-ellipsis">
                                        <?php 
        echo displayDate($redeem_row['top_up_date']);
        ?>
                                    </div>
                                </td>
                                <td>
                                    <div class="table-text-overflow-ellipsis">
                                        <?php 
        echo displayTime($redeem_row['top_up_time']);
        ?>
                                    </div>
                                </td>   
                                <?php 
        if ($show_used == 0) {
            $confirm_message = "Confirm that you want to change " . $user_name . " voucher " . $redeem_row['voucher'] . " status?";
            ?>
                                    <td>
                                        <div class="table-text-overflow-ellipsis">
                                            <form action="<?php 
            echo $action_url;
            ?>
" onSubmit="return confirm('<?php 
            echo $confirm_message;
            ?>
Ejemplo n.º 9
0
         $dow = $day->appendChild($dow);
         // exception/holiday hours display as dates, regular hours display as days
         if ($hour_grouping['category'] == 'Holiday' || $hour_grouping['category'] == 'Exception') {
             $day_of_week = date('M j', strtotime($hour_day['day_of_week']));
         } else {
             $day_of_week = $hour_day['day_of_week'];
         }
         $ctext = $doc->createTextNode($day_of_week);
         $ctext = $dow->appendChild($ctext);
         $otime = $doc->createElement('open_time');
         $otime = $day->appendChild($otime);
         $ottext = $doc->createTextNode(displayTime($hour_day['open_time']));
         $ottext = $otime->appendChild($ottext);
         $ctime = $doc->createElement('close_time');
         $ctime = $day->appendChild($ctime);
         $cttext = $doc->createTextNode(displayTime($hour_day['close_time']));
         $cttext = $ctime->appendChild($cttext);
         $closed = $doc->createElement('is_closed');
         $closed = $day->appendChild($closed);
         $clsdtext = $doc->createTextNode($hour_day['is_closed'] ? "Closed" : "Open");
         $clsdtext = $closed->appendChild($clsdtext);
         $tbd = $doc->createElement('is_tbd');
         $tbd = $day->appendChild($tbd);
         $tbdtext = $doc->createTextNode($hour_day['is_tbd'] ? "TBD" : "");
         $tbdtext = $tbd->appendChild($tbdtext);
     }
     // end foreach hour_day
 }
 // end foreach hour_grouping
 //echo "Saving all the document:\n";
 header('Content-Type: text/xml');
 if ($criteria == ".1.3.6.1.4.1.3222.14.2.1.1" || $criteria == ".1.3.6.1.4.1.5591.29317.1.11.1.3.1.1" || $criteria == ".1.3.6.1.4.1.17409.1.11" || $criteria == "SNMPv2-SMI::enterprises.3222.14.2.1.1" || $criteria == "SNMPv2-SMI::enterprises.5591.29317.1.11.1.3.1.1" || $criteria == "SNMPv2-SMI::enterprises.17409.1.11" || $criteria == "SNMPv2-SMI::enterprises.5802.1.3.1.2" || $criteria == ".1.3.6.1.4.1.5802.1.3.1.2") {
     # code...
     echo "\t<tr class=even pointer>\n";
     echo "\t\t<td align=left>{$row->id}</td>";
     $deviceCategory = deviceCat(trim($row->mib));
     echo "\t\t<td align=left>{$deviceCategory}</td>";
     echo "\t\t<td align=left>{$row->ip} </td>";
     echo "\t\t<td align=left>{$row->mac} </td>";
     echo "\t\t<td align=left>{$row->sn} </td>";
     $profile = assigned_profile($row->provision);
     echo "\t\t<td align=left>{$profile}</td>";
     $alarmStatus = getAlarmStatus($row->ip);
     echo "\t\t<td align=left>{$alarmStatus}</td>";
     $onlineStatus = is_online_for_inventory($row->ip);
     echo "\t\t<td align=left>{$onlineStatus}</td>";
     $time = displayTime($row->time);
     echo "\t\t<td align=left>{$time}</td>";
     $trimedIp = trim($row->ip);
     switch (trim($row->mib)) {
         case ".1.3.6.1.4.1.3222.14.2.1.1":
             # code...
             echo "\t\t<td align=center><a href=daemon_scr/display_value_1550.php?ip={$trimedIp} target=_blank ><img src=images/search-icon-md.png style=width:20px;height:20px;>  </a></td>";
             echo "\t\t<td align=center><a href=daemon_scr/setup_alarmT_1550.php target=_blank ><img src=images/17-512.png style=width:20px;height:20px;></a></td>";
             echo "\t\t<td align=center><a href=daemon_scr/daemon_doDeleteDeive.php?ip={$trimedIp} target=_blank ><img src=images/editing-delete-icon.png style=width:20px;height:20px;></a></td>";
             echo "\t</tr>\n";
             break;
         case ".1.3.6.1.4.1.5591.29317.1.11.1.3.1.1":
             # code...
             echo "\t\t<td align=center><a href=daemon_scr/display_value_elink.php?ip={$trimedIp} target=_blank ><img src=images/search-icon-md.png style=width:20px;height:20px;>  </a></td>";
             echo "\t\t<td align=center><a href=daemon_scr/setup_alarmT_elink.php target=_blank ><img src=images/17-512.png style=width:20px;height:20px;></a></td>";
             echo "\t\t<td align=center><a href=daemon_scr/daemon_doDeleteDeive.php?ip={$trimedIp} target=_blank ><img src=images/editing-delete-icon.png style=width:20px;height:20px;></a></td>";
Ejemplo n.º 11
0
function displayHoursByMonth($month, $year, $branchID = null)
{
    global $dbh;
    if ($branchID == null) {
        $hourlocation = "";
    } else {
        $hourlocation = "AND hour_groupings.hour_location_id = {$branchID}";
    }
    //closes if-else
    // set first day of the month for longer (i.e. spanning multiple months) range checking
    $ymd = $year . '-' . $month . '-01';
    $sql = "SELECT hour_days.day_of_week, hour_days.open_time, hour_days.close_time, hour_days.is_closed, hour_days.is_tbd,\r\n                 hour_groupings.hour_category_id,\r\n                 hour_categories.category,\r\n                 hour_date_ranges.begin_date, hour_date_ranges.end_date\r\n          FROM hour_days\r\n          JOIN hour_groupings\r\n          ON hour_days.hour_grouping_id = hour_groupings.id\r\n          JOIN hour_date_ranges\r\n          ON hour_groupings.hour_date_range_id = hour_date_ranges.id\r\n          JOIN hour_categories\r\n          ON hour_groupings.hour_category_id = hour_categories.id\r\n          WHERE hour_days.hour_grouping_id IN (\r\n                SELECT hour_groupings.id\r\n                FROM hour_date_ranges\r\n                JOIN hour_groupings\r\n                ON hour_groupings.hour_date_range_id = hour_date_ranges.id\r\n                WHERE ( (EXTRACT(YEAR FROM hour_date_ranges.begin_date) = {$year} \r\n                        AND EXTRACT(MONTH FROM hour_date_ranges.begin_date) = {$month})\r\n                        OR  \r\n                        (EXTRACT(YEAR FROM hour_date_ranges.end_date) = {$year} \r\n                        AND EXTRACT(MONTH FROM hour_date_ranges.end_date) = {$month})\r\n                        OR\r\n                        (hour_date_ranges.begin_date <= '{$ymd}' AND '{$ymd}' <= hour_date_ranges.end_date)  )\r\n                AND hour_groupings.hour_type_id = 2\r\n                {$hourlocation} )\r\n          AND ( EXTRACT(MONTH FROM hour_days.day_of_week) = {$month}\r\n                OR hour_days.day_of_week = 'Monday'\r\n                OR hour_days.day_of_week = 'Tuesday'\r\n                OR hour_days.day_of_week = 'Wednesday'\r\n                OR hour_days.day_of_week = 'Thursday'\r\n                OR hour_days.day_of_week = 'Friday'\r\n                OR hour_days.day_of_week = 'Saturday'\r\n                OR hour_days.day_of_week = 'Sunday' )\r\n          ORDER BY hour_date_ranges.begin_date, hour_groupings.id,\r\n                   hour_days.day_of_week = 'Monday' DESC,\r\n                   hour_days.day_of_week = 'Tuesday' DESC,\r\n                   hour_days.day_of_week = 'Wednesday' DESC,\r\n                   hour_days.day_of_week = 'Thursday' DESC,\r\n                   hour_days.day_of_week = 'Friday' DESC,\r\n                   hour_days.day_of_week = 'Saturday' DESC,\r\n                   hour_days.day_of_week = 'Sunday' DESC,\r\n                   hour_days.day_of_week ASC";
    $sth = $dbh->prepare($sql);
    $status = $sth->execute();
    if ($sth->errorCode() !== '00000') {
        var_export($sth->errorInfo());
    }
    //closes if
    $results = $sth->fetchAll();
    $count = count($results);
    // matching hours set to false
    $match = false;
    // variable to store code string
    $hours = '';
    // if no hours were found
    if (!$results) {
        $hours .= '
              <h6>Hours Unavailable</h6>
              <p>No hours currently listed for this month.</p>';
    } else {
        // display hours by category, collapsing where appropriate
        for ($i = 0; $i < $count; $i++) {
            // variables to compare the next/prev values
            $next_open = isset($results[$i + 1]['open_time']) ? $results[$i + 1]['open_time'] : '0';
            $next_close = isset($results[$i + 1]['close_time']) ? $results[$i + 1]['close_time'] : '0';
            $next_closed = isset($results[$i + 1]['is_closed']) ? $results[$i + 1]['is_closed'] : '';
            $prev_category = isset($results[$i - 1]['hour_category_id']) ? $results[$i - 1]['hour_category_id'] : '0';
            $next_category = isset($results[$i + 1]['hour_category_id']) ? $results[$i + 1]['hour_category_id'] : '0';
            // show color block and heading when category is new
            if ($results[$i]['hour_category_id'] != $prev_category) {
                $hours .= '
              <h6><span class="hours-category ';
                if ($results[$i]['hour_category_id'] == 4) {
                    $hours .= 'summer-alternate';
                } else {
                    $hours .= strtolower($results[$i]['category']);
                }
                $hours .= '"></span>';
                if ($results[$i]['hour_category_id'] == 4 || $results[$i]['hour_category_id'] == 3) {
                    $hours .= 'Summer Hours';
                } else {
                    $hours .= $results[$i]['category'] . ' Hours';
                }
                if ($results[$i]['hour_category_id'] != 5 && $results[$i]['hour_category_id'] != 7) {
                    $hours .= ' (' . date('M j', strtotime($results[$i]['begin_date'])) . '-' . date('M j', strtotime($results[$i]['end_date'])) . ')';
                }
                $hours .= '</h6>
              <dl class="';
                if ($results[$i]['hour_category_id'] == 4) {
                    $hours .= 'summer-alternate';
                } else {
                    $hours .= strtolower($results[$i]['category']);
                }
                $hours .= '">';
            }
            //closes if
            // if the next set of hours is the same (and the same category), set the range start date, change match to true, break the loop
            if ($results[$i]['open_time'] == $next_open && $results[$i]['close_time'] == $next_close && $results[$i]['is_closed'] == $next_closed && $match == false && $results[$i]['hour_category_id'] == $next_category) {
                // exception/holiday hours display as dates, regular hours display as days
                if ($results[$i]['hour_category_id'] == 5 || $results[$i]['hour_category_id'] == 7) {
                    $start_range = date('M j', strtotime($results[$i]['day_of_week']));
                } else {
                    $start_range = date('D', strtotime($results[$i]['day_of_week']));
                }
                //closes if-else
                $match = true;
                continue;
                // if the next set of hours is the same (and the same category) AGAIN, just skip to the next one
            } else {
                if ($results[$i]['open_time'] == $next_open && $results[$i]['close_time'] == $next_close && $results[$i]['is_closed'] == $next_closed && $match == true && $results[$i]['hour_category_id'] == $next_category) {
                    continue;
                    // otherwise, display the hours
                } else {
                    $hours .= '
                <dt>';
                    // when a range has been set, display it
                    if ($match == true) {
                        $hours .= $start_range;
                        // exception/holiday hours display as dates, regular hours display as days
                        if ($results[$i]['hour_category_id'] == 5 || $results[$i]['hour_category_id'] == 7) {
                            if ($results[$i]['begin_date'] == $results[$i]['end_date']) {
                                $hours .= ' &amp ' . date('j', strtotime($results[$i]['day_of_week']));
                            } else {
                                $hours .= '-' . date('j', strtotime($results[$i]['day_of_week']));
                            }
                            //closes if-else
                        } else {
                            $hours .= '-' . date('D', strtotime($results[$i]['day_of_week']));
                        }
                        //closes if-else
                        // otherwise, just display the current date
                    } else {
                        // exception/holiday hours display as dates, regular hours display as days
                        if ($results[$i]['hour_category_id'] == 5 || $results[$i]['hour_category_id'] == 7) {
                            $hours .= date('M j', strtotime($results[$i]['day_of_week']));
                        } else {
                            $hours .= date('l', strtotime($results[$i]['day_of_week']));
                        }
                        //closes if-else
                    }
                    //closes if-else
                    $hours .= '</dt><dd>';
                    // now display the hours (uses displayTime function to trim zero minutes)
                    if ($results[$i]['is_tbd'] == 1) {
                        $hours .= 'TBD';
                    } else {
                        if ($results[$i]['is_closed'] == 1) {
                            $hours .= 'Closed';
                        } else {
                            if ($results[$i]['is_closed'] == 0 && $results[$i]['open_time'] == $results[$i]['close_time']) {
                                $hours .= 'Open 24 Hours';
                            } else {
                                $hours .= displayTime($results[$i]['open_time']) . ' - ' . displayTime($results[$i]['close_time']);
                            }
                        }
                    }
                    //closes if-else
                    $hours .= '</dd>';
                    // close dl, when next category is new
                    if ($results[$i]['hour_category_id'] != $next_category) {
                        $hours .= '
              </dl>
            ';
                    }
                    //closes if
                    //reset match to false to start the loop over
                    $match = false;
                }
            }
            //closes if
        }
        //closes for
    }
    //closes if-else
    return $hours;
}
<?php 
                } else {
                    if ($today[0]['open_time'] == $today[0]['close_time'] && $today[0]['is_closed'] == 0) {
                        ?>

hourswidget += 'Open 24 Hrs</p>';

<?php 
                    } else {
                        ?>

hourswidget += '<?php 
                        echo displayTime($today[0]['open_time']);
                        ?>
 - <?php 
                        echo displayTime($today[0]['close_time']);
                        ?>
</p>';

<?php 
                    }
                }
                //closes if-elseif-else
                // if no return
            } else {
                ?>

hourswidget += 'N/A';

<?php 
            }