@@ -151,11 +151,11 @@ function game_bookquiz_play($cm, $game, $attempt, $bookquiz, $chapterid, $contex
151151 $ chnavigation = '' ;
152152
153153 if ($ previd ) {
154- $ chnavigation .= '<a title=" ' . get_string ('navprev ' , 'book ' ). '" href="attempt.php?id= ' . $ cm ->id .
155- '&chapterid= ' . $ previd. '"><img src=" ' . game_pix_url ('bookquiz/nav_prev ' , 'mod_game ' ).
156- '" class="bigicon" alt=" ' . get_string ('navprev ' , 'book ' ). '"/></a> ' ;
154+ $ chnavigation .= '<a title=" ' . get_string ('navprev ' , 'book ' ) . '" href="attempt.php?id= ' . $ cm ->id .
155+ '&chapterid= ' . $ previd . '"><img src=" ' . game_pix_url ('bookquiz/nav_prev ' , 'mod_game ' ) .
156+ '" class="bigicon" alt=" ' . get_string ('navprev ' , 'book ' ) . '"/></a> ' ;
157157 } else {
158- $ chnavigation .= '<img src=" ' .game_pix_url ('bookquiz/nav_prev_dis ' , 'mod_game ' ). '" class="bigicon" alt="" /> ' ;
158+ $ chnavigation .= '<img src=" ' .game_pix_url ('bookquiz/nav_prev_dis ' , 'mod_game ' ) . '" class="bigicon" alt="" /> ' ;
159159 }
160160
161161 $ nextbutton = '' ;
@@ -166,8 +166,8 @@ function game_bookquiz_play($cm, $game, $attempt, $bookquiz, $chapterid, $contex
166166 game_pix_url ('bookquiz/nav_next ' , 'mod_game ' ) . '" class="bigicon" alt=" ' .get_string ('navnext ' , 'book ' ) . '" ></a> ' ;
167167 $ nextbutton = '<center> ' ;
168168 $ nextbutton .= '<form name="form" method="get" action="attempt.php"> ' ;
169- $ nextbutton .= '<input type="hidden" name="id" value=" ' . $ cm ->id . '" > ' . "\r\n" ;
170- $ nextbutton .= '<input type="hidden" name="chapterid" value=" ' . $ nextid . '" > ' . "\r\n" ;
169+ $ nextbutton .= '<input type="hidden" name="id" value=" ' . $ cm ->id . '" > ' . "\r\n" ;
170+ $ nextbutton .= '<input type="hidden" name="chapterid" value=" ' . $ nextid . '" > ' . "\r\n" ;
171171 $ nextbutton .= '<input type="submit" value=" ' . get_string ('continue ' ) . '"> ' ;
172172 $ nextbutton .= '</center> ' ;
173173 game_updateattempts_maxgrade ($ game , $ attempt , $ scoreattempt , 0 , $ cm , $ course );
@@ -176,8 +176,8 @@ function game_bookquiz_play($cm, $game, $attempt, $bookquiz, $chapterid, $contex
176176 game_updateattempts_maxgrade ($ game , $ attempt , 1 , 0 , $ cm , $ course );
177177
178178 $ chnavigation .= '<a title=" ' .get_string ('navexit ' , 'book ' ) . '" href="attempt.php?id= ' .
179- $ cm ->id . '&chapterid= ' . $ lastid. '><img src=" ' . game_pix_url ('bookquiz/nav_exit ' , 'mod_game ' ) .
180- '" class="bigicon" alt=" ' . get_string ('navexit ' , 'book ' ). '" /></a> ' ;
179+ $ cm ->id . '&chapterid= ' . $ lastid . '><img src=" ' . game_pix_url ('bookquiz/nav_exit ' , 'mod_game ' ) .
180+ '" class="bigicon" alt=" ' . get_string ('navexit ' , 'book ' ) . '" /></a> ' ;
181181 }
182182
183183 require ('toc.php ' );
@@ -229,7 +229,7 @@ function game_bookquiz_play($cm, $game, $attempt, $bookquiz, $chapterid, $contex
229229 $ modcontext = game_get_context_module_instance ($ cmbook ->id );
230230 $ content .= game_filterbook ($ chapter ->content , $ chapter ->id , $ modcontext ->id , $ game ->course );
231231
232- $ nocleanoption = new stdClass ;
232+ $ nocleanoption = new stdClass () ;
233233 $ nocleanoption ->noclean = true ;
234234 echo '<div> ' ;
235235 if ($ nextbutton != '' ) {
@@ -243,7 +243,7 @@ function game_bookquiz_play($cm, $game, $attempt, $bookquiz, $chapterid, $contex
243243 echo '</div> ' ;
244244 echo $ OUTPUT ->box_end ();
245245 // Lower navigation.
246- echo '<p align="right"> ' . $ chnavigation. '</p> ' ;
246+ echo '<p align="right"> ' . $ chnavigation . '</p> ' ;
247247 ?>
248248 </td>
249249 </tr>
@@ -260,6 +260,8 @@ function game_bookquiz_play($cm, $game, $attempt, $bookquiz, $chapterid, $contex
260260/**
261261 * Computes the last chapter.
262262 *
263+ * @package mod_game
264+ *
263265 * @param stdClass $game
264266 * @param stdClass $bookquiz
265267 */
@@ -279,8 +281,11 @@ function game_bookquiz_play_computelastchapter($game, &$bookquiz) {
279281 // Update the data in table game_bookquiz.
280282 if (($ DB ->set_field ('game_bookquiz ' , 'lastchapterid ' , $ bookquiz ->lastchapterid ,
281283 ['id ' => $ bookquiz ->id ])) == false ) {
282- throw new moodle_exception ('bookquiz_error ' , 'game ' ,
283- "Can't update table game_bookquiz with lastchapterid to $ bookquiz ->lastchapterid " );
284+ throw new moodle_exception (
285+ 'bookquiz_error ' ,
286+ 'game ' ,
287+ "Can't update table game_bookquiz with lastchapterid to $ bookquiz ->lastchapterid "
288+ );
284289 }
285290 }
286291 }
@@ -289,6 +294,8 @@ function game_bookquiz_play_computelastchapter($game, &$bookquiz) {
289294/**
290295 * Shows questions.
291296 *
297+ * @package mod_game
298+ *
292299 * @param int $id
293300 * @param int $questionid
294301 * @param int $chapterid
@@ -307,7 +314,7 @@ function game_bookquiz_showquestions($id, $questionid, $chapterid, $nextchapteri
307314 global $ CFG ;
308315
309316 // Start the form.
310- echo "<form id= \"responseform \" method= \"post \" action= \"{$ CFG ->wwwroot }/mod/game/attempt.php \" " .
317+ echo "<form id= \"responseform \" method= \"post \" action= \"{$ CFG ->wwwroot }/mod/game/attempt.php \" " .
311318 " onclick= \"this.autocomplete='off' \"> \n" ;
312319 if (($ onlyshow === false ) && ($ showsolution === false )) {
313320 echo "<center><input type= \"submit \" name= \"finishattempt \" value= \"" .get_string ('sudoku_submit ' , 'game ' )."\"></center> \n" ;
@@ -317,14 +324,14 @@ function game_bookquiz_showquestions($id, $questionid, $chapterid, $nextchapteri
317324 echo '<div> ' ;
318325 echo '<input type="hidden" name="id" value=" ' . $ id . "\" /> \n" ;
319326 echo '<input type="hidden" name="action" value="bookquizcheck" /> ' ;
320- echo '<input type="hidden" name="chapterid" value=" ' . $ chapterid. '" /> ' ;
321- echo '<input type="hidden" name="scoreattempt" value=" ' . $ scoreattempt. '" /> ' ;
322- echo '<input type="hidden" name="nextchapterid" value=" ' . $ nextchapterid. '" /> ' ;
327+ echo '<input type="hidden" name="chapterid" value=" ' . $ chapterid . '" /> ' ;
328+ echo '<input type="hidden" name="scoreattempt" value=" ' . $ scoreattempt . '" /> ' ;
329+ echo '<input type="hidden" name="nextchapterid" value=" ' . $ nextchapterid . '" /> ' ;
323330
324331 // Print all the questions.
325332
326333 // Add a hidden field with questionids.
327- echo '<input type="hidden" name="questionids" value=" ' .$ questionlist. "\" /> \n" ;
334+ echo '<input type="hidden" name="questionids" value=" ' .$ questionlist . "\" /> \n" ;
328335
329336 $ number = 0 ;
330337 foreach ($ questions as $ question ) {
@@ -335,7 +342,7 @@ function game_bookquiz_showquestions($id, $questionid, $chapterid, $nextchapteri
335342 // Finish the form.
336343 echo '</div> ' ;
337344 if (($ onlyshow === false ) && ($ showsolution === false )) {
338- echo "<center><input type= \"submit \" name= \"finishattempt \" value= \"" . get_string ('sudoku_submit ' , 'game ' ). "\"></center> \n" ;
345+ echo "<center><input type= \"submit \" name= \"finishattempt \" value= \"" . get_string ('sudoku_submit ' , 'game ' ) . "\"></center> \n" ;
339346 }
340347
341348 echo "</form> \n" ;
@@ -344,9 +351,11 @@ function game_bookquiz_showquestions($id, $questionid, $chapterid, $nextchapteri
344351/**
345352 * Selects random one question from the input list.
346353 *
354+ * @package mod_game
355+ *
347356 * @param array $questions
348357 *
349- * @return the position of the random question.
358+ * @return int: the position of the random question.
350359 */
351360function game_bookquiz_selectrandomquestion ($ questions ) {
352361 global $ DB ;
@@ -378,6 +387,8 @@ function game_bookquiz_selectrandomquestion($questions) {
378387/**
379388 * Check if the answers are correct.
380389 *
390+ * @package mod_game
391+ *
381392 * @param stdClass $cm
382393 * @param stdClass $game
383394 * @param stdClass $attempt
@@ -388,7 +399,7 @@ function game_bookquiz_selectrandomquestion($questions) {
388399function game_bookquiz_check_questions ($ cm , $ game , $ attempt , $ bookquiz , $ context , $ course ) {
389400 global $ USER , $ DB ;
390401
391- $ scoreattempt = optional_param ('scoreattempt ' , 0 , PARAM_INT );
402+ $ scoreattempt = optional_param ('scoreattempt ' , 0 , PARAM_INT );
392403 $ responses = data_submitted ();
393404
394405 $ questionlist = $ responses ->questionids ;
0 commit comments