예제 #1
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  * @UseSession
  */
 public function getReminderEvents()
 {
     $EvSource = $this->params('EvSource');
     $ALARMDATA = new Alarm();
     $resultRefresh = '';
     if (isset($EvSource) && $EvSource !== '') {
         $ALARMDATA->setEventSources($EvSource);
         $resultRefresh = $ALARMDATA->checkAutoRefresh();
         if ($resultRefresh === false) {
             $resultRefresh = 'onlyTimeLine';
         }
     } else {
         $resultRefresh = 'onlyTimeLine';
     }
     $result = '';
     if (\OCP\User::isLoggedIn()) {
         $ALARMDATA->checkAlarm();
         $result = $ALARMDATA->getAlarms();
     }
     if (count($result) > 0 || $resultRefresh !== '') {
         $params = ['data' => $result, 'refresh' => $resultRefresh];
         $response = new JSONResponse();
         $response->setData($params);
         return $response;
     }
 }