| 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 VTIMEZONE |
| 31 |
* |
| 32 |
* @author Kjell-Inge Gustafsson, kigkonsult <[email protected]> |
| 33 |
* @since 2.5.1 - 2008-10-12 |
| 34 |
*/ |
| 35 |
class vtimezone extends calendarComponent { |
| 36 |
/** @var array $timezonetype component property value */ |
| 37 |
public $timezonetype; |
| 38 |
/** |
| 39 |
* @var array $comment component property value |
| 40 |
* @var array $dtstart component property value |
| 41 |
* @var array $lastmodified component property value |
| 42 |
* @var array $rdate component property value |
| 43 |
* @var array $rrule component property value |
| 44 |
* @var array $tzid component property value |
| 45 |
* @var array $tzname component property value |
| 46 |
* @var array $tzoffsetfrom component property value |
| 47 |
* @var array $tzoffsetto component property value |
| 48 |
* @var array $tzurl component property value |
| 49 |
* @access protected |
| 50 |
*/ |
| 51 |
protected $comment; |
| 52 |
protected $dtstart; |
| 53 |
protected $lastmodified; |
| 54 |
protected $rdate; |
| 55 |
protected $rrule; |
| 56 |
protected $tzid; |
| 57 |
protected $tzname; |
| 58 |
protected $tzoffsetfrom; |
| 59 |
protected $tzoffsetto; |
| 60 |
protected $tzurl; |
| 61 |
/** |
| 62 |
* constructor for calendar component VTIMEZONE object |
| 63 |
* |
| 64 |
* @author Kjell-Inge Gustafsson, kigkonsult <[email protected]> |
| 65 |
* @since 2.8.2 - 2011-05-01 |
| 66 |
* @param mixed $timezonetype default FALSE ( STANDARD / DAYLIGHT ) |
| 67 |
* @param array $config |
| 68 |
* @uses vtimezone::$timezonetype |
| 69 |
* @uses vtimezone::calendarComponent() |
| 70 |
* @uses vtimezone::$comment |
| 71 |
* @uses vtimezone::$dtstart |
| 72 |
* @uses vtimezone::$lastmodified |
| 73 |
* @uses vtimezone::$rdate |
| 74 |
* @uses vtimezone::$rrule |
| 75 |
* @uses vtimezone::$tzid |
| 76 |
* @uses vtimezone::$tzname |
| 77 |
* @uses vtimezone::$tzoffsetfrom |
| 78 |
* @uses vtimezone::$tzoffsetto |
| 79 |
* @uses vtimezone::$tzurl |
| 80 |
* @uses vtimezone::$xprop |
| 81 |
* @uses vtimezone::$components |
| 82 |
* @uses calendarComponent::setConfig() |
| 83 |
*/ |
| 84 |
function __construct( $timezonetype=FALSE, $config = array()) { |
| 85 |
if( is_array( $timezonetype )) { |
| 86 |
$config = $timezonetype; |
| 87 |
$timezonetype = FALSE; |
| 88 |
} |
| 89 |
if( !$timezonetype ) |
| 90 |
$this->timezonetype = 'VTIMEZONE'; |
| 91 |
else |
| 92 |
$this->timezonetype = strtoupper( $timezonetype ); |
| 93 |
parent::__construct(); |
| 94 |
$this->comment = ''; |
| 95 |
$this->dtstart = ''; |
| 96 |
$this->lastmodified = ''; |
| 97 |
$this->rdate = ''; |
| 98 |
$this->rrule = ''; |
| 99 |
$this->tzid = ''; |
| 100 |
$this->tzname = ''; |
| 101 |
$this->tzoffsetfrom = ''; |
| 102 |
$this->tzoffsetto = ''; |
| 103 |
$this->tzurl = ''; |
| 104 |
$this->xprop = ''; |
| 105 |
$this->components = array(); |
| 106 |
if( defined( 'ICAL_LANG' ) && !isset( $config['language'] )) |
| 107 |
$config['language'] = ICAL_LANG; |
| 108 |
if( !isset( $config['allowEmpty'] )) $config['allowEmpty'] = TRUE; |
| 109 |
if( !isset( $config['nl'] )) $config['nl'] = "\r\n"; |
| 110 |
if( !isset( $config['format'] )) $config['format'] = 'iCal'; |
| 111 |
if( !isset( $config['delimiter'] )) $config['delimiter'] = DIRECTORY_SEPARATOR; |
| 112 |
$this->setConfig( $config ); |
| 113 |
} |
| 114 |
/** |
| 115 |
* create formatted output for calendar component VTIMEZONE object instance |
| 116 |
* |
| 117 |
* @author Kjell-Inge Gustafsson, kigkonsult <[email protected]> |
| 118 |
* @since 2.5.1 - 2008-10-25 |
| 119 |
* @param array $xcaldecl |
| 120 |
* @uses calendarComponent::_createFormat() |
| 121 |
* @uses calendarComponent::$componentStart1 |
| 122 |
* @uses calendarComponent::$componentStart2 |
| 123 |
* @uses calendarComponent::$nl |
| 124 |
* @uses calendarComponent::createTzid() |
| 125 |
* @uses calendarComponent::createLastModified() |
| 126 |
* @uses calendarComponent::createTzurl() |
| 127 |
* @uses calendarComponent::createDtstart() |
| 128 |
* @uses calendarComponent::createTzoffsetfrom() |
| 129 |
* @uses calendarComponent::createTzoffsetto() |
| 130 |
* @uses calendarComponent::createComment() |
| 131 |
* @uses calendarComponent::createRdate() |
| 132 |
* @uses calendarComponent::createRrule() |
| 133 |
* @uses calendarComponent::createTzname() |
| 134 |
* @uses calendarComponent::createXprop() |
| 135 |
* @uses calendarComponent::createSubComponent() |
| 136 |
* @uses calendarComponent::createXprop() |
| 137 |
* @uses calendarComponent::$componentEnd1 |
| 138 |
* @uses calendarComponent::$componentEnd2 |
| 139 |
* @uses calendarComponent::$xcaldecl |
| 140 |
* @return string |
| 141 |
*/ |
| 142 |
function createComponent( &$xcaldecl ) { |
| 143 |
$objectname = $this->_createFormat(); |
| 144 |
$component = $this->componentStart1.$objectname.$this->componentStart2.$this->nl; |
| 145 |
$component .= $this->createTzid(); |
| 146 |
$component .= $this->createLastModified(); |
| 147 |
$component .= $this->createTzurl(); |
| 148 |
$component .= $this->createDtstart(); |
| 149 |
$component .= $this->createTzoffsetfrom(); |
| 150 |
$component .= $this->createTzoffsetto(); |
| 151 |
$component .= $this->createComment(); |
| 152 |
$component .= $this->createRdate(); |
| 153 |
$component .= $this->createRrule(); |
| 154 |
$component .= $this->createTzname(); |
| 155 |
$component .= $this->createXprop(); |
| 156 |
$component .= $this->createSubComponent(); |
| 157 |
$component .= $this->componentEnd1.$objectname.$this->componentEnd2; |
| 158 |
if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) { |
| 159 |
foreach( $this->xcaldecl as $localxcaldecl ) |
| 160 |
$xcaldecl[] = $localxcaldecl; |
| 161 |
} |
| 162 |
return $component; |
| 163 |
} |
| 164 |
} |
| 165 |
|