◆ clearGapCombinationsFromDb()
static assClozeGapCombination::clearGapCombinationsFromDb |
( |
|
$question_id | ) |
|
|
static |
◆ combinationExistsForQid()
assClozeGapCombination::combinationExistsForQid |
( |
|
$question_id | ) |
|
◆ getBestSolutionCombination()
assClozeGapCombination::getBestSolutionCombination |
( |
|
$question_id | ) |
|
Definition at line 223 of file class.assClozeGapCombination.php.
References $data, $ilDB, $lng, $result, and array.
228 'SELECT * FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND best_solution=1 ORDER BY gap_fi',
233 $return_string =
'<br>';
237 if ($combination_id !=
$data[
'combination_id']) {
238 $combination_id =
$data[
'combination_id'];
239 $return_string .= $points;
240 $return_string .=
'<br>';
241 $return_string .=
$data[
'answer'] .
'|';
243 $return_string .=
$data[
'answer'] .
'|';
246 $points =
' (' .
$data[
'points'] .
' ' . $lng->txt(
'points') .
')';
248 return rtrim($return_string,
'|') . $points;
Create styles array
The data for the language used.
◆ getCleanCombinationArray()
assClozeGapCombination::getCleanCombinationArray |
( |
|
$question_id | ) |
|
Definition at line 49 of file class.assClozeGapCombination.php.
References $key, and array.
52 $combination_from_db = $assClozeGapCombinationObj->loadFromDb($question_id);
53 $clean_array =
array();
54 foreach ($combination_from_db as
$key => $value) {
55 $clean_array[$value[
'cid']][$value[
'row_id']][$value[
'gap_fi']][
'answer'] = $value[
'answer'];
56 $clean_array[$value[
'cid']][$value[
'row_id']][
'points'] = $value[
'points'];
57 $clean_array[$value[
'cid']][$value[
'row_id']][$value[
'gap_fi']][
'type'] = $value[
'type'];
Create styles array
The data for the language used.
◆ getGapsWhichAreUsedInCombination()
assClozeGapCombination::getGapsWhichAreUsedInCombination |
( |
|
$question_id | ) |
|
Definition at line 171 of file class.assClozeGapCombination.php.
References $data, $ilDB, $result, and array.
176 'SELECT gap_fi, combination_id FROM ' . $ilDB->quoteIdentifier(
'qpl_a_cloze_combi_res') .
' WHERE question_fi = %s GROUP BY gap_fi, combination_id',
183 $gaps[
$data[
'gap_fi']] = $data[
'combination_id'];
Create styles array
The data for the language used.
◆ getMaxPointsForCombination()
assClozeGapCombination::getMaxPointsForCombination |
( |
|
$question_id, |
|
|
|
$combination_id = -1 |
|
) |
| |
Definition at line 189 of file class.assClozeGapCombination.php.
References $data, $ilDB, $result, and array.
193 if ($combination_id == -1) {
195 'SELECT combination_id, points FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND best_solution=1 GROUP BY combination_id, points',
202 $points +=
$data[
'points'];
208 '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',
209 array(
'integer',
'integer'),
210 array($question_id, $combination_id)
215 $points +=
$data[
'points'];
Create styles array
The data for the language used.
◆ importGapCombinationToDb()
static assClozeGapCombination::importGapCombinationToDb |
( |
|
$question_id, |
|
|
|
$gap_combinations |
|
) |
| |
|
static |
Definition at line 109 of file class.assClozeGapCombination.php.
References $ilDB, $key, $row, and array.
Referenced by assClozeTestImport\fromXML().
113 foreach ($gap_combinations as
$key =>
$row) {
114 if (is_object(
$row)) {
117 if ($question_id != -1) {
119 'INSERT INTO qpl_a_cloze_combi_res 120 (combination_id, question_fi, gap_fi, row_id, answer, points, best_solution) VALUES (%s, %s, %s, %s, %s, %s, %s)',
137 $row[
'best_solution']
Create styles array
The data for the language used.
◆ loadFromDb()
assClozeGapCombination::loadFromDb |
( |
|
$question_id | ) |
|
Definition at line 5 of file class.assClozeGapCombination.php.
References $data, $ilDB, $result, and array.
10 SELECT combinations.combination_id, 15 combinations.best_solution, 16 combinations.question_fi, 18 FROM qpl_a_cloze_combi_res AS combinations 19 INNER JOIN qpl_a_cloze AS cloze 20 WHERE combinations.question_fi = cloze.question_fi 21 AND combinations.gap_fi = cloze.gap_id 22 AND combinations.question_fi = %s 23 ORDER BY combination_id, row_id, gap_fi ASC 29 $return_array =
array();
31 if (isset($return_array[
$data[
'combination_id'] .
'::' .
$data[
'gap_fi']])) {
35 $return_array[$data[
'combination_id'] .
'::' . $data[
'row_id'] .
'::' . $data[
'gap_fi']]=
array(
36 'cid' => $data[
'combination_id'],
37 'gap_fi' => $data[
'gap_fi'],
38 'answer' => $data[
'answer'],
39 'points' => $data[
'points'],
40 'row_id' => $data[
'row_id'],
41 'type' => $data[
'cloze_type'],
42 'best_solution' => $data[
'best_solution']
46 return array_values($return_array);
Create styles array
The data for the language used.
◆ saveGapCombinationToDb()
assClozeGapCombination::saveGapCombinationToDb |
( |
|
$question_id, |
|
|
|
$gap_combinations, |
|
|
|
$gap_values |
|
) |
| |
Definition at line 62 of file class.assClozeGapCombination.php.
References $i, $ilDB, and array.
65 $best_solutions =
array();
66 for (
$i = 0;
$i < count($gap_combinations[
'points']);
$i++) {
68 for ($j = 0; $j < count($gap_combinations[
'points'][
$i]); $j++) {
69 if ($highest_points < $gap_combinations[
'points'][
$i][$j]) {
70 $highest_points = $gap_combinations[
'points'][
$i][$j];
71 $best_solutions[
$i] = $j;
75 for (
$i = 0;
$i < count($gap_values);
$i++) {
76 for ($j = 0; $j < count($gap_values[
$i]); $j++) {
77 for ($k = 0; $k < count($gap_values[
$i][$j]); $k++) {
78 if ($best_solutions[
$i] == $j) {
84 'INSERT INTO qpl_a_cloze_combi_res 85 (combination_id, question_fi, gap_fi, row_id, answer, points, best_solution) VALUES (%s, %s, %s, %s, %s, %s, %s)',
98 $gap_combinations[
'select'][
$i][$k],
100 $gap_values[
$i][$j][$k],
101 $gap_combinations[
'points'][
$i][$j],
Create styles array
The data for the language used.
The documentation for this class was generated from the following file: