/**
  * @param MvcEvent $e
  * @return void
  */
 public function onDispatch(MvcEvent $e)
 {
     parent::onDispatch($e);
     $userStorage = new UserStorage($this->serviceLocator->get('ADB'));
     $userStorage->userLoggedIn();
     $loggedIn = SessionStorage::getValue('user-logged-in');
     $this->layout()->setVariable('loggedIn', $loggedIn);
     if ($loggedIn) {
         $this->layout()->setVariable('userData', $userStorage->fetchCurrentUser());
     } else {
         $this->layout()->setVariable('userData', ['username' => 'not logged in']);
     }
     $configStorage = new ConfigStorage($this->serviceLocator->get('ADB'));
     $this->layout()->setVariable('configuration', $configStorage->getConfiguration(1));
 }
 /**
  * @return \Zend\Http\Response
  */
 public function logoutUserAction()
 {
     $storage = new UserStorage($this->serviceLocator->get('ADB'));
     $storage->logout();
     return $this->redirect()->toRoute('display-index');
 }
 public function dashboardAction()
 {
     $this->_setLocation();
     $userStorage = new UserStorage($this->serviceLocator->get('adb'));
     return array('allUsers' => $userStorage->fetchAllUsers(), 'location' => self::LOCATION_ADMIN_DASHBOARD);
 }