OPiQuotations
v.03.00.00 — April 5, 2019
|
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... | |
Class to get OPiQuotation and informations from the databse.
Definition at line 178 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::__construct | ( | ) |
Connect to the database. See the Db class.
Definition at line 184 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::list_authors | ( | ) |
Return a associative table id => array(name, number of use) of elements of the table author.
Definition at line 199 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::list_nations | ( | ) |
Return a associative table id => array(name, number of use) of elements of the table nation.
Definition at line 211 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::list_subjects | ( | ) |
Return a associative table id => array(name, number of use) of elements of the table subject.
Definition at line 222 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::list_works | ( | ) |
Return a associative table id => array(name, number of use) of elements of the table work.
Definition at line 234 of file OPiQuotations.inc.
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.
null | bool | $is_maxim |
Definition at line 249 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotation_add_selection | ( | $quotation, | |
$selection | |||
) |
Add the selection to this quotation and updates the DB.
OPiQuotation | $quotation | |
Selection | $selection |
Definition at line 268 of file OPiQuotations.inc.
References $selection.
OPiQuotations\OPiQuotations::quotation_by_id | ( | $id | ) |
Return the unique quotation/maxim of id $id.
If this id doesn't exist then return null.
int | $id |
Definition at line 297 of file OPiQuotations.inc.
References $id.
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.
null | string | $label |
Definition at line 326 of file OPiQuotations.inc.
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.
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 354 of file OPiQuotations.inc.
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.
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 392 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_all_marked_nb | ( | ) |
Return the number of all quotations/maxims that are marked.
Definition at line 410 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_all_nb | ( | ) |
Return the number of all quotations/maxims.
Definition at line 372 of file OPiQuotations.inc.
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.
string | $author | |
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 431 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_author_nb | ( | $author | ) |
Return the number of all quotations that are written by author $author.
string | $author |
Definition at line 452 of file OPiQuotations.inc.
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.
int[] | $ids (each int > 0) | |
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 477 of file OPiQuotations.inc.
References $id.
OPiQuotations\OPiQuotations::quotations_by_ids_nb | ( | $ids | ) |
Return the number of all quotations/maxims of id among $ids.
int[] | $ids (each int > 0) |
Definition at line 509 of file OPiQuotations.inc.
References $id.
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.
string | $nation | |
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 545 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_nation_nb | ( | $nation | ) |
Return the number of all maxims of nationality $nation.
string | $nation |
Definition at line 566 of file OPiQuotations.inc.
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.
int | $nb | (must be >= 0) |
null | string | $label |
Definition at line 588 of file OPiQuotations.inc.
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.
string | $label | |
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 625 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_selection_label_nb | ( | $label | ) |
Return the number of all quotations/maxims are selected with $label.
string | $label |
Definition at line 646 of file OPiQuotations.inc.
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.
string | $subject | |
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 671 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_subject_nb | ( | $subject | ) |
Return the number of all quotations/maxims of subject $subject.
string | $subject |
Definition at line 690 of file OPiQuotations.inc.
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.
string | $text | |
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 715 of file OPiQuotations.inc.
References $text.
OPiQuotations\OPiQuotations::quotations_by_text_nb | ( | $text | ) |
Return the number of all quotations/maxims that contains the text $text.
string | $text |
Definition at line 736 of file OPiQuotations.inc.
References $text.
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.
string | $translation | |
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 761 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_translation_nb | ( | $translation | ) |
Return the number of all quotations/maxims with a translation that contains the text $translation.
string | $translation |
Definition at line 782 of file OPiQuotations.inc.
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.
string | $work | |
null | int | $limit | (must be >= 0) |
null | int | $offset | (must be >= 0) |
Definition at line 807 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_work_nb | ( | $work | ) |
Return the number of all quotations/maxims that are written in work $work.
string | $work |
Definition at line 828 of file OPiQuotations.inc.
|
protected |
Link to the database.
Definition at line 842 of file OPiQuotations.inc.