Пример #1
0
 protected function beforeLoad(&$response, &$model, &$params)
 {
     if ($model->isPrivate(\GO::user()) && $model->user_id != \GO::user()->id && $model->calendar->user_id != \GO::user()->id) {
         throw new \GO\Base\Exception\AccessDenied();
     }
     if (!empty($params['exception_date'])) {
         //$params['exception_date'] is a unixtimestamp. We should return this event with an empty id and the exception date.
         //this parameter is sent by the view when it wants to edit a single occurence of a repeating event.
         $model = $model->getExceptionEvent($params['exception_date']);
     }
     return parent::beforeLoad($response, $model, $params);
 }