Documentation

do_test_test.php

\file \brief 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

Tags
author

LWT Project lwt-project@hotmail.com

license

Unlicense http://unlicense.org/

link
https://hugofara.github.io/lwt/docs/php/files/do-test-test.html
since
1.0.3

Table of Contents

Functions

do_test_get_identifier()  : array<string|int, int|array<string|int, int>|string>
Get the SQL string to perform tests.
do_test_get_test_sql()  : string
Get the SQL string to perform tests.
do_test_get_test_type()  : int
Get the test type clamped between 1 and 5 (included)
get_test_sql()  : string
Set sql request for the word test.
get_test_type()  : int<1, 5>
Give the test type.
do_test_test_css()  : void
Prepare the css code for tests.
do_test_get_tomorrow_tests_count()  : int
Return the number of test due for tomorrow.
do_test_test_finished()  : void
Output a message for a finished test, with the number of tests for tomorrow.
do_test_test_sentence()  : array<string|int, int|null|string>
Get a sentence containing the word.
do_test_get_term_test()  : array<string|int, string>
Return the test relative to a word.
print_term_test()  : string
Echo the test relative to a word.
do_test_get_word()  : array<string|int, float|int|null|string>
Find the next word to test.
get_test_solution()  : string
Get the solution to a test.
do_test_prepare_ajax_test_area()  : int
Preforms the HTML of the test area, to update through AJAX.
prepare_test_area()  : int
Preforms the HTML of the test area.
do_test_test_interaction_globals()  : void
Prepare JavaScript code globals so that you can click on words.
do_test_test_javascript_clickable()  : void
Prepare JavaScript code so that you can click on words.
do_test_test_javascript_interaction()  : void
Prepare JavaScript code so that you can click on words.
prepare_test_footer()  : void
Get the data and echoes the footer.
do_test_footer()  : void
Echoes HTML code for the footer of a words test page.
do_test_test_javascript()  : void
Prepare JavaScript code for interacting between the different frames.
do_test_test_content()  : void
Do the main content of a test page.
do_test_test_content_ajax()  : void
Do the main content of a test page.

Functions

do_test_get_identifier()

Get the SQL string to perform tests.

do_test_get_identifier(int|null $selection, string|null $sess_testsql, int|null $lang, int|null $text) : array<string|int, int|array<string|int, int>|string>
Parameters
$selection : int|null

Test is of type selection

$sess_testsql : string|null

SQL string for test

$lang : int|null

Test is of type language, for the language $lang ID

$text : int|null

Testing text with ID $text

Tags
psalm-return

list{string, int|non-empty-list|string}

Return values
array<string|int, int|array<string|int, int>|string>

Test identifier as an array(key, value)

do_test_get_test_sql()

Get the SQL string to perform tests.

do_test_get_test_sql(int|null $selection, string|null $sess_testsql, int|null $lang, int|null $text) : string
Parameters
$selection : int|null

Test is of type selection

$sess_testsql : string|null

SQL string for test

$lang : int|null

Test is of type language, for the language $lang ID

$text : int|null

Testing text with ID $text

Return values
string

SQL projection (selection) string

do_test_get_test_type()

Get the test type clamped between 1 and 5 (included)

do_test_get_test_type(int $testtype) : int
Parameters
$testtype : int

Initial test type value

Return values
int

Clamped $testtype

  • 1: Test type is ..[L2]..
  • 2: Test type is ..[L1]..
  • 3: Test type is ..[..]..
  • 4: Test type is [L2]
  • 5: Test type is [L1]

get_test_sql()

Set sql request for the word test.

get_test_sql() : string
Tags
global

string $tbpref

deprecated
2.9.0-fork

Use do_test_get_sql instead

Return values
string

SQL request string

get_test_type()

Give the test type.

get_test_type() : int<1, 5>
Tags
deprecated
2.9.0-fork

Use do_test_get_test_type instead.

Return values
int<1, 5>

Test type between 1 and 5 (included)

do_test_test_css()

Prepare the css code for tests.

do_test_test_css() : void
Tags
deprecated
2.6.0-fork

Do not use this function since it was causing wrong display. Will be removed in 3.0.0.

do_test_get_tomorrow_tests_count()

Return the number of test due for tomorrow.

do_test_get_tomorrow_tests_count(string $testsql) : int
Parameters
$testsql : string

Test selection string

Return values
int

Tomorrow tests

do_test_test_finished()

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

do_test_test_finished(string $testsql, int $totaltests[, bool $ajax = false ]) : void
Parameters
$testsql : string

Query used to select words.

$totaltests : int

Total number of tests.

$ajax : bool = false

AJAX mode, content will not be displayed.

do_test_test_sentence()

Get a sentence containing the word.

do_test_test_sentence(int $wid, mixed $lang, string $wordlc) : array<string|int, int|null|string>

The sentence should contain at least 70% of known words.

Parameters
$wid : int

The word to test.

$lang : mixed

ID of the language, will be removed in PHP 3.0.0

$wordlc : string

Word in lowercase

Tags
global

string $tbpref Table prefix

since
2.5.3-fork

Properly return sentences with at least 70% of known words. Previously, it was supposed to be 100%, but buggy.

since
2.10.0-fork

Always return a sentence, even the 70% known words ratio is not matched

psalm-return

list{null|string, 0|1}

Return values
array<string|int, int|null|string>

Sentence with escaped word and 1.

do_test_get_term_test()

Return the test relative to a word.

