1. Go to this page and download the library: Download portrino/px_ical library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
portrino / px_ical example snippets
use Portrino\PxICal\Mvc\View\ICalView;
use TYPO3\CMS\Extbase\Mvc\View\JsonView;
class BookingController extends RestController
{
/**
* @var array
*/
protected $viewFormatToObjectNameMap = [
'json' => JsonView::class,
'ical' => ICalView::class
];
/**
* Action Show
*
* @param \Foo\Bar\Domain\Model\Booking $booking
*
* @return void
*/
public function showAction($booking)
{
/**
* $booking should implement the ICalEventInterface
*/
$this->view->assign('booking', $booking);
}
}
...
class Booking extends AbstractEntity implements ICalEventInterface
{
/**
* @return Event
*/
public function __toICalEvent()
{
$event = new Event();
$event
->setUniqueId('foo_bar_' . (string)$this->getUid())
->setDtStart($this->getStart())
->setDtEnd($this->getEnd());
...
return $event;
}
}
use Eluceo\iCal\Component\Event;
/**
* Action Show
*
* @return void
*/
public function showAction()
{
$vEvent = new Event();
$vEvent
->setUniqueId('foo_bar_' . (string)$this->getUid())
->setDtStart($this->getStart())
->setDtEnd($this->getEnd());
...
$this->view->assign('vEvent', $vEvent);
}