(count($modal_verbs)-1) || $modalTest<0) $modalTest = -1; $title = "Combined Modal Verbs Test (personal ".($modalTest==-1?"modal verbs":($modalTest==1?"pseudo-":"")."modal verb \"".$modal_verbs[$modalTest][3]."\"").", 2 agents, ".($isSpoken?"spoken":"written")." style, ".($isPersScript?"Persian script":"transcription").", Present Indicative)"; $bodyParams = ($isSpoken?'text="#FFFFFF" bgcolor="#808080"':'text="#000000" bgcolor="#CC99FF"'); $total = 50; //#################################### // Sending a letter to the instructor if (isset($_POST['sendinfo'])) { $link = mysql_connect("localhost", $login, $pass) or die("Could not connect: " . mysql_error()); mysql_select_db($db) or die("Could not select database"); $stname = htmlspecialchars($_POST['stname']); $email = htmlspecialchars($_POST['email']); // if ($_POST['univer']=='University of Texas at Austin') { // $sql = "INSERT INTO test_results (`date`, `name`, `email`, `othertest_id`, `grade`, comment) // VALUES ('".date('Y-m-d H:i:s')."', '$stname', '$email', 36, 'A', '');"; // mysql_query($sql); // } $mailtext = "This is the letter from the $title. $stname from {$_POST['univer']} has successfully answered all the questions of this test! His/her e-mail is $email Best regards, Persian Test System {$_SERVER['HTTP_REFERER']}"; $uri = $_SERVER['HTTP_REFERER']; $header = "From: {$_POST['email']}\n" ."MIME-Version: 1.0\n" ."Content-Type: text/plain; charset=\"windows-1252\"\n" ."Content-Transfer-Encoding: 7bit\n"; if ($_POST['univer']=='University of Michigan') { $mb = 0; $mailto = "aghaeib@umich.edu"; } elseif ($_POST['univer']=='South Orange County Community College District') { $mb = 1; $mailto = "monird@cox.net"; } elseif ($_POST['univer']=='UT Informal Class') { $mb = 2; $mailto = "blake.atwood@gmail.com"; } else { $mb = 3; $mailto = "connieb@gmail.com"; } $subject = $title; $uri = base64_encode($uri); $error = "Sorry. This service is unavailable right now. Try to send a e-mail later."; /* $PostData = "mb=$mb&sbj=$subject&stname=$stname&email=$email&uri=$uri"; $len = strlen($PostData); $fp = fsockopen("students.washington.edu", 80, $errno, $errstr, 30); if ($fp) { fputs($fp, "POST /irina/tests/emailer.php HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;.NET CLR 1.1.4322; .NET CLR 2.0.50215) Host: students.washington.edu Connection: close Content-Type: application/x-www-form-urlencoded Content-Length: $len $PostData"); $page = ""; while (!feof($fp)) $page .= fgets($fp, 128); fclose($fp); if (substr($page, strlen($page)-6)=="SENDOK") { $sent = true; $error = ""; } // echo ""; } */ // 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 - $title", $mailtext, $header); exit(' '.$title.'

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

