SnapContentMediaNetlogoApplet Class Reference
[Content Modules]

Content Module for Netlogo Applets. More...

Inheritance diagram for SnapContentMediaNetlogoApplet:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 checkMedia ()
 INSERT BRIEF DESCRIPTION HERE.
 getHeight ()
 Retrieves height of applet.
 getNlogoPath ()
 INSERT BRIEF DESCRIPTION HERE.
 getNlogoURL ()
 Retrieves URL of applet.
 getSize ()
 INSERT BRIEF DESCRIPTION HERE.
 getWidth ()
 Retrieves width of applet.
 setHeight ($oldCM, $height)
 Sets the display height of the model.
 setWidth ($oldCM, $width)
 Sets the display width of the model.
 updateFileList ()
 INSERT BRIEF DESCRIPTION HERE.
 uploadApplet ($tmpFile, $fileName, $width, $height)
 Uploads the applet into the content module.


Detailed Description

Content Module for Netlogo Applets.

Each content module stores information about an applet, including a URL to a .nlogo model file on the server. Also stored is the width and height of the applet. getHTML should return valid HTML code to display the applet in a browser.


Member Function Documentation

SnapContentMediaNetlogoApplet::checkMedia (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SnapContent.

SnapContentMediaNetlogoApplet::getHeight (  ) 

Retrieves height of applet.

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

Returns:
[integer]: height of the image

SnapContentMediaNetlogoApplet::getNlogoPath (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

SnapContentMediaNetlogoApplet::getNlogoURL (  ) 

Retrieves URL of applet.

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

Returns:
[string]: URL to a Netlogo file.

SnapContentMediaNetlogoApplet::getSize (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

SnapContentMediaNetlogoApplet::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 image

SnapContentMediaNetlogoApplet::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

SnapContentMediaNetlogoApplet::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

SnapContentMediaNetlogoApplet::updateFileList (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SnapContent.

SnapContentMediaNetlogoApplet::uploadApplet ( tmpFile,
fileName,
width,
height 
)

Uploads the applet into the content module.

This method requires four 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/TKMediaNetlogoEditor.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. 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.

Most errors related to resizing or creating the subimages will be handled gracefully, but it is still possible that large or strange images could result in PHP running out of memory, or some other bad condition. Call this method with care and warn users appropriate when uploading images.

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 desired display width of the applet (greater than 0)
$height [integer]: the desired display height of the applet (greater than 0)
Returns:
[boolean]: success or failure; with errors set on this object; retrieve with getLastError()


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

Generated on Wed Nov 24 02:03:15 2010 for Common by  doxygen 1.5.6