You are here

public function AutologoutManager::getRemainingTime in Automated Logout 8

Get the time remaining before logout.

Return value

int Number of seconds remaining.

Overrides AutologoutManagerInterface::getRemainingTime

1 call to AutologoutManager::getRemainingTime()
AutologoutManager::createTimer in src/AutologoutManager.php
Get the timer HTML markup.

File

src/AutologoutManager.php, line 247

Class

AutologoutManager
Defines an AutologoutManager service.

Namespace

Drupal\autologout

Code

public function getRemainingTime() {
  if ($this->configFactory
    ->get('logout_regardless_of_activity')) {
    $time_passed = $this->time
      ->getRequestTime() - $_COOKIE['Drupal_visitor_autologout_login'];
  }
  else {
    $time_passed = isset($_SESSION['autologout_last']) ? $this->time
      ->getRequestTime() - $_SESSION['autologout_last'] : 0;
  }
  $timeout = $this
    ->getUserTimeout();
  return $timeout - $time_passed;
}