OPiQuotations  v.03.00.00 — April 5, 2019
Public Member Functions | Protected Attributes | List of all members
OPiQuotations\OPiQuotations Class Reference

Class to get OPiQuotation and informations from the databse. More...

Public Member Functions

 __construct ()
 Connect to the database. See the Db class. More...
 
 list_authors ()
 Return a associative table id => array(name, number of use) of elements of the table author. More...
 
 list_nations ()
 Return a associative table id => array(name, number of use) of elements of the table nation. More...
 
 list_subjects ()
 
 list_works ()
 Return a associative table id => array(name, number of use) of elements of the table work. More...
 
 nb ($is_maxim=null)
 If $is_maxim === null then return the numbers of quotations/maxims, if $is_maxim === false then return the numbers of quotations, if $is_maxim === true then return the numbers of maxims. More...
 
 quotation_add_selection ($quotation, $selection)
 Add the selection to this quotation and updates the DB. More...
 
 quotation_by_id ($id)
 Return the unique quotation/maxim of id $id. More...
 
 quotation_by_random ($label=null)
 Return a quotation choose at random. If not available quotation, then return null. More...
 
 quotations_all ($limit=null, $offset=null)
 Return the complete list of quotations/maxims. More...
 
 quotations_all_nb ()
 Return the number of all quotations/maxims. More...
 
 quotations_all_marked ($limit=null, $offset=null)
 Return the list of quotations/maxims that are marked. More...
 
 quotations_all_marked_nb ()
 Return the number of all quotations/maxims that are marked. More...
 
 quotations_by_author ($author, $limit=null, $offset=null)
 Return the list of quotations that are written by author $author. More...
 
 quotations_by_author_nb ($author)
 Return the number of all quotations that are written by author $author. More...
 
 quotations_by_ids ($ids, $limit=null, $offset=null)
 Return the list of quotations/maxims of id among $ids. More...
 
 quotations_by_ids_nb ($ids)
 Return the number of all quotations/maxims of id among $ids. More...
 
 quotations_by_nation ($nation, $limit=null, $offset=null)
 Return the list of maxims of nationality $nation. More...
 
 quotations_by_nation_nb ($nation)
 Return the number of all maxims of nationality $nation. More...
 
 quotations_by_random ($nb=1, $label=null)
 Return a list of $nb different quotations (if available) choose at random. More...
 
 quotations_by_selection_label ($label, $limit=null, $offset=null)
 Return the list of quotations/maxims are selected with $label. More...
 
 quotations_by_selection_label_nb ($label)
 Return the number of all quotations/maxims are selected with $label. More...
 
 quotations_by_subject ($subject, $limit=null, $offset=null)
 Return the list of quotations/maxims of subject $subject. More...
 
 quotations_by_subject_nb ($subject)
 Return the number of all quotations/maxims of subject $subject. More...
 
 quotations_by_text ($text, $limit=null, $offset=null)
 Return the list of quotations/maxims that contains the text $text. More...
 
 quotations_by_text_nb ($text)
 Return the number of all quotations/maxims that contains the text $text. More...
 
 quotations_by_translation ($translation, $limit, $offset)
 Return the list of quotations/maxims with a translation that contains the text $translation. More...
 
 quotations_by_translation_nb ($translation)
 Return the number of all quotations/maxims with a translation that contains the text $translation. More...
 
 quotations_by_work ($work, $limit, $offset)
 Return the list of quotations/maxims that are written in work $work. More...
 
 quotations_by_work_nb ($work)
 Return the number of all quotations/maxims that are written in work $work. More...
 

Protected Attributes

 $db
 Link to the database. More...
 

Detailed Description

Class to get OPiQuotation and informations from the databse.

Definition at line 178 of file OPiQuotations.inc.

Constructor & Destructor Documentation

◆ __construct()

OPiQuotations\OPiQuotations::__construct ( )

Connect to the database. See the Db class.

Definition at line 184 of file OPiQuotations.inc.

Member Function Documentation

◆ list_authors()

OPiQuotations\OPiQuotations::list_authors ( )

Return a associative table id => array(name, number of use) of elements of the table author.

