如何创建多层次“树”? (如果它可以称为一棵树的话)

发布于 2024-08-09 04:53:45 字数 1307 浏览 6 评论 0原文

我有一个课程证书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 have Introduction_course (this course is a requirement of this certificate)
  • Funday_swimming can be obtained by those who have a Introduction_certificate (the certificate is a requirement of the fun_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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

强辩 2024-08-16 04:53:45

您可能会考虑类似有向图的东西,之前的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?

初相遇 2024-08-16 04:53:45

您可以使用

  • 标记,因此:
    • Introduction_course
      • Introduction_certificate
        • funday_swimming
      • 另一种证书

    (如果您尝试以 html 形式显示它)。

    如果您想要更多图形化的东西,您可以使用 svg 文件或 canvas 标签(在 html5 中)来绘制图形,或者,仅使用 lib_gd 绘制位图,并将其制作为图像图(如果需要)。

    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.

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文