public static function run($dataDir = null) { $one_sec = 10000000; # microsecond * 10 $one_min = 60 * $one_sec; $one_hour = 60 * $one_min; # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); $tsk = new Tsk(); $prj = new Prj(); # Add tasks $task1 = $project->getRootTask()->getChildren()->add("1"); $timeUnitType = new TimeUnitType(); $task1->set($tsk->DURATION, $project->getDuration(8, $timeUnitType->Hour)); $task1->set($tsk->START, $project->get($prj->START_DATE)); $task1->set($tsk->FINISH, $project->get($prj->CALENDAR)->getTaskFinishDateFromDuration($task1, (double) (string) $task1->get($tsk->DURATION))); //.toDouble() $task2 = $project->getRootTask()->getChildren()->add("2"); $task2->set($tsk->DURATION, $project->getDuration(8, $timeUnitType->Hour)); $task2->set($tsk->START, $project->get($prj->START_DATE)); $task2->set($tsk->FINISH, $project->get($prj->CALENDAR)->getTaskFinishDateFromDuration($task2, (double) (string) $task2->get($tsk->DURATION))); //.toDouble() $project->getRootTask()->getChildren()->add($task1); $project->getRootTask()->getChildren()->add($task2); # Add four TaskLinks with different TaskLinkTypes $taskLinkType = new TaskLinkType(); $link1 = $project->getTaskLinks()->add($task1, $task2, $taskLinkType->StartToStart); # Save the Project $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "TaskLinks.mpp", $saveFileFormat->MPP); print "Saved task links data." . PHP_EOL; }
public static function save_to_text($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); # Save the Project as Text $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "Project.txt", $saveFileFormat->TXT); print "Saved project data to Text, please check the output file" . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); # Save the Project as XLSX $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "Project.XLSX", $saveFileFormat->XLSX); print "Saved project data to Excel, please check the output file" . PHP_EOL; }
public static function set_currency_digits($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); $prj = new Prj(); $project->set($prj->CURRENCY_DIGITS, 2); $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "ProjectCurrDigits.mpp", $saveFileFormat->MPP); print "Set currency digits." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project(); $project_stream = new FileOutputStream($dataDir . "Project1.xml"); $saveFileFormat = new SaveFileFormat(); $project->save($project_stream, $saveFileFormat->XML); $project_stream->close(); # Display Status print "Created project Successfully." . PHP_EOL; }
public static function set_currency_symbol($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); $prj = new Prj(); $project->set($prj->CURRENCY_SYMBOL, "\$\$"); $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "ProjectCurrSymbols.mpp", $saveFileFormat->MPP); exit; print "Set currency symbol." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); $prj = new Prj(); # Set new task property $taskStartDateType = new TaskStartDateType(); $project->set($prj->NEW_TASK_START_DATE, $taskStartDateType->CurrentDate); $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "set_attributes_for_new_tasks.xml", $saveFileFormat->XML); print "Set attributes for new tasks, please check the output file." . PHP_EOL; }
public static function render_resource_sheetview($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); # Define the SaveOptions with required TimeScale settings as Days $options = new PdfSaveOptions(); # Set the Presentation format to ResourceSheet $presentationFormat = new PresentationFormat(); $options->setPresentationFormat($presentationFormat->ResourceSheet); $project->save($dataDir . "result.pdf", $options); print "Created resource sheet view file." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); # Define Calendar $cal1 = $project->getCalendars()->add("My Cal"); $calendar = new Calendar(); $calendar->makeStandardCalendar($cal1); # Save the Project $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "CreateStandardCalendar.xml", $saveFileFormat->XML); print "Created standard calendar, please check the output file." . PHP_EOL; }
public static function set_fiscal_year_properties($dataDir = null) { # Instantiate project object $project = new Project(); $prj = new Prj(); # Set fiscal year properties $month = new Month(); $project->set($prj->FY_START_DATE, $month->July); $project->set($prj->FISCAL_YEAR_START, new NullableBool(true)); $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "fiscal_year_properties.xml", $saveFileFormat->XML); print "Set fiscal year properties, please check the output file." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); # Define Calendar $cal1 = $project->getCalendars()->add("no info"); $cal2 = $project->getCalendars()->add("no name"); $cal3 = $project->getCalendars()->add("cal3"); # Save the Project $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "CreateCalendar.xml", $saveFileFormat->XML); print "Created calendar, please check the output file." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); # Define the SaveOptions with required TimeScale settings as Days $options = new PdfSaveOptions(); $timescale = new Timescale(); $options->setTimescale($timescale->Days); # Set the Presentation format to ResourceUsage $presentationFormat = new PresentationFormat(); $options->setPresentationFormat($presentationFormat->TaskUsage); # Save the Project $project->save($dataDir . "task_days.pdf", $options); # Set the Tiemscale settings to ThirdsOfMonths $options->setTimescale($timescale->ThirdsOfMonths); # Save the Project $project->save($dataDir . "task_thirdsOfMonths.pdf", $options); # Set the Timescale settings to Months $options->setTimescale($timescale->Months); # Save the project $project->save($dataDir . "task_months.pdf", $options); print "Created task usage view files." . PHP_EOL; }
public static function set_weekday_properties($dataDir = null) { # Instantiate project object $project = new Project(); $prj = new Prj(); $dayType = new DayType(); # Set week days properties $project->set($prj->WEEK_START_DAY, $dayType->Monday); $project->set($prj->DAYS_PER_MONTH, 24); $project->set($prj->MINUTES_PER_DAY, 540); $project->set($prj->MINUTES_PER_WEEK, 3240); $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "weekday_properties.xml", $saveFileFormat->XML); print "Set weekday properties, please check the output file." . PHP_EOL; }
public static function set_currency_properties($dataDir = null) { # Instantiate project object $project = new Project(); $prj = new Prj(); # Set currency properties $currencySymbolPositionType = new CurrencySymbolPositionType(); $project->set($prj->CURRENCY_CODE, "AUD"); $project->set($prj->CURRENCY_DIGITS, 2); $project->set($prj->CURRENCY_SYMBOL, "\$"); $project->set($prj->CURRENCY_SYMBOL_POSITION, $currencySymbolPositionType->After); $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "currency_properties.xml", $saveFileFormat->XML); print "Set currency properties, please check the output file." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); $options = new PdfSaveOptions(); # Set the LegendOnEachPage property to false to hide legends # Set the row height to fit cell content $timescale = new Timescale(); $presentationFormat = new PresentationFormat(); $options->setFitContent(true); $options->setTimescale($timescale->Months); $options->setPresentationFormat($presentationFormat->TaskUsage); $options->setLegendOnEachPage(false); $project->save($dataDir . "project.pdf", $options); print "Saved project as pdf, please check the output file." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project(); $prj = new Prj(); $tsk = new Tsk(); # Get a standard calendar $calendar = $project->get($prj->CALENDAR); # Set project's calendar settings $cal = new Calendar(); $cal = $cal->getInstance(); $cal->set(2011, 3, 15, 8, 0, 0); $project->set($prj->START_DATE, $cal->getTime()); $cal->set(2011, 3, 21, 17, 0, 0); $project->set($prj->FINISH_DATE, $cal->getTime()); # root task $rootTask = $project->getRootTask(); $rootTask->set($tsk->NAME, "Root"); # Add a new task $taskToSplit = $rootTask->getChildren()->add("Task1"); $taskToSplit->set($tsk->DURATION, $project->getDuration(3)); # Create a new resource assignment $splitResourceAssignment = $project->getResourceAssignments()->add($taskToSplit, null); # Generate resource assignment timephased data $splitResourceAssignment->timephasedDataFromTaskDuration($calendar); # Split the task into 3 parts. # Provide start date and finish date arguments to SplitTask method # These dates will be used for split # Set project's calendar settings $cal = new Calendar(); $cal = $cal->getInstance(); $cal2 = new Calendar(); $cal2 = $cal2->getInstance(); $cal->set(2011, 3, 16, 8, 0, 0); $cal2->set(2011, 3, 16, 17, 0, 0); $splitResourceAssignment->splitTask($cal->getTime(), $cal2->getTime(), $calendar); $cal->set(2011, 3, 18, 8, 0, 0); $cal2->set(2011, 3, 18, 17, 0, 0); $splitResourceAssignment->splitTask($cal->getTime(), $cal2->getTime(), $calendar); $asn = new Asn(); $workContourType = new WorkContourType(); $splitResourceAssignment->set($asn->WORK_CONTOUR, $workContourType->Contoured); # Save the Project $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "SplitTasks.xml", $saveFileFormat->XML); }
public static function run($dataDir = null) { # Instantiate project object $project = new Project(); # Define Calendar $cal = $project->getCalendars()->add("Calendar1"); $weekday = new WeekDay(); $daytype = new DayType(); # Add working days monday through thursday with default timings $cal->getWeekDays()->add($weekday->createDefaultWorkingDay($daytype->Monday)); $cal->getWeekDays()->add($weekday->createDefaultWorkingDay($daytype->Tuesday)); $cal->getWeekDays()->add($weekday->createDefaultWorkingDay($daytype->Wednesday)); $cal->getWeekDays()->add($weekday->createDefaultWorkingDay($daytype->Thursday)); $cal->getWeekDays()->add(new WeekDay($daytype->Saturday)); $cal->getWeekDays()->add(new WeekDay($daytype->Sunday)); # Set friday as short working day $myWeekDay = new WeekDay($daytype->Friday); # Sets working time. Only time part of DateTime is important $wt1 = new WorkingTime(); $calendar = new Calendar(); $calTime = $calendar->getInstance(); $calTime->set(1, 1, 1, 9, 0, 0); $date = $calTime->getTime(); $wt1->setFromTime($date); $calTime->set(1, 1, 1, 12, 0, 0); $date = $calTime->getTime(); $wt1->setToTime($date); $wt2 = new WorkingTime(); $calTime->set(1, 1, 1, 13, 0, 0); $date = $calTime->getTime(); $wt2->setFromTime($date); $calTime->set(1, 1, 1, 16, 0, 0); $date = $calTime->getTime(); $wt2->setToTime($date); $myWeekDay->getWorkingTimes()->add($wt1); $myWeekDay->getWorkingTimes()->add($wt2); $myWeekDay->setDayWorking(true); $cal->getWeekDays()->add($myWeekDay); # Save the Project $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "CalendarWeekdays.xml", $saveFileFormat->XML); print "Defined weekdays for calendar, please check the output file." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate project object $project = new Project($dataDir . 'test_tasks.mpp'); # create a new task $task = $project->getRootTask()->getChildren()->add("Task1"); # set start date $cal = new Calendar(); $cal = $cal->getInstance(); $cal->set(2015, 7, 1, 8, 0, 0); $tsk = new Tsk(); $task->set($tsk->START, $cal->getTime()); $cal->set(2015, 7, 1, 17, 0, 0); $task->set($tsk->FINISH, $cal->getTime()); # Save the project as MPP project file $saveFileFormat = new SaveFileFormat(); $project->save($dataDir . "AfterLinking.mpp", $saveFileFormat->MPP); print "Project file updated, please check the output file." . PHP_EOL; }