ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateMigrationValidator Class Reference
+ Collaboration diagram for ilCertificateMigrationValidator:

Public Member Functions

 __construct (\ilSetting $certificateSettings)
 
 isMigrationAvailable (\ilObjUser $user, \ilCertificateMigration $migrationHelper)
 

Protected Member Functions

 areCertificatesGloballyEnabled ()
 
 isMigrationFinishedForUser (\ilObjUser $user)
 
 isUserCreatedAfterFeatureIntroduction (\ilObjUser $user)
 

Private Attributes

 $certificateSettings
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateMigrationValidator::__construct ( \ilSetting  $certificateSettings)
Parameters
\ilSetting$certificateSettings

Definition at line 15 of file class.ilCertificateMigrationValidator.php.

References $certificateSettings.

16  {
17  $this->certificateSettings = $certificateSettings;
18  }

Member Function Documentation

◆ areCertificatesGloballyEnabled()

ilCertificateMigrationValidator::areCertificatesGloballyEnabled ( )
protected
Returns
bool

Definition at line 47 of file class.ilCertificateMigrationValidator.php.

Referenced by isMigrationAvailable().

47  : bool
48  {
49  $certificatesGloballyEnabled = (bool) $this->certificateSettings->get('active', false);
50 
51  return $certificatesGloballyEnabled;
52  }
+ Here is the caller graph for this function:

◆ isMigrationAvailable()

ilCertificateMigrationValidator::isMigrationAvailable ( \ilObjUser  $user,
\ilCertificateMigration  $migrationHelper 
)
Parameters
\ilObjUser$user
\ilCertificateMigration$migrationHelper
Returns
bool

Definition at line 25 of file class.ilCertificateMigrationValidator.php.

References areCertificatesGloballyEnabled(), isMigrationFinishedForUser(), ilCertificateMigration\isTaskFinished(), ilCertificateMigration\isTaskRunning(), and isUserCreatedAfterFeatureIntroduction().

25  : bool
26  {
27  if (!$this->areCertificatesGloballyEnabled()) {
28  return false;
29  }
30 
31  if ($this->isMigrationFinishedForUser($user)) {
32  return false;
33  }
34 
35  if ($migrationHelper->isTaskRunning() || $migrationHelper->isTaskFinished()) {
36  return false;
37  }
38 
39  $isUserCreatedAfterFeatureIntroduction = $this->isUserCreatedAfterFeatureIntroduction($user);
40 
41  return $isUserCreatedAfterFeatureIntroduction;
42  }
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:

◆ isMigrationFinishedForUser()

ilCertificateMigrationValidator::isMigrationFinishedForUser ( \ilObjUser  $user)
protected
Parameters
ilObjUser$user
Returns
bool

Definition at line 58 of file class.ilCertificateMigrationValidator.php.

References ilObjUser\getPref().

Referenced by isMigrationAvailable().

58  : bool
59  {
60  $migrationFinished = $user->getPref('cert_migr_finished') == 1;
61 
62  return $migrationFinished;
63  }
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUserCreatedAfterFeatureIntroduction()

ilCertificateMigrationValidator::isUserCreatedAfterFeatureIntroduction ( \ilObjUser  $user)
protected
Parameters
\ilObjUser$user
Returns
bool

Definition at line 69 of file class.ilCertificateMigrationValidator.php.

References ilObject\getCreateDate().

Referenced by isMigrationAvailable().

69  : bool
70  {
71  $createdBeforeFeatureIntroduction = false;
72 
73  $userCreationDate = $user->getCreateDate();
74  if (null !== $userCreationDate) {
75  $userCreatedTimestamp = strtotime($userCreationDate);
76  $introducedTimestamp = $this->certificateSettings->get('persisting_cers_introduced_ts', 0);
77 
78  if ($userCreatedTimestamp < $introducedTimestamp) {
79  $createdBeforeFeatureIntroduction = true;
80  }
81  }
82 
83  return $createdBeforeFeatureIntroduction;
84  }
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $certificateSettings

ilCertificateMigrationValidator::$certificateSettings
private

Definition at line 10 of file class.ilCertificateMigrationValidator.php.

Referenced by __construct().


The documentation for this class was generated from the following file: