Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // draw_podio_space
- // paste result into https://mermaid-js.github.io/mermaid-live-editor/#/
- input "Space ID?" $space
- print "classDiagram\n"
- $d = makeSpace($space)
- print $d
- function makeSpace($space) {
- $apps = podio_space_get_apps($space)
- $d = ""
- foreach ( $apps as $app ) {
- $class = "class "+saften($app.config.name)+" {\n"
- $rels = ""
- $app = podio_app_get_raw($app.app_id)
- foreach ( $app.fields as $field ) {
- $class = $class+saften($field.config.label)+"\n"
- if ( $field.type != "app" ) continue
- foreach ( $field.config.settings.referenced_apps as $ref ) {
- $rels = $rels + saften($ref.app.name)+"<|--"+saften($app.config.name)+"\n"
- }
- }
- $class = $class+"}\n"
- $d = $d + $class+$rels
- }
- return $d
- }
- function saften($name) {
- $name = str_replace(" ", "_", $name)
- $name = preg_replace("/[^a-z0-9_]/i", "", $name)
- return $name
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement