Omeka_View_Helper_FileMarkup

class Omeka_View_Helper_FileMarkup

Package: View\Helper

View Helper for displaying files through Omeka.

This will determine how to display any given file based on the MIME type(Internet media type) of that file. Individual rendering agents are definedby callbacks that are either contained within this class or defined byplugins. Callbacks defined by plugins will override native class methods ifdefined for existing MIME types. In order to define a rendering callback thatshould be in the core of Omeka, define a method in this class and then makesure that it responds to all the correct MIME types by modifying otherproperties in this class.

property _callbacks

Array of MIME types and the callbacks that can process it.

Example:array(‘video/avi’=>’wmv’);

property _fileExtensionCallbacks

Array of file extensions and the callbacks that can process them.

Taken from http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

property _callbackOptions

The array consists of the default options which are passed to the callback.

addMimeTypes(array|string $fileIdentifiers, $callback, array $defaultOptions = Array)

Add MIME types and/or file extensions and associated callbacks to the list.

This allows plugins to override/define ways of displaying specific files.The most obvious example of where this would come in handy is to defineways of displaying uncommon files, such as QTVR, or novel ways ofdisplaying more common files, such as using iPaper to display PDFs.

Parameters:
  • $fileIdentifiers (array|string) –

    Set of MIME types (Internet media types) and/or file extensions that this specific callback will respond to. Accepts the following:

    • A string containing one MIME type: 'application/msword'
    • A simple array containing MIME types: array('application/msword', 'application/doc')
    • A keyed array containing MIME types: array('mimeTypes' => array('application/msword', 'application/doc'))
    • A keyed array containing file extensions: array('fileExtensions' => array('doc', 'docx''DOC', 'DOCX'))
    • A keyed array containing MIME types and file extensions: array( 'mimeTypes' => array( 'application/msword', 'application/doc', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', ), 'fileExtensions' => array('doc', 'docx', 'DOC', 'DOCX'), )

    Note that file extensions are case sensitive.

  • $callback (unknown) –
  • $defaultOptions (array) –
Returns:

void

defaultDisplay(File $file, array $options = Array)

Default display for MIME types that do not have a valid rendering callback.

This wraps the original filename in a link to download that file, with aclass of “download-file”. Any behavior more complex than that should beprocessed with a valid callback.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string HTML

_linkToFile(File $file, array $options, string $html)

Add a link for the file based on the given set of options.

If the ‘linkToMetadata’ option is true, then link to the filemetadata page (files/show). If ‘linkToFile’ is true,link to the original file, and if ‘linkToFile’ is a string, tryto link to that specific derivative. Otherwise just return the$html without wrapping in a link.

The attributes for the link will be based off the ‘linkAttributes’ option, which should be an array.

If $html is null, it defaults to original filename of the file.

Parameters:
  • $file (File) –
  • $options (array) –
  • $html (string) –
Returns:

string

wmv(File $file, array $options = Array)

Retrieve valid XHTML for displaying a wmv video file or equivalent. Currently this loads the video inside of an <object> tag, but that provides less flexibility than a flash wrapper, which seems to be a standard Web2.0 practice for video sharing. This limitation can be overcome by a plugin that used a flash wrapper for displaying video.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

wma(File $file, array $options = Array)

Retrieve valid XHTML for displaying a wma audio file or equivalent. Currently this loads the video inside of an <object> tag, but that provides less flexibility than a flash wrapper, which seems to be a standard Web2.0 practice for video sharing. This limitation can be overcome by a plugin that used a flash wrapper for displaying video.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

mov(File $file, array $options = Array)

Retrieve valid XHTML for displaying Quicktime video files

Parameters:
  • $file (File) –
  • $options (array) – The set of default options for this includes: width, height, autoplay, controller, loop
Returns:

string

_audio(File $file, array $options, string $type)

Default display of audio files via <object> tags.

Parameters:
  • $file (File) –
  • $options (array) – The set of default options for this includes: width, height, autoplay, controller, loop
  • $type (string) – The Internet media type of the file
Returns:

string

ogg(File $file, array $options = Array)

Display OGG audio files.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

mp3(File $file, array $options = Array)

Display MP3/MPEG audio files.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

aac(File $file, array $options = Array)

Display AAC audio files.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

aiff(File $file, array $options = Array)

Display AIFF audio files.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

midi(File $file, array $options = Array)

Display MIDI audio files.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

mp4(File $file, array $options = Array)

Display MP4 audio files.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

wav(File $file, array $options = Array)

Display WAV audio files.

Parameters:
  • $file (File) –
  • $options (array) –
Returns:

string

icon($file, array $options = Array)

Default display of an icon to represent a file.

Example usage:

echo files_for_item(array(‘showFilename’=>false,’linkToFile’=>false,’linkAttributes’=>array(‘rel’=>’lightbox’),’filenameAttributes’=>array(‘class’=>’error’),’imgAttributes’=>array(‘id’=>’foobar’),’icons’ => array(‘audio/mpeg’=>img(‘audio.gif’))));

Parameters:
  • $file (unknown) –
  • $options (array) – Available options include: ‘showFilename’ => boolean, ‘linkToFile’ => boolean, ‘linkAttributes’ => array, ‘filenameAttributes’ => array (for the filename div), ‘imgAttributes’ => array, ‘icons’ => array.
Returns:

string

derivativeImage(File $file, $options = Array)

Returns valid XHTML markup for displaying an image that has been stored in Omeka.

Parameters:
  • $file (File) – Options for customizing the display of images. Current options include: ‘imageSize’
  • $options (unknown) –
Returns:

string HTML for display

getCallback($file, $options)
Parameters:
  • $file (unknown) –
  • $options (unknown) –
getDefaultOptions(mixed $callback)
Parameters:
  • $callback (mixed) –
Returns:

array

getHtml(File $file, callback $renderer, array $options)

Retrieve the HTML for a given file from the callback.

Parameters:
  • $file (File) –
  • $renderer (callback) – Any valid callback that will display the HTML.
  • $options (array) – Set of options passed to the rendering callback.
Returns:

string HTML for displaying the file.

fileMarkup(File $file, array $props = Array, array $wrapperAttributes = Array)

Bootstrap for the helper class. This will retrieve the HTML for displaying the file and by default wrap it in a <div class=”item-file”>.

Parameters:
  • $file (File) –
  • $props (array) – Set of options passed by a theme writer to the customize the display of any given callback.
  • $wrapperAttributes (array) –
Returns:

string HTML

image_tag(File|Item $record, array $props, string $format)

Return a valid img tag for an image.

Parameters:
  • $record (File|Item) –
  • $props (array) –
  • $format (string) –
Returns:

string

_getCallbackKey(callback $callback)

Get a string key to represent a given callback.

This key can be used to store and retrieve data about thecallback, like default options.

Parameters:
  • $callback (callback) –
Returns:

string

Project Versions

Previous topic

Omeka_View_Helper_FileId3Metadata

Next topic

Omeka_View_Helper_Flash

This Page