function displayGraphDetail($devices) { //global the tool and make a tool bar for adding a client global $tool, $deviceForm; $now = time(); $day = time() - 24 * 60 * 60; $twoday = time() - 2 * 24 * 60 * 60; $week = time() - 7 * 24 * 60 * 60; $month = time() - 31 * 24 * 60 * 60; $year = time() - 365 * 24 * 60 * 60; $interfaces = $devices->get_interfaces(); $interfaceID = $_GET['interID']; $port = new Port($interfaceID); echo "<table id=\"dataTable\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" style='width:1024px;'>"; #"<select name='interfaces' onchange=\"return LoadPage('statistics.php?action=showCurGraph&mode=graphTime'+this.value, 'statGraphs')\">"; $deviceID = $devices->get_device_id(); $oriName = $port->get_name(); $nameTitle = str_replace(" ", "%20", $oriName); $name = str_replace(" ", "-", $oriName); $name = str_replace("/", "-", $name); $type = $_GET['type']; $graph = $type; switch ($type) { case "traffic": $graph = 'Bits Per Second'; break; case "errors": $graph = 'Errors'; break; case "unicastpkts": $graph = 'Unicast Packets'; break; case "nonunicastpkts": $graph = 'Non Unicast Packets'; break; } $type = str_replace(" ", "%20", $type); $graph = str_replace(" ", "%20", $graph); $graphLink = "rrdgraph.php?file=deviceid" . $deviceID . "_" . $name . ".rrd&title=" . $nameTitle . "---" . $graph . "&height=150&width=900&type=" . $type; $dayLink = $graphLink . "&from=" . $day . "&to=-1s"; $weekLink = $graphLink . "&from=" . $week . "&to=-1s"; $monthLink = $graphLink . "&from=" . $month . "&to=-1s"; $yearLink = $graphLink . "&from=" . $year . "&to=-1s"; $detail = "statistics.php?action=zoomGraphDetail&ID=" . $deviceID . "&interID=" . $port->get_interface_id() . "&active=" . $port->get_oper_status() . "&type=" . $type; echo "<thead><tr><th colspan='5'>" . $oriName . " | " . $devices->get_name() . " | " . $port->get_descr() . " - " . $port->get_alias() . "</th></tr></thead>\r\n\t\t<tbody>\r\n\t\t<tr>\r\n\t\t<tr class='form'><td class='info' style='text-align:center;'><h3>Last Day</h3></td></tr>\r\n\t\t<tr>\r\n\t\t<td><a href='#' onclick=\"handleEvent('" . $detail . "&from=day&to=now')\"><img src=" . $dayLink . "></a></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<tr class='form'><td class='info' style='text-align:center;'><h3>Last Week</h3></td></tr>\r\n\t\t<tr>\r\n\t\t<td><a href='#' onclick=\"handleEvent('" . $detail . "&from=week&to=now')\"><img src=" . $weekLink . "></a></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<tr class='form'><td class='info' style='text-align:center;'><h3>Last Month</h3></td></tr>\r\n\t\t<tr>\r\n\t\t<td><a href='#' onclick=\"handleEvent('" . $detail . "&from=month&to=now')\"><img src=" . $monthLink . "></a></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<tr class='form'><td class='info' style='text-align:center;'><h3>Last Year</h3></td></tr>\r\n\t\t<tr><td><a href='#' onclick=\"handleEvent('" . $detail . "&from=year&to=now')\"><img src=" . $yearLink . "></a></td></tr>\r\n\t\t</tbody>"; echo "</table>"; }