ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Glossary\Settings\SettingsDBRepository Class Reference
+ Collaboration diagram for ILIAS\Glossary\Settings\SettingsDBRepository:

Public Member Functions

 __construct (protected ilDBInterface $db, protected InternalDataService $data)
 
 update (Settings $settings)
 
 getById (int $id)
 

Protected Member Functions

 getSettingsFromRecord (array $record)
 
 boolToText (bool $value)
 
 textToBool (string $value)
 

Detailed Description

Definition at line 26 of file SettingsDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Glossary\Settings\SettingsDBRepository::__construct ( protected ilDBInterface  $db,
protected InternalDataService  $data 
)

Definition at line 28 of file SettingsDBRepository.php.

31 {
32 }

Member Function Documentation

◆ boolToText()

ILIAS\Glossary\Settings\SettingsDBRepository::boolToText ( bool  $value)
protected

Definition at line 88 of file SettingsDBRepository.php.

88 : string
89 {
90 return $value ? 'y' : 'n';
91 }

Referenced by ILIAS\Glossary\Settings\SettingsDBRepository\update().

+ Here is the caller graph for this function:

◆ getById()

ILIAS\Glossary\Settings\SettingsDBRepository::getById ( int  $id)

Definition at line 54 of file SettingsDBRepository.php.

54 : ?Settings
55 {
56 $set = $this->db->queryF(
57 'SELECT * FROM glossary WHERE id = %s',
58 ['integer'],
59 [$id]
60 );
61
62 $record = $this->db->fetchAssoc($set);
63 if ($record) {
64 return $this->getSettingsFromRecord($record);
65 }
66
67 return null;
68 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and ILIAS\Glossary\Settings\SettingsDBRepository\getSettingsFromRecord().

+ Here is the call graph for this function:

◆ getSettingsFromRecord()

ILIAS\Glossary\Settings\SettingsDBRepository::getSettingsFromRecord ( array  $record)
protected

Definition at line 70 of file SettingsDBRepository.php.

70 : Settings
71 {
72 $flash_mode = ($record['flash_mode'] == "")
73 ? "term"
74 : $record['flash_mode'];
75 return $this->data->settings(
76 (int) $record['id'],
77 $this->textToBool($record['is_online']),
78 (string) $record['virtual'],
79 $this->textToBool($record['glo_menu_active']),
80 (string) $record['pres_mode'],
81 (int) $record['show_tax'],
82 (int) $record['snippet_length'],
83 $this->textToBool($record['flash_active']),
84 (string) $flash_mode
85 );
86 }

References ILIAS\Repository\int(), and ILIAS\Glossary\Settings\SettingsDBRepository\textToBool().

Referenced by ILIAS\Glossary\Settings\SettingsDBRepository\getById().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ textToBool()

ILIAS\Glossary\Settings\SettingsDBRepository::textToBool ( string  $value)
protected

Definition at line 93 of file SettingsDBRepository.php.

93 : bool
94 {
95 return $value === 'y';
96 }

Referenced by ILIAS\Glossary\Settings\SettingsDBRepository\getSettingsFromRecord().

+ Here is the caller graph for this function:

◆ update()

ILIAS\Glossary\Settings\SettingsDBRepository::update ( Settings  $settings)

Definition at line 34 of file SettingsDBRepository.php.

34 : void
35 {
36 $this->db->update(
37 'glossary',
38 [
39 'is_online' => ['text', $this->boolToText($settings->getOnline())],
40 'virtual' => ['text', $settings->getVirtualMode()],
41 'glo_menu_active' => ['text', $this->boolToText($settings->getActiveGlossaryMenu())],
42 'pres_mode' => ['text', $settings->getPresentationMode()],
43 'show_tax' => ['integer', $settings->getShowTaxonomy()],
44 'snippet_length' => ['integer', $settings->getSnippetLength()],
45 'flash_active' => ['text', $this->boolToText($settings->getActiveFlashcards())],
46 'flash_mode' => ['text', $settings->getFlashcardsMode()]
47 ],
48 [
49 'id' => ['integer', $settings->getId()]
50 ]
51 );
52 }

References ILIAS\Glossary\Settings\SettingsDBRepository\boolToText(), ILIAS\Glossary\Settings\Settings\getActiveFlashcards(), ILIAS\Glossary\Settings\Settings\getActiveGlossaryMenu(), ILIAS\Glossary\Settings\Settings\getFlashcardsMode(), ILIAS\Glossary\Settings\Settings\getId(), ILIAS\Glossary\Settings\Settings\getOnline(), ILIAS\Glossary\Settings\Settings\getPresentationMode(), ILIAS\Glossary\Settings\Settings\getShowTaxonomy(), ILIAS\Glossary\Settings\Settings\getSnippetLength(), and ILIAS\Glossary\Settings\Settings\getVirtualMode().

+ Here is the call graph for this function:

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