90 $this->sametag = FALSE;
91 $this->characterbuffer =
"";
92 $this->depth[$a_xml_parser]++;
93 $this->path[$this->depth[$a_xml_parser]] = strtolower($a_name);
94 $this->qti_element = $a_name;
96 switch (strtolower($a_name))
101 switch ($this->table)
104 if (!$this->user_criteria_checked)
106 $this->user_criteria_checked =
true;
107 if ($ilDB->tableColumnExists(
'usr_data', $a_attribs[
'user_criteria']))
109 include_once
'./Services/Database/classes/class.ilDBAnalyzer.php';
111 $info = $analyzer->getFieldInformation(
'usr_data');
112 $this->user_criteria_field = $a_attribs[
'user_criteria'];
113 $this->user_criteria_type =
$info[$a_attribs[
'user_criteria']][
'type'];
116 $usr_id = ANONYMOUS_USER_ID;
117 if (strlen($this->user_criteria_field))
119 $result = $ilDB->queryF(
"SELECT usr_id FROM usr_data WHERE " . $this->user_criteria_field .
" = %s",
120 array($this->user_criteria_type),
121 array($a_attribs[$this->user_criteria_field])
126 $usr_id =
$row[
'usr_id'];
129 $next_id = $ilDB->nextId(
'tst_active');
131 $ilDB->insert(
'tst_active',
array(
132 'active_id' =>
array(
'integer', $next_id),
133 'user_fi' =>
array(
'integer', $usr_id),
134 'anonymous_id' =>
array(
'text', strlen($a_attribs[
'anonymous_id']) ? $a_attribs[
'anonymous_id'] : NULL),
135 'test_fi' =>
array(
'integer', $this->tst_obj->getTestId()),
136 'lastindex' =>
array(
'integer', $a_attribs[
'lastindex']),
137 'tries' =>
array(
'integer', $a_attribs[
'tries']),
138 'submitted' =>
array(
'integer', $a_attribs[
'submitted']),
139 'submittimestamp' =>
array(
'timestamp', strlen($a_attribs[
'submittimestamp']) ? $a_attribs[
'submittimestamp'] : NULL),
140 'tstamp' =>
array(
'integer', $a_attribs[
'tstamp']),
141 'importname' =>
array(
'text', $a_attribs[
'fullname']),
144 'answerstatusfilter' =>
array(
'integer', $this->
fetchAttribute($a_attribs,
'answer_status_filter')),
145 'objective_container' =>
array(
'integer', $this->
fetchAttribute($a_attribs,
'objective_container'))
147 $this->active_id_mapping[$a_attribs[
'active_id']] = $next_id;
149 case 'tst_test_rnd_qst':
150 $nextId = $ilDB->nextId(
'tst_test_rnd_qst');
151 $newActiveId = $this->active_id_mapping[$a_attribs[
'active_fi']];
152 $newQuestionId = $this->question_id_mapping[$a_attribs[
'question_fi']];
153 $newSrcPoolDefId = $this->src_pool_def_id_mapping[$a_attribs[
'src_pool_def_fi']];
154 $ilDB->insert(
'tst_test_rnd_qst',
array(
155 'test_random_question_id' =>
array(
'integer', $nextId),
156 'active_fi' =>
array(
'integer', $newActiveId),
157 'question_fi' =>
array(
'integer', $newQuestionId),
158 'sequence' =>
array(
'integer', $a_attribs[
'sequence']),
159 'pass' =>
array(
'integer', $a_attribs[
'pass']),
160 'tstamp' =>
array(
'integer', $a_attribs[
'tstamp']),
161 'src_pool_def_fi' =>
array(
'integer', $newSrcPoolDefId)
164 case 'tst_pass_result':
165 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_pass_result (active_fi, pass, points, maxpoints, questioncount, answeredquestions, workingtime, tstamp) VALUES (%s,%s,%s,%s,%s,%s,%s,%s)",
177 $this->active_id_mapping[$a_attribs[
'active_fi']],
178 strlen($a_attribs[
'pass']) ? $a_attribs[
'pass'] : 0,
179 ($a_attribs[
"points"]) ? $a_attribs[
"points"] : 0,
180 ($a_attribs[
"maxpoints"]) ? $a_attribs[
"maxpoints"] : 0,
181 $a_attribs[
"questioncount"],
182 $a_attribs[
"answeredquestions"],
183 ($a_attribs[
"workingtime"]) ? $a_attribs[
"workingtime"] : 0,
188 case 'tst_result_cache':
189 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_result_cache (active_fi, pass, max_points, reached_points, mark_short, mark_official, passed, failed, tstamp) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)",
202 $this->active_id_mapping[$a_attribs[
'active_fi']],
203 strlen($a_attribs[
'pass']) ? $a_attribs[
'pass'] : 0,
204 ($a_attribs[
"max_points"]) ? $a_attribs[
"max_points"] : 0,
205 ($a_attribs[
"reached_points"]) ? $a_attribs[
"reached_points"] : 0,
206 strlen($a_attribs[
"mark_short"]) ? $a_attribs[
"mark_short"] :
" ",
207 strlen($a_attribs[
"mark_official"]) ? $a_attribs[
"mark_official"] :
" ",
208 ($a_attribs[
"passed"]) ? 1 : 0,
209 ($a_attribs[
"failed"]) ? 1 : 0,
215 $affectedRows = $ilDB->insert(
"tst_sequence",
array(
216 "active_fi" =>
array(
"integer", $this->active_id_mapping[$a_attribs[
'active_fi']]),
217 "pass" =>
array(
"integer", $a_attribs[
'pass']),
218 "sequence" =>
array(
"clob", $a_attribs[
'sequence']),
219 "postponed" =>
array(
"text", (strlen($a_attribs[
'postponed'])) ? $a_attribs[
'postponed'] : NULL),
220 "hidden" =>
array(
"text", (strlen($a_attribs[
'hidden'])) ? $a_attribs[
'hidden'] : NULL),
221 "tstamp" =>
array(
"integer", $a_attribs[
'tstamp'])
224 case 'tst_solutions':
225 $next_id = $ilDB->nextId(
'tst_solutions');
226 $affectedRows = $ilDB->insert(
"tst_solutions",
array(
227 "solution_id" =>
array(
"integer", $next_id),
228 "active_fi" =>
array(
"integer", $this->active_id_mapping[$a_attribs[
'active_fi']]),
229 "question_fi" =>
array(
"integer", $this->question_id_mapping[$a_attribs[
'question_fi']]),
230 "value1" =>
array(
"clob", (strlen($a_attribs[
'value1'])) ? $a_attribs[
'value1'] : NULL),
231 "value2" =>
array(
"clob", (strlen($a_attribs[
'value2'])) ? $a_attribs[
'value2'] : NULL),
232 "pass" =>
array(
"integer", $a_attribs[
'pass']),
233 "tstamp" =>
array(
"integer", $a_attribs[
'tstamp'])
236 case 'tst_test_result':
237 $next_id = $ilDB->nextId(
'tst_test_result');
238 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
239 array(
'integer',
'integer',
'integer',
'float',
'integer',
'integer',
'integer'),
240 array($next_id, $this->active_id_mapping[$a_attribs[
'active_fi']], $this->question_id_mapping[$a_attribs[
'question_fi']], $a_attribs[
'points'], $a_attribs[
'pass'], (strlen($a_attribs[
'manual'])) ? $a_attribs[
'manual'] : 0, $a_attribs[
'tstamp'])
244 $next_id = $ilDB->nextId(
'tst_times');
245 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
246 array(
'integer',
'integer',
'timestamp',
'timestamp',
'integer',
'integer'),
247 array($next_id, $this->active_id_mapping[$a_attribs[
'active_fi']], $a_attribs[
'started'], $a_attribs[
'finished'], $a_attribs[
'pass'], $a_attribs[
'tstamp'])
253 $this->table = $a_name;
fetchLastFinishedPass($attribs)
Create styles array
The data for the language used.
fetchLastStartedPass($attribs)
fetchAttribute($attributes, $name)
This class gives all kind of DB information using the MDB2 manager and reverse module.