"IngenieriaLaSalle", Vcalendar::LANGUAGE=> "es", ]; // create a new Vcalendar instance $calendar = Vcalendar::factory( $config ) // required of some calendar software ->setMethod( Vcalendar::PUBLISH ) ->setXprop( Vcalendar::X_WR_CALNAME, "Calendar Sample" ) ->setXprop( Vcalendar::X_WR_CALDESC, "Calendar Description" ) ->setXprop( Vcalendar::X_WR_RELCALID,"3E26604A-50F4-4449-8B3E-E4F4932D05B5" ) ->setXprop( Vcalendar::X_WR_TIMEZONE, $tz ); $calendar->VtimezonePopulate( $tz ); //Evento único con horario $calendar->newVevent() // set event start ->setDtstart( new DateTime( '2021-05-01 09:00:00', new DateTimezone( $tz ))) // set event end ->setDtend( new DateTime( '2021-05-01 10:30:00', new DateTimezone( $tz ))) // describe the event ->setSummary( 'Fiesta' ) ->setDescription( 'Fiesta por el día del trabajo' ) ->setComment( 'It\'s going to be fun..' ); //Evento único todo el día $calendar->newVevent() // set event start ->setDtstart('2021-05-05', [ Vcalendar::VALUE => Vcalendar::DATE ]) // set event end ->setDtend( '20210506', [ Vcalendar::VALUE => Vcalendar::DATE ]) // describe the event ->setSummary( 'Festivo por batalla de Puebla' ) ->setDescription( 'Feriado' ); // create a new event $event1 = $calendar->newVevent() ->setTransp( Vcalendar::OPAQUE ) ->setClass( Vcalendar::P_BLIC ) ->setSequence( 1 ) // describe the event ->setSummary( 'Exámenes finales' ) ->setDescription( 'Agenda for the the meeting...' ) ->setComment( 'It\'s going to be fun..' ) // set the time ->setDtstart( new DateTime( '20210524T090000', new DateTimezone( $tz ) ) ) ->setDtend( new DateTime( '20210524T100000', new DateTimezone( $tz ) ) ) // with recurrence rule ->setRrule( [ Vcalendar::FREQ => Vcalendar::DAILY, //Vcalendar::COUNT => 5, Vcalendar::UNTIL => new DateTime( "20210531" ),//no incluyente ] ) // and set another on a specific date /*->setRdate( [ new DateTime( '20210609T090000', new DateTimezone( $tz ) ), new DateTime( '20210609T110000', new DateTimezone( $tz ) ), ], [ Vcalendar::VALUE => Vcalendar::PERIOD ] )*/ // and revoke a recurrence date ->setExdate( new DateTime( '2021-05-26 09:00:00', new DateTimezone( $tz ) ) ); // add alarm for the event /*$alarm = $event1->newValarm() ->setAction( Vcalendar::DISPLAY ) // copy description from event ->setDescription( $event1->getDescription()) // fire off the alarm one day before ->setTrigger( '-P1D' );*/ // alter day and time for one event in recurrence set $event2 = $calendar->newVevent() ->setTransp( Vcalendar::OPAQUE ) ->setClass( Vcalendar::P_BLIC ) // reference to event in recurrence set ->setUid( $event1->getUid()) ->setSequence( 2 ) // pointer to event in the recurrence set ->setRecurrenceid( '20210528T090000 '.$tz ) ->setSummary( $event1->getSummary() ) // reason text ->setDescription( 'Altered day and time for event 2021-05-28' ) ->setComment( 'Now we are working hard for two hours' ) // the altered day and time with duration ->setDtstart( new DateTime( '20210528T100000', new DateTimezone( $tz ) ) ) ->setDtend( new DateTime( '20210528T120000', new DateTimezone( $tz ) ) ); //->setDuration( 'PT2H' ); // add alarm (copy from event1) /*->setComponent( $event1->getComponent( Vcalendar::VALARM ) );*/ // create a new event $event3 = $calendar->newVevent() ->setTransp( Vcalendar::OPAQUE ) ->setClass( Vcalendar::P_BLIC ) ->setSequence( 1 ) // describe the event ->setSummary( 'Semana de bienestar' ) ->setDescription( 'Agenda for the the meeting...' ) ->setComment( 'It\'s going to be fun..' ) // set the time ->setDtstart('20210502', [ Vcalendar::VALUE => Vcalendar::DATE ]) ->setDtend('20210503', [ Vcalendar::VALUE => Vcalendar::DATE ]) // with recurrence rule ->setRrule( [ Vcalendar::FREQ => Vcalendar::DAILY, //Vcalendar::COUNT => 5, Vcalendar::UNTIL => new DateTime( "20210508" ),//no incluyente ] ) // and revoke a recurrence date ->setExdate('20210504', [ Vcalendar::VALUE => Vcalendar::DATE ]); // Download as file $calendar->returnCalendar("calendarioIng.ics"); /* // JSON $xmlstr = Kigkonsult\Icalcreator\Util\IcalXMLFactory::iCal2XML( $calendar ); $json = json_encode( simplexml_load_string( $xmlstr )); echo $json;*/ /* $events_arr = $calendar->selectComponents( 2021, 01, 1, 2021, 12, 30, Vcalendar::VEVENT ); foreach( $events_arr as $year => $year_arr ) { foreach( $year_arr as $month => $month_arr ) { foreach( $month_arr as $day => $day_arr ) { foreach( $day_arr as $event ) { $currddate = $event->getDtstart(); print_r($event); //echo date("Y-m-d h:i", $currddate->getTimestamp()); echo "
"; } } } }*/ ?>