ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjTestMainSettingsDatabaseRepository Class Reference
+ Inheritance diagram for ilObjTestMainSettingsDatabaseRepository:
+ Collaboration diagram for ilObjTestMainSettingsDatabaseRepository:

Public Member Functions

 __construct (ilDBInterface $db)
 
 getForObjFi (int $obj_fi)
 
 getFor (int $test_id)
 
 store (ilObjTestMainSettings $settings)
 
- Public Member Functions inherited from ILIAS\Test\MainSettingsRepository
 store (\ilObjTestMainSettings $settings)
 

Data Fields

const TABLE_NAME = 'tst_tests'
 
const STORAGE_DATE_FORMAT = 'YmdHis'
 

Protected Member Functions

 doSelect (string $where_part)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 23 of file ilObjTestMainSettingsDatabaseRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjTestMainSettingsDatabaseRepository::__construct ( ilDBInterface  $db)

Definition at line 30 of file ilObjTestMainSettingsDatabaseRepository.php.

References $db.

31  {
32  $this->db = $db;
33  }

Member Function Documentation

◆ doSelect()

ilObjTestMainSettingsDatabaseRepository::doSelect ( string  $where_part)
protected

Definition at line 47 of file ilObjTestMainSettingsDatabaseRepository.php.

References $res, ILIAS\LTI\ToolProvider\$settings, and ILIAS\Repository\int().

Referenced by getFor(), and getForObjFi().

48  {
49  $query = 'SELECT ' . PHP_EOL
50  . 'question_set_type,' . PHP_EOL
51  . 'anonymity,' . PHP_EOL
52  . 'test_id,' . PHP_EOL
53  . 'intro_enabled,' . PHP_EOL
54  . 'hide_info_tab,' . PHP_EOL
55  . 'conditions_checkbox_enabled,' . PHP_EOL
56  . 'introduction,' . PHP_EOL
57  . 'introduction_page_id,' . PHP_EOL
58  . 'starting_time_enabled,' . PHP_EOL
59  . 'starting_time,' . PHP_EOL
60  . 'ending_time_enabled,' . PHP_EOL
61  . 'ending_time,' . PHP_EOL
62  . 'password_enabled,' . PHP_EOL
63  . 'password,' . PHP_EOL
64  . 'fixed_participants,' . PHP_EOL
65  . 'nr_of_tries,' . PHP_EOL
66  . 'block_after_passed,' . PHP_EOL
67  . 'pass_waiting,' . PHP_EOL
68  . 'enable_processing_time,' . PHP_EOL
69  . 'processing_time,' . PHP_EOL
70  . 'reset_processing_time,' . PHP_EOL
71  . 'kiosk,' . PHP_EOL
72  . 'examid_in_test_pass,' . PHP_EOL
73  . 'title_output,' . PHP_EOL
74  . 'autosave,' . PHP_EOL
75  . 'autosave_ival,' . PHP_EOL
76  . 'shuffle_questions,' . PHP_EOL
77  . 'offer_question_hints,' . PHP_EOL
78  . 'answer_feedback_points,' . PHP_EOL
79  . 'answer_feedback,' . PHP_EOL
80  . 'specific_feedback,' . PHP_EOL
81  . 'instant_verification,' . PHP_EOL
82  . 'force_inst_fb,' . PHP_EOL
83  . 'inst_fb_answer_fixation,' . PHP_EOL
84  . 'follow_qst_answer_fixation,' . PHP_EOL
85  . 'obligations_enabled,' . PHP_EOL
86  . 'use_previous_answers,' . PHP_EOL
87  . 'suspend_test_allowed,' . PHP_EOL
88  . 'sequence_settings,' . PHP_EOL
89  . 'usr_pass_overview_mode,' . PHP_EOL
90  . 'show_marker,' . PHP_EOL
91  . 'show_questionlist,' . PHP_EOL
92  . 'enable_examview,' . PHP_EOL
93  . 'showfinalstatement,' . PHP_EOL
94  . 'finalstatement,' . PHP_EOL
95  . 'concluding_remarks_page_id,' . PHP_EOL
96  . 'redirection_mode,' . PHP_EOL
97  . 'redirection_url,' . PHP_EOL
98  . 'mailnotification,' . PHP_EOL
99  . 'mailnottype,' . PHP_EOL
100  . 'skill_service' . PHP_EOL
101  . 'FROM ' . self::TABLE_NAME . PHP_EOL
102  . $where_part;
103 
104  $res = $this->db->query($query);
105 
106  if ($this->db->numRows($res) == 0) {
107  throw new \Exception('Mo main settings for: ' . $where_part);
108  }
109 
110  $row = $this->db->fetchAssoc($res);
111 
112  $test_id = (int) $row['test_id'];
113 
115  $test_id,
117  $test_id,
118  $row['question_set_type'],
119  (bool) $row['anonymity']
120  ),
122  $test_id,
123  (bool) $row['intro_enabled'],
124  $row['introduction'],
125  $row['introduction_page_id'],
126  (bool) $row['conditions_checkbox_enabled'],
127  ),
129  $test_id,
130  (bool) $row['starting_time_enabled'],
131  $row['starting_time'] !== 0
132  ? DateTimeImmutable::createFromFormat('U', (string) $row['starting_time'])
133  : null,
134  (bool) $row['ending_time_enabled'],
135  $row['ending_time'] !== 0
136  ? DateTimeImmutable::createFromFormat('U', (string) $row['ending_time'])
137  : null,
138  (bool) $row['password_enabled'],
139  $row['password'],
140  (bool) $row['fixed_participants'],
141  ),
143  $test_id,
144  $row['nr_of_tries'],
145  (bool) $row['block_after_passed'],
146  $row['pass_waiting'],
147  (bool) $row['enable_processing_time'],
148  $row['processing_time'],
149  (bool) $row['reset_processing_time'],
150  $row['kiosk'],
151  (bool) $row['examid_in_test_pass']
152  ),
154  $test_id,
155  (int) $row['title_output'],
156  (bool) $row['autosave'],
157  $row['autosave_ival'],
158  (bool) $row['shuffle_questions'],
159  (bool) $row['offer_question_hints'],
160  (bool) $row['answer_feedback_points'],
161  (bool) $row['answer_feedback'],
162  (bool) $row['specific_feedback'],
163  (bool) $row['instant_verification'],
164  (bool) $row['force_inst_fb'],
165  (bool) $row['inst_fb_answer_fixation'],
166  (bool) $row['follow_qst_answer_fixation'],
167  (bool) $row['obligations_enabled']
168  ),
170  $test_id,
171  (bool) $row['use_previous_answers'],
172  (bool) $row['suspend_test_allowed'],
173  (bool) $row['sequence_settings'],
174  $row['usr_pass_overview_mode'],
175  (bool) $row['show_marker'],
176  (bool) $row['show_questionlist']
177  ),
179  $test_id,
180  (bool) $row['enable_examview'],
181  (bool) $row['showfinalstatement'],
182  $row['finalstatement'],
183  $row['concluding_remarks_page_id'],
184  $row['redirection_mode'],
185  $row['redirection_url'],
186  $row['mailnotification'],
187  (bool) $row['mailnottype'],
188  ),
190  $test_id,
191  (bool) $row['skill_service'],
192  (bool) $row['hide_info_tab']
193  )
194  );
195 
196  return $settings;
197  }
$res
Definition: ltiservices.php:69
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFor()

