public static function get_filter_definition_data($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     $task_filters = $project->getTaskFilters()->toList();
     print "Task Filters Count: " . (string) $task_filters->size() . PHP_EOL;
     //.to_s
     print "All Tasks: " . (string) $task_filters->get(0)->getName() . PHP_EOL;
     //.to_s
     print "Task Item: " . (string) $task_filters->get(0)->getFilterType() . PHP_EOL;
     //.to_s;
     print "Task Filters Show In Menu: " . (string) $task_filters->get(0)->getShowInMenu() . PHP_EOL;
     //.to_s
     print "Task filter ShowRelatedSummaryRows: " . (string) $task_filters->get(0)->getShowRelatedSummaryRows() . PHP_EOL;
     //.to_s
     $rsc_filters = $project->getResourceFilters()->toList();
     print "Project.ResourceFilters count: " . (string) $rsc_filters->size() . PHP_EOL;
     //.to_s
     print "Resource Filter Item Type: Item.ResourceType: " . (string) $rsc_filters->get(0)->getFilterType() . PHP_EOL;
     //.to_s
     print "Resource filter ShowInMenu" . (string) $rsc_filters->get(0)->getShowInMenu() . PHP_EOL;
     //.to_s
     print "Resource filter ShowRelatedSummaryRows: " . (string) $rsc_filters->get(0)->getShowRelatedSummaryRows() . PHP_EOL;
     //.to_s
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     $t1 = $project->getTables()->toList()->get(0);
     print "Table Fields Count" . (string) $t1->getTableFields()->size();
     //.to_s
     $f = $t1->getTableFields()->get(0);
     print "Field width: " . (string) $f->getWidth() . PHP_EOL;
     //.to_s
     print "Field Title: " . (string) $f->getTitle() . PHP_EOL;
     //.to_s
     print "Field Title Alignment: " . (string) $f->getAlignTitle() . PHP_EOL;
     //.to_s
     print "Field Align Data: " . $f->getAlignData() . PHP_EOL;
     //.to_s
     $f = $t1->getTableFields()->get(1);
     print "Field width: " . (string) $f->getWidth() . PHP_EOL;
     //.to_s
     print "Field Title: " . (string) $f->getTitle() . PHP_EOL;
     //.to_s
     print "Field Title Alignment: " . (string) $f->getAlignTitle() . PHP_EOL;
     //.to_s
     print "Field Align Data: " . (string) $f->getAlignData() . PHP_EOL;
     //.to_s
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     # Create a ChildTasksCollector instance
     $collector = new ChildTasksCollector();
     # Collect all the tasks from RootTask using TaskUtils
     $taskUtils = new TaskUtils();
     $taskUtils->apply($project->getRootTask(), $collector, 0);
     $tasks = $collector->getTasks();
     $tsk = new Tsk();
     # Parse through all the collected tasks
     $i = 0;
     while ($i < sizeof($tasks)) {
         $task = $tasks->get($i);
         if ((string) $task->get($tsk->STOP) == "1/1/2015") {
             print "NA" . PHP_EOL;
         } else {
             print "Task Stop: " . (string) $task->get($tsk->STOP) . PHP_EOL;
             // . toString()
         }
         if ((string) $task->get($tsk->RESUME) == "1/1/2015") {
             print "NA" . PHP_EOL;
         } else {
             print "Task Resume: " . (string) $task->get($tsk->RESUME);
             // . toString()
         }
         print "---------------------------------------------" . PHP_EOL;
         $i += 1;
     }
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     $resource_assignments = $project->getResourceAssignments()->toList();
     # Parse through all the collected resource assignments
     $i = 0;
     $asn = new Asn();
     while ($i < sizeof($resource_assignments)) {
         $ra = $resource_assignments->get($i);
         if ((string) $ra->get($asn->STOP) == "1/1/2000") {
             print "NA" . PHP_EOL;
         } else {
             print (string) $ra->get($asn->STOP);
             // . toString();
         }
         if ((string) $ra->get($asn->RESUME) == "1/1/2000") {
             print "NA" . PHP_EOL;
         } else {
             print (string) $ra->get($asn->RESUME);
             // . toString()
         }
         $i += 1;
     }
 }
 public static function set_currency_code($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     $prj = new Prj();
     $project->set($prj->CURRENCY_CODE, "USD");
     print "Set currency code." . 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');
     $task = $project->getRootTask()->getChildren()->add("Task");
     $rsc = $project->getResources()->add("Rsc");
     $assn = $project->getResourceAssignments()->add($task, $rsc);
     print "Created resource assignment." . 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 run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     # Set baseline for the entire project
     $baselineType = new BaselineType();
     $project->setBaseline($baselineType->Baseline);
     print "Set baseline for the project." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project();
     $pred = $project->getRootTask()->getChildren()->add("Task 1");
     $succ = $project->getRootTask()->getChildren()->add("Task 2");
     $link = $project->getTaskLinks()->add($pred, $succ);
     print "Created task link." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'Sample.xml');
     # Display project version property
     $prj = new Prj();
     print "Project Version : " . (string) $project->get($prj->SAVE_VERSION) . PHP_EOL;
     //->to_string
     print "Last Saved : " . (string) $project->get($prj->LAST_SAVED) . 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 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();
     $pred = $project->getRootTask()->getChildren()->add("Task 1");
     $succ = $project->getRootTask()->getChildren()->add("Task 2");
     $link = $project->getTaskLinks()->add($pred, $succ);
     $taskLinkType = new TaskLinkType();
     $link->setLinkType($taskLinkType->StartToStart);
     print "Defined task link type." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project();
     print $project->getCalculationMode();
     $task = $project->getRootTask()->getChildren()->add("Task");
     $tsk = new Tsk();
     $task->set($tsk->DURATION, $project->getDuration(2));
     $task->set($tsk->PERCENT_COMPLETE, 50);
     print "Changed progress of task." . 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 run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     $res = $project->getResources()->toList()->get(0);
     $ea = new ExtendedAttribute();
     $ea->setFieldId("11");
     $ea->setValue("MyValueEA");
     $ea->setValueGuid("MyValueGuidEA");
     $res->getExtendedAttributes()->add($ea);
     print "Set extended resource attributes." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     $project = new Project();
     # Resource properties are represented by static class Rsc
     $rsc = $project->getResources()->add("Rsc");
     # set resource properties
     $rscc = new Rsc();
     $bigDecimal = new BigDecimal();
     $rsc->set($rscc->STANDARD_RATE, $bigDecimal->valueOf(15));
     $rsc->set($rscc->OVERTIME_RATE, $bigDecimal->valueOf(20));
     print "Set resource properties" . 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');
     # Remove an exception
     $cal = $project->getCalendars()->toList()->get(0);
     if ((int) (string) $cal->getExceptions()->getCount() > 1) {
         $exc = $cal->getExceptions()->toList()->get(0);
         $cal->getExceptions()->remove($exc);
         print "Removed calendar exception." . 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 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 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 set_resource_assignments($dataDir = null)
 {
     # Instantiate project object
     $project = new Project();
     $task = $project->getRootTask()->getChildren()->add("Task");
     $rsc = $project->getResources()->add("Rsc");
     $rscc = new Rsc();
     $bigDecimal = new BigDecimal();
     $rsc->set($rscc->STANDARD_RATE, $bigDecimal->valueOf(10));
     $rsc->set($rscc->OVERTIME_RATE, $bigDecimal->valueOf(15));
     $assn = $project->getResourceAssignments()->add($task, $rsc);
     print "Set resource assignment properties." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     $cal = $project->getCalendars()->toList()->get(0);
     # Add an exception
     $calExc = new CalendarException();
     $calendar = new Calendar();
     $calObject = $calendar->getInstance();
     $calObject->set(2009, 1, 1, 0, 0, 0);
     $calExc->setFromDate($calObject->getTime());
     $calObject->set(2009, 1, 3, 0, 0, 0);
     $calExc->setToDate($calObject->getTime());
     $cal->getExceptions()->add($calExc);
     print "Added calendar excpetion." . 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($dataDir . 'test_tasks.mpp');
     $resource_assignments = $project->getResourceAssignments()->toList();
     # Parse through all the collected resource assignments
     $i = 0;
     $asn = new Asn();
     while ($i < sizeof($resource_assignments)) {
         $ra = $resource_assignments->get($i);
         print "Percentage of the Completed Work: " . (string) $ra->get($asn->PERCENT_WORK_COMPLETE) . PHP_EOL;
         // . toString()
         print "--------------------------------------------------------" . PHP_EOL;
         $i += 1;
     }
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     $presentation_format = new PresentationFormat();
     $timescale = new Timescale();
     # Get number of pages
     print "Number of Pages = " . (string) $project->getPageCount($presentation_format->ResourceUsage, $timescale->Days) . PHP_EOL;
     //.to_s
     # Get number of pages (Months)
     print "Number of Pages = " . (string) $project->getPageCount($presentation_format->ResourceUsage, $timescale->Months) . PHP_EOL;
     //.to_s
     # Get number of pages (ThirdsOfMonths)
     print "Number of Pages = " . (string) $project->getPageCount($presentation_format->ResourceUsage, $timescale->ThirdsOfMonths) . PHP_EOL;
     //.to_s
 }
 public static function run($dataDir = null)
 {
     $onesec = 10000000;
     $onemin = 60 * $onesec;
     $onehour = 60 * $onemin;
     # Instantiate project object
     $project = new Project();
     # Creating TaskBaseline:
     $task = $project->getRootTask()->getChildren()->add("Task");
     $baselineType = new BaselineType();
     $project->setBaseline($baselineType->Baseline);
     $baseline = $task->getBaselines()->toList()->get(0);
     $duration = (double) (string) $baseline->getDuration();
     //.toDouble();
     $baseline_duration = $duration / $onehour;
     print $baseline_duration . PHP_EOL;
 }