Jump to content

[SOLVED] how to use php display a organization structure chart?


Recommended Posts

Too vague, I'm not going to code the entire thing for you.  Try something, post some code.

 

In general, you need a relational database designed that shows the relationships between the departments, staff, whatever you're organizing.  Then you need to decide how you want it displayed on the website and create the HTML template for it.  Then you create your backend queries (the PHP part) to fill that template with the info you want.

With any chart of this type you need a data structure which holds a parent id for each item. The "parent" in the case of an organisation chart would be the person's boss.

 

You then need a recursive algorithm to create a box for a person with lower level boxes for the people reporting to that person. Each of the lower level boxes then have lower level boxes for people reporting to them and so on.

 

You would probably have to do two passes on the data, the first to find out the max number at the bottom of the pyramid, and how many levels, so you know how to to size/scale it. The second pass can then draw it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.