ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilBuddySystem.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
13 protected static $instance;
14
18 protected static $is_enabled;
19
23 protected $settings;
24
28 protected $user;
29
33 protected function __construct()
34 {
35 global $DIC;
36
37 $this->settings = new ilSetting('buddysystem');
38 $this->user = $DIC['ilUser'];
39 }
40
44 public static function getInstance()
45 {
46 if (!(self::$instance instanceof self)) {
47 self::$instance = new self();
48 }
49
50 return self::$instance;
51 }
52
57 public function setSetting($keyword, $value)
58 {
59 $this->settings->set($keyword, $value);
60 }
61
67 public function getSetting($keyword, $default = false)
68 {
69 return $this->settings->get($keyword, $default);
70 }
71
75 public function isEnabled()
76 {
77 if (self::$is_enabled !== null) {
78 return self::$is_enabled;
79 }
80
81 if ($this->user->isAnonymous()) {
82 self::$is_enabled = false;
83 return false;
84 }
85
86 self::$is_enabled = $this->settings->get('enabled', false);
87 return self::$is_enabled;
88 }
89}
user()
Definition: user.php:4
$default
Definition: build.php:20
An exception for terminatinating execution or to throw for unit testing.
Class ilBuddySystem.
getSetting($keyword, $default=false)
setSetting($keyword, $value)
ILIAS Setting Class.
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2