Returns
array[array]

Definition at line 199 of file OPiQuotations.inc.

◆ list_nations()

OPiQuotations\OPiQuotations::list_nations ( )

Return a associative table id => array(name, number of use) of elements of the table nation.

Returns
array[array]

Definition at line 211 of file OPiQuotations.inc.

◆ list_subjects()

OPiQuotations\OPiQuotations::list_subjects ( )

Return a associative table id => array(name, number of use) of elements of the table subject.

Returns
array[array]

Definition at line 222 of file OPiQuotations.inc.

◆ list_works()

OPiQuotations\OPiQuotations::list_works ( )

Return a associative table id => array(name, number of use) of elements of the table work.

Returns
array[array]

Definition at line 234 of file OPiQuotations.inc.

◆ nb()

OPiQuotations\OPiQuotations::nb (   $is_maxim = null)

If $is_maxim === null then return the numbers of quotations/maxims, if $is_maxim === false then return the numbers of quotations, if $is_maxim === true then return the numbers of maxims.

Parameters
null | bool$is_maxim
Returns
int >= 0

Definition at line 249 of file OPiQuotations.inc.

◆ quotation_add_selection()

OPiQuotations\OPiQuotations::quotation_add_selection (   $quotation,
  $selection 
)

Add the selection to this quotation and updates the DB.

Parameters
OPiQuotation$quotation
Selection$selection
Returns
bool

Definition at line 268 of file OPiQuotations.inc.

References $selection.

◆ quotation_by_id()

OPiQuotations\OPiQuotations::quotation_by_id (   $id)

Return the unique quotation/maxim of id $id.

If this id doesn't exist then return null.

Parameters
int$id
Returns
null|OPiQuotation

Definition at line 297 of file OPiQuotations.inc.

References $id.

◆ quotation_by_random()

OPiQuotations\OPiQuotations::quotation_by_random (   $label = null)

Return a quotation choose at random. If not available quotation, then return null.

If $label !== null then choose quotation not already chosen with this label.

Parameters
null | string$label
Returns
null|OPiQuotation

Definition at line 326 of file OPiQuotations.inc.

◆ quotations_all()

OPiQuotations\OPiQuotations::quotations_all (   $limit = null,
  $offset = null 
)

Return the complete list of quotations/maxims.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 354 of file OPiQuotations.inc.

◆ quotations_all_marked()

OPiQuotations\OPiQuotations::quotations_all_marked (   $limit = null,
  $offset = null 
)

Return the list of quotations/maxims that are marked.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 392 of file OPiQuotations.inc.

◆ quotations_all_marked_nb()

OPiQuotations\OPiQuotations::quotations_all_marked_nb ( )

Return the number of all quotations/maxims that are marked.

Returns
int

Definition at line 410 of file OPiQuotations.inc.

◆ quotations_all_nb()

OPiQuotations\OPiQuotations::quotations_all_nb ( )

Return the number of all quotations/maxims.

Returns
int

Definition at line 372 of file OPiQuotations.inc.

◆ quotations_by_author()

OPiQuotations\OPiQuotations::quotations_by_author (   $author,
  $limit = null,
  $offset = null 
)

Return the list of quotations that are written by author $author.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
string$author
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 431 of file OPiQuotations.inc.

◆ quotations_by_author_nb()

OPiQuotations\OPiQuotations::quotations_by_author_nb (   $author)

Return the number of all quotations that are written by author $author.

Parameters
string$author
Returns
int

Definition at line 452 of file OPiQuotations.inc.

◆ quotations_by_ids()

OPiQuotations\OPiQuotations::quotations_by_ids (   $ids,
  $limit = null,
  $offset = null 
)

Return the list of quotations/maxims of id among $ids.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
int[]$ids (each int > 0)
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 477 of file OPiQuotations.inc.

References $id.

◆ quotations_by_ids_nb()

OPiQuotations\OPiQuotations::quotations_by_ids_nb (   $ids)

Return the number of all quotations/maxims of id among $ids.

Parameters
int[]$ids (each int > 0)
Returns
int

Definition at line 509 of file OPiQuotations.inc.

References $id.

