Files
luos/workflow/engine/services/rest/crud/OutputDocument.php
Erik Amaru Ortiz ce21ee6454 PM Rest Feature: added plugins support & more improvements
from a plugin a rest class can be registered now:

on setup method add the following:
---
$this->registerRestService('Sample', [optional string: $path]);
--

and create the folder   PATH_PLUGIN . /your_plugin/classes/rest

next add a class with the flowing characteristics:

<?php

class Plugin_Services_Rest_Sample
{
    public function get()
    {
        return 'hello world';
    }
}

A class prefixed with Plugin_Services_Rest_
and add the corresponding methods for a Restler api
(http://luracast.com/products/restler/)

Finally on process maker will be exposed as:

via GET: http://127.0.0.1/rest/workflow/sample
2012-08-23 13:01:19 -04:00

59 lines
2.7 KiB
PHP

<?php
class Services_Rest_OutputDocument
{
/**
* Implementation for 'GET' method for Rest API
*
* @param mixed $outDocUid Primary key
*
* @return array $result Returns array within multiple records or a single record depending if
* a single selection was requested passing id(s) as param
*/
protected function get($outDocUid=null)
{
$result = array();
try {
if (func_num_args() == 0) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_UID);
$criteria->addSelectColumn(OutputDocumentPeer::PRO_UID);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_LANDSCAPE);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_MEDIA);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_LEFT_MARGIN);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_TOP_MARGIN);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_GENERATE);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_TYPE);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_CURRENT_REVISION);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_FIELD_MAPPING);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_VERSIONING);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_DESTINATION_PATH);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_TAGS);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD);
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS);
$dataset = AppEventPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dataset->next()) {
$result[] = $dataset->getRow();
}
} else {
$record = OutputDocumentPeer::retrieveByPK($outDocUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
}
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}
}