'I', 'You', 'He', 'We', 'You (pl.)', 'They'); $question = $persons[$person]." ______."; // if ($person==3) $question .= eng3sgVerb($verb); // else $question .= $verb; // $question .= ". ".$persons[$q_person]." ______."; return $question; } function EngConjugate($verb, $person) { if ($verb=='be') { if ($person==1) return 'am'; elseif ($person==3) return 'is'; else return 'are'; } elseif ($person==3) { return eng3sgVerb($verb); } return $verb; } function eng3sgVerb($verb) { $words = explode(' ', $verb); // if there is a preposition after the verb $vowels = 'aeiou'; $len = strlen($words[0]); if ($words[0]=='be') $verbform = 'is'; elseif ($words[0]=='have') $verbform = 'has'; elseif (substr($words[0], $len-1)=='y') { if (strpos($vowels, substr($words[0], $len-2, 1))===false) { $verbform = substr($words[0], 0, $len-1)."ies"; // deny -> denies } } elseif (substr($words[0], $len-1)=='o' || substr($words[0], $len-2)=='ss' || substr($words[0], $len-2)=='sh' || substr($words[0], $len-2)=='ch') { $verbform = $words[0]."es"; // go -> goes } if (empty($verbform)) $verbform = $words[0]."s"; if (count($words)>1) { // if there is a preposition after the verb for ($i=1; $i"; } */ // header("Location: http://students.washington.edu/irina/tests/emailer.php?mb=$mb&sbj=$subject&stname=$stname&email=$email&uri=$uri"); // exit(); $sent = mail($mailto, "Persian Test System - Boyle Patterns", $mailtext, $header); exit(' Boyle Patterns Test

'.($sent?"Your results have successfully been sent to your Instructor!":$error)."

Back to the Persian Tests "); } //#################################### // Question generation or retrieving $isPersScript = !isset($_GET['trans']); $part = 0; if (isset($_POST['check'])) { $part = $_POST['part']; $data = $_POST['data']; $newdata = explode(":", $data); $newdata = explode(":", base64_decode($data)); $verbs_pers = explode(",", $newdata[0]); $engVerbs = explode(",", $newdata[1]); $persons = explode(",", $newdata[2]); $questions_data = explode(";", $newdata[3]); $questions = array(); for ($i=0; $i<20; $i++) array_push($questions, explode(",", $questions_data[$i])); $answers = explode(",", $newdata[4]); $qtypes = explode(",", $newdata[5]); $verbs = array(); for ($i=0; $i<20; $i++) { $query = "SELECT * FROM pvc_verbs WHERE id={$verbs_pers[$i]};"; $r = mysql_query($query); $row = mysql_fetch_array($r, MYSQL_BOTH); array_push($verbs, $row); } } else { srand((float)microtime() * 1000000); $verbs = array(); $engVerbs = array(); for ($i=1; $i<=10; $i++) { $r = mysql_query("SELECT * FROM pvc_verbs WHERE `testtype`=$i ORDER BY RAND() LIMIT 0,2;"); while ($row = mysql_fetch_array($r, MYSQL_BOTH)) { array_push($verbs, $row); } } shuffle($verbs); for ($i=0; $i<20; $i++) { $engVerb = $verbs[$i]['translation']; $temp = explode(',', $engVerb); $engVerb = trim($temp[array_rand($temp)]); if (substr($engVerb, 0, 3)=='to ') $engVerb = substr($engVerb, 3); array_push($engVerbs, $engVerb); // Select one verb if there are synonyms } //Make a list of answers - person numbers $persons = array_merge(range(1,6), range(1,6), range(1,6), range(1,2)); shuffle($persons); $qtypes = array_merge(array_fill(0, 10, 0), array_fill(10, 10, 1)); shuffle($qtypes); $answers = array(); $questions = array(); for ($i=0; $i<20; $i++) { if ($qtypes[$i]==1) $temp = array(2, 5, 7); else $temp = array(2, 5, 1); shuffle($temp); //Shuffle 3 tenses: 2 - Imperfect, 5 - Present Perfect, //7 - Present Indecative or 1 - Simple Past (correct) array_push($questions, $temp); for ($j=0; $j<3; $j++) { if ($questions[$i][$j]==1 || $questions[$i][$j]==7) { array_push($answers, $j); //Remember the number of the correct answer break; } } } $data = $verbs[0]["id"]; for ($i=1; $i<20; $i++) $data .= ",".$verbs[$i]["id"]; $data .= ":".implode(",", $engVerbs).":".implode(",", $persons).":"; for ($i=0; $i<20; $i++) $data .= implode(",", $questions[$i]).";"; $data .= ":".implode(",", $answers).":".implode(",", $qtypes); $data = str_replace(",;", ";", $data); $data = str_replace(";:", ":", $data); $data = base64_encode($data); } ?> Boyle Patterns Test \n

Tenses

\n"; $part++; if ($part==ceil($total/10)) { print "

You have answered all $total questions correctly. Fill the form and click the button to send the results to your instructor:

\n"; include("emailform.php"); exit(); } else { print "

You have completed $end out of $total, ".($total-$end)." left to go.

"; } } else { ?> \n

Tenses

You have answered $correct questions of $answcount correctly. Try again."; } } else { print "\n

Tenses

There are $total questions in this test. Answer the first 10:"; } ?>

Please change verbs, keeping the same person:

"> ".Conjugate($pastStem, $presStem, $presStemTrans, 1, $persons[$i-1]); print ", whose infinitive means \"to $engVerb\" (from the Simple Past to the Present Indicative)"; } else { print "

".Conjugate($pastStem, $presStem, $presStemTrans, 7, $persons[$i-1]); print ", whose infinitive means \"to $engVerb\" (from the Present Indicative to the Simple Past)"; } print ""; print ""; print "
".Conjugate($pastStem, $presStem, $presStemTrans, $questions[$i-1][0], $persons[$i-1])."
".Conjugate($pastStem, $presStem, $presStemTrans, $questions[$i-1][1], $persons[$i-1])."
".Conjugate($pastStem, $presStem, $presStemTrans, $questions[$i-1][2], $persons[$i-1])."
"; } print "

"; ?>


Persian Verb Conjugator

Back to the Persian Tests