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

Public Member Functions

 __construct (protected ilDBInterface $db, protected InternalDataService $data)
 
 create (Settings $settings)
 
 update (Settings $settings)
 
 getByObjId (int $obj_id)
 
 delete (int $obj_id)
 

Protected Member Functions

 getSettingsFromRecord (array $rec)
 

Detailed Description

Definition at line 26 of file SettingsDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 28 of file SettingsDBRepository.php.

31 {
32 }

Member Function Documentation

◆ create()

ILIAS\Exercise\Settings\SettingsDBRepository::create ( Settings  $settings)

Definition at line 34 of file SettingsDBRepository.php.

34 : void
35 {
36 $this->db->insert("exc_data", [
37 "obj_id" => ["integer", $settings->getObjId()],
38 "instruction" => ["clob", $settings->getInstruction()],
39 "time_stamp" => ["integer", $settings->getTimeStamp()],
40 "pass_mode" => ["text", $settings->getPassMode()],
41 "nr_mandatory_random" => ["integer", $settings->getNrMandatoryRandom()],
42 "pass_nr" => ["text", $settings->getPassNr()],
43 "show_submissions" => ["integer", (int) $settings->getShowSubmissions()],
44 'compl_by_submission' => ["integer", (int) $settings->getCompletionBySubmission()],
45 "certificate_visibility" => ["integer", $settings->getCertificateVisibility()],
46 "tfeedback" => ["integer", $settings->getTutorFeedback()]
47 ]);
48 }

References ILIAS\Exercise\Settings\Settings\getCertificateVisibility(), ILIAS\Exercise\Settings\Settings\getCompletionBySubmission(), ILIAS\Exercise\Settings\Settings\getInstruction(), ILIAS\Exercise\Settings\Settings\getNrMandatoryRandom(), ILIAS\Exercise\Settings\Settings\getObjId(), ILIAS\Exercise\Settings\Settings\getPassMode(), ILIAS\Exercise\Settings\Settings\getPassNr(), ILIAS\Exercise\Settings\Settings\getShowSubmissions(), ILIAS\Exercise\Settings\Settings\getTimeStamp(), and ILIAS\Exercise\Settings\Settings\getTutorFeedback().

+ Here is the call graph for this function:

◆ delete()

ILIAS\Exercise\Settings\SettingsDBRepository::delete ( int  $obj_id)

Definition at line 83 of file SettingsDBRepository.php.

83 : void
84 {
85 $this->db->manipulateF(
86 "DELETE FROM exc_data WHERE obj_id = %s",
87 ["integer"],
88 [$obj_id]
89 );
90 }

◆ getByObjId()

ILIAS\Exercise\Settings\SettingsDBRepository::getByObjId ( int  $obj_id)

Definition at line 67 of file SettingsDBRepository.php.

67 : ?Settings
68 {
69 $set = $this->db->queryF(
70 "SELECT * FROM exc_data WHERE obj_id = %s",
71 ["integer"],
72 [$obj_id]
73 );
74
75 $rec = $this->db->fetchAssoc($set);
76 if ($rec !== false) {
77 return $this->getSettingsFromRecord($rec);
78 }
79
80 return null;
81 }

References ILIAS\Exercise\Settings\SettingsDBRepository\getSettingsFromRecord().

+ Here is the call graph for this function:

◆ getSettingsFromRecord()

ILIAS\Exercise\Settings\SettingsDBRepository::getSettingsFromRecord ( array  $rec)
protected

Definition at line 92 of file SettingsDBRepository.php.

92 : Settings
93 {
94 return $this->data->settings(
95 (int) $rec['obj_id'],
96 $rec['instruction'],
97 (int) $rec['time_stamp'],
98 $rec['pass_mode'],
99 (int) $rec['nr_mandatory_random'],
100 (int) $rec['pass_nr'],
101 (bool) $rec['show_submissions'],
102 (bool) $rec['compl_by_submission'],
103 (int) $rec['certificate_visibility'],
104 (int) $rec['tfeedback']
105 );
106 }

Referenced by ILIAS\Exercise\Settings\SettingsDBRepository\getByObjId().

+ Here is the caller graph for this function:

◆ update()

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

Definition at line 50 of file SettingsDBRepository.php.

50 : void
51 {
52 $this->db->update("exc_data", [
53 "instruction" => ["clob", $settings->getInstruction()],
54 "time_stamp" => ["integer", $settings->getTimeStamp()],
55 "pass_mode" => ["text", $settings->getPassMode()],
56 "nr_mandatory_random" => ["integer", $settings->getNrMandatoryRandom()],
57 "pass_nr" => ["text", $settings->getPassNr()],
58 "show_submissions" => ["integer", (int) $settings->getShowSubmissions()],
59 'compl_by_submission' => ["integer", (int) $settings->getCompletionBySubmission()],
60 "certificate_visibility" => ["integer", $settings->getCertificateVisibility()],
61 "tfeedback" => ["integer", $settings->getTutorFeedback()]
62 ], [
63 "obj_id" => ["integer", $settings->getObjId()]
64 ]);
65 }

References ILIAS\Exercise\Settings\Settings\getCertificateVisibility(), ILIAS\Exercise\Settings\Settings\getCompletionBySubmission(), ILIAS\Exercise\Settings\Settings\getInstruction(), ILIAS\Exercise\Settings\Settings\getNrMandatoryRandom(), ILIAS\Exercise\Settings\Settings\getObjId(), ILIAS\Exercise\Settings\Settings\getPassMode(), ILIAS\Exercise\Settings\Settings\getPassNr(), ILIAS\Exercise\Settings\Settings\getShowSubmissions(), ILIAS\Exercise\Settings\Settings\getTimeStamp(), and ILIAS\Exercise\Settings\Settings\getTutorFeedback().

+ Here is the call graph for this function:

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