2017-05-01 05:54:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class DMSUploadField_ItemHandler extends UploadField_ItemHandler
|
|
|
|
{
|
|
|
|
private static $allowed_actions = array(
|
|
|
|
'delete',
|
|
|
|
'edit',
|
|
|
|
'EditForm',
|
|
|
|
);
|
|
|
|
|
2017-05-02 04:49:41 +02:00
|
|
|
/**
|
|
|
|
* Gets a DMS document by its ID
|
|
|
|
*
|
|
|
|
* @return DMSDocument
|
|
|
|
*/
|
2017-05-01 05:54:48 +02:00
|
|
|
public function getItem()
|
|
|
|
{
|
2017-05-02 04:49:41 +02:00
|
|
|
return DMSDocument::get()->byId($this->itemID);
|
2017-05-01 05:54:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Form
|
|
|
|
*/
|
|
|
|
public function EditForm()
|
|
|
|
{
|
|
|
|
$file = $this->getItem();
|
|
|
|
|
|
|
|
// Get form components
|
|
|
|
$fields = $this->parent->getDMSFileEditFields($file);
|
|
|
|
$actions = $this->parent->getDMSFileEditActions($file);
|
|
|
|
$validator = $this->parent->getDMSFileEditValidator($file);
|
|
|
|
$form = new Form(
|
|
|
|
$this,
|
|
|
|
__FUNCTION__,
|
|
|
|
$fields,
|
|
|
|
$actions,
|
|
|
|
$validator
|
|
|
|
);
|
|
|
|
$form->loadDataFrom($file);
|
|
|
|
|
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
}
|