STrans Class Reference
[Translators]

The template class for all the translation classes. More...

Inheritance diagram for STrans:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 __construct ($parent)
 A standard constructor method for all XML translators.
 doc ()
 A doc method that can be called externally to get a brief description of this class.
 getInFormat ()
 Gets the expected input format the user has set.
 getInputOption ($key)
 returns the value of the requested input option If the desired option is not set, returns null.
 getOption ($key)
 If the requested option is set, returns that option's value.
 getOutFormat ()
 Gets the expected output format the user wants.
 getPageRender ()
 INSERT BRIEF DESCRIPTION HERE.
 sendToTarget ($si, $input)
 Puts the output of the translator into the appropriate slot in the SPage object.
 setInputOption ($key, $value)
 Sets the given input option to the given value.
 setInputOptions ($options)
 Set all the input options. Sets all the input options. The given array is simply stored as the input options.
 setOption ($key, $value)
 Sets the desired option to the given value.
 translate ($si)
 A translator helper function that looks for the desired translation helper class.

Protected Attributes

 $inputOptions
 $options
 $parent
 $transHelper
 $transHelperClass
 $transHelperCustom
 $transHelperCustomClass


Detailed Description

The template class for all the translation classes.

The most basic translation class. It is extended by all other classes. Do not use this translator directly. Extend it to make the desired translators.

Author:
Jonathan Stuart-Moore <jwsm@shodor.org> (10/17/06)

Definition at line 11 of file STrans.php5.


Constructor & Destructor Documentation

STrans::__construct ( parent  ) 

A standard constructor method for all XML translators.

Parameters:
$parent [PageRender]: the current instance of PageRender in use.

Reimplemented in STransInteractivateInstructor, STransInteractivateLesson, STransListXML, and STransXFormsXML.

Definition at line 56 of file STrans.php5.

References $parent, and SObject::setPrettyError().


Member Function Documentation

STrans::doc (  ) 

A doc method that can be called externally to get a brief description of this class.

Returns:
[String] A brief description of this class.

Reimplemented from SObject.

Reimplemented in STransBookXML, STransHTML, STransListXML, STransMediaAgentSheetsApplet, STransMediaApplet, STransMediaDocument, STransMediaFile, STransMediaImage, STransMediaInteractivateApplet, STransMediaNetLogoApplet, STransNavXML, STransObject, STransPhotoXML, STransStdXML, STransStdXML3, STransTK, STransXML, and STransXSL.

Definition at line 46 of file STrans.php5.

STrans::getInFormat (  ) 

Gets the expected input format the user has set.

Child classes will override this function.

Returns:
[String] The format selected by the option 'inFormat'.

Reimplemented in STransHTML, STransMediaAgentSheetsApplet, STransMediaApplet, STransMediaDocument, STransMediaFile, STransMediaImage, STransMediaInteractivateApplet, STransMediaNetLogoApplet, STransObject, STransStdXML, STransStdXML3, STransTK, STransXML, and STransXSL.

Definition at line 90 of file STrans.php5.

References getOption().

STrans::getInputOption ( key  ) 

returns the value of the requested input option If the desired option is not set, returns null.

Parameters:
$key [string]: the name of the requested option.
Returns:
[string]: the value of the requested option (null if not found).

Definition at line 218 of file STrans.php5.

Referenced by STransStdXML3::translate().

STrans::getOption ( key  ) 

If the requested option is set, returns that option's value.

If the option is set, returns the value. If it isn't set asks the parent for the same option.

Parameters:
$key [string]: the name of the option.
Returns:
[string]: the value of the requested option.

Definition at line 190 of file STrans.php5.

Referenced by STransPhotoXML::createPhotoHTML(), STransPhotoXML::createPhotoJS(), STransNavXML::formatTabs(), getInFormat(), getOutFormat(), STransStdXML::translate(), STransListXML::translate(), translate(), and STransListXML::translateListPage().

STrans::getOutFormat (  ) 

Gets the expected output format the user wants.

Child classes should override this function.

Returns:
[String] The format selected by the option 'outFormat'.

Reimplemented in STransHTML, STransMediaAgentSheetsApplet, STransMediaApplet, STransMediaDocument, STransMediaFile, STransMediaImage, STransMediaInteractivateApplet, STransMediaNetLogoApplet, STransObject, STransStdXML, STransStdXML3, STransTK, STransXML, and STransXSL.

Definition at line 100 of file STrans.php5.

References getOption().

STrans::getPageRender (  ) 

INSERT BRIEF DESCRIPTION HERE.

For internal use only.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 230 of file STrans.php5.

