/**
  * Action to authenticate the google calendar
  *
  * @param string $authCode
  * @param bool $eventsLoaded
  * @param bool $eventsFlushed
  */
 public function authenticateAction($authCode = NULL, $eventsLoaded = FALSE, $eventsFlushed = FALSE)
 {
     if ($authCode) {
         $this->googleService->createCredentials($authCode);
     }
     try {
         $credentials = $this->googleService->getCredentials();
     } catch (\KevinDitscheid\KdCalendar\Exception\NoCredentialsException $ex) {
         $authUrl = $this->googleService->getAuthUrl();
     }
     $this->view->assignMultiple(array('authUrl' => $authUrl, 'credentials' => $credentials));
     if ($this->calendarRepository->calendarsLoaded()) {
         $this->view->assign('calendarsLoaded', TRUE);
         $this->view->assign('calendars', $this->calendarRepository->findAll());
     }
     $this->view->assign('eventsLoaded', $eventsLoaded);
     $this->view->assign('eventsFlushed', $eventsFlushed);
 }
예제 #2
0
 /**
  * action list
  *
  * @return void
  */
 public function listAction()
 {
     $calendars = $this->calendarRepository->findAll();
     $this->view->assign('calendars', $calendars);
 }