function printGraph($task, $level, &$bizrules) { foreach ($task as $child => $grandChildren) { if ($level > 0) { echo '<em>'; for ($i = 0; $i < $level - 1; $i++) { echo '│ '; } echo '└─'; echo '</em>'; } // if(in_array($child,$bizrules)) // $child .= ' (#)'; if (empty($grandChildren)) { echo '<b'; if (in_array($child, $bizrules)) { echo ' class="biz"'; } echo ">● {$child}</b>\n"; } else { echo "○ {$child} \n"; printGraph($grandChildren, $level + 1, $bizrules); } } }
// echo "</pre>"; } function printGraph($graphfile) { // echo '<div id="container"> // <div id="graph-container">'; require "./graph_json.html"; // echo '</div></div>'; } ?> <html> <head> <meta charset="UTF-8"> <title></title> <link rel='stylesheet' type='text/css' href='myCss.css' /> </head> <body> <div id="container"> <!-- <div id="PublicationList">Scroll down to see the graph</div>--> <?php $xmlfile = "myPubs.xml"; $graphfile = "myCoauth.json"; checkGraph($xmlfile, $graphfile); printPublications($xmlfile); printGraph($graphfile); ?> </div> </body> </html>