//overall conf stat setSkill($progressVoc, $userID, getSkill($progressVoc, $userID) - $skillWrongPen); //cvset prog skill setStat('gold', $userID, getStat('gold', $userID) - $gcPen); //gold incrUserDeckStat('stats_incorrect', $cvset, $vstyle, $userID); for ($i = 0; $i < sizeof($skills); $i++) { setStat($skills[$i], $userID, getScore($skills[$i], $userID) - $scoreDecr); $changeLog[] = "<li>" . getStatInfo($skills[$i], 'display_name') . ": <span class='text-danger'>-{$scoreDecr} Confidence points</span></li>"; } $_SESSION['streak'] = 0; } //Update Statistics //insertFlashcardResults($user_id,$deck_id,$word_id,$word_lv,$vstyle_id,$correct,$time_taken); //****************************************************** //****CHECK IF PLAYER LEVELED UP & PREPARE DISPLAY VARIABLES*** //******************************************** $lvUp = setLevelUp($userID, 'quiz'); //change lv's if needed //***Used to give display correct answer if user guessed wrong $original_kanji = getWord($_POST['questionID'], $questionFromBank); $reading_tmp = getReading($_POST['questionID'], $questionFromBank); $original_reading = $original_kanji == $reading_tmp ? '-' : getReading($_POST['questionID'], $questionFromBank); $original_translation = getWord($answerID, 'etest'); } include '../mc_get.php'; include '../include/kanjiRE.php'; ?>
} } elseif ($vstyle == 'audioR' || $vstyle == 'audioK') { //*************************************************************************************************** //************************************* Answers are Japanese ********************************** //*************************************************************************************************** //Get Question and Answers for MC Via Id's $questionFromBank = 'jtest'; $answerFromBank = 'jtest'; $questionID = getQuizWordID($userID, $vstyle); $answerID = $questionID; $element = 'reading'; $answerChoices = getRandomWords($choiceQ, $answerFromBank, $answerID, $userID, $element); //get random words in HIRAGANA; need to get hiragana, not kanji //Prepare for Display in kanjiRE.php $rand = rand(0, $choiceQ - 1); $answer = $vstyle == 'audioR' || $vstyle == 'kanjiH' ? getReading($answerID, $answerFromBank) : getWord($answerID, $answerFromBank); $answerChoices[$rand]['id'] = $answerID; $answerChoices[$rand][$element] = $answer; //print_r($answerChoices); //Finalized Variables Used in kanjiRE.php $question = $vstyle == 'audioR' || $vstyle == 'audioK' ? getWordInfo('audio_filename', $questionID, $questionFromBank) : getWord($questionID, $questionFromBank); if (isSentencesDeck(getVocStat('cvset', $userID)) == '1') { $sentences = getSentences($questionID); } else { $sentences = False; } } elseif (getSkill('vStyle', $userID) == 'engK' || getSkill('vStyle', $userID) == 'engKR') { //*************************************************************************************************** //*************************************English<-->Kanji+Hiragana; Hiragana*************************** //*************************************************************************************************** //$choiceQ = 5;
$changeLog[] = "<li>Overall Player Confidence:<b> <span class='text-danger'>-{$confWrongPen} Confidence points</span></b></li>"; $changeLog[] = "<li>Quiz Mode Confidence: <span class='text-danger'>-{$skillWrongPen} Confidence points(xp)</span></li>"; $changeLog[] = "<li>Streak Bonus: Reset to 0</li>"; $_SESSION['streak'] = 0; $result = "<span style='color:#E15119'>WRONG..</span>"; } $changeLog[] = "</ul></div>"; //******************************************************************************* //********CHECK IF PLAYER LEVELED UP & PREPARE DISPLAY VARIABLES***************** //******************************************************************************* $lvUp = setLevelUp($userID, 'quiz'); //change lv's if needed //Prepare Summary of Guess Results (correct/incorrect) for User Display $previousQ = "<span style='color:green;'>" . getWord($_POST['questionID'], $questionFromBank) . "</span>"; if (getSkill('vStyle', $userID) == 'kanjiH') { $previousA = "<span style='color:green;'>" . getReading($answerID, $answerFromBank) . "</span>"; } else { $previousA = "<span style='color:green;'>" . getWord($answerID, $answerFromBank) . "</span>"; } $origQ = getWord($_POST['questionID'], $questionFromBank); $lv = getStat('lv', $userID); $currentConf = getStat('conf', $userID); $maxconf = getStat('maxconf', $userID); $currConfPerc = $currentConf / $maxconf * 100; $vsLv = getSkill($cvset . '_' . $vstyle . '_lv', $userID); $vsProg = getSkill($cvset . '_' . $vstyle . '_prog', $userID); $vsProgMax = getSkill($cvset . '_' . $vstyle . '_prog_max', $userID); } include '../display_mc.php'; ?>
function noRepeat() { include 'config.php'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'); mysql_select_db($dbname); $cvset = getSkill('cvset', $userID); $query = sprintf("SELECT id FROM jtest WHERE {$cvset} !=0 AND {$cvset} <='%s' AND word != reading ORDER BY RAND() LIMIT 1", mysql_real_escape_string(getSkill($cvset . "_lv", $userID))); $result = mysql_query($query) or die(mysql_error()); list($question) = mysql_fetch_row($result); //echo $question; $word = getWord($question, 'jtest'); $r = getReading($question, 'jtest'); //echo "$word::$r </br>"; if (getWord($question, 'jtest') == getReading($question, 'jtest')) { echo "Found duplicate word({$word}) and reading({$r}), finding another </br>"; noRepeat(); } else { return $question; } }
function clickChoiceInfoToQuestionsKanji($infoArr) { require_once 'words.php'; $qaArr = array(); for ($i = 0; $i < count($infoArr); $i++) { $choicesStr = ""; $temp = explode(',', $infoArr[$i]['choices'], -1); shuffle($temp); $choicesStr .= '<p><div class="btn-group col-xs-12">'; for ($j = 0; $j < count($temp); $j++) { $q = $i + 1; $c = $j + 1; $idStr = "{$q}.{$c}"; if ($temp[$j] == $infoArr[$i]['correct']) { $infoArr[$i]['correctid'] = $idStr; } $choicesStr .= "<div class=' no-pad-left pull-left'><button type='button' class='btn btn-default btn-sm' id='{$idStr}' style='font-size:1.0em; margin-right:0.2em;' title='" . getReading($temp[$j], 'jtest') . "' onClick='setUserResponse({$q},{$idStr})'>" . $temp[$j] . "</button></div>"; //id's of choices are 0.0;0.1;0.2 } $choicesStr .= '</div></p>'; $qaArr[$i]['question'] = count(explode('<u>', $infoArr[$i]['sentence'])) == 1 ? str_replace("{(choices)}", '__________', $infoArr[$i]['sentence']) . '<p>' . $choicesStr . '</p>' : str_replace("{(choices)}", $choicesStr, $infoArr[$i]['sentence']); $qaArr[$i]['correct'] = $infoArr[$i]['correct']; $qaArr[$i]['correctid'] = $infoArr[$i]['correctid']; } return $qaArr; }
function clickChoiceInfoToQuestions($infoArr) { require_once 'words.php'; $qaArr = array(); for ($i = 0; $i < count($infoArr); $i++) { $choicesStr = ""; $temp = explode(',', $infoArr[$i]['choices'], -1); shuffle($temp); $choicesStr .= '<div class="btn-group">'; for ($j = 0; $j < count($temp); $j++) { $q = $i + 1; $c = $j + 1; $idStr = "{$q}.{$c}"; if ($temp[$j] == $infoArr[$i]['correct']) { $infoArr[$i]['correctid'] = $idStr; } $choicesStr .= " <button type='button' class='btn btn-info btn-xs' id='{$idStr}' style='font-size:1.0em; margin-right:0.2em;' title='" . getReading($temp[$j], 'jtest') . "' onClick='setUserResponse({$q},{$idStr})'>" . $temp[$j] . "</button>"; //id's of choices are 0.0;0.1;0.2 } $choicesStr .= '</div>'; $qaArr[$i]['question'] = str_replace("(choices)", $choicesStr, $infoArr[$i]['sentence']); $qaArr[$i]['correct'] = $infoArr[$i]['correct']; $qaArr[$i]['correctid'] = $infoArr[$i]['correctid']; } return $qaArr; }