SetaPDF_Merger_Collection Class for creating and managing PDF Collections (aka Portfolios, or Packages).

File: /SetaPDF/Merger/Collection.php

Class hierarchy

Summary

Constants

SORT_ASC

const boolean SetaPDF_Merger_Collection::SORT_ASC = true

Sort in ascending order.

SORT_DESC

const string SetaPDF_Merger_Collection::SORT_DESC = false

Sort in descending order.

SPLIT_HORIZONTALLY

Indicates that the window is split horizontally.

SPLIT_NO

Indicates that the window is not split. The entire window region shall be dedicated to the file navigation view.

SPLIT_VERTICALLY

Indicates that the window is split vertically.

VIEW_DETAILS

The collection view shall be presented in details mode.

VIEW_HIDDEN

The collection view shall be initially hidden.

VIEW_NAVIGATOR

The collection view shall be presented by the navigator specified by the Navigator entry.

VIEW_TILE

The collection view shall be presented in tile mode.


Properties

$_document

The document instance of the cover sheet.

$_schema


Methods

__construct()

The constructor.

Parameters
$document : SetaPDF_Core_Document
 

_getSplitDictionary()

Get and/or creates the split dictionary.

Parameters
$create : bool
 

addFile()

public string SetaPDF_Merger_Collection::addFile ( SetaPDF_Core_Reader_ReaderInterface|string $pathOrReader, string $filename [, null|string $description = null [, array $fileStreamParams = array ( ) [, null|string $mimeType = null [, null|array|SetaPDF_Merger_Collection_Item $collectionItem = null ]]]] )

Add a file to the collection.

Parameters
$pathOrReader : SetaPDF_Core_Reader_ReaderInterface|string

A reader instance or a path to a file.

$filename : string

The filename in UTF-8 encoding.

$description : null|string

The description of the file.

$fileStreamParams : array

See SetaPDF_Core_EmbeddedFileStream::setParams() method.

$mimeType : null|string

The subtype of the embedded file. Shall conform to the MIME media type names defined in Internet RFC 2046

$collectionItem : null|array|SetaPDF_Merger_Collection_Item

The data described by the collection schema.

Return Values

The name that was used to register the file specification in the embedded files name tree.

addFolder()

public SetaPDF_Merger_Collection_Folder SetaPDF_Merger_Collection::addFolder ( string $name [, null|string $description = null [, DateTime|null $creationDate = null [, DateTime|null $modificationDate = null [, null|array|SetaPDF_Merger_Collection_Item $collectionItem = null ]]]] )

Add a folder to the collection.

Parameters
$name : string

The folder name.

$description : null|string

The description of the folder.

$creationDate : DateTime|null

If null "now" will be used.

$modificationDate : DateTime|null

If null "now" will be used.

$collectionItem : null|array|SetaPDF_Merger_Collection_Item

The data described by the collection schema.

cleanUp()

public void SetaPDF_Merger_Collection::cleanUp ( void )

Release cylced referenced.

deleteFile()

public bool SetaPDF_Merger_Collection::deleteFile ( string $name )

Removes a file from the collection.

If the file doesn't exists false will be returned.

Parameters
$name : string

The name with which the file is registered in the documents embedded files name tree.

getDictionary()

public null|SetaPDF_Core_Type_Dictionary SetaPDF_Merger_Collection::getDictionary ( [ bool $create = false ] )

Get the collection dictionary.

Parameters
$create : bool
 

getDocument()

Get the document instance.

getFile()

Get a file by its name in the embedded files name tree.

Parameters
$name : string
 

getFiles()

Get all embedded files from this collection/document.

getInitialDocument()

public string|null SetaPDF_Merger_Collection::getInitialDocument ( void )

Get the name of the document, that should be initially presented.

Return Values

Null if it is not defined.

getRootFolder()

public SetaPDF_Merger_Collection_Folder|null SetaPDF_Merger_Collection::getRootFolder ( [ boolean $create = false ] )

Get and/or created the root folder instance.

To ensure that a root folder is created pass true as the $create parameter.

Parameters
$create : boolean

Defines whether to create the folder if it does not exists or not.

getSchema()

Get the schema instance.

getSort()

public array SetaPDF_Merger_Collection::getSort ( void )

Get the data which specifies the order in which in the collection shall be sorted in the user interface.

Return Values

The key is the field name, while the value describing the direction.

See

getSplitterDirection()

public string|null SetaPDF_Merger_Collection::getSplitterDirection ( void )

Get the orientation of the splitter bar.

getSplitterPosition()

public number|null SetaPDF_Merger_Collection::getSplitterPosition ( void )

Get the initial position of the splitter bar.

getView()

public string SetaPDF_Merger_Collection::getView ( void )

Get the initial view.

hasFolders()

Checks whether this collection has folders or not.

isCollection()

public boolean SetaPDF_Merger_Collection::isCollection ( void )

Checks whether the document instance has the Collection dictionary defined or not.

setInitialDocument()

public void SetaPDF_Merger_Collection::setInitialDocument ( string $name )

Set the name of the document, that should be initially presented.

If you want to open a document, that is located in a subfolder, you will need to pass the id of the subfolder as a prefix to the name:

$collection->setInitialDocument('<' . $folder->getId() . '>' . $name);
Parameters
$name : string
 

setSort()

public void SetaPDF_Merger_Collection::setSort ( array $sort )

Set the data that specifies the order in which the collection shall be sorted in the user interface.

Parameters
$sort : array

The key is the field name, while the value defines the direction. Valid key names are field names defined in the schema or SetaPDF_Merger_Collection_Schema::DATA_* constants.

See

setSplitterDirection()

public void SetaPDF_Merger_Collection::setSplitterDirection ( string $direction )

Set the orientation of the splitter bar.

Parameters
$direction : string
 

setSplitterPosition()

public void SetaPDF_Merger_Collection::setSplitterPosition ( number $position )

Set the initial position of the splitter bar.

Parameters
$position : number
 

setView()

public void SetaPDF_Merger_Collection::setView ( string $view )

Set the initial view.

Parameters
$view : string

A view constant.

See