Browse Source

update readme files

lairaalmas 1 year ago
parent
commit
de56deeb5c
2 changed files with 21 additions and 21 deletions
  1. 3 3
      README.md
  2. 18 18
      src/php/README.md

+ 3 - 3
README.md

@@ -4,7 +4,7 @@
 
 **iFractions** is an online collection of games for teaching fractions currently being developed by LInE (Laboratório de Informática na Educação).
 
-It can be used both on a server or as an activity inside Moodle.
+It can be used both on a server or as an activity inside [Moodle](https://moodle.org/).
 
 Play iFractions online: http://www.usp.br/line/ifractions/
 
@@ -16,7 +16,7 @@ Follow the description below based on in which platform you want to run iFractio
 
 * Extract the content of **Ifraction-web.zip** inside the server directory
 
-* Check that the variable **moodle** is set to **false** inside **/js/globals.js**
+* Check that the variable **moodle** is set to **false** inside **/js/globals/global_control.js**
 
 * It can now be accessed through the **browser** (e.g http://localhost/Ifractions-web)
 
@@ -34,7 +34,7 @@ iFractions is one of the iLM (Interactive Learning Modules) provided by the iAss
 
 * To download and setup iAssign access: http://200.144.254.107/git/LInE/iassign
 
-* Be sure to check that the variable **moodle** is set to **true** inside **/js/globals.js**
+* Be sure to check that the variable **moodle** is set to **true** inside **/js/globals/global_control.js**
 
 * With iAssign installed, as a Moodle professor on you'll be able to:
   

+ 18 - 18
src/php/README.md

@@ -1,20 +1,20 @@
-#  save.php
+#  Configuring `save.php`
 
-iFractions is developed to run mainly on the client side. However, it communicates with a MySQL database to save info about the player's progress after each level. There's a PHP file called **save.php** that manages the connection between the game and the database. Also, the asynchronous communication is stablished using **XMLHTTPRequest**.
+iFractions is developed to run mainly on the client side. However, it communicates with a **MySQL** database to save information about the player's progress after each level. There's a **PHP** file called `save.php` that manages the connection between the game and the database. Also, the asynchronous communication is stablished using **XMLHTTPRequest**.
 
 # How to set up the database connection correctly
 
-First you'll need a MySQL database installed on the server (more info in https://www.mysql.com).
+First you'll need a **MySQL** database installed on the server (more info in https://www.mysql.com).
 
 Now, in order for iFractions to successfully establish a connection to the database you must:
 
 1. create and set up the database for the game.
-2. update /php/save.php 
-3. update /js/globals.js
+2. update `/php/save.php` 
+3. update `/js/globals/globals_functions.js`
 
 ## 1) Creating the database for iFractions
 
-Considering the database name to be **db_ifractins** and the table to be **ifractions**, you can setup the MySQL database as follows:
+Considering the **database name** to be `db_ifractins` and the **table name** to be `ifractions`, you can setup the MySQL database as follows:
 
 	CREATE DATABASE db_ifractions;
 
@@ -37,21 +37,21 @@ Considering the database name to be **db_ifractins** and the table to be **ifrac
 		PRIMARY KEY (line_id)
 	) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1;
 
-Note that each column has the prefix **line_**.
+Note that each column has the prefix `line_`.
 
-## 2) /php/save.php
+## 2) `save.php`
 
-You have to set values for the following variables in **/php/save.php** to match the database's:
+You have to set values for the following variables in `/php/save.php` to match the database's:
 
 	$servername = "localhost"; 	// INSERT MySQL server
-	$username = "put_username";	// INSERT MySQL user name
-	$password = "put_password";	// INSERT MySQL password
+	$username = "your_db_username";	// INSERT MySQL user name
+	$password = "your_db_password";	// INSERT MySQL password
 	$dbname = "db_ifractions";	// INSERT database name (default=db_ifractions) 
 	$tablename = "ifractions";	// INSERT table name (default=ifractions)
 
-## 3) /js/globals.js
+## 3) `globals_functions.js`
 
-Inside **/js/globals.js** there's a global function called **sendToDatabase()**. When the player's information is collected after each game, the game file sends it as a parameter to **sendToDatabase()**. It makes an asynchronous call to **/php/save.php**, that executes the connection to the database.
+Inside `/js/globals/globals_functions.js` there's a global function called `sendToDatabase()`. When the player's information is collected after each game, the game file sends it as a parameter to `sendToDatabase()`. It makes an asynchronous call to `/php/save.php`, that executes the connection to the database.
 
 	const data = 'line_ip='// INSERT the IP of the machine where the MySQL was set up
 		+ '&line_name=' + // player's name
@@ -61,12 +61,12 @@ Inside **/js/globals.js** there's a global function called **sendToDatabase()**.
 
 # Where do we use the database in the code?
 
-There is a function **postScore()** in every game file:
-* /js/squareOne.js
-* /js/squareTwo.js
-* /js/circleOne.js
+There is a function `postScore()` in every game file:
+* `/js/games/squareOne.js`
+* `/js/games/squareTwo.js`
+* `/js/games/circleOne.js`
 
-After each level is completed (with the player's answer being correct or not), before going back to the level map, the function **postScore()**, is called. It joins all the player's progress information into a string (as can be seen below), that is sent as a parameter to **sendToDatabase()**, from **/js/globals.js**, that sends it to the database.
+After each level is completed (with the player's answer being correct or not), before going back to the level map, the function `postScore()`, is called. It joins all the player's progress information into a string (as can be seen below), that is sent as a parameter to `sendToDatabase()`, from `/js/globals/globals_functions.js`, that sends it to the database.
 
 	const data = '&line_game=' + // collect game shape
 	+ '&line_mode=' + // collect game mode type