SnapContentMediaAgentsheetsApplet Class Reference
[Content Modules]

Content Module for Agentsheets Applets. More...

Inheritance diagram for SnapContentMediaAgentsheetsApplet:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 checkMedia ()
 INSERT BRIEF DESCRIPTION HERE.
 getAdditionalWorksheets ()
 INSERT BRIEF DESCRIPTION HERE.
 getAppDirPath ()
 INSERT BRIEF DESCRIPTION HERE.
 getAppDirURL ()
 Retrieves a functioning URL to the directory in which the applet resides.
 getHeight ()
 Retrieves height of applet.
 getSize ()
 INSERT BRIEF DESCRIPTION HERE.
 getWidth ()
 Retrieves width of applet.
 getWorksheet ()
 Retrieves filename of the default worksheet.
 getWsCols ()
 Retrieves number of columns of the default worksheet.
 getWsRows ()
 Retrieves number of rows of the default worksheet.
 getZipPath ()
 INSERT BRIEF DESCRIPTION HERE.
 getZipURL ()
 INSERT BRIEF DESCRIPTION HERE.
 setAdditionalWorksheets ($oldCM, $addl)
 INSERT BRIEF DESCRIPTION HERE.
 setHeight ($oldCM, $height)
 Sets the display height of the model.
 setWidth ($oldCM, $width)
 Sets the display width of the model.
 setWorksheet ($oldCM, $worksheet)
 Sets the name of the default worksheet. It should be the name of a file that was included in the ZIP file passed to uploadApplet.
 setWsCols ($oldCM, $wsCols)
 Sets the number of columns to display of the default worksheet.
 setWsRows ($oldCM, $wsRows)
 Sets the number of rows to display of the default worksheet.
 updateFileList ()
 INSERT BRIEF DESCRIPTION HERE.
 uploadApplet ($tmpFile, $fileName, $width, $height, $wsCols, $wsRows, $worksheet, $addlWorksheets=array())
 Uploads the applet into the content module.

Protected Member Functions

 doCopy ()
 INSERT BRIEF DESCRIPTION HERE.
 doDelete ()
 INSERT BRIEF DESCRIPTION HERE.
 doGetHTML ($params)
 INSERT BRIEF DESCRIPTION HERE.
 validate ()
 INSERT BRIEF DESCRIPTION HERE.

Private Member Functions

 copyFrom ($oldCM)
 INSERT BRIEF DESCRIPTION HERE.


Detailed Description

Content Module for Agentsheets Applets.

Each content module stores information about an AgentSheets applet, including a URL to an AgentSheets project folder on the server. Note that the content module does not yet support sound effects in AgentSheet models. A number of other attributes are stored, including the width and height in pixels of the applet, the number of columns and rows held in the default worksheet, a link to the worksheet, and a number of properties selected while * inside the Ristretto tool in AgentSheets. getHTML should return valid HTML code to display the applet in a browser.

Definition at line 16 of file SnapContentMediaAgentsheetsApplet.php5.


Member Function Documentation

