Browse Source

Fix: PHP coding style problems

MOODLE_20_STABLE
bdaloukas 8 years ago
parent
commit
552fad457f
  1. 28
      exporthtml_snakes.php
  2. 2
      hangman/play.php
  3. 2
      lib.php
  4. 18
      locallib.php
  5. 2
      mod_form.php
  6. 4
      report/overview/report.php
  7. 2
      tabs.php
  8. 3
      translate.php

28
exporthtml_snakes.php

@ -174,7 +174,8 @@ function ShowMainForm()
} }
axis_y=Math.floor((current_position /rows)); axis_y=Math.floor((current_position /rows));
pawn_x=board_headerx[current_board]+(axis_x*col_width)+(col_width-pawn_width[current_board])/2; pawn_x=board_headerx[current_board]+(axis_x*col_width)+(col_width-pawn_width[current_board])/2;
pawn_y=board_footery[current_board]+pawn_height[current_board]+(axis_y*col_height)+(col_height-pawn_height[current_board])/2; pawn_y=board_footery[current_board]+pawn_height[current_board]+(axis_y*col_height);
pawn_y += (col_height-pawn_height[current_board])/2;
document.write('<div id="pawn1"><img id="pawn" alt="" src="images/player1.png"></div>'); document.write('<div id="pawn1"><img id="pawn" alt="" src="images/player1.png"></div>');
move_pawn(); move_pawn();
@ -252,12 +253,14 @@ function check_answer_M() {
current_position += current_dice; current_position += current_dice;
correct_ans =correct_ans+1; //calculate new score---- correct_ans =correct_ans+1; //calculate new score----
score = Math.round((correct_ans/all_ans)*100); score = Math.round((correct_ans/all_ans)*100);
document.getElementById("show_score").innerHTML='<strong>'+str_score+': </strong><strong class="score">' +score+ '</strong>'; var s = '<strong>'+str_score+': </strong><strong class="score">' +score+ '</strong>';
document.getElementById("show_score").innerHTML = s;
check_game_over(); check_game_over();
check_exists_ladder(); check_exists_ladder();
} else { } else {
score = Math.round((correct_ans/all_ans)*100); score = Math.round((correct_ans/all_ans)*100);
document.getElementById("show_score").innerHTML='<strong>'+str_score+': </strong><strong class="score">' +score+ '</strong>'; var s = '<strong>'+str_score+': </strong><strong class="score">' +score+ '</strong>';
document.getElementById("show_score").innerHTML = s;
check_exists_snake(); check_exists_snake();
} }
@ -273,13 +276,15 @@ function check_answer_S() {
current_position += current_dice; current_position += current_dice;
correct_ans =correct_ans+1; //calculate new score correct_ans =correct_ans+1; //calculate new score
score = Math.round((correct_ans/all_ans)*100); score = Math.round((correct_ans/all_ans)*100);
document.getElementById("show_score").innerHTML='<strong>'+str_score+': </strong><strong class="score">' +score+ '</strong>'; var s = '<strong>'+str_score+': </strong><strong class="score">' +score+ '</strong>';
document.getElementById("show_score").innerHTML = s;
check_game_over(); check_game_over();
check_exists_ladder(); check_exists_ladder();
} else { } else {
document.getElementById("feedb_wrong").style.display = "block"; document.getElementById("feedb_wrong").style.display = "block";
score = Math.round((correct_ans/all_ans)*100); score = Math.round((correct_ans/all_ans)*100);
document.getElementById("show_score").innerHTML='<strong>'+str_score+': </strong><strong class="score">' +score+ '</strong>'; var s = '<strong>'+str_score+': </strong><strong class="score">' +score+ '</strong>';
document.getElementById("show_score").innerHTML = s;
check_exists_snake(); check_exists_snake();
} }
@ -438,7 +443,8 @@ function move_pawn() {
axis_y=Math.floor((current_position /rows)); axis_y=Math.floor((current_position /rows));
pawn_x=board_headerx[current_board]+(axis_x*col_width)+(col_width-pawn_width[current_board])/2; pawn_x=board_headerx[current_board]+(axis_x*col_width)+(col_width-pawn_width[current_board])/2;
pawn_y=board_footery[current_board]+pawn_height[current_board]+(axis_y*col_height)+(col_height-pawn_height[current_board])/2; pawn_y = board_footery[current_board]+pawn_height[current_board]+(axis_y*col_height);
pawn_y += (col_height-pawn_height[current_board])/2;
document.getElementById("pawn1").style.position='relative'; document.getElementById("pawn1").style.position='relative';
document.getElementById("pawn1").style.left=pawn_x+'px'; document.getElementById("pawn1").style.left=pawn_x+'px';
@ -456,7 +462,6 @@ function move_pawn() {
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) { while (i < input.length) {
enc1 = keyStr.indexOf(input.charAt(i++)); enc1 = keyStr.indexOf(input.charAt(i++));
enc2 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++));
enc3 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++));
@ -489,30 +494,25 @@ function move_pawn() {
var c = c1 = c2 = 0; var c = c1 = c2 = 0;
while ( i < utftext.length ) { while ( i < utftext.length ) {
c = utftext.charCodeAt(i); c = utftext.charCodeAt(i);
if (c < 128) { if (c < 128) {
string += String.fromCharCode(c); string += String.fromCharCode(c);
i++; i++;
} } else if((c > 191) && (c < 224)) {
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1); c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2; i += 2;
} } else {
else {
c2 = utftext.charCodeAt(i+1); c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2); c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3; i += 3;
} }
} }
return string; return string;
} }
</script> </script>
</body> </body>

2
hangman/play.php

@ -16,6 +16,8 @@
// This file plays the game hangman. // This file plays the game hangman.
defined('MOODLE_INTERNAL') || die();
function game_hangman_continue( $id, $game, $attempt, $hangman, $newletter, $action, $context) { function game_hangman_continue( $id, $game, $attempt, $hangman, $newletter, $action, $context) {
global $DB, $USER; global $DB, $USER;

2
lib.php

@ -17,7 +17,7 @@
/** /**
* Library of functions and constants for module game * Library of functions and constants for module game
* *
* @author * @author Vasilis Daloukas
* @package game * @package game
**/ **/

18
locallib.php

@ -1657,7 +1657,9 @@ function game_print_question_shortanswer( $game, $question, $context) {
?> ?>
<div class="qtext"> <div class="qtext">
<?php echo game_filterquestion(str_replace( '\"', '"', $questiontext), $question->id, $context->id, $game->course); ?> <?php
echo game_filterquestion(str_replace( '\"', '"', $questiontext), $question->id, $context->id, $game->course);
?>
</div> </div>
<div class="ablock clearfix"> <div class="ablock clearfix">
@ -1890,12 +1892,6 @@ function game_addattempt( $game) {
return $DB->get_record_select( 'game_attempts', 'id='.$newid); return $DB->get_record_select( 'game_attempts', 'id='.$newid);
} }
/*
function game_print_r( $title, $a) {
echo "\r\n<hr><b>$title</b><br>";print_r( $a);echo "<hr>\r\n";
}
*/
function game_get_contexts() { function game_get_contexts() {
global $CFG, $COURSE; global $CFG, $COURSE;
@ -2016,14 +2012,6 @@ function game_question_get_id_from_name_prefix($name) {
return (integer) $matches[ 1]; return (integer) $matches[ 1];
} }
/*
function game_debug_array( $title, $a) {
echo '<br>'.$title.' ';
print_r( $a);
echo '<br>';
}
*/
function game_get_version() { function game_get_version() {
global $CFG, $DB; global $CFG, $DB;

2
mod_form.php

@ -22,6 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
defined('MOODLE_INTERNAL') || die();
require_once( $CFG->dirroot.'/course/moodleform_mod.php'); require_once( $CFG->dirroot.'/course/moodleform_mod.php');
require( 'locallib.php'); require( 'locallib.php');

4
report/overview/report.php

@ -16,13 +16,13 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
/** /*
* This script lists student attempts * This script lists student attempts
* *
* @author bdaloukas. * @author bdaloukas.
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package game * @package game
*//** */ */
require_once($CFG->libdir.'/tablelib.php'); require_once($CFG->libdir.'/tablelib.php');

2
tabs.php

@ -72,7 +72,7 @@ if ($currenttab == 'reports' and isset($mode)) {
$activated[] = 'reports'; $activated[] = 'reports';
$allreports = get_list_of_plugins("mod/game/report"); $allreports = get_list_of_plugins("mod/game/report");
// Standard reports we want to show first // Standard reports we want to show first.
$reportlist = array ('overview'); $reportlist = array ('overview');
foreach ($allreports as $report) { foreach ($allreports as $report) {

3
translate.php

@ -17,8 +17,7 @@
/** /**
* Check translation of module Game * Check translation of module Game
* *
* @author * @author Vasilis Daloukas
* @version $Id: translate.php,v 1.10 2012/07/25 23:07:43 bdaloukas Exp $
* @package game * @package game
**/ **/
require( "../../config.php"); require( "../../config.php");

Loading…
Cancel
Save