This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning
Definition at line 19 of file class.assClozeGapCombination.php.
◆ clearGapCombinationsFromDb()
static assClozeGapCombination::clearGapCombinationsFromDb |
( |
|
$question_id | ) |
|
|
static |
◆ combinationExistsForQid()
assClozeGapCombination::combinationExistsForQid |
( |
|
$question_id | ) |
|
◆ getBestSolutionCombination()
assClozeGapCombination::getBestSolutionCombination |
( |
|
$question_id | ) |
|
Definition at line 246 of file class.assClozeGapCombination.php.
References $data, $DIC, $ilDB, and $lng.
249 $ilDB = $DIC[
'ilDB'];
252 $result =
$ilDB->queryF(
253 'SELECT * FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND best_solution=1 ORDER BY gap_fi',
257 if ($result->numRows() > 0) {
258 $return_string =
'<br>';
262 if ($combination_id !=
$data[
'combination_id']) {
263 $combination_id =
$data[
'combination_id'];
264 $return_string .= $points;
265 $return_string .=
'<br>';
266 $return_string .=
$data[
'answer'] .
'|';
268 $return_string .=
$data[
'answer'] .
'|';
271 $points =
' (' .
$data[
'points'] .
' ' .
$lng->txt(
'points') .
')';
273 return rtrim($return_string,
'|') . $points;
◆ getCleanCombinationArray()
assClozeGapCombination::getCleanCombinationArray |
( |
|
$question_id | ) |
|
Definition at line 66 of file class.assClozeGapCombination.php.
References ILIAS\LTI\ToolProvider\$key.
69 $combination_from_db = $assClozeGapCombinationObj->loadFromDb($question_id);
70 $clean_array = array();
71 foreach ($combination_from_db as
$key => $value) {
72 $clean_array[$value[
'cid']][$value[
'row_id']][$value[
'gap_fi']][
'answer'] = $value[
'answer'];
73 $clean_array[$value[
'cid']][$value[
'row_id']][
'points'] = $value[
'points'];
74 $clean_array[$value[
'cid']][$value[
'row_id']][$value[
'gap_fi']][
'type'] = $value[
'type'];
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ getGapsWhichAreUsedInCombination()
assClozeGapCombination::getGapsWhichAreUsedInCombination |
( |
|
$question_id | ) |
|
Definition at line 192 of file class.assClozeGapCombination.php.
References $data, $DIC, and $ilDB.
195 $ilDB = $DIC[
'ilDB'];
197 $result =
$ilDB->queryF(
198 'SELECT gap_fi, combination_id FROM ' .
$ilDB->quoteIdentifier(
'qpl_a_cloze_combi_res') .
' WHERE question_fi = %s GROUP BY gap_fi, combination_id',
203 if ($result->numRows() > 0) {
205 $gaps[
$data[
'gap_fi']] = $data[
'combination_id'];
◆ getMaxPointsForCombination()
assClozeGapCombination::getMaxPointsForCombination |
( |
int |
$question_id, |
|
|
int |
$combination_id = -1 |
|
) |
| |
Definition at line 211 of file class.assClozeGapCombination.php.
References $data, $DIC, and $ilDB.
214 $ilDB = $DIC[
'ilDB'];
216 if ($combination_id == -1) {
217 $result =
$ilDB->queryF(
218 'SELECT combination_id, points FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND best_solution=1 GROUP BY combination_id, points',
222 if ($result->numRows() > 0) {
225 $points +=
$data[
'points'];
230 $result =
$ilDB->queryF(
231 'SELECT combination_id, points FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND combination_id = %s AND best_solution=1 GROUP BY combination_id, points',
232 array(
'integer',
'integer'),
233 array($question_id, $combination_id)
235 if ($result->numRows() > 0) {
238 $points +=
$data[
'points'];
◆ importGapCombinationToDb()
static assClozeGapCombination::importGapCombinationToDb |
( |
|
$question_id, |
|
|
|
$gap_combinations |
|
) |
| |
|
static |
Definition at line 127 of file class.assClozeGapCombination.php.
References $DIC, $ilDB, and ILIAS\LTI\ToolProvider\$key.
Referenced by assClozeTestImport\fromXML().
130 $ilDB = $DIC[
'ilDB'];
132 foreach ($gap_combinations as
$key => $row) {
133 if (is_object($row)) {
134 $row = get_object_vars($row);
136 if ($question_id != -1) {
138 'INSERT INTO qpl_a_cloze_combi_res 139 (combination_id, question_fi, gap_fi, row_id, answer, points, best_solution) VALUES (%s, %s, %s, %s, %s, %s, %s)',
156 $row[
'best_solution']
◆ loadFromDb()
assClozeGapCombination::loadFromDb |
( |
|
$question_id | ) |
|
Definition at line 21 of file class.assClozeGapCombination.php.
References $data, $DIC, and $ilDB.
25 $result =
$ilDB->queryF(
27 SELECT combinations.combination_id, 32 combinations.best_solution, 33 combinations.question_fi, 35 FROM qpl_a_cloze_combi_res AS combinations 36 INNER JOIN qpl_a_cloze AS cloze 37 WHERE combinations.question_fi = cloze.question_fi 38 AND combinations.gap_fi = cloze.gap_id 39 AND combinations.question_fi = %s 40 ORDER BY combination_id, row_id, gap_fi ASC 46 $return_array = array();
48 if (isset($return_array[
$data[
'combination_id'] .
'::' .
$data[
'gap_fi']])) {
52 $return_array[$data[
'combination_id'] .
'::' . $data[
'row_id'] .
'::' . $data[
'gap_fi']] = array(
53 'cid' => $data[
'combination_id'],
54 'gap_fi' => $data[
'gap_fi'],
55 'answer' => $data[
'answer'],
56 'points' => $data[
'points'],
57 'row_id' => $data[
'row_id'],
58 'type' => $data[
'cloze_type'],
59 'best_solution' => $data[
'best_solution']
63 return array_values($return_array);
◆ saveGapCombinationToDb()
assClozeGapCombination::saveGapCombinationToDb |
( |
|
$question_id, |
|
|
|
$gap_combinations, |
|
|
|
$gap_values |
|
) |
| |
Definition at line 79 of file class.assClozeGapCombination.php.
References $DIC, $i, and $ilDB.
83 $best_solutions = array();
84 for (
$i = 0;
$i < count($gap_combinations[
'points']);
$i++) {
86 for ($j = 0; $j < count($gap_combinations[
'points'][
$i]); $j++) {
87 if ($highest_points < $gap_combinations[
'points'][
$i][$j]) {
88 $highest_points = $gap_combinations[
'points'][
$i][$j];
89 $best_solutions[
$i] = $j;
93 for (
$i = 0;
$i < count($gap_values);
$i++) {
94 for ($j = 0; $j < count($gap_values[
$i]); $j++) {
95 for ($k = 0; $k < count($gap_values[
$i][$j]); $k++) {
96 if ($best_solutions[
$i] == $j) {
102 'INSERT INTO qpl_a_cloze_combi_res 103 (combination_id, question_fi, gap_fi, row_id, answer, points, best_solution) VALUES (%s, %s, %s, %s, %s, %s, %s)',
116 $gap_combinations[
'select'][
$i][$k],
118 $gap_values[
$i][$j][$k],
119 (
float) str_replace(
',',
'.', $gap_combinations[
'points'][
$i][$j]),
The documentation for this class was generated from the following file: