Documentation

AnnotationService

Service class for annotation management.

Tags
category

Lwt

author

HugoFara hugo.farajallah@protonmail.com

license

Unlicense http://unlicense.org/

link
https://hugofara.github.io/lwt/docs/php/
since
3.0.0

Table of Contents

Methods

__construct()  : mixed
Constructor - initialize table prefix.
annotationToJson()  : string|false
Convert annotations in a JSON format.
createAnnotation()  : string
Create new annotations for a text.
createSaveAnnotation()  : string
Create and save annotations for a text.
getAnnotationLink()  : string
Get a link to the annotated text if it exists.
getFirstTranslation()  : string
Get the first translation from a translation string.
processTerm()  : string
Process a term for annotation output.
recreateSaveAnnotation()  : string
Uses provided annotations, and annotations from database to update annotations.

Methods

__construct()

Constructor - initialize table prefix.

public __construct() : mixed

annotationToJson()

Convert annotations in a JSON format.

public annotationToJson(string $ann) : string|false
Parameters
$ann : string

Annotations.

Return values
string|false

A JSON-encoded version of the annotations

createAnnotation()

Create new annotations for a text.

public createAnnotation(int $textId) : string
Parameters
$textId : int

Id of the text to create annotations for

Tags
since
2.9.0

Annotations "position" change, they are now equal to Ti2Order it was shifted by one index before.

Return values
string

Annotations for the text

createSaveAnnotation()

Create and save annotations for a text.

public createSaveAnnotation(int $textId) : string
Parameters
$textId : int

Text ID

Return values
string

Annotations for the text

Get a link to the annotated text if it exists.

public getAnnotationLink(int $textId) : string
Parameters
$textId : int

Text ID

Return values
string

HTML link or empty string

getFirstTranslation()

Get the first translation from a translation string.

public getFirstTranslation(string $trans) : string
Parameters
$trans : string

Full translation string (may contain separators)

Return values
string

First translation only

processTerm()

Process a term for annotation output.

public processTerm(string $nonterm, string $term, string $trans, string $wordid, int $line) : string
Parameters
$nonterm : string

Non-term text (punctuation, spaces)

$term : string

Term text

$trans : string

Translation

$wordid : string

Word ID

$line : int

Line/order number

Return values
string

Formatted annotation line

recreateSaveAnnotation()

Uses provided annotations, and annotations from database to update annotations.

public recreateSaveAnnotation(int $textId, string $oldAnn) : string
Parameters
$textId : int

Id of the text on which to update annotations

$oldAnn : string

Old annotations

Return values
string

Updated annotations for this text.


        
On this page

Search results