View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}
{composition-setup}
{zone-data:component-name}
Zend_Ical
{zone-data}

{zone-data:proposer-list}
* [Ben Scholzen|mailto:mail@dasprids.de]
* [~alexander]
** (Zend-liaison)
{zone-data}

{zone-data:revision}
1.1 - 22 September 2007: Initial proposal
1.2 - 03 March 2008: Proposal rewrite
1.3 - 19 May 2008: Proposal update
{zone-data}

{zone-data:overview}
Zend_Ical is a component to manage events, alarms and todos in calendar objects.
{zone-data}

{zone-data:references}
* [iCal Wikipedia Entry|http://en.wikipedia.org/wiki/ICalendar]
* [LALR parser Wikipedia Entry|http://en.wikipedia.org/wiki/LALR_parser]
* [RFC 2445|http://tools.ietf.org/html/rfc2445]
{zone-data}

{zone-data:requirements}
* This component *will* handle ICS files from different data sources (Filesystem, FTP and HTTP (webDAV required for writing)).
* This component *will* support the entire ICS 2.0 specification
* This component *will* be able to create/write new ICS data
* This component *will* allow searching and iteration through calendar data
* This component *must* validate any input before writing them to the source
{zone-data}

{zone-data:dependencies}
* Zend_Exception
* Zend_Date
* Zend_Uri
{zone-data}

{zone-data:operation}
Zend_Ical will take an URI (String or Zend_Uri) as argument for the constructor method. Zend_Ical will then parse the ICS file through a LALR parsing mode. All time values within the ICS data will be converted to the local time zone.

After the parsing you can call different methods to gather data from the calendar or add additional data to it. You can also iterate through the calendar object to get all data available.

At the time of writing, Zend_Ical will only support the iCalender 2.0 format.
{zone-data}

{zone-data:milestones}
* Milestone 1: [done] Proposal finished
* Milestone 2: [done] Development of prototype started and checked into http://zend.svn.dasprids.de/
* Milestone 3: Proposal approved
* Milestone 4: Working prototype checked into the incubator.
* Milestone 5: Unit tests exist, work, and are checked into SVN.
* Milestone 6: Documentation exists.
{zone-data}

{zone-data:class-list}
* Zend_Ical
* Zend_Ical_Exception
* Zend_Ical_Parser
* Zend_Ical_Source_Exception
* Zend_Ical_Source_Abstract
* Zend_Ical_Source_Filesystem
* Zend_Ical_Source_Ftp
* Zend_Ical_Source_Http
{zone-data}

{zone-data:use-cases}
||UC-01||

h4. Open a ICS calendar file
{code}
$calendar = new Zend_Ical('http://user:password@www.zend.com/mycalendar.ics');
{code}

||UC-02||

h4. Fetching specific events
{code}
$calendar->getEvents('Feb 31, 2007');
{code}

||UC-03||

h2. Iterating through all events

{code}
foreach ($calendar->events as $event) {
// Do something
}
{code}
{zone-data}

{zone-data:skeletons}
{deck:id=Class Skeletons}
{card:label=Zend_Ical}
{code}
class Zend_Ical
{
/**
* The source object to get and put data.
*
* @var Zend_Ical_Source_Interface
*/
protected $_source;

/**
* Contains all data from the source
*
* @var array
*/
protected $_data;

/**
* Zend_Ical provides a simple interface for working with ICS files.
*
* Zend_Ical follows the specification of the RFC 2445:
* http://tools.ietf.org/html/rfc445
*
* @param string $soruceUri
* @throws Zend_Ical_Exception
*/
public function __construct($sourceUri)
{
}

/**
* Import data from the source
*/
protected function _importData()
{
}
}
{code}
{card}
{card:label=Zend_Ical_Parser}
{code}
class Zend_Ical_Parser
{
/**
* Raw ICS data
*
* @var string
*/
protected $_rawData;

/**
* Length of the raw data
*
* @var integer
*/
protected $_rawDataLength;

/**
* Current position of the parser
*
* @var integer
*/
protected $_currentPos = 0;

/**
* List of valid node names
*
* @var array
*/
protected $_validNodeNames = array('DAYLIGHT', 'STANDARD', 'VALARM',
'VCALENDAR', 'VEVENT', 'VFREEBUSY',
'VJOURNAL', 'VTIMEZONE', 'VTODO');

/**
* Takes the raw data and makes some comaptibility magic on it
*
* @param string $rawData The raw (partial) ICS data
* @param boolean $cleanData Wether to clean the data or not; this should
* only be done once on the entire data
*/
public function __construct($rawData, $cleanData = true)
{
}

/**
* Parse the given data and return an array with all nodes and properties
* of this node.
*
* @return array
*/
public function parse()
{
}

/**
* Parse a node until it's end. If $nodeName is null, the document will be
* parsed until it's end.
*
* @param string $currentNodeName Name of the node which this run is parsing
* @throws Zend_Ical_Exception When there is a lonely \r
* @throws Zend_Ical_Exception When there is an unknown node
* @throws Zend_Ical_Exception When an unexpected END: occurs
* @return array
*/
protected function _parseNode($currentNodeName = null)
{
}
}
{code}
{card}
{card:label=Zend_Ical_Source_Abstract}
{code}
abstract class Zend_Ical_Source_Abstract
{
/**
* URI of the source
*
* @var string
*/
protected $_uri;


/**
* Set the URI of the source
*/
public function __construct($uri)
{
$this->_uri = $uri;
}

/**
* Get raw data from the source
*
* @throws Zend_Ical_Source_Exception
* @return string
*/
abstract public function getRawData();

/**
* Put raw data into the source
*
* @param string $data
* @throws Zend_Ical_Source_Exception
*/
abstract public function putRawData($data);
}
{code}
{card}
{card:label=Zend_Ical_Source_Filesystem}
{code}
class Zend_Ical_Source_Filesystem extends Zend_Ical_Source_Abstract
{
/**
* Defined by Zend_Ical_Source_Abstract
*
* @throws Zend_Ical_Source_Exception
* @return string
*/
public function getRawData()
{
}

/**
* Defined by Zend_Ical_Source_Abstract
*
* @param string $data
* @throws Zend_Ical_Source_Exception
*/
public function putRawData($data)
{
}
}
{code}
{card}
{card:label=Zend_Ical_Source_Ftp}
{code}
class Zend_Ical_Source_Ftp extends Zend_Ical_Source_Abstract
{
/**
* Defined by Zend_Ical_Source_Abstract
*
* @throws Zend_Ical_Source_Exception
* @return string
* @todo Needs implemenation
*/
public function getRawData()
{
}

/**
* Defined by Zend_Ical_Source_Abstract
*
* @param string $data
* @throws Zend_Ical_Source_Exception
* @todo Needs implemenation
*/
public function putRawData($data)
{
}
}
{code}
{card}
{card:label=Zend_Ical_Source_Http}
{code}
class Zend_Ical_Source_Http extends Zend_Ical_Source_Abstract
{
/**
* Defined by Zend_Ical_Source_Abstract
*
* @throws Zend_Ical_Source_Exception
* @return string
* @todo Needs implemenation
*/
public function getRawData()
{
}

/**
* Defined by Zend_Ical_Source_Abstract
*
* @param string $data
* @throws Zend_Ical_Source_Exception
* @todo Needs implemenation
*/
public function putRawData($data)
{
}
}
{code}
{card}
{deck}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>