function getTexter($parts) { $randLength = mt_rand(25, 35); for ($i = 0; $i < $randLength; $i++) { getSentence($parts); } }
function getSentenceCode() { $sentenceInfo = getSentence(); $number = $sentenceInfo['number']; }
} $record = mysql_fetch_assoc($res); if ($record) { // random sent found $num = 1; $seid = $record['SeID']; if (AreUnknownWordsInSentence($seid)) { if ($debug) { echo "DEBUG sent: {$seid} has unknown words<br />"; } $sentexcl = ' AND SeID != ' . $seid . ' '; $num = 0; // not yet found, $num == 0 (unknown words in sent) } else { // echo ' OK '; $sent = getSentence($seid, $wordlc, (int) getSettingWithDefault('set-test-sentence-count')); $sent = $sent[1]; if ($debug) { echo "DEBUG sent: {$seid} OK: {$sent} <br />"; } $pass = 3; // found, $num == 1 } } else { // no random sent found $num = 0; $pass = 3; if ($debug) { echo "DEBUG no random sent found<br />"; } // no sent. take term sent. $num == 0
runsql("DELETE " . $tbpref . "texttags FROM (" . $tbpref . "texttags LEFT JOIN " . $tbpref . "texts on TtTxID = TxID) WHERE TxID IS NULL", ''); adjust_autoincr('texts', 'TxID'); adjust_autoincr('sentences', 'SeID'); adjust_autoincr('textitems', 'TiID'); } elseif ($markaction == 'addtag') { $message = addtexttaglist($actiondata, $list); } elseif ($markaction == 'deltag') { $message = removetexttaglist($actiondata, $list); header("Location: edit_texts.php"); exit; } elseif ($markaction == 'setsent') { $count = 0; $sql = "select WoID, WoTextLC, min(TiSeID) as SeID from " . $tbpref . "words, " . $tbpref . "textitems where TiLgID = WoLgID and TiTextLC = WoTextLC and TiTxID in " . $list . " and ifnull(WoSentence,'') not like concat('%{',WoText,'}%') group by WoID order by WoID, min(TiSeID)"; $res = do_mysql_query($sql); while ($record = mysql_fetch_assoc($res)) { $sent = getSentence($record['SeID'], $record['WoTextLC'], (int) getSettingWithDefault('set-term-sentence-count')); $count += runsql('update ' . $tbpref . 'words set WoSentence = ' . convert_string_to_sqlsyntax(repl_tab_nl($sent[1])) . ' where WoID = ' . $record['WoID'], ''); } mysql_free_result($res); $message = 'Term Sentences set from Text(s): ' . $count; } elseif ($markaction == 'rebuild') { $count = 0; $sql = "select TxID, TxLgID from " . $tbpref . "texts where TxID in " . $list; $res = do_mysql_query($sql); while ($record = mysql_fetch_assoc($res)) { $id = $record['TxID']; $message2 = runsql('delete from ' . $tbpref . 'sentences where SeTxID = ' . $id, "Sentences deleted"); $message3 = runsql('delete from ' . $tbpref . 'textitems where TiTxID = ' . $id, "Text items deleted"); adjust_autoincr('sentences', 'SeID'); adjust_autoincr('textitems', 'TiID'); splitCheckText(get_first_value('select TxText as value from ' . $tbpref . 'texts where TxID = ' . $id), $record['TxLgID'], $id);
);"><img src="icn/sticky-notes-stack.png" title="Show Sentences" alt="Show Sentences" /> Show Sentences</span></div> <?php } else { $sql = 'select WoTranslation, WoSentence, WoRomanization, WoStatus from ' . $tbpref . 'words where WoID = ' . $wid; $res = do_mysql_query($sql); if ($record = mysql_fetch_assoc($res)) { $status = $record['WoStatus']; if ($fromAnn == '') { if ($status >= 98) { $status = 1; } } $sentence = repl_tab_nl($record['WoSentence']); if ($sentence == '' && isset($_REQUEST['tid']) && isset($_REQUEST['ord'])) { $seid = get_first_value("select TiSeID as value from " . $tbpref . "textitems where TiTxID = " . $_REQUEST['tid'] . " and TiWordCount = 1 and TiOrder = " . $_REQUEST['ord']); $sent = getSentence($seid, $termlc, (int) getSettingWithDefault('set-term-sentence-count')); $sentence = repl_tab_nl($sent[1]); } $transl = repl_tab_nl($record['WoTranslation']); if ($transl == '*') { $transl = ''; } ?> <form name="editword" class="validate" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post"> <input type="hidden" name="WoLgID" id="langfield" value="<?php echo $lang; ?>
function get20Sentences($lang, $wordlc, $jsctlname, $mode) { global $tbpref; $r = '<p><b>Sentences in active texts with <i>' . tohtml($wordlc) . '</i></b></p><p>(Click on <img src="icn/tick-button.png" title="Choose" alt="Choose" /> to copy sentence into above term)</p>'; $sql = 'SELECT DISTINCT SeID, SeText FROM ' . $tbpref . 'sentences, ' . $tbpref . 'textitems WHERE TiTextLC = ' . convert_string_to_sqlsyntax($wordlc) . ' AND SeID = TiSeID AND SeLgID = ' . $lang . ' order by CHAR_LENGTH(SeText), SeText limit 0,20'; $res = do_mysql_query($sql); $r .= '<p>'; $last = ''; while ($record = mysql_fetch_assoc($res)) { if ($last != $record['SeText']) { $sent = getSentence($record['SeID'], $wordlc, $mode); $r .= '<span class="click" onclick="{' . $jsctlname . '.value=' . prepare_textdata_js($sent[1]) . '; makeDirty();}"><img src="icn/tick-button.png" title="Choose" alt="Choose" /></span> ' . $sent[0] . '<br />'; } $last = $record['SeText']; } mysql_free_result($res); $r .= '</p>'; return $r; }
} else { if (isset($_SESSION['data']) && $_SESSION['data']) { $data = $_SESSION['data']; $_SESSION['data'] = null; } } if (!$data) { // Pick the word/letter if ($_SESSION['type'] == "Words") { $data = getWord(); } else { if ($_SESSION['type'] == "Letters") { $data = getLetter(); } else { if ($_SESSION['type'] == "Sentences") { $data = getSentence(rand(1, 6)); } else { if ($_SESSION['type'] == "Koch Method") { $data = getKochSentence($_SESSION['koch_size'], rand(1, 6)); } } } } } ?> <html> <head></head> <body onLoad="document.getElementById('answer').focus()"> <?php // Send data to arduino if available $ch = curl_init('http://192.168.1.86/training?p=pa55word&d=' . $data);