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

Show text header frame. More...

Namespaces

 Lwt
 

Functions

 get_text_data ($textid)
 
 getTextData ($textid)
 
 get_language_settings ($langid)
 
 getLanguagesSettings ($langid)
 
 echo_term ( $actcode, $showAll, $spanid, $hidetag, $currcharcount, $record, &$exprs=array())
 
 echoTerm ( $actcode, $showAll, $hideuntil, $spanid, $hidetag, $currcharcount, $record)
 
 wordProcessor ($record, $showAll, $currcharcount)
 
 sentence_parser ($sid, $old_sid)
 
 sentenceParser ($sid, $old_sid)
 
 item_parser ( $record, $showAll, $currcharcount, $hide, &$exprs=array())
 
 word_parser ($record, $showAll, $currcharcount, $hideuntil)
 
 wordParser ($record, $showAll, $currcharcount, $hideuntil)
 
 main_word_loop ($textid, $showAll)
 
 mainWordLoop ($textid, $showAll)
 
 do_text_text_style ($showLearning, $mode_trans, $textsize, $ann_exists)
 
 prepareStyle ($showLearning, $mode_trans, $textsize, $ann_exists)
 
 do_text_text_javascript ($var_array)
 
 do_text_javascript ($var_array)
 
 do_text_text_content ($textid, $only_body=true)
 

Detailed Description

Show text header frame.

Call: do_text_text.php?text=[textid]

PHP version 8.1

Function Documentation

◆ do_text_javascript()

do_text_javascript (   $var_array)

Print JavaScript-formatted content.

Parameters
array<string,mixed>Associative array of all global variables for JS
Returns
void
Deprecated:
Use do_text_text_javascript instead.

◆ do_text_text_content()

do_text_text_content (   $textid,
  $only_body = true 
)

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

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

Annotation position between 0 and 4

Ruby annotations

◆ do_text_text_javascript()

do_text_text_javascript (   $var_array)

Print JavaScript-formatted content.

Parameters
array<string,mixed>Associative array of all global variables for JS
Returns
void

Map global variables as a JSON object

Save the current reading position. @global {string} LWT_DATA.text.id Text ID

Since
2.0.3-fork

◆ do_text_text_style()

do_text_text_style (   $showLearning,
  $mode_trans,
  $textsize,
  $ann_exists 
)

Prepare style for showing word status. Write a now STYLE object

Parameters
int$showLearning1 to show learning translations
int<1,4>$mode_trans Annotation position
int$textsizeText font size
bool$ann_existDoes annotations exist for this text
Returns
void

◆ echo_term()

echo_term (   $actcode,
  $showAll,
  $spanid,
  $hidetag,
  $currcharcount,
  $record,
$exprs = array() 
)

Print the output when the word is a term (word or multi-word).

Parameters
int$actcodeAction code, number of words forming the term (> 1 for multiword)
int$showAllShow all words or not
int$hideuntilUnused
string$spanidID for this span element
int$currcharcountCurrent number of characters
array<string,string>$record Various data
array$exprsCurrent expressions
Returns
void
Since
2.8.0-fork Takes a new argument $exprs

◆ echoTerm()

echoTerm (   $actcode,
  $showAll,
  $hideuntil,
  $spanid,
  $hidetag,
  $currcharcount,
  $record 
)

Print the output when the word is a term.

Parameters
int$actcodeAction code, > 1 for multiword
int$showAllShow all words or not
int$hideuntilUnused
string$spanidID for this span element
int$currcharcountCurrent number of characters
array<string,string>$record Various data
Since
2.2.1 Return 0 instead of a new value for $hideuntil
Deprecated:
Use echo_term instead.

◆ get_language_settings()

get_language_settings (   $langid)

Return the settings relative to this language.

Parameters
int$langidLanguage ID as defined in the database.
Returns
array{LgName: string, LgDict1URI: string, LgDict2URI: string, LgGoogleTranslateURI: string, LgTextSize: int, LgRegexpWordCharacters: string, LgRemoveSpaces: int, LgRightToLeft: int, Lg}|false|null Record corresponding to this language.

@global string $tbpref Table name prefix

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

◆ get_text_data()

