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
파일 보기 프로젝트 열기: pradosoft/prado

보호된 프로퍼티들

프로퍼티 타입 설명
$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