if (count($_POST['input']) != $nn->inputs) { throw new Exception("Incorrect number of entries!"); } $outputs = $nn->run($_POST['input']); //save into cache $app->model->get("cache")->saveCache($_GET['n'] . implode("|", $_POST['input']), $_GET['n'], implode("|", $outputs)); } else { $outputs = explode("|", $data); //get from cache } $return = "<table>"; $maxout = max($outputs); $count = 1; foreach ($outputs as $output) { $return .= "<tr><td>Output {$count}: <strong>" . $output . "</strong></td>"; $return .= "<td>" . buildGraph($output) . ($output == $maxout ? "«" : "") . "</td></tr>"; $count++; } $return .= "</table>"; } $app->display("header"); ?> <div id="tools"> <fieldset> <legend>Note:</legend> These values range from -1 to 1 rather than binary so instead of working with 0 to 1, you need to use -1. The bar graph is a visual representation of the range with the lowest being closer to -1, center being 0 and highest being closer to 1. </fieldset> </div>
function buildGraph($task, &$allTasks, &$authGraph) { if (!isset($allTasks[$task]) || empty($allTasks[$task])) { return array(); } else { $children = array(); foreach (array_keys($allTasks[$task]) as $child) { if (isset($authGraph[$child]) && $authGraph[$child] === false) { continue; } $childGraph = buildGraph($child, $allTasks, $authGraph); $children[$child] = $childGraph; $authGraph[$child] = false; // this is a child task, remove it from the top level } return $children; } }
var seconds = Math.floor(value / 100) % 60; var centis = value % 100; if (minutes > 0 && seconds < 10) seconds = '0' + seconds; if (centis < 10) centis = '0' + centis; return (minutes > 0 ? minutes + ':' : '') + seconds + (showCentis ? '.' + centis : ''); } EOD; $tabLinks = $tabDivs = ''; foreach ($whats as $what) { list($eventId, $eventName, $divide) = explode(':', "{$what}:100"); #pretty("$eventId, $eventName, $divide"); $tabLinks .= "<li><a href=\"#container_{$eventId}\">{$eventName}</a></li>\n"; $tabDivs .= "<div id=\"container_{$eventId}\" style=\"xwidth: 95%; width: 940px; height: 600px; margin: auto; xborder: 1px solid red\"></div>\n"; $eventChartsJs .= buildGraph($eventName, $eventId, $divide) . "\n"; } file_put_contents('charts_data.js', "{$eventChartsJs}});});"); #--- Finish/store/show the page echo "\n<div id=\"tabs\" style=\"font-size:0.7em; width:980px; margin:auto\">\n<ul>\n{$tabLinks}</ul>\n{$tabDivs}</div>"; require '../../includes/_footer.php'; $html = ob_get_clean(); echo $html; if (!wcaDebug()) { file_put_contents('index.php', $html); } #---------------------------------------------------------------------- function buildGraph($eventName, $eventId, $divide) { #---------------------------------------------------------------------- #pretty("buildGraph( $eventName, $eventId, $divide ) ...");