ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
48  self::$instance = new self();
49  }
50 
51  return self::$instance;
52  }
53 
58  public function setSetting($keyword, $value)
59  {
60  $this->settings->set($keyword, $value);
61  }
62 
68  public function getSetting($keyword, $default = false)
69  {
70  return $this->settings->get($keyword, $default);
71  }
72 
76  public function isEnabled()
77  {
78  if(self::$is_enabled !== null)
79  {
80  return self::$is_enabled;
81  }
82 
83  if($this->user->isAnonymous())
84  {
85  self::$is_enabled = false;
86  return false;
87  }
88 
89  self::$is_enabled = $this->settings->get('enabled', false);
90  return self::$is_enabled;
91  }
92 }
ILIAS Setting Class.
user()
Definition: user.php:4
setSetting($keyword, $value)
settings()
Definition: settings.php:2
global $DIC
getSetting($keyword, $default=false)
Class ilBuddySystem.