VirtueMart  3.2.14.9808
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
VmMediaHandler Class Reference
Inheritance diagram for VmMediaHandler:
Inheritance graph
[legend]

Public Member Functions

 __construct ($id=0)
 
 getMediaUrlByView ($type)
 
 setFileInfo ($type=0)
 
 getUrl ()
 
 getThumbUrl ()
 
 getFullPath ()
 
 getThumbPath ()
 
 determineFoldersToTest ()
 
 addFoldersToTest ($folders)
 
 displayFoldersWriteAble ()
 
 displaySupportedImageTypes ()
 
 filterImageArgs ($imageArgs)
 
 displayMediaFull ()
 
 displayMediaThumb ($imageArgs='', $lightbox=true, $effect="class='modal' rel='group'", $return=true, $withDescr=false, $absUrl=false, $width=0, $height=0)
 
 getFileUrlThumb ($width=0, $height=0)
 
 getIcon ($imageArgs, $lightbox, $return=false, $withDescr=false, $absUrl=false)
 
 displayIt ($file_url, $file_alt, $imageArgs, $lightbox, $effect="class='modal'", $withDesc=false, $absUrl=false)
 
 uploadFile ($urlfolder, $overwrite=false)
 
 deleteFile ($url, $absPathGiv=0)
 
 deleteThumbs ()
 
 processAction ($data)
 
 processAttributes ($data)
 
 addMediaAction ($optionName, $langkey)
 
 addMediaActionByType ()
 
 addMediaAttributes ($optionName, $langkey='')
 
 addMediaAttributesByType ()
 
 addHidden ($name, $value='')
 
 displayFilesHandler ($fileIds, $type, $vendorId=0)
 
 displayFileSelection ($fileIds, $type=0)
 
 displayImage ($image, $key)
 
 displayFileHandler ($vendorId=0)
 

Static Public Member Functions

static getStoriesFb ($suffix= '')
 
static createMedia ($table, $type='', $file_mimetype='')
 
static prepareStoreMedia ($table, $data, $type)
 
static displayImages ($types='', $page=0, $max=16)
 
static getImagesList ($type= '', $limit=0, $max=16)
 

Public Attributes

 $media_attributes = 0
 
 $setRole = false
 
 $file_name = ''
 
 $file_extension = ''
 
 $virtuemart_media_id = ''
 

Private Member Functions

 addHiddenByType ()
 
 getOptions ($optionsarray)
 
 displayRow ($descr, $name, $readonly='', $value=null)
 
 displayHidden ()
 

Static Private Member Functions

static isImage ($file_extension=0)
 

Private Attributes

 $_foldersToTest = array()
 
 $_actions = array()
 
 $_mLocation = array()
 
 $_hidden = array()
 

Constructor & Destructor Documentation

VmMediaHandler::__construct (   $id = 0)

Member Function Documentation

VmMediaHandler::addFoldersToTest (   $folders)

Add complete paths here to test/display if their are writable

Author
Max Milbers
Parameters
absolutepPath$folders
VmMediaHandler::addHidden (   $name,
  $value = '' 
)

Use this to adjust the hidden fields of the displayFileHandler to your form

Author
Max Milbers
Parameters
string$namefor exampel view
string$valuefor exampel media
VmMediaHandler::addHiddenByType ( )
private

Adds the hidden fields which are needed for the form in every case

Author
Max Milbers
VmMediaHandler::addMediaAction (   $optionName,
  $langkey 
)

This method can be used to add extra actions to the media

Author
Max Milbers
Parameters
string$optionNamethis is the value in the form
string$langkeythe langkey used
VmMediaHandler::addMediaActionByType ( )

Adds the media action which are needed in the form for all media, you can use this function in your child calling parent. Look in VmImage for an exampel

Author
Max Milbers
VmMediaHandler::addMediaAttributes (   $optionName,
  $langkey = '' 
)

This method can be used to add extra attributes to the media

Author
Max Milbers
Parameters
string$optionNamethis is the value in the form
string$langkeythe langkey used
VmMediaHandler::addMediaAttributesByType ( )

Adds the attributes which are needed in the form for all media, you can use this function in your child calling parent. Look in VmImage for an exampel

Author
Max Milbers
static VmMediaHandler::createMedia (   $table,
  $type = '',
  $file_mimetype = '' 
)
static

This function determines the type of a media and creates it. When you want to write a child class of the mediahandler, you need to manipulate this function. We may use later here a hook for plugins or simular

Author
Max Milbers
Parameters
object$table
string$typevendor,product,category,...
string$file_mimetypesuch as image/jpeg
VmMediaHandler::deleteFile (   $url,
  $absPathGiv = 0 
)

Deletes a file

Parameters
string$urlrelative Url, gets adjusted to path
VmMediaHandler::deleteThumbs ( )
VmMediaHandler::determineFoldersToTest ( )

This functions adds the folders to test for each media, you can add more folders to test with addFoldersToTest

Author
Max Milbers
VmMediaHandler::displayFileHandler (   $vendorId = 0)

This displays a media handler. It displays the full and the thumb (icon) of the media. It also gives a possibility to upload/change/thumbnail media

Parameters
string$imageArgshtml atttributes, Just for displaying the fullsized image
VmMediaHandler::displayFileSelection (   $fileIds,
  $type = 0 
)

Displays a possibility to select already uploaded media the getImagesList must be adjusted to have more search functions

Author
Max Milbers
Parameters
array$fileIds
VmMediaHandler::displayFilesHandler (   $fileIds,
  $type,
  $vendorId = 0 
)

Displays file handler and file selector

Author
Max Milbers
Parameters
array$fileIds
VmMediaHandler::displayFoldersWriteAble ( )

Displays for paths if they are writeable You set the folders to test with the function addFoldersToTest

Author
Max Milbers
VmMediaHandler::displayHidden ( )
private

renders the hiddenfields added in the layout before (used to make the displayFileHandle reusable)

Author
Max Milbers
VmMediaHandler::displayImage (   $image,
  $key 
)
static VmMediaHandler::displayImages (   $types = '',
  $page = 0,
  $max = 16 
)
static
VmMediaHandler::displayIt (   $file_url,
  $file_alt,
  $imageArgs,
  $lightbox,
  $effect = "class='modal'",
  $withDesc = false,
  $absUrl = false 
)

This function is just for options how to display an image... we may add here plugins for displaying images

Author
Max Milbers
Parameters
string$file_urlrelative Url
string$file_altmedia description
string$imageArgsattributes for displaying the images
boolean$lightboxuse lightbox
VmMediaHandler::displayMediaFull ( )

Just for overwriting purpose for childs. Take a look on VmImage to see an example

Author
Max Milbers
VmMediaHandler::displayMediaThumb (   $imageArgs = '',
  $lightbox = true,
  $effect = "class='modal' rel='group'",
  $return = true,
  $withDescr = false,
  $absUrl = false,
  $width = 0,
  $height = 0 
)

This function displays the image, when the image is not already a resized one, it tries to get first the resized one, or create a resized one or fallback in case

Author
Max Milbers
Parameters
string$imageArgsAttributes to be included in the tag.
boolean$lightboxalternative display method
string$effectalternative lightbox display
boolean$withDescdisplay the image media description
VmMediaHandler::displayRow (   $descr,
  $name,
  $readonly = '',
  $value = null 
)
private

Just for creating simpel rows

Author
Max Milbers
Parameters
string$descr
string$name
VmMediaHandler::displaySupportedImageTypes ( )

Shows the supported file types for the server

Author
enyo 06-Nov-2003 03:32 http://www.php.net/manual/en/function.imagetypes.php
Max Milbers
Returns
multitype:string
VmMediaHandler::filterImageArgs (   $imageArgs)
VmMediaHandler::getFileUrlThumb (   $width = 0,
  $height = 0 
)
VmMediaHandler::getFullPath ( )
VmMediaHandler::getIcon (   $imageArgs,
  $lightbox,
  $return = false,
  $withDescr = false,
  $absUrl = false 
)

This function should return later also an icon, if there isnt any automatic thumbnail creation possible like pdf, zip, ...

Author
Max Milbers
Parameters
string$imageArgs
boolean$lightbox
static VmMediaHandler::getImagesList (   $type = '',
  $limit = 0,
  $max = 16 
)
static

Retrieve a list of layouts from the default and chosen templates directory.

We may use here the getFiles function of the media model or write something simular

Author
Max Milbers
Parameters
nameof the view
Returns
object List of flypage objects
VmMediaHandler::getMediaUrlByView (   $type)

The type of the media determines the used path for storing them

Author
Max Milbers
Parameters
string$typetype of the media, allowed values product, category, shop, vendor, manufacturer, forSale
VmMediaHandler::getOptions (   $optionsarray)
private

child classes can add their own options and you can get them with this function

Parameters
array$optionsarrayAllowed values are $this->_actions and $this->_attributes
static VmMediaHandler::getStoriesFb (   $suffix = '')
static
VmMediaHandler::getThumbPath ( )
VmMediaHandler::getThumbUrl ( )
VmMediaHandler::getUrl ( )
static VmMediaHandler::isImage (   $file_extension = 0)
staticprivate

Tests if a function is an image by mime or extension

Author
Max Milbers
Parameters
string$file_mimetype
string$file_extension
static VmMediaHandler::prepareStoreMedia (   $table,
  $data,
  $type 
)
static

This prepares the object for storing the data. This means it does the action and returns the data for storing in the table

Author
Max Milbers
Parameters
object$table
array$data
string$type
VmMediaHandler::processAction (   $data)

Processes the choosed Action while storing the data, gets extend by the used child, use for the action clear commands. Useable commands in all medias upload, upload_delete, delete, and all of them with _thumb on it also.

Author
Max Milbers
Parameters
arraybyform$data
VmMediaHandler::processAttributes (   $data)

For processing the Attributes of the media while the storing process

Author
Max Milbers
Parameters
unknown_type$data
VmMediaHandler::setFileInfo (   $type = 0)

Sets the file information and paths/urls and so on.

Author
Max Milbers
Parameters
unknown_type$filename
unknown_type$url
unknown_type$path
VmMediaHandler::uploadFile (   $urlfolder,
  $overwrite = false 
)

Handles the upload process of a media, sets the mime_type, when success

Author
Max Milbers
Parameters
string$urlfolderrelative url of the folder where to store the media
Returns
name of the uploaded file

Member Data Documentation

VmMediaHandler::$_actions = array()
private
VmMediaHandler::$_foldersToTest = array()
private
VmMediaHandler::$_hidden = array()
private
VmMediaHandler::$_mLocation = array()
private
VmMediaHandler::$file_extension = ''
VmMediaHandler::$file_name = ''
VmMediaHandler::$media_attributes = 0
VmMediaHandler::$setRole = false
VmMediaHandler::$virtuemart_media_id = ''

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