|
@ -160,9 +160,17 @@ function game_question_shortanswer_quiz( $game, $allowspaces, $use_repetitions) |
|
|
print_error( get_string( 'must_select_quiz', 'game')); |
|
|
print_error( get_string( 'must_select_quiz', 'game')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( game_get_moodle_version() < '02.07') |
|
|
|
|
|
{ |
|
|
$select = "qtype='shortanswer' AND quiz='$game->quizid' ". |
|
|
$select = "qtype='shortanswer' AND quiz='$game->quizid' ". |
|
|
" AND qqi.question=q.id"; |
|
|
" AND qqi.question=q.id"; |
|
|
$table = "{question} q,{quiz_question_instances} qqi"; |
|
|
$table = "{question} q,{quiz_question_instances} qqi"; |
|
|
|
|
|
}else |
|
|
|
|
|
{ |
|
|
|
|
|
$select = "qtype='shortanswer' AND qs.quizid='$game->quizid' ". |
|
|
|
|
|
" AND qs.questionid=q.id"; |
|
|
|
|
|
$table = "{question} q,{quiz_slots} qs"; |
|
|
|
|
|
} |
|
|
$fields = "q.id"; |
|
|
$fields = "q.id"; |
|
|
|
|
|
|
|
|
if( ($id = game_question_selectrandom( $game, $table, $select, $fields, $use_repetitions)) == false) |
|
|
if( ($id = game_question_selectrandom( $game, $table, $select, $fields, $use_repetitions)) == false) |
|
@ -338,11 +346,22 @@ function game_questions_selectrandom( $game, $count=1) |
|
|
print_error( get_string( 'must_select_quiz', 'game')); |
|
|
print_error( get_string( 'must_select_quiz', 'game')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( game_get_moodle_version() < '02.07') |
|
|
|
|
|
{ |
|
|
$table = '{question} q, {quiz_question_instances} qqi'; |
|
|
$table = '{question} q, {quiz_question_instances} qqi'; |
|
|
$select = " qqi.quiz=$game->quizid". |
|
|
$select = " qqi.quiz=$game->quizid". |
|
|
" AND qqi.question=q.id ". |
|
|
" AND qqi.question=q.id ". |
|
|
" AND q.qtype in ('shortanswer', 'truefalse', 'multichoice')". |
|
|
" AND q.qtype in ('shortanswer', 'truefalse', 'multichoice')". |
|
|
" AND q.hidden=0"; |
|
|
" AND q.hidden=0"; |
|
|
|
|
|
}else |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$table = '{question} q, {quiz_slots} qs'; |
|
|
|
|
|
$select = " qs.quizid=$game->quizid". |
|
|
|
|
|
" AND qs.questionid=q.id ". |
|
|
|
|
|
" AND q.qtype in ('shortanswer', 'truefalse', 'multichoice')". |
|
|
|
|
|
" AND q.hidden=0"; |
|
|
|
|
|
} |
|
|
//todo 'match' |
|
|
//todo 'match' |
|
|
$field = "q.id as id"; |
|
|
$field = "q.id as id"; |
|
|
|
|
|
|
|
@ -561,6 +580,8 @@ function game_questions_shortanswer_quiz( $game) |
|
|
print_error( get_string( 'must_select_quiz', 'game')); |
|
|
print_error( get_string( 'must_select_quiz', 'game')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( game_get_moodle_version() < '02.07') |
|
|
|
|
|
{ |
|
|
$select = "qtype='shortanswer' AND quiz='$game->quizid' ". |
|
|
$select = "qtype='shortanswer' AND quiz='$game->quizid' ". |
|
|
" AND qqi.question=q.id". |
|
|
" AND qqi.question=q.id". |
|
|
" AND qa.question=q.id". |
|
|
" AND qa.question=q.id". |
|
@ -569,6 +590,17 @@ function game_questions_shortanswer_quiz( $game) |
|
|
$fields = "qa.id as qaid, q.id, q.questiontext as questiontext, ". |
|
|
$fields = "qa.id as qaid, q.id, q.questiontext as questiontext, ". |
|
|
"qa.answer as answertext, q.id as questionid,". |
|
|
"qa.answer as answertext, q.id as questionid,". |
|
|
" 0 as glossaryentryid,'' as attachment"; |
|
|
" 0 as glossaryentryid,'' as attachment"; |
|
|
|
|
|
}else |
|
|
|
|
|
{ |
|
|
|
|
|
$select = "qtype='shortanswer' AND qs.quizid='$game->quizid' ". |
|
|
|
|
|
" AND qs.questionid=q.id". |
|
|
|
|
|
" AND qa.question=q.id". |
|
|
|
|
|
" AND q.hidden=0"; |
|
|
|
|
|
$table = "{question} q,{quiz_slots} qs,{question_answers} qa"; |
|
|
|
|
|
$fields = "qa.id as qaid, q.id, q.questiontext as questiontext, ". |
|
|
|
|
|
"qa.answer as answertext, q.id as questionid,". |
|
|
|
|
|
" 0 as glossaryentryid,'' as attachment"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return game_questions_shortanswer_question_fraction( $table, $fields, $select); |
|
|
return game_questions_shortanswer_question_fraction( $table, $fields, $select); |
|
|
} |
|
|
} |
|
|