Class to get OPiQuotation and informations from the databse. More...
Public Member Functions | |
__construct () | |
Connect to the database. See the Db class. | |
list_authors () | |
Return a associative table id => array(name, number of use) of elements of the table author. | |
list_nations () | |
Return a associative table id => array(name, number of use) of elements of the table nation. | |
list_subjects () | |
list_works () | |
Return a associative table id => array(name, number of use) of elements of the table work. | |
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. | |
quotation_by_id ($id) | |
Return the unique quotation/maxim of id $id. | |
quotations_all () | |
Return the complete list of quotations/maxims. | |
quotations_all_marked () | |
Return the list of quotations/maxims that are marked. | |
quotations_by_author ($author) | |
Return the list of quotations that are writed by author $author. | |
quotations_by_ids ($ids) | |
Return the list of quotations/maxims of id among $ids. | |
quotations_by_nation ($nation) | |
Return the list of maxims of nationality $nation. | |
quotations_by_random ($nb=1, $label=null) | |
Return a list of $nb different quotations choose at random. | |
quotations_by_subject ($subject) | |
Return the list of quotations/maxims of subject $subject. | |
quotations_by_text ($text) | |
Return the list of quotations/maxims that contains the text $text. | |
quotations_by_translation ($translation) | |
Return the list of quotations/maxims with a translation that contains the text $translation. | |
quotations_by_work ($work) | |
Return the list of quotations/maxims that are writed in work $work. |
Protected Attributes | |
$db | |
Link to the database. |
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_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 269 of file OPiQuotations.inc.
References $quots.
OPiQuotations\OPiQuotations::quotations_all | ( | ) |
Return the complete list of quotations/maxims.
Definition at line 292 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_all_marked | ( | ) |
Return the list of quotations/maxims that are marked.
Definition at line 304 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_author | ( | $author | ) |
Return the list of quotations that are writed by author $author.
string | $author |
Definition at line 318 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_ids | ( | $ids | ) |
Return the list of quotations/maxims of id among $ids.
int[] | $ids (each int > 0) |
Definition at line 336 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_nation | ( | $nation | ) |
Return the list of maxims of nationality $nation.
string | $nation |
Definition at line 364 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_random | ( | $nb = 1 , |
|
$label = null |
|||
) |
Return a list of $nb different quotations choose at random.
If $label !== null then choose quotations not already chosen with this label and set the chosen quotations with this $label.
int | $nb | (must be >= 0) |
null | string | $label |
Definition at line 387 of file OPiQuotations.inc.
References $quots.
OPiQuotations\OPiQuotations::quotations_by_subject | ( | $subject | ) |
Return the list of quotations/maxims of subject $subject.
string | $subject |
Definition at line 428 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_text | ( | $text | ) |
Return the list of quotations/maxims that contains the text $text.
string | $text |
Definition at line 446 of file OPiQuotations.inc.
References $text.
OPiQuotations\OPiQuotations::quotations_by_translation | ( | $translation | ) |
Return the list of quotations/maxims with a translation that contains the text $translation.
string | $translation |
Definition at line 464 of file OPiQuotations.inc.
OPiQuotations\OPiQuotations::quotations_by_work | ( | $work | ) |
Return the list of quotations/maxims that are writed in work $work.
string | $work |
Definition at line 482 of file OPiQuotations.inc.
|
protected |
Link to the database.
Definition at line 497 of file OPiQuotations.inc.