add endpoints for case trackers

This commit is contained in:
Ronald Quenta
2015-05-29 17:31:08 -04:00
parent 1de425eb77
commit 32dca0a41e
5 changed files with 513 additions and 1 deletions

View File

@@ -90,6 +90,11 @@ class Light
return $response;
}
/**
* Get status trigger case
* @param $triggers
* @return array
*/
public function statusTriggers($triggers)
{
$return = array("before" => false, "after"=> false);
@@ -1061,6 +1066,8 @@ class Light
$sysConf = \System::getSystemConfiguration( PATH_CONFIG . 'env.ini' );
$offset = timezone_offset_get( new \DateTimeZone( $sysConf['time_zone'] ), new \DateTime() );
$response['timeZone'] = sprintf( "GMT%s%02d:%02d", ( $offset >= 0 ) ? '+' : '-', abs( $offset / 3600 ), abs( ($offset % 3600) / 60 ) );
$fields = \System::getSysInfo();
$response['version'] = $fields['PM_VERSION'];
return $response;
}

File diff suppressed because it is too large Load Diff

View File

@@ -832,7 +832,7 @@ class Light extends Api
/**
* @url POST /case/:app_uid/claim
*
* @param $app_uid
* @param $app_uid {@min 1}{@max 32}
* @return mixed
*/
public function claimCaseUser($app_uid)

View File

@@ -0,0 +1,150 @@
<?php
/**
* Created by PhpStorm.
* Dev: Ronald Quenta
* E-mail: ronald.otn@gmail.com
* Date: 8/05/15
* Time: 17:10
*/
namespace ProcessMaker\Services\Api\Light;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
*
* Process Api Controller
*
* @protected
*/
class Tracker extends Api
{
/**
* @return array
* @access public
* @url GET /case/:case/tracker/:pin
*/
public function Authentication($case, $pin)
{
try {
$oMobile = new \ProcessMaker\BusinessModel\Light\Tracker();
$response = $oMobile->authentication($case, $pin);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @return array
* @access public
* @url GET /process/:pro_uid/case/:app_uid/tracker-history
*/
public function history($pro_uid, $app_uid)
{
try {
$oMobile = new \ProcessMaker\BusinessModel\Light\Tracker();
if (!$oMobile->permissions($pro_uid, "history"))
{
throw (new \Exception(\G::LoadTranslation('ID_ACCOUNT_DISABLED_CONTACT_ADMIN')));
}
$response = $oMobile->history($pro_uid, $app_uid);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @return array
* @access public
*
* @param string $pro_uid {@min 1}{@max 32}
* @param string $app_uid {@min 1}{@max 32}
*
* @url GET /process/:pro_uid/case/:app_uid/tracker-messages
*/
public function getMessages($pro_uid, $app_uid)
{
try {
$oMobile = new \ProcessMaker\BusinessModel\Light\Tracker();
if (!$oMobile->permissions($pro_uid, "messages"))
{
throw (new \Exception(\G::LoadTranslation('ID_ACCOUNT_DISABLED_CONTACT_ADMIN')));
}
$response = $oMobile->messages($pro_uid, $app_uid);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @return array
* @access public
*
* @param string $msg_uid {@min 1}{@max 32}
* @param string $app_uid {@min 1}{@max 32}
*
* @url GET /process/case/:app_uid/message/:msg_uid/view
*/
public function getViewMessages($app_uid, $msg_uid)
{
try {
$oMobile = new \ProcessMaker\BusinessModel\Light\Tracker();
$Fields = \Cases::getHistoryMessagesTrackerView( $app_uid, $msg_uid );
$response = $oMobile->parserMessages($Fields);
//$response = $oMobile->messages($pro_uid, $app_uid);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @return array
* @access public
*
* @param string $pro_uid {@min 1}{@max 32}
* @param string $app_uid {@min 1}{@max 32}
*
* @url GET /process/:pro_uid/case/:app_uid/tracker-docs
*/
public function getObjects($pro_uid, $app_uid)
{
try {
$oMobile = new \ProcessMaker\BusinessModel\Light\Tracker();
if (!$oMobile->permissions($pro_uid, "objects"))
{
throw (new \Exception(\G::LoadTranslation('ID_ACCOUNT_DISABLED_CONTACT_ADMIN')));
}
$response = $oMobile->objects($pro_uid, $app_uid);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @return array
* @access public
*
* @param string $pro_uid {@min 1}{@max 32}
* @param string $app_uid {@min 1}{@max 32}
* @param string $obj_uid {@min 1}{@max 32}
* @param string $type
*
* @url GET /process/:pro_uid/case/:app_uid/object/:obj_uid/:type/show
*/
public function getShowObjects($pro_uid, $app_uid, $obj_uid, $type)
{
try {
$oMobile = new \ProcessMaker\BusinessModel\Light\Tracker();
$response = $oMobile->showObjects($pro_uid, $app_uid, $obj_uid, $type);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
}

View File

@@ -100,6 +100,7 @@ debug = 1
[alias: light]
light = "ProcessMaker\Services\Api\Light"
tracker = "ProcessMaker\Services\Api\Light\Tracker"
[alias: consolidated]
list = "ProcessMaker\Services\Api\Consolidated"