◆ quotations_by_nation()

OPiQuotations\OPiQuotations::quotations_by_nation (   $nation,
  $limit = null,
  $offset = null 
)

Return the list of maxims of nationality $nation.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
string$nation
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 545 of file OPiQuotations.inc.

◆ quotations_by_nation_nb()

OPiQuotations\OPiQuotations::quotations_by_nation_nb (   $nation)

Return the number of all maxims of nationality $nation.

Parameters
string$nation
Returns
int

Definition at line 566 of file OPiQuotations.inc.

◆ quotations_by_random()

OPiQuotations\OPiQuotations::quotations_by_random (   $nb = 1,
  $label = null 
)

Return a list of $nb different quotations (if available) choose at random.

If $label !== null then choose quotations not already chosen with this label.

Parameters
int$nb(must be >= 0)
null | string$label
Returns
OPiQuotation[]

Definition at line 588 of file OPiQuotations.inc.

◆ quotations_by_selection_label()

OPiQuotations\OPiQuotations::quotations_by_selection_label (   $label,
  $limit = null,
  $offset = null 
)

Return the list of quotations/maxims are selected with $label.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
string$label
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 625 of file OPiQuotations.inc.

◆ quotations_by_selection_label_nb()

OPiQuotations\OPiQuotations::quotations_by_selection_label_nb (   $label)

Return the number of all quotations/maxims are selected with $label.

Parameters
string$label
Returns
int

Definition at line 646 of file OPiQuotations.inc.

◆ quotations_by_subject()

OPiQuotations\OPiQuotations::quotations_by_subject (   $subject,
  $limit = null,
  $offset = null 
)

Return the list of quotations/maxims of subject $subject.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
string$subject
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 671 of file OPiQuotations.inc.

◆ quotations_by_subject_nb()

OPiQuotations\OPiQuotations::quotations_by_subject_nb (   $subject)

Return the number of all quotations/maxims of subject $subject.

Parameters
string$subject
Returns
int

Definition at line 690 of file OPiQuotations.inc.

◆ quotations_by_text()

OPiQuotations\OPiQuotations::quotations_by_text (   $text,
  $limit = null,
  $offset = null 
)

Return the list of quotations/maxims that contains the text $text.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
string$text
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 715 of file OPiQuotations.inc.

References $text.

◆ quotations_by_text_nb()

OPiQuotations\OPiQuotations::quotations_by_text_nb (   $text)

Return the number of all quotations/maxims that contains the text $text.

Parameters
string$text
Returns
int

Definition at line 736 of file OPiQuotations.inc.

References $text.

◆ quotations_by_translation()

OPiQuotations\OPiQuotations::quotations_by_translation (   $translation,
  $limit,
  $offset 
)

Return the list of quotations/maxims with a translation that contains the text $translation.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
string$translation
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 761 of file OPiQuotations.inc.

◆ quotations_by_translation_nb()

OPiQuotations\OPiQuotations::quotations_by_translation_nb (   $translation)

Return the number of all quotations/maxims with a translation that contains the text $translation.

Parameters
string$translation
Returns
int

Definition at line 782 of file OPiQuotations.inc.

◆ quotations_by_work()

OPiQuotations\OPiQuotations::quotations_by_work (   $work,
  $limit,
  $offset 
)

Return the list of quotations/maxims that are written in work $work.

If $limit is not null then return only $limit OPiQuotation.

If $limit and $offset are not null then return only $limit OPiQuotation from $offset.

Parameters
string$work
null | int$limit(must be >= 0)
null | int$offset(must be >= 0)
Returns
OPiQuotation[]

Definition at line 807 of file OPiQuotations.inc.

◆ quotations_by_work_nb()

OPiQuotations\OPiQuotations::quotations_by_work_nb (   $work)

Return the number of all quotations/maxims that are written in work $work.

Parameters
string$work
Returns
int

Definition at line 828 of file OPiQuotations.inc.

Member Data Documentation

◆ $db

Db OPiQuotations\OPiQuotations::$db
protected

Link to the database.

Definition at line 842 of file OPiQuotations.inc.


The documentation for this class was generated from the following file: