Location: PHPKode > projects > PhpiCalLib > doc/PhpiCalLib/tutorial_create.pkg.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Object creation</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			

	<table class="tutorial-nav-box">
	<tr>
		<td style="width: 30%">
							<a href="../PhpiCalLib/tutorial_examples.pkg.html" class="nav-button">Previous</a>
					</td>
		<td style="text-align: center">
							<a href="../PhpiCalLib/tutorial_examples.pkg.html" class="nav-button">Up</a>
					</td>
		<td style="text-align: right; width: 30%">
							<a href="../PhpiCalLib/tutorial_parse.pkg.html" class="nav-button">Next</a>
					</td>
	</tr>
	<tr>
		<td style="width: 30%">
							<span class="detail">Examples</span>
					</td>
		<td style="text-align: center">
							<span class="detail">Examples</span>
					</td>
		<td style="text-align: right; width: 30%">
							<span class="detail">File parsing</span>
					</td>
	</tr>
</table>
	
<div><a name=""></a><div class="ref-title-box"><h1 class="ref-title">Object creation</h1>
		<h2 class="ref-purpose">An example of creating an iCalendar file using PhpiCalLib</h2></div>
	<h1 class="title">Table of Contents</h1>
<ul class="toc">
	
			
					<li><a href="../PhpiCalLib/tutorial_create.pkg.html#source">Source</a></li>
					
					<li><a href="../PhpiCalLib/tutorial_create.pkg.html#input">Input</a></li>
					
					<li><a href="../PhpiCalLib/tutorial_create.pkg.html#output">Output</a></li>
					</ul>

	<span><a name="source"></a><h2 class="title">Source</h2><p>The source of the example:</p>
		<div class="src-code"><ol><li><div class="src-line"><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;create.php:&nbsp;example&nbsp;of&nbsp;creating&nbsp;an&nbsp;icalendar&nbsp;file</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;In&nbsp;this&nbsp;example,&nbsp;we&nbsp;try&nbsp;to&nbsp;create&nbsp;an&nbsp;ics&nbsp;file&nbsp;that&nbsp;looks&nbsp;like&nbsp;the&nbsp;following:</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-inlinetag">{@example&nbsp;create.ics}</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@copyright</span><span class="src-doc">&nbsp;Copyright&nbsp;(C)&nbsp;2008&nbsp;Nigel&nbsp;Swinson,&nbsp;hide@address.com</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@author</span><span class="src-doc">&nbsp;&nbsp;Nigel&nbsp;Swinson</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;PhpiCalLib</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@version</span><span class="src-doc">&nbsp;1.0</span></div></li>
