ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilAchievements.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 public const SERV_LEARNING_HISTORY = 1;
26 public const SERV_COMPETENCES = 2;
27 public const SERV_LEARNING_PROGRESS = 3;
28 public const SERV_BADGES = 4;
29 public const SERV_CERTIFICATES = 5;
30 private const SERVICES = [
36 ];
37
40 protected readonly ilSetting $setting;
41
42 public function __construct()
43 {
44 global $DIC;
45
46 $this->learing_history = $DIC->learningHistory();
47 $this->setting = new ilSetting('skmg');
48 $this->validator = new ilCertificateActiveValidator();
49 }
50
51 public function isActive(int $service): bool
52 {
53 switch ($service) {
55 return $this->learing_history->isActive();
56
58 return (bool) $this->setting->get('enable_skmg');
59
64
66 return ilBadgeHandler::getInstance()->isActive();
67
69 return $this->validator->validate();
70 }
71 return false;
72 }
73
74 public function isAnyActive(): bool
75 {
76 foreach (self::SERVICES as $s) {
77 if ($this->isActive($s)) {
78 return true;
79 }
80 }
81 return false;
82 }
83
87 public function getActiveServices(): array
88 {
89 return array_filter(self::SERVICES, $this->isActive(...));
90 }
91}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
readonly ilLearningHistoryService $learing_history
isActive(int $service)
readonly ilSetting $setting
readonly ilCertificateActiveValidator $validator
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