STrans::sendToTarget ( si,
input 
)

Puts the output of the translator into the appropriate slot in the SPage object.

Grabs the target slot and the input mode (append or set) from the SInput object. If the option "trans_mode" is set to append, it will append to the slot. Otherwise it overwrites the slot ('set'). It hands SPage the desired slot and the output.

Parameters:
$si [SInput]: the SInput object just translated.
$input [string]: a string containing the result of translation (HTML, Javascript, or XML).

Definition at line 167 of file STrans.php5.

Referenced by TransSDRPendingXML::translate(), STransXSL::translate(), STransXFormsXML::translate(), STransTK::translate(), STransStdXML3::translate(), STransStdXML::translate(), STransSDRMetadata::translate(), STransPhotoXML::translate(), STransNSDLSearchXML::translate(), STransMediaNetLogoApplet::translate(), STransMediaInteractivateApplet::translate(), STransMediaImage::translate(), STransMediaFile::translate(), STransMediaDocument::translate(), STransMediaApplet::translate(), STransMediaAgentSheetsApplet::translate(), STransListXML::translate(), STransHTMLTK::translate(), STransHTMLMedia::translate(), STransHTML::translate(), and STransBookXML::translate().

STrans::setInputOption ( key,
value 
)

Sets the given input option to the given value.

Parameters:
$key [string]: the name of the desired input option.
$value [string]: the desired value for the input option.

Definition at line 209 of file STrans.php5.

STrans::setInputOptions ( options  ) 

Set all the input options. Sets all the input options. The given array is simply stored as the input options.

Parameters:
$options [array]: an associative array of the input options.

Definition at line 199 of file STrans.php5.

References $options.

STrans::setOption ( key,
value 
)

Sets the desired option to the given value.

Parameters:
$key [string]: the name of the option being set.
$value [string]: the value to set the option to.

Definition at line 180 of file STrans.php5.

Referenced by STransListXML::__construct(), and STransStdXML3::translate().

STrans::translate ( si  ) 

A translator helper function that looks for the desired translation helper class.

Child classes can use this function to get the correct translator. NOTE: this translator does no translation itself. If a custom translator is set, the function will try to use it. If the translator has logged errors or cannot find the custom translator, it will return false. If no custom translator is selected or the custom translator is found, it returns true.

Parameters:
$si [SInput]: The SInput object being translated.

Reimplemented in STransBookXML, STransHTML, STransHTMLMedia, STransHTMLTK, STransListXML, STransMediaAgentSheetsApplet, STransMediaApplet, STransMediaDocument, STransMediaFile, STransMediaImage, STransMediaInteractivateApplet, STransMediaNetLogoApplet, STransNavXML, STransNSDLSearchXML, STransObject, STransPhotoXML, STransSDRMetadata, STransStdXML, STransStdXML3, STransTK, STransXFormsXML, STransXML, STransXSL, and TransSDRPendingXML.

Definition at line 119 of file STrans.php5.

References getOption(), SObject::hasError(), and SObject::setPrettyError().


Member Data Documentation

STrans::$inputOptions [protected]

For internal use only.

A different set of options (? maybe coming from a different place? or specifyinga different set of options?)

Definition at line 40 of file STrans.php5.

STrans::$options [protected]

For internal use only.

User-defined options, such as output format and custom translators

Definition at line 37 of file STrans.php5.

Referenced by setInputOptions().

STrans::$parent [protected]

For internal use only.

The parent class (PageRender) I feel it should be noted this usage of parent is different from PHP's concept of parent. STrans extends SObject, so SObject is what PHP would call the parent. but the variable, parent, is actually the current instance of the PageRender class in use.

Definition at line 18 of file STrans.php5.

Referenced by STransXFormsXML::__construct(), STransListXML::__construct(), STransInteractivateLesson::__construct(), STransInteractivateInstructor::__construct(), and __construct().

STrans::$transHelper [protected]

For internal use only.

The helper class for translating XML

Definition at line 23 of file STrans.php5.

STrans::$transHelperClass [protected]

For internal use only.

The name of the helper class (so the program can look it up)

Reimplemented in STransListXML, STransStdXML, and STransStdXML3.

Definition at line 26 of file STrans.php5.

STrans::$transHelperCustom [protected]

For internal use only.

An optional, user-defined helper class (if they want a different translator)

Definition at line 30 of file STrans.php5.

STrans::$transHelperCustomClass [protected]

For internal use only.

The name of the optional class (for looking up)

Definition at line 33 of file STrans.php5.


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:06:39 2010 for Common by  doxygen 1.5.6