RefGraph.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. Lib::loadClass('Api_WfsNs');
  3. class Route_RefGraph extends RouteBase {
  4. function defaultAction() {
  5. UI::layout([$this, 'defaultView']);
  6. }
  7. function defaultView() {
  8. $namespace = V::get('namespace', '', $_GET);
  9. if (!$namespace) throw new Exception("Missing namespace");
  10. $primaryKey = V::get('primaryKey', '', $_GET);
  11. if (!$primaryKey) throw new Exception("Missing primaryKey");
  12. $show_flow_diagram = (V::get('FLOW', 0, $_GET, 'int') > 0); // TODO: BUG dla pracownika 9
  13. echo UI::h('div', [ 'id' => "ref_graph_node", 'style' => "width:98%; height:500px; border:1px solid silver; margin:8px auto; padding:0" ], [
  14. "Pobieranie danych..."
  15. ]);
  16. if ($show_flow_diagram) { // $_GET['FLOW'] = 1
  17. echo UI::h('svg', [ 'width' => "200%", 'height' => "500", 'id' => "d3-sankey-test" ]);
  18. echo UI::h('script', [ 'src' => "https://d3js.org/d3.v4.js" ]);
  19. echo UI::h('script', [ 'src' => "https://unpkg.com/d3-sankey@0.7.1" ]);
  20. }
  21. echo UI::h('script', [ 'src' => "static/visjs/vis.min.js" ]);
  22. echo UI::h('style', [ 'type' => "text/css", 'src' => "static/visjs/vis.min.css" ]);
  23. UI::inlineJS(__FILE__ . '.view.js', [
  24. // 'FUNCTION_FETCH_CHILDRENS' => 'refGraphFetchChildrens',
  25. // 'FUNCTION_FETCH_PARENTS' => 'refGraphFetchParents',
  26. 'HTML_ID_REF_GRAPH' => 'ref_graph_node',
  27. 'TYPENAME' => Api_WfsNs::typeName($namespace),
  28. 'PRIMARY_KEY' => $primaryKey,
  29. // 'WFS_URL' => Router::getRoute('Test_WfsApi')->getLink(),
  30. // 'WFS_URL' => "https://biuro.biall-net.pl/dev-pl/se-master/wfs-data.php/default_db/",
  31. // 'JS_CHANNEL_UPDATE_NAME' => $jsFunction['JS_CHANNEL_UPDATE_NAME'],
  32. 'DBG' => (V::get('DBG', 0, $_GET, 'int') > 0),
  33. 'SHOW_FLOW_DIAGRAM' => $show_flow_diagram,
  34. ]);
  35. }
  36. }