Browse Source

Fix: Moodle 2.6 compatibility

MOODLE_20_STABLE
bdaloukas 11 years ago
parent
commit
8204f722c6
  1. 2
      attempt.php
  2. 20
      bookquiz/play.php
  3. 8
      bookquiz/questions.php
  4. 2
      cross/cross_class.php
  5. 2
      cross/play.php
  6. 19
      export.php
  7. 2
      hangman/play.php
  8. 2
      headergame.php
  9. 2
      hiddenpicture/play.php
  10. 74
      locallib.php
  11. 3
      millionaire/play.php
  12. 4
      mod_form.php
  13. 2
      preview.php
  14. 9
      showanswers.php
  15. 2
      showattempts.php
  16. 5
      sudoku/play.php
  17. 4
      version.php
  18. 2
      view.php

2
attempt.php

@ -55,7 +55,7 @@
/// Check login and get context. /// Check login and get context.
require_login($course->id, false, $cm); require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = game_get_context_module_instance( $cm->id);
require_capability('mod/game:view', $context); require_capability('mod/game:view', $context);
/// Cache some other capabilites we use several times. /// Cache some other capabilites we use several times.

20
bookquiz/play.php

@ -86,6 +86,7 @@ $previd = null;
$nextid = null; $nextid = null;
$found = 0; $found = 0;
$scoreattempt = 0; $scoreattempt = 0;
$lastid = 0;
foreach ($chapters as $ch) { foreach ($chapters as $ch) {
$scoreattempt++; $scoreattempt++;
if ($found) { if ($found) {
@ -98,6 +99,7 @@ foreach ($chapters as $ch) {
if (!$found) { if (!$found) {
$previd = $ch->id; $previd = $ch->id;
} }
$lastid = $ch->id;
} }
if ($ch == current($chapters)) { if ($ch == current($chapters)) {
$nextid = $ch->id; $nextid = $ch->id;
@ -132,7 +134,9 @@ if ($nextid) {
game_updateattempts_maxgrade( $game, $attempt, 1, 0); game_updateattempts_maxgrade( $game, $attempt, 1, 0);
$sec = ''; $sec = '';
if( !isset( $cm)) if( !isset( $cm))
$cm = get_coursemodule_from_id('game', $game->id); {
$cm = get_coursemodule_from_instance('game', $game->id, $game->course);
}
if ($section = $DB->get_record('course_sections', array( 'id' => $cm->section))) { if ($section = $DB->get_record('course_sections', array( 'id' => $cm->section))) {
$sec = $section->section; $sec = $section->section;
} }
@ -140,7 +144,7 @@ if ($nextid) {
if (! $cm = $DB->get_record('course_modules', array( 'id' => $id))) { if (! $cm = $DB->get_record('course_modules', array( 'id' => $id))) {
print_error("Course Module ID was incorrect id=$id"); print_error("Course Module ID was incorrect id=$id");
} }
$chnavigation .= '<a title="'.get_string('navexit', 'book').'" href="../../course/attempt.php?id='.$cm->course.'"><img src="'.$OUTPUT->pix_url('bookquiz/nav_exit', 'mod_game').'" class="bigicon" alt="'.get_string('navexit', 'book').'" /></a>'; $chnavigation .= '<a title="'.get_string('navexit', 'book').'" href="attempt.php?id='.$id.'&chapterid='.$lastid.'><img src="'.$OUTPUT->pix_url('bookquiz/nav_exit', 'mod_game').'" class="bigicon" alt="'.get_string('navexit', 'book').'" /></a>';
} }
require( 'toc.php'); require( 'toc.php');
@ -188,7 +192,9 @@ $tocwidth = '10%';
$content .= '<p class="book_chapter_title">'.$currtitle.'<br />'.$currsubtitle.'</p>'; $content .= '<p class="book_chapter_title">'.$currtitle.'<br />'.$currsubtitle.'</p>';
} }
} }
$content .= $chapter->content; $cmbook = get_coursemodule_from_instance( 'book', $game->bookid, $game->course);
$modcontext = game_get_context_module_instance( $cmbook->id);
$content .= game_filterbook( $chapter->content, $chapter->id, $modcontext->id, $game->course);
$nocleanoption = new object(); $nocleanoption = new object();
$nocleanoption->noclean = true; $nocleanoption->noclean = true;
@ -196,7 +202,7 @@ $tocwidth = '10%';
if( $nextbutton != ''){ if( $nextbutton != ''){
echo $nextbutton; echo $nextbutton;
} }
echo format_text($content, FORMAT_HTML, $nocleanoption, $id); echo format_text($content, FORMAT_HTML, $nocleanoption);
if( $nextbutton != ''){ if( $nextbutton != ''){
echo $nextbutton; echo $nextbutton;
} }
@ -221,7 +227,13 @@ function game_bookquiz_play_computelastchapter( $game, &$bookquiz)
{ {
global $DB; global $DB;
if( $game->bookid == 0)
{
print_error( 'Not defined a book on this game');
}
$pagenum = $DB->get_field( 'book_chapters', 'min(pagenum) as p', array('bookid' => $game->bookid)); $pagenum = $DB->get_field( 'book_chapters', 'min(pagenum) as p', array('bookid' => $game->bookid));
if( $pagenum){ if( $pagenum){
$bookquiz->lastchapterid = $DB->get_field( 'book_chapters', 'id', array('bookid' => $game->bookid, 'pagenum' => $pagenum)); $bookquiz->lastchapterid = $DB->get_field( 'book_chapters', 'id', array('bookid' => $game->bookid, 'pagenum' => $pagenum));

8
bookquiz/questions.php

@ -8,7 +8,7 @@
**/ **/
require_once("../../../config.php"); require_once("../../../config.php");
require_once( "../header.php"); require_once( "../headergame.php");
require_once("../locallib.php"); require_once("../locallib.php");
$attempt = game_getattempt( $game, $detail); $attempt = game_getattempt( $game, $detail);
@ -21,7 +21,7 @@
$ids = explode( ',', $form->ids); $ids = explode( ',', $form->ids);
game_bookquiz_save( $game->id, $game->bookid, $ids, $form); game_bookquiz_save( $game->id, $game->bookid, $ids, $form);
redirect("{$CFG->wwwroot}/mod/game/bookquiz/questions.php?id=$cm->id", '', 0); //redirect("{$CFG->wwwroot}/mod/game/bookquiz/questions.php?id=$cm->id", '', 0);
} }
/// Print upload form /// Print upload form
@ -36,7 +36,7 @@
} }
} }
$context = get_context_instance(50, $COURSE->id); $context = game_get_context_course_instance( $COURSE->id);
$select = " contextid in ($context->id)"; $select = " contextid in ($context->id)";
$a = array(); $a = array();
@ -160,7 +160,7 @@ function game_bookquiz_save( $gameid, $bookid, $ids, $form)
} }
}else }else
{ {
unset( $updrec); $updrec = new StdClass;
$updrec->id = $recids[ $chapterid]; $updrec->id = $recids[ $chapterid];
$updrec->questioncategoryid = $categoryid; $updrec->questioncategoryid = $categoryid;
if (($DB->update_record( 'game_bookquiz_questions', $updrec)) == false) { if (($DB->update_record( 'game_bookquiz_questions', $updrec)) == false) {

2
cross/cross_class.php

@ -630,7 +630,7 @@ class Cross
if( $game->glossaryid) if( $game->glossaryid)
{ {
$cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course); $cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course);
$contextglossary = get_context_instance(CONTEXT_MODULE, $cmglossary->id); $contextglossary = game_get_context_module_instance( $cmglossary->id);
} }
foreach ($crossd as $rec) foreach ($crossd as $rec)
{ {

2
cross/play.php

@ -1042,7 +1042,7 @@ if( $attempt != false){
</body> </body>
<?PHP <?php
} }
function game_cross_show_welcome( $game){ function game_cross_show_welcome( $game){

19
export.php

@ -14,7 +14,7 @@ require_once ($CFG->dirroot.'/lib/formslib.php');
require( 'locallib.php'); require( 'locallib.php');
require( 'headergame.php'); require( 'headergame.php');
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = game_get_context_module_instance( $cm->id);
if (!has_capability('mod/game:viewreports', $context)) if (!has_capability('mod/game:viewreports', $context))
return; return;
@ -44,18 +44,22 @@ class mod_game_exporthtml_form extends moodleform {
//filename //filename
$mform->addElement('text', 'filename', get_string('javame_filename', 'game'), array('size'=>'30')); $mform->addElement('text', 'filename', get_string('javame_filename', 'game'), array('size'=>'30'));
$mform->setDefault('filename',$html->filename); $mform->setDefault('filename',$html->filename);
$mform->setType('filename', PARAM_TEXT);
//html title //html title
$mform->addElement('text', 'title', get_string('html_title', 'game'), array('size'=>'80')); $mform->addElement('text', 'title', get_string('html_title', 'game'), array('size'=>'80'));
$mform->setDefault('title',$html->title); $mform->setDefault('title',$html->title);
$mform->setType('title', PARAM_TEXT);
//fields for hangman //fields for hangman
if( $game->gamekind == 'hangman') if( $game->gamekind == 'hangman')
{ {
$mform->addElement('text', 'maxpicturewidth', get_string('javame_maxpicturewidth', 'game'), array('size'=>'5')); $mform->addElement('text', 'maxpicturewidth', get_string('javame_maxpicturewidth', 'game'), array('size'=>'5'));
$mform->setDefault('maxpicturewidth',$html->maxpicturewidth); $mform->setDefault('maxpicturewidth',$html->maxpicturewidth);
$mform->setType('maxpicturewidth', PARAM_INT);
$mform->addElement('text', 'maxpictureheight', get_string('javame_maxpictureheight', 'game'), array('size'=>'5')); $mform->addElement('text', 'maxpictureheight', get_string('javame_maxpictureheight', 'game'), array('size'=>'5'));
$mform->setDefault('maxpictureheight',$html->maxpictureheight); $mform->setDefault('maxpictureheight',$html->maxpictureheight);
$mform->setType('maxpictureheight', PARAM_INT);
} }
//fiels for cross //fiels for cross
@ -68,7 +72,9 @@ class mod_game_exporthtml_form extends moodleform {
} }
$mform->addElement('hidden', 'q', $game->id); $mform->addElement('hidden', 'q', $game->id);
$mform->setType('q', PARAM_INT);
$mform->addElement('hidden', 'target', 'html'); $mform->addElement('hidden', 'target', 'html');
$mform->setType('target', PARAM_TEXT);
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
$mform->addElement('submit', 'submitbutton', get_string( 'export', 'game')); $mform->addElement('submit', 'submitbutton', get_string( 'export', 'game'));
@ -138,25 +144,36 @@ class mod_game_exportjavame_form extends moodleform {
//filename //filename
$mform->addElement('text', 'filename', get_string('javame_filename', 'game'), array('size'=>'30')); $mform->addElement('text', 'filename', get_string('javame_filename', 'game'), array('size'=>'30'));
$mform->setDefault('filename',$javame->filename); $mform->setDefault('filename',$javame->filename);
$mform->setType('filename', PARAM_TEXT);
$mform->addElement('text', 'icon', get_string('javame_icon', 'game')); $mform->addElement('text', 'icon', get_string('javame_icon', 'game'));
$mform->setDefault('icon',$javame->icon); $mform->setDefault('icon',$javame->icon);
$mform->setType('icon', PARAM_TEXT);
$mform->addElement('text', 'createdby', get_string('javame_createdby', 'game')); $mform->addElement('text', 'createdby', get_string('javame_createdby', 'game'));
$mform->setDefault('createdby',$javame->createdby); $mform->setDefault('createdby',$javame->createdby);
$mform->setType('createdby', PARAM_TEXT);
$mform->addElement('text', 'vendor', get_string('javame_vendor', 'game')); $mform->addElement('text', 'vendor', get_string('javame_vendor', 'game'));
$mform->setDefault('vendor',$javame->vendor); $mform->setDefault('vendor',$javame->vendor);
$mform->setType('vendor', PARAM_TEXT);
$mform->addElement('text', 'name', get_string('javame_name', 'game'), array('size'=>'80')); $mform->addElement('text', 'name', get_string('javame_name', 'game'), array('size'=>'80'));
$mform->setDefault('name',$javame->name); $mform->setDefault('name',$javame->name);
$mform->setType('name', PARAM_TEXT);
$mform->addElement('text', 'description', get_string('javame_description', 'game'), array('size'=>'80')); $mform->addElement('text', 'description', get_string('javame_description', 'game'), array('size'=>'80'));
$mform->setDefault('description',$javame->description); $mform->setDefault('description',$javame->description);
$mform->setType('description', PARAM_TEXT);
$mform->addElement('text', 'version', get_string('javame_version', 'game'), array('size'=>'10')); $mform->addElement('text', 'version', get_string('javame_version', 'game'), array('size'=>'10'));
$mform->setDefault('version',$javame->version); $mform->setDefault('version',$javame->version);
$mform->setType('version', PARAM_TEXT);
$mform->addElement('text', 'maxpicturewidth', get_string('javame_maxpicturewidth', 'game'), array('size'=>'5')); $mform->addElement('text', 'maxpicturewidth', get_string('javame_maxpicturewidth', 'game'), array('size'=>'5'));
$mform->setDefault('maxpicturewidth',$javame->maxpicturewidth); $mform->setDefault('maxpicturewidth',$javame->maxpicturewidth);
$mform->setType('maxpicturewidth', PARAM_INT);
$mform->addElement('text', 'maxpictureheight', get_string('javame_maxpictureheight', 'game'), array('size'=>'5')); $mform->addElement('text', 'maxpictureheight', get_string('javame_maxpictureheight', 'game'), array('size'=>'5'));
$mform->setDefault('maxpictureheight',$javame->maxpictureheight); $mform->setDefault('maxpictureheight',$javame->maxpictureheight);
$mform->setType('maxpictureheight', PARAM_INT);
$mform->addElement('hidden', 'q', $game->id); $mform->addElement('hidden', 'q', $game->id);
$mform->setType('q', PARAM_INT);
$mform->addElement('hidden', 'target', 'javame'); $mform->addElement('hidden', 'target', 'javame');
$mform->setType('target', PARAM_TEXT);
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
$mform->addElement('submit', 'submitbutton', get_string( 'export', 'game')); $mform->addElement('submit', 'submitbutton', get_string( 'export', 'game'));

2
hangman/play.php

@ -302,7 +302,7 @@ function hangman_showpage(&$done, &$correct, &$wrong, $max, &$word_line, &$word_
}else }else
{ {
$cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course); $cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course);
$contextglossary = get_context_instance(CONTEXT_MODULE, $cmglossary->id); $contextglossary = game_get_context_module_instance( $cmglossary->id);
$query->questiontext = game_filterglossary(str_replace( '\"', '"', $query->questiontext), $query->glossaryentryid, $contextglossary->id, $game->course); $query->questiontext = game_filterglossary(str_replace( '\"', '"', $query->questiontext), $query->glossaryentryid, $contextglossary->id, $game->course);
} }

2
headergame.php

@ -32,7 +32,7 @@
/// Check login and get context. /// Check login and get context.
require_login($course->id, false, $cm); require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = game_get_context_module_instance( $cm->id);
require_capability('mod/game:view', $context); require_capability('mod/game:view', $context);
/// Cache some other capabilites we use several times. /// Cache some other capabilites we use several times.

2
hiddenpicture/play.php

@ -111,7 +111,7 @@ function game_hiddenpicture_selectglossaryentry( $game, $attempt){
$keys = array(); $keys = array();
$fs = get_file_storage(); $fs = get_file_storage();
$cmg = get_coursemodule_from_instance('glossary', $game->glossaryid2, $game->course); $cmg = get_coursemodule_from_instance('glossary', $game->glossaryid2, $game->course);
$context = get_context_instance(CONTEXT_MODULE, $cmg->id); $context = game_get_context_module_instance( $cmg->id);
foreach( $recs as $rec){ foreach( $recs as $rec){
$files = $fs->get_area_files($context->id, 'mod_glossary', 'attachment', $rec->id, "timemodified", false); $files = $fs->get_area_files($context->id, 'mod_glossary', 'attachment', $rec->id, "timemodified", false);
if( $files) if( $files)

74
locallib.php

@ -1228,6 +1228,35 @@ function game_filterglossary( $text, $entryid, $contextid, $courseid)
} }
function game_filterbook( $text, $chapterid, $contextid, $courseid)
{
global $CFG, $DB;
for(;;)
{
$find='@@PLUGINFILE@@';
$pos = strpos( $text, $find);
if( $pos === false)
break;
$pos2 = strpos( $text,'/', $pos);
if( $pos2 === false)
break;
$pos3 = strpos( $text,'"', $pos);
if( $pos3 === false)
break;
$file = substr( $text, $pos2+1, $pos3-$pos2-1);
$new = $CFG->wwwroot."/pluginfile.php/$contextid/mod_book/chapter/$chapterid/$file";
$text = substr( $text, 0, $pos).$new.substr( $text,$pos3);
}
$questiontext = str_replace( '$$'.'\\'.'\\'.'frac', '$$\\'.'frac', $text);
return game_filtertext( $text, $courseid);
}
function game_filterquestion( $questiontext, $questionid, $contextid, $courseid) function game_filterquestion( $questiontext, $questionid, $contextid, $courseid)
{ {
global $CFG, $DB; global $CFG, $DB;
@ -1289,7 +1318,7 @@ function game_filtertext( $text, $courseid){
$formatoptions = new stdClass(); $formatoptions = new stdClass();
$formatoptions->noclean = true; $formatoptions->noclean = true;
$formatoptions->filter = 1; $formatoptions->filter = 1;
$text = trim( format_text( $text, FORMAT_MOODLE, $formatoptions, $courseid)); $text = trim( format_text( $text, FORMAT_MOODLE, $formatoptions));
$start = '<div class="text_to_html">'; $start = '<div class="text_to_html">';
if( substr( $text, 0, strlen( $start)) == $start){ if( substr( $text, 0, strlen( $start)) == $start){
@ -1919,12 +1948,17 @@ function game_debug_array( $title, $a)
function game_get_version() function game_get_version()
{ {
global $DB; global $CFG, $DB;
if( ($rec = $DB->get_record( 'modules', array( 'name' => 'game'), 'id,version')) === false) if( ($rec = $DB->get_record( 'modules', array( 'name' => 'game'))) === false)
return ''; return '';
if( isset( $rec->version))
return $rec->version; return $rec->version;
$module = new StdClass;
require($CFG->dirroot . '/mod/game/version.php');
return $module->version;
} }
function game_can_start_new_attempt( $game) function game_can_start_new_attempt( $game)
@ -1990,3 +2024,37 @@ function game_strpos( $haystack, $needle, $offset = 0)
else else
return textlib_get_instance()->strpos( $haystack, $needle, $offset); return textlib_get_instance()->strpos( $haystack, $needle, $offset);
} }
function game_get_context_course_instance( $courseid)
{
if( class_exists( 'context_course'))
return context_course::instance( $courseid);
return get_context_instance( 50, $courseid);
}
function game_get_context_module_instance( $moduleid)
{
if( class_exists( 'context_module'))
return context_module::instance( $moduleid);
return get_context_instance( CONTEXT_MODULE, $moduleid);
}
function game_show_query( $game, $query, $text)
{
if( $game->glossaryid)
{
$cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course);
$contextglossary = game_get_context_module_instance( $cmglossary->id);
return game_filterglossary(str_replace( '\"', '"', $text), $query->glossaryentryid, $contextglossary->id, $game->course);
}else if( $query->questionid)
{
$context = game_get_context_module_instance( $game->id);
$text = str_replace( array("\'", '\"'), array("'", '"'), $text);
return game_filterquestion($text, $query->questionid, $context->id, $game->course);
}
return $text;
}

3
millionaire/play.php

@ -176,7 +176,8 @@ function game_millionaire_showgrid( $game, $millionaire, $id, $query, $aAnswer,
$bTR = true; $bTR = true;
break; break;
case 12: case 12:
$question = game_filterquestion($question, $query->questionid, $context->id, $game->course); //$question = game_filterquestion($question, $query->questionid, $context->id, $game->course);
$question = game_show_query( $game, $query, $question, $context);
echo "<tr>"; echo "<tr>";
echo "<td rowspan=12 colspan=2 valign=top style=\"$styletext\">$question</td>\r\n"; echo "<td rowspan=12 colspan=2 valign=top style=\"$styletext\">$question</td>\r\n";
$bTR = true; $bTR = true;

4
mod_form.php

@ -109,7 +109,7 @@ class mod_game_mod_form extends moodleform_mod {
// Question Category - Short Answer // Question Category - Short Answer
if( $gamekind != 'bookquiz'){ if( $gamekind != 'bookquiz'){
$context = get_context_instance(50, $COURSE->id); $context = game_get_context_course_instance( $COURSE->id);
$select = " contextid in ($context->id)"; $select = " contextid in ($context->id)";
$a = array(); $a = array();
@ -378,7 +378,7 @@ class mod_game_mod_form extends moodleform_mod {
if($recs = $DB->get_records('glossary', array( 'course' => $COURSE->id), 'id,name')){ if($recs = $DB->get_records('glossary', array( 'course' => $COURSE->id), 'id,name')){
foreach($recs as $rec){ foreach($recs as $rec){
$cmg = get_coursemodule_from_instance('glossary', $rec->id, $COURSE->id); $cmg = get_coursemodule_from_instance('glossary', $rec->id, $COURSE->id);
$context = get_context_instance(CONTEXT_MODULE, $cmg->id); $context = game_get_context_module_instance( $cmg->id);
if( $DB->record_exists( 'files', array( 'contextid' => $context->id))){ if( $DB->record_exists( 'files', array( 'contextid' => $context->id))){
$a[$rec->id] = $rec->name; $a[$rec->id] = $rec->name;
} }

2
preview.php

@ -20,7 +20,7 @@
require_once( "headergame.php"); require_once( "headergame.php");
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = game_get_context_module_instance( $cm->id);
if (!has_capability('mod/game:viewreports', $context)){ if (!has_capability('mod/game:viewreports', $context)){
print_error( get_string( 'only_teachers', 'game')); print_error( get_string( 'only_teachers', 'game'));

9
showanswers.php

@ -53,7 +53,7 @@ function game_showusers($game)
$users = array(); $users = array();
$context = get_context_instance(CONTEXT_COURSE, $game->course); $context = game_get_context_course_instance( $game->course);
if ($courseusers = get_enrolled_users($context)) { if ($courseusers = get_enrolled_users($context)) {
foreach ($courseusers as $courseuser) { foreach ($courseusers as $courseuser) {
@ -378,7 +378,12 @@ function game_showanswers_glossary( $game)
echo '<td>'.(++$line); echo '<td>'.(++$line);
echo '</td>'; echo '</td>';
echo '<td>'.$question->definition.'</td>'; $query = new StdClass;
$query->glossaryid = $game->glossaryid;
$query->glossaryentryid = $question->id;
echo '<td>'.game_show_query( $game, $query, $question->definition).'</td>';
echo '<td>'.$question->concept.'</td>'; echo '<td>'.$question->concept.'</td>';
if( $reps != false){ if( $reps != false){
if( array_key_exists( $question->id, $reps)) if( array_key_exists( $question->id, $reps))

2
showattempts.php

@ -37,7 +37,7 @@
$users = array(); $users = array();
$context = get_context_instance(CONTEXT_COURSE, $game->course); $context = game_get_context_course_instance( $game->course);
$groupid = optional_param('groupid',0, PARAM_INT); $groupid = optional_param('groupid',0, PARAM_INT);
$sql = "SELECT DISTINCT ra.userid,u.lastname,u.firstname FROM {role_assignments} ra, {user} u ". $sql = "SELECT DISTINCT ra.userid,u.lastname,u.firstname FROM {role_assignments} ra, {user} u ".

5
sudoku/play.php

@ -460,7 +460,10 @@ function game_sudoku_showquestions_glossary( $id, $game, $attempt, $sudoku, $off
continue; //I don't show the correct answers continue; //I don't show the correct answers
} }
$s = '<b>A'.$ofs.'.</b> '.game_filtertext( $entry->definition, 0).'<br>'; $query = new StdClass;
$query->glossaryid = $game->glossaryid;
$query->glossaryentryid = $entry->id;
$s = '<b>A'.$ofs.'.</b> '.game_show_query( $game, $query, $entry->definition, 0).'<br>';
if( $showsolution){ if( $showsolution){
$s .= get_string( 'answer').': '; $s .= get_string( 'answer').': ';
$s .= "<input type=\"text\" name=\"resp{$entry->id}\" value=\"$entry->concept\"size=30 /><br>"; $s .= "<input type=\"text\" name=\"resp{$entry->id}\" value=\"$entry->concept\"size=30 /><br>";

4
version.php

@ -11,7 +11,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$module->component = 'mod_game'; // Full name of the plugin (used for diagnostics) $module->component = 'mod_game'; // Full name of the plugin (used for diagnostics)
$module->version = 2013101901; // The current module version (Date: YYYYMMDDXX) $module->version = 2013120101; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2010112400; // Requires Moodle 2.0 $module->requires = 2010112400; // Requires Moodle 2.0
$module->cron = 0; // Period for cron to check this module (secs) $module->cron = 0; // Period for cron to check this module (secs)
$module->release = '3.10.19.1'; $module->release = '3.12.1.1';

2
view.php

@ -20,7 +20,7 @@
/// Check login and get context. /// Check login and get context.
require_login($course->id, false, $cm); require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = game_get_context_module_instance( $cm->id);
require_capability('mod/game:view', $context); require_capability('mod/game:view', $context);
$timenow = time(); $timenow = time();

Loading…
Cancel
Save