Ropstah
Ropstah

Reputation: 17794

How can I create a multi-hierarchical 'tree'? (If it can be called a tree)

i have a list of say courses and certificates and fun_days. These are all called objects. Every object has its requirements object_requirements. A requirement can be either one of the objects or several of them.

You can take any object without object_requirements as a starting point. "Everybody is allowed to have those objects."

So it could be that:

Is there a way to create a visual representation of the hierarchical or somewhat structured-flow of this system? The example is fairly simple, but multiple requirements anywhere in the 'tree' should be possible.

This is how I store the requirements:

TABLE: OBJECT_REQUIREMENT
 OBJECTTYPE                (pk)
 OBJECTID                  (pk)
 REQUIREMENT_OBJECTTYPE    (pk)
 REQUIREMENT_OBJECTID      (pk)

TABLE: COURSE
 OBJECTID                  (pk)
 OBJECTTYPE                       // value is always [1] for course

TABLE: CERTIFICATE
 OBJECTID                  (pk)
 OBJECTTYPE                       // value is always [2] for certificate

TABLE: FUN_DAY
 OBJECTID                  (pk)
 OBJECTTYPE                       // value is always [3] for fun_day

Oh and I use PHP and MySQL. But any piece of software which could generate these visual representations would be more than welcome also!

Upvotes: 0

Views: 1168

Answers (2)

James Black
James Black

Reputation: 41858

You can use the <li> tag, so:

  • Introduction_course
    • Introduction_certificate
      • funday_swimming
    • Another certificate

If you are trying to show it in html.

If you want something that is more graphical, you can use svg files or canvas tags (in html5) in order to draw the graph, or, just use lib_gd to draw a bitmap, and make it into an imagemap, if needed.

Upvotes: 0

Amber
Amber

Reputation: 526573

You might consider something like a directed graph, to which this previous SO question might be useful:

How to do directed graph drawing in PHP?

Upvotes: 2

Related Questions