Learning with Texts - Fork 2.4.0-fork
Learn foreign languages with texts
Namespaces | Functions
do_test_test.php File Reference

Show test frame. More...

Namespaces

namespace  Lwt
 

Functions

 get_test_sql ()
 
 get_test_type ()
 
 do_test_test_css ()
 
</style > do_test_test_finished ($testsql, $totaltests)
 
 do_test_test_sentence ($wid, $lang, $wordlc)
 
 print_term_test ($wo_record, $sent, $testtype, $nosent, $regexword)
 
 prepare_test_area ($testsql, $totaltests, $count, $testtype)
 
 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 ()
 

Detailed Description

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'])

Function Documentation

◆ do_test_footer()

do_test_footer (   $notyettested,
  $wrong,
  $correct 
)

Echoes HTML code for the footer of a words test page.

Parameters
int$notyettestedNumber of words left to be tested
int$wrongNumber of failed tests
int$correctNumber of correct answers.
Returns
void

◆ do_test_test_content()

do_test_test_content ( )

Do the main content of a test page.

@global int $debug Show debug informations

Returns
void

◆ do_test_test_css()

do_test_test_css ( )

Prepare the css code for tests.

Returns
void

◆ do_test_test_finished()

</style > do_test_test_finished (   $testsql,
  $totaltests 
)

Output a message for a finished test, with the number of tests for tomorrow.

Parameters
string$testsqlQuery used to select words.
int$totaltestsTotal number of tests.
Returns
void

◆ do_test_test_javascript()

do_test_test_javascript (   $count)

Prepare JavaScript code for interacting between the different frames.

Parameters
int$count1 for timer.
Returns
void

◆ do_test_test_javascript_interaction()

do_test_test_javascript_interaction (   $wo_record,
  $wb1,
  $wb2,
  $wb3,
  $testtype,
  $nosent,
  $save 
)

Prepare JavaScript code so that you can click on words.

Parameters
array$wo_recordWord record. Associative array with keys 'WoID', 'WoTranslation'.
string$wb1URL of the first dictionary.
string$wb2URL of the secondary dictionary.
string$wb3URL of the google translate dictionary.
int$testtypeType of test
int$nosent1 to use single word instead of sentence.
string$saveWord or sentence to use for the test
Returns
void

@global string $tbpref Database table prefix @global string $angDefs Languages definition array

Read the word aloud

◆ do_test_test_sentence()

do_test_test_sentence (   $wid,
  $lang,
  $wordlc 
)

Get a sentence containing the word.

Parameters
int$widThe word to test.
string$langID of the language
string$wordlc

@global string $tbpref Table prefix @global int $debug Echo the passage number if 1.

Returns
array{0: int, 1: int} Sentence with escaped word and a confirmation number if sentence was found.

◆ get_test_sql()

get_test_sql ( )

Set sql request for the word test.

Returns
string SQL request string

@global string $tbpref Table prefix

◆ get_test_type()

get_test_type ( )

Give the test type.

Returns
int<1, 5> Test type between 1 and 5 (included)

◆ prepare_test_area()

prepare_test_area (   $testsql,
  $totaltests,
  $count,
  $testtype 
)

Preforms the HTML of the test area.

Parameters
string$testsqlSQL query of for the words that should be tested.
int$totaltestsTotal number of tests to do.
int$countNumber of tests left.
int$testtypeType of test.
Returns
int Number of tests left to do.

@global string $tbpref Table prefix @global int $debug Show the SQL query used if 1.

@psalm-return int<0, max>

◆ prepare_test_footer()

prepare_test_footer (   $notyettested)

Get the data and echoes the footer.

Parameters
int$notyettestedNumber of words left to be tested.
Returns
void

◆ print_term_test()

print_term_test (   $wo_record,
  $sent,
  $testtype,
  $nosent,
  $regexword 
)

Echo the test relative to a word.

Parameters
array$wo_recordQuery from the database regarding a word.
string$sentSentence containing the word.
int$testtypeType of test
int$nosent1 if you want to hide sentences.
string$regexwordRegex to select the desired word.
Returns
array{0: string, 1: string} HTML-escaped and raw text sentences (or word)