ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCachedLanguage Class Reference

Class ilCachedLanguage. More...

+ Collaboration diagram for ilCachedLanguage:

Public Member Functions

 isActive ()
 
 writeToCache ()
 
 flush ()
 
 setLanguageKey ($language_key)
 
 getLanguageKey ()
 
 setLoaded ($loaded)
 
 getLoaded ()
 
 setTranslations ($translations)
 
 getTranslations ()
 

Static Public Member Functions

static getInstance ($key)
 

Protected Member Functions

 readFromCache ()
 

Protected Attributes

 $global_cache
 
 $loaded = false
 
 $language_key = 'en'
 
 $translations = array()
 

Static Protected Attributes

static $instances = array()
 

Detailed Description

Class ilCachedLanguage.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 10 of file class.ilCachedLanguage.php.

Member Function Documentation

◆ flush()

ilCachedLanguage::flush ( )

Definition at line 108 of file class.ilCachedLanguage.php.

References writeToCache().

108  {
109  if ($this->global_cache->isActive()) {
110  $this->global_cache->flush();
111  }
112  $this->readFromDB();
113  $this->writeToCache();
114  }
+ Here is the call graph for this function:

◆ getInstance()

static ilCachedLanguage::getInstance (   $key)
static
Parameters
$key
Returns
ilCachedLanguage

Definition at line 99 of file class.ilCachedLanguage.php.

Referenced by ilLanguage\__construct(), and ilObjLanguageExt\_saveValues().

99  {
100  if (! isset(self::$instances[$key])) {
101  self::$instances[$key] = new self($key);
102  }
103 
104  return self::$instances[$key];
105  }
+ Here is the caller graph for this function:

◆ getLanguageKey()

ilCachedLanguage::getLanguageKey ( )
Returns
string

Definition at line 128 of file class.ilCachedLanguage.php.

References $language_key.

Referenced by readFromCache(), and writeToCache().

128  {
129  return $this->language_key;
130  }
+ Here is the caller graph for this function:

◆ getLoaded()

ilCachedLanguage::getLoaded ( )
Returns
boolean

Definition at line 144 of file class.ilCachedLanguage.php.

References $loaded.

144  {
145  return $this->loaded;
146  }

◆ getTranslations()

ilCachedLanguage::getTranslations ( )
Returns
array

Definition at line 160 of file class.ilCachedLanguage.php.

References $translations.

Referenced by writeToCache().

160  {
161  return $this->translations;
162  }
+ Here is the caller graph for this function:

◆ isActive()

ilCachedLanguage::isActive ( )
Returns
bool

Definition at line 53 of file class.ilCachedLanguage.php.

53  {
54  return $this->global_cache->isActive();
55  }

◆ readFromCache()

ilCachedLanguage::readFromCache ( )
protected

Definition at line 58 of file class.ilCachedLanguage.php.

References $translations, getLanguageKey(), setLoaded(), and setTranslations().

58  {
59  if ($this->global_cache->isActive()) {
60  $translations = $this->global_cache->get('translations_' . $this->getLanguageKey());
61  if (is_array($translations)) {
63  $this->setLoaded(true);
64  }
65  }
66  }
setTranslations($translations)
+ Here is the call graph for this function:

◆ setLanguageKey()

ilCachedLanguage::setLanguageKey (   $language_key)
Parameters
string$language_key

Definition at line 120 of file class.ilCachedLanguage.php.

References $language_key.

120  {
121  $this->language_key = $language_key;
122  }

◆ setLoaded()

ilCachedLanguage::setLoaded (   $loaded)
Parameters
boolean$loaded

Definition at line 136 of file class.ilCachedLanguage.php.

References $loaded.

Referenced by readFromCache().

136  {
137  $this->loaded = $loaded;
138  }
+ Here is the caller graph for this function:

◆ setTranslations()

ilCachedLanguage::setTranslations (   $translations)
Parameters
array$translations

Definition at line 152 of file class.ilCachedLanguage.php.

References $translations.

Referenced by readFromCache(), and writeToCache().

152  {
153  $this->translations = $translations;
154  }
+ Here is the caller graph for this function:

◆ writeToCache()

ilCachedLanguage::writeToCache ( )

Definition at line 69 of file class.ilCachedLanguage.php.

References $ilDB, $res, $translations, array, getLanguageKey(), getTranslations(), and setTranslations().

Referenced by flush().

69  {
70  if ($this->global_cache->isActive()) {
71  $this->global_cache->set('translations_' . $this->getLanguageKey(), $this->getTranslations());
72  }
73  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $global_cache

ilCachedLanguage::$global_cache
protected

Definition at line 12 of file class.ilCachedLanguage.php.

◆ $instances

ilCachedLanguage::$instances = array()
staticprotected

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

◆ $language_key

ilCachedLanguage::$language_key = 'en'
protected

Definition at line 20 of file class.ilCachedLanguage.php.

Referenced by getLanguageKey(), and setLanguageKey().

◆ $loaded

ilCachedLanguage::$loaded = false
protected

Definition at line 16 of file class.ilCachedLanguage.php.

Referenced by getLoaded(), and setLoaded().

◆ $translations

ilCachedLanguage::$translations = array()
protected

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