如何创建多层次“树”? (如果它可以称为一棵树的话)
我有一个课程
、证书
和fun_days
的列表。这些都称为对象
。每个对象都有其要求object_requirements
。需求可以是对象
之一或其中多个。
您可以将任何对象
没有object_requirements
作为起点
。 “每个人都可以拥有这些物品。”
因此可能是:
Introduction_course
是一个起点(无要求)Introduction_certificate
可以由那些拥有Introduction_course
的人获得(此课程
是此证书
的要求)- 拥有
Introduction_certificate
的人可以获得Funday_swimming
(该证书是fun_day
)。
有没有办法创建该系统的分层或结构化流程的可视化表示?该示例相当简单,但“树”中任何位置的多个需求都应该是可能的。
这就是我存储需求的方式:
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
哦,我使用 PHP 和 MySQL。但是任何可以生成这些视觉表示的软件也将受到欢迎!
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:
Introduction_course
is a starting point (no requirements)Introduction_certificate
can be obtained by those who haveIntroduction_course
(thiscourse
is a requirement of thiscertificate
)Funday_swimming
can be obtained by those who have aIntroduction_certificate
(the certificate is a requirement of thefun_day
).
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会考虑类似有向图的东西,之前的SO问题可能有用:
如何在 PHP 中进行有向图绘制?
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?
您可以使用
标记,因此:
(如果您尝试以 html 形式显示它)。
如果您想要更多图形化的东西,您可以使用 svg 文件或 canvas 标签(在 html5 中)来绘制图形,或者,仅使用 lib_gd 绘制位图,并将其制作为图像图(如果需要)。
You can use the
<li>
tag, so: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.