2013-12-13 16:36:03 -04:00
|
|
|
<?php
|
|
|
|
|
namespace Services\Api\ProcessMaker\Project;
|
|
|
|
|
|
|
|
|
|
use \ProcessMaker\Services\Api;
|
|
|
|
|
use \Luracast\Restler\RestException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Project\OutputDocuments Api Controller
|
|
|
|
|
*
|
|
|
|
|
* @protected
|
|
|
|
|
*/
|
|
|
|
|
class OutputDocuments extends Api
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
|
|
|
*
|
|
|
|
|
* @url GET /:prjUid/output-documents
|
|
|
|
|
*/
|
|
|
|
|
public function doGetProjectOutputDocuments($prjUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$outputDocument = new \BusinessModel\OutputDocument();
|
|
|
|
|
$arrayData = $outputDocument->getOutputDocuments($prjUid);
|
|
|
|
|
//Response
|
|
|
|
|
$response = $arrayData;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
//response
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
|
|
|
* @param string $outputDocumentUid {@min 32} {@max 32}
|
|
|
|
|
*
|
|
|
|
|
* @url GET /:prjUid/output-document/:outputDocumentUid
|
|
|
|
|
*/
|
|
|
|
|
public function doGetProjectOutputDocument($prjUid, $outputDocumentUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$outputDocument = new \BusinessModel\OutputDocument();
|
|
|
|
|
$arrayData = $outputDocument->getOutputDocument($prjUid, $outputDocumentUid);
|
|
|
|
|
//Response
|
|
|
|
|
$response = $arrayData;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
//response
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url POST /:prjUid/output-document
|
|
|
|
|
*
|
|
|
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
|
|
|
* @param OutputDocumentStructure $request_data
|
|
|
|
|
*
|
|
|
|
|
* @status 201
|
|
|
|
|
*/
|
|
|
|
|
public function doPostProjectOutputDocument($prjUid, OutputDocumentStructure $request_data = null)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$request_data = (array)($request_data);
|
|
|
|
|
$outputDocument = new \BusinessModel\OutputDocument();
|
|
|
|
|
$arrayData = $outputDocument->addOutputDocument($prjUid, $request_data);
|
|
|
|
|
//Response
|
|
|
|
|
$response = $arrayData;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
//response
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url PUT /:prjUid/output-document/:outputDocumentUid
|
|
|
|
|
*
|
|
|
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
|
|
|
* @param string $outputDocumentUid {@min 32} {@max 32}
|
2014-01-25 06:27:56 -04:00
|
|
|
* @param OutputDocumentStructure $request_data
|
2013-12-13 16:36:03 -04:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function doPutProjectOutputDocument($prjUid, $outputDocumentUid, OutputDocumentStructure $request_data)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$request_data = (array)($request_data);
|
|
|
|
|
$outputDocument = new \BusinessModel\OutputDocument();
|
2014-01-29 13:09:08 -04:00
|
|
|
$arrayData = $outputDocument->updateOutputDocument($prjUid, $request_data, $outputDocumentUid);
|
2013-12-13 16:36:03 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
//response
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
2014-02-07 15:33:58 -04:00
|
|
|
}
|
2013-12-13 16:36:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url DELETE /:prjUid/output-document/:outputDocumentUid
|
|
|
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
|
|
|
* @param string $outputDocumentUid {@min 32} {@max 32}
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function doDeleteProjectOutputDocument($prjUid, $outputDocumentUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$outputDocument = new \BusinessModel\OutputDocument();
|
|
|
|
|
$arrayData = $outputDocument->deleteOutputDocument($prjUid, $outputDocumentUid);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
//response
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class OutputDocumentStructure
|
2014-01-25 06:27:56 -04:00
|
|
|
{
|
2014-01-25 06:10:24 -04:00
|
|
|
/**
|
2013-12-13 16:36:03 -04:00
|
|
|
* @var string {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_title;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_description;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_filename;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_template;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-12-16 14:32:38 -04:00
|
|
|
* @var string {@from body} {@choice TCPDF,HTML2PDF}
|
2013-12-13 16:36:03 -04:00
|
|
|
*/
|
|
|
|
|
public $out_doc_report_generator;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-12-16 14:32:38 -04:00
|
|
|
* @var int {@from body} {@choice 0,1}
|
2013-12-13 16:36:03 -04:00
|
|
|
*/
|
|
|
|
|
public $out_doc_landscape;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string {@from body} {@min 0} {@max 10}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_media;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var int {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_left_margin;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var int {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_right_margin;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var int {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_top_margin;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var int {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_bottom_margin;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-12-16 14:32:38 -04:00
|
|
|
* @var string {@from body} {@choice PDF,DOC,BOTH}
|
2013-12-13 16:36:03 -04:00
|
|
|
*/
|
|
|
|
|
public $out_doc_generate;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string {@from body} {@min 0} {@max 32}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_type;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var int {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_current_revision;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_field_mapping;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var int {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_versioning;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_destination_path;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string {@from body}
|
|
|
|
|
*/
|
|
|
|
|
public $out_doc_tags;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-12-16 14:32:38 -04:00
|
|
|
* @var int {@from body} {@choice 0,1}
|
2013-12-13 16:36:03 -04:00
|
|
|
*/
|
|
|
|
|
public $out_doc_pdf_security_enabled;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-12-16 14:32:38 -04:00
|
|
|
* @var string {@from body} {@min 0} {@max 32}
|
2013-12-13 16:36:03 -04:00
|
|
|
*/
|
|
|
|
|
public $out_doc_pdf_security_open_password;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-12-16 14:32:38 -04:00
|
|
|
* @var string {@from body} {@min 0} {@max 32}
|
2013-12-13 16:36:03 -04:00
|
|
|
*/
|
|
|
|
|
public $out_doc_pdf_security_owner_password;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-12-16 14:32:38 -04:00
|
|
|
* @var string {@from body} {@min 0} {@max 150}
|
2013-12-13 16:36:03 -04:00
|
|
|
*/
|
2013-12-16 14:32:38 -04:00
|
|
|
public $out_doc_pdf_security_permissions;
|
2013-12-13 16:36:03 -04:00
|
|
|
}
|
2014-01-25 06:10:24 -04:00
|
|
|
|