modules/API/handlers/CalDAV.php
<?php
/**
* Api CalDAV Handler Class.
*
* @package Handler
*
* @copyright YetiForce S.A.
* @license YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
* @author Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
*/
class API_CalDAV_Handler
{
/**
* EntityAfterSave handler function.
*
* @param App\EventHandler $eventHandler
*/
public function entityAfterSave(App\EventHandler $eventHandler)
{
$recordModel = $eventHandler->getRecordModel();
if (!$recordModel->isNew()) {
$this->entityChangeState($eventHandler);
}
}
/**
* EntityAfterDelete handler function.
*
* @param \App\EventHandler $eventHandler
*/
public function entityAfterDelete(App\EventHandler $eventHandler)
{
\App\Integrations\Dav\Calendar::deleteByCrmId($eventHandler->getRecordModel()->getId());
}
/**
* EntityChangeState handler function.
*
* @param \App\EventHandler $eventHandler
*/
public function entityChangeState(App\EventHandler $eventHandler)
{
\App\Db::getInstance()->createCommand()
->update('vtiger_activity', ['dav_status' => 1], ['activityid' => $eventHandler->getRecordModel()->getId()])
->execute();
}
}