Merged in qronald/processmaker/HOR-886 (pull request #4167)

HOR-886
This commit is contained in:
Julio Cesar Laura Avendaño
2016-04-28 16:58:08 -04:00
2 changed files with 28 additions and 2 deletions

View File

@@ -1268,7 +1268,8 @@ class Light
$multiTimeZone = (int)($sysConf['system_utc_time_zone']) == 1;
}
/*----------------------------------********---------------------------------*/
$offset = timezone_offset_get( new \DateTimeZone( $sysConf['time_zone'] ), new \DateTime() );
$tz = isset($_SESSION['USR_TIME_ZONE'])?$_SESSION['USR_TIME_ZONE']:$sysConf['time_zone'];
$offset = timezone_offset_get( new \DateTimeZone( $tz ), new \DateTime() );
$response['timeZone'] = sprintf( "GMT%s%02d:%02d", ( $offset >= 0 ) ? '+' : '-', abs( $offset / 3600 ), abs( ($offset % 3600) / 60 ) );
$response['multiTimeZone'] = $multiTimeZone;
$fields = \System::getSysInfo();
@@ -1306,9 +1307,12 @@ class Light
$languagesList[] = $languages;
}
$response['listLanguage'] = $languagesList;
if ($params['fileLimit']) {
if (isset($params['fileLimit']) && $params['fileLimit']) {
$response['fileLimit'] = $this->return_bytes(ini_get('post_max_size'));
}
if (isset($params['tz']) && $params['tz']) {
$response['tz'] = isset($_SESSION['USR_TIME_ZONE'])?$_SESSION['USR_TIME_ZONE']:$sysConf['time_zone'];
}
return $response;
}

View File

@@ -1533,4 +1533,26 @@ class Light extends Api
}
return $response;
}
/**
* Get configuration ProcessMaker
*
* @return array
*
* @url GET /config-user
*
* @param string $fileLimit {@from path}
* @param string $tz {@from path}
*/
public function getConfigurationUser($fileLimit = false, $tz = false)
{
try {
$params = array('fileLimit' => $fileLimit, 'tz' => $tz);
$oMobile = new \ProcessMaker\BusinessModel\Light();
$response = $oMobile->getConfiguration($params);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
}