src/FS/File/Gantt/CalendarBuilder.php
public function build( $projects, $meetings )
	{
		$tree		= new XML_DOM_Node( $this->title );
		$cal		= new XML_DOM_Node( "vcalendar" );
		$cal->addChild( new XML_DOM_Node( "version", "2.0" ) );
		foreach( $projects as $project )
		{
			$start		= strtotime( $project['start'] );
			$end		= strtotime( $project['end'] );
			$event		= new XML_DOM_Node( "vevent" );
			$start		= new XML_DOM_Node( "dtstart", date( "Ymd", $start ) );
			$end		= new XML_DOM_Node( "dtend", date( "Ymd", $end ) );
			$summary	= new XML_DOM_Node( "summary", $project['name'] );
			$event->addChild( $start );
			$event->addChild( $end );
			$event->addChild( $summary );
			$cal->addChild( $event );
		}

		foreach( $meetings as $meeting )
		{
			$start		= strtotime( $meeting['start'] );
			$end		= strtotime( $meeting['end'] );
			$event		= new XML_DOM_Node( "vevent" );
			$start		= new XML_DOM_Node( "dtstart", date( "Ymd", $start ) );
			$end		= new XML_DOM_Node( "dtend", date( "Ymd", $end ) );
			$summary	= new XML_DOM_Node( "summary", $meeting['name'] );
			$event->addChild( $start );
			$event->addChild( $end );
			$event->addChild( $summary );
			$cal->addChild( $event );
		}
		$tree->addChild( $cal );

		$builder	= new FS_File_iCal_Builder();
		$ical		= $builder->build( $tree );
		return $ical;
	}
public function build( $projects, $meetings )
	{
		$tree		= new XML_DOM_Node( $this->title );
		$cal		= new XML_DOM_Node( "vcalendar" );
		$cal->addChild( new XML_DOM_Node( "version", "2.0" ) );
		foreach( $projects as $project )
		{
			$start		= strtotime( $project['start'] );
			$end		= strtotime( $project['end'] );
			$event		= new XML_DOM_Node( "vevent" );
			$start		= new XML_DOM_Node( "dtstart", date( "Ymd", $start ) );
			$end		= new XML_DOM_Node( "dtend", date( "Ymd", $end ) );
			$summary	= new XML_DOM_Node( "summary", $project['name'] );
			$event->addChild( $start );
			$event->addChild( $end );
			$event->addChild( $summary );
			$cal->addChild( $event );
		}

		foreach( $meetings as $meeting )
		{
			$start		= strtotime( $meeting['start'] );
			$end		= strtotime( $meeting['end'] );
			$event		= new XML_DOM_Node( "vevent" );
			$start		= new XML_DOM_Node( "dtstart", date( "Ymd", $start ) );
			$end		= new XML_DOM_Node( "dtend", date( "Ymd", $end ) );
			$summary	= new XML_DOM_Node( "summary", $meeting['name'] );
			$event->addChild( $start );
			$event->addChild( $end );
			$event->addChild( $summary );
			$cal->addChild( $event );
		}
		$tree->addChild( $cal );

		$builder	= new FS_File_iCal_Builder();
		$ical		= $builder->build( $tree );
		return $ical;
	}
public function build ( $ projects , $ meetings ) { $ tree = new XML_DOM_Node ( $ this -> title ) ; $ cal = new XML_DOM_Node ( "vcalendar" ) ; $ cal -> addChild ( new XML_DOM_Node ( "version" , "2.0" ) ) ; foreach ( $ projects as $ project ) { $ start = strtotime ( $ project [ 'start' ] ) ; $ end = strtotime ( $ project [ 'end' ] ) ; $ event = new XML_DOM_Node ( "vevent" ) ; $ start = new XML_DOM_Node ( "dtstart" , date ( "Ymd" , $ start ) ) ; $ end = new XML_DOM_Node ( "dtend" , date ( "Ymd" , $ end ) ) ; $ summary = new XML_DOM_Node ( "summary" , $ project [ 'name' ] ) ; $ event -> addChild ( $ start ) ; $ event -> addChild ( $ end ) ; $ event -> addChild ( $ summary ) ; $ cal -> addChild ( $ event ) ; } foreach ( $ meetings as $ meeting ) { $ start = strtotime ( $ meeting [ 'start' ] ) ; $ end = strtotime ( $ meeting [ 'end' ] ) ; $ event = new XML_DOM_Node ( "vevent" ) ; $ start = new XML_DOM_Node ( "dtstart" , date ( "Ymd" , $ start ) ) ; $ end = new XML_DOM_Node ( "dtend" , date ( "Ymd" , $ end ) ) ; $ summary = new XML_DOM_Node ( "summary" , $ meeting [ 'name' ] ) ; $ event -> addChild ( $ start ) ; $ event -> addChild ( $ end ) ; $ event -> addChild ( $ summary ) ; $ cal -> addChild ( $ event ) ; } $ tree -> addChild ( $ cal ) ; $ builder = new FS_File_iCal_Builder ( ) ; $ ical = $ builder -> build ( $ tree ) ; return $ ical ; }
Builds iCal File with Project and Meeting Dates.
@access		public
@param		array		$projects		Array of Projects
@param		array		$meetings		Array of Meetings
@return		string
Builds iCal File with Project and Meeting Dates .