RefGraph.php 1.2 KB

123456789101112131415161718192021222324252627282930313233
  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. echo UI::h('script', [ 'src' => "static/cytoscape.min.js" ]);
  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. echo UI::h('script', [ 'src' => "static/visjs/vis.min.js" ]);
  17. echo UI::h('style', [ 'type' => "text/css", 'src' => "static/visjs/vis.min.css" ]);
  18. UI::inlineJS(__FILE__ . '.view.js', [
  19. // 'FUNCTION_FETCH_CHILDRENS' => 'refGraphFetchChildrens',
  20. // 'FUNCTION_FETCH_PARENTS' => 'refGraphFetchParents',
  21. 'HTML_ID_REF_GRAPH' => 'ref_graph_node',
  22. 'TYPENAME' => Api_WfsNs::typeName($namespace),
  23. 'PRIMARY_KEY' => $primaryKey,
  24. // 'JS_CHANNEL_UPDATE_NAME' => $jsFunction['JS_CHANNEL_UPDATE_NAME'],
  25. 'DBG' => (V::get('DBG', 0, $_GET, 'int') > 0),
  26. ]);
  27. }
  28. }