Advertisement
globiws

pf_draw_podio_space

Nov 26th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. // draw_podio_space
  2. // paste result into https://mermaid-js.github.io/mermaid-live-editor/#/
  3.  
  4. input "Space ID?" $space
  5.  
  6. print "classDiagram\n"
  7. $d = makeSpace($space)
  8. print $d
  9.  
  10. function makeSpace($space) {
  11. $apps = podio_space_get_apps($space)
  12. $d = ""
  13. foreach ( $apps as $app ) {
  14. $class = "class "+saften($app.config.name)+" {\n"
  15. $rels = ""
  16. $app = podio_app_get_raw($app.app_id)
  17. foreach ( $app.fields as $field ) {
  18. $class = $class+saften($field.config.label)+"\n"
  19. if ( $field.type != "app" ) continue
  20. foreach ( $field.config.settings.referenced_apps as $ref ) {
  21. $rels = $rels + saften($ref.app.name)+"<|--"+saften($app.config.name)+"\n"
  22. }
  23. }
  24. $class = $class+"}\n"
  25. $d = $d + $class+$rels
  26. }
  27. return $d
  28. }
  29.  
  30. function saften($name) {
  31. $name = str_replace(" ", "_", $name)
  32. $name = preg_replace("/[^a-z0-9_]/i", "", $name)
  33. return $name
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement