dirroot/lib/ddllib.php"); require_once $CFG->dirroot.'/lib/accesslib.php'; require_once $CFG->dirroot.'/lib/questionlib.php'; /// First we check that form variables have been initialised if (!isset($form->name)) { $form->name = ''; $form->gamekind = ''; $form->sourcemodule = 'glossary'; $form->id = 0; $form->glossaryid = 0; $form->glossarycategoryid = 0; $gamekind = '-'; }else $gamekind = $form->gamekind; $existsbook = ( get_record_select( 'modules', "name='book'", 'id,id') ? 1 : 0); if( $form->sourcemodule == ''){ //the variables need initialization switch( $form->gamekind){ case 'hangman': case '': $form->param1 = 0; //show first letter $form->param2 = 0; //show last letter $form->param3 = 1; //image set $form->param4 = 1; //how many words in each game $form->param5 = 1; //show question $form->param6 = 1; //show answer $form->param7 = 0; //allow spaces $form->param8 = 0; //allow - break; case 'cross': $form->param1 = 0; //max cols $form->param2 = 0; //max words $form->param3 = 0; //layout $form->param7 = 0; //allow spaces break; case 'cryptex': $form->param1 = 0; //max cols $form->param2 = 0; //max words $form->param3 = 0; //layout $form->param7 = 0; //allow spaces $form->param8 = 0; //maxtries break; case 'sudoku': $form->param2 = 0; //max questions break; case 'snakes': $form->param3 = 0; //background break; case 'hiddenpicture': $form->param1 = 3; //cols accross $form->param2 = 3; //cols down $form->param4 = 0; //width $form->param5 = 0; //height $form->param7 = 0; //allow spaces break; case 'millionaire': $form->shuffle = 1; //randomize $form->param4 = 0; //width $form->param5 = 0; //height $form->param7 = 0; //allow spaces $form->param8 = 0x408080; $form->shuffle = 1; //randomize questions break; } } require_once( "locallib.php"); ?>
mode == 'add'){ ?> mode != 'add'){ for( $i=1; $i <= 6; $i++){ $name = 'param'.$i; echo ''."\r\n"; } echo ''."\r\n"; ?> '; $form->sourcemodule = 'question'; echo ''; } }else { $a = array(); if( $form->gamekind != 'millionaire'){ $a[ 'glossary'] = get_string('modulename','glossary'); } $a[ 'question'] = get_string('sourcemodule_question','game'); $a[ 'quiz'] = get_string('modulename','quiz'); $events = 'ONCHANGE="onselectsourcemodule(document.form.sourcemodule.value)"'; echo game_showselectcontrol( 'sourcemodule', $a, $form->sourcemodule, $events); echo ''; } echo "\r\n"; ?> gamekind == 'millionaire' && $form->sourcemodule == 'quiz' ){ ?> gamekind == 'millionaire' ){ if( $form->param8 == 0) $form->param8 = 0x408080; ?> gamekind == 'hangman') { ?> gamekind == 'cross'){ ?> gamekind == 'sudoku'){ if( !record_exists_select( 'game_sudoku_database')){ require( "{$CFG->dirroot}/mod/game/db/importsudoku.php"); } ?> gamekind == 'cryptex'){ ?> gamekind == 'bookquiz' and $existsbook){ ?> gamekind == 'millionaire'){ ?> gamekind == 'snakes'){ ?> gamekind == 'hiddenpicture'){ ?> gamekind <> 'bookquiz'){ echo ''; echo ''; } //grademethod ?> mode != 'add' $answers = 0; if (array_key_exists( 'answers', $_GET)) { $answers = ( $_GET[ 'answers'] != 0 ? 1 : 0); } $nanswers = ($answers ? '0' : '1'); ?>
  gamekind != '') echo get_string('game_'.$form->gamekind,'game'); ?>
:
: gamekind, $events); ?>
: gamekind == 'bookquiz'){ if( $existsbook){ echo get_string('sourcemodule_question','game').'
: id'", 'id,name')){ foreach( $recs as $rec){ $a[ $rec->id] = $rec->name; } } echo game_showselectcontrol( 'quizid', $a, $form->quizid); ?>
: id'", 'id,name')){ foreach( $recs as $rec){ $a[ $rec->id] = $rec->name; } } echo game_showselectcontrol( 'bookid', $a, $form->bookid); ?>
: id'", 'id,name')){ foreach( $recs as $rec){ $a[ $rec->id] = $rec->name; } } $events = 'ONCHANGE="onselectglossary(document.form.glossaryid.value)"'; echo game_showselectcontrol( 'glossaryid', $a, $form->glossaryid, $events); ?>
: id'", 'id,name')){ foreach($recs as $rec){ $a[$rec->id] = $rec->name; } } if( count( $a) == 0) $select = 'glossaryid=-1'; else if( count( $a) == 1) $select = 'glossaryid='.$rec->id; else { $select = ''; foreach($recs as $rec){ $select .= ','.$rec->id; } $select = 'g.id IN ('.substr( $select, 1).')'; } $select .= ' AND g.id=gc.glossaryid'; $table = "glossary g, {$CFG->prefix}glossary_categories gc"; $a = array(); $a[ ] = ''; if($recs = get_records_select( $table, $select, 'g.name,gc.name', 'gc.id,gc.name,g.name as name2')){ foreach($recs as $rec){ $a[$rec->id] = $rec->name2.' -> '.$rec->name; } } echo game_showselectcontrol( 'glossarycategoryid', $a, $form->glossarycategoryid); ?>
: id"; }else{ $context = get_context_instance(50, $course->id); $select = " contextid in ($context->id)"; } break; } $a = array(); if( $recs = get_records_select( 'question_categories', $select, 'id,name')){ foreach( $recs as $rec){ $s = $rec->name; if( ($count = count_records_select( 'question', "category={$rec->id}")) != 0){ $s .= " ($count)"; } $a[ $rec->id] = $s; } } echo game_showselectcontrol( 'questioncategoryid', $a, $form->questioncategoryid); ?>
: subcategories); ?>
: shuffle); ?>
:
:
:
: param1); ?>
: param2); ?>
: param7); ?>
: param8); ?>
: param3 < 1){ $form->param3 = 1; } $a = array(); $a[ 1] = 1; echo game_showselectcontrol( 'param3', $a, $form->param3); ?>
: param5); ?>
: param6); ?>
: language); ?>
:
:
: param7); ?>
: param3 != 2){ $form->param3 = 1; } $a = array(); $a[ 1] = get_string('cross_layout0', 'game'); $a[ 2] = get_string('cross_layout1', 'game'); echo game_showselectcontrol( 'param3', $a, $form->param3); ?>
:
:
:
: param7); ?>
:

: shuffle); ?>
: id] = $rec->name; } } if( count( $a) == 0){ require( "{$CFG->dirroot}/mod/game/db/importsnakes.php"); if( $recs = get_records_select( 'game_snakes_database', "", 'id,name')){ foreach( $recs as $rec){ $a[ $rec->id] = $rec->name; } } } echo game_showselectcontrol( 'param3', $a, $form->param3); ?>
:
:
: id'", 'id,name')){ foreach( $recs as $rec){ $a[ $rec->id] = $rec->name; } } echo game_showselectcontrol( 'glossaryid2', $a, $form->glossaryid2); ?>
: glossaryid ? 'glossaryid='.$form->glossaryid2 : ''); if( $recs = get_records_select( 'glossary_categories', $select, 'id,name')){ foreach( $recs as $rec){ if( count( $a) == 0){ $a[] = ''; } $a[ $rec->id] = $rec->name; } } echo game_showselectcontrol( 'glossarycategoryid2', $a, $form->glossarycategoryid2); ?>
: param7); ?>
:
:
'.get_string('toptext', 'game').''; print_textarea( $usehtmleditor, 15, 60, 630, 200, 'toptext', $game->toptext, $game->course); echo '
'.get_string('bottomtext', 'game').''; print_textarea( $usehtmleditor, 15, 60, 630, 200, 'bottomtext', $game->bottomtext, $game->course); echo '
: grademethod); ?>

" />