| 1 |
<?php |
| 2 |
/*********************************************************************************/ |
| 3 |
/** |
| 4 |
* |
| 5 |
* iCalcreator, a PHP rfc2445/rfc5545 solution. |
| 6 |
* |
| 7 |
* @copyright Copyright (c) 2007-2015 Kjell-Inge Gustafsson, kigkonsult, All rights reserved |
| 8 |
* @link http://kigkonsult.se/iCalcreator/index.php |
| 9 |
* @license http://kigkonsult.se/downloads/dl.php?f=LGPL |
| 10 |
* @package iCalcreator |
| 11 |
* @version 2.22 |
| 12 |
*/ |
| 13 |
/** |
| 14 |
* This library is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU Lesser General Public |
| 16 |
* License as published by the Free Software Foundation; either |
| 17 |
* version 2.1 of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This library is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 |
* Lesser General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU Lesser General Public |
| 25 |
* License along with this library; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 27 |
*/ |
| 28 |
/*********************************************************************************/ |
| 29 |
/** |
| 30 |
* class for calendar component VALARM |
| 31 |
* |
| 32 |
* @author Kjell-Inge Gustafsson, kigkonsult <[email protected]> |
| 33 |
* @since 2.5.1 - 2008-10-12 |
| 34 |
*/ |
| 35 |
class valarm extends calendarComponent { |
| 36 |
/** |
| 37 |
* @var array $action component property value |
| 38 |
* @var array $attach component property value |
| 39 |
* @var array $attendee component property value |
| 40 |
* @var array $description component property value |
| 41 |
* @var array $duration component property value |
| 42 |
* @var array $repeat component property value |
| 43 |
* @var array $summary component property value |
| 44 |
* @var array $trigger component property value |
| 45 |
* @access protected |
| 46 |
*/ |
| 47 |
protected $action; |
| 48 |
protected $attach; |
| 49 |
protected $attendee; |
| 50 |
protected $description; |
| 51 |
protected $duration; |
| 52 |
protected $repeat; |
| 53 |
protected $summary; |
| 54 |
protected $trigger; |
| 55 |
/** |
| 56 |
* constructor for calendar component VALARM object |
| 57 |
* |
| 58 |
* @author Kjell-Inge Gustafsson, kigkonsult <[email protected]> |
| 59 |
* @since 2.8.2 - 2011-05-01 |
| 60 |
* @param array $config |
| 61 |
* @uses valarm::calendarComponent() |
| 62 |
* @uses valarm::$action |
| 63 |
* @uses valarm::$attach |
| 64 |
* @uses valarm::$attendee |
| 65 |
* @uses valarm::$description |
| 66 |
* @uses valarm::$duration |
| 67 |
* @uses valarm::$repeat |
| 68 |
* @uses valarm::$summary |
| 69 |
* @uses valarm::$trigger |
| 70 |
* @uses valarm::$xprop |
| 71 |
* @uses calendarComponent::setConfig() |
| 72 |
*/ |
| 73 |
function __construct( $config = array()) { |
| 74 |
parent::__construct(); |
| 75 |
$this->action = ''; |
| 76 |
$this->attach = ''; |
| 77 |
$this->attendee = ''; |
| 78 |
$this->description = ''; |
| 79 |
$this->duration = ''; |
| 80 |
$this->repeat = ''; |
| 81 |
$this->summary = ''; |
| 82 |
$this->trigger = ''; |
| 83 |
$this->xprop = ''; |
| 84 |
if( defined( 'ICAL_LANG' ) && !isset( $config['language'] )) |
| 85 |
$config['language'] = ICAL_LANG; |
| 86 |
if( !isset( $config['allowEmpty'] )) $config['allowEmpty'] = TRUE; |
| 87 |
if( !isset( $config['nl'] )) $config['nl'] = "\r\n"; |
| 88 |
if( !isset( $config['format'] )) $config['format'] = 'iCal'; |
| 89 |
if( !isset( $config['delimiter'] )) $config['delimiter'] = DIRECTORY_SEPARATOR; |
| 90 |
$this->setConfig( $config ); |
| 91 |
} |
| 92 |
/** |
| 93 |
* create formatted output for calendar component VALARM object instance |
| 94 |
* |
| 95 |
* @author Kjell-Inge Gustafsson, kigkonsult <[email protected]> |
| 96 |
* @since 2.5.1 - 2008-10-22 |
| 97 |
* @param array $xcaldecl |
| 98 |
* @uses calendarComponent::_createFormat() |
| 99 |
* @uses calendarComponent::$componentStart1 |
| 100 |
* @uses calendarComponent::$componentStart2 |
| 101 |
* @uses calendarComponent::$nl |
| 102 |
* @uses calendarComponent::createAction() |
| 103 |
* @uses calendarComponent::createAttach() |
| 104 |
* @uses calendarComponent::createAttendee() |
| 105 |
* @uses calendarComponent::createDescription() |
| 106 |
* @uses calendarComponent::createDuration() |
| 107 |
* @uses calendarComponent::createRepeat() |
| 108 |
* @uses calendarComponent::createSummary() |
| 109 |
* @uses calendarComponent::createTrigger() |
| 110 |
* @uses calendarComponent::createXprop() |
| 111 |
* @uses calendarComponent::$componentEnd1 |
| 112 |
* @uses calendarComponent::$componentEnd2 |
| 113 |
* @uses calendarComponent::$xcaldecl |
| 114 |
* @return string |
| 115 |
*/ |
| 116 |
function createComponent( & $xcaldecl ) { |
| 117 |
$objectname = $this->_createFormat(); |
| 118 |
$component = $this->componentStart1.$objectname.$this->componentStart2.$this->nl; |
| 119 |
$component .= $this->createAction(); |
| 120 |
$component .= $this->createAttach(); |
| 121 |
$component .= $this->createAttendee(); |
| 122 |
$component .= $this->createDescription(); |
| 123 |
$component .= $this->createDuration(); |
| 124 |
$component .= $this->createRepeat(); |
| 125 |
$component .= $this->createSummary(); |
| 126 |
$component .= $this->createTrigger(); |
| 127 |
$component .= $this->createXprop(); |
| 128 |
$component .= $this->componentEnd1.$objectname.$this->componentEnd2; |
| 129 |
if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) { |
| 130 |
foreach( $this->xcaldecl as $localxcaldecl ) |
| 131 |
$xcaldecl[] = $localxcaldecl; |
| 132 |
} |
| 133 |
return $component; |
| 134 |
} |
| 135 |
} |
| 136 |
|