get_text_data (   $textid)

Get the record for this text in the database.

Parameters
string | int$textidID of the text
Returns
array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null Record corresponding to this text.

@global string $tbpref Table name prefix

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

◆ getLanguagesSettings()

getLanguagesSettings (   $langid)

Return the settings relative to this language.

Parameters
int$langidLanguage ID as defined in the database.
Returns
array{LgName: string, LgDict1URI: string, LgDict2URI: string, LgGoogleTranslateURI: string, LgTextSize: int, LgRemoveSpaces: int, LgRightToLeft: int}|false|null Record corresponding to this language.

@global string $tbpref Table name prefix

Deprecated:
Use get_language_settings instead.

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

◆ getTextData()

getTextData (   $textid)

Get the record for this text in the database.

Parameters
string$textidID of the text
Returns
array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null Record corresponding to this text.

@global string $tbpref Table name prefix

Deprecated:
Use get_text_data instead.

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

◆ item_parser()

item_parser (   $record,
  $showAll,
  $currcharcount,
  $hide,
$exprs = array() 
)

Process each text item (can be punction, term, etc...)

Parameters
array$recordText item information
0 | 1$showAllShow all words or not
int$currcharcountCurrent number of caracters
bool$hideShould some item be hidden, depends on $showAll
array$exprsCurrent expressions
Returns
void
Since
2.5.0-fork
2.8.0-fork Take a new optional arguent $exprs

◆ main_word_loop()

main_word_loop (   $textid,
  $showAll 
)

Get all words and start the iterate over them.

Parameters
string$textidID of the text
0 | 1$showAllShow all words or not
Returns
void

@global string $tbpref Table name prefix

◆ mainWordLoop()

mainWordLoop (   $textid,
  $showAll 
)

Get all words and start the iterate over them.

Parameters
string$textidID of the text
0 | 1$showAllShow all words or not
Returns
void

@global string $tbpref Table name prefix

Deprecated:
Use main_word_loop instead.

◆ prepareStyle()

prepareStyle (   $showLearning,
  $mode_trans,
  $textsize,
  $ann_exists 
)

Prepare style for showing word status. Write a now STYLE object

Parameters
int$showLearning1 to show learning translations
int<1,4>$mode_trans Annotation position
int$textsizeText font size
bool$ann_existDoes annotations exist for this text
Returns
void
Deprecated:
Use do_text_text_style instead.

◆ sentence_parser()

sentence_parser (   $sid,
  $old_sid 
)

Check if a new sentence SPAN should be started.

Parameters
int$sidSentence ID
int$old_sidOld sentence ID
Returns
int Sentence ID

◆ sentenceParser()

sentenceParser (   $sid,
  $old_sid 
)

Check if a new sentence SPAN should be started.

Parameters
int$sidSentence ID
int$old_sidOld sentence ID
Returns
int Sentence ID
Deprecated:
Use sentence_parser instead.

◆ word_parser()

word_parser (   $record,
  $showAll,
  $currcharcount,
  $hideuntil 
)

Process each text item (can be punction, term, etc...)

Parameters
string[]$recordRecord information
0 | 1$showAllShow all words or not
int$currcharcountCurrent number of caracters
int$hideuntilShould the value be hidden or not
Returns
int New value for $hideuntil
Deprecated:
Use item_parser instead (since 2.5.0-fork).

◆ wordParser()

wordParser (   $record,
  $showAll,
  $currcharcount,
  $hideuntil 
)

Process each word (can be punction, term, etc...)

Parameters
string[]$recordRecord information
0 | 1$showAllShow all words or not
int$currcharcountCurrent number of caracters
int$cnt
int$sidSentence ID
int$hideuntilShould the value be hidden or not
Returns
int New value for $hideuntil
Deprecated:
Use word_parser instead.

◆ wordProcessor()

wordProcessor (   $record,
  $showAll,
  $currcharcount 
)

Process each word (can be punction, term, etc...). Caused laggy texts, replaced by wordParser.

Parameters
string[]$recordRecord information
0 | 1$showAllShow all words or not
int$currcharcountCurrent number of caracters
Returns
int New number of caracters
Deprecated:
Use sentenceParser and wordParser instead.