ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAchievements Class Reference
+ Collaboration diagram for ilAchievements:

Public Member Functions

 __construct ()
 
 isActive (int $service)
 
 isAnyActive ()
 
 getActiveServices ()
 

Data Fields

const SERV_LEARNING_HISTORY = 1
 
const SERV_COMPETENCES = 2
 
const SERV_LEARNING_PROGRESS = 3
 
const SERV_BADGES = 4
 
const SERV_CERTIFICATES = 5
 

Protected Attributes

ilLearningHistoryService $learing_history
 
array $services
 
ilSetting $setting
 
ilSetting $skmg_setting
 

Private Attributes

ilCertificateActiveValidator $validator
 

Detailed Description

Definition at line 23 of file class.ilAchievements.php.

Constructor & Destructor Documentation

◆ __construct()

ilAchievements::__construct ( )

Definition at line 45 of file class.ilAchievements.php.

References $DIC.

46  {
47  global $DIC;
48 
49  $this->setting = $DIC->settings();
50  $this->learing_history = $DIC->learningHistory();
51  $this->skmg_setting = new ilSetting('skmg');
52  $this->validator = new ilCertificateActiveValidator();
53  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ getActiveServices()

ilAchievements::getActiveServices ( )
Returns
int[]

Definition at line 91 of file class.ilAchievements.php.

References isActive().

91  : array
92  {
93  return array_filter($this->services, function ($s) {
94  return $this->isActive($s);
95  });
96  }
isActive(int $service)
+ Here is the call graph for this function:

◆ isActive()

ilAchievements::isActive ( int  $service)

Definition at line 55 of file class.ilAchievements.php.

References ilObjUserTracking\_enabledLearningProgress(), ilObjUserTracking\_hasLearningProgressLearner(), ilObjUserTracking\_hasLearningProgressOtherUsers(), and ilBadgeHandler\getInstance().

Referenced by getActiveServices(), and isAnyActive().

55  : bool
56  {
57  switch ($service) {
58  case self::SERV_LEARNING_HISTORY:
59  return $this->learing_history->isActive();
60 
61  case self::SERV_COMPETENCES:
62  return (bool) $this->skmg_setting->get('enable_skmg');
63 
64  case self::SERV_LEARNING_PROGRESS:
68 
69  case self::SERV_BADGES:
70  return ilBadgeHandler::getInstance()->isActive();
71 
72  case self::SERV_CERTIFICATES:
73  return $this->validator->validate();
74  }
75  return false;
76  }
$service
Definition: ltiservices.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnyActive()

ilAchievements::isAnyActive ( )

Definition at line 78 of file class.ilAchievements.php.

References isActive().

78  : bool
79  {
80  foreach ($this->services as $s) {
81  if ($this->isActive($s)) {
82  return true;
83  }
84  }
85  return false;
86  }
isActive(int $service)
+ Here is the call graph for this function:

Field Documentation

◆ $learing_history

ilLearningHistoryService ilAchievements::$learing_history
protected

Definition at line 26 of file class.ilAchievements.php.

◆ $services

array ilAchievements::$services
protected
Initial value:
= [
self::SERV_LEARNING_HISTORY,
self::SERV_COMPETENCES,
self::SERV_LEARNING_PROGRESS,
self::SERV_BADGES,
self::SERV_CERTIFICATES
]

Definition at line 34 of file class.ilAchievements.php.

◆ $setting

ilSetting ilAchievements::$setting
protected

Definition at line 42 of file class.ilAchievements.php.

◆ $skmg_setting

ilSetting ilAchievements::$skmg_setting
protected

Definition at line 43 of file class.ilAchievements.php.

◆ $validator

ilCertificateActiveValidator ilAchievements::$validator
private

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

◆ SERV_BADGES

const ilAchievements::SERV_BADGES = 4

◆ SERV_CERTIFICATES

const ilAchievements::SERV_CERTIFICATES = 5

◆ SERV_COMPETENCES

const ilAchievements::SERV_COMPETENCES = 2

◆ SERV_LEARNING_HISTORY

const ilAchievements::SERV_LEARNING_HISTORY = 1

◆ SERV_LEARNING_PROGRESS

const ilAchievements::SERV_LEARNING_PROGRESS = 3

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