You are here

public static function LPStatus::getLatestCertificateTimestamp in Opigno Learning path 3.x

Same name and namespace in other branches
  1. 8 src/Entity/LPStatus.php \Drupal\opigno_learning_path\Entity\LPStatus::getLatestCertificateTimestamp()

Returns training latest certificate timestamp.

Parameters

int $gid: Group ID.

int $uid: User ID.

Return value

int|null Timestamp if found, null otherwise.

1 call to LPStatus::getLatestCertificateTimestamp()
LPStatus::getTrainingStartDate in src/Entity/LPStatus.php
Returns training start date for displaying statistics.

File

src/Entity/LPStatus.php, line 281

Class

LPStatus
Defines the User Learning Path attempt status entity.

Namespace

Drupal\opigno_learning_path\Entity

Code

public static function getLatestCertificateTimestamp($gid, $uid) {
  $db_connection = \Drupal::service('database');
  $result = $db_connection
    ->select('user_lp_status_expire', 'lps')
    ->fields('lps', [
    'latest_cert_date',
  ])
    ->condition('gid', $gid)
    ->condition('uid', $uid)
    ->execute()
    ->fetchField();
  if ($result) {
    return $result;
  }
  return NULL;
}