XarayaTranslationMemory
1.6
|
Public Member Functions | |
__construct ($loadByID=0, $brief=false) | |
CreateRootProject ($name, $localeID) | |
CreateProject ($rootID, $parentID, $name, $isFolder, $localeID, $document='', $skeleton='') | |
Save () | |
LoadRoot ($name, $localeID) | |
Load ($parentID, $name, $localeID, $brief) | |
LoadFromRecordSet ($recordSet, $brief) | |
LoadByID ($projectID, $brief) | |
DestroyData () | |
SetName ($name) | |
SetSkeleton ($skeleton) | |
SetDocument ($document) | |
GetName () | |
GetID () | |
GetRootID () | |
GetParentID () | |
GetIsFolder () | |
GetLocaleID () | |
GetSkeleton () | |
GetDocument () | |
GetLastSeen () | |
Static Public Member Functions | |
static | InitLocaleIDCache () |
static | GetRoots ($localeID) |
Static Public Attributes | |
static | $LocaleIDCache |
Private Member Functions | |
Clear () | |
CheckNameCollision () | |
LoadRecordSetEntry ($rs) | |
Private Attributes | |
$ProjectID | |
$ParentID | |
$RootID | |
$Name | |
$IsFolder | |
$LocaleID | |
$Skeleton | |
$Document | |
$LastSeen | |
$Brief | |
This class can handle projects. A project is either a file which contains some translatable strings, or an empty project which does not have actual strings, just subprojects only.
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. ***** A 'PROJECT' IS ONE FILE IN XARAYA TERMS *****
Definition at line 31 of file TranslationProject.php.
TranslationProject::__construct | ( | $loadByID = 0 , |
|
$brief = false |
|||
) |
Initialize a new project handler.
$loadByID | Integer, a project ID to be loaded. If not specified, empty project handler is made. |
$brief | If true, the faster project won't handle Document and Skeleton and Save won't work. |
Definition at line 53 of file TranslationProject.php.
References LoadByID().
|
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 116 of file TranslationProject.php.
References $DB, GetDbConn(), and GetTables().
Referenced by CreateProject(), and Save().
|
private |
Reinitalize - clear all internal data of - this Project.
Definition at line 105 of file TranslationProject.php.
Referenced by CreateProject().
TranslationProject::CreateProject | ( | $rootID, | |
$parentID, | |||
$name, | |||
$isFolder, | |||
$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. |
$isFolder | True if the project is a folder (no document, container for more projects) |
$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 165 of file TranslationProject.php.
References CheckNameCollision(), and Clear().
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 144 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 403 of file TranslationProject.php.
References $DB, ProjectIterator\ClearCache(), GetDbConn(), and GetTables().
TranslationProject::GetDocument | ( | ) |
Get the original document of this project
Definition at line 571 of file TranslationProject.php.
References $Document.
TranslationProject::GetID | ( | ) |
Get the ID of this project. 0 if project is not yet in the database.
Definition at line 487 of file TranslationProject.php.
References $ProjectID.
Referenced by TranslationExportXaraya\CheckCodeFiles(), TranslationExportXaraya\ExportProject(), TranslationImportXaraya\ImportFile(), and TranslationImportXaraya\ProcessDir().
TranslationProject::GetIsFolder | ( | ) |
Cheks if the project is a folder (container for projects, has no translation document).
Definition at line 529 of file TranslationProject.php.
References $IsFolder.
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 587 of file TranslationProject.php.
References $LastSeen.
TranslationProject::GetLocaleID | ( | ) |
Get the locale ID of this project. 0 if project is not yet in the database.
Definition at line 543 of file TranslationProject.php.
References $LocaleID.
Referenced by TranslationExportXaraya\CheckCodeFiles(), TranslationImportXaraya\ImportFile(), and TranslationImportXaraya\ProcessDir().
TranslationProject::GetName | ( | ) |
Get the name of this Project
Definition at line 473 of file TranslationProject.php.
References $Name.
Referenced by TranslationExportXaraya\CheckCodeFiles().
TranslationProject::GetParentID | ( | ) |
Get the Parent ID of this project.
Definition at line 515 of file TranslationProject.php.
References $ParentID.
TranslationProject::GetRootID | ( | ) |
Get the Root project's ID containing this project.
Definition at line 501 of file TranslationProject.php.
References $RootID.
Referenced by TranslationImportXaraya\ProcessDir().
|
static |
Load array of all root projects of the given locale.
Definition at line 85 of file TranslationProject.php.
References $DB, GetDbConn(), and GetTables().
Referenced by TranslationBackend\__construct().
TranslationProject::GetSkeleton | ( | ) |
Get the skeleton of this project
Definition at line 557 of file TranslationProject.php.
References $Skeleton.
Referenced by TranslationExportXaraya\ExportProject().
|
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 67 of file TranslationProject.php.
References $DB, $LocaleIDCache, GetDbConn(), and GetTables().
Referenced by CacheIndexes().
TranslationProject::Load | ( | $parentID, | |
$name, | |||
$localeID, | |||
$brief | |||
) |
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 262 of file TranslationProject.php.
References $DB, GetDbConn(), GetTables(), and LoadRecordSetEntry().
Referenced by LoadRoot().
TranslationProject::LoadByID | ( | $projectID, | |
$brief | |||
) |
Load a project by ID.
$projectID | Which project to load. |
Definition at line 315 of file TranslationProject.php.
References $DB, GetDbConn(), GetTables(), and LoadRecordSetEntry().
Referenced by __construct().
TranslationProject::LoadFromRecordSet | ( | $recordSet, | |
$brief | |||
) |
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 302 of file TranslationProject.php.
References LoadRecordSetEntry().
|
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 351 of file TranslationProject.php.
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 248 of file TranslationProject.php.
References Load().
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 194 of file TranslationProject.php.
References $DB, $ProjectID, CheckNameCollision(), GetDbConn(), and GetTables().
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 460 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 433 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 449 of file TranslationProject.php.
Referenced by TranslationImportXaraya\ImportFile().
|
private |
The project did not load Document and Skeleton for performance. Save not possible
Definition at line 42 of file TranslationProject.php.
|
private |
The original untranslated, unchanged file of this project
Definition at line 40 of file TranslationProject.php.
Referenced by GetDocument().
|
private |
True if the project it no a translatable document, just a folder or directory
Definition at line 37 of file TranslationProject.php.
Referenced by GetIsFolder().
|
private |
The date and time (UNIX timestamp) when this project was last updated.
Definition at line 41 of file TranslationProject.php.
Referenced by GetLastSeen().
|
private |
Project locale ID
Definition at line 38 of file TranslationProject.php.
Referenced by GetLocaleID().
|
static |
Static hash table caching the locale names(key) and IDs(value)
Definition at line 44 of file TranslationProject.php.
Referenced by TranslationBackend\__construct(), WebBackend\Event_ExportPack(), TranslationExportXaraya\Export(), TranslationImportXaraya\Import(), and InitLocaleIDCache().
|
private |
|
private |
Project's parent project id
Definition at line 34 of file TranslationProject.php.
Referenced by GetParentID().
|
private |
Project's ID if loaded
Definition at line 33 of file TranslationProject.php.
|
private |
Root element containing this project - redundant database data but fast
Definition at line 35 of file TranslationProject.php.
Referenced by GetRootID().
|
private |
Project's original file with placeholders for the translatable strings
Definition at line 39 of file TranslationProject.php.
Referenced by GetSkeleton().