public function addEvent()
 {
     try {
         $data = $this->getJsonRequest();
         if (!$data) {
             return $this->serverError();
         }
         $event = $this->event_manager->addEvent($data);
         return $event->ID;
     } catch (NotFoundEntityException $ex1) {
         SS_Log::log($ex1, SS_Log::WARN);
         return $this->notFound($ex1->getMessage());
     } catch (EntityValidationException $ex2) {
         SS_Log::log($ex2, SS_Log::WARN);
         return $this->validationError($ex2->getMessages());
     } catch (Exception $ex) {
         SS_Log::log($ex, SS_Log::ERR);
         return $this->serverError();
     }
 }
 public function __construct()
 {
     $this->directory = realpath(Yii::app()->basePath . DIRECTORY_SEPARATOR . Yii::getPathOfAlias($this->path));
     EventManager::addEvent('onBeforeConstruct', array($this, 'beforeConstruct'));
 }