0
因爲我改變了代碼任務詳細信息被保存到數據庫中,但鏈接任務之間的細節沒有被保存
FROM(注意,這部分代碼是節省了任務,並鏈接詳細信息):
$res=mysql_connect("localhost","root","");
mysql_select_db("gantt");
$gantt = new JSONGanttConnector($res);
$gantt->render_links("gantt_links","id","source,target,type");
$gantt->render_table("gantt_tasks","id","start_date,duration,text,progress,sortorder,parent");
TO:
$connector = new JSONGanttConnector($res);
function default_values($action){
global $user_id;
$action->add_field("userId", $user_id);
}
$connector->event->attach("beforeProcessing","default_values");
$connector->render_sql("select * from gantt_tasks where userId = ".$user_id,"id","start_date,duration,text,progress,sortorder,parent");
$connector->render_sql("select * from gantt_links where userId = ".$user_id,"id","source,target,type");
$connector ->render_links("gantt_links","id","source,target,type,userId");
$connector->render_table("gantt_tasks","id","start_date,duration,text,progress,sortorder,parent,userId");
它不僅節省了任務的詳細信息,但任務之間不連接的細節。我不明白爲什麼?就好像它忽略了代碼中的第二個render_mysql。
$鏈接 - >過濾器( 「用戶id」 $ USER_ID); $ links-> event-> attach(「beforeProcessing」,「default_values」); $ gantt-> render_links(「gantt_links」,「id」,「source,target,type,userId」); $ gantt-> filter(「userId」,$ user_id); $ gantt-> event-> attach(「beforeProcessing」,「default_values」); $ gantt-> render_sql(「select * from gantt_tasks where userId =」。$ user_id,「id」,「start_date,duration,text,progress,sortorder,parent」); $ gantt-> render_table(「gantt_tasks」,「id」,「start_date,duration,text,progress,parent,userId」); –
這段代碼可以工作,它可以保存表中的任務和鏈接細節。但是這次問題是,在gantt_links表中,只有userId沒有被保存:/。我不明白爲什麼userId沒有被保存..你能幫我解決它嗎? –
它得到解決,非常感謝你。 –