ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository Class Reference
+ Collaboration diagram for ILIAS\MetaData\OERHarvester\Settings\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\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository::__construct ( protected ilDBInterface  $db,
protected InternalDataService  $data 
)

Definition at line 28 of file SettingsDBRepository.php.

31  {
32  }

Member Function Documentation

◆ boolToText()

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

Definition at line 85 of file SettingsDBRepository.php.

Referenced by ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository\update().

85  : string
86  {
87  return $value ? 'y' : 'n';
88  }
+ Here is the caller graph for this function:

◆ getById()

ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository::getById ( int  $id)

Definition at line 54 of file SettingsDBRepository.php.

References ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository\getSettingsFromRecord(), and null.

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getSettingsFromRecord()

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

Definition at line 70 of file SettingsDBRepository.php.

References ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository\textToBool().

Referenced by ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository\getById().

70  : Settings
71  {
72  return $this->data->settings(
73  (int) $record['id'],
74  $this->textToBool($record['is_online']),
75  (string) $record['virtual'],
76  $this->textToBool($record['glo_menu_active']),
77  (string) $record['pres_mode'],
78  (int) $record['show_tax'],
79  (int) $record['snippet_length'],
80  $this->textToBool($record['flash_active']),
81  (string) $record['flash_mode']
82  );
83  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ textToBool()

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

Definition at line 90 of file SettingsDBRepository.php.

Referenced by ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository\getSettingsFromRecord().

90  : bool
91  {
92  return $value === 'y';
93  }
+ Here is the caller graph for this function:

◆ update()

ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository::update ( Settings  $settings)

Definition at line 34 of file SettingsDBRepository.php.

References ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsDBRepository\boolToText(), and ILIAS\MetaData\OERHarvester\Settings\Settings\Settings\getId().

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  }
+ Here is the call graph for this function:

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