Back to the Persian Tests "); } function GetQuestion($person, $person2, $negative, $verb) { global $isPersScript; $persons = array(1 => 'I', 'You', 'He/she/it', 'We', 'You', 'They'); $persons2 = array(1 => 'me', 'you', 'him/her/it', 'us', 'you', 'them'); $be = array(1 => 'am', 'are', 'is', 'are', 'are', 'are'); $verb = str_replace(",", "", $verb); $words = explode(' ', $verb); // if there is a preposition after the verb $question = $persons[$person].' '; if ($negative) { if ($words[0]=='be') { $question .= $be[$person] . " not"; } elseif ($words[0]=='must') { $question .= $words[0] . " not"; } else { if ($person==3) $question .= "does not $words[0]"; else $question .= "do not $words[0]"; if ($words[0]=='let') { $question .= ', '.array_pop($words); } } } else { if ($words[0]=='be') { $question .= $be[$person]; } else { if ($person==3 && $words[0]!='must') $question .= eng3sgVerb($words[0]); else $question .= $words[0]; if ($words[0]=='let') { $question .= ', '; $verb2 = array_pop($words); if ($person==3) $question .= eng3sgVerb($verb2); else $question .= $verb2; } } } for ($i=1; $i .css"> 321".($id?"":" AND (e1.hassnd=1 OR e1.hassndtest=1)")." AND e2.style=0".($id?" AND e1.id=$id":" ORDER BY RAND()").";"); else $r = mysql_query("SELECT * FROM pvc_verbs WHERE id<>26 AND isnew=0 AND level=1 AND style=0".($id?"":" AND (hassnd=1 OR hassndtest=1)")." AND translation IS NOT NULL".($id?" AND id=$id":" ORDER BY RAND()").";"); $row = mysql_fetch_assoc($r); if ($row===false) exit("The verb is not found"); $verb_id = $row['id']; if ($isPersScript) { $randomVerb = $row['pers_inf']; $presStem = $row['pers_presstem']; } else { $randomVerb = $row['trans_inf']; $presStem = $row['trans_presstem']; } $presStemTrans = $row['trans_presstem']; $engVerb = $row['translation']; $engVerbs = explode(',', $engVerb); $engVerb = $engVerbs[0]; if (substr($engVerb, 0, 3)=='to ') $engVerb = substr($engVerb, 3); // 1 - correct; 2 - wrong person; 3 - wrong tense, 4 - wrong tense and person, // 5 - wrong object person, 6 - wrong object person and tense $qtypes = range(2, 6); shuffle($qtypes); $qtypes = array_slice($qtypes, 0, 3); $qtypes[] = 1; shuffle($qtypes); $answer = array_search(1, $qtypes); //Make a list of answers - person numbers $persons = range(1, 6); shuffle($persons); $persons2 = range(1, 6); do { shuffle($persons2); } while ($persons[$answer]==$persons2[$answer]); if ($isSpoken) $wrong_tenses = array(1, 2, 5, 6); else $wrong_tenses = array(1, 2, 4, 5, 6, 8, 10); if ($presStemTrans!="dār") $wrong_tenses[] = 3; shuffle($wrong_tenses); $neg = array(0, 0, 0, 1, 1, 1); shuffle($neg); $tenses = array(); for ($j=0; $j<4; $j++) { switch ($qtypes[$j]) { case 1: // correct answer case 2: // wrong person case 5: // wrong object person if ($presStemTrans=="dār") $tenses[] = 3; else $tenses[] = 9; break; default: do { $tense = array_shift($wrong_tenses); } while (Conjugate(substr($randomVerb, 0, strlen($randomVerb)-2), $presStem, $presStemTrans, $tense, $persons[$j])==""); $tenses[] = $tense; // It is not wrong to have the perfect subjunctive. // It may be rare, but it is possible. // Make them wrongly positive or negative if ($tense==3 && $neg[$j]==$neg[$answer]) { $neg[$j] = abs($neg[$answer]-1); } break; } if (in_array($qtypes[$j], array(3, 5, 6))) { $persons[$j] = $persons[$answer]; } if (in_array($qtypes[$j], array(2, 3, 4))) { $persons2[$j] = $persons2[$answer]; } // only one YOU should be among answers if ($qtypes[$j]==2) { if ($persons[$answer]==2 && $persons[$j]==5) { $persons[$j] = array_pop($persons); } if ($persons[$answer]==5 && $persons[$j]==2) { $persons[$j] = array_pop($persons); } } if ($qtypes[$j]==5) { if ($persons2[$answer]==2 && $persons2[$j]==5) { $persons2[$j] = array_pop($persons2); } if ($persons2[$answer]==5 && $persons2[$j]==2) { $persons2[$j] = array_pop($persons2); } } } if ($modalTest==-1) { $modal = rand(0, 1); } else { $modal = $modalTest; } $data = "$verb_id:$engVerb:".implode(",", $persons2).":$answer:".implode(",", $persons).":".implode(",", $tenses).":".implode(",", $qtypes).":".implode(",", $neg).":$modal:$question"; $data = base64_encode($data); } $pastStem = substr($randomVerb, 0, strlen($randomVerb)-2); if (!$correct) { print "\n"; } else { print "\n"; } ?>

$total) { 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 "

Question $question out of $total"; } print "

"; if (isset($_POST['check']) && $correct==0) { print "

You are wrong! "; } ?> Please translate to Persian:

".GetQuestion($persons[$answer], $persons2[$answer], $neg[$answer], $modal_verbs[$modal][3])." $engVerb."; print ""; for ($j=1; $j<=4; $j++) { $modal_verb = Conjugate($modal_verbs[$modal][0], $modal_verbs[$modal][1], $modal_verbs[$modal][2], ($neg[$j-1]==1?17:7), ($modal==2?3:$persons[$j-1])); print ""; } print "
$modal_verb ".Conjugate($pastStem, $presStem, $presStemTrans, $tenses[$j-1], $persons2[$j-1])."
"; } print "

"; ?>

Back to the Persian Verb Conjugator Basic Verb Conjugation Tests"; ?>

Back to the Persian Tests