| 1 |
<?php |
| 2 |
/** |
| 3 |
* iCalcreator, the PHP class package managing iCal (rfc2445/rfc5445) calendar information. |
| 4 |
* |
| 5 |
* copyright (c) 2007-2021 Kjell-Inge Gustafsson, kigkonsult, All rights reserved |
| 6 |
* Link https://kigkonsult.se |
| 7 |
* Package iCalcreator |
| 8 |
* Version 2.30 |
| 9 |
* License Subject matter of licence is the software iCalcreator. |
| 10 |
* The above copyright, link, package and version notices, |
| 11 |
* this licence notice and the invariant [rfc5545] PRODID result use |
| 12 |
* as implemented and invoked in iCalcreator shall be included in |
| 13 |
* all copies or substantial portions of the iCalcreator. |
| 14 |
* |
| 15 |
* iCalcreator is free software: you can redistribute it and/or modify |
| 16 |
* it under the terms of the GNU Lesser General Public License as published |
| 17 |
* by the Free Software Foundation, either version 3 of the License, |
| 18 |
* or (at your option) any later version. |
| 19 |
* |
| 20 |
* iCalcreator is distributed in the hope that it will be useful, |
| 21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
* GNU Lesser General Public License for more details. |
| 24 |
* |
| 25 |
* You should have received a copy of the GNU Lesser General Public License |
| 26 |
* along with iCalcreator. If not, see <https://www.gnu.org/licenses/>. |
| 27 |
* |
| 28 |
* This file is a part of iCalcreator. |
| 29 |
*/ |
| 30 |
|
| 31 |
namespace Kigkonsult\Icalcreator; |
| 32 |
|
| 33 |
use Exception; |
| 34 |
|
| 35 |
use function sprintf; |
| 36 |
use function strtoupper; |
| 37 |
|
| 38 |
/** |
| 39 |
* iCalcreator VEVENT component class |
| 40 |
* |
| 41 |
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se> |
| 42 |
* @since 2.29.9 - 2019-08-05 |
| 43 |
*/ |
| 44 |
final class Vevent extends VetComponent |
| 45 |
{ |
| 46 |
use Traits\ATTACHtrait, |
| 47 |
Traits\ATTENDEEtrait, |
| 48 |
Traits\CATEGORIEStrait, |
| 49 |
Traits\CLASStrait, |
| 50 |
Traits\COLORrfc7986trait, |
| 51 |
Traits\COMMENTtrait, |
| 52 |
Traits\CONFERENCErfc7986trait, |
| 53 |
Traits\CONTACTtrait, |
| 54 |
Traits\CREATEDtrait, |
| 55 |
Traits\DESCRIPTIONtrait, |
| 56 |
Traits\DTENDtrait, |
| 57 |
Traits\DTSTARTtrait, |
| 58 |
Traits\DURATIONtrait, |
| 59 |
Traits\EXDATEtrait, |
| 60 |
Traits\EXRULEtrait, |
| 61 |
Traits\GEOtrait, |
| 62 |
Traits\IMAGErfc7986trait, |
| 63 |
Traits\LAST_MODIFIEDtrait, |
| 64 |
Traits\LOCATIONtrait, |
| 65 |
Traits\ORGANIZERtrait, |
| 66 |
Traits\PRIORITYtrait, |
| 67 |
Traits\RDATEtrait, |
| 68 |
Traits\RECURRENCE_IDtrait, |
| 69 |
Traits\RELATED_TOtrait, |
| 70 |
Traits\REQUEST_STATUStrait, |
| 71 |
Traits\RESOURCEStrait, |
| 72 |
Traits\RRULEtrait, |
| 73 |
Traits\SEQUENCEtrait, |
| 74 |
Traits\STATUStrait, |
| 75 |
Traits\SUMMARYtrait, |
| 76 |
Traits\TRANSPtrait, |
| 77 |
Traits\UIDrfc7986trait, |
| 78 |
Traits\URLtrait; |
| 79 |
|
| 80 |
/** |
| 81 |
* @var string |
| 82 |
*/ |
| 83 |
protected static $compSgn = 'e'; |
| 84 |
|
| 85 |
/** |
| 86 |
* Destructor |
| 87 |
* |
| 88 |
* @since 2.29.5 - 2019-06-20 |
| 89 |
*/ |
| 90 |
public function __destruct() |
| 91 |
{ |
| 92 |
if( ! empty( $this->components )) { |
| 93 |
foreach( $this->components as $cix => $component ) { |
| 94 |
$this->components[$cix]->__destruct(); |
| 95 |
} |
| 96 |
} |
| 97 |
unset( |
| 98 |
$this->compType, |
| 99 |
$this->xprop, |
| 100 |
$this->components, |
| 101 |
$this->unparsed, |
| 102 |
$this->config, |
| 103 |
$this->compix, |
| 104 |
$this->propIx, |
| 105 |
$this->propDelIx |
| 106 |
); |
| 107 |
unset( |
| 108 |
$this->cno, |
| 109 |
$this->srtk |
| 110 |
); |
| 111 |
unset( |
| 112 |
$this->attach, |
| 113 |
$this->attendee, |
| 114 |
$this->categories, |
| 115 |
$this->class, |
| 116 |
$this->comment, |
| 117 |
$this->color, |
| 118 |
$this->conference, |
| 119 |
$this->contact, |
| 120 |
$this->created, |
| 121 |
$this->description, |
| 122 |
$this->dtend, |
| 123 |
$this->dtstamp, |
| 124 |
$this->dtstart, |
| 125 |
$this->duration, |
| 126 |
$this->image, |
| 127 |
$this->exdate, |
| 128 |
$this->exrule, |
| 129 |
$this->geo, |
| 130 |
$this->lastmodified, |
| 131 |
$this->location, |
| 132 |
$this->organizer, |
| 133 |
$this->priority, |
| 134 |
$this->rdate, |
| 135 |
$this->recurrenceid, |
| 136 |
$this->relatedto, |
| 137 |
$this->requeststatus, |
| 138 |
$this->resources, |
| 139 |
$this->rrule, |
| 140 |
$this->sequence, |
| 141 |
$this->status, |
| 142 |
$this->summary, |
| 143 |
$this->transp, |
| 144 |
$this->uid, |
| 145 |
$this->url |
| 146 |
); |
| 147 |
} |
| 148 |
|
| 149 |
/** |
| 150 |
* Return formatted output for calendar component VEVENT object instance |
| 151 |
* |
| 152 |
* @return string |
| 153 |
* @throws Exception (on Duration/Rdate err) |
| 154 |
* @since 2.29.9 - 2019-08-05 |
| 155 |
*/ |
| 156 |
public function createComponent() |
| 157 |
{ |
| 158 |
$compType = strtoupper( $this->getCompType()); |
| 159 |
$component = sprintf( self::$FMTBEGIN, $compType ); |
| 160 |
$component .= $this->createUid(); |
| 161 |
$component .= $this->createDtstamp(); |
| 162 |
$component .= $this->createAttach(); |
| 163 |
$component .= $this->createAttendee(); |
| 164 |
$component .= $this->createCategories(); |
| 165 |
$component .= $this->createClass(); |
| 166 |
$component .= $this->createColor(); |
| 167 |
$component .= $this->createComment(); |
| 168 |
$component .= $this->createConference(); |
| 169 |
$component .= $this->createContact(); |
| 170 |
$component .= $this->createCreated(); |
| 171 |
$component .= $this->createDescription(); |
| 172 |
$component .= $this->createDtstart(); |
| 173 |
$component .= $this->createDtend(); |
| 174 |
$component .= $this->createDuration(); |
| 175 |
$component .= $this->createExdate(); |
| 176 |
$component .= $this->createExrule(); |
| 177 |
$component .= $this->createImage(); |
| 178 |
$component .= $this->createGeo(); |
| 179 |
$component .= $this->createLastmodified(); |
| 180 |
$component .= $this->createLocation(); |
| 181 |
$component .= $this->createOrganizer(); |
| 182 |
$component .= $this->createPriority(); |
| 183 |
$component .= $this->createRdate(); |
| 184 |
$component .= $this->createRrule(); |
| 185 |
$component .= $this->createRelatedto(); |
| 186 |
$component .= $this->createRequeststatus(); |
| 187 |
$component .= $this->createRecurrenceid(); |
| 188 |
$component .= $this->createResources(); |
| 189 |
$component .= $this->createSequence(); |
| 190 |
$component .= $this->createStatus(); |
| 191 |
$component .= $this->createSummary(); |
| 192 |
$component .= $this->createTransp(); |
| 193 |
$component .= $this->createUrl(); |
| 194 |
$component .= $this->createXprop(); |
| 195 |
$component .= $this->createSubComponent(); |
| 196 |
return $component . sprintf( self::$FMTEND, $compType ); |
| 197 |
} |
| 198 |
} |
| 199 |
|