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();
     # 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)
 {
     $d1 = new Date();
     $calendar = new Calendar();
     $cl = $calendar->getInstance();
     $cl->setTime($d1);
     $cl->add($calendar->HOUR, 1);
     $d2 = $cl->getTime();
     $journal = new MapiJournal("daily record", "called out in the dark", "Phone call", "Phone call");
     $journal->setStartTime($d1);
     $journal->setEndTime($d2);
     $personalStorage = new PersonalStorage();
     $fileFormatVersion = new FileFormatVersion();
     $pst = $personalStorage->create($dataDir . "JournalPST.pst", $fileFormatVersion->Unicode);
     $standardIpmFolder = new StandardIpmFolder();
     $journal_folder = $pst->createPredefinedFolder("Journal", $standardIpmFolder->Journal);
     $journal_folder->addMapiMessageItem($journal);
     print "Added MapiJournal Successfully." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Instantiate project object
     $project = new Project($dataDir . 'test_tasks.mpp');
     #Define Calendar
     $cal = $project->getCalendars()->add("Calendar1");
     # Define week days exception for christmis
     $except = new CalendarException();
     $except->setEnteredByOccurrences(false);
     $calendar = new Calendar();
     $calendarExceptionType = new CalendarExceptionType();
     $cal_object = $calendar->getInstance();
     $cal_object->set(2009, 12, 24, 0, 0, 0);
     $except->setFromDate($cal_object->getTime());
     $cal_object->set(2009, 12, 31, 23, 59, 0);
     $except->setToDate($cal_object->getTime());
     $except->setType($calendarExceptionType->Daily);
     $except->setDayWorking(false);
     $cal->getExceptions()->add($except);
     print "Defined weekdays for exceptions." . PHP_EOL;
 }