Commit c31bf65a authored by Robert's avatar Robert
Browse files

Initial commit

parents
auto_prepend_file = "/srv/data/web/includes/esc/ecran_securite_cassiopea.php"
display_errors = On
V 2.3
QRcode + affichage responsive web design
V 2.1
Possibilité d'ajouter un fichier texte comprenant des scripts de stats.
V 2.0
Mise au point d'une feuille de style d'impression.
V 1.9
Détection des 32 bits et limitation en fonction.
V 1.8
Menues améliorations et un peu de refactoring ....
V 1.7
Traduction de l'aide en français.
V 1.6
Le bouton Réponse O/N est devenu une chekbox qui permet de choisir d'afficher ou pas les réponses, avant d'obtenir de nouveau problèmes. Le ON/OFF est préservé par click sur la checkbox.
V 1.5
Interface bilingue FR - EN (Aide à traduire)
V 1.4
Embarquement de jQuery 1.11.0 compressé.
V 1.3
Ajout d'une petite fonctionnalité ergonomnique pour le mode "Hide title & settins Y/N". Ajout de l'opération en cours entre les boutons "Get a new calculation" et "Answers Y/N".
Correction de la fôte d'orthographe "Hide title & settins Y/N" vers "Hide title & settings Y/N"
V 1.2
Ajouté une petite animation avec la perle
V 1.1
Augmenté les nombre min, max de digits et les nombres de problèmes à 15 pour +, -, +/-. Fraudra voir avec les limites des entiers...
V 1.0
Finalisation des fonctionnalités pour smartphones et tablettes: The button "Hide title & settins Y/N" is user-friendly with smartphones and tablets when you choose, in the settings above, a low "Number of problems", eg 1, 2 or 3. Then you can reload, eg 1 problem, for each exercice.
V 0.9-6
Bouton de vue d'impression.
V 0.9-5
More responsive! ;-).
V 0.9-4
Cache les réponses. Bouton on/off pour les afficher.
V 0.9-3
Amélioration de l'ergonomie visuelle
V 0.9-1
Correction d'un petit bug qui faisait que dans les requetes mélangeant add et sub, certains opérandes avait plus de chiffres que le nombre max demandé.
V 0.9
Version de base
\ No newline at end of file
This diff is collapsed.
<?php
// (C) Robert Sebille 2014 http://sebille.name This script is under License GNU GPL V3. See LICENCE.
include("fonctions.php");
// On récupère les valeurs passées en post
$typeop = $_POST["TYPEOP"];
$mindigit = $_POST["MINDIGIT"];
$maxdigit = $_POST["MAXDIGIT"];
$numnumb = $_POST["NUMNUMB"];
$numprob = $_POST["NUMPROB"];
// On détermine les nombres max et min
$maxnumber = pow(10,($maxdigit)) - 1;
$minnumber = pow(10,($mindigit-1));
$retour = "<tr>";
for ($i = 0; $i < $numprob; $i++) {
// formater le tableau comme je veux
// if ($i > 0 AND $numprob < 5) {$retour .= "</tr><tr>";}
if ($i > 0 AND ($i % 5) == 0) {$retour .= "</tr><tr>";}
$retour .= "<td class='nombre'>";
$total = 0;
for ($j = 1; $j <= $numnumb; $j++) {
switch ($typeop) {
case "add":
$number = mt_rand($minnumber, $maxnumber);
$total += $number;
if ($j == $numnumb) {$retour .= "+ ".number_format($number, 0, ',', ' ' )."<br />";}
else {$retour .= number_format($number, 0, ',', ' ' )."<br />";}
//$retour .= "+ ".number_format($number, 0, ',', ' ' )."<br />";
break;
case "sub":
if ($j == 1) {$number = mt_rand($minnumber+floor(($maxnumber-$minnumber)/2), $maxnumber);$total += $number;}
else {
if ($total > $minnumber) {$number = mt_rand($minnumber, $total);$total -= $number;}
else {$number = 0;}
}
if ($j > 1) {$retour .= "- ".number_format($number, 0, ',', ' ' )."<br />";}
else {$retour .= number_format($number, 0, ',', ' ' )."<br />";}
//$retour .= "+ ".number_format($number, 0, ',', ' ' )."<br />";
break;
case "addsub":
if ($j == 1) {$number = mt_rand($minnumber+floor(($maxnumber-$minnumber)/2), $maxnumber);$total += $number;}
if ($j > 1) {
$oper = rand(0,1);
if ($oper == 0) { // on dit qu'alors c'est add, sinon c'est sub
$number = mt_rand($minnumber, $maxnumber); $total += $number;}
else {
// Prévenir que le total soit plus grand que $maxnumber
if ($total > $maxnumber) {$tmp_maxnumber = $maxnumber;} else {$tmp_maxnumber = $total;}
if ($total > $minnumber) {$number = mt_rand($minnumber, $tmp_maxnumber);$total -= $number;}
else {$number = 0;}
}
}
if ($j > 1 AND $oper == 1) {$retour .= "- ".number_format($number, 0, ',', ' ' )."<br />";}
else {$retour .= number_format($number, 0, ',', ' ' )."<br />";}
//$retour .= "+ ".number_format($number, 0, ',', ' ' )."<br />";
break;
}
}
$retour .= "<p class='reponse'>".number_format($total, 0, ',', ' ' )."</p><p class='noreponse'>&nbsp;</p></td>";
}
$retour .= "</tr>";
echo $retour;
// echo "Coming soon... ajax param: ".$typeop." ".$mindigit." - ".$maxdigit." -- ".$numnumb." --- ".$numprob." + ".$maxnumber." - ".$minnumber;
?>
\ No newline at end of file
<!-- <div class="param" id="addsub"> -->
<form class="formulaire" name="addsous" action="">
<p><select name="mindigit" id="mindigit">
<option value=1>1</option>
<option value=2>2</option>
<option value=3 selected="selected">3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
</select> <label for="mindigit"><span class="t_Min_number_of_digits">Min. number of digits</span></label></p>
<p><select name="maxdigit" id="maxdigit">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4 selected="selected">4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
</select> <label for="maxdigit"><span class="t_Max_number_of_digits">Max. number of digits</span></label></p>
<p><select name="numnumb" id="numnumb">
<option value=2 selected="selected">2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
</select> <label for="numnumb"><span class="t_Number_of_numbers">Number of numbers</span></label></p>
<p><select name="numprob" id="numprobaddsub">
<option value=1>1</option>
<option value=2>2</option>
<option value=3 selected="selected">3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=10>10</option>
<option value=20>20</option>
<option value=30>30</option>
<option value=50>50</option>
</select> <label for="numprobaddsub"><span class="t_Number_of_problems">Number of problems</span></label></p>
<!-- </div> -->
<?php
// On vérifie si le système supporte tous les nombres à 10 chiffres. Si oui, OS ou CPU 64 bits, sinon, OS ou CPU 32 bits
//$mtrandmax = 2147483648;
//$mtrandmax = 9999999999999999*999;
//$mtrandmax = 9999999999; // <- sautait l'exception! why??
$mtrandmax = 3333333333;
function mtr($mtrm) {
if (!mt_rand(0, $mtrm)) {
throw new Exception('32 bits.');
return null;
}
else {
return mt_rand(0, $mtrm);
}
}
$sys32bits="0";
try {
$test = mtr($mtrandmax);
} catch (Exception $e) {
$sys32bits="1";
}
if ($sys32bits == "0") {setcookie("sysbits", "64", time()+3600, "/");} else {setcookie("sysbits", "32", time()+3600, "/");}
?>
\ No newline at end of file
<?php
// (C) Robert Sebille 2014 http://sebille.name This script is under License GNU GPL V3. See LICENCE.
?>
\ No newline at end of file
<?php
// (C) Robert Sebille 2014 http://sebille.name This script is under License GNU GPL V3. See LICENCE.
include("fonctions.php");
// On récupère les valeurs passées en post
$typeop = $_POST["TYPEOP"];
$mulandquot = $_POST["MULANDQUOT"];
$mulordivor = $_POST["MULORDIVOR"];
$numprob = $_POST["NUMPROB"];
// On détermine les nombres max et min
$maxmqnumber = pow(10,($mulandquot)) - 1;
$minmqnumber = pow(10,($mulandquot-1));
$maxmdnumber = pow(10,($mulordivor)) - 1;
$minmdnumber = pow(10,($mulordivor-1));
$retour = "<tr>";
for ($i = 0; $i < $numprob; $i++) {
// formater le tableau comme je veux
// if ($i > 0 AND $numprob < 5) {$retour .= "</tr><tr>";}
if ($i > 0 AND ($i % 5) == 0) {$retour .= "</tr><tr>";}
$retour .= "<td class='nombre'>";
$total = 0;
// $total = $mulandquot * $mulordivor;
$mqnumber = mt_rand($minmqnumber, $maxmqnumber);
$mdnumber = mt_rand($minmdnumber, $maxmdnumber);
$total = $mqnumber * $mdnumber;
switch ($typeop) {
case "mul":
$retour .= number_format($mqnumber, 0, ',', ' ' )."<br />x ".number_format($mdnumber, 0, ',', ' ' );
$retour .= "<p class='reponse'>".number_format($total, 0, ',', ' ' )."</p><p class='noreponse'>&nbsp;</p></td>"; break;
case "div":
$retour .= number_format($total, 0, ',', ' ' )."<br />&divide; ".number_format($mdnumber, 0, ',', ' ' );
$retour .= "<p class='reponse'>".number_format($mqnumber, 0, ',', ' ' )."</p><p class='noreponse'>&nbsp;</p></td>"; break;
break;
}
}
$retour .= "</tr>";
//$retour = $maxmqnumber." - ".$minmqnumber." --- ".$maxmdnumber." - ".$minmdnumber." == ".$mqnumber." - ".$mdnumber;
echo $retour;
// echo "Coming soon... ajax param: ".$typeop." ".$mindigit." - ".$maxdigit." -- ".$numnumb." --- ".$numprob." + ".$maxnumber." - ".$minnumber;
?>
\ No newline at end of file
<!-- <div class="param" id="muldiv"> -->
<form class="formulaire" name="muldiv" action="">
<p><select name="mulandquot" id="mulandquot">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4 selected="selected">4</option>
<option value=5>5</option>
</select> <label for="mulandquot"><span id="mulandquotstr"></span> : <span class="t_Number_of_digits">number of digits</span></label></p>
<p><select name="mulordivor" id="mulordivor">
<option value=1>1</option>
<option value=2 selected="selected">2</option>
<option value=3>3</option>
<option value=4>4</option>
</select> <label for="mulordivor"><span id="mulordivorstr"></span> : <span class="t_Number_of_digits">number of digits</span></label></p>
<p><select name="numprob" id="numprobmuldiv">
<option value=1>1</option>
<option value=2>2</option>
<option value=3 selected="selected">3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=10>10</option>
<option value=20>20</option>
<option value=30>30</option>
<option value=50>50</option>
</select> <label for="numprobmuldiv"><span class="t_Number_of_problems">Number of problems</span></label></p>
</form>
<!-- </div> -->
<script type="text/javascript">
// Placez ici vos scripts de stats
</script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://web.sebille.name/piwik/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "5"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
\ No newline at end of file
BODY {
font-size: 0.9em;
width: 99%;
}
H1 {
font-size: 140%;
}
H2 {
font-size: 120%;
}
H3 {
font-size: 100%;
}
TABLE.resultat {
border: 1px solid #222;
border-spacing: 5px;
}
TABLE.resultat TD {
text-align: right;
border: 1px dotted #222;
padding: 5px;
}
HR.sep {
}
DIV.small, SPAN.small {
font-size: 0.7em;
}
DIV.bigbw {
font-size: 140%;
font-weight: bold;
/* background:black;*/
color:red;
text-align:left;
padding: 5px;
}
DIV.avert {
color:red;
text-align:left;
padding: 5px;
}
IMG#img_avert {
vertical-align: middle;
}
DIV#perle {
background-color: black;
background-image: url("barre_soroban.jpg");
background-position: left 11px;
background-repeat: repeat-x;
width: 180px;
margin-bottom: 5px;
margin-top: 5px;
border: 5px ridge #744C22;
}
IMG#bead {
position: relative;
}
DIV.boutons_operations {
margin-left: 5px;
}
.bouton {
border: 2px none;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
background: #ddd;
background: -webkit-linear-gradient( #fff, #eee);
background: -moz-linear-gradient( #fff, #eee);
background: -ms-linear-gradient( #fff, #eee);
background: -o-linear-gradient( #fff, #eee);
background: linear-gradient( #fff, #eee);
text-shadow: 0px 1px 0px rgba( 255, 255, 255, 0.2);
box-shadow: 0 0 3px rgba( 0, 0, 0, 0.5), 0 -1px 0 rgba( 255, 255, 255, 0.4);
}
input#answersyn {
vertical-align: middle;
}
P.reponse, P.noreponse {
outline: 0px none;
border-top: 1px solid #222;
margin: 0px;
margin-top: 2px;
padding-top: 2px;
}
SPAN.big {
font-weight: bold;
font-size: 140%;
}
DIV#footer {
text-align: left;
border-top: 1px dotted #222;
margin-top: 5px;
padding-top: 5px;
}
DIV#footer a IMG {
vertical-align: middle;
}
DIV#footer_print {
display: none;
}
\ No newline at end of file
BODY {
width: auto!important;
margin: auto!important;
font-family: serif;
font-size: 10pt;
background-color: #fff!important;
color: #000!important;
}
DIV#perle, DIV.boutons, DIV#infohideparam, DIV#footer, FORM.formulaire, BUTTON, INPUT, LABEL {
display: none;
}
H1 {
text-align: center;
}
TABLE#resultat TR {
page-break-inside: avoid;
}
DIV#footer_print {
display: block;
text-align: center;
border-top: 1px dotted #222;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8">
<meta name="keywords" lang="en" content="abaque, abacus, soroban, smartphone, tablet, calculation, calculation sheet, soroban sheet, soroban training, calculation training, exercice soroban, feuille de calcul, tablette, feuille de calcul soroban, apprentissage soroban, entrainement sorobancalu-cul pour soroban">
<meta name="generator" content="Komodo">
<meta name="author" CONTENT="Robert Sebille">
<meta name="description" content="Soroban calculations sheets / Feuille de calcul pour Soroban, user-friendly for smartphones and tablets.">
<meta name="created" CONTENT="2014-03-09">
<meta name="robots" content="follow">
<meta name="viewport" content="width=device-width">
<!-- <script language="JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script> -->
<script language="JavaScript" src="../js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script language="JavaScript" src="../js/soroban.js" type="text/javascript"></script>
<link href="../css/soroban.css" rel="stylesheet" type="text/css" />
<link href="../css/soroban_print.css" rel="stylesheet" type="text/css" media="print" />
<link rel="icon" href="../css/soroban1.png" type="image/x-icon" />
<title>Soroban calculations help</title>
</head>
<body>
<p><a href="javascript:history.back()">Return</a></p>
<h1>Soroban calculations help</h1>
<p>This website was build to do user-friendly with smartphone and tablets too.</p>
<h2>Features</h2>
<p>When you come on the site, you can choose several operations to display:<br />
Additions, subtractions, additions and subtractions, multiplications and integer divisions.</p>
<h3>With additions, subtractions, additions and subtractions, you can choice this settings:</h3>
<ul>
<li>Minimum number of digits (1-15 on 64-bits, 1-8 on 32-bits)</li>
<li>Maximum number of digits (1-15 on 64-bits, 1-8 on 32-bits)</li>
<li>Number of numbers per problem (1-15 on 64-bits, 1-9 on 32-bits)</li>
<li>Number of problems (1-50)</li>
</ul>
<h3>With multiplications and integer divisions, you can choose:</h3>
<ul>
<li>Multiplicand/quotient number of digits (1-9 on 64-bits, 1-5 on 32-bits)</li>
<li>Multiplicator/divisor number of digits (1-5 on 64-bits, 1-4 on 32-bits)</li>
<li>Number of problems (1-50)</li>
</ul>
<p>Any dividend can be divided into an integer answer.</p>
<p>32 bit systems do not support integers larger than 2,147,483,647. The application detects this case and limits the size of the problems available depending this issue.</p>
<h3>General</h3>
<p>An on / off checkbox and its label allows to show or hide the answers at will. Before or after you get new calculations.</p>
<p>The number of problems is common with the addition, subtraction and both. It is different from the multiplication and division, which have their own number of common problems.</p>
<h3>Printing</h3>
<p>When printing, only the title, problems and footer (at the end) will be printed. Page breaks in a problem are prohibited. With very large numbers, it may be necessary to print in landscape mode for correct printing.</p>
<h2>Smartphones and tablets</h2>
<p>The button "Hide title & settins Y/N", below the table of results of a calculation, is usefull and user-friendly with smartphones and tablets when you choose, in the settings above, a low "Number of problems", eg 1, 2 or 3. Then you can reload, eg 1 problem, for each exercice.</p>
<p>The site works locally on my Samsung GT-S7562 (android) with <a href="https://play.google.com/store/apps/details?id=com.andi.serverweb"> Bit Web Server</a> (which costs € 1.87). NB: The android systems are currently 32-bit system.</p>
<p>It's very fluid! Try it ? ;-)</p>
<h2>Links to other resources:</h2>
<ul>
<li><button class="bouton" id="learnsheet">Learn sheets</button> : a soroban sheets generator usefull to learn.</li>
<li><button class="bouton" id="prosheet">Pro sheets</button> : a soroban sheets generator pro.</li>
<li><button class="bouton" id="tomoe">Tomoe Soroban/Abacus Co., Ltd</button> : the famous Soroban/Abacus company in Japan.</li>
</ul>
<h2>Technical issues</h2>
<p>The operations generator is server side, writed in php, and the interface is full html and ajax, with the javascript library jQuery 1.11.0 embedded. So you just need the web and php servers to run the application locally. Your language preference is stored in a cookie.</p>
<div class="small" id="footer"></div>
<div class="small" id="footer_print">&copy; Robert Sebille 2014 - GNU GPL License V3</div>
<div class="small" id="stats" style="display: none;"></div>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//web.sebille.name/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 5]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//web.sebille.name/piwik/piwik.php?idsite=5" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8">
<meta name="keywords" lang="en" content="abaque, abacus, soroban, smartphone, tablet, calculation, calculation sheet, soroban sheet, soroban training, calculation training, exercice soroban, feuille de calcul, tablette, feuille de calcul soroban, apprentissage soroban, entrainement sorobancalu-cul pour soroban">
<meta name="generator" content="Komodo">
<meta name="author" CONTENT="Robert Sebille">
<meta name="description" content="Soroban calculations sheets / Feuille de calcul pour Soroban, user-friendly for smartphones and tablets.">
<meta name="created" CONTENT="2014-03-09">
<meta name="robots" content="follow">
<meta name="viewport" content="width=device-width">
<!-- <script language="JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script> -->
<script language="JavaScript" src="../js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script language="JavaScript" src="../js/soroban.js" type="text/javascript"></script>