PHP Class Prado\I18N\core\MessageSource_MySQL

Retrive the message translation from a MySQL database. See the MessageSource::factory() method to instantiate this class.
Inheritance: extends MessageSource
Afficher le fichier Open project: pradosoft/prado

Protected Properties

Свойство Type Description
$db db A resource link to the database
$dns array The DSN array property, parsed by PEAR's DB DSN parser.
$source string The datasource string, full DSN to the database.

Méthodes publiques

Méthode Description
__construct ( $source ) Constructor.
__destruct ( ) Destructor, close the database connection.
catalogues ( ) : array Returns a list of catalogue as key and all it variants as value.
connection ( ) : db Get the database connection.
delete ( $message, $catalogue = 'messages' ) : boolean Delete a particular message from the specified catalogue.
save ( $catalogue = 'messages' ) : boolean Save the list of untranslated blocks to the translation source.
update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean Update the translation.

Méthodes protégées

Méthode Description
connect ( ) : resource Connect to the MySQL datasource
getCatalogueList ( $catalogue ) : array Get all the variants of a particular catalogue.
getLastModified ( $source ) : integer Get the last modified unix-time for this particular catalogue+variant.
isValidSource ( $variant ) : boolean Check if a particular catalogue+variant exists in the database.
loadData ( $variant ) : array Get an array of messages for a particular catalogue and cultural variant.

Private Methods

Méthode Description
getCatalogueDetails ( $catalogue = 'messages' ) : array Retrive catalogue details, array($cat_id, $variant, $count).
updateCatalogueTime ( $cat_id, $variant ) : boolean Update the catalogue last modified time.

Method Details

__construct() public méthode

Create a new message source using MySQL.
public __construct ( $source )

__destruct() public méthode

Destructor, close the database connection.
public __destruct ( )

catalogues() public méthode

Returns a list of catalogue as key and all it variants as value.
public catalogues ( ) : array
Résultat array list of catalogues

connect() protected méthode

Connect to the MySQL datasource
protected connect ( ) : resource
Résultat resource MySQL connection.

connection() public méthode

Get the database connection.
public connection ( ) : db
Résultat db database connection.

delete() public méthode

Delete a particular message from the specified catalogue.
public delete ( $message, $catalogue = 'messages' ) : boolean
Résultat boolean true if deleted, false otherwise.

getCatalogueList() protected méthode

Get all the variants of a particular catalogue.
protected getCatalogueList ( $catalogue ) : array
Résultat array list of all variants for this catalogue.

getLastModified() protected méthode

We need to query the database to get the date_modified.
protected getLastModified ( $source ) : integer
Résultat integer last modified in unix-time format.

isValidSource() protected méthode

Check if a particular catalogue+variant exists in the database.
protected isValidSource ( $variant ) : boolean
Résultat boolean true if the catalogue+variant is in the database, false otherwise.

loadData() protected méthode

Get an array of messages for a particular catalogue and cultural variant.
protected loadData ( $variant ) : array
Résultat array translation messages.

save() public méthode

If the translation was not found, you should add those strings to the translation source via the append() method.
public save ( $catalogue = 'messages' ) : boolean
Résultat boolean true if saved successfuly, false otherwise.

update() public méthode

Update the translation.
public update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean
Résultat boolean true if translation was updated, false otherwise.

Property Details

$db protected_oe property

A resource link to the database
protected db $db
Résultat db

$dns protected_oe property

The DSN array property, parsed by PEAR's DB DSN parser.
protected array $dns
Résultat array

$source protected_oe property

The datasource string, full DSN to the database.
protected string $source
Résultat string