<li><div class="src-line"><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//&nbsp;You&nbsp;should&nbsp;only&nbsp;ever&nbsp;have&nbsp;to&nbsp;include&nbsp;this&nbsp;file.</span></div></li>
<li><div class="src-line"><span class="src-inc">require_once&nbsp;</span><span class="src-str">'../icalendar.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//&nbsp;The&nbsp;error&nbsp;handling&nbsp;model&nbsp;in&nbsp;PhpiCalLib&nbsp;is&nbsp;to&nbsp;throw&nbsp;exceptions,&nbsp;so&nbsp;you&nbsp;really&nbsp;should&nbsp;wrap&nbsp;code</span></div></li>
<li><div class="src-line"><span class="src-comm">//&nbsp;that&nbsp;calls&nbsp;the&nbsp;library&nbsp;in&nbsp;a&nbsp;try/catch&nbsp;block&nbsp;to&nbsp;handle&nbsp;errors.</span></div></li>
<li><div class="src-line">try&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Create&nbsp;a&nbsp;new&nbsp;event&nbsp;object.&nbsp;&nbsp;It&nbsp;will&nbsp;automatically&nbsp;get&nbsp;DtStamp,&nbsp;DtStart&nbsp;and&nbsp;Uid&nbsp;properties&nbsp;as&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;these&nbsp;are&nbsp;compulsory.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Event.html">PhpiCalLib_Event</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Set&nbsp;the&nbsp;event's&nbsp;attributes.&nbsp;&nbsp;There&nbsp;are&nbsp;several&nbsp;ways&nbsp;we&nbsp;can&nbsp;set&nbsp;the&nbsp;property&nbsp;values.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;-&nbsp;Call&nbsp;SetEncodedValue()&nbsp;supplying&nbsp;an&nbsp;encoded&nbsp;string</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;-&nbsp;Call&nbsp;SetValue()&nbsp;supplying&nbsp;a&nbsp;strongly&nbsp;typed&nbsp;object&nbsp;from&nbsp;which&nbsp;we&nbsp;can&nbsp;extract&nbsp;the&nbsp;encoded&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;string&nbsp;by&nbsp;calling&nbsp;ToString()</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;-&nbsp;Use&nbsp;a&nbsp;PhpiCalLib_PropertyFactory&nbsp;and&nbsp;call&nbsp;ToContentLines()&nbsp;suppling&nbsp;the&nbsp;encoded&nbsp;value&nbsp;for</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;the&nbsp;full&nbsp;string&nbsp;of&nbsp;the&nbsp;property</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;Dtstamp&nbsp;property.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;###&nbsp;Note&nbsp;this&nbsp;isn't&nbsp;strictly&nbsp;necessary&nbsp;as&nbsp;the&nbsp;Event&nbsp;will&nbsp;auto&nbsp;allocate&nbsp;a&nbsp;DtStamp&nbsp;property.&nbsp;&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;It&nbsp;is&nbsp;also&nbsp;not&nbsp;normally&nbsp;even&nbsp;correct,&nbsp;as&nbsp;DtStamp&nbsp;is&nbsp;meant&nbsp;to&nbsp;represent&nbsp;the&nbsp;time&nbsp;the&nbsp;ics&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;object&nbsp;representation&nbsp;was&nbsp;generated,&nbsp;which&nbsp;is&nbsp;exactly&nbsp;what&nbsp;the&nbsp;default&nbsp;will&nbsp;do.&nbsp;&nbsp;But&nbsp;the&nbsp;premise</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;of&nbsp;the&nbsp;example&nbsp;is&nbsp;to&nbsp;produce&nbsp;an&nbsp;ics&nbsp;file&nbsp;like&nbsp;the&nbsp;example,&nbsp;so&nbsp;we&nbsp;override&nbsp;it.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DtStamp&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Properties_DtStampProperty.html">PhpiCalLib_Properties_DtStampProperty</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Here&nbsp;we&nbsp;use&nbsp;a&nbsp;DateTime&nbsp;object&nbsp;to&nbsp;create&nbsp;the&nbsp;value</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DateTime&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_DataTypes_DateTime.html">PhpiCalLib_DataTypes_DateTime</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DateTime</span><span class="src-sym">-&gt;</span><span class="src-id">Parse</span><span class="src-sym">(</span><span class="src-str">&quot;19960704T120000Z&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DtStamp</span><span class="src-sym">-&gt;</span><a href="../PhpiCalLib/PhpiCalLib_Properties_UnencodedProperty.html#methodSetValue">SetValue</a><span class="src-sym">(</span><span class="src-var">$DateTime</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Note&nbsp;calling&nbsp;SetProperty&nbsp;removes&nbsp;any&nbsp;previous&nbsp;values.&nbsp;&nbsp;Were&nbsp;we&nbsp;to&nbsp;call&nbsp;AddProperty,&nbsp;then&nbsp;it&nbsp;would</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;add&nbsp;an&nbsp;additional&nbsp;DtStamp&nbsp;to&nbsp;any&nbsp;that&nbsp;were&nbsp;already&nbsp;there.&nbsp;&nbsp;The&nbsp;Event&nbsp;class&nbsp;chooses&nbsp;a&nbsp;default&nbsp;DtStamp</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;property&nbsp;so&nbsp;we&nbsp;want&nbsp;to&nbsp;remove&nbsp;it&nbsp;and&nbsp;replace&nbsp;it&nbsp;with&nbsp;this,&nbsp;so&nbsp;hence&nbsp;the&nbsp;call&nbsp;to&nbsp;SetProperty.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;AddProperty&nbsp;is&nbsp;faster,&nbsp;so&nbsp;is&nbsp;a&nbsp;better&nbsp;choice&nbsp;for&nbsp;properties&nbsp;that&nbsp;are&nbsp;not&nbsp;required.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">SetProperty</span><span class="src-sym">(</span><span class="src-var">$DtStamp</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;Uid&nbsp;property.&nbsp;&nbsp;Note&nbsp;this&nbsp;isn't&nbsp;strictly&nbsp;necessary,&nbsp;as&nbsp;the&nbsp;Event&nbsp;will&nbsp;auto</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;allocate&nbsp;a&nbsp;Uid&nbsp;property</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Uid&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Properties_UidProperty.html">PhpiCalLib_Properties_UidProperty</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Here&nbsp;we&nbsp;call&nbsp;SetTextValue()&nbsp;to&nbsp;create&nbsp;the&nbsp;property,&nbsp;which&nbsp;is&nbsp;a&nbsp;method&nbsp;of&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;PhpiCalLib_Properties_UidProperty&nbsp;that&nbsp;offers&nbsp;extra&nbsp;validation.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Uid</span><span class="src-sym">-&gt;</span><span class="src-id">SetTextValue</span><span class="src-sym">(</span><span class="src-str">'hide@address.com'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;A&nbsp;required&nbsp;property,&nbsp;so&nbsp;we&nbsp;call&nbsp;SetProperty&nbsp;to&nbsp;overwrite&nbsp;the&nbsp;default</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">SetProperty</span><span class="src-sym">(</span><span class="src-var">$Uid</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;organizer.&nbsp;&nbsp;Note&nbsp;here&nbsp;we&nbsp;illustrate&nbsp;using&nbsp;the&nbsp;generic&nbsp;ContentLine&nbsp;base&nbsp;class</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;to&nbsp;create&nbsp;the&nbsp;property,&nbsp;which&nbsp;won't&nbsp;offer&nbsp;us&nbsp;any&nbsp;validation,&nbsp;meaning&nbsp;if&nbsp;the&nbsp;coder</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;gets&nbsp;it&nbsp;wrong,&nbsp;we&nbsp;may&nbsp;create&nbsp;an&nbsp;invalid&nbsp;iCalendar&nbsp;file</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Organiser&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_ContentLine.html">PhpiCalLib_ContentLine</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Organiser</span><span class="src-sym">-&gt;</span><a href="../PhpiCalLib/PhpiCalLib_ContentLine.html#methodSetName">SetName</a><span class="src-sym">(</span><span class="src-str">'ORGANIZER'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Because&nbsp;we&nbsp;are&nbsp;using&nbsp;the&nbsp;PhpiCalLib_ContentLine()&nbsp;base&nbsp;class,&nbsp;our&nbsp;only&nbsp;option&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;is&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;to&nbsp;call&nbsp;SetEncodedValue()</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Organiser</span><span class="src-sym">-&gt;</span><a href="../PhpiCalLib/PhpiCalLib_Properties_VersionProperty.html#methodSetEncodedValue">SetEncodedValue</a><span class="src-sym">(</span><span class="src-str">&quot;mailto:hide@address.com&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">AddProperty</span><span class="src-sym">(</span><span class="src-var">$Organiser</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;DtStart&nbsp;property&nbsp;to&nbsp;19960918T143000Z</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DtStart&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Properties_DtStartProperty.html">PhpiCalLib_Properties_DtStartProperty</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Here&nbsp;we&nbsp;exculively&nbsp;use&nbsp;the&nbsp;API&nbsp;to&nbsp;create&nbsp;the&nbsp;values&nbsp;without&nbsp;needing&nbsp;to&nbsp;do&nbsp;any&nbsp;parsing.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Perhaps&nbsp;the&nbsp;highest&nbsp;performance,&nbsp;but&nbsp;a&nbsp;bit&nbsp;laborious,&nbsp;compare&nbsp;this&nbsp;to&nbsp;setting&nbsp;the&nbsp;DtStamp</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Date&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_DataTypes_Date.html">PhpiCalLib_DataTypes_Date</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Date</span><span class="src-sym">-&gt;</span><span class="src-id">SetFullYear</span><span class="src-sym">(</span><span class="src-num">1996</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Date</span><span class="src-sym">-&gt;</span><span class="src-id">SetMonth</span><span class="src-sym">(</span><span class="src-num">9</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Date</span><span class="src-sym">-&gt;</span><span class="src-id">SetMonthDay</span><span class="src-sym">(</span><span class="src-num">18</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Time&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_DataTypes_Time.html">PhpiCalLib_DataTypes_Time</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Time</span><span class="src-sym">-&gt;</span><span class="src-id">SetHours</span><span class="src-sym">(</span><span class="src-num">14</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Time</span><span class="src-sym">-&gt;</span><span class="src-id">SetMinutes</span><span class="src-sym">(</span><span class="src-num">30</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Time</span><span class="src-sym">-&gt;</span><span class="src-id">SetSeconds</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Time</span><span class="src-sym">-&gt;</span><span class="src-id">SetUtc</span><span class="src-sym">(</span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DateTime&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_DataTypes_DateTime.html">PhpiCalLib_DataTypes_DateTime</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DateTime</span><span class="src-sym">-&gt;</span><span class="src-id">SetDate</span><span class="src-sym">(</span><span class="src-var">$Date</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DateTime</span><span class="src-sym">-&gt;</span><span class="src-id">SetTime</span><span class="src-sym">(</span><span class="src-var">$Time</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DtStart</span><span class="src-sym">-&gt;</span><span class="src-id">SetDateTimeValue</span><span class="src-sym">(</span><span class="src-var">$DateTime</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;A&nbsp;required&nbsp;property,&nbsp;so&nbsp;we&nbsp;call&nbsp;SetProperty&nbsp;to&nbsp;overwrite&nbsp;the&nbsp;default</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">SetProperty</span><span class="src-sym">(</span><span class="src-var">$DtStart</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;DtEnd&nbsp;property&nbsp;to&nbsp;19960920T220000Z</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DtEnd&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Properties_DtEndProperty.html">PhpiCalLib_Properties_DtEndProperty</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Here&nbsp;we&nbsp;use&nbsp;an&nbsp;alternative&nbsp;method&nbsp;of&nbsp;PhpiCalLib_DataTypes_DateTime&nbsp;to&nbsp;create&nbsp;the&nbsp;object.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Compare&nbsp;this&nbsp;to&nbsp;the&nbsp;way&nbsp;we&nbsp;set&nbsp;the&nbsp;DtStart&nbsp;or&nbsp;DtStamp&nbsp;properties</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DateTime&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_DataTypes_DateTime.html">PhpiCalLib_DataTypes_DateTime</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;int&nbsp;gmmktime&nbsp;(&nbsp;[int&nbsp;hour&nbsp;[,&nbsp;int&nbsp;minute&nbsp;[,&nbsp;int&nbsp;second&nbsp;[,&nbsp;int&nbsp;month&nbsp;[,&nbsp;int&nbsp;day&nbsp;[,&nbsp;int&nbsp;year&nbsp;[,&nbsp;int&nbsp;is_dst]]]]]]]&nbsp;)</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Note&nbsp;we&nbsp;use&nbsp;gmmktime&nbsp;to&nbsp;make&nbsp;a&nbsp;time&nbsp;WRT&nbsp;to&nbsp;UTC</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$TimeStamp&nbsp;</span>=&nbsp;<a href="http://www.php.net/gmmktime">gmmktime</a><span class="src-sym">(</span><span class="src-num">22</span><span class="src-sym">,</span><span class="src-num">00</span><span class="src-sym">,</span><span class="src-num">00</span><span class="src-sym">,</span><span class="src-num">9</span><span class="src-sym">,</span><span class="src-num">20</span><span class="src-sym">,</span><span class="src-num">1996</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DateTime</span><span class="src-sym">-&gt;</span><span class="src-id">FromTimeStamp</span><span class="src-sym">(</span><span class="src-var">$TimeStamp</span><span class="src-sym">,&nbsp;</span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$DtEnd</span><span class="src-sym">-&gt;</span><span class="src-id">SetDateTimeValue</span><span class="src-sym">(</span><span class="src-var">$DateTime</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">AddProperty</span><span class="src-sym">(</span><span class="src-var">$DtEnd</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;Status&nbsp;property.&nbsp;&nbsp;Here&nbsp;we&nbsp;illustrate&nbsp;the&nbsp;use&nbsp;of&nbsp;the&nbsp;Property&nbsp;factory.&nbsp;&nbsp;The&nbsp;object</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;returned&nbsp;will&nbsp;be&nbsp;the&nbsp;most&nbsp;specialized&nbsp;PhpiCalLib_ContentLine&nbsp;class&nbsp;available&nbsp;providing&nbsp;the&nbsp;best</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;data&nbsp;validation&nbsp;possible.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$PropertyFactory&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_PropertyFactory.html">PhpiCalLib_PropertyFactory</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Status&nbsp;</span>=&nbsp;<span class="src-var">$PropertyFactory</span><span class="src-sym">-&gt;</span><a href="../PhpiCalLib/PhpiCalLib_ContentLine.html#methodCreate">Create</a><span class="src-sym">(</span><span class="src-str">&quot;STATUS:CONFIRMED&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">AddProperty</span><span class="src-sym">(</span><span class="src-var">$Status</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;The&nbsp;intention&nbsp;is&nbsp;that&nbsp;your&nbsp;code&nbsp;for&nbsp;adding&nbsp;properties&nbsp;would&nbsp;look&nbsp;more&nbsp;along&nbsp;these&nbsp;lines.&nbsp;&nbsp;Create</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;a&nbsp;specialized&nbsp;property,&nbsp;call&nbsp;a&nbsp;custom&nbsp;accessor&nbsp;to&nbsp;set&nbsp;the&nbsp;value,&nbsp;and&nbsp;then&nbsp;add&nbsp;it&nbsp;to&nbsp;the&nbsp;component.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;Categories</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Categories&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Properties_CategoriesProperty.html">PhpiCalLib_Properties_CategoriesProperty</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Categories</span><span class="src-sym">-&gt;</span><span class="src-id">SetTextValue</span><span class="src-sym">(</span><span class="src-str">'CONFERENCE'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">AddProperty</span><span class="src-sym">(</span><span class="src-var">$Categories</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;Summary</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Summary&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Properties_SummaryProperty.html">PhpiCalLib_Properties_SummaryProperty</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Summary</span><span class="src-sym">-&gt;</span><span class="src-id">SetTextValue</span><span class="src-sym">(</span><span class="src-str">'Networld+Interop&nbsp;Conference'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">AddProperty</span><span class="src-sym">(</span><span class="src-var">$Summary</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;description&nbsp;property</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Description&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Properties_DescriptionProperty.html">PhpiCalLib_Properties_DescriptionProperty</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Note&nbsp;here&nbsp;we&nbsp;add&nbsp;a&nbsp;multiline&nbsp;text&nbsp;property,&nbsp;so&nbsp;we&nbsp;use&nbsp;&quot;&nbsp;to&nbsp;indicate&nbsp;the&nbsp;\n&nbsp;means&nbsp;newline.&nbsp;&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Were&nbsp;we&nbsp;to&nbsp;call&nbsp;SetEnocededValue,&nbsp;it&nbsp;would&nbsp;throw&nbsp;an&nbsp;exception&nbsp;as&nbsp;raw&nbsp;newlines&nbsp;aren't&nbsp;allowed&nbsp;in&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;property&nbsp;values.</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Description</span><span class="src-sym">-&gt;</span><span class="src-id">SetTextValue</span><span class="src-sym">(</span><span class="src-str">&quot;Networld+Interop&nbsp;Conference&nbsp;and&nbsp;Exhibit\nAtlanta&nbsp;World&nbsp;Congress&nbsp;Center\n&nbsp;Atlanta,&nbsp;Georgia&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Event</span><span class="src-sym">-&gt;</span><span class="src-id">AddProperty</span><span class="src-sym">(</span><span class="src-var">$Description</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;the&nbsp;completed&nbsp;event&nbsp;to&nbsp;an&nbsp;iCalendar&nbsp;object</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$iCalFile&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_iCalendar.html">PhpiCalLib_iCalendar</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$iCalFile</span><span class="src-sym">-&gt;</span><span class="src-id">AddComponent</span><span class="src-sym">(</span><span class="src-var">$Event</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><span class="src-sym">}&nbsp;</span>catch&nbsp;<span class="src-sym">(</span><span class="src-id"><a href="../PhpiCalLib/PhpiCalLib_Exception.html">PhpiCalLib_Exception</a>&nbsp;</span><span class="src-var">$E</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;A&nbsp;failure&nbsp;in&nbsp;the&nbsp;API,&nbsp;but&nbsp;perhaps&nbsp;the&nbsp;default&nbsp;exception&nbsp;handler&nbsp;is&nbsp;sufficient?&nbsp;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-var">$E</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><span class="src-sym">}</span></div></li>
<li><div class="src-line"><span class="src-php">?&gt;</span></div></li>
<li><div class="src-line">&lt;html&gt;</div></li>
<li><div class="src-line">&lt;body&gt;</div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&lt;table&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;Contents&nbsp;of&nbsp;&lt;a&nbsp;href=&quot;create.ics&quot;&gt;create.ics&lt;/a&gt;&lt;/th&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;Contents&nbsp;of&nbsp;manually&nbsp;created&nbsp;ics&nbsp;file&lt;/th&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;pre&gt;<span class="src-php">&lt;?</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<a href="http://www.php.net/htmlspecialchars">htmlspecialchars</a><span class="src-sym">(</span><a href="http://www.php.net/file_get_contents">file_get_contents</a><span class="src-sym">(</span><span class="src-str">'create.ics'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-php">?&gt;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/pre&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/td&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;pre&gt;<span class="src-php">&lt;?</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Echo&nbsp;it's&nbsp;results</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-var">$iCalFile</span><span class="src-sym">-&gt;</span><a href="../PhpiCalLib/PhpiCalLib_ContentLine.html#methodToString">ToString</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-php">?&gt;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/pre&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/td&gt;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;</div></li>
<li><div class="src-line">&lt;/table&gt;</div></li>
<li><div class="src-line">&lt;/body&gt;</div></li>
<li><div class="src-line">&lt;/html&gt;</div></li>
</ol></div></span>
	<span><a name="input"></a><h2 class="title">Input</h2><p>The sample input file:</p>
		<div class="src-code"><ol><li><div class="src-line"><span class="src-id">BEGIN</span>:<span class="src-id">VCALENDAR</span></div></li>
<li><div class="src-line"><span class="src-id">PRODID</span>:-<span class="src-comm">//xyz&nbsp;Corp//NONSGML&nbsp;PDA&nbsp;Calendar&nbsp;Version&nbsp;1.0//EN</span></div></li>
<li><div class="src-line"><span class="src-id">VERSION</span>:<span class="src-num">2.0</span></div></li>
<li><div class="src-line"><span class="src-id">BEGIN</span>:<span class="src-id">VEVENT</span></div></li>
<li><div class="src-line"><span class="src-id">DTSTAMP</span>:<span class="src-num">19960704</span><span class="src-id">T120000Z</span></div></li>
<li><div class="src-line"><span class="src-id">UID</span>:<span class="src-id">uid1</span><span class="src-sym">@</span><span class="src-id">example</span>.<span class="src-id">com</span></div></li>
<li><div class="src-line"><span class="src-id">ORGANIZER</span>:<span class="src-id">mailto</span>:<span class="src-id">jsmith</span><span class="src-sym">@</span><span class="src-id">example</span>.<span class="src-id">com</span></div></li>
<li><div class="src-line"><span class="src-id">DTSTART</span>:<span class="src-num">19960918</span><span class="src-id">T143000Z</span></div></li>
<li><div class="src-line"><span class="src-id">DTEND</span>:<span class="src-num">19960920</span><span class="src-id">T220000Z</span></div></li>
<li><div class="src-line"><span class="src-id">STATUS</span>:<span class="src-id">CONFIRMED</span></div></li>
<li><div class="src-line"><span class="src-id">CATEGORIES</span>:<span class="src-id">CONFERENCE</span></div></li>
<li><div class="src-line"><span class="src-id">SUMMARY</span>:<span class="src-id">Networld</span>+<span class="src-id">Interop&nbsp;Conference</span></div></li>
<li><div class="src-line"><span class="src-id">DESCRIPTION</span>:<span class="src-id">Networld</span>+<span class="src-id">Interop&nbsp;Conference</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-key">and&nbsp;</span><span class="src-id">ExhibitnAtlanta&nbsp;World&nbsp;Congress&nbsp;Centern</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-id">Atlanta</span><span class="src-sym">,&nbsp;</span><span class="src-id">Georgia</span></div></li>
<li><div class="src-line"><span class="src-id">END</span>:<span class="src-id">VEVENT</span></div></li>
<li><div class="src-line"><span class="src-id">END</span>:<span class="src-id">VCALENDAR</span></div></li>
</ol></div></span>
	<span><a name="output"></a><h2 class="title">Output</h2><p>Typical output can be seen by running the example <a href="http://scripts.carrubbers.org/scripts/php/icallib/examples/create.php">http://scripts.carrubbers.org/scripts/php/icallib/examples/create.php</a></p></span></div>

	<table class="tutorial-nav-box">
	<tr>
		<td style="width: 30%">
							<a href="../PhpiCalLib/tutorial_examples.pkg.html" class="nav-button">Previous</a>
					</td>
		<td style="text-align: center">
							<a href="../PhpiCalLib/tutorial_examples.pkg.html" class="nav-button">Up</a>
					</td>
		<td style="text-align: right; width: 30%">
							<a href="../PhpiCalLib/tutorial_parse.pkg.html" class="nav-button">Next</a>
					</td>
	</tr>
	<tr>
		<td style="width: 30%">
							<span class="detail">Examples</span>
					</td>
		<td style="text-align: center">
							<span class="detail">Examples</span>
					</td>
		<td style="text-align: right; width: 30%">
							<span class="detail">File parsing</span>
					</td>
	</tr>
</table>
	
	<p class="notes" id="credit">
		Documentation generated on Tue, 01 Apr 2008 01:07:03 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.0</a>
	</p>
	</div></body>
</html>
Return current item: PhpiCalLib