我尝试使用 gantview jquery 插件(https://github.com/thegrubbsian/jquery.ganttView)
所以需要的数据是这样的:
{
id: 1, name: "Feature 1", series: [
{ name: "Planned", start: new Date(2010,00,01), end: new Date(2010,00,03) },
{ name: "Actual", start: new Date(2010,00,02), end: new Date(2010,00,05), color: "#f0f0f0" }
]
},
{
id: 2, name: "Feature 2", series: [
{ name: "Planned", start: new Date(2010,00,05), end: new Date(2010,00,20) },
{ name: "Actual", start: new Date(2010,00,06), end: new Date(2010,00,17), color: "#f0f0f0" },
{ name: "Projected", start: new Date(2010,00,06), end: new Date(2010,00,17), color: "#e0e0e0" }
]
},
{
id: 3, name: "Feature 3", series: [
{ name: "Planned", start: new Date(2010,00,11), end: new Date(2010,01,03) },
{ name: "Actual", start: new Date(2010,00,15), end: new Date(2010,01,03), color: "#f0f0f0" }
]
},
{
id: 4, name: "Feature 4", series: [
{ name: "Planned", start: new Date(2010,01,01), end: new Date(2010,01,03) },
{ name: "Actual", start: new Date(2010,01,01), end: new Date(2010,01,05), color: "#f0f0f0" }
]
}
好的,我认为它的 JSON :-) 所以我用 php 构建它,我的 funcs 输出是:
SERIES DATA
Array
(
[name] => Krank
[start] => 1317420000
[end] => 1320102000
)
DATA
Array
(
[id] => 1
[name] => 15
[series] => Array
(
[name] => Krank
[start] => 1317420000
[end] => 1320102000
)
)
JSON
{"id":1,"name":15,"series":{"name":"Krank","start":1317420000,"end":1320102000}}
当然,我只将 json 部分提交给插件;)
我构建了一个数组并将其编码为 json。
因此,使用此数据插件不起作用。我不知道如何用 php 重建这些数据。
一些提示?;)