ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAchievements Class Reference

Maybe a separate service in the future. More...

+ Collaboration diagram for ilAchievements:

Public Member Functions

 __construct ()
 Constructor. More...
 
 isActive ($service)
 Is subservice active? More...
 
 isAnyActive ()
 Is any subservice active? More...
 
 getActiveServices ()
 Get active services. More...
 

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

 $learing_history
 
 $services
 
 $setting
 

Private Attributes

 $validator
 

Detailed Description

Maybe a separate service in the future.

Needs a generic approach.

Currently only the main menu (and personal desktop) should use this.

Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilAchievements::__construct ( )

Constructor.

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

References $DIC.

49  {
50  global $DIC;
51 
52  $this->setting = $DIC["ilSetting"];
53  $this->learing_history = $DIC->learningHistory();
54  $this->skmg_setting = new ilSetting("skmg");
55  $this->validator = new ilCertificateActiveValidator();
56  }
global $DIC
Definition: goto.php:24

Member Function Documentation

◆ getActiveServices()

ilAchievements::getActiveServices ( )

Get active services.

Returns
int[]

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

References isActive().

108  : array
109  {
110  return array_filter($this->services, function ($s) {
111  return $this->isActive($s);
112  });
113  }
isActive($service)
Is subservice active?
+ Here is the call graph for this function:

◆ isActive()

ilAchievements::isActive (   $service)

Is subservice active?

Parameters
intservice
Returns
bool

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

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

Referenced by getActiveServices(), and isAnyActive().

64  : bool
65  {
66  switch ($service) {
67  case self::SERV_LEARNING_HISTORY:
68  return (bool) $this->learing_history->isActive();
69  break;
70  case self::SERV_COMPETENCES:
71  return (bool) $this->skmg_setting->get("enable_skmg");
72  break;
73  case self::SERV_LEARNING_PROGRESS:
77  break;
78  case self::SERV_BADGES:
79  return (bool) ilBadgeHandler::getInstance()->isActive();
80  break;
81  case self::SERV_CERTIFICATES:
82  return $this->validator->validate();
83  break;
84  }
85  return false;
86  }
static _enabledLearningProgress()
check wether learing progress is enabled or not
$service
Definition: result.php:17
static getInstance()
Constructor.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnyActive()

ilAchievements::isAnyActive ( )

Is any subservice active?

Returns
bool

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

References isActive().

93  : bool
94  {
95  foreach ($this->services as $s) {
96  if ($this->isActive($s)) {
97  return true;
98  }
99  }
100  return false;
101  }
isActive($service)
Is subservice active?
+ Here is the call graph for this function:

Field Documentation

◆ $learing_history

ilAchievements::$learing_history
protected

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

◆ $services

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 32 of file class.ilAchievements.php.

◆ $setting

ilAchievements::$setting
protected

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

◆ $validator

ilAchievements::$validator
private

Definition at line 18 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: