2012-07-16 03:06:35 +02:00
|
|
|
<?php
|
2012-07-16 08:21:48 +02:00
|
|
|
class DMSDocument extends DataObject implements DMSDocumentInterface {
|
2012-07-16 03:06:35 +02:00
|
|
|
|
2012-07-16 08:21:48 +02:00
|
|
|
static $db = array(
|
|
|
|
"Filename" => "Text",
|
|
|
|
);
|
2012-07-16 03:06:35 +02:00
|
|
|
|
2012-07-16 21:34:52 +02:00
|
|
|
function delete() {
|
|
|
|
parent::delete();
|
|
|
|
}
|
|
|
|
|
2012-07-16 03:06:35 +02:00
|
|
|
/**
|
2012-07-16 05:32:28 +02:00
|
|
|
* Associates this document with a Page. This method does nothing if the association already exists.
|
|
|
|
* This could be a simple wrapper around $myDoc->Pages()->add($myPage) to add a has_many relation
|
|
|
|
* @param $pageObject Page object to associate this Document with
|
|
|
|
* @return null
|
2012-07-16 03:06:35 +02:00
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function addPage($pageObject) {
|
|
|
|
// TODO: Implement addPage() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the association between this Document and a Page. This method does nothing if the association does not exist.
|
|
|
|
* @param $pageObject Page object to remove the association to
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function removePage($pageObject) {
|
|
|
|
// TODO: Implement removePage() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a list of the Page objects associated with this Document
|
|
|
|
* @return DataList
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function getPages() {
|
|
|
|
// TODO: Implement getPages() method.
|
|
|
|
}
|
2012-07-16 03:06:35 +02:00
|
|
|
|
|
|
|
/**
|
2012-07-16 05:32:28 +02:00
|
|
|
* Adds a metadata tag to the Document. The tag has a category and a value.
|
|
|
|
* 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)
|
|
|
|
* @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
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function addTag($category, $value, $multiValue = true) {
|
|
|
|
// TODO: Implement addTag() method.
|
|
|
|
}
|
2012-07-16 03:06:35 +02:00
|
|
|
|
2012-07-16 05:32:28 +02:00
|
|
|
/**
|
|
|
|
* Quick way to add multiple tags to a Document. This takes a multidimensional array of category/value pairs.
|
|
|
|
* The array should look like this:
|
|
|
|
* $twoDimensionalArray = new array(
|
|
|
|
* array('fruit','banana'),
|
|
|
|
* array('fruit','apple')
|
|
|
|
* );
|
|
|
|
* @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
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function addTags($twoDimensionalArray, $multiValue = true) {
|
|
|
|
// TODO: Implement addTags() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes a tag from the Document. If you only set a category, then all values in that category are deleted.
|
|
|
|
* 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.
|
|
|
|
* @param $category Category to remove (required)
|
|
|
|
* @param null $value Value to remove (optional)
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function removeTag($category, $value = null) {
|
|
|
|
// TODO: Implement removeTag() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Deletes all tags associated with this Document.
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function removeAllTags() {
|
|
|
|
// TODO: Implement removeAllTags() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a multi-dimensional array containing all Tags associated with this Document. The array has the
|
|
|
|
* following structure:
|
|
|
|
* $twoDimensionalArray = new array(
|
2012-07-16 08:21:48 +02:00
|
|
|
* array('fruit','banana'),
|
|
|
|
* array('fruit','apple')
|
|
|
|
* );
|
2012-07-16 05:32:28 +02:00
|
|
|
* @return array Multi-dimensional array of tags
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function getAllTags() {
|
|
|
|
// TODO: Implement getAllTags() method.
|
|
|
|
}
|
2012-07-16 03:06:35 +02:00
|
|
|
|
2012-07-16 05:32:28 +02:00
|
|
|
/**
|
|
|
|
* Returns a link to download this document from the DMS store
|
|
|
|
* @return String
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function downloadLink() {
|
|
|
|
// TODO: Implement downloadLink() method.
|
|
|
|
}
|
2012-07-16 03:06:35 +02:00
|
|
|
|
2012-07-16 05:32:28 +02:00
|
|
|
/**
|
|
|
|
* Hides the document, so it does not show up when getByPage($myPage) is called
|
|
|
|
* (without specifying the $showEmbargoed = true parameter). This is similar to expire, except that this method
|
|
|
|
* should be used to hide documents that have not yet gone live.
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function embargo() {
|
|
|
|
// TODO: Implement embargo() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if this is Document is embargoed.
|
|
|
|
* @return bool True or False depending on whether this document is embargoed
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function isEmbargoed() {
|
|
|
|
// TODO: Implement isEmbargoed() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides the document, so it does not show up when getByPage($myPage) is called. Automatically un-hides the
|
|
|
|
* Document at a specific date.
|
|
|
|
* @param $datetime String date time value when this Document should expire
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function embargoUntilDate($datetime) {
|
|
|
|
// TODO: Implement embargoUntilDate() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears any previously set embargos, so the Document always shows up in all queries.
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function clearEmbargo() {
|
|
|
|
// TODO: Implement clearEmbargo() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides the document, so it does not show up when getByPage($myPage) is called.
|
|
|
|
* (without specifying the $showEmbargoed = true parameter). This is similar to embargo, except that it should be
|
|
|
|
* used to hide documents that are no longer useful.
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function expire() {
|
|
|
|
// TODO: Implement expire() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if this is Document is expired.
|
|
|
|
* @return bool True or False depending on whether this document is expired
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function isExpired() {
|
|
|
|
// TODO: Implement isExpired() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides the document at a specific date, so it does not show up when getByPage($myPage) is called.
|
|
|
|
* @param $datetime String date time value when this Document should expire
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function expireAtDate($datetime) {
|
|
|
|
// TODO: Implement expireAtDate() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears any previously set expiry.
|
|
|
|
* @return null
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function clearExpiry() {
|
|
|
|
// TODO: Implement clearExpiry() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a DataList of all previous Versions of this document (check the LastEdited date of each
|
|
|
|
* object to find the correct one)
|
|
|
|
* @return DataList List of Document objects
|
|
|
|
*/
|
2012-07-16 08:21:48 +02:00
|
|
|
function getVersions() {
|
|
|
|
// TODO: Implement getVersions() method.
|
|
|
|
}
|
2012-07-16 05:32:28 +02:00
|
|
|
|
2012-07-16 03:06:35 +02:00
|
|
|
}
|