You are here

public static function LPStatus::setUserNotification in Opigno Learning path 8

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

Sets a user notified.

Parameters

int $gid: The training ID.

int $uid: The user ID.

int $value: The user notification value.

1 call to LPStatus::setUserNotification()
opigno_learning_path_cron in ./opigno_learning_path.module
Sends email notifications about training expired certification.

File

src/Entity/LPStatus.php, line 501

Class

LPStatus
Defines the User Learning Path attempt status entity.

Namespace

Drupal\opigno_learning_path\Entity

Code

public static function setUserNotification($gid, $uid, $value) {
  $db_connection = \Drupal::service('database');
  try {
    $db_connection
      ->merge('user_lp_status_expire')
      ->key([
      'gid' => $gid,
      'uid' => $uid,
    ])
      ->fields([
      'notified' => $value,
    ])
      ->execute();
  } catch (\Exception $e) {
    \Drupal::logger('opigno_learning_path')
      ->error($e
      ->getMessage());
    \Drupal::messenger()
      ->addMessage($e
      ->getMessage(), 'error');
  }
}