ILIAS
trunk Revision v11.0_alpha-3011-gc6b235a2e85
◀ ilDoc Overview
SettingsDBRepository.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Portfolio\Settings
;
22
23
use
ilDBInterface
;
24
use
ILIAS\Portfolio\InternalDataService
;
25
26
class
SettingsDBRepository
27
{
28
public
function
__construct
(
29
protected
ilDBInterface
$db
,
30
protected
InternalDataService
$data
31
) {
32
}
33
34
public
function
create
(
Settings
$settings): void
35
{
36
$this->db->insert(
'usr_portfolio'
, [
37
'id'
=> [
'integer'
, $settings->
getId
()],
38
'ppic'
=> [
'integer'
, $settings->
getShowPersonalPicture
()]
39
]);
40
}
41
42
public
function
update
(
Settings
$settings): void
43
{
44
$this->db->update(
'usr_portfolio'
, [
45
'ppic'
=> [
'integer'
, $settings->
getShowPersonalPicture
()]
46
], [
47
'id'
=> [
'integer'
, $settings->
getId
()],
48
]);
49
}
50
51
public
function
getById
(
int
$id
): ?
Settings
52
{
53
$set = $this->db->queryF(
54
'SELECT * FROM usr_portfolio WHERE id = %s'
,
55
[
'integer'
],
56
[
$id
]
57
);
58
$rec = $this->db->fetchAssoc($set);
59
if
($rec) {
60
return
$this->
getSettingsFromRecord
($rec);
61
}
62
return
null
;
63
}
64
65
public
function
delete
(
int
$id
):
void
66
{
67
$this->db->manipulateF(
68
'DELETE FROM usr_portfolio WHERE id = %s'
,
69
[
'integer'
],
70
[
$id
]
71
);
72
}
73
74
protected
function
getSettingsFromRecord
(array $rec):
Settings
75
{
76
return
$this->data->settings(
77
(
int
) $rec[
'id'
],
78
(
bool
) $rec[
'ppic'
]
79
);
80
}
81
}
$id
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition:
plugin.php:23
ILIAS\COPage\InternalDataService
Repository internal data service.
Definition:
class.InternalDataService.php:28
ILIAS\Portfolio\InternalDataService
Definition:
class.InternalDataService.php:26
ILIAS\Portfolio\Settings\SettingsDBRepository
Definition:
SettingsDBRepository.php:27
ILIAS\Portfolio\Settings\SettingsDBRepository\getById
getById(int $id)
Definition:
SettingsDBRepository.php:51
ILIAS\Portfolio\Settings\SettingsDBRepository\create
create(Settings $settings)
Definition:
SettingsDBRepository.php:34
ILIAS\Portfolio\Settings\SettingsDBRepository\__construct
__construct(protected ilDBInterface $db, protected InternalDataService $data)
Definition:
SettingsDBRepository.php:28
ILIAS\Portfolio\Settings\SettingsDBRepository\getSettingsFromRecord
getSettingsFromRecord(array $rec)
Definition:
SettingsDBRepository.php:74
ILIAS\Portfolio\Settings\SettingsDBRepository\update
update(Settings $settings)
Definition:
SettingsDBRepository.php:42
ILIAS\Portfolio\Settings\Settings
Definition:
Settings.php:24
ILIAS\Portfolio\Settings\Settings\getId
getId()
Definition:
Settings.php:31
ILIAS\Portfolio\Settings\Settings\getShowPersonalPicture
getShowPersonalPicture()
Definition:
Settings.php:36
ILIAS\$db
$db
Definition:
class.ilias.php:60
ilDBInterface
Interface ilDBInterface.
Definition:
interface.ilDBInterface.php:30
$data
$data
Definition:
ltiregistration.php:29
ILIAS\Portfolio\Settings
Definition:
class.SettingsGUI.php:21
components
ILIAS
Portfolio
Settings
SettingsDBRepository.php
Generated on Sat Oct 18 2025 23:02:40 for ILIAS by
1.9.4 (using
Doxyfile
)