2013-11-28 16:37:24 -04:00
|
|
|
<?php
|
2013-12-02 12:47:58 -04:00
|
|
|
namespace Services\Api\ProcessMaker\Project;
|
2013-11-28 16:37:24 -04:00
|
|
|
|
2013-12-03 17:10:18 -04:00
|
|
|
use \ProcessMaker\Services\Api;
|
2013-11-28 16:37:24 -04:00
|
|
|
use \Luracast\Restler\RestException;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-12-02 12:47:58 -04:00
|
|
|
* Project\Activity Api Controller
|
2013-11-28 16:37:24 -04:00
|
|
|
*
|
|
|
|
|
* @protected
|
|
|
|
|
*/
|
2013-12-02 12:47:58 -04:00
|
|
|
class Activity extends Api
|
2013-11-28 16:37:24 -04:00
|
|
|
{
|
2013-12-02 16:49:28 -04:00
|
|
|
/**
|
2013-12-06 09:14:55 -04:00
|
|
|
* @param string $projectUid
|
|
|
|
|
* @param string $activityUid
|
|
|
|
|
* @param string $filter {@choice definition,,properties}
|
2013-11-28 16:37:24 -04:00
|
|
|
* @url GET /:projectUid/activity/:activityUid
|
|
|
|
|
*/
|
|
|
|
|
public function doGetProjectActivity($projectUid, $activityUid, $filter = '')
|
|
|
|
|
{
|
|
|
|
|
try {
|
2013-12-02 15:29:36 -04:00
|
|
|
$hiddenFields = array('pro_uid', 'tas_uid', 'tas_delay_type', 'tas_temporizer', 'tas_alert',
|
|
|
|
|
'tas_mi_instance_variable', 'tas_mi_complete_variable', 'tas_assign_location',
|
|
|
|
|
'tas_assign_location_adhoc', 'tas_last_assigned', 'tas_user', 'tas_can_upload', 'tas_view_upload',
|
|
|
|
|
'tas_view_additional_documentation', 'tas_can_cancel', 'tas_owner_app', 'tas_can_pause',
|
|
|
|
|
'tas_can_send_message', 'tas_can_delete_docs', 'tas_self_service', 'tas_to_last_user',
|
|
|
|
|
'tas_derivation', 'tas_posx', 'tas_posy', 'tas_width', 'tas_height', 'tas_color', 'tas_evn_uid',
|
|
|
|
|
'tas_boundary', 'tas_def_proc_code', 'stg_uid'
|
|
|
|
|
);
|
2013-11-28 16:37:24 -04:00
|
|
|
$definition = array();
|
|
|
|
|
$properties = array();
|
|
|
|
|
|
|
|
|
|
if ($filter == '' || $filter == 'definition') {
|
|
|
|
|
// DEFINITION
|
|
|
|
|
$definition = array();
|
2013-12-02 14:54:34 -04:00
|
|
|
$response['definition'] = $definition;
|
2013-11-28 16:37:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($filter == '' || $filter == 'properties') {
|
|
|
|
|
// PROPERTIES
|
|
|
|
|
$task = new \BusinessModel\Task();
|
|
|
|
|
$properties = $task->getProperties($activityUid, true, false);
|
2013-12-02 14:25:20 -04:00
|
|
|
foreach ($properties as $key => $value) {
|
|
|
|
|
if (in_array($key, $hiddenFields)) {
|
|
|
|
|
unset($properties[$key]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-02 14:54:34 -04:00
|
|
|
$response['properties'] = $properties;
|
2013-11-28 16:37:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
2013-12-02 12:56:13 -04:00
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
2013-11-28 16:37:24 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-02 16:49:28 -04:00
|
|
|
/**
|
2013-11-28 16:37:24 -04:00
|
|
|
* @url PUT /:projectUid/activity/:activityUid
|
|
|
|
|
*/
|
|
|
|
|
public function doPutProjectActivity($projectUid, $activityUid, $request_data = array())
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$task = new \BusinessModel\Task();
|
|
|
|
|
$properties = $task->updateProperties($activityUid, $projectUid, $request_data);
|
|
|
|
|
} catch (\Exception $e) {
|
2013-12-02 12:56:13 -04:00
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
2013-11-28 16:37:24 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-02 16:49:28 -04:00
|
|
|
/**
|
2013-11-28 16:37:24 -04:00
|
|
|
* @url DELETE /:projectUid/activity/:activityUid
|
|
|
|
|
*/
|
|
|
|
|
public function doDeleteProjectActivity($projectUid, $activityUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$task = new \BusinessModel\Task();
|
|
|
|
|
$task->deleteTask($activityUid);
|
|
|
|
|
} catch (\Exception $e) {
|
2013-12-02 12:56:13 -04:00
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
2013-11-28 16:37:24 -04:00
|
|
|
}
|
|
|
|
|
}
|
2013-12-02 16:49:28 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url GET /:projectUid/activity/:activityUid/steps
|
|
|
|
|
*/
|
|
|
|
|
public function doGetActivitySteps($activityUid, $projectUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$task = new \BusinessModel\Task();
|
|
|
|
|
|
|
|
|
|
$response = $task->getSteps($activityUid);
|
|
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url GET /:projectUid/activity/:activityUid/available-steps
|
|
|
|
|
*/
|
|
|
|
|
public function doGetActivityAvailableSteps($activityUid, $projectUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$task = new \BusinessModel\Task();
|
|
|
|
|
|
|
|
|
|
$response = $task->getAvailableSteps($activityUid, $projectUid);
|
|
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-11-28 16:37:24 -04:00
|
|
|
}
|
|
|
|
|
|