TranslationProject Class Reference

List of all members.

Detailed Description

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.

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


Constructor & Destructor Documentation

TranslationProject::__construct ( loadByID = 0  ) 

Initialize a new project handler.

Parameters:
$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().


Member Function Documentation

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!

Parameters:
$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.
Exceptions:
'Exception' thrown if a project with same name exists in the same location.

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

Parameters:
$name Name of the project to be created.
$localeID Locale ID of this project.
Returns:
The ID of the newly created project, false if a root project wiht $name already exists.

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

Returns:
string 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.

Returns:
int ID of this project.

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).

Returns:
timestamp The last update time of this project.

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.

Returns:
int ID of this project.

Definition at line 428 of file TranslationProject.php.

Referenced by TranslationImportXaraya::ImportFile().

TranslationProject::GetName (  ) 

Get the name of this Project

Returns:
string Name of this project.

Definition at line 386 of file TranslationProject.php.

TranslationProject::GetParentID (  ) 

Get the Parent ID of this project.

Returns:
int Parent ID of this project.

Definition at line 414 of file TranslationProject.php.

TranslationProject::GetSkeleton (  ) 

Get the skeleton of this project

Returns:
string 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.

Parameters:
$parentID In which parent project.
$name Which project to look for.
$localeID Which locale version to find.
Returns:
True on success, false otherwise.

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.

Parameters:
$projectID Which project to load.
Returns:
True on success, false otherwise.

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.

Parameters:
$recordSet Existing ADODB recordset running a project list query.
Returns:
True on success, false otherwise.

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.

Parameters:
$rs The recordset running the specified query and providing data for the project.
Returns:
True on success, false otherwise (no more rows).

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).

Parameters:
$name Which root project to look for.
$localeID Locale ID of the requested project.
Returns:
True on success, false otherwise.

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).

Returns:
Bool true if names collide, false if name is free

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.

Returns:
The ID of the created project.

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.

Parameters:
$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.

Parameters:
$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.

Parameters:
$skeleton String Skeleton document for this project.

Definition at line 362 of file TranslationProject.php.

Referenced by TranslationImportXaraya::ImportFile().


Member Data Documentation

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.


The documentation for this class was generated from the following file:
Generated on Tue Mar 20 00:42:40 2007 for XarayaTranslationMemory by  doxygen 1.4.7