Writing Updated TaskLink Data to MPP in PHP

To write Updated TaskLink Data to MPP using Aspose.Tasks Java for PHP, simply invoke UpdateTaskLink module. Here you can see example code.

PHP Code

 1$one_sec = 10000000;
 2$one_min = 60 * $one_sec;
 3$one_hour = 60 * $one_min;
 4$project = new Project('test_tasks.mpp');
 5$tsk = new Tsk();
 6$prj = new Prj();
 7$task1 = $project->getRootTask()->getChildren()->add("1");
 8$timeUnitType = new TimeUnitType();
 9$task1->set($tsk->DURATION, $project->getDuration(8, $timeUnitType->Hour));
10$task1->set($tsk->START, $project->get($prj->START_DATE));
11$task1->set($tsk->FINISH, $project->get($prj->CALENDAR)->getTaskFinishDateFromDuration($task1,(double)(string)($task1->get($tsk->DURATION))));
12$task2 = $project->getRootTask()->getChildren()->add("2");
13$task2->set($tsk->DURATION, $project->getDuration(8, $timeUnitType->Hour));
14$task2->set($tsk->START, $project->get($prj->START_DATE));
15$task2->set($tsk->FINISH, $project->get($prj->CALENDAR)->getTaskFinishDateFromDuration($task2, (double)(string)($task2->get($tsk->DURATION))));
16$project->getRootTask()->getChildren()->add($task1);
17$project->getRootTask()->getChildren()->add($task2);
18$taskLinkType = new TaskLinkType();
19$link1 = $project->getTaskLinks()->add($task1, $task2, $taskLinkType->StartToStart);
20$saveFileFormat = new SaveFileFormat();
21$project->save("TaskLinks.mpp", $saveFileFormat->MPP);
22print "Saved task links data.";

Download Running Code

Download Writing Updated TaskLink Data to MPP (Aspose.Tasks) from any of the below mentioned social coding sites:

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.