' . "\n";
echo '
' . $this->message . "
\n";
echo '
'.($this->selectedCard == null ? '' : $this->selectedCard->front.' | '.$this->db->getClassNameByClassID($this->selectedCard->classID))."
\n";
echo '
' . "\n";
echo '
Case sensitive' . "\n";
echo "
\n";
}
private function selectCardIfBoxSelected() {
// Select random card from selected box since none is selected yet:
if($this->selectedBoxID != null && $this->selectedCard == null) {
$this->selectNewCard();
/*
if($this->selectedCard != null) {
// Give the user some info...
$this->message = $this->selectedCard->front.' | '.$this->db->getClassNameByClassID($this->selectedCard->classID);
}
*/
}
}
private function runTestIfUserInput() {
// Do some evaluation...
if(isset($this->selectedCard) && $this->testInput != null) {
// Copy values to be mangled :)
$a = $this->selectedCard->back;
$b = $this->testInput;
// Normalize Umlauts
$umlauts = array(
"ä"=>"ae",
"Ä"=>"Ae",
"ö"=>"oe",
"Ö"=>"Oe",
"ü"=>"ue",
"Ü"=>"Ue",
"ß"=>"ss",
"ẞ"=>"Ss"
);
$a = str_replace(array_keys($umlauts), array_values($umlauts), $a);
$b = str_replace(array_keys($umlauts), array_values($umlauts), $b);
// Case insensitive...
if(!$this->checkCase) {
$a = strtolower($a);
$b = strtolower($b);
}
//Answer correct:
if($a == $b) {
if($this->selectedCard->back == $this->testInput) {
$this->message = 'Correct';
}
else {
$this->message = 'Correct spelling but wrong upper/lower case';
}
/*
if($this->selectedCard->boxID >= 0 && $this->selectedCard->boxID < 3) {
$this->selectedCard->boxID = 4;
}
else if($this->selectedCard->boxID >= 3 && $this->selectedCard->boxID < $this->db->getNumBoxes()-1) {
$this->selectedCard->boxID += 1;
}
*/
$this->selectedCard->boxID = $this->db->getNewBoxIDOnCorrectByBoxID($this->selectedCard->boxID);
}
//Answer wrong:
else {
$this->message = 'Wrong - Correct answer: