public function index(Application $app)
 {
     $usersDao = new Users($app['db']);
     $user = $usersDao->getUser($this->getAuthenticatedUser($app)->getId());
     $datasetsDao = new Dataset($app['db']);
     $app->logger()->debug('Accesing index controller');
     return $app->twig()->render('index/index.twig', array('user' => $user, 'clean_datasets' => $datasetsDao->countCleanByOwner($user['id']), 'pending_datasets' => $datasetsDao->countPendingByOwner($user['id']), 'cleaning_datasets' => $datasetsDao->countCleaningByOwner($user['id']), 'error_datasets' => $datasetsDao->countErrorsByOwner($user['id'])));
 }
 /**
  * Saves the changes of the user profile
  *
  * @param Application $app
  * @return string
  * @throws QsardwException
  * @throws \Exception
  */
 public function saveProfile(Application $app)
 {
     $usersDao = new Users($app['db']);
     $postParams = $app['request']->request->all();
     if (!isset($postParams['password']) || !isset($postParams['confirm_password'])) {
         throw new QsardwException('New password must be provided');
     }
     if ($postParams['password'] !== $postParams['confirm_password']) {
         throw new QsardwException('Passwords do not match');
     }
     $authenticatedUser = $this->getAuthenticatedUser($app);
     $encoder = $app['security.encoder_factory']->getEncoder($authenticatedUser);
     $queryParams = ['id' => $this->getAuthenticatedUser($app)->getId(), 'complete_name' => $postParams['complete_name'], 'password' => $encoder->encodePassword($postParams['password'], $authenticatedUser->getSalt())];
     $usersDao->updateUser($queryParams);
     $templateData = [];
     return $app->twig()->render('user/profile_saved.twig', $templateData);
 }