|
Learning with Texts - Fork
2.10.0-fork
Learn foreign languages with texts
|
Show test frame. More...
Namespaces | |
| Lwt | |
Functions | |
| do_test_get_identifier ($selection, $sess_testsql, $lang, $text) | |
| do_test_get_test_sql ($selection, $sess_testsql, $lang, $text) | |
| do_test_get_test_type ($testtype) | |
| get_test_sql () | |
| get_test_type () | |
| do_test_test_css () | |
| do_test_get_tomorrow_tests_count ($testsql) | |
| do_test_test_finished ($testsql, $totaltests, $ajax=false) | |
| do_test_test_sentence ($wid, $lang, $wordlc) | |
| do_test_get_term_test ( $wo_record, $sent, $testtype, $nosent, $regexword) | |
| print_term_test ($wo_record, $sent, $testtype, $nosent, $regexword) | |
| do_test_get_word ($testsql) | |
| get_test_solution ($testtype, $wo_record, $nosent, $wo_text) | |
| do_test_prepare_ajax_test_area ( $selector, $selection, $count, $testtype) | |
| prepare_test_area ($testsql, $totaltests, $count, $testtype) | |
| do_test_test_interaction_globals ($wb1, $wb2, $wb3, $lg_id) | |
| do_test_test_javascript_clickable ($wo_record, $solution) | |
| do_test_test_javascript_interaction ( $wo_record, $wb1, $wb2, $wb3, $testtype, $nosent, $save) | |
| prepare_test_footer ($notyettested) | |
| do_test_footer ($notyettested, $wrong, $correct) | |
| do_test_test_javascript ($count) | |
| do_test_test_content () | |
| do_test_test_content_ajax ($selector, $selection) | |
Show test frame.
Call: do_test_test.php?type=[testtype]&lang=[langid] Call: do_test_test.php?type=[testtype]&text=[textid] Call: do_test_test.php?type=[testtype]&selection=1 (SQL via $_SESSION['testsql'])
PHP version 8.1
| do_test_footer | ( | $notyettested, | |
| $wrong, | |||
| $correct | |||
| ) |
Echoes HTML code for the footer of a words test page.
| int | $notyettested | Number of words left to be tested |
| int | $wrong | Number of failed tests |
| int | $correct | Number of correct answers. |
| do_test_get_identifier | ( | $selection, | |
| $sess_testsql, | |||
| $lang, | |||
| $text | |||
| ) |
Get the SQL string to perform tests.
| int | null | $selection | Test is of type selection |
| string | null | $sess_testsql | SQL string for test |
| int | null | $lang | Test is of type language, for the language $lang ID |
| int | null | $text | Testing text with ID $text |
@psalm-return list{string, int|non-empty-list<int>|string}
| do_test_get_term_test | ( | $wo_record, | |
| $sent, | |||
| $testtype, | |||
| $nosent, | |||
| $regexword | |||
| ) |
Return the test relative to a word.
| array | $wo_record | Query from the database regarding a word. |
| string | $sent | Sentence containing the word. |
| int | $testtype | Type of test |
| bool | int | $nosent | 1 or true if you want to hide sentences. |
| string | $regexword | Regex to select the desired word. |
@psalm-return list{string, string}
| do_test_get_test_sql | ( | $selection, | |
| $sess_testsql, | |||
| $lang, | |||
| $text | |||
| ) |
Get the SQL string to perform tests.
| int | null | $selection | Test is of type selection |
| string | null | $sess_testsql | SQL string for test |
| int | null | $lang | Test is of type language, for the language $lang ID |
| int | null | $text | Testing text with ID $text |
| do_test_get_test_type | ( | $testtype | ) |
Get the test type clamped between 1 and 5 (included)
| int | $testtype | Initial test type value |
| do_test_get_tomorrow_tests_count | ( | $testsql | ) |
Return the number of test due for tomorrow.
| string | $testsql | Test selection string |
| do_test_get_word | ( | $testsql | ) |
Find the next word to test.
| string | $testsql | Test selection string |
@psalm-return array<string, float|int|null|string>
| do_test_prepare_ajax_test_area | ( | $selector, | |
| $selection, | |||
| $count, | |||
| $testtype | |||
| ) |
Preforms the HTML of the test area, to update through AJAX.
| string | $selector | On which set to run the test. |
| array | int | $selection | ID of the elements of the set to use. |
| int | $count | Number of tests left. |
| int | $testtype | Type of test (words, sentences, etc...). |
@global string $tbpref Table prefix @global int $debug Show the SQL query used if 1.
@psalm-return int<0, max>
Get a new word test.
| {array} | review_data Data to use |
| do_test_test_content | ( | ) |
Do the main content of a test page.
@global int $debug Show debug informations
| do_test_test_content_ajax | ( | $selector, | |
| $selection | |||
| ) |
Do the main content of a test page.
| string | $selector | Type of test to run |
| array | int | $selection | Items to run the test on |
@global int $debug Show debug informations
| do_test_test_css | ( | ) |
Prepare the css code for tests.
| do_test_test_finished | ( | $testsql, | |
| $totaltests, | |||
$ajax = false |
|||
| ) |
Output a message for a finished test, with the number of tests for tomorrow.
| string | $testsql | Query used to select words. |
| int | $totaltests | Total number of tests. |
| bool | $ajax | AJAX mode, content will not be displayed. |
| do_test_test_interaction_globals | ( | $wb1, | |
| $wb2, | |||
| $wb3, | |||
| $lg_id | |||
| ) |
Prepare JavaScript code globals so that you can click on words.
| string | $wb1 | URL of the first dictionary. |
| string | $wb2 | URL of the secondary dictionary. |
| string | $wb3 | URL of the google translate dictionary. |
| int | $lg_id | Language ID (since 2.10.0-fork) |
| do_test_test_javascript | ( | $count | ) |
Prepare JavaScript code for interacting between the different frames.
| int | $count | Total number of tests that were done today |
Prepare the different frames for a test.
Adds a word reading event.
Insert a new word test.
| {number} | word_id Word ID |
| {string} | solution Test answer |
| {string} | group HTML group to display (either term, translation, sentence...) |
Handles an ajax query for word tests.
| {JSON} | current_test Current test data |
| {number} | total_tests Total number of tests for the day |
| {string} | test_key Key identifier for the test to run |
| {string} | selection Selection of data to run the test on |
Get new term to test through AJAX
| {JSON} | review_data Various data on the current test |
Make a custom display when tests are finished for today.
| do_test_test_javascript_clickable | ( | $wo_record, | |
| $solution | |||
| ) |
Prepare JavaScript code so that you can click on words.
| array | $wo_record | Word record. Associative array with keys 'WoID', 'WoTranslation'. |
| string | $solution | Solution to the test (as HTML) |
Read the word aloud
| do_test_test_javascript_interaction | ( | $wo_record, | |
| $wb1, | |||
| $wb2, | |||
| $wb3, | |||
| $testtype, | |||
| $nosent, | |||
| $save | |||
| ) |
Prepare JavaScript code so that you can click on words.
| array | $wo_record | Word record. Associative array with keys 'WoID', 'WoTranslation'. |
| string | $wb1 | URL of the first dictionary. |
| string | $wb2 | URL of the secondary dictionary. |
| string | $wb3 | URL of the google translate dictionary. |
| int | $testtype | Type of test |
| int | $nosent | 1 to use single word instead of sentence. |
| string | $save | Word or sentence to use for the test |
@global string $tbpref Database table prefix @global string $angDefs Languages definition array
| do_test_test_sentence | ( | $wid, | |
| $lang, | |||
| $wordlc | |||
| ) |
Get a sentence containing the word.
The sentence should contain at least 70% of known words.
| int | $wid | The word to test. |
| mixed | $lang | ID of the language, will be removed in PHP 3.0.0 |
| string | $wordlc | Word in lowercase |
@global string $tbpref Table prefix
@psalm-return list{null|string, 0|1}
| get_test_solution | ( | $testtype, | |
| $wo_record, | |||
| $nosent, | |||
| $wo_text | |||
| ) |
Get the solution to a test.
| int | $testtype | Test type between 1 and 5 |
| array | $wo_record | Word record element |
| bool | $nosent | Test is in word mode |
| string | $wo_text | Word text |
| get_test_sql | ( | ) |
Set sql request for the word test.
@global string $tbpref
| get_test_type | ( | ) |
Give the test type.
| prepare_test_area | ( | $testsql, | |
| $totaltests, | |||
| $count, | |||
| $testtype | |||
| ) |
Preforms the HTML of the test area.
| string | $testsql | SQL query of for the words that should be tested. |
| int | $totaltests | Total number of tests to do. |
| int | $count | Number of tests left. |
| int | $testtype | Type of test. |
@global string $tbpref Table prefix @global int $debug Show the SQL query used if 1.
@psalm-return int<0, max>
| prepare_test_footer | ( | $notyettested | ) |
Get the data and echoes the footer.
| int | $notyettested | Number of words left to be tested. |
| print_term_test | ( | $wo_record, | |
| $sent, | |||
| $testtype, | |||
| $nosent, | |||
| $regexword | |||
| ) |
Echo the test relative to a word.
| array | $wo_record | Query from the database regarding a word. |
| string | $sent | Sentence containing the word. |
| int | $testtype | Type of test |
| int | $nosent | 1 if you want to hide sentences. |
| string | $regexword | Regex to select the desired word. |