Merged in qronald/processmaker (pull request #2348)
add method jsonr in get json definitions
This commit is contained in:
@@ -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,23 @@ 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'];
|
||||
|
||||
$Translations = new \Translation;
|
||||
$translationsTable = $Translations->getTranslationEnvironments();
|
||||
$languagesList = array ();
|
||||
|
||||
foreach ($translationsTable as $locale) {
|
||||
$LANG_ID = $locale['LOCALE'];
|
||||
if ($locale['COUNTRY'] != '.') {
|
||||
$LANG_NAME = $locale['LANGUAGE'] . ' (' . (ucwords( strtolower( $locale['COUNTRY'] ) )) . ')';
|
||||
} else {
|
||||
$LANG_NAME = $locale['LANGUAGE'];
|
||||
}
|
||||
$languagesList[$LANG_ID] = $LANG_NAME;
|
||||
}
|
||||
$response['listLanguage'] = $languagesList;
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
347
workflow/engine/src/ProcessMaker/BusinessModel/Light/Tracker.php
Normal file
347
workflow/engine/src/ProcessMaker/BusinessModel/Light/Tracker.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -462,8 +462,11 @@ class Light extends Api
|
||||
|
||||
$response = $process->getDynaForms($prj_uid);
|
||||
$result = $this->parserDataDynaForm($response);
|
||||
\G::LoadClass("pmDynaform");
|
||||
$pmDynaForm = new \pmDynaform();
|
||||
foreach ($result as $k => $form) {
|
||||
$result[$k]['formContent'] = (isset($form['formContent']) && $form['formContent'] != null)?json_decode($form['formContent']):"";
|
||||
$pmDynaForm->jsonr($result[$k]['formContent']);
|
||||
$result[$k]['index'] = $k;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -491,12 +494,15 @@ class Light extends Api
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||
$step = new \ProcessMaker\Services\Api\Project\Activity\Step();
|
||||
\G::LoadClass("pmDynaform");
|
||||
$pmDynaForm = new \pmDynaform();
|
||||
$response = array();
|
||||
for ($i = 0; $i < count($activitySteps); $i++) {
|
||||
if ($activitySteps[$i]['step_type_obj'] == "DYNAFORM") {
|
||||
$dataForm = $dynaForm->getDynaForm($activitySteps[$i]['step_uid_obj']);
|
||||
$result = $this->parserDataDynaForm($dataForm);
|
||||
$result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null)?json_decode($result['formContent']):"";
|
||||
$pmDynaForm->jsonr($result['formContent']);
|
||||
$result['index'] = $i;
|
||||
$result['stepId'] = $activitySteps[$i]["step_uid"];
|
||||
$trigger = $oMobile->statusTriggers($step->doGetActivityStepTriggers($activitySteps[$i]["step_uid"], $act_uid, $prj_uid));
|
||||
@@ -559,6 +565,9 @@ class Light extends Api
|
||||
$response = $dynaForm->getDynaForm($dyn_uid);
|
||||
$result = $this->parserDataDynaForm($response);
|
||||
$result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null)?json_decode($result['formContent']):"";
|
||||
\G::LoadClass("pmDynaform");
|
||||
$pmDynaForm = new \pmDynaform();
|
||||
$pmDynaForm->jsonr($result['formContent']);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -574,11 +583,14 @@ class Light extends Api
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
\G::LoadClass("pmDynaform");
|
||||
$pmDynaForm = new \pmDynaform();
|
||||
$return = array();
|
||||
foreach ($request_data['formId'] as $dyn_uid) {
|
||||
$response = $dynaForm->getDynaForm($dyn_uid);
|
||||
$result = $this->parserDataDynaForm($response);
|
||||
$result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null)?json_decode($result['formContent']):"";
|
||||
$pmDynaForm->jsonr($result['formContent']);
|
||||
$return[] = $result;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -832,7 +844,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)
|
||||
|
||||
143
workflow/engine/src/ProcessMaker/Services/Api/Light/Tracker.php
Normal file
143
workflow/engine/src/ProcessMaker/Services/Api/Light/Tracker.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user