2014-03-14 15:33:35 -04:00
|
|
|
<?php
|
|
|
|
|
namespace Services\Api\ProcessMaker;
|
|
|
|
|
|
|
|
|
|
use \ProcessMaker\Services\Api;
|
|
|
|
|
use \Luracast\Restler\RestException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Cases Api Controller
|
|
|
|
|
*
|
|
|
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
|
|
|
* @copyright Colosa - Bolivia
|
|
|
|
|
*
|
|
|
|
|
* @protected
|
|
|
|
|
*/
|
|
|
|
|
class Cases extends Api
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Get list Cases To Do
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
* @param array $request_data , Data for list
|
|
|
|
|
* @return array
|
|
|
|
|
*
|
|
|
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
|
|
|
* @copyright Colosa - Bolivia
|
|
|
|
|
*
|
|
|
|
|
* @url GET
|
|
|
|
|
*/
|
|
|
|
|
public function doGetCasesListToDo($request_data = array())
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$request_data['action'] = 'todo';
|
|
|
|
|
$request_data['userId'] = $this->getUserId();
|
|
|
|
|
$oCases = new \BusinessModel\Cases();
|
|
|
|
|
$response = $oCases->getList($request_data);
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get list Cases Draft
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
* @param array $request_data , Data for list
|
|
|
|
|
* @return array
|
|
|
|
|
*
|
|
|
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
|
|
|
* @copyright Colosa - Bolivia
|
|
|
|
|
*
|
|
|
|
|
* @url GET /draft
|
|
|
|
|
*/
|
|
|
|
|
public function doGetCasesListDraft($request_data = array())
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$request_data['action'] = 'draft';
|
|
|
|
|
$request_data['userId'] = $this->getUserId();
|
|
|
|
|
$oCases = new \BusinessModel\Cases();
|
|
|
|
|
$response = $oCases->getList($request_data);
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get list Cases Participated
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
* @param array $request_data , Data for list
|
|
|
|
|
* @return array
|
|
|
|
|
*
|
|
|
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
|
|
|
* @copyright Colosa - Bolivia
|
|
|
|
|
*
|
2014-03-14 15:38:03 -04:00
|
|
|
* @url GET /participated
|
2014-03-14 15:33:35 -04:00
|
|
|
*/
|
|
|
|
|
public function doGetCasesListParticipated($request_data = array())
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$request_data['action'] = 'sent';
|
|
|
|
|
$request_data['userId'] = $this->getUserId();
|
|
|
|
|
$oCases = new \BusinessModel\Cases();
|
|
|
|
|
$response = $oCases->getList($request_data);
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get list Cases Unassigned
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
* @param array $request_data , Data for list
|
|
|
|
|
* @return array
|
|
|
|
|
*
|
|
|
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
|
|
|
* @copyright Colosa - Bolivia
|
|
|
|
|
*
|
2014-03-14 15:38:03 -04:00
|
|
|
* @url GET /unassigned
|
2014-03-14 15:33:35 -04:00
|
|
|
*/
|
|
|
|
|
public function doGetCasesListUnassigned($request_data = array())
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$request_data['action'] = 'unassigned';
|
|
|
|
|
$request_data['userId'] = $this->getUserId();
|
|
|
|
|
$oCases = new \BusinessModel\Cases();
|
|
|
|
|
$response = $oCases->getList($request_data);
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get list Cases Paused
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
* @param array $request_data , Data for list
|
|
|
|
|
* @return array
|
|
|
|
|
*
|
|
|
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
|
|
|
* @copyright Colosa - Bolivia
|
|
|
|
|
*
|
2014-03-14 15:38:03 -04:00
|
|
|
* @url GET /paused
|
2014-03-14 15:33:35 -04:00
|
|
|
*/
|
|
|
|
|
public function doGetCasesListPaused($request_data = array())
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$request_data['action'] = 'paused';
|
|
|
|
|
$request_data['userId'] = $this->getUserId();
|
|
|
|
|
$oCases = new \BusinessModel\Cases();
|
|
|
|
|
$response = $oCases->getList($request_data);
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get list Cases Advanced Search
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
* @param array $request_data , Data for list
|
|
|
|
|
* @return array
|
|
|
|
|
*
|
|
|
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
|
|
|
* @copyright Colosa - Bolivia
|
|
|
|
|
*
|
2014-03-14 15:38:03 -04:00
|
|
|
* @url GET /advanced-search
|
2014-03-14 15:33:35 -04:00
|
|
|
*/
|
|
|
|
|
public function doGetCasesListAdvancedSearch($request_data = array())
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$request_data['action'] = 'search';
|
|
|
|
|
$request_data['userId'] = $this->getUserId();
|
|
|
|
|
$oCases = new \BusinessModel\Cases();
|
|
|
|
|
$response = $oCases->getList($request_data);
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|