|
@ -24,6 +24,7 @@ |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
defined('MOODLE_INTERNAL') || die(); |
|
|
defined('MOODLE_INTERNAL') || die(); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Plays the game "Hidden picture" |
|
|
* Plays the game "Hidden picture" |
|
|
* |
|
|
* |
|
@ -112,7 +113,13 @@ function game_hiddenpicture_continue( $id, $game, $attempt, $hiddenpicture, $con |
|
|
game_hiddenpicture_play( $id, $game, $attempt, $newrec, false, $context); |
|
|
game_hiddenpicture_play( $id, $game, $attempt, $newrec, false, $context); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Create the game_hiddenpicture record. |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Create the game_hiddenpicture record. |
|
|
|
|
|
* |
|
|
|
|
|
* @param $game |
|
|
|
|
|
* @param $attempt |
|
|
|
|
|
*/ |
|
|
function game_hiddenpicture_selectglossaryentry( $game, $attempt) { |
|
|
function game_hiddenpicture_selectglossaryentry( $game, $attempt) { |
|
|
global $CFG, $DB, $USER; |
|
|
global $CFG, $DB, $USER; |
|
|
|
|
|
|
|
@ -223,6 +230,16 @@ function game_hiddenpicture_selectglossaryentry( $game, $attempt) { |
|
|
return $newrec; |
|
|
return $newrec; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Plays the game "Hidden picture" |
|
|
|
|
|
* |
|
|
|
|
|
* @param $id |
|
|
|
|
|
* @param $game |
|
|
|
|
|
* @param $attempt |
|
|
|
|
|
* @param $hiddenpicture |
|
|
|
|
|
* @param $showsolution |
|
|
|
|
|
* @param $context |
|
|
|
|
|
*/ |
|
|
function game_hiddenpicture_play( $id, $game, $attempt, $hiddenpicture, $showsolution, $context) { |
|
|
function game_hiddenpicture_play( $id, $game, $attempt, $hiddenpicture, $showsolution, $context) { |
|
|
if ($game->toptext != '') { |
|
|
if ($game->toptext != '') { |
|
|
echo $game->toptext.'<br>'; |
|
|
echo $game->toptext.'<br>'; |
|
@ -256,6 +273,12 @@ function game_hiddenpicture_play( $id, $game, $attempt, $hiddenpicture, $showsol |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* "Hidden picture" compute score |
|
|
|
|
|
* |
|
|
|
|
|
* @param $game |
|
|
|
|
|
* @param $hiddenpicture |
|
|
|
|
|
*/ |
|
|
function game_hidden_picture_computescore( $game, $hiddenpicture) { |
|
|
function game_hidden_picture_computescore( $game, $hiddenpicture) { |
|
|
$correct = $hiddenpicture->correct; |
|
|
$correct = $hiddenpicture->correct; |
|
|
if ($hiddenpicture->found) { |
|
|
if ($hiddenpicture->found) { |
|
@ -272,6 +295,15 @@ function game_hidden_picture_computescore( $game, $hiddenpicture) { |
|
|
return $percent; |
|
|
return $percent; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Show hidden picture |
|
|
|
|
|
* |
|
|
|
|
|
* @param $id |
|
|
|
|
|
* @param $game |
|
|
|
|
|
* @param $attempt |
|
|
|
|
|
* @param $hiddenpicture |
|
|
|
|
|
* @param $showsolution |
|
|
|
|
|
*/ |
|
|
function game_hiddenpicture_showhiddenpicture( $id, $game, $attempt, $hiddenpicture, $showsolution, |
|
|
function game_hiddenpicture_showhiddenpicture( $id, $game, $attempt, $hiddenpicture, $showsolution, |
|
|
$offsetquestions, $correctquestions) { |
|
|
$offsetquestions, $correctquestions) { |
|
|
global $DB; |
|
|
global $DB; |
|
@ -300,6 +332,13 @@ function game_hiddenpicture_showhiddenpicture( $id, $game, $attempt, $hiddenpict |
|
|
game_showpicture( $id, $game, $attempt, $query, $cells, $foundcells, true); |
|
|
game_showpicture( $id, $game, $attempt, $query, $cells, $foundcells, true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* hidden picture. show question glossary |
|
|
|
|
|
* |
|
|
|
|
|
* @param $game |
|
|
|
|
|
* @param $id |
|
|
|
|
|
* @param $query |
|
|
|
|
|
*/ |
|
|
function game_hiddenpicture_showquestion_glossary( $game, $id, $query) { |
|
|
function game_hiddenpicture_showquestion_glossary( $game, $id, $query) { |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
|
|
|
|
|
|
@ -331,6 +370,16 @@ function game_hiddenpicture_showquestion_glossary( $game, $id, $query) { |
|
|
echo "</form><br>\n"; |
|
|
echo "</form><br>\n"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Check main question |
|
|
|
|
|
* |
|
|
|
|
|
* @param $id |
|
|
|
|
|
* @param $game |
|
|
|
|
|
* @param $attempt |
|
|
|
|
|
* @param $hiddenpicture |
|
|
|
|
|
* @param $finishattempt |
|
|
|
|
|
* @param $context |
|
|
|
|
|
*/ |
|
|
function game_hiddenpicture_check_mainquestion( $id, $game, &$attempt, &$hiddenpicture, $finishattempt, $context) { |
|
|
function game_hiddenpicture_check_mainquestion( $id, $game, &$attempt, &$hiddenpicture, $finishattempt, $context) { |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
|
|
|
|
|
|
@ -396,6 +445,17 @@ function game_hiddenpicture_check_mainquestion( $id, $game, &$attempt, &$hiddenp |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Show picture |
|
|
|
|
|
* |
|
|
|
|
|
* @param $id |
|
|
|
|
|
* @param $game |
|
|
|
|
|
* @param $attempt |
|
|
|
|
|
* @param $query |
|
|
|
|
|
* @param $cells |
|
|
|
|
|
* @param $foundcells |
|
|
|
|
|
* @param $usemap |
|
|
|
|
|
*/ |
|
|
function game_showpicture( $id, $game, $attempt, $query, $cells, $foundcells, $usemap) { |
|
|
function game_showpicture( $id, $game, $attempt, $query, $cells, $foundcells, $usemap) { |
|
|
global $CFG; |
|
|
global $CFG; |
|
|
|
|
|
|
|
|