ILIAS  release_8 Revision v8.24
class.ilAchievements.php
Go to the documentation of this file.
1<?php
2
20{
23
24 // all services being covered under the achievements menu item
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
31 // this also determines the order of tabs
32 protected array $services = [
38 ];
39
42
43 public function __construct()
44 {
46 global $DIC;
47
48 $this->setting = $DIC->settings();
49 $this->learing_history = $DIC->learningHistory();
50 $this->skmg_setting = new ilSetting("skmg");
51 $this->validator = new ilCertificateActiveValidator();
52 }
53
57 public function isActive(int $service): bool
58 {
59 switch ($service) {
61 return $this->learing_history->isActive();
62
64 return (bool) $this->skmg_setting->get("enable_skmg");
65
70
72 return ilBadgeHandler::getInstance()->isActive();
73
75 return $this->validator->validate();
76
77 }
78 return false;
79 }
80
84 public function isAnyActive(): bool
85 {
86 foreach ($this->services as $s) {
87 if ($this->isActive($s)) {
88 return true;
89 }
90 }
91 return false;
92 }
93
98 public function getActiveServices(): array
99 {
100 return array_filter($this->services, function ($s) {
101 return $this->isActive($s);
102 });
103 }
104}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isActive(int $service)
Is sub-service active?
ilCertificateActiveValidator $validator
getActiveServices()
Get active services.
ilLearningHistoryService $learing_history
isAnyActive()
Is any sub-service active?
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$service
Definition: ltiservices.php:43
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc