<?php
namespace Modules\RemoteData\Calendar; class Controller extends \App\Mvc\ControllerAbstract { protected function initialize() { parent::initialize(); $this->actionsCfg['snooze'] = ['authType' => 'easy', 'checkSection' => false,]; $this->actionsCfg['dismiss'] = ['authType' => 'easy', 'checkSection' => false,]; $this->actionsCfg['dismissMultiple'] = ['authType' => 'easy', 'checkSection' => false,]; } protected function actionSnooze($R) { $model = new Model(); \DB::startTransaction(); $newAlertDateTime = \Engine\DateTime::create()->modify("+{$R['duration']}minutes"); $model->snoozeEvent($R['eventId'], $newAlertDateTime); \DB::commitTransaction(); $response = new \stdClass(); $response->success = true; return new \Engine\Mvc\Response\Json($response); } protected function actionDismiss($R) { $model = new Model(); \DB::startTransaction(); $model->dismissEvent($R['eventId']); \DB::commitTransaction(); $response = new \stdClass(); $response->success = true; return new \Engine\Mvc\Response\Json($response); } protected function actionDismissMultiple($R) { $model = new Model(); \DB::startTransaction(); $events = []; if ($R['events']) { sort($R['events']); foreach($R['events'] as $eventId) { $model->dismissEvent($eventId); $events[] = $eventId; } } \DB::commitTransaction(); $response = new \stdClass(); $response->success = true; $response->events = $events; return new \Engine\Mvc\Response\Json($response); } } 