◆ clearGapCombinationsFromDb()
static assClozeGapCombination::clearGapCombinationsFromDb |
( |
|
$question_id | ) |
|
|
static |
◆ combinationExistsForQid()
assClozeGapCombination::combinationExistsForQid |
( |
|
$question_id | ) |
|
◆ getBestSolutionCombination()
assClozeGapCombination::getBestSolutionCombination |
( |
|
$question_id | ) |
|
Definition at line 242 of file class.assClozeGapCombination.php.
References $data, $ilDB, $lng, $result, and array.
246 $result = $ilDB->queryF(
'SELECT * FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND best_solution=1 ORDER BY gap_fi',
252 $return_string =
'<br>';
257 if($combination_id !=
$data[
'combination_id'])
259 $combination_id =
$data[
'combination_id'];
260 $return_string .= $points;
261 $return_string .=
'<br>';
262 $return_string .=
$data[
'answer'].
'|';
266 $return_string .=
$data[
'answer'].
'|';
269 $points =
' (' .
$data[
'points'] .
' '. $lng->txt(
'points') .
')';
271 return rtrim($return_string ,
'|') . $points;
Create styles array
The data for the language used.
◆ getCleanCombinationArray()
assClozeGapCombination::getCleanCombinationArray |
( |
|
$question_id | ) |
|
Definition at line 50 of file class.assClozeGapCombination.php.
References array.
53 $combination_from_db = $assClozeGapCombinationObj->loadFromDb($question_id);
54 $clean_array =
array();
55 foreach($combination_from_db as $key => $value)
57 $clean_array[$value[
'cid']][$value[
'row_id']][$value[
'gap_fi']][
'answer'] = $value[
'answer'];
58 $clean_array[$value[
'cid']][$value[
'row_id']][
'points'] = $value[
'points'];
59 $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 184 of file class.assClozeGapCombination.php.
References $data, $ilDB, $result, and array.
188 $result = $ilDB->queryF(
'SELECT gap_fi, combination_id FROM ' . $ilDB->quoteIdentifier(
'qpl_a_cloze_combi_res') .
' WHERE question_fi = %s GROUP BY gap_fi, combination_id',
197 $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 203 of file class.assClozeGapCombination.php.
References $data, $ilDB, $result, and array.
207 if($combination_id == -1)
209 $result = $ilDB->queryF(
'SELECT combination_id, points FROM qpl_a_cloze_combi_res WHERE question_fi = %s AND best_solution=1 GROUP BY combination_id, points',
218 $points +=
$data[
'points'];
225 $result = $ilDB->queryF(
'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',
226 array(
'integer',
'integer'),
227 array($question_id, $combination_id)
234 $points +=
$data[
'points'];
Create styles array
The data for the language used.
◆ importGapCombinationToDb()
static assClozeGapCombination::importGapCombinationToDb |
( |
|
$question_id, |
|
|
|
$gap_combinations |
|
) |
| |
|
static |
Definition at line 119 of file class.assClozeGapCombination.php.
References $ilDB, $row, and array.
Referenced by assClozeTestImport\fromXML().
123 foreach($gap_combinations as $key =>
$row)
129 if($question_id != -1)
131 $ilDB->manipulateF(
'INSERT INTO qpl_a_cloze_combi_res 132 (combination_id, question_fi, gap_fi, row_id, answer, points, best_solution) VALUES (%s, %s, %s, %s, %s, %s, %s)',
149 $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.
9 SELECT combinations.combination_id, 14 combinations.best_solution, 15 combinations.question_fi, 17 FROM qpl_a_cloze_combi_res AS combinations 18 INNER JOIN qpl_a_cloze AS cloze 19 WHERE combinations.question_fi = cloze.question_fi 20 AND combinations.gap_fi = cloze.gap_id 21 AND combinations.question_fi = %s 22 ORDER BY combination_id, row_id, gap_fi ASC 28 $return_array =
array();
31 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);
Create styles array
The data for the language used.
◆ saveGapCombinationToDb()
assClozeGapCombination::saveGapCombinationToDb |
( |
|
$question_id, |
|
|
|
$gap_combinations, |
|
|
|
$gap_values |
|
) |
| |
Definition at line 64 of file class.assClozeGapCombination.php.
References $ilDB, and array.
67 $best_solutions =
array();
68 for($i = 0; $i < count($gap_combinations[
'points']); $i++)
71 for($j = 0; $j < count($gap_combinations[
'points'][$i]); $j++)
73 if($highest_points < $gap_combinations[
'points'][$i][$j])
75 $highest_points = $gap_combinations[
'points'][$i][$j];
76 $best_solutions[$i] = $j;
80 for($i = 0; $i < count($gap_values); $i++)
82 for($j = 0; $j < count($gap_values[$i]); $j++)
84 for($k = 0; $k < count($gap_values[$i][$j]); $k++)
86 if($best_solutions[$i] == $j )
94 $ilDB->manipulateF(
'INSERT INTO qpl_a_cloze_combi_res 95 (combination_id, question_fi, gap_fi, row_id, answer, points, best_solution) VALUES (%s, %s, %s, %s, %s, %s, %s)',
108 $gap_combinations[
'select'][$i][$k],
110 $gap_values[$i][$j][$k],
111 $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: