This shows you the differences between two versions of the page.
|
qcal_component [2010/01/19 14:05] luke created |
qcal_component [2010/01/19 14:12] (current) luke |
||
|---|---|---|---|
| Line 6: | Line 6: | ||
| qCal_Component is an abstract class, so it is not possible to instantiate it directly. You must use one of its descendants such as qCal_Component_Vevent. All of its descendants are instantiated exactly the same, so the following will be true for any of the component classes. | qCal_Component is an abstract class, so it is not possible to instantiate it directly. You must use one of its descendants such as qCal_Component_Vevent. All of its descendants are instantiated exactly the same, so the following will be true for any of the component classes. | ||
| + | |||
| + | iCalendar components are basically just a collection of properties, and occasionally sub-components. So to instantiate a qCal_Component class, you can optionally provide an array of properties and an array of components. You can also instantiate the class with no parameters (and add them later using setters). | ||
| <code php> | <code php> | ||
| Line 48: | Line 50: | ||
| === components === | === components === | ||
| + | |||
| + | This parameter must be an array of keys and values or an array of qCal_Component objects. | ||
| + | |||
| + | == Examples == | ||
| + | |||
| + | **Keys and Values** | ||
| + | |||
| + | <code php> | ||
| + | $event = new qCal_Component_Vevent(array( | ||
| + | 'summary' => "Luke's birthday party", | ||
| + | 'dtstart' => "2009-04-23 20:00:00", | ||
| + | )); | ||
| + | </code> | ||
| + | |||
| + | **List of property objects** | ||
| + | |||
| + | <code php> | ||
| + | $event = new qCal_Component_Vevent(array( | ||
| + | new qCal_Property_Summary("Luke's birthday party"), | ||
| + | new qCal_Property_Dtstart("2009-04-23 20:00:00"), | ||
| + | )); | ||
| + | </code> | ||
| + | |||
| + | **Intermixed** | ||
| + | |||
| + | <code php> | ||
| + | $event = new qCal_Component_Vevent(array( | ||
| + | 'summary' => "Luke's birthday party", | ||
| + | new qCal_Property_Dtstart("2009-04-23 20:00:00") | ||
| + | )); | ||
| + | </code> | ||