ilObjTestMainSettingsDatabaseRepository::getFor ( int  $test_id)

Implements ILIAS\Test\MainSettingsRepository.

Definition at line 41 of file ilObjTestMainSettingsDatabaseRepository.php.

References doSelect().

42  {
43  $where_part = 'WHERE test_id = ' . $this->db->quote($test_id, 'integer');
44  return $this->doSelect($where_part);
45  }
+ Here is the call graph for this function:

◆ getForObjFi()

ilObjTestMainSettingsDatabaseRepository::getForObjFi ( int  $obj_fi)

Definition at line 35 of file ilObjTestMainSettingsDatabaseRepository.php.

References doSelect().

36  {
37  $where_part = 'WHERE obj_fi = ' . $this->db->quote($obj_fi, 'integer');
38  return $this->doSelect($where_part);
39  }
+ Here is the call graph for this function:

◆ store()

ilObjTestMainSettingsDatabaseRepository::store ( ilObjTestMainSettings  $settings)

Definition at line 199 of file ilObjTestMainSettingsDatabaseRepository.php.

References ilObjTestMainSettings\getAccessSettings(), ilObjTestMainSettings\getAdditionalSettings(), ilObjTestMainSettings\getFinishingSettings(), ilObjTestMainSettings\getGeneralSettings(), ilObjTestMainSettings\getIntroductionSettings(), ilObjTestMainSettings\getParticipantFunctionalitySettings(), ilObjTestMainSettings\getQuestionBehaviourSettings(), ilObjTestMainSettings\getTestBehaviourSettings(), and ilObjTestMainSettings\getTestId().

199  : void
200  {
201  $values = array_merge(
202  $settings->getGeneralSettings()->toStorage(),
203  $settings->getIntroductionSettings()->toStorage(),
204  $settings->getAccessSettings()->toStorage(),
205  $settings->getTestBehaviourSettings()->toStorage(),
206  $settings->getQuestionBehaviourSettings()->toStorage(),
207  $settings->getParticipantFunctionalitySettings()->toStorage(),
208  $settings->getFinishingSettings()->toStorage(),
209  $settings->getAdditionalSettings()->toStorage()
210  );
211 
212  $this->db->update(
213  self::TABLE_NAME,
214  $values,
215  ['test_id' => ['integer', $settings->getTestId()]]
216  );
217  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilObjTestMainSettingsDatabaseRepository::$db
protected

Definition at line 28 of file ilObjTestMainSettingsDatabaseRepository.php.

Referenced by __construct().

◆ STORAGE_DATE_FORMAT

const ilObjTestMainSettingsDatabaseRepository::STORAGE_DATE_FORMAT = 'YmdHis'

Definition at line 26 of file ilObjTestMainSettingsDatabaseRepository.php.

◆ TABLE_NAME

const ilObjTestMainSettingsDatabaseRepository::TABLE_NAME = 'tst_tests'

Definition at line 25 of file ilObjTestMainSettingsDatabaseRepository.php.


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