Browse Source

Fix:Coding style

MOODLE_20_STABLE
Vasilis Daloukas 9 years ago
parent
commit
febd678901
  1. 3
      CHANGES.md
  2. 15
      README.md
  3. 2
      export.php
  4. 4
      exporthtml.php
  5. 83
      exporthtml_snakes.php
  6. 3
      exportjavame.php
  7. 3
      showanswers.php
  8. 2
      showattempts.php

3
CHANGES.md

@ -0,0 +1,3 @@
Changes in version 3.36.25.1 (2015122501)
------------------------------------------------------------------
- Fix: Coding style

15
README.md

@ -1,5 +1,5 @@
Game module for Moodle
Copyright (C) 2004-2012 Vasilis Daloukas (http://bdaloukas.gr)
Copyright (C) 2004-2015 by Vasilis Daloukas (http://bdaloukas.gr)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -66,3 +66,16 @@ Upgrade
* Delete the files from mod/game
* Copy the new files to mod/game
To install it using git, type this command in the root of your Moodle install:
```
git clone https://github.com/bdaloukas/moodle-mod_game.git mod
mv moodle-mod_game game
cd game
git checkout MOODLE_20_STABLE
```
Alternatively, download the zip from
<https://codeload.github.com/bdaloukas/moodle-mod_game/zip/MOODLE_20_STABLE>,
unzip it into the local folder, and then rename the new folder to "game".

2
export.php

@ -128,7 +128,7 @@ class mod_game_exporthtml_form extends moodleform {
}
$cm = get_coursemodule_from_instance('game', $game->id, $game->course);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$context = game_get_context_module_instance( $cm->id);
require_once("exporthtml.php");
game_OnExportHTML( $game, $context, $html);

4
exporthtml.php

@ -159,7 +159,7 @@ function game_onexporthtml_cross_repair_questions( $game, $context, $filename, $
$params = array( 'component' => $component, 'filearea' => $filearea,
'itemid' => $id, 'filename' => $fileimage, 'contextid' => $context, 'contextid' => $contextcourse->id);
$rec = $DB->get_record( 'files', $params);
if ( $rec == false {
if ( $rec == false) {
break;
}
@ -350,7 +350,7 @@ function game_onexporthtml_snakes( $game, $html, $destdir, $context) {
$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);
$questionsm = game_millionaire_html_getquestions( $game, $context, $maxquestions, $countofquestionsm, $retfeedback, $destdir, $files);
} else {
$questionsm = array();
$countofquestionsm = 0;

83
exporthtml_snakes.php

@ -1,4 +1,19 @@
<?php // $Id: exporthtml_snakes.php,v 1.4 2011/07/23 12:34:08 bdaloukas Exp $
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This page export the game snakes to html
*
@ -46,7 +61,7 @@ background: #999 url('images/backdropJungle.png') no-repeat fixed left top;
<body>
<script language="JavaScript">
//Snakes for Moodle by Maria Rigkou
// Snakes for Moodle by Maria Rigkou.
var boards = 1;
var board_images = new Array( boards);
@ -93,29 +108,31 @@ pawn_height [0]= 40;
<?php
echo "var countofquestionsM=$countofquestionsM;\r\n";
echo 'var countofquestionsS='.count($questionsS).";\r\n";
echo "var countofquestionsM=$countofquestionsm;\r\n";
echo 'var countofquestionsS='.count($questionss).";\r\n";
foreach( $questionsS as $line)
{
foreach ($questionss as $line) {
$s = $line->question.'#'.str_replace( array( '"', '#'), array( "'", ' '), $line->answer);
if( $questionsM != '')
$questionsM .= ",\r";
$questionsM .= '"'.base64_encode( game_upper( $s)).'"';
if ($questionsm != '') {
$questionsm .= ",\r";
}
$questionsm .= '"'.base64_encode( game_upper( $s)).'"';
$s = '#'.str_replace( array( '"', '#'), array( "'", ' '), $line->feedback);
if( $retfeedback != '')
if ($retfeedback != '') {
$retfeedback .= ",\r";
$retfeedback .= '"'.base64_encode( $s).'"';
}
$rettimesasked = '';
for($i=0;$i<$countofquestionsM+count($questionsS);$i++)
$retfeedback .= '"'.base64_encode( $s).'"';
}
$rettimesasked = '';
for ($i = 0; $i < $countofquestionsm + count($questionss); $i++) {
$rettimesasked .= ',0';
$rettimesasked = substr( $rettimesasked, 1);
}
$rettimesasked = substr( $rettimesasked, 1);
echo "var questions=new Array( $questionsM);\r\n";
echo "var questions=new Array( $questionsm);\r\n";
echo "var feedbacks=new Array( $retfeedback);\r\n";
echo "var quest_times_asked=new Array( $rettimesasked);//How many times is used a question\r\n";
echo "var quest_times_asked=new Array( $rettimesasked); //How many times is used a question\r\n";
?>
var current_dice=0;
@ -365,7 +382,11 @@ function display_quest()
function display_quest_M()
{
s = '<table width="250px"><tr><td><div id="show_dice"> <img src = "images/dice' + current_dice + '.png"> </div> </td><td align=right><div id="show_score" style="color: #FFFFFF; font-weight:bold; font-size: 20px;"><strong>'+str_score+': </strong><strong class="score">' +score+ '</strong></div></td></tr></table>';
s = '<table width="250px"><tr><td><div id="show_dice"> ';
s = s + '<img src = "images/dice' + current_dice + '.png"> </div> </td>';
s = s + '<td align=right><div id="show_score" style="color: #FFFFFF; font-weight:bold; font-size: 20px;">';
s = s + '<strong>'+str_score+': </strong>';
s = s + '<strong class="score">' +score+ '</strong></div></td></tr></table>';
s = s + '<div id="question_area">' + quest_text+'</div>';
s = s + '<form name="snakesform">';
@ -381,10 +402,17 @@ function display_quest_M()
mchoice_positions[ j] = temp;
}
for(i=0; i < mchoice_count;i++)
s = s + '<input type="radio" name="radio_answer" id="radio_answer" value="'+i+'" />'+quest_resp[ mchoice_positions[ i]] + '<br />';
for(i=0; i < mchoice_count;i++) {
s = s + '<input type="radio" name="radio_answer" id="radio_answer" value="';
s = s + i+'" />'+quest_resp[ mchoice_positions[ i]] + '<br />';
}
s = s + '<br /><input type="button" id="check_btn" value="'+str_check+'" onclick="check_answer();"> <br /> <div id="feedb_area"> <div id="feedb_wrong" style="display:none; color:yellow;"> '+quest_feedb+' </div> <br /><div id="feedb" style="display:none; color:yellow;"> '+quest_feedb+'. Θα προχωρήσεις '+current_dice+' τετράγωνα μπροστά!</div><br /> <div id="OK_btn" style="display:none;"><input type="button" onclick="display_quest();" value="OK"/></div> </div></form>';
s = s + '<br /><input type="button" id="check_btn" value="'+str_check;
s = s + '" onclick="check_answer();"> <br/><div id="feedb_area"> <div id="feedb_wrong" style="display:none; color:yellow;"> ';
s = s + quest_feedb+' </div> <br /><div id="feedb" style="display:none; color:yellow;"> ';
s = s + quest_feedb+'. Θα προχωρήσεις ';
s = s + current_dice+' τετράγωνα μπροστά!</div><br /> <div id="OK_btn"';
s = s + 'style="display:none;"><input type="button" onclick="display_quest();" value="OK"/></div> </div></form>';
document.getElementById("dicecont").innerHTML = s;
@ -394,8 +422,19 @@ function display_quest_M()
function display_quest_S()
{
document.getElementById("dicecont").innerHTML = '<table width="250px"><tr><td><div id="show_dice"> <img src = "images/dice' + current_dice + '.png"> </div> </td><td align=right><div id="show_score" style="color: #FFFFFF; font-weight:bold; font-size: 20px;"><strong>'+str_score+': </strong><strong class="score">' +score+ '</strong></div></td></tr></table><div id="question_area">' +quest_text+'</div> <br /><input type="text" id="answer"/><br /><br /> <input type="button" id="check_btn" value="'+str_check+'" onclick="check_answer();"> <br /> <div id="feedb_area"> <div id="feedb_wrong" style="display:none; color:yellow;"> '+feedb_wrong_S+' </div> <div id="feedb" style="display:none; color:yellow;"> '+feedb_correct_S+'</div> <br /><div id="OK_btn" style="display:none;"><input type="button" onclick="display_quest();" value="OK"/></div> </div>';
var s = "";
s = '<table width="250px"><tr><td><div id="show_dice"> <img src = "images/dice';
s = s + current_dice + '.png"> </div> </td><td align=right>';
s = s + '<div id="show_score" style="color: #FFFFFF; font-weight:bold; font-size: 20px;"><strong>';
s = s + str_score+': </strong><strong class="score">' +score+ '</strong></div></td></tr></table><div id="question_area">';
s = s + quest_text+'</div> <br /><input type="text" id="answer"/><br /><br /> <input type="button" id="check_btn" value="';
s = s + str_check+'" onclick="check_answer();"> <br /> <div id="feedb_area">';
s = s + ' <div id="feedb_wrong" style="display:none; color:yellow;"> ';
s = s + feedb_wrong_S+' </div> <div id="feedb" style="display:none; color:yellow;"> ';
s = s + feedb_correct_S+'</div> <br /><div id="OK_btn" style="display:none;">';
s = s + '<input type="button" onclick="display_quest();" value="OK"/></div> </div>';
document.getElementById("dicecont").innerHTML = s;
document.getElementById("question_area").style.display = "block";
document.getElementById("check_btn").style.display = "block";
}

3
exportjavame.php

@ -206,6 +206,7 @@ function game_exmportjavame_getanswers_question_select( $game, $context, $table,
$map = array();
foreach ($questions as $question) {
unset( $ret);
$ret = new stdClass();
$ret->qtype = $question->qtype;
$ret->question = $question->questiontext;
$ret->question = str_replace( array( '"', '#'), array( "'", ' '),
@ -248,7 +249,7 @@ function game_exmportjavame_getanswers_glossary( $game, $context, $exportattachm
$fields .= ',attachment';
}
$sql = "SELECT $fields FROM $table WHERE $select ORDER BY definition";
if ($questions = $DB->get_records_sql( $sql)) === false) {
if( ($questions = $DB->get_records_sql( $sql)) === false) {
return false;
}

3
showanswers.php

@ -307,7 +307,7 @@ function game_showanswers_question_select( $game, $table, $select, $fields, $ord
foreach ($recs as $rec) {
if ($i++ > 0) {
echo '<br>';
}
if ($rec->fraction == 1) {
echo " <b>$rec->answer</b>";
if ($rec->feedback == '') {
@ -324,6 +324,7 @@ function game_showanswers_question_select( $game, $table, $select, $fields, $ord
$feedback .= "<br>";
}
}
}
echo '</td>';
if ($feedback == '') {
$feedback = '&nbsp;';

2
showattempts.php

@ -73,7 +73,7 @@ function game_showusers($game) {
function onselectuser()
{
var groupid = document.getElementById('menugroup').value;
window.location.href = "<?php echo href;?>" + document.getElementById('menuuser').value + '&groupid=' + groupid;
window.location.href = "<?php echo $href;?>" + document.getElementById('menuuser').value + '&groupid=' + groupid;
}
</script>
<?php

Loading…
Cancel
Save