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

Change term status (Table Test). More...

Namespaces

 Lwt
 

Functions

 set_word_status ($wid, $status)
 
 get_new_status ($oldstatus, $up)
 
 update_word_status ($wid, $currstatus)
 
 ajax_increment_term_status ($wid, $up)
 
 do_ajax_chg_term_status ($wid, $up)
 

Detailed Description

Change term status (Table Test).

value-difference should be either 1 or -1.

Call: inc/ajax_chg_term_status.php?id=[wordID]&data=[value-difference]

Function Documentation

◆ ajax_increment_term_status()

ajax_increment_term_status (   $wid,
  $up 
)

Do a word status change.

Parameters
int$widWord ID
bool$upShould the status be incremeted or decremented
Returns
string HTML-formatted string for increments

@global string $tbpref Database table prefix.

Todo:
2.9.0 Dirty PHP implementation, needs further refactoring

◆ do_ajax_chg_term_status()

do_ajax_chg_term_status (   $wid,
  $up 
)

Do a word status change and print the result.

Parameters
int$widWord ID
bool$upShould the status be incremeted or decremented
Returns
void

@global string $tbpref Database table prefix.

See also
ajax_increment_term_status Return values instead of printing.

◆ get_new_status()

get_new_status (   $oldstatus,
  $up 
)

Check the consistency of the new status.

Parameters
int$oldstatusOld status
bool$upTrue if status should incremented, false if decrementation needed
Returns
int<1, 5>|98|99 New status in the good number range.

◆ set_word_status()

set_word_status (   $wid,
  $status 
)

Force a term to get a new status.

Parameters
string | int$widID of the word to edit
string | int$statusNew status to set
Returns
string Number of affected rows or error message

@global string $tbpref

◆ update_word_status()

update_word_status (   $wid,
  $currstatus 
)

Save the new word status to the database, return the controls.

Parameters
int$widWord ID
int$currstatusCurrent status in the good value range.
Returns
string|null HTML-formatted string with plus/minus controls if a success.

@global string $tbpref Database table prefix