Table_File

Package: Db\Table

class Table_File

extends Omeka_Db_Table

property Table_File::$_target

protected

Table_File::applySearchFilters($select, $params)
Parameters:
  • $select

  • $params

Table_File::filterByHasDerivativeImage($select, $hasDerivative)
Parameters:
  • $select

  • $hasDerivative

Table_File::getSelect()

All files should only be retrieved if they join properly on the items table.

Returns:

Omeka_Db_Select

Table_File::getRandomFileWithImage($itemId)

Retrieve a random file with an image associated with an item.

Parameters:
  • $itemId (int) –

Returns:

File

Table_File::findByItem($itemId, $fileIds = array(), $sort = 'order')

Retrieve files associated with an item.

Parameters:
  • $itemId (int) –

  • $fileIds (array) – Optional If given, this will only retrieve files with these specific IDs.

  • $sort (string) – The manner by which to order the files. For example: ‘id’: file id, ‘filename’ = alphabetical by filename. The default is ‘order’, following the user’s specified order.

Returns:

array

Table_File::findOneByItem($itemId, $index = 0, $sort = 'order')

Get a single file associated with an item, by index.

Parameters:
  • $itemId (int) –

  • $index (int) –

  • $sort (string) – The manner by which to order the files. For example: ‘id’: file id, ‘filename’ = alphabetical by filename. The default is ‘order’, following the user’s specified order.

Returns:

File|null

Table_File::findWithImages($itemId, $index = null, $sort = 'order')

Retrieve files for an item that has derivative images.

Parameters:
  • $itemId (int) – The ID of the item to get images for.

  • $index (int|null) – Optional If given, this specifies the file to retrieve for an item, based upon the ordering of its files.

  • $sort (string) – The manner by which to order the files. For example: ‘id’: file id, ‘filename’: alphabetical by filename. The default is ‘order’, following the user’s specified order.

Returns:

File|array

Table_File::_orderFilesBy($select, $sort)

Orders select results for files.

Parameters:
  • $select

  • $sort (string) – The manner in which to order the files by. For example: ‘id’ = file id ‘filename’ = alphabetical by filename