IceHrm v18.0
This commit is contained in:
@@ -24,13 +24,57 @@ Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilin
|
||||
class EmployeesActionManager extends SubActionManager{
|
||||
public function get($req){
|
||||
$profileId = $this->getCurrentProfileId();
|
||||
$subordinate = new Employee();
|
||||
$subordinatesCount = $subordinate->Count("supervisor = ? and id = ?",array($profileId, $req->id));
|
||||
$cemp = $profileId;
|
||||
$obj = new Employee();
|
||||
|
||||
$cempObj = new Employee();
|
||||
$cempObj->Load("id = ?",array($cemp));
|
||||
if($obj->getUserOnlyMeAccessField() == 'id' &&
|
||||
SettingsManager::getInstance()->getSetting('System: Company Structure Managers Enabled') == 1 &&
|
||||
CompanyStructure::isHeadOfCompanyStructure($cempObj->department, $cemp)){
|
||||
|
||||
$subordinates = $obj->Find("supervisor = ?",array($cemp));
|
||||
|
||||
if(empty($subordinates)){
|
||||
$subordinates = array();
|
||||
}
|
||||
|
||||
$childCompaniesIds = array();
|
||||
if(SettingsManager::getInstance()->getSetting('System: Child Company Structure Managers Enabled') == '1'){
|
||||
$childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department);
|
||||
$childCompanies = $childCompaniesResp->getObject();
|
||||
|
||||
foreach($childCompanies as $cc){
|
||||
$childCompaniesIds[] = $cc->id;
|
||||
}
|
||||
}else{
|
||||
$childCompaniesIds[] = $cempObj->department;
|
||||
}
|
||||
|
||||
|
||||
if($this->user->user_level == 'Admin' || $subordinatesCount > 0){
|
||||
$id = $req->id;
|
||||
if(!empty($childCompaniesIds)) {
|
||||
$childStructureSubordinates = $obj->Find("department in (" . implode(',', $childCompaniesIds) . ") and id != ?", array($cemp));
|
||||
$subordinates = array_merge($subordinates, $childStructureSubordinates);
|
||||
}
|
||||
|
||||
foreach ($subordinates as $subordinate){
|
||||
if($subordinate->id == $req->id){
|
||||
$id = $req->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$subordinate = new Employee();
|
||||
$subordinatesCount = $subordinate->Count("supervisor = ? and id = ?",array($profileId, $req->id));
|
||||
|
||||
|
||||
if($this->user->user_level == 'Admin' || $subordinatesCount > 0){
|
||||
$id = $req->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(empty($id)){
|
||||
$id = $profileId;
|
||||
@@ -56,7 +100,13 @@ class EmployeesActionManager extends SubActionManager{
|
||||
if(!empty($employee->joined_date)){
|
||||
$employee->joined_date = date("F jS, Y",strtotime($employee->joined_date));
|
||||
}
|
||||
|
||||
|
||||
//Read custom fields
|
||||
try {
|
||||
$employee = BaseService::getInstance()->customFieldManager->enrichObjectCustomFields('Employee', $employee);
|
||||
}catch(Exception $e){
|
||||
|
||||
}
|
||||
|
||||
if(empty($employee->id)){
|
||||
return new IceResponse(IceResponse::ERROR,$employee);
|
||||
@@ -98,4 +148,4 @@ class EmployeesActionManager extends SubActionManager{
|
||||
}
|
||||
return new IceResponse(IceResponse::SUCCESS,$user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,18 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row" id="customFieldsCont" style="margin-left:10px;margin-top:20px;">
|
||||
<div class="panel panel-default" style="width:97.5%;">
|
||||
<div class="panel-heading"><h4>Other Details</h4></div>
|
||||
<div class="panel-body">
|
||||
<div class="row-fluid" id="customFields">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="adminUsersModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-red">
|
||||
<div class="inner">
|
||||
<h3>My Profile</h3>
|
||||
<h3><t>My Profile</t></h3>
|
||||
<p>
|
||||
Edit Details
|
||||
<t>Edit Details</t>
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-ios7-person"></i>
|
||||
</div>
|
||||
<a href="#_moduleLink_#" class="small-box-footer" id="myProfileLink">
|
||||
Manage Profile <i class="fa fa-arrow-circle-right"></i>
|
||||
<t>View/Edit Profile</t> <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -54,8 +54,8 @@ path.link {
|
||||
<div class="span9">
|
||||
|
||||
<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">My Details</a></li>
|
||||
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph">Company</a></li>
|
||||
<li class="active"><a id="tabEmployee" href="#tabPageEmployee"><?=LanguageManager::tran('My Details')?></a></li>
|
||||
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph"><?=LanguageManager::tran('Company')?></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
@@ -83,4 +83,4 @@ modJsList['tabCompanyGraph'] = new CompanyGraphAdapter('CompanyStructure');
|
||||
var modJs = modJsList['tabEmployee'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
|
||||
@@ -289,6 +289,20 @@ EmployeeAdapter.method('modEmployeeGetSuccessCallBack' , function(data) {
|
||||
}
|
||||
subordinates += "<br/>";
|
||||
}
|
||||
|
||||
//Add custom fields
|
||||
if(data.customFields != undefined && data.customFields != null && Object.keys(data.customFields).length > 0) {
|
||||
var ct = '<div class="col-xs-6 col-md-3" style="font-size:16px;"><label class="control-label col-xs-12" style="font-size:13px;">#_label_#</label><label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;">#_value_#</label></div>';
|
||||
var customFieldHtml;
|
||||
for (index in data.customFields) {
|
||||
customFieldHtml = ct;
|
||||
customFieldHtml = customFieldHtml.replace('#_label_#', index);
|
||||
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index]);
|
||||
$("#customFields").append($(customFieldHtml));
|
||||
}
|
||||
}else{
|
||||
$("#customFieldsCont").remove();
|
||||
}
|
||||
|
||||
$("#"+this.getTableName()+" #subordinates").html(subordinates);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user