function game_OnExportHTML_millionaire($game, $html, $destdir) { global $CFG, $DB; if ($html->filename == '') { $html->filename = 'millionaire'; } $filename = $html->filename . '.htm'; $ret = game_export_printheader($html->title, false); $ret .= "\r<body onload=\"Reset();\">\r"; //Here is the code of millionaire require "exporthtml_millionaire.php"; $questions = game_millionaire_html_getquestions($game, $maxquestions); ob_start(); game_millionaire_html_print($game, $questions, $maxquestions); //End of millionaire code $output_string = ob_get_contents(); ob_end_clean(); $courseid = $game->course; $course = $DB->get_record('course', array('id' => $courseid)); $filename = $html->filename . '.htm'; file_put_contents($destdir . '/' . $filename, $ret . "\r\n" . $output_string); //Copy the standard pictures of Millionaire $src = $CFG->dirroot . '/mod/game/millionaire/1'; $handle = opendir($src); while (false !== ($item = readdir($handle))) { if ($item != '.' && $item != '..') { if (!is_dir($src . '/' . $item)) { $itemdest = $item; if (strpos($item, '.') === false) { continue; } copy($src . '/' . $item, $destdir . '/' . $itemdest); } } } $filezip = game_create_zip($destdir, $courseid, $html->filename . '.zip'); game_send_stored_file($filezip); }
function game_OnExportHTML_snakes($game, $html, $destdir) { require_once "exporthtml_millionaire.php"; global $CFG, $DB; if ($html->filename == '') { $html->filename = 'snakes'; } $filename = $html->filename . '.htm'; $ret = ''; $board = game_snakes_get_board($game); if ($game->sourcemodule == 'quiz' or $game->sourcemodule == 'question') { $questionsM = game_millionaire_html_getquestions($game, $context, $maxquestions, $countofquestionsM, $retfeedback, $files); } else { $questionsM = array(); $countofquestionsM = 0; $retfeedback = ''; } $questionsS = game_exmportjavame_getanswers($game, false); ob_start(); //Here is the code of hangman require "exporthtml_snakes.php"; $output_string = ob_get_contents(); ob_end_clean(); $courseid = $game->course; $course = $DB->get_record('course', array('id' => $courseid)); $filename = $html->filename . '.htm'; file_put_contents($destdir . '/' . $filename, $ret . "\r\n" . $output_string); $src = $CFG->dirroot . '/mod/game/export/html/snakes'; game_copyfiles($src, $destdir); mkdir($destdir . '/css'); $src = $CFG->dirroot . '/mod/game/export/html/snakes/css'; game_copyfiles($src, $destdir . '/css'); mkdir($destdir . '/js'); $src = $CFG->dirroot . '/mod/game/export/html/snakes/js'; game_copyfiles($src, $destdir . '/js'); mkdir($destdir . '/images'); $destfile = $destdir . '/images/' . $board->fileboard; if ($game->param3 != 0) { //Is a standard board copy($board->imagesrc, $destfile); } else { $cmg = get_coursemodule_from_instance('game', $game->id, $game->course); $modcontext = get_context_instance(CONTEXT_MODULE, $cmg->id); $fs = get_file_storage(); $files = $fs->get_area_files($modcontext->id, 'mod_game', 'snakes_board', $game->id); foreach ($files as $f) { if ($f->is_directory()) { continue; } break; } $f->copy_content_to($destfile); } $a = array('player1.png', 'dice1.png', 'dice2.png', 'dice3.png', 'dice4.png', 'dice5.png', 'dice6.png', 'numbers.png'); foreach ($a as $file) { copy($CFG->dirroot . '/mod/game/snakes/1/' . $file, $destdir . '/images/' . $file); } $filezip = game_create_zip($destdir, $courseid, $html->filename . '.zip'); game_send_stored_file($filezip); }
$max = count($recs2); } } return $ret; } $maxquestions = 0; ?> <body onload="Reset();"> <script type="text/javascript"> //Millionaire for Moodle by Vasilis Daloukas <?php echo 'var questions = new Array(' . game_millionaire_html_getquestions($game, $maxquestions) . ");\r"; ?> var current_question = 0; var level = 0; var posCorrect = 0; var infoCorrect = ""; var flag5050 = 0; var flagTelephone = 0; var flagPeople = 0; var countQuestions = 0; var maxQuestions = <?php echo $maxquestions; ?> ; function Highlite( ans)