Attendance and Employee API
This commit is contained in:
@@ -27,6 +27,21 @@ include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
$fieldNameMap = \Classes\BaseService::getInstance()->getFieldNameMappings("Employee");
|
||||
$customFields = \Classes\BaseService::getInstance()->getCustomFields("Employee");
|
||||
|
||||
if (\Classes\SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1") {
|
||||
$user = \Classes\BaseService::getInstance()->getCurrentUser();
|
||||
if (empty($user)) {
|
||||
return;
|
||||
}
|
||||
$dbUser = new \Users\Common\Model\User();
|
||||
$dbUser->Load("id = ?", array($user->id));
|
||||
$resp = \Classes\RestApiManager::getInstance()->getAccessTokenForUser($dbUser);
|
||||
if ($resp->getStatus() != \Classes\IceResponse::SUCCESS) {
|
||||
\Utils\LogManager::getInstance()->error(
|
||||
"Error occurred while creating REST Api access token for ".$user->username
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript" src="<?=BASE_URL.'js/d3js/d3.js?v='.$jsVersion?>"></script>
|
||||
<script type="text/javascript" src="<?=BASE_URL.'js/d3js/d3.layout.js?v='.$jsVersion?>"></script>
|
||||
@@ -56,6 +71,9 @@ path.link {
|
||||
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
|
||||
<li class="active"><a id="tabEmployee" href="#tabPageEmployee"><?=t('My Details')?></a></li>
|
||||
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph"><?=t('Company')?></a></li>
|
||||
<?php if (\Classes\SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1") { ?>
|
||||
<li><a id="tabApiAccess" href="#tabPageApiAccess"><?=t('Api Access')?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
@@ -70,6 +88,17 @@ path.link {
|
||||
<div class="tab-pane reviewBlock" id="tabPageCompanyGraph" style="overflow-x: scroll;">
|
||||
|
||||
</div>
|
||||
<?php if (\Classes\SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1") { ?>
|
||||
<div class="tab-pane reviewBlock" id="tabPageApiAccess" style="overflow-x: scroll;">
|
||||
<div class="row">
|
||||
<div class="panel panel-default" style="width:97.5%;">
|
||||
<div class="panel-heading"><h4>Api Access Token</h4></div>
|
||||
<div class="panel-body">
|
||||
<?=$resp->getData()?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -79,6 +108,7 @@ modJsList['tabEmployee'] = new EmployeeAdapter('Employee');
|
||||
modJsList['tabEmployee'].setFieldNameMap(<?=json_encode($fieldNameMap)?>);
|
||||
modJsList['tabEmployee'].setCustomFields(<?=json_encode($customFields)?>);
|
||||
modJsList['tabCompanyGraph'] = new CompanyGraphAdapter('CompanyStructure');
|
||||
modJsList['tabApiAccess'] = new ApiAccessAdapter('ApiAccess');
|
||||
|
||||
var modJs = modJsList['tabEmployee'];
|
||||
|
||||
|
||||
@@ -710,3 +710,36 @@ CompanyGraphAdapter.method('fixCyclicParent', function(sourceData) {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Api Access
|
||||
*/
|
||||
|
||||
function ApiAccessAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
ApiAccessAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ApiAccessAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
];
|
||||
});
|
||||
|
||||
ApiAccessAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
ApiAccessAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
];
|
||||
});
|
||||
|
||||
ApiAccessAdapter.method('get', function() {
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user