do_test_get_term_test(array<string|int, mixed> $wo_record, string $sent, int $testtype, bool|int $nosent, string $regexword) : array<string|int, string>
Parameters
$wo_record : array<string|int, mixed>

Query from the database regarding a word.

$sent : string

Sentence containing the word.

$testtype : int

Type of test

$nosent : bool|int

1 or true if you want to hide sentences.

$regexword : string

Regex to select the desired word.

Tags
psalm-return

list{string, string}

Return values
array<string|int, string>

HTML-escaped and raw text sentences (or word)

print_term_test()

Echo the test relative to a word.

print_term_test(array<string|int, mixed> $wo_record, string $sent, int $testtype, int $nosent, string $regexword) : string
Parameters
$wo_record : array<string|int, mixed>

Query from the database regarding a word.

$sent : string

Sentence containing the word.

$testtype : int

Type of test

$nosent : int

1 if you want to hide sentences.

$regexword : string

Regex to select the desired word.

Return values
string

HTML-escaped and raw text sentences (or word)

do_test_get_word()

Find the next word to test.

do_test_get_word(string $testsql) : array<string|int, float|int|null|string>
Parameters
$testsql : string

Test selection string

Tags
psalm-return

array<string, float|int|null|string>

Return values
array<string|int, float|int|null|string>

Empty array

get_test_solution()

Get the solution to a test.

get_test_solution(int $testtype, array<string|int, mixed> $wo_record, bool $nosent, string $wo_text) : string
Parameters
$testtype : int

Test type between 1 and 5

$wo_record : array<string|int, mixed>

Word record element

$nosent : bool

Test is in word mode

$wo_text : string

Word text

Return values
string

Solution to display.

do_test_prepare_ajax_test_area()

Preforms the HTML of the test area, to update through AJAX.

do_test_prepare_ajax_test_area(string $selector, array<string|int, mixed>|int $selection, int $count, int $testtype) : int
Parameters
$selector : string

On which set to run the test.

$selection : array<string|int, mixed>|int

ID of the elements of the set to use.

$count : int

Number of tests left.

$testtype : int

Type of test (words, sentences, etc...).

Tags
global

string $tbpref Table prefix

global

int $debug Show the SQL query used if 1.

psalm-return

int<0, max>

Return values
int

Number of tests left to do.

prepare_test_area()

Preforms the HTML of the test area.

prepare_test_area(string $testsql, int $totaltests, int $count, int $testtype) : int
Parameters
$testsql : string

SQL query of for the words that should be tested.

$totaltests : int

Total number of tests to do.

$count : int

Number of tests left.

$testtype : int

Type of test.

Tags
global

string $tbpref Table prefix

global

int $debug Show the SQL query used if 1.

psalm-return

int<0, max>

Return values
int

Number of tests left to do.

do_test_test_interaction_globals()

Prepare JavaScript code globals so that you can click on words.

do_test_test_interaction_globals(string $wb1, string $wb2, string $wb3, int $lg_id) : void
Parameters
$wb1 : string

URL of the first dictionary.

$wb2 : string

URL of the secondary dictionary.

$wb3 : string

URL of the google translate dictionary.

$lg_id : int

Language ID (since 2.10.0-fork)

Tags
since
2.10.0-fork

Takes a language ID as the fourth argument

do_test_test_javascript_clickable()

Prepare JavaScript code so that you can click on words.

do_test_test_javascript_clickable(array<string|int, mixed> $wo_record, string $solution) : void
Parameters
$wo_record : array<string|int, mixed>

Word record. Associative array with keys 'WoID', 'WoTranslation'.

$solution : string

Solution to the test (as HTML)

do_test_test_javascript_interaction()

Prepare JavaScript code so that you can click on words.

do_test_test_javascript_interaction(array<string|int, mixed> $wo_record, string $wb1, string $wb2, string $wb3, int $testtype, int $nosent, string $save) : void
Parameters
$wo_record : array<string|int, mixed>

Word record. Associative array with keys 'WoID', 'WoTranslation'.

$wb1 : string

URL of the first dictionary.

$wb2 : string

URL of the secondary dictionary.

$wb3 : string

URL of the google translate dictionary.

$testtype : int

Type of test

$nosent : int

1 to use single word instead of sentence.

$save : string

Word or sentence to use for the test

Tags
global

string $tbpref Database table prefix

global

string $angDefs Languages definition array

Get the data and echoes the footer.

prepare_test_footer(int $notyettested) : void
Parameters
$notyettested : int

Number of words left to be tested.

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

do_test_footer(int $notyettested, int $wrong, int $correct) : void
Parameters
$notyettested : int

Number of words left to be tested

$wrong : int

Number of failed tests

$correct : int

Number of correct answers.

do_test_test_javascript()

Prepare JavaScript code for interacting between the different frames.

do_test_test_javascript(int $count) : void
Parameters
$count : int

Total number of tests that were done today

do_test_test_content()

Do the main content of a test page.

do_test_test_content() : void
Tags
global

int $debug Show debug informations

deprecated

Since 2.10.0-fork, use do_test_test_content_ajax instead

do_test_test_content_ajax()

Do the main content of a test page.

do_test_test_content_ajax(string $selector, array<string|int, mixed>|int $selection) : void
Parameters
$selector : string

Type of test to run

$selection : array<string|int, mixed>|int

Items to run the test on

Tags
global

int $debug Show debug informations


        
On this page

Search results