◆ clearGapCombinationsFromDb()
static assClozeGapCombination::clearGapCombinationsFromDb |
( |
|
$question_id | ) |
|
|
static |
◆ combinationExistsForQid()
assClozeGapCombination::combinationExistsForQid |
( |
|
$question_id | ) |
|
◆ getBestSolutionCombination()
assClozeGapCombination::getBestSolutionCombination |
( |
|
$question_id | ) |
|
Definition at line 230 of file class.assClozeGapCombination.php.
References $data, $DIC, $ilDB, $lng, and $result.
233 $ilDB = $DIC[
'ilDB'];
237 'SELECT * FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND best_solution=1 ORDER BY gap_fi',
242 $return_string =
'<br>';
246 if ($combination_id !=
$data[
'combination_id']) {
247 $combination_id =
$data[
'combination_id'];
248 $return_string .= $points;
249 $return_string .=
'<br>';
250 $return_string .=
$data[
'answer'] .
'|';
252 $return_string .=
$data[
'answer'] .
'|';
255 $points =
' (' .
$data[
'points'] .
' ' .
$lng->txt(
'points') .
')';
257 return rtrim($return_string,
'|') . $points;
◆ getCleanCombinationArray()
assClozeGapCombination::getCleanCombinationArray |
( |
|
$question_id | ) |
|
Definition at line 50 of file class.assClozeGapCombination.php.
References $key.
53 $combination_from_db = $assClozeGapCombinationObj->loadFromDb($question_id);
54 $clean_array = array();
55 foreach ($combination_from_db as
$key => $value) {
56 $clean_array[$value[
'cid']][$value[
'row_id']][$value[
'gap_fi']][
'answer'] = $value[
'answer'];
57 $clean_array[$value[
'cid']][$value[
'row_id']][
'points'] = $value[
'points'];
58 $clean_array[$value[
'cid']][$value[
'row_id']][$value[
'gap_fi']][
'type'] = $value[
'type'];
◆ getGapsWhichAreUsedInCombination()
assClozeGapCombination::getGapsWhichAreUsedInCombination |
( |
|
$question_id | ) |
|
◆ getMaxPointsForCombination()
assClozeGapCombination::getMaxPointsForCombination |
( |
|
$question_id, |
|
|
|
$combination_id = -1 |
|
) |
| |
Definition at line 195 of file class.assClozeGapCombination.php.
References $data, $DIC, $ilDB, and $result.
198 $ilDB = $DIC[
'ilDB'];
200 if ($combination_id == -1) {
202 'SELECT combination_id, points FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND best_solution=1 GROUP BY combination_id, points',
209 $points +=
$data[
'points'];
215 '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',
216 array(
'integer',
'integer'),
217 array($question_id, $combination_id)
222 $points +=
$data[
'points'];
◆ importGapCombinationToDb()
static assClozeGapCombination::importGapCombinationToDb |
( |
|
$question_id, |
|
|
|
$gap_combinations |
|
) |
| |
|
static |
Definition at line 111 of file class.assClozeGapCombination.php.
References $DIC, $ilDB, $key, and $row.
Referenced by assClozeTestImport\fromXML().
114 $ilDB = $DIC[
'ilDB'];
116 foreach ($gap_combinations as
$key =>
$row) {
117 if (is_object(
$row)) {
120 if ($question_id != -1) {
122 'INSERT INTO qpl_a_cloze_combi_res 123 (combination_id, question_fi, gap_fi, row_id, answer, points, best_solution) VALUES (%s, %s, %s, %s, %s, %s, %s)',
140 $row[
'best_solution']
◆ loadFromDb()
assClozeGapCombination::loadFromDb |
( |
|
$question_id | ) |
|
Definition at line 5 of file class.assClozeGapCombination.php.
References $data, $DIC, $ilDB, and $result.
11 SELECT combinations.combination_id, 16 combinations.best_solution, 17 combinations.question_fi, 19 FROM qpl_a_cloze_combi_res AS combinations 20 INNER JOIN qpl_a_cloze AS cloze 21 WHERE combinations.question_fi = cloze.question_fi 22 AND combinations.gap_fi = cloze.gap_id 23 AND combinations.question_fi = %s 24 ORDER BY combination_id, row_id, gap_fi ASC 30 $return_array = array();
32 if (isset($return_array[
$data[
'combination_id'] .
'::' .
$data[
'gap_fi']])) {
36 $return_array[$data[
'combination_id'] .
'::' . $data[
'row_id'] .
'::' . $data[
'gap_fi']] = array(
37 'cid' => $data[
'combination_id'],
38 'gap_fi' => $data[
'gap_fi'],
39 'answer' => $data[
'answer'],
40 'points' => $data[
'points'],
41 'row_id' => $data[
'row_id'],
42 'type' => $data[
'cloze_type'],
43 'best_solution' => $data[
'best_solution']
47 return array_values($return_array);
◆ saveGapCombinationToDb()
assClozeGapCombination::saveGapCombinationToDb |
( |
|
$question_id, |
|
|
|
$gap_combinations, |
|
|
|
$gap_values |
|
) |
| |
Definition at line 63 of file class.assClozeGapCombination.php.
References $DIC, $i, and $ilDB.
67 $best_solutions = array();
68 for (
$i = 0;
$i < count($gap_combinations[
'points']);
$i++) {
70 for ($j = 0; $j < count($gap_combinations[
'points'][
$i]); $j++) {
71 if ($highest_points < $gap_combinations[
'points'][
$i][$j]) {
72 $highest_points = $gap_combinations[
'points'][
$i][$j];
73 $best_solutions[
$i] = $j;
77 for (
$i = 0;
$i < count($gap_values);
$i++) {
78 for ($j = 0; $j < count($gap_values[
$i]); $j++) {
79 for ($k = 0; $k < count($gap_values[
$i][$j]); $k++) {
80 if ($best_solutions[
$i] == $j) {
86 'INSERT INTO qpl_a_cloze_combi_res 87 (combination_id, question_fi, gap_fi, row_id, answer, points, best_solution) VALUES (%s, %s, %s, %s, %s, %s, %s)',
100 $gap_combinations[
'select'][
$i][$k],
102 $gap_values[
$i][$j][$k],
103 $gap_combinations[
'points'][
$i][$j],
The documentation for this class was generated from the following file: