PHP Класс Prado\I18N\core\MessageSource_MySQL

Retrive the message translation from a MySQL database. See the MessageSource::factory() method to instantiate this class.
Наследование: extends MessageSource
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
getCatalogueDetails ( $catalogue = 'messages' ) : array Retrive catalogue details, array($cat_id, $variant, $count).
updateCatalogueTime ( $cat_id, $variant ) : boolean Update the catalogue last modified time.

Описание методов

__construct() публичный Метод

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

__destruct() публичный Метод

Destructor, close the database connection.
public __destruct ( )

catalogues() публичный Метод

Returns a list of catalogue as key and all it variants as value.
public catalogues ( ) : array
Результат array list of catalogues

connect() защищенный Метод

Connect to the MySQL datasource
protected connect ( ) : resource
Результат resource MySQL connection.

connection() публичный Метод

Get the database connection.
public connection ( ) : db
Результат db database connection.

delete() публичный Метод

Delete a particular message from the specified catalogue.
public delete ( $message, $catalogue = 'messages' ) : boolean
Результат boolean true if deleted, false otherwise.

getCatalogueList() защищенный Метод

Get all the variants of a particular catalogue.
protected getCatalogueList ( $catalogue ) : array
Результат array list of all variants for this catalogue.

getLastModified() защищенный Метод

We need to query the database to get the date_modified.
protected getLastModified ( $source ) : integer
Результат integer last modified in unix-time format.

isValidSource() защищенный Метод

Check if a particular catalogue+variant exists in the database.
protected isValidSource ( $variant ) : boolean
Результат boolean true if the catalogue+variant is in the database, false otherwise.

loadData() защищенный Метод

Get an array of messages for a particular catalogue and cultural variant.
protected loadData ( $variant ) : array
Результат array translation messages.

save() публичный Метод

If the translation was not found, you should add those strings to the translation source via the append() method.
public save ( $catalogue = 'messages' ) : boolean
Результат boolean true if saved successfuly, false otherwise.

update() публичный Метод

Update the translation.
public update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean
Результат boolean true if translation was updated, false otherwise.

Описание свойств

$db защищенное свойство

A resource link to the database
protected db $db
Результат db

$dns защищенное свойство

The DSN array property, parsed by PEAR's DB DSN parser.
protected array $dns
Результат array

$source защищенное свойство

The datasource string, full DSN to the database.
protected string $source
Результат string