ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAuthLoginPageEditorSettings Class Reference

Storage of editor settings. More...

+ Collaboration diagram for ilAuthLoginPageEditorSettings:

Public Member Functions

 __construct ()
 
 setMode (int $a_mode)
 
 getMode ()
 
 getIliasEditorLanguage (string $a_langkey)
 Get ilias editor language. More...
 
 enableIliasEditor (string $a_langkey, bool $a_status)
 Enable editor for language. More...
 
 isIliasEditorEnabled (string $a_langkey)
 Check if ilias editor is enabled for a language. More...
 
 update ()
 Update settings. More...
 
 read ()
 Read settings. More...
 

Static Public Member Functions

static getInstance ()
 Get singelton instance. More...
 

Data Fields

const MODE__UNDEFINED = 0
 
const MODE_RTE = 1
 
const MODE_IPE = 2
 

Protected Member Functions

 getStorage ()
 

Private Attributes

array $languages = []
 
ilSetting $storage
 
int $mode = 0
 
ilLanguage $lng
 

Static Private Attributes

static ilAuthLoginPageEditorSettings $instance = null
 

Detailed Description

Storage of editor settings.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 26 of file class.ilAuthLoginPageEditorSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilAuthLoginPageEditorSettings::__construct ( )

Definition at line 41 of file class.ilAuthLoginPageEditorSettings.php.

References $DIC, ILIAS\Repository\lng(), and read().

42  {
43  global $DIC;
44  $this->lng = $DIC->language();
45 
46  $this->storage = new ilSetting('login_editor');
47  $this->read();
48  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ enableIliasEditor()

ilAuthLoginPageEditorSettings::enableIliasEditor ( string  $a_langkey,
bool  $a_status 
)

Enable editor for language.

Definition at line 103 of file class.ilAuthLoginPageEditorSettings.php.

Referenced by ilAuthLoginPageEditorGUI\activate(), and read().

103  : void
104  {
105  $this->languages[$a_langkey] = $a_status;
106  }
+ Here is the caller graph for this function:

◆ getIliasEditorLanguage()

ilAuthLoginPageEditorSettings::getIliasEditorLanguage ( string  $a_langkey)

Get ilias editor language.

Parameters
string$a_langkey
Returns
string

Definition at line 86 of file class.ilAuthLoginPageEditorSettings.php.

References isIliasEditorEnabled(), and ILIAS\Repository\lng().

86  : string
87  {
88  if ($this->mode !== self::MODE_IPE) {
89  return '';
90  }
91  if ($this->isIliasEditorEnabled($a_langkey)) {
92  return $a_langkey;
93  }
94  if ($this->isIliasEditorEnabled($this->lng->getDefaultLanguage())) {
95  return $this->lng->getDefaultLanguage();
96  }
97  return '';
98  }
isIliasEditorEnabled(string $a_langkey)
Check if ilias editor is enabled for a language.
+ Here is the call graph for this function:

◆ getInstance()

static ilAuthLoginPageEditorSettings::getInstance ( )
static

Get singelton instance.

Returns
ilAuthLoginPageEditorSettings

Definition at line 54 of file class.ilAuthLoginPageEditorSettings.php.

Referenced by ilAuthLoginPageEditorGUI\__construct(), ilAuthLoginPageEditorGUI\activate(), ilStartUpGUI\getLoginPageEditorHTML(), and ilAuthLoginPageEditorTableGUI\parse().

55  {
56  if (self::$instance) {
57  return self::$instance;
58  }
59  return self::$instance = new ilAuthLoginPageEditorSettings();
60  }
+ Here is the caller graph for this function:

◆ getMode()

ilAuthLoginPageEditorSettings::getMode ( )

Definition at line 76 of file class.ilAuthLoginPageEditorSettings.php.

References $mode.

Referenced by update().

76  : int
77  {
78  return $this->mode;
79  }
+ Here is the caller graph for this function:

◆ getStorage()

ilAuthLoginPageEditorSettings::getStorage ( )
protected
Returns
ilSetting

Definition at line 65 of file class.ilAuthLoginPageEditorSettings.php.

References $storage.

Referenced by read(), and update().

+ Here is the caller graph for this function:

◆ isIliasEditorEnabled()

ilAuthLoginPageEditorSettings::isIliasEditorEnabled ( string  $a_langkey)

Check if ilias editor is enabled for a language.

Definition at line 111 of file class.ilAuthLoginPageEditorSettings.php.

Referenced by getIliasEditorLanguage().

111  : bool
112  {
113  return $this->languages[$a_langkey] ?? false;
114  }
+ Here is the caller graph for this function:

◆ read()

ilAuthLoginPageEditorSettings::read ( )

Read settings.

Definition at line 131 of file class.ilAuthLoginPageEditorSettings.php.

References enableIliasEditor(), getStorage(), ILIAS\Repository\lng(), and setMode().

Referenced by __construct().

131  : void
132  {
133  $this->setMode((int) $this->getStorage()->get('mode', (string) self::MODE_RTE));
134 
135  // Language settings
136  $this->languages = [];
137  foreach ($this->lng->getInstalledLanguages() as $lngkey) {
138  $this->enableIliasEditor($lngkey, (bool) $this->getStorage()->get($lngkey, ""));
139  }
140  }
enableIliasEditor(string $a_langkey, bool $a_status)
Enable editor for language.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMode()

ilAuthLoginPageEditorSettings::setMode ( int  $a_mode)

Definition at line 70 of file class.ilAuthLoginPageEditorSettings.php.

Referenced by read().

70  : void
71  {
72  //TODO check for proper mode
73  $this->mode = $a_mode;
74  }
+ Here is the caller graph for this function:

◆ update()

ilAuthLoginPageEditorSettings::update ( )

Update settings.

Definition at line 119 of file class.ilAuthLoginPageEditorSettings.php.

References getMode(), and getStorage().

Referenced by ilAuthLoginPageEditorGUI\activate().

119  : void
120  {
121  $this->getStorage()->set('mode', (string) $this->getMode());
122 
123  foreach ($this->languages as $lngkey => $stat) {
124  $this->storage->set($lngkey, (string) $stat);
125  }
126  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $instance

ilAuthLoginPageEditorSettings ilAuthLoginPageEditorSettings::$instance = null
staticprivate

Definition at line 34 of file class.ilAuthLoginPageEditorSettings.php.

◆ $languages

array ilAuthLoginPageEditorSettings::$languages = []
private

Definition at line 32 of file class.ilAuthLoginPageEditorSettings.php.

◆ $lng

ilLanguage ilAuthLoginPageEditorSettings::$lng
private

Definition at line 39 of file class.ilAuthLoginPageEditorSettings.php.

◆ $mode

int ilAuthLoginPageEditorSettings::$mode = 0
private

Definition at line 37 of file class.ilAuthLoginPageEditorSettings.php.

Referenced by getMode().

◆ $storage

ilSetting ilAuthLoginPageEditorSettings::$storage
private

Definition at line 35 of file class.ilAuthLoginPageEditorSettings.php.

Referenced by getStorage().

◆ MODE__UNDEFINED

const ilAuthLoginPageEditorSettings::MODE__UNDEFINED = 0

Definition at line 28 of file class.ilAuthLoginPageEditorSettings.php.

◆ MODE_IPE

const ilAuthLoginPageEditorSettings::MODE_IPE = 2

◆ MODE_RTE

const ilAuthLoginPageEditorSettings::MODE_RTE = 1

The documentation for this class was generated from the following file: