2012-07-16 03:06:35 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Interface for a DMSDocument used in the Document Management System. A DMSDocument is create by storing a File object in an
|
|
|
|
* instance of the DMSInterface. All write operations on the DMSDocument create a new relation, so we never need to
|
|
|
|
* explicitly call the write() method on the DMSDocument DataObject
|
2012-07-16 03:06:35 +02:00
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
interface DMSDocumentInterface {
|
2012-07-16 03:06:35 +02:00
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Deletes the DMSDocument, its underlying file, as well as any tags related to this DMSDocument.
|
2012-07-16 21:55:05 +02:00
|
|
|
*
|
|
|
|
* @todo Can't be applied to classes which already implement the DataObjectInterface (naming conflict)
|
|
|
|
*
|
2012-07-16 03:06:35 +02:00
|
|
|
* @abstract
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 21:55:05 +02:00
|
|
|
// function delete();
|
2012-07-16 03:06:35 +02:00
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Associates this DMSDocument with a Page. This method does nothing if the association already exists.
|
2012-07-27 02:22:27 +02:00
|
|
|
* This could be a simple wrapper around $myDoc->Pages()->add($myPage) to add a many_many relation
|
2012-07-16 03:06:35 +02:00
|
|
|
* @abstract
|
2012-07-16 08:21:48 +02:00
|
|
|
* @param $pageObject Page object to associate this DMSDocument with
|
2012-07-16 05:32:28 +02:00
|
|
|
* @return null
|
2012-07-16 03:06:35 +02:00
|
|
|
*/
|
|
|
|
function addPage($pageObject);
|
2012-07-27 02:22:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Associates this DMSDocument with a set of Pages. This method loops through a set of page ids, and then associates this
|
|
|
|
* DMSDocument with the individual Page with the each page id in the set
|
|
|
|
* @abstract
|
|
|
|
* @param $pageIDs array of page ids used for the page objects associate this DMSDocument with
|
|
|
|
* @return null
|
|
|
|
*/
|
|
|
|
function addPages($pageIDs);
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Removes the association between this DMSDocument and a Page. This method does nothing if the association does not exist.
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
|
|
|
* @param $pageObject Page object to remove the association to
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2012-07-16 03:06:35 +02:00
|
|
|
function removePage($pageObject);
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Returns a list of the Page objects associated with this DMSDocument
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
|
|
|
* @return DataList
|
|
|
|
*/
|
2012-07-16 03:06:35 +02:00
|
|
|
function getPages();
|
|
|
|
|
2012-07-17 07:58:33 +02:00
|
|
|
/**
|
|
|
|
* Removes all associated Pages from the DMSDocument
|
|
|
|
* @abstract
|
|
|
|
* @return null
|
|
|
|
*/
|
|
|
|
function removeAllPages();
|
|
|
|
|
2012-07-16 03:06:35 +02:00
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Adds a metadata tag to the DMSDocument. The tag has a category and a value.
|
2012-07-16 05:32:28 +02:00
|
|
|
* Each category can have multiple values by default. So: addTag("fruit","banana") addTag("fruit", "apple") will add two items.
|
|
|
|
* However, if the third parameter $multiValue is set to 'false', then all updates to a category only ever update a single value. So:
|
|
|
|
* addTag("fruit","banana") addTag("fruit", "apple") would result in a single metadata tag: fruit->apple.
|
|
|
|
* Can could be implemented as a key/value store table (although it is more like category/value, because the
|
|
|
|
* same category can occur multiple times)
|
2012-07-16 03:06:35 +02:00
|
|
|
* @abstract
|
2012-07-16 05:32:28 +02:00
|
|
|
* @param $category String of a metadata category to add (required)
|
|
|
|
* @param $value String of a metadata value to add (required)
|
|
|
|
* @param bool $multiValue Boolean that determines if the category is multi-value or single-value (optional)
|
|
|
|
* @return null
|
2012-07-16 03:06:35 +02:00
|
|
|
*/
|
|
|
|
function addTag($category, $value, $multiValue = true);
|
|
|
|
|
2012-07-25 08:56:43 +02:00
|
|
|
/**
|
|
|
|
* Fetches all tags associated with this DMSDocument within a given category. If a value is specified this method
|
|
|
|
* tries to fetch that specific tag.
|
|
|
|
* @abstract
|
|
|
|
* @param $category String of the metadata category to get
|
|
|
|
* @param null $value String of the value of the tag to get
|
|
|
|
* @return array of Strings of all the tags or null if there is no match found
|
|
|
|
*/
|
2012-07-30 02:33:01 +02:00
|
|
|
function getTagsList($category, $value = null);
|
2012-07-25 08:56:43 +02:00
|
|
|
|
2012-07-16 05:32:28 +02:00
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Quick way to add multiple tags to a DMSDocument. This takes a multidimensional array of category/value pairs.
|
2012-07-16 05:32:28 +02:00
|
|
|
* The array should look like this:
|
|
|
|
* $twoDimensionalArray = new array(
|
|
|
|
* array('fruit','banana'),
|
|
|
|
* array('fruit','apple')
|
|
|
|
* );
|
|
|
|
* @abstract
|
|
|
|
* @param $twoDimensionalArray array containing a list of arrays
|
|
|
|
* @param bool $multiValue Boolean that determines if the category is multi-value or single-value (optional)
|
|
|
|
* @return null
|
|
|
|
*/
|
|
|
|
function addTags($twoDimensionalArray, $multiValue = true);
|
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Removes a tag from the DMSDocument. If you only set a category, then all values in that category are deleted.
|
2012-07-16 05:32:28 +02:00
|
|
|
* If you specify both a category and a value, then only that single category/value pair is deleted.
|
|
|
|
* Nothing happens if the category or the value do not exist.
|
|
|
|
* @abstract
|
|
|
|
* @param $category Category to remove (required)
|
|
|
|
* @param null $value Value to remove (optional)
|
|
|
|
* @return null
|
|
|
|
*/
|
|
|
|
function removeTag($category, $value = null);
|
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Deletes all tags associated with this DMSDocument.
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 03:06:35 +02:00
|
|
|
function removeAllTags();
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Returns a multi-dimensional array containing all Tags associated with this DMSDocument. The array has the
|
2012-07-16 05:32:28 +02:00
|
|
|
* following structure:
|
|
|
|
* $twoDimensionalArray = new array(
|
|
|
|
* array('fruit','banana'),
|
|
|
|
* array('fruit','apple')
|
|
|
|
* );
|
|
|
|
* @abstract
|
|
|
|
* @return array Multi-dimensional array of tags
|
|
|
|
*/
|
2012-07-16 03:06:35 +02:00
|
|
|
function getAllTags();
|
|
|
|
|
2012-07-16 05:32:28 +02:00
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Returns a link to download this DMSDocument from the DMS store
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
|
|
|
* @return String
|
|
|
|
*/
|
2012-08-22 23:20:48 +02:00
|
|
|
function getLink();
|
2012-08-01 04:13:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the extension of the file associated with the document
|
|
|
|
*/
|
2012-08-22 23:20:48 +02:00
|
|
|
function getExtension();
|
2012-08-01 04:13:07 +02:00
|
|
|
|
2012-08-01 04:42:31 +02:00
|
|
|
/**
|
2012-08-22 23:20:48 +02:00
|
|
|
* Returns the size of the file type in an appropriate format.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getSize();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the size of the file associated with the document, in bytes.
|
|
|
|
*
|
|
|
|
* @return int
|
2012-08-01 04:42:31 +02:00
|
|
|
*/
|
2012-08-22 23:20:48 +02:00
|
|
|
function getAbsoluteSize();
|
2012-08-01 04:42:31 +02:00
|
|
|
|
2012-07-16 03:06:35 +02:00
|
|
|
|
2012-07-27 01:26:30 +02:00
|
|
|
/**
|
|
|
|
* Takes a File object or a String (path to a file) and copies it into the DMS, replacing the original document file
|
|
|
|
* but keeping the rest of the document unchanged.
|
|
|
|
* @param $file File object, or String that is path to a file to store
|
|
|
|
* @return DMSDocumentInstance Document object that we replaced the file in
|
|
|
|
*/
|
|
|
|
function replaceDocument($file);
|
|
|
|
|
2012-07-16 05:32:28 +02:00
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Hides the DMSDocument, so it does not show up when getByPage($myPage) is called
|
2012-07-16 05:32:28 +02:00
|
|
|
* (without specifying the $showEmbargoed = true parameter). This is similar to expire, except that this method
|
2012-07-16 08:21:48 +02:00
|
|
|
* should be used to hide DMSDocuments that have not yet gone live.
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-08-14 07:26:26 +02:00
|
|
|
function embargoIndefinitely();
|
2012-08-13 04:14:31 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if this is DMSDocument is embargoed or expired.
|
|
|
|
* @abstract
|
|
|
|
* @return bool True or False depending on whether this DMSDocument is embargoed or expired
|
|
|
|
*/
|
|
|
|
function isHidden();
|
|
|
|
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Returns if this is DMSDocument is embargoed.
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
2012-07-16 08:21:48 +02:00
|
|
|
* @return bool True or False depending on whether this DMSDocument is embargoed
|
2012-07-16 05:32:28 +02:00
|
|
|
*/
|
|
|
|
function isEmbargoed();
|
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Hides the DMSDocument, so it does not show up when getByPage($myPage) is called. Automatically un-hides the
|
|
|
|
* DMSDocument at a specific date.
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
2012-07-16 08:21:48 +02:00
|
|
|
* @param $datetime String date time value when this DMSDocument should expire
|
2012-07-16 05:32:28 +02:00
|
|
|
* @return null
|
|
|
|
*/
|
|
|
|
function embargoUntilDate($datetime);
|
|
|
|
|
|
|
|
/**
|
2012-08-13 04:14:31 +02:00
|
|
|
* Hides the document until any page it is linked to is published
|
2012-07-16 05:32:28 +02:00
|
|
|
* @return null
|
|
|
|
*/
|
2012-08-13 04:14:31 +02:00
|
|
|
function embargoUntilPublished();
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
2012-08-13 04:14:31 +02:00
|
|
|
* Clears any previously set embargos, so the DMSDocument always shows up in all queries.
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-08-13 04:14:31 +02:00
|
|
|
function clearEmbargo();
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Returns if this is DMSDocument is expired.
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
2012-07-16 08:21:48 +02:00
|
|
|
* @return bool True or False depending on whether this DMSDocument is expired
|
2012-07-16 05:32:28 +02:00
|
|
|
*/
|
|
|
|
function isExpired();
|
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Hides the DMSDocument at a specific date, so it does not show up when getByPage($myPage) is called.
|
2012-07-16 05:32:28 +02:00
|
|
|
* @abstract
|
2012-07-16 08:21:48 +02:00
|
|
|
* @param $datetime String date time value when this DMSDocument should expire
|
2012-07-16 05:32:28 +02:00
|
|
|
* @return null
|
|
|
|
*/
|
|
|
|
function expireAtDate($datetime);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears any previously set expiry.
|
|
|
|
* @abstract
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 03:06:35 +02:00
|
|
|
function clearExpiry();
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/*---- FROM HERE ON: optional API features ----*/
|
|
|
|
|
|
|
|
/**
|
2012-07-16 08:21:48 +02:00
|
|
|
* Returns a DataList of all previous Versions of this DMSDocument (check the LastEdited date of each
|
2012-07-16 05:32:28 +02:00
|
|
|
* object to find the correct one)
|
|
|
|
* @abstract
|
2012-07-16 08:21:48 +02:00
|
|
|
* @return DataList List of DMSDocument objects
|
2012-07-16 05:32:28 +02:00
|
|
|
*/
|
|
|
|
function getVersions();
|
|
|
|
|
2012-07-16 03:06:35 +02:00
|
|
|
}
|