|
@ -104,9 +104,10 @@ function game_upper( $str, $lang='') { |
|
|
* Returns the HTML of a select control. |
|
|
* Returns the HTML of a select control. |
|
|
* |
|
|
* |
|
|
* @param string $name |
|
|
* @param string $name |
|
|
* @param array a |
|
|
* @param array $a |
|
|
* @param string $input |
|
|
* @param string $input |
|
|
* @param array $events |
|
|
* @param array $events |
|
|
|
|
|
* |
|
|
* @return string the HTML |
|
|
* @return string the HTML |
|
|
*/ |
|
|
*/ |
|
|
function game_showselectcontrol( $name, $a, $input, $events='') { |
|
|
function game_showselectcontrol( $name, $a, $input, $events='') { |
|
@ -142,10 +143,10 @@ function game_showcheckbox( $name, $value) { |
|
|
/** |
|
|
/** |
|
|
* Used by hangman. Returns a short answer. |
|
|
* Used by hangman. Returns a short answer. |
|
|
* |
|
|
* |
|
|
* @param string $name |
|
|
* @param stdClass $game |
|
|
* @param array a |
|
|
* @param boolean $allowspaces |
|
|
* @param string $input |
|
|
* @param boolean $userepetitions |
|
|
* @param array $events |
|
|
* |
|
|
* @return string the HTML |
|
|
* @return string the HTML |
|
|
*/ |
|
|
*/ |
|
|
function game_question_shortanswer( $game, $allowspaces=false, $userepetitions=true) { |
|
|
function game_question_shortanswer( $game, $allowspaces=false, $userepetitions=true) { |
|
@ -165,11 +166,10 @@ function game_question_shortanswer( $game, $allowspaces=false, $userepetitions=t |
|
|
/** |
|
|
/** |
|
|
* Used by hangman. Returns a short answer from glossary. |
|
|
* Used by hangman. Returns a short answer from glossary. |
|
|
* |
|
|
* |
|
|
* @param string $name |
|
|
* @param stdClass $game |
|
|
* @param array a |
|
|
* @param boolean $allowspaces |
|
|
* @param string $input |
|
|
* @param boolean $userepetitions |
|
|
* @param array $events |
|
|
* |
|
|
* @return string the HTML |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
function game_question_shortanswer_glossary( $game, $allowspaces, $userepetitions) { |
|
|
function game_question_shortanswer_glossary( $game, $allowspaces, $userepetitions) { |
|
|
global $DB; |
|
|
global $DB; |
|
@ -215,11 +215,9 @@ function game_question_shortanswer_glossary( $game, $allowspaces, $userepetition |
|
|
/** |
|
|
/** |
|
|
* Used by hangman. Returns a short answer from quiz. |
|
|
* Used by hangman. Returns a short answer from quiz. |
|
|
* |
|
|
* |
|
|
* @param string $name |
|
|
* @param stdClass $game |
|
|
* @param array a |
|
|
* @param boolean $allowspaces |
|
|
* @param string $input |
|
|
* @param boolean $userepetitions |
|
|
* @param array $events |
|
|
|
|
|
* @return string the HTML |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
function game_question_shortanswer_quiz( $game, $allowspaces, $userepetitions) { |
|
|
function game_question_shortanswer_quiz( $game, $allowspaces, $userepetitions) { |
|
|
global $DB; |
|
|
global $DB; |
|
@ -263,10 +261,10 @@ function game_question_shortanswer_quiz( $game, $allowspaces, $userepetitions) { |
|
|
/** |
|
|
/** |
|
|
* Used by hangman. Returns a short answer from question. |
|
|
* Used by hangman. Returns a short answer from question. |
|
|
* |
|
|
* |
|
|
* @param string $name |
|
|
|
|
|
* @param stdClass $game |
|
|
* @param stdClass $game |
|
|
* @param boolean $allowspaces |
|
|
* @param boolean $allowspaces |
|
|
* @param boolean $userepetitions |
|
|
* @param boolean $userepetitions |
|
|
|
|
|
* |
|
|
* @return the short answer record |
|
|
* @return the short answer record |
|
|
*/ |
|
|
*/ |
|
|
function game_question_shortanswer_question( $game, $allowspaces, $userepetitions) { |
|
|
function game_question_shortanswer_question( $game, $allowspaces, $userepetitions) { |
|
@ -318,6 +316,7 @@ function game_question_shortanswer_question( $game, $allowspaces, $userepetition |
|
|
* @param string $select |
|
|
* @param string $select |
|
|
* @param string $idfields |
|
|
* @param string $idfields |
|
|
* @param boolean userepetitions |
|
|
* @param boolean userepetitions |
|
|
|
|
|
* |
|
|
* @return stdClass the random question |
|
|
* @return stdClass the random question |
|
|
*/ |
|
|
*/ |
|
|
function game_question_selectrandom( $game, $table, $select, $idfields='id', $userepetitions=true) { |
|
|
function game_question_selectrandom( $game, $table, $select, $idfields='id', $userepetitions=true) { |
|
@ -429,7 +428,8 @@ function game_update_repetitions( $gameid, $userid, $questionid, $glossaryentryi |
|
|
* |
|
|
* |
|
|
* @param stdClass $game |
|
|
* @param stdClass $game |
|
|
* @param int count |
|
|
* @param int count |
|
|
* @param stdClass the random record(s) |
|
|
* |
|
|
|
|
|
* @return stdClass the random record(s) |
|
|
*/ |
|
|
*/ |
|
|
function game_questions_selectrandom( $game, $count=1) { |
|
|
function game_questions_selectrandom( $game, $count=1) { |
|
|
global $DB; |
|
|
global $DB; |
|
@ -528,8 +528,9 @@ function game_questions_selectrandom( $game, $count=1) { |
|
|
* |
|
|
* |
|
|
* @param string $table |
|
|
* @param string $table |
|
|
* @param string $select |
|
|
* @param string $select |
|
|
@param int $idfield |
|
|
* @param int $idfield |
|
|
@param int $count |
|
|
* @param int $count |
|
|
|
|
|
* |
|
|
* @return stdClass the random record(s) |
|
|
* @return stdClass the random record(s) |
|
|
*/ |
|
|
*/ |
|
|
function game_questions_selectrandom_detail( $table, $select, $idfield="id", $count=1) { |
|
|
function game_questions_selectrandom_detail( $table, $select, $idfield="id", $count=1) { |
|
@ -557,7 +558,7 @@ function game_questions_selectrandom_detail( $table, $select, $idfield="id", $co |
|
|
/** |
|
|
/** |
|
|
* Tries to detect the language of word. |
|
|
* Tries to detect the language of word. |
|
|
* |
|
|
* |
|
|
* @param $word |
|
|
* @param string $word |
|
|
* |
|
|
* |
|
|
* @return the language detected |
|
|
* @return the language detected |
|
|
*/ |
|
|
*/ |
|
@ -600,9 +601,9 @@ function game_detectlanguage( $word) { |
|
|
/** |
|
|
/** |
|
|
* The words maybe are in two languages e.g. greek or english so I try to find the correct one. |
|
|
* The words maybe are in two languages e.g. greek or english so I try to find the correct one. |
|
|
* |
|
|
* |
|
|
* @param $word |
|
|
* @param string $word |
|
|
* @param $lang |
|
|
* @param string $lang |
|
|
* @param $userlanguage |
|
|
* @param string $userlanguage |
|
|
* |
|
|
* |
|
|
* @return the letters detected |
|
|
* @return the letters detected |
|
|
*/ |
|
|
*/ |
|
@ -639,8 +640,8 @@ function game_getallletters( $word, $lang='', $userlanguage='') { |
|
|
/** |
|
|
/** |
|
|
* true if exist all the letters |
|
|
* true if exist all the letters |
|
|
* |
|
|
* |
|
|
* @param $str |
|
|
* @param string $str |
|
|
* @param $strfile |
|
|
* @param string $strfile |
|
|
* |
|
|
* |
|
|
* @return the letters detected |
|
|
* @return the letters detected |
|
|
*/ |
|
|
*/ |
|
@ -659,7 +660,7 @@ function hangman_existall( $str, $strfind) { |
|
|
/** |
|
|
/** |
|
|
* return a short answer randomly selected. used by cross |
|
|
* return a short answer randomly selected. used by cross |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* |
|
|
* |
|
|
* @return a question |
|
|
* @return a question |
|
|
*/ |
|
|
*/ |
|
@ -682,7 +683,7 @@ function game_questions_shortanswer( $game) { |
|
|
/** |
|
|
/** |
|
|
* return a short answer (from glossary) randomly selected. used by cross |
|
|
* return a short answer (from glossary) randomly selected. used by cross |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* |
|
|
* |
|
|
* @return a question |
|
|
* @return a question |
|
|
*/ |
|
|
*/ |
|
@ -707,7 +708,7 @@ function game_questions_shortanswer_glossary( $game) { |
|
|
/** |
|
|
/** |
|
|
* return a short answer (from quiz) randomly selected. used by cross |
|
|
* return a short answer (from quiz) randomly selected. used by cross |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* |
|
|
* |
|
|
* @return a question |
|
|
* @return a question |
|
|
*/ |
|
|
*/ |
|
@ -744,7 +745,7 @@ function game_questions_shortanswer_quiz( $game) { |
|
|
/** |
|
|
/** |
|
|
* return a short answer (from question) randomly selected. used by cross |
|
|
* return a short answer (from question) randomly selected. used by cross |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* |
|
|
* |
|
|
* @return a question |
|
|
* @return a question |
|
|
*/ |
|
|
*/ |
|
@ -775,9 +776,9 @@ function game_questions_shortanswer_question( $game) { |
|
|
/** |
|
|
/** |
|
|
* question fraction |
|
|
* question fraction |
|
|
* |
|
|
* |
|
|
* @param $table |
|
|
* @param string $table |
|
|
* @param $field |
|
|
* @param string $fields |
|
|
* @param $select |
|
|
* @param string $select |
|
|
* |
|
|
* |
|
|
* @return the record |
|
|
* @return the record |
|
|
*/ |
|
|
*/ |
|
@ -815,9 +816,9 @@ function game_questions_shortanswer_question_fraction( $table, $fields, $select) |
|
|
/** |
|
|
/** |
|
|
* sets char |
|
|
* sets char |
|
|
* |
|
|
* |
|
|
* @param $d |
|
|
* @param string $s |
|
|
* @param $pos |
|
|
* @param int $pos |
|
|
* @param $char |
|
|
* @param string $char |
|
|
*/ |
|
|
*/ |
|
|
function game_setchar( &$s, $pos, $char) { |
|
|
function game_setchar( &$s, $pos, $char) { |
|
|
$ret = ""; |
|
|
$ret = ""; |
|
@ -832,8 +833,8 @@ function game_setchar( &$s, $pos, $char) { |
|
|
/** |
|
|
/** |
|
|
* insert a record |
|
|
* insert a record |
|
|
* |
|
|
* |
|
|
* @param $table |
|
|
* @param stdClass $table |
|
|
* @param $rec |
|
|
* @param stdClass $rec |
|
|
*/ |
|
|
*/ |
|
|
function game_insert_record( $table, $rec) { |
|
|
function game_insert_record( $table, $rec) { |
|
|
global $DB; |
|
|
global $DB; |
|
@ -862,10 +863,10 @@ function game_insert_record( $table, $rec) { |
|
|
/** |
|
|
/** |
|
|
* If score is negative doesn't update the record score is between 0 and 1. |
|
|
* If score is negative doesn't update the record score is between 0 and 1. |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* @param $attempt |
|
|
* @param stdClass $attempt |
|
|
* @param $score |
|
|
* @param float $score |
|
|
* @param $finished |
|
|
* @param boolean $finished |
|
|
* |
|
|
* |
|
|
* @return the record |
|
|
* @return the record |
|
|
*/ |
|
|
*/ |
|
@ -917,10 +918,10 @@ function game_updateattempts( $game, $attempt, $score, $finished) { |
|
|
/** |
|
|
/** |
|
|
* Computes max grade |
|
|
* Computes max grade |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* @param $attempt |
|
|
* @param stdClass $attempt |
|
|
* @param $grade |
|
|
* @param float $grade |
|
|
* @param $finished |
|
|
* @param boolean $finished |
|
|
* |
|
|
* |
|
|
* @return the record |
|
|
* @return the record |
|
|
*/ |
|
|
*/ |
|
@ -939,12 +940,12 @@ function game_updateattempts_maxgrade( $game, $attempt, $grade, $finished) { |
|
|
/** |
|
|
/** |
|
|
* Update queries |
|
|
* Update queries |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* @param $attempt |
|
|
* @param stdClass $attempt |
|
|
* @param $query |
|
|
* @param string $query |
|
|
* @param $score |
|
|
* @param float $score |
|
|
* @param $studentanswer |
|
|
* @param string $studentanswer |
|
|
* @param $updatetries |
|
|
* @param boolean $updatetries |
|
|
* |
|
|
* |
|
|
* @return the record |
|
|
* @return the record |
|
|
*/ |
|
|
*/ |
|
@ -1007,9 +1008,9 @@ function game_update_queries( $game, $attempt, $query, $score, $studentanswer, $ |
|
|
/** |
|
|
/** |
|
|
* get attempt |
|
|
* get attempt |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* @param $detail |
|
|
* @param stdclass $detail |
|
|
* @param $autoadd |
|
|
* @param boolean $autoadd |
|
|
*/ |
|
|
*/ |
|
|
function game_getattempt( $game, &$detail, $autoadd=false) { |
|
|
function game_getattempt( $game, &$detail, $autoadd=false) { |
|
|
global $DB, $USER; |
|
|
global $DB, $USER; |
|
@ -1050,6 +1051,7 @@ function game_getattempt( $game, &$detail, $autoadd=false) { |
|
|
* @param integer $gameid the game id. |
|
|
* @param integer $gameid the game id. |
|
|
* @param integer $userid the userid. |
|
|
* @param integer $userid the userid. |
|
|
* @param string $status 'all', 'finished' or 'unfinished' to control |
|
|
* @param string $status 'all', 'finished' or 'unfinished' to control |
|
|
|
|
|
* |
|
|
* @return an array of all the user's attempts at this game. Returns an empty array if there are none. |
|
|
* @return an array of all the user's attempts at this game. Returns an empty array if there are none. |
|
|
*/ |
|
|
*/ |
|
|
function game_get_user_attempts( $gameid, $userid, $status = 'finished') { |
|
|
function game_get_user_attempts( $gameid, $userid, $status = 'finished') { |
|
@ -1093,6 +1095,7 @@ function game_get_user_attempt_unfinished( $gameid, $userid) { |
|
|
* |
|
|
* |
|
|
* @param object $game the game object. |
|
|
* @param object $game the game object. |
|
|
* @param integer $userid the id of the user. |
|
|
* @param integer $userid the id of the user. |
|
|
|
|
|
* |
|
|
* @return float the user's current grade for this game. |
|
|
* @return float the user's current grade for this game. |
|
|
*/ |
|
|
*/ |
|
|
function game_get_best_score($game, $userid) { |
|
|
function game_get_best_score($game, $userid) { |
|
@ -1113,6 +1116,7 @@ function game_get_best_score($game, $userid) { |
|
|
* |
|
|
* |
|
|
* @param object $game the game object. |
|
|
* @param object $game the game object. |
|
|
* @param integer $userid the id of the user. |
|
|
* @param integer $userid the id of the user. |
|
|
|
|
|
* |
|
|
* @return float the user's current grade for this game. |
|
|
* @return float the user's current grade for this game. |
|
|
*/ |
|
|
*/ |
|
|
function game_get_best_grade($game, $userid) { |
|
|
function game_get_best_grade($game, $userid) { |
|
@ -1128,8 +1132,9 @@ function game_get_best_grade($game, $userid) { |
|
|
/** |
|
|
/** |
|
|
* Converts score to grade |
|
|
* Converts score to grade |
|
|
* |
|
|
* |
|
|
* @param $score |
|
|
* @param float $score |
|
|
* @param $grade |
|
|
* @param float $grade |
|
|
|
|
|
* |
|
|
* @return float the user's current grade for this game. |
|
|
* @return float the user's current grade for this game. |
|
|
*/ |
|
|
*/ |
|
|
function game_score_to_grade($score, $game) { |
|
|
function game_score_to_grade($score, $game) { |
|
@ -1197,7 +1202,7 @@ function game_get_reviewoptions($game, $attempt, $context=null) { |
|
|
* Compute attempt layout |
|
|
* Compute attempt layout |
|
|
* |
|
|
* |
|
|
* @param object $game the game object. |
|
|
* @param object $game the game object. |
|
|
* @param $attempt |
|
|
* @param stdClass $attempt |
|
|
* @return float the user's current grade for this game. |
|
|
* @return float the user's current grade for this game. |
|
|
*/ |
|
|
*/ |
|
|
function game_compute_attempt_layout( $game, &$attempt) { |
|
|
function game_compute_attempt_layout( $game, &$attempt) { |
|
@ -1402,10 +1407,10 @@ function game_sudoku_getquestions( $questionlist) { |
|
|
/** |
|
|
/** |
|
|
* Filter glossary |
|
|
* Filter glossary |
|
|
* |
|
|
* |
|
|
* @param $text |
|
|
* @param string $text |
|
|
* @param $entryid |
|
|
* @param int $entryid |
|
|
* @param $contextid |
|
|
* @param int $contextid |
|
|
* @param $courseid |
|
|
* @param int $courseid |
|
|
*/ |
|
|
*/ |
|
|
function game_filterglossary( $text, $entryid, $contextid, $courseid) { |
|
|
function game_filterglossary( $text, $entryid, $contextid, $courseid) { |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
@ -1440,10 +1445,10 @@ function game_filterglossary( $text, $entryid, $contextid, $courseid) { |
|
|
/** |
|
|
/** |
|
|
* Filter book |
|
|
* Filter book |
|
|
* |
|
|
* |
|
|
* @param $text |
|
|
* @param string $text |
|
|
* @param $chapterid |
|
|
* @param int $chapterid |
|
|
* @param $contextid |
|
|
* @param int $contextid |
|
|
* @param $courseid |
|
|
* @param int $courseid |
|
|
*/ |
|
|
*/ |
|
|
function game_filterbook( $text, $chapterid, $contextid, $courseid) { |
|
|
function game_filterbook( $text, $chapterid, $contextid, $courseid) { |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
@ -1478,10 +1483,10 @@ function game_filterbook( $text, $chapterid, $contextid, $courseid) { |
|
|
/** |
|
|
/** |
|
|
* Filter questio |
|
|
* Filter questio |
|
|
* |
|
|
* |
|
|
* @param $questiontext |
|
|
* @param string $questiontext |
|
|
* @param $questionid |
|
|
* @param int $questionid |
|
|
* @param $contextid |
|
|
* @param int $contextid |
|
|
* @param $courseid |
|
|
* @param int $courseid |
|
|
*/ |
|
|
*/ |
|
|
function game_filterquestion( $questiontext, $questionid, $contextid, $courseid) { |
|
|
function game_filterquestion( $questiontext, $questionid, $contextid, $courseid) { |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
@ -1516,10 +1521,10 @@ function game_filterquestion( $questiontext, $questionid, $contextid, $courseid) |
|
|
/** |
|
|
/** |
|
|
* Filter question answer |
|
|
* Filter question answer |
|
|
* |
|
|
* |
|
|
* @param $questiontext |
|
|
* @param string $questiontext |
|
|
* @param $questionid |
|
|
* @param int $questionid |
|
|
* @param $contextid |
|
|
* @param int $contextid |
|
|
* @param $courseid |
|
|
* @param int $courseid |
|
|
*/ |
|
|
*/ |
|
|
function game_filterquestion_answer( $questiontext, $questionid, $contextid, $courseid) { |
|
|
function game_filterquestion_answer( $questiontext, $questionid, $contextid, $courseid) { |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
@ -1553,8 +1558,8 @@ function game_filterquestion_answer( $questiontext, $questionid, $contextid, $co |
|
|
/** |
|
|
/** |
|
|
* Filter text |
|
|
* Filter text |
|
|
* |
|
|
* |
|
|
* @param $text |
|
|
* @param string $text |
|
|
* @param $courseid |
|
|
* @param int $courseid |
|
|
*/ |
|
|
*/ |
|
|
function game_filtertext( $text, $courseid) { |
|
|
function game_filtertext( $text, $courseid) { |
|
|
$formatoptions = new stdClass(); |
|
|
$formatoptions = new stdClass(); |
|
@ -1580,7 +1585,7 @@ function game_filtertext( $text, $courseid) { |
|
|
/** |
|
|
/** |
|
|
* To javascript string |
|
|
* To javascript string |
|
|
* |
|
|
* |
|
|
* @param $text |
|
|
* @param string $text |
|
|
*/ |
|
|
*/ |
|
|
function game_tojavascriptstring( $text) { |
|
|
function game_tojavascriptstring( $text) { |
|
|
$from = array('"', "\r", "\n"); |
|
|
$from = array('"', "\r", "\n"); |
|
@ -1597,7 +1602,7 @@ function game_tojavascriptstring( $text) { |
|
|
/** |
|
|
/** |
|
|
* Repair question |
|
|
* Repair question |
|
|
* |
|
|
* |
|
|
* @param $s |
|
|
* @param string $s |
|
|
*/ |
|
|
*/ |
|
|
function game_repairquestion( $s) { |
|
|
function game_repairquestion( $s) { |
|
|
if (substr( $s, 0, 3) == '<p>') { |
|
|
if (substr( $s, 0, 3) == '<p>') { |
|
@ -1627,8 +1632,8 @@ function game_repairquestion( $s) { |
|
|
/** |
|
|
/** |
|
|
* Delete a game attempt. |
|
|
* Delete a game attempt. |
|
|
* |
|
|
* |
|
|
* @param $attempt |
|
|
* @param stdClass $attempt |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
*/ |
|
|
*/ |
|
|
function game_delete_attempt($attempt, $game) { |
|
|
function game_delete_attempt($attempt, $game) { |
|
|
global $DB; |
|
|
global $DB; |
|
@ -1700,7 +1705,7 @@ function game_get_grading_option_name($option) { |
|
|
/** |
|
|
/** |
|
|
* Right to left. |
|
|
* Right to left. |
|
|
* |
|
|
* |
|
|
* @param $lang |
|
|
* @param string $lang |
|
|
*/ |
|
|
*/ |
|
|
function game_right_to_left( $lang) { |
|
|
function game_right_to_left( $lang) { |
|
|
return ( get_string_manager()->get_string('thisdirection', 'langconfig', null, $lang) == 'rtl'); |
|
|
return ( get_string_manager()->get_string('thisdirection', 'langconfig', null, $lang) == 'rtl'); |
|
@ -1709,9 +1714,9 @@ function game_right_to_left( $lang) { |
|
|
/** |
|
|
/** |
|
|
* Compute reverse print |
|
|
* Compute reverse print |
|
|
* |
|
|
* |
|
|
* @param $attempt |
|
|
* @param stdClass $attempt |
|
|
* @param $wordctrl |
|
|
* @param string $wordctrl |
|
|
* @param $reverseprint |
|
|
* @param boolean $reverseprint |
|
|
*/ |
|
|
*/ |
|
|
function game_compute_reserve_print( $attempt, &$wordrtl, &$reverseprint) { |
|
|
function game_compute_reserve_print( $attempt, &$wordrtl, &$reverseprint) { |
|
|
if (function_exists( 'right_to_left')) { |
|
|
if (function_exists( 'right_to_left')) { |
|
@ -1730,9 +1735,9 @@ function game_compute_reserve_print( $attempt, &$wordrtl, &$reverseprint) { |
|
|
/** |
|
|
/** |
|
|
* select from repetitions |
|
|
* select from repetitions |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* @param $recs |
|
|
* @param stdClass $recs |
|
|
* @param $need |
|
|
* @param booolean $need |
|
|
*/ |
|
|
*/ |
|
|
function game_select_from_repetitions( $game, $recs, $need) { |
|
|
function game_select_from_repetitions( $game, $recs, $need) { |
|
|
global $DB, $USER; |
|
|
global $DB, $USER; |
|
@ -1778,11 +1783,11 @@ function game_select_from_repetitions( $game, $recs, $need) { |
|
|
/** |
|
|
/** |
|
|
* Grades responses |
|
|
* Grades responses |
|
|
* |
|
|
* |
|
|
* @param $question |
|
|
* @param stdClass $question |
|
|
* @param $responses |
|
|
* @param array $responses |
|
|
* @param $maxgrade |
|
|
* @param int $maxgrade |
|
|
* @param $answertext |
|
|
* @param string $answertext |
|
|
* @param $answered |
|
|
* @param boolean $answered |
|
|
*/ |
|
|
*/ |
|
|
function game_grade_responses( $question, $responses, $maxgrade, &$answertext, &$answered) { |
|
|
function game_grade_responses( $question, $responses, $maxgrade, &$answertext, &$answered) { |
|
|
$answered = true; |
|
|
$answered = true; |
|
@ -1822,10 +1827,10 @@ function game_grade_responses( $question, $responses, $maxgrade, &$answertext, & |
|
|
/** |
|
|
/** |
|
|
* Responses multianswer |
|
|
* Responses multianswer |
|
|
* |
|
|
* |
|
|
* @param $question |
|
|
* @param stdClass $question |
|
|
* @param $responses |
|
|
* @param array $responses |
|
|
* @param $maxgrade |
|
|
* @param int $maxgrade |
|
|
* @param $answertext |
|
|
* @param string $answertext |
|
|
*/ |
|
|
*/ |
|
|
function game_grade_responses_multianswer( $question, $responses, $maxgrade, &$answertext) { |
|
|
function game_grade_responses_multianswer( $question, $responses, $maxgrade, &$answertext) { |
|
|
$name = "resp{$question->id}_"; |
|
|
$name = "resp{$question->id}_"; |
|
@ -1850,9 +1855,9 @@ function game_grade_responses_multianswer( $question, $responses, $maxgrade, &$a |
|
|
/** |
|
|
/** |
|
|
* Print question |
|
|
* Print question |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* @param $question |
|
|
* @param string $question |
|
|
* @param $context |
|
|
* @param stdClass $context |
|
|
*/ |
|
|
*/ |
|
|
function game_print_question( $game, $question, $context) { |
|
|
function game_print_question( $game, $question, $context) { |
|
|
if ($question->qtype == 'multichoice') { |
|
|
if ($question->qtype == 'multichoice') { |
|
@ -1869,9 +1874,9 @@ function game_print_question( $game, $question, $context) { |
|
|
/** |
|
|
/** |
|
|
* Print question multichoice |
|
|
* Print question multichoice |
|
|
* |
|
|
* |
|
|
* @param $game |
|
|
* @param stdClass $game |
|
|
* @param $question |
|
|
* @param string $question |
|
|
* @param $context |
|
|
* @param stdClass $context |
|
|
*/ |
|
|
*/ |
|
|
function game_print_question_multichoice( $game, $question, $context) { |
|
|
function game_print_question_multichoice( $game, $question, $context) { |
|
|
global $CFG; |
|
|
global $CFG; |
|
@ -1933,8 +1938,8 @@ foreach ($anss as $answer) { |
|
|
* Print question multianswer |
|
|
* Print question multianswer |
|
|
* |
|
|
* |
|
|
* @param object $game the game object. |
|
|
* @param object $game the game object. |
|
|
* @param $question |
|
|
* @param stdClass $question |
|
|
* @param $context |
|
|
* @param stdClass $context |
|
|
*/ |
|
|
*/ |
|
|
function game_print_question_multianswer( $game, $question, $context) { |
|
|
function game_print_question_multianswer( $game, $question, $context) { |
|
|
global $CFG; |
|
|
global $CFG; |
|
@ -1997,7 +2002,7 @@ foreach ($anss as $answer) { |
|
|
* |
|
|
* |
|
|
* @param stdClass $game |
|
|
* @param stdClass $game |
|
|
* @param stdClass $question |
|
|
* @param stdClass $question |
|
|
* @param $context |
|
|
* @param stdClass $context |
|
|
*/ |
|
|
*/ |
|
|
function game_print_question_shortanswer( $game, $question, $context) { |
|
|
function game_print_question_shortanswer( $game, $question, $context) { |
|
|
$questiontext = $question->questiontext; |
|
|
$questiontext = $question->questiontext; |
|
@ -2157,9 +2162,9 @@ function game_export_createtempdir() { |
|
|
/** |
|
|
/** |
|
|
* Create zip |
|
|
* Create zip |
|
|
* |
|
|
* |
|
|
* @param $srcdir |
|
|
* @param string $srcdir |
|
|
* @param $couseid |
|
|
* @param int $courseid |
|
|
* @param $filename |
|
|
* @param string $filename |
|
|
*/ |
|
|
*/ |
|
|
function game_create_zip( $srcdir, $courseid, $filename) { |
|
|
function game_create_zip( $srcdir, $courseid, $filename) { |
|
|
global $CFG; |
|
|
global $CFG; |
|
@ -2193,9 +2198,9 @@ function game_create_zip( $srcdir, $courseid, $filename) { |
|
|
/** |
|
|
/** |
|
|
* Get string lang |
|
|
* Get string lang |
|
|
* |
|
|
* |
|
|
* @param $identifier |
|
|
* @param string $identifier |
|
|
* @param $module |
|
|
* @param string $module |
|
|
* @param $lang |
|
|
* @param string $lang |
|
|
*/ |
|
|
*/ |
|
|
function game_get_string_lang( $identifier, $module, $lang) { |
|
|
function game_get_string_lang( $identifier, $module, $lang) { |
|
|
global $CFG; |
|
|
global $CFG; |
|
@ -2206,9 +2211,9 @@ function game_get_string_lang( $identifier, $module, $lang) { |
|
|
/** |
|
|
/** |
|
|
* Get string from file |
|
|
* Get string from file |
|
|
* |
|
|
* |
|
|
* @param $identifier |
|
|
* @param string $identifier |
|
|
* @param $lanfile |
|
|
* @param string $lanfile |
|
|
* @param $destination |
|
|
* @param string $destination |
|
|
*/ |
|
|
*/ |
|
|
function get_string_from_file($identifier, $langfile, $destination) { |
|
|
function get_string_from_file($identifier, $langfile, $destination) { |
|
|
static $strings; // Keep the strings cached in memory. |
|
|
static $strings; // Keep the strings cached in memory. |
|
@ -2277,13 +2282,13 @@ function game_get_contexts() { |
|
|
/** |
|
|
/** |
|
|
* Export split files |
|
|
* Export split files |
|
|
* |
|
|
* |
|
|
* @param $courseid |
|
|
* @param int $courseid |
|
|
* @param $context |
|
|
* @param stdClass $context |
|
|
* @param $filearea |
|
|
* @param string $filearea |
|
|
* @param $id |
|
|
* @param int $id |
|
|
* @param $line |
|
|
* @param string $line |
|
|
* @param $destdir |
|
|
* @param string $destdir |
|
|
* @pram $files |
|
|
* @pram array $files |
|
|
*/ |
|
|
*/ |
|
|
function game_export_split_files( $courseid, $context, $filearea, $id, $line, $destdir, &$files) { |
|
|
function game_export_split_files( $courseid, $context, $filearea, $id, $line, $destdir, &$files) { |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
@ -2346,7 +2351,7 @@ function game_export_split_files( $courseid, $context, $filearea, $id, $line, $d |
|
|
/** |
|
|
/** |
|
|
* Grade questions |
|
|
* Grade questions |
|
|
* |
|
|
* |
|
|
* @param $questions |
|
|
* @param array $questions |
|
|
*/ |
|
|
*/ |
|
|
function game_grade_questions( $questions) { |
|
|
function game_grade_questions( $questions) { |
|
|
$grades = array(); |
|
|
$grades = array(); |
|
@ -2445,7 +2450,7 @@ function game_can_start_new_attempt( $game) { |
|
|
/** |
|
|
/** |
|
|
* strlen |
|
|
* strlen |
|
|
* |
|
|
* |
|
|
* @param $str |
|
|
* @param string $str |
|
|
*/ |
|
|
*/ |
|
|
function game_strlen( $str) { |
|
|
function game_strlen( $str) { |
|
|
if (game_get_moodle_version() >= '02.08') { |
|
|
if (game_get_moodle_version() >= '02.08') { |
|
@ -2489,7 +2494,7 @@ function game_substr() { |
|
|
/** |
|
|
/** |
|
|
* strtoupper |
|
|
* strtoupper |
|
|
* |
|
|
* |
|
|
* @param $str |
|
|
* @param string $str |
|
|
*/ |
|
|
*/ |
|
|
function game_strtoupper( $str) { |
|
|
function game_strtoupper( $str) { |
|
|
if (game_get_moodle_version() >= '02.08') { |
|
|
if (game_get_moodle_version() >= '02.08') { |
|
@ -2507,9 +2512,9 @@ function game_strtoupper( $str) { |
|
|
/** |
|
|
/** |
|
|
* strpos |
|
|
* strpos |
|
|
* |
|
|
* |
|
|
* @param $haystack |
|
|
* @param string $haystack |
|
|
* @param $needle |
|
|
* @param string $needle |
|
|
* @param $offset |
|
|
* @param int $offset |
|
|
*/ |
|
|
*/ |
|
|
function game_strpos( $haystack, $needle, $offset = 0) { |
|
|
function game_strpos( $haystack, $needle, $offset = 0) { |
|
|
if (game_get_moodle_version() >= '02.08') { |
|
|
if (game_get_moodle_version() >= '02.08') { |
|
@ -2527,8 +2532,8 @@ function game_strpos( $haystack, $needle, $offset = 0) { |
|
|
* show query |
|
|
* show query |
|
|
* |
|
|
* |
|
|
* @param object $game the game |
|
|
* @param object $game the game |
|
|
* @param $query |
|
|
* @param stdClass $query |
|
|
* @param $text |
|
|
* @param string $text |
|
|
*/ |
|
|
*/ |
|
|
function game_show_query( $game, $query, $text) { |
|
|
function game_show_query( $game, $query, $text) { |
|
|
if ($game->glossaryid) { |
|
|
if ($game->glossaryid) { |
|
|