开发者

Need help planning a task management site

I want to build a website that helps users with a specific task. Let's say for example it's a site on building a house. There's a definite order of things that need to be done (i.e. can't lay carpet before pouring the slab). I want users to be able to check off that they've poured the sla开发者_运维百科b and it'll be marked done.

I will be putting all of the tasks in a "tasks" table. There will be a prerequisites table to make sure a user is allowed to check off a task.

ALl of that is fine. However, when it comes down to coding the site, I'm having trouble figuring out how I'm going to have one more level of options for certain items. As an example, I'd like for someone to be able to check off "Chose a contractor" and a form will pop up asking them to enter the contractor's contact information. On other choices, there isn't anything else to do other than simply check off the choice.

How would you go about coding this up? I can't wrap my head around the part where some items will have additional information the user can add.


This is a database design question.

There are a number of ways to do it, but one way is to have tasks have a ParentTaskID field. If there is a non-NULL value for this field, then you know that the task is a sub-task, and you know which task is the parent. If it's NULL, then it is just a first-level task.

Based on Brad's comment below, you can also make a table that lists all prerequisite tasks for a particular task. A lack of an entry in this table means that this task can be done at any time within the flow, while one (or more) entries means, say, that you can't do the drywall task without first having done the plumbing task and the wiring task.


I have the feeling that you are describing TaskFreak, which is written in PHP. Maybe you can learn from their code. You can download it here http://www.taskfreak.com/original/download

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