A project(file) has an original document, a skeleton which contains ###33### type references to TranslationString objects. The translated document can be created from the Project's Skeleton and the Strings referenced by the ## IDs.
Definition at line 32 of file TranslationProject.php.
Public Member Functions | |
__construct ($loadByID=0) | |
CreateRootProject ($name, $localeID) | |
CreateProject ($parentID, $name, $localeID, $document= '', $skeleton= '') | |
Save () | |
LoadRoot ($name, $localeID) | |
Load ($parentID, $name, $localeID) | |
LoadFromRecordset ($recordSet) | |
LoadByID ($projectID) | |
DestroyData () | |
SetName ($name) | |
SetSkeleton ($skeleton) | |
SetDocument ($document) | |
GetName () | |
GetID () | |
GetParentID () | |
GetLocaleID () | |
GetSkeleton () | |
GetDocument () | |
GetLastSeen () | |
Static Public Member Functions | |
static | InitLocaleIDCache () |
Static Public Attributes | |
static | $LocaleIDCache |
Private Member Functions | |
Clear () | |
NameCollision () | |
LoadRecordSetEntry ($rs) | |
Private Attributes | |
$ProjectID | |
$ParentID | |
$Name | |
$LocaleID | |
$Skeleton | |
$Document | |
$LastSeen |
TranslationProject::__construct | ( | $ | loadByID = 0 |
) |
Initialize a new project handler.
$loadByID | Integer, a project ID to be loaded. If not specified, empty project handler is made. |
Definition at line 50 of file TranslationProject.php.
References LoadByID().
TranslationProject::Clear | ( | ) | [private] |
Reinitalize - clear all internal data of - this Project.
Definition at line 80 of file TranslationProject.php.
Referenced by CreateProject(), and LoadRecordSetEntry().
TranslationProject::CreateProject | ( | $ | parentID, | |
$ | name, | |||
$ | localeID, | |||
$ | document = '' , |
|||
$ | skeleton = '' | |||
) |
Initialize this object as a new (sub)project in a root or any other project.
These projects may or may not store the real textural content for the project's translation. If you want to store the project in the database, you must call ->Save() too. Until saving, the project won't have a Project ID!
$parentID | In which project to create this project as child. | |
$name | Name of the project to be created. | |
$localeID | Locale ID of this project. | |
$document | The original content of the document to be translated. | |
$skeleton | The document which contains IDs in place of each translation string from origdoc. |
Definition at line 146 of file TranslationProject.php.
References Clear(), and NameCollision().
Referenced by CreateRootProject().
TranslationProject::CreateRootProject | ( | $ | name, | |
$ | localeID | |||
) |
Create a new Project into the current object instance, which has 0 as parent ID.
Root projects cannot have actual strings content, just a placeholder for all its subprojects
$name | Name of the project to be created. | |
$localeID | Locale ID of this project. |
Definition at line 126 of file TranslationProject.php.
References CreateProject().
TranslationProject::DestroyData | ( | ) |
Removes the current project from the database.
Throws exception if the project has child projects or contains strings.
Definition at line 315 of file TranslationProject.php.
References $DB, ProjectIterator::$ProjectChildren, ProjectIterator::$ProjectList, GetDbConn(), and GetTables().
TranslationProject::GetDocument | ( | ) |
Get the original document of this project
Definition at line 456 of file TranslationProject.php.
TranslationProject::GetID | ( | ) |
Get the ID of this project. 0 if project is not yet in the database.
Definition at line 400 of file TranslationProject.php.
Referenced by TranslationImportXaraya::ImportFile().
TranslationProject::GetLastSeen | ( | ) |
Get the last seen (last update) timestamp of this project
Usually projects older than the root project of a tree can be considered as dead projects (removed from the project, becuase they were not updated by the last import).
Definition at line 472 of file TranslationProject.php.
TranslationProject::GetLocaleID | ( | ) |
Get the ID of this project. 0 if project is not yet in the database.
Definition at line 428 of file TranslationProject.php.
Referenced by TranslationImportXaraya::ImportFile().
TranslationProject::GetName | ( | ) |
Get the name of this Project
Definition at line 386 of file TranslationProject.php.
TranslationProject::GetParentID | ( | ) |
Get the Parent ID of this project.
Definition at line 414 of file TranslationProject.php.
TranslationProject::GetSkeleton | ( | ) |
Get the skeleton of this project
Definition at line 442 of file TranslationProject.php.
static TranslationProject::InitLocaleIDCache | ( | ) | [static] |
Initialize the static locale ID cache, by loading locales from the database.
You can access the locale IDs in TraslationProject::$LocaleIDCache[localename] = id format.
Definition at line 64 of file TranslationProject.php.
References $DB, $LocaleIDCache, GetDbConn(), and GetTables().
Referenced by CacheIndexes().
TranslationProject::Load | ( | $ | parentID, | |
$ | name, | |||
$ | localeID | |||
) |
Load a Project by name.
$parentID | In which parent project. | |
$name | Which project to look for. | |
$localeID | Which locale version to find. |
Definition at line 231 of file TranslationProject.php.
References $DB, GetDbConn(), GetTables(), and LoadRecordSetEntry().
Referenced by LoadRoot().
TranslationProject::LoadByID | ( | $ | projectID | ) |
Load a project by ID.
$projectID | Which project to load. |
Definition at line 267 of file TranslationProject.php.
References $DB, GetDbConn(), GetTables(), and LoadRecordSetEntry().
Referenced by __construct().
TranslationProject::LoadFromRecordset | ( | $ | recordSet | ) |
Load the next Project from an existing ADODB recordset.
The query running in the recordset must return the same columns as the query in this class' ->Load() method. Useful for loading a lot of project at once.
$recordSet | Existing ADODB recordset running a project list query. |
Definition at line 255 of file TranslationProject.php.
References LoadRecordSetEntry().
TranslationProject::LoadRecordSetEntry | ( | $ | rs | ) | [private] |
Load a Project's details using an exisitng record set.
Called by public Load() methods.
$rs | The recordset running the specified query and providing data for the project. |
Definition at line 289 of file TranslationProject.php.
References Clear().
Referenced by Load(), LoadByID(), and LoadFromRecordset().
TranslationProject::LoadRoot | ( | $ | name, | |
$ | localeID | |||
) |
Load a root Project with the given name (which has parent ID 0).
$name | Which root project to look for. | |
$localeID | Locale ID of the requested project. |
Definition at line 217 of file TranslationProject.php.
References Load().
TranslationProject::NameCollision | ( | ) | [private] |
Check if there is another Project in the database with the same name, in the same tree branch and the in the same locale (as the current Project properties).
Definition at line 98 of file TranslationProject.php.
References $DB, GetDbConn(), and GetTables().
Referenced by CreateProject(), and Save().
TranslationProject::Save | ( | ) |
Save the current Project in the database (insert or update).
The project may have empty skeleton and original document, as a placeholder project. But name, parentid and LocaleID are mandatory to be set.
Definition at line 174 of file TranslationProject.php.
References $DB, GetDbConn(), GetTables(), and NameCollision().
Referenced by TranslationImportXaraya::ImportFile().
TranslationProject::SetDocument | ( | $ | document | ) |
Set the original Document of this Project (usually the language file's original content).
To apply changes, you must ->Save() into the database.
$document | String Original document of the project. |
Definition at line 373 of file TranslationProject.php.
Referenced by TranslationImportXaraya::ImportFile().
TranslationProject::SetName | ( | $ | name | ) |
Set the name of this Project
To apply changes, you must ->Save() into the database.
$name | String New name for this project. |
Definition at line 346 of file TranslationProject.php.
TranslationProject::SetSkeleton | ( | $ | skeleton | ) |
Set the Skeleton of this Project (usually the language file's contents, with replaceable variables for translated strings)
To apply changes, you must ->Save() into the database.
$skeleton | String Skeleton document for this project. |
Definition at line 362 of file TranslationProject.php.
Referenced by TranslationImportXaraya::ImportFile().
TranslationProject::$Document [private] |
The original untranslated, unchanged file of this project
Definition at line 39 of file TranslationProject.php.
TranslationProject::$LastSeen [private] |
The date and time (UNIX timestamp) when this project was last updated.
Definition at line 40 of file TranslationProject.php.
TranslationProject::$LocaleID [private] |
Project locale ID
Definition at line 37 of file TranslationProject.php.
TranslationProject::$LocaleIDCache [static] |
Static hash table caching the locale names(key) and IDs(value)
Definition at line 42 of file TranslationProject.php.
Referenced by TranslationBackend::__construct(), WebBackend::Event_ExportPack(), TranslationExportXaraya::Export(), TranslationImportXaraya::Import(), and InitLocaleIDCache().
TranslationProject::$Name [private] |
Project name
Definition at line 36 of file TranslationProject.php.
TranslationProject::$ParentID [private] |
Project's parent project id
Definition at line 35 of file TranslationProject.php.
TranslationProject::$ProjectID [private] |
Project's ID if loaded
Definition at line 34 of file TranslationProject.php.
TranslationProject::$Skeleton [private] |
Project's original file with placeholders for the translatable strings
Definition at line 38 of file TranslationProject.php.