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

Responsible for drawing the header when reading texts. More...

Namespaces

 Lwt
 

Functions

 getData ($textid)
 
 do_header_row ($textid, $langid)
 
 do_title ($title, $sourceURI)
 
 do_settings ($textid)
 
 browser_tts ($text, $languageName)
 
 save_audio_position ($textid)
 
 do_text_header_content ($textid, $only_body=true)
 

Detailed Description

Responsible for drawing the header when reading texts.

Call: do_text_header.php?text=[textid]

PHP version 8.1

Function Documentation

◆ browser_tts()

browser_tts (   $text,
  $languageName 
)

Prints javascript data and function to read text in your browser.

Parameters
string$textText to read
string$languageNameFull name of the language (i. e.: "English")

@global string $tbpref

Since
2.0.3-fork
2.9.1-fork Function may work even when the language name was manually changed.

Main object for text-to-speech interaction with SpeechSynthesisUtterance

The text to read

{string} ISO code for the language

{string} Rate at wich the speech is done, deprecated since 2.10.0

Check browser compatibility before reading

Start and stop the reading feature.

Change the annotations display mode

Parameters
{string}mode The new annotation mode

◆ do_header_row()

do_header_row (   $textid,
  $langid 
)

Print the main title row.

Parameters
int$textidText ID
string$langidLanguage ID to navigate between texts of same language
Since
2.0.4-fork

◆ do_settings()

do_settings (   $textid)

Prepare user settings for this text.

Parameters
string | int$textidText ID
Since
2.0.4-fork

◆ do_text_header_content()

do_text_header_content (   $textid,
  $only_body = true 
)

Main function for displaying header. It will print HTML content.

Parameters
string | int$textidID of the required text
bool$only_bodyIf true, only show the inner body. If false, create a complete HTML document.
Since
2.0.3-fork

◆ do_title()

do_title (   $title,
  $sourceURI 
)

Print the title of the text.

Parameters
string$titleTitle of the text
string$sourceURIURL of the text (if any)
Since
2.0.4-fork

◆ getData()

getData (   $textid)

Get the text and language data associated with the text.

Parameters
string | int$textidID of the text

@global string $tbpref Table name prefix

Since
2.0.3-fork
Returns
(float|int|null|string)[]|false|null LgName, TxLgID, TxText, TxTitle, TxAudioURI, TxSourceURI, TxAudioPosition for the text.

@psalm-return array<string, float|int|null|string>|false|null

◆ save_audio_position()

save_audio_position (   $textid)

Save the position of the audio reading for a text.

Parameters
string | int$textidID of the text
Since
2.0.4-fork

Save text status, for instance audio position