ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAchievements.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
19
20 // all services being covered under the achievements menu item
24 const SERV_BADGES = 4;
26
27 // this also determines the order of tabs
28 protected $services = [
34 ];
35
39 protected $setting;
40
44 public function __construct()
45 {
46 global $DIC;
47
48 $this->setting = $DIC["ilSetting"];
49 $this->learing_history = $DIC->learningHistory();
50 $this->skmg_setting = new ilSetting("skmg");
51 }
52
59 public function isActive($service) : bool
60 {
61 switch ($service) {
63 return (bool) $this->learing_history->isActive();
64 break;
66 return (bool) $this->skmg_setting->get("enable_skmg");
67 break;
72 break;
74 return (bool) ilBadgeHandler::getInstance()->isActive();
75 break;
77 return (bool) ilCertificate::isActive();
78 break;
79 }
80 return false;
81 }
82
88 public function isAnyActive() : bool
89 {
90 foreach ($this->services as $s) {
91 if ($this->isActive($s)) {
92 return true;
93 }
94 }
95 return false;
96 }
97
103 public function getActiveServices() : array
104 {
105 return array_filter($this->services, function ($s) {
106 return $this->isActive($s);
107 });
108 }
109}
An exception for terminatinating execution or to throw for unit testing.
Maybe a separate service in the future.
getActiveServices()
Get active services.
isActive($service)
Is subservice active?
isAnyActive()
Is any subservice active?
__construct()
Constructor.
static getInstance()
Constructor.
static _enabledLearningProgress()
check wether learing progress is enabled or not
ILIAS Setting Class.
$s
Definition: pwgen.php:45
global $DIC
Definition: saml.php:7