add endpoints for get information in status paused and participated

This commit is contained in:
Ronald Quenta
2015-03-03 10:50:51 -04:00
parent 593c5784ed
commit 77fd5e7f83
2 changed files with 92 additions and 0 deletions

View File

@@ -592,4 +592,78 @@ class Light
return $response;
}
/**
* Get information for status paused and participated or other status
*
* @param $userUid
* @param $type
* @param $app_uid
* @throws \Exception
*/
public function getInformation($userUid, $type, $app_uid)
{
switch ($type) {
case 'paused':
case 'participated':
$oCase = new \Cases();
$iDelIndex = $oCase->getCurrentDelegationCase( $app_uid );
$aFields = $oCase->loadCase( $app_uid, $iDelIndex );
$this->getInfoResume($userUid, $aFields, $type);
break;
}
}
/**
* view in html response for status
*
* @param $userUid
* @param $Fields
* @param $type
* @throws \Exception
*/
public function getInfoResume($userUid, $Fields, $type)
{
//print_r($Fields);die;
/* Includes */
G::LoadClass( 'case' );
/* Prepare page before to show */
//$oCase = new \Cases();
// $participated = $oCase->userParticipatedInCase( $Fields['APP_UID'], $userUid );
// if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $participated == 0) {
// /*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') {
// $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE');
// }*/
// $aMessage['MESSAGE'] = G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' );
// $G_PUBLISH = new Publisher();
// $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
// G::RenderPage( 'publishBlank', 'blank' );
// die();
// }
$objProc = new \Process();
$aProc = $objProc->load( $Fields['PRO_UID'] );
$Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
$objTask = new \Task();
if (isset($_SESSION['ACTION']) && ($_SESSION['ACTION'] == 'jump')) {
$task = explode('-', $Fields['TAS_UID']);
$Fields['TAS_TITLE'] = '';
for( $i = 0; $i < sizeof($task)-1; $i ++ ) {
$aTask = $objTask->load( $task[$i] );
$Fields['TAS_TITLE'][] = $aTask['TAS_TITLE'];
}
$Fields['TAS_TITLE'] = implode(" - ", array_values($Fields['TAS_TITLE']));
} else {
$aTask = $objTask->load( $Fields['TAS_UID'] );
$Fields['TAS_TITLE'] = $aTask['TAS_TITLE'];
}
require_once(PATH_GULLIVER .'../thirdparty/smarty/libs/Smarty.class.php');
$G_PUBLISH = new \Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Resume.xml', '', $Fields, '' );
$G_PUBLISH->RenderContent();
}
}

View File

@@ -713,4 +713,22 @@ class Light extends Api
}
return $files;
}
/**
* @url GET /:type/case/:app_uid
*
* @param $access
* @param $refresh
* @return mixed
*/
public function getInformation($type, $app_uid)
{
try {
$userUid = $this->getUserId();
$oMobile = new \ProcessMaker\BusinessModel\Light();
$oMobile->getInformation($userUid, $type, $app_uid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}