SnapContentMediaAgentsheetsApplet::checkMedia (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SnapContent.

Definition at line 596 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::copyFrom ( oldCM  )  [private]

INSERT BRIEF DESCRIPTION HERE.

For internal use only.

INSERT FULL DESCRIPTION HERE

Parameters:
$oldCM [TYPE]: DESCRIPTION
Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 257 of file SnapContentMediaAgentsheetsApplet.php5.

References doGetHTML(), and SObject::setError().

Referenced by setAdditionalWorksheets(), setHeight(), setWidth(), setWorksheet(), setWsCols(), and setWsRows().

SnapContentMediaAgentsheetsApplet::doCopy (  )  [protected]

INSERT BRIEF DESCRIPTION HERE.

For internal use only.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SnapContent.

Definition at line 43 of file SnapContentMediaAgentsheetsApplet.php5.

References SnapContent::copy(), and doGetHTML().

SnapContentMediaAgentsheetsApplet::doDelete (  )  [protected]

INSERT BRIEF DESCRIPTION HERE.

For internal use only.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SnapContent.

Definition at line 26 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::doGetHTML ( params  )  [protected]

INSERT BRIEF DESCRIPTION HERE.

For internal use only.

INSERT FULL DESCRIPTION HERE

Parameters:
$params [TYPE]: DESCRIPTION
Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SnapContent.

Definition at line 107 of file SnapContentMediaAgentsheetsApplet.php5.

References getAppDirURL(), and validate().

Referenced by copyFrom(), doCopy(), and uploadApplet().

SnapContentMediaAgentsheetsApplet::getAdditionalWorksheets (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 500 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::getAppDirPath (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 527 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::getAppDirURL (  ) 

Retrieves a functioning URL to the directory in which the applet resides.

This method is useful when you need information about the applet for embedding into your own HTML when not using the HTML generated by getHTML().

Returns:
[string]: full URL of app directory

Definition at line 512 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

Referenced by doGetHTML().

SnapContentMediaAgentsheetsApplet::getHeight (  ) 

Retrieves height of applet.

This method is useful when you need information about applet for embedding into your own HTML when not using the HTML generated by getHTML().

Returns:
[integer]: height of applet

Definition at line 453 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::getSize (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 578 of file SnapContentMediaAgentsheetsApplet.php5.

References SObject::setError(), and validate().

SnapContentMediaAgentsheetsApplet::getWidth (  ) 

Retrieves width of applet.

This method is useful when you need the width of the applet for embedding into your own HTML when not using the HTML generated by getHTML().

Returns:
[integer]: width of the applet

Definition at line 440 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::getWorksheet (  ) 

Retrieves filename of the default worksheet.

This method is useful when you need information about the applet for embedding into your own HTML when not using the HTML generated by getHTML().

Returns:
[string]: the filename of the worksheet

Definition at line 488 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::getWsCols (  ) 

Retrieves number of columns of the default worksheet.

This method is useful when you need information about the applet for embedding into your own HTML when not using the HTML generated by getHTML().

Returns:
[integer]: number of columns in the worksheet

Definition at line 466 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::getWsRows (  ) 

Retrieves number of rows of the default worksheet.

This method is useful when you need information about the applet for embedding into your own HTML when not using the HTML generated by getHTML().

Returns:
[integer]: number of rows in the worksheet

Definition at line 477 of file SnapContentMediaAgentsheetsApplet.php5.

References validate().

SnapContentMediaAgentsheetsApplet::getZipPath (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 542 of file SnapContentMediaAgentsheetsApplet.php5.

References SObject::setError(), and validate().

SnapContentMediaAgentsheetsApplet::getZipURL (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 560 of file SnapContentMediaAgentsheetsApplet.php5.

References SObject::setError(), and validate().

SnapContentMediaAgentsheetsApplet::setAdditionalWorksheets ( oldCM,
addl 
)

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Parameters:
$oldCM [TYPE]: DESCRIPTION
$addl [TYPE]: DESCRIPTION
Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 423 of file SnapContentMediaAgentsheetsApplet.php5.

References copyFrom(), and SObject::setError().

SnapContentMediaAgentsheetsApplet::setHeight ( oldCM,
height 
)

Sets the display height of the model.

The height is stored in the content module and is the applet's width when getHTML is called.

Parameters:
$oldCM [SnapContentMediaNetlogoApplet]: the model you want to change the height of
$height [integer]: new height
Returns:
[boolean]: returns false if height is invalid or if content module is invalid

Definition at line 348 of file SnapContentMediaAgentsheetsApplet.php5.

References copyFrom(), and SObject::setError().

SnapContentMediaAgentsheetsApplet::setWidth ( oldCM,
width 
)

Sets the display width of the model.

The width is stored in the content module and is the applet's width when getHTML is called.

Parameters:
$oldCM [SnapContentMediaNetlogoApplet]: the model you want to change the width of
$width [integer]: new width
Returns:
[boolean]: returns false if width is invalid or if content module is invalid

Definition at line 329 of file SnapContentMediaAgentsheetsApplet.php5.

References copyFrom(), and SObject::setError().

SnapContentMediaAgentsheetsApplet::setWorksheet ( oldCM,
worksheet 
)

Sets the name of the default worksheet. It should be the name of a file that was included in the ZIP file passed to uploadApplet.

If the worksheet has more than this number of rows, the other rows will not be displayed.

Parameters:
$oldCM [SnapContentMediaNetlogoApplet]: the model you want to set the default worksheet for.
$worksheet [integer]: new rows
Returns:
[boolean]: returns false if input is invalid or if content module is invalid

Definition at line 404 of file SnapContentMediaAgentsheetsApplet.php5.

References copyFrom(), and SObject::setError().

SnapContentMediaAgentsheetsApplet::setWsCols ( oldCM,
wsCols 
)

Sets the number of columns to display of the default worksheet.

If the worksheet has more than this number of rows, the other rows will not be displayed.

Parameters:
$oldCM [SnapContentMediaNetlogoApplet]: the model you want to change the wsCols of
$wsCols [integer]: new rows
Returns:
[boolean]: returns false if input is invalid or if content module is invalid

Definition at line 385 of file SnapContentMediaAgentsheetsApplet.php5.

References copyFrom(), and SObject::setError().

SnapContentMediaAgentsheetsApplet::setWsRows ( oldCM,
wsRows 
)

Sets the number of rows to display of the default worksheet.

If the worksheet has more than this number of rows, the other rows will not be displayed.

Parameters:
$oldCM [SnapContentMediaNetlogoApplet]: the model you want to change the wsRows of
$wsRows [integer]: new rows
Returns:
[boolean]: returns false if input is invalid or if content module is invalid

Definition at line 367 of file SnapContentMediaAgentsheetsApplet.php5.

References copyFrom(), and SObject::setError().

SnapContentMediaAgentsheetsApplet::updateFileList (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SnapContent.

Definition at line 616 of file SnapContentMediaAgentsheetsApplet.php5.

References SnapDBI::cancelTransaction(), SnapDBI::commitTransaction(), SnapDBI::startTransaction(), and validate().

SnapContentMediaAgentsheetsApplet::uploadApplet ( tmpFile,
fileName,
width,
height,
wsCols,
wsRows,
worksheet,
addlWorksheets = array() 
)

Uploads the applet into the content module.

This method requires seven parameters. The first parameter specifies the full path to the file to be uploaded. The file, obviously, must be on the server and accessible to the web server user. The next parameter is the original name of the file. This is useful for when the file to be uploaded was uploaded by the user via a POST request. In that case, you can get the first parameter from $_FILES['foo']['tmp_name'] and the second parameter (original file name) from $_FILES['foo']['fileName']. See the code in snap2.2/tk2/editors/TKMediaAgentsheetsEditor.php5 for more on how to do this effectively/correctly.

The third and fourth parameters are the width and height of the applet respectively. If the values provided are too small, the applet will be cut off. Both parameters must be supplied and must be greater than 0. The fifth and sixth parameters are the number of rows and number of columns in an applet. All of these parameters are usually handled by the TKMediaAgentSheetsEditor class after the user uploads the AgentSheets-generated index.html. The last parameter is the name of the default worksheet.

This method will not delete the original file as specified by $tmpFile (this was the case in earlier versions of Snap2). You need to clean up that file in your code. If there is any code within Snap2 that does not do that, it should be fixed, or else image files will leak.

Parameters:
$tmpFile [string]: full path to soruce Netlogo model file file, on this server
$fileName [string]: original name of file (do not include path)
$width [integer]: the width of the applet, in pixels
$height [integer]: the height of the applet, in pixels
$wsCols [integer]: the number of columns in a worksheet
$wsRows [integer]: the number of rows in a worksheet
$worksheet [string]: this string is the name of the default worksheet.
$addlWorksheets [array]: additional worksheets to be included in model (beyond the default worksheet)
Returns:
[boolean]: success or failure; with errors set on this object; retrieve with getLastError()

Definition at line 186 of file SnapContentMediaAgentsheetsApplet.php5.

References doGetHTML(), and SObject::setError().

SnapContentMediaAgentsheetsApplet::validate (  )  [protected]

INSERT BRIEF DESCRIPTION HERE.

For internal use only.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SnapContent.

Definition at line 90 of file SnapContentMediaAgentsheetsApplet.php5.

References SnapContent::getAll().

Referenced by checkMedia(), doDelete(), doGetHTML(), getAdditionalWorksheets(), getAppDirPath(), getAppDirURL(), getHeight(), getSize(), getWidth(), getWorksheet(), getWsCols(), getWsRows(), getZipPath(), getZipURL(), and updateFileList().


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

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