Hello Ramil,
After modifying gantt.php, all tasks can’t be added, always showing bold, reloading the web task and emptying it. Is there anything I am doing wrong?
function addTask($request, $response, $args) {
$task = getTask($request->getParsedBody());
$db = getConnection();
$maxOrderQuery = "SELECT MAX(sortorder) AS maxOrder FROM gantt_tasks";
$statement = $db->prepare($maxOrderQuery);
$statement->execute();
$maxOrder = $statement->fetchColumn();
if(!$maxOrder)
$maxOrder = 0;
$task[":sortorder"] = $maxOrder + 1;
$query = "INSERT INTO gantt_tasks(text, start_date,end_date,duration, progress, parent, sortorder) ".
"VALUES (:text,:start_date,:end_date,:duration,:progress,:parent, :sortorder)";
$db->prepare($query)->execute($task);
return $response->withJson([
"action"=>"inserted",
"tid"=> $db->lastInsertId()
]);
}
// update task
function updateTask($request, $response, $args) {
$sid = $request->getAttribute(“id”);
$params = $request->getParsedBody();/!/
$task = getTask($params);
$db = getConnection();
$query = "UPDATE gantt_tasks ".
"SET text = :text, start_date = :start_date, end_date = :end_date, duration = :duration, progress = :progress, parent = :parent ".
“WHERE id = :sid”;
$db->prepare($query)->execute(array_merge($task, [":sid"=>$sid]));
if(isset($params["target"]) && $params["target"])/*!*/
updateOrder($sid, $params["target"], $db);
return $response->withJson([
"action"=>"updated"
]);
}