ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAchievements.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
27
28 public const SERV_LEARNING_HISTORY = 1;
29 public const SERV_COMPETENCES = 2;
30 public const SERV_LEARNING_PROGRESS = 3;
31 public const SERV_BADGES = 4;
32 public const SERV_CERTIFICATES = 5;
33
34 protected array $services = [
40 ];
41
44
45 public function __construct()
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 }
54
55 public function isActive(int $service): bool
56 {
57 switch ($service) {
59 return $this->learing_history->isActive();
60
62 return (bool) $this->skmg_setting->get('enable_skmg');
63
68
70 return ilBadgeHandler::getInstance()->isActive();
71
73 return $this->validator->validate();
74 }
75 return false;
76 }
77
78 public function isAnyActive(): bool
79 {
80 foreach ($this->services as $s) {
81 if ($this->isActive($s)) {
82 return true;
83 }
84 }
85 return false;
86 }
87
91 public function getActiveServices(): array
92 {
93 return array_filter($this->services, function ($s) {
94 return $this->isActive($s);
95 });
96 }
97}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
isActive(int $service)
ilCertificateActiveValidator $validator
ilLearningHistoryService $learing_history
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Setting Class.
$service
Definition: ltiresult.php:36
global $DIC
Definition: shib_login.php:26