Initial checkin v13.0
This commit is contained in:
105
ext/admin/attendance/api/AttendanceActionManager.php
Normal file
105
ext/admin/attendance/api/AttendanceActionManager.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
class AttendanceActionManager extends SubActionManager{
|
||||
|
||||
public function savePunch($req){
|
||||
|
||||
|
||||
$employee = $this->baseService->getElement('Employee',$req->employee,null,true);
|
||||
$inDateTime = $req->in_time;
|
||||
$inDateArr = explode(" ",$inDateTime);
|
||||
$inDate = $inDateArr[0];
|
||||
$outDateTime = $req->out_time;
|
||||
$outDate = "";
|
||||
if(!empty($outDateTime)){
|
||||
$outDateArr = explode(" ",$outDateTime);
|
||||
$outDate = $outDateArr[0];
|
||||
}
|
||||
|
||||
$note = $req->note;
|
||||
|
||||
//check if dates are differnet
|
||||
if(!empty($outDate) && $inDate != $outDate){
|
||||
return new IceResponse(IceResponse::ERROR,"Attendance entry should be within a single day");
|
||||
}
|
||||
|
||||
//compare dates
|
||||
if(!empty($outDateTime) && strtotime($outDateTime) <= strtotime($inDateTime)){
|
||||
return new IceResponse(IceResponse::ERROR,"Punch-in time should be lesser than Punch-out time");
|
||||
}
|
||||
|
||||
|
||||
//Find all punches for the day
|
||||
$attendance = new Attendance();
|
||||
$attendanceList = $attendance->Find("employee = ? and DATE_FORMAT( in_time, '%Y-%m-%d' ) = ?",array($employee->id,$inDate));
|
||||
|
||||
foreach($attendanceList as $attendance){
|
||||
if(!empty($req->id) && $req->id == $attendance->id){
|
||||
continue;
|
||||
}
|
||||
if(empty($attendance->out_time) || $attendance->out_time == "0000-00-00 00:00:00"){
|
||||
return new IceResponse(IceResponse::ERROR,"There is a non closed attendance entry for today. Please mark punch-out time of the open entry before adding a new one");
|
||||
}else if(!empty($outDateTime)){
|
||||
if(strtotime($attendance->out_time) >= strtotime($outDateTime) && strtotime($attendance->in_time) <= strtotime($outDateTime)){
|
||||
//-1---0---1---0 || ---0--1---1---0
|
||||
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one");
|
||||
}else if(strtotime($attendance->out_time) >= strtotime($inDateTime) && strtotime($attendance->in_time) <= strtotime($inDateTime)){
|
||||
//---0---1---0---1 || ---0--1---1---0
|
||||
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one");
|
||||
}else if(strtotime($attendance->out_time) <= strtotime($outDateTime) && strtotime($attendance->in_time) >= strtotime($inDateTime)){
|
||||
//--1--0---0--1--
|
||||
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one");
|
||||
}
|
||||
}else{
|
||||
if(strtotime($attendance->out_time) >= strtotime($inDateTime) && strtotime($attendance->in_time) <= strtotime($inDateTime)){
|
||||
//---0---1---0
|
||||
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$attendance = new Attendance();
|
||||
if(!empty($req->id)){
|
||||
$attendance->Load("id = ?",array($req->id));
|
||||
}
|
||||
$attendance->in_time = $inDateTime;
|
||||
if(empty($outDateTime)){
|
||||
$attendance->out_time = "0000-00-00 00:00:00";
|
||||
}else{
|
||||
$attendance->out_time = $outDateTime;
|
||||
}
|
||||
|
||||
$attendance->employee = $req->employee;
|
||||
$attendance->note = $note;
|
||||
$ok = $attendance->Save();
|
||||
if(!$ok){
|
||||
LogManager::getInstance()->info($attendance->ErrorMsg());
|
||||
return new IceResponse(IceResponse::ERROR,"Error occured while saving attendance");
|
||||
}
|
||||
return new IceResponse(IceResponse::SUCCESS,$attendance);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
176
ext/admin/attendance/api/AttendanceAdminManager.php
Normal file
176
ext/admin/attendance/api/AttendanceAdminManager.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
if (!class_exists('AttendanceAdminManager')) {
|
||||
|
||||
class AttendanceAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
$this->addModelClass('Attendance');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Model Classes
|
||||
|
||||
if (!class_exists('Attendance')) {
|
||||
class Attendance extends ICEHRM_Record {
|
||||
var $_table = 'Attendance';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array("get");
|
||||
}
|
||||
|
||||
public function getUserOnlyMeAccess(){
|
||||
return array("element","save","delete");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!class_exists('AttendanceStatus')) {
|
||||
class AttendanceStatus extends ICEHRM_Record {
|
||||
var $_table = 'Attendance';
|
||||
|
||||
|
||||
public function getRecentAttendanceEntries($limit){
|
||||
$shift = intval(SettingsManager::getInstance()->getSetting("Attendance: Shift (Minutes)"));
|
||||
$attendance = new Attendance();
|
||||
$attendanceToday = $attendance->Find("1 = 1 order by in_time desc limit ".$limit,array());
|
||||
$attendanceData = array();
|
||||
$employees = array();
|
||||
foreach($attendanceToday as $atEntry){
|
||||
$entry = new stdClass();
|
||||
$entry->id = $atEntry->employee;
|
||||
$dayArr = explode(" ",$atEntry->in_time);
|
||||
$day = $dayArr[0];
|
||||
if($atEntry->out_time == "0000-00-00 00:00:00" || empty($atEntry->out_time)){
|
||||
if(strtotime($atEntry->in_time) < (time() + $shift * 60) && $day == date("Y-m-d")){
|
||||
$entry->status = "Clocked In";
|
||||
$entry->statusId = 0;
|
||||
$entry->color = 'green';
|
||||
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?",array($entry->id));
|
||||
$entry->employee = $employee->first_name." ".$employee->last_name;
|
||||
$employees[$entry->id] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($employees[$entry->id])){
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?",array($entry->id));
|
||||
if($day == date("Y-m-d")){
|
||||
$entry->status = "Clocked Out";
|
||||
$entry->statusId = 1;
|
||||
$entry->color = 'yellow';
|
||||
}else{
|
||||
$entry->status = "Not Clocked In";
|
||||
$entry->statusId = 2;
|
||||
$entry->color = 'gray';
|
||||
}
|
||||
$entry->employee = $employee->first_name." ".$employee->last_name;
|
||||
$employees[$entry->id] = $entry;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return array_values($employees);
|
||||
}
|
||||
|
||||
public function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array()){
|
||||
$shift = intval(SettingsManager::getInstance()->getSetting("Attendance: Shift (Minutes)"));
|
||||
$employee = new Employee();
|
||||
$data = array();
|
||||
$employees = $employee->Find("1=1");
|
||||
|
||||
$attendance = new Attendance();
|
||||
$attendanceToday = $attendance->Find("date(in_time) = ?",array(date("Y-m-d")));
|
||||
$attendanceData = array();
|
||||
//Group by employee
|
||||
foreach($attendanceToday as $attendance){
|
||||
if(isset($attendanceData[$attendance->employee])){
|
||||
$attendanceData[$attendance->employee][] = $attendance;
|
||||
}else{
|
||||
$attendanceData[$attendance->employee] = array($attendance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($employees as $employee){
|
||||
|
||||
$entry = new stdClass();
|
||||
$entry->id = $employee->id;
|
||||
$entry->employee = $employee->id;
|
||||
|
||||
|
||||
|
||||
if(isset($attendanceData[$employee->id])){
|
||||
$attendanceEntries = $attendanceData[$employee->id];
|
||||
foreach($attendanceEntries as $atEntry){
|
||||
if($atEntry->out_time == "0000-00-00 00:00:00" || empty($atEntry->out_time)){
|
||||
if(strtotime($atEntry->in_time) < time() + $shift * 60){
|
||||
$entry->status = "Clocked In";
|
||||
$entry->statusId = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($entry->status)){
|
||||
$entry->status = "Clocked Out";
|
||||
$entry->statusId = 1;
|
||||
}
|
||||
}else{
|
||||
$entry->status = "Not Clocked In";
|
||||
$entry->statusId = 2;
|
||||
}
|
||||
|
||||
$data[] = $entry;
|
||||
}
|
||||
|
||||
function cmp($a, $b) {
|
||||
return $a->statusId - $b->statusId;
|
||||
}
|
||||
usort($data, "cmp");
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array("get");
|
||||
}
|
||||
|
||||
public function getUserOnlyMeAccess(){
|
||||
return array("element","save","delete");
|
||||
}
|
||||
}
|
||||
}
|
||||
82
ext/admin/attendance/index.php
Normal file
82
ext/admin/attendance/index.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'attendance_monitor';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabAttendance" href="#tabPageAttendance">Monitor Attendance</a></li>
|
||||
<li class=""><a id="tabAttendanceStatus" href="#tabPageAttendanceStatus">Current Clocked In Status</a></li>
|
||||
<!--
|
||||
<li class=""><a id="tabAttendanceData" href="#tabPageAttendanceData">Attendance Data Update</a></li>
|
||||
-->
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageAttendance">
|
||||
<div id="Attendance" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="AttendanceForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageAttendanceStatus">
|
||||
<div id="AttendanceStatus" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="AttendanceStatusForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="tab-pane" id="tabPageAttendanceData">
|
||||
<div class="control-group" id="field__id_">
|
||||
<div class="controls">
|
||||
<textarea class="input-xxlarge" placeholder="Insert CSV data to submit" type="textarea" width="96%" rows="100" id="attendanceData" name="attendanceData"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button onclick="return false;" class="btn">Update Attendance Data</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
modJsList['tabAttendance'] = new AttendanceAdapter('Attendance','Attendance','','in_time desc');
|
||||
modJsList['tabAttendance'].setRemoteTable(true);
|
||||
modJsList['tabAttendanceStatus'] = new AttendanceStatusAdapter('AttendanceStatus','AttendanceStatus','','');
|
||||
modJsList['tabAttendanceStatus'].setShowAddNew(false);
|
||||
var modJs = modJsList['tabAttendance'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
218
ext/admin/attendance/lib.js
Normal file
218
ext/admin/attendance/lib.js
Normal file
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
function AttendanceAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
AttendanceAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
AttendanceAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"employee",
|
||||
"in_time",
|
||||
"out_time",
|
||||
"note"
|
||||
];
|
||||
});
|
||||
|
||||
AttendanceAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Employee" },
|
||||
{ "sTitle": "Time-In" },
|
||||
{ "sTitle": "Time-Out"},
|
||||
{ "sTitle": "Note"}
|
||||
];
|
||||
});
|
||||
|
||||
AttendanceAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "employee", {"label":"Employee","type":"select2","allow-null":false,"remote-source":["Employee","id","first_name+last_name"]}],
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "in_time", {"label":"Time-In","type":"datetime"}],
|
||||
[ "out_time", {"label":"Time-Out","type":"datetime", "validation":"none"}],
|
||||
[ "note", {"label":"Note","type":"textarea","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
AttendanceAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "employee", {"label":"Employee","type":"select2","allow-null":false,"remote-source":["Employee","id","first_name+last_name"]}]
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
AttendanceAdapter.method('getCustomTableParams', function() {
|
||||
var that = this;
|
||||
var dataTableParams = {
|
||||
"aoColumnDefs": [
|
||||
{
|
||||
"fnRender": function(data, cell){
|
||||
return that.preProcessRemoteTableData(data, cell, 2)
|
||||
} ,
|
||||
"aTargets": [2]
|
||||
},
|
||||
{
|
||||
"fnRender": function(data, cell){
|
||||
return that.preProcessRemoteTableData(data, cell, 3)
|
||||
} ,
|
||||
"aTargets": [3]
|
||||
},
|
||||
{
|
||||
"fnRender": function(data, cell){
|
||||
return that.preProcessRemoteTableData(data, cell, 4)
|
||||
} ,
|
||||
"aTargets": [4]
|
||||
},
|
||||
{
|
||||
"fnRender": that.getActionButtons,
|
||||
"aTargets": [that.getDataMapping().length]
|
||||
}
|
||||
]
|
||||
};
|
||||
return dataTableParams;
|
||||
});
|
||||
|
||||
AttendanceAdapter.method('preProcessRemoteTableData', function(data, cell, id) {
|
||||
if(id == 2){
|
||||
if(cell == '0000-00-00 00:00:00' || cell == "" || cell == undefined || cell == null){
|
||||
return "";
|
||||
}
|
||||
return Date.parse(cell).toString('yyyy MMM d <b>HH:mm</b>');
|
||||
}else if(id == 3){
|
||||
if(cell == '0000-00-00 00:00:00' || cell == "" || cell == undefined || cell == null){
|
||||
return "";
|
||||
}
|
||||
return Date.parse(cell).toString('MMM d <b>HH:mm</b>');
|
||||
}else if(id == 4){
|
||||
if(cell != undefined && cell != null){
|
||||
if(cell.length > 10){
|
||||
return cell.substring(0,10)+"..";
|
||||
}
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
AttendanceAdapter.method('save', function() {
|
||||
var validator = new FormValidation(this.getTableName()+"_submit",true,{'ShowPopup':false,"LabelErrorClass":"error"});
|
||||
if(validator.checkValues()){
|
||||
var params = validator.getFormParameters();
|
||||
|
||||
var msg = this.doCustomValidation(params);
|
||||
if(msg == null){
|
||||
var id = $('#'+this.getTableName()+"_submit #id").val();
|
||||
if(id != null && id != undefined && id != ""){
|
||||
$(params).attr('id',id);
|
||||
}
|
||||
|
||||
var reqJson = JSON.stringify(params);
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'saveSuccessCallback';
|
||||
callBackData['callBackFail'] = 'saveFailCallback';
|
||||
|
||||
this.customAction('savePunch','admin=attendance',reqJson,callBackData);
|
||||
}else{
|
||||
$("#"+this.getTableName()+'Form .label').html(msg);
|
||||
$("#"+this.getTableName()+'Form .label').show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
AttendanceAdapter.method('saveSuccessCallback', function(callBackData) {
|
||||
this.get(callBackData);
|
||||
});
|
||||
|
||||
|
||||
AttendanceAdapter.method('saveFailCallback', function(callBackData) {
|
||||
this.showMessage("Error saving attendance entry", callBackData);
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Attendance Status
|
||||
*/
|
||||
|
||||
|
||||
function AttendanceStatusAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
AttendanceStatusAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
AttendanceStatusAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"employee",
|
||||
"status"
|
||||
];
|
||||
});
|
||||
|
||||
AttendanceStatusAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Employee" },
|
||||
{ "sTitle": "Clocked In Status" }
|
||||
];
|
||||
});
|
||||
|
||||
AttendanceStatusAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
AttendanceStatusAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "employee", {"label":"Employee","type":"select2","allow-null":false,"remote-source":["Employee","id","first_name+last_name"]}]
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
AttendanceStatusAdapter.method('getActionButtonsHtml', function(id,data) {
|
||||
|
||||
|
||||
html = '<div class="online-button-_COLOR_"></div>';
|
||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
||||
if(data[2] == "Not Clocked In"){
|
||||
html = html.replace(/_COLOR_/g,'gray');
|
||||
}else if(data[2] == "Clocked Out"){
|
||||
html = html.replace(/_COLOR_/g,'yellow');
|
||||
}else if(data[2] == "Clocked In"){
|
||||
html = html.replace(/_COLOR_/g,'green');
|
||||
}
|
||||
return html;
|
||||
});
|
||||
10
ext/admin/attendance/meta.json
Normal file
10
ext/admin/attendance/meta.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"label":"Monitor Attendance",
|
||||
"menu":"Employees",
|
||||
"order":"8",
|
||||
"icon":"fa-clock-o",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if (!class_exists('Company_structureAdminManager')) {
|
||||
|
||||
class Company_structureAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
$this->addDatabaseErrorMapping("CONSTRAINT `Fk_Employee_CompanyStructures` FOREIGN KEY (`department`) REFERENCES `CompanyStructures` (`id`)", "Can not delete a company structure while employees are assigned to it");
|
||||
$this->addDatabaseErrorMapping("CONSTRAINT `Fk_CompanyStructures_Own` FOREIGN KEY (`parent`) REFERENCES ", "Can not delete a parent structure");
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
$this->addModelClass('CompanyStructure');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('CompanyStructure')) {
|
||||
class CompanyStructure extends ICEHRM_Record {
|
||||
var $_table = 'CompanyStructures';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
|
||||
public function validateSave($obj){
|
||||
if($obj->id == $obj->parent && !empty($obj->parent)){
|
||||
return new IceResponse(IceResponse::ERROR,"A Company structure unit can not be the parent of the same unit");
|
||||
}
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS,"");
|
||||
}
|
||||
}
|
||||
}
|
||||
96
ext/admin/company_structure/index.php
Normal file
96
ext/admin/company_structure/index.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'company_structure';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?>
|
||||
<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>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
|
||||
.node circle {
|
||||
cursor: pointer;
|
||||
fill: #fff;
|
||||
stroke: steelblue;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.node text {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
path.link {
|
||||
fill: none;
|
||||
stroke: #ccc;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<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="tabCompanyStructure" href="#tabPageCompanyStructure">Company Structure</a></li>
|
||||
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph">Company Graph</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageCompanyStructure">
|
||||
<div id="CompanyStructure" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="CompanyStructureForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane reviewBlock" id="tabPageCompanyGraph" style="overflow-x: scroll;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
modJsList['tabCompanyStructure'] = new CompanyStructureAdapter('CompanyStructure');
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Company Structure']) && $modulePermissions['perm']['Add Company Structure'] == "No"){?>
|
||||
modJsList['tabCompanyStructure'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Delete Company Structure']) && $modulePermissions['perm']['Delete Company Structure'] == "No"){?>
|
||||
modJsList['tabCompanyStructure'].setShowDelete(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Edit Company Structure']) && $modulePermissions['perm']['Edit Company Structure'] == "No"){?>
|
||||
modJsList['tabCompanyStructure'].setShowEdit(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
modJsList['tabCompanyGraph'] = new CompanyGraphAdapter('CompanyStructure');
|
||||
|
||||
var modJs = modJsList['tabCompanyStructure'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
306
ext/admin/company_structure/lib.js
Normal file
306
ext/admin/company_structure/lib.js
Normal file
@@ -0,0 +1,306 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
function CompanyStructureAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
CompanyStructureAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
CompanyStructureAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"title",
|
||||
"address",
|
||||
"type",
|
||||
"country",
|
||||
"parent"
|
||||
];
|
||||
});
|
||||
|
||||
CompanyStructureAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Address","bSortable":false},
|
||||
{ "sTitle": "Type"},
|
||||
{ "sTitle": "Country", "sClass": "center" },
|
||||
{ "sTitle": "Parent Structure"}
|
||||
];
|
||||
});
|
||||
|
||||
CompanyStructureAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden","validation":""}],
|
||||
[ "title", {"label":"Name","type":"text","validation":""}],
|
||||
[ "description", {"label":"Details","type":"textarea","validation":""}],
|
||||
[ "address", {"label":"Address","type":"textarea","validation":"none"}],
|
||||
[ "type", {"label":"Type","type":"select","source":[["Company","Company"],["Head Office","Head Office"],["Regional Office","Regional Office"],["Department","Department"],["Unit","Unit"],["Sub Unit","Sub Unit"],["Other","Other"]]}],
|
||||
[ "country", {"label":"Country","type":"select","remote-source":["Country","code","name"]}],
|
||||
[ "parent", {"label":"Parent Structure","type":"select","allow-null":true,"remote-source":["CompanyStructure","id","title"]}]
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* Company Graph
|
||||
*/
|
||||
|
||||
|
||||
function CompanyGraphAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
this.nodeIdCounter = 0;
|
||||
}
|
||||
|
||||
CompanyGraphAdapter.inherits(CompanyStructureAdapter);
|
||||
|
||||
|
||||
CompanyGraphAdapter.method('convertToTree', function(data) {
|
||||
var ice = {};
|
||||
ice['id'] = -1;
|
||||
ice['title'] = '';
|
||||
ice['name'] = '';
|
||||
ice['children'] = [];
|
||||
|
||||
var parent = null;
|
||||
|
||||
var added = {};
|
||||
|
||||
|
||||
for(var i=0;i<data.length;i++){
|
||||
|
||||
data[i].name = data[i].title;
|
||||
|
||||
if(data[i].parent != null && data[i].parent != undefined){
|
||||
parent = this.findParent(data,data[i].parent);
|
||||
if(parent != null){
|
||||
if(parent.children == undefined || parent.children == null){
|
||||
parent.children = [];
|
||||
}
|
||||
parent.children.push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for(var i=0;i<data.length;i++){
|
||||
if(data[i].parent == null || data[i].parent == undefined){
|
||||
ice['children'].push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ice;
|
||||
|
||||
});
|
||||
|
||||
|
||||
CompanyGraphAdapter.method('findParent', function(data, parent) {
|
||||
for(var i=0;i<data.length;i++){
|
||||
if(data[i].title == parent || data[i].title == parent){
|
||||
return data[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
CompanyGraphAdapter.method('createTable', function(elementId) {
|
||||
$("#tabPageCompanyGraph").html("");
|
||||
var that = this;
|
||||
var sourceData = this.sourceData;
|
||||
|
||||
//this.fixCyclicParent(sourceData);
|
||||
var treeData = this.convertToTree(sourceData);
|
||||
|
||||
var m = [20, 120, 20, 120],
|
||||
w = 5000 - m[1] - m[3],
|
||||
h = 1000 - m[0] - m[2],
|
||||
root;
|
||||
|
||||
var tree = d3.layout.tree()
|
||||
.size([h, w]);
|
||||
|
||||
this.diagonal = d3.svg.diagonal()
|
||||
.projection(function(d) { return [d.y, d.x]; });
|
||||
|
||||
this.vis = d3.select("#tabPageCompanyGraph").append("svg:svg")
|
||||
.attr("width", w + m[1] + m[3])
|
||||
.attr("height", h + m[0] + m[2])
|
||||
.append("svg:g")
|
||||
.attr("transform", "translate(" + m[3] + "," + m[0] + ")");
|
||||
|
||||
root = treeData;
|
||||
root.x0 = h / 2;
|
||||
root.y0 = 0;
|
||||
|
||||
function toggleAll(d) {
|
||||
if (d.children) {
|
||||
console.log(d.name);
|
||||
d.children.forEach(toggleAll);
|
||||
that.toggle(d);
|
||||
}
|
||||
}
|
||||
this.update(root, tree, root);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
CompanyGraphAdapter.method('update', function(source, tree, root) {
|
||||
var that = this;
|
||||
var duration = d3.event && d3.event.altKey ? 5000 : 500;
|
||||
|
||||
// Compute the new tree layout.
|
||||
var nodes = tree.nodes(root).reverse();
|
||||
|
||||
// Normalize for fixed-depth.
|
||||
nodes.forEach(function(d) { d.y = d.depth * 180; });
|
||||
|
||||
// Update the nodes<65>
|
||||
var node = that.vis.selectAll("g.node")
|
||||
.data(nodes, function(d) { return d.id || (d.id = ++that.nodeIdCounter); });
|
||||
|
||||
// Enter any new nodes at the parent's previous position.
|
||||
var nodeEnter = node.enter().append("svg:g")
|
||||
.attr("class", "node")
|
||||
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
|
||||
.on("click", function(d) { that.toggle(d); that.update(d, tree, root); });
|
||||
|
||||
nodeEnter.append("svg:circle")
|
||||
.attr("r", 1e-6)
|
||||
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
|
||||
|
||||
nodeEnter.append("svg:text")
|
||||
.attr("x", function(d) { return d.children || d._children ? -10 : 10; })
|
||||
.attr("dy", ".35em")
|
||||
.attr("text-anchor", function(d) { return d.children || d._children ? "end" : "start"; })
|
||||
.text(function(d) { return d.name; })
|
||||
.style("fill-opacity", 1e-6);
|
||||
|
||||
// Transition nodes to their new position.
|
||||
var nodeUpdate = node.transition()
|
||||
.duration(duration)
|
||||
.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
|
||||
|
||||
nodeUpdate.select("circle")
|
||||
.attr("r", 4.5)
|
||||
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
|
||||
|
||||
nodeUpdate.select("text")
|
||||
.style("fill-opacity", 1);
|
||||
|
||||
// Transition exiting nodes to the parent's new position.
|
||||
var nodeExit = node.exit().transition()
|
||||
.duration(duration)
|
||||
.attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
|
||||
.remove();
|
||||
|
||||
nodeExit.select("circle")
|
||||
.attr("r", 1e-6);
|
||||
|
||||
nodeExit.select("text")
|
||||
.style("fill-opacity", 1e-6);
|
||||
|
||||
// Update the links<6B>
|
||||
var link = that.vis.selectAll("path.link")
|
||||
.data(tree.links(nodes), function(d) { return d.target.id; });
|
||||
|
||||
// Enter any new links at the parent's previous position.
|
||||
link.enter().insert("svg:path", "g")
|
||||
.attr("class", "link")
|
||||
.attr("d", function(d) {
|
||||
var o = {x: source.x0, y: source.y0};
|
||||
return that.diagonal({source: o, target: o});
|
||||
})
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("d", that.diagonal);
|
||||
|
||||
// Transition links to their new position.
|
||||
link.transition()
|
||||
.duration(duration)
|
||||
.attr("d", that.diagonal);
|
||||
|
||||
// Transition exiting nodes to the parent's new position.
|
||||
link.exit().transition()
|
||||
.duration(duration)
|
||||
.attr("d", function(d) {
|
||||
var o = {x: source.x, y: source.y};
|
||||
return that.diagonal({source: o, target: o});
|
||||
})
|
||||
.remove();
|
||||
|
||||
// Stash the old positions for transition.
|
||||
nodes.forEach(function(d) {
|
||||
d.x0 = d.x;
|
||||
d.y0 = d.y;
|
||||
});
|
||||
});
|
||||
|
||||
// Toggle children.
|
||||
CompanyGraphAdapter.method('toggle', function(d) {
|
||||
if (d.children) {
|
||||
d._children = d.children;
|
||||
d.children = null;
|
||||
} else {
|
||||
d.children = d._children;
|
||||
d._children = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
CompanyGraphAdapter.method('getSourceDataById', function(id) {
|
||||
|
||||
for(var i=0; i< this.sourceData.length; i++){
|
||||
if(this.sourceData[i].id == id){
|
||||
return this.sourceData[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
});
|
||||
|
||||
CompanyGraphAdapter.method('fixCyclicParent', function(sourceData) {
|
||||
var errorMsg = "";
|
||||
for(var i=0; i< sourceData.length; i++){
|
||||
var obj = sourceData[i];
|
||||
|
||||
|
||||
var curObj = obj;
|
||||
var parentIdArr = {};
|
||||
parentIdArr[curObj.id] = 1;
|
||||
|
||||
while(curObj.parent != null && curObj.parent != undefined){
|
||||
var parent = this.getSourceDataById(curObj.parent);
|
||||
if(parent == null){
|
||||
break;
|
||||
}else if(parentIdArr[parent.id] == 1){
|
||||
errorMsg = obj.title +"'s parent structure set to "+parent.title+"<br/>";
|
||||
obj.parent = null;
|
||||
break;
|
||||
}
|
||||
parentIdArr[parent.id] = 1;
|
||||
curObj = parent;
|
||||
}
|
||||
}
|
||||
|
||||
if(errorMsg != ""){
|
||||
this.showMessage("Company Structure is having a cyclic dependency","We found a cyclic dependency due to following reasons:<br/>"+errorMsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
CompanyGraphAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=61';
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
16
ext/admin/company_structure/meta.json
Normal file
16
ext/admin/company_structure/meta.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"label":"Company Structure",
|
||||
"menu":"Admin",
|
||||
"order":"2",
|
||||
"icon":"fa-building-o",
|
||||
"user_levels":["Admin","Manager"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
"Manager":{
|
||||
"Add Company Structure":"No",
|
||||
"Edit Company Structure":"No",
|
||||
"Delete Company Structure":"No"
|
||||
}
|
||||
}
|
||||
}
|
||||
55
ext/admin/dashboard/api/DashboardActionManager.php
Normal file
55
ext/admin/dashboard/api/DashboardActionManager.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
|
||||
class DashboardActionManager extends SubActionManager{
|
||||
|
||||
public function getInitData($req){
|
||||
$data = array();
|
||||
$employees = new Employee();
|
||||
$data['numberOfEmployees'] = $employees->Count("1 = 1");
|
||||
|
||||
$company = new CompanyStructure();
|
||||
$data['numberOfCompanyStuctures'] = $company->Count("1 = 1");
|
||||
|
||||
$user = new User();
|
||||
$data['numberOfUsers'] = $user->Count("1 = 1");
|
||||
|
||||
$project = new Project();
|
||||
$data['numberOfProjects'] = $project->Count("status = 'Active'");
|
||||
|
||||
$attendance = new Attendance();
|
||||
$data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '".date("Y-m-d H:i:s",strtotime("-1 week"))."'");
|
||||
|
||||
$empLeave = new EmployeeLeave();
|
||||
$data['numberOfLeaves'] = $empLeave->Count("date_start > '".date("Y-m-d")."'");
|
||||
|
||||
$timeEntry = new EmployeeTimeEntry();
|
||||
$data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '".date("Y-m-d H:i:s",strtotime("-1 week"))."'");
|
||||
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS,$data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
22
ext/admin/dashboard/api/DashboardAdminManager.php
Normal file
22
ext/admin/dashboard/api/DashboardAdminManager.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if (!class_exists('DashboardAdminManager')) {
|
||||
class DashboardAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
223
ext/admin/dashboard/index.php
Normal file
223
ext/admin/dashboard/index.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'dashboard';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><div class="span9">
|
||||
<div id="iceannon">
|
||||
<div class="callout callout-warning lead" style="font-size: 14px;">
|
||||
<h4>Why not upgrade to IceHrm Pro Version</h4>
|
||||
<p>
|
||||
IceHrm Pro is the feature rich upgrade to IceHrm open source version. It comes with improved modules for
|
||||
employee management, leave management, LDAP support and number of other features over open source version.
|
||||
Hit this <a href="http://icehrm.com/#compare" class="btn btn-primary btn-xs target="_blank">link</a> to do a full one to one comparison.
|
||||
|
||||
Also you can learn more about IceHrm Pro <a href="http://blog.icehrm.com/icehrm-pro/" class="btn btn-primary btn-xs" target="_blank">here</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="http://icehrm.com/modules.php" class="btn btn-success btm-xs" target="_blank"><i class="fa fa-checkout"></i> Buy IceHrm Pro</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-aqua">
|
||||
<div class="inner">
|
||||
<h3>
|
||||
People
|
||||
</h3>
|
||||
<p id="numberOfEmployees">
|
||||
.. Employees
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-person-stalker"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="employeeLink">
|
||||
Manage Employees <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-green">
|
||||
<div class="inner">
|
||||
<h3 id="numberOfCompanyStuctures">..</h3>
|
||||
<p >
|
||||
Company Structures
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-shuffle"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="companyLink">
|
||||
Manage Company <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-yellow">
|
||||
<div class="inner">
|
||||
<h3>Users</h3>
|
||||
<p id="numberOfUsers">
|
||||
.. Users
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-person-add"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="usersLink">
|
||||
Manage Users <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-red">
|
||||
<div class="inner">
|
||||
<h3 id="numberOfProjects">..</h3>
|
||||
<p>
|
||||
Active Projects
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-pie-graph"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="projectsLink">
|
||||
Update Clients/Projects <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-yellow">
|
||||
<div class="inner">
|
||||
<h3>
|
||||
Attendance
|
||||
</h3>
|
||||
<p id="numberOfAttendanceLastWeek">
|
||||
.. Entries Last Week
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-clock"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="attendanceLink">
|
||||
Monitor Attendance <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-red">
|
||||
<div class="inner">
|
||||
<h3 id="numberOfLeaves">..</h3>
|
||||
<p >Upcoming Leaves</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-calendar"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="leaveLink">
|
||||
Leave Management <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-teal">
|
||||
<div class="inner">
|
||||
<h3>Reports</h3>
|
||||
<p>
|
||||
View / Download Reports
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-document-text"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="reportsLink">
|
||||
Create a Report <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-green">
|
||||
<div class="inner">
|
||||
<h3>Settings</h3>
|
||||
<p>
|
||||
Configure IceHrm
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-settings"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="settingsLink">
|
||||
Update Settings <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabDashboard'] = new DashboardAdapter('Dashboard','Dashboard');
|
||||
|
||||
var modJs = modJsList['tabDashboard'];
|
||||
|
||||
$("#employeeLink").attr("href",modJs.getCustomUrl('?g=admin&n=employees&m=admin_Admin'));
|
||||
$("#companyLink").attr("href",modJs.getCustomUrl('?g=admin&n=company_structure&m=admin_Admin'));
|
||||
$("#usersLink").attr("href",modJs.getCustomUrl('?g=admin&n=users&m=admin_System'));
|
||||
$("#projectsLink").attr("href",modJs.getCustomUrl('?g=admin&n=projects&m=admin_Admin'));
|
||||
$("#attendanceLink").attr("href",modJs.getCustomUrl('?g=admin&n=attendance&m=admin_Admin'));
|
||||
$("#leaveLink").attr("href",modJs.getCustomUrl('?g=admin&n=leaves&m=admin_Admin'));
|
||||
$("#reportsLink").attr("href",modJs.getCustomUrl('?g=admin&n=reports&m=admin_Reports'));
|
||||
$("#settingsLink").attr("href",modJs.getCustomUrl('?g=admin&n=settings&m=admin_System'));
|
||||
|
||||
modJs.getInitData();
|
||||
|
||||
$(document).ready(function(){
|
||||
try{
|
||||
$.ajax({
|
||||
url : "https://icehrm-public.s3.amazonaws.com/icehrmnews.html",
|
||||
success : function(result){
|
||||
$('#iceannon').html(result);
|
||||
}
|
||||
});
|
||||
}catch(e){}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
76
ext/admin/dashboard/lib.js
Normal file
76
ext/admin/dashboard/lib.js
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
function DashboardAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
DashboardAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
DashboardAdapter.method('getDataMapping', function() {
|
||||
return [];
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getHeaders', function() {
|
||||
return [];
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getFormFields', function() {
|
||||
return [];
|
||||
});
|
||||
|
||||
|
||||
DashboardAdapter.method('get', function(callBackData) {
|
||||
});
|
||||
|
||||
|
||||
DashboardAdapter.method('getInitData', function() {
|
||||
var that = this;
|
||||
var object = {};
|
||||
var reqJson = JSON.stringify(object);
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'getInitDataSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'getInitDataFailCallBack';
|
||||
|
||||
this.customAction('getInitData','admin=dashboard',reqJson,callBackData);
|
||||
});
|
||||
|
||||
|
||||
|
||||
DashboardAdapter.method('getInitDataSuccessCallBack', function(data) {
|
||||
|
||||
$("#numberOfEmployees").html(data['numberOfEmployees']+" Employees");
|
||||
$("#numberOfCompanyStuctures").html(data['numberOfCompanyStuctures']);
|
||||
$("#numberOfUsers").html(data['numberOfUsers']+" Users");
|
||||
$("#numberOfProjects").html(data['numberOfProjects']);
|
||||
$("#numberOfAttendanceLastWeek").html(data['numberOfAttendanceLastWeek']+" Entries Last Week");
|
||||
$("#numberOfLeaves").html(data['numberOfLeaves']);
|
||||
$("#numberOfTimeEntries").html(data['numberOfTimeEntries']);
|
||||
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getInitDataFailCallBack', function(callBackData) {
|
||||
|
||||
});
|
||||
11
ext/admin/dashboard/meta.json
Normal file
11
ext/admin/dashboard/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Dashboard",
|
||||
"menu":"Admin",
|
||||
"order":"1",
|
||||
"icon":"fa-desktop",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
69
ext/admin/documents/api/DocumentsAdminManager.php
Normal file
69
ext/admin/documents/api/DocumentsAdminManager.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
if (!class_exists('DocumentsAdminManager')) {
|
||||
class DocumentsAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
$this->addFileFieldMapping('EmployeeDocument', 'attachment', 'name');
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
$this->addDatabaseErrorMapping('CONSTRAINT `Fk_EmployeeDocuments_Documents` FOREIGN KEY','Can not delete Document Type, users have already uploaded these types of documents');
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
$this->addModelClass('Document');
|
||||
$this->addModelClass('EmployeeDocument');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('Document')) {
|
||||
class Document extends ICEHRM_Record {
|
||||
var $_table = 'Documents';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('EmployeeDocument')) {
|
||||
class EmployeeDocument extends ICEHRM_Record {
|
||||
var $_table = 'EmployeeDocuments';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array("get");
|
||||
}
|
||||
|
||||
public function getUserOnlyMeAccess(){
|
||||
return array("element","save","delete");
|
||||
}
|
||||
|
||||
public function Insert(){
|
||||
if(empty($this->date_added)){
|
||||
$this->date_added = date("Y-m-d H:i:s");
|
||||
}
|
||||
return parent::Insert();
|
||||
}
|
||||
}
|
||||
}
|
||||
64
ext/admin/documents/index.php
Normal file
64
ext/admin/documents/index.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'documents';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabDocument" href="#tabPageDocument">Document Types</a></li>
|
||||
<li class=""><a id="tabEmployeeDocument" href="#tabPageEmployeeDocument">Employee Documents</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageDocument">
|
||||
<div id="Document" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="DocumentForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageEmployeeDocument">
|
||||
<div id="EmployeeDocument" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="EmployeeDocumentForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabDocument'] = new DocumentAdapter('Document','Document');
|
||||
modJsList['tabEmployeeDocument'] = new EmployeeDocumentAdapter('EmployeeDocument','EmployeeDocument');
|
||||
|
||||
var modJs = modJsList['tabDocument'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
107
ext/admin/documents/lib.js
Normal file
107
ext/admin/documents/lib.js
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* DocumentAdapter
|
||||
*/
|
||||
|
||||
function DocumentAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
DocumentAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
DocumentAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"details"
|
||||
];
|
||||
});
|
||||
|
||||
DocumentAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Details"}
|
||||
];
|
||||
});
|
||||
|
||||
DocumentAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text","validation":""}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
DocumentAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=88';
|
||||
});
|
||||
|
||||
|
||||
function EmployeeDocumentAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EmployeeDocumentAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
EmployeeDocumentAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"employee",
|
||||
"document",
|
||||
"details",
|
||||
"date_added",
|
||||
"status",
|
||||
"attachment"
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeDocumentAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Employee" },
|
||||
{ "sTitle": "Document" },
|
||||
{ "sTitle": "Details" },
|
||||
{ "sTitle": "Date Added"},
|
||||
{ "sTitle": "Status"},
|
||||
{ "sTitle": "Attachment","bVisible":false}
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeDocumentAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}],
|
||||
[ "document", {"label":"Document","type":"select2","remote-source":["Document","id","name"]}],
|
||||
[ "date_added", {"label":"Date Added","type":"date","validation":""}],
|
||||
[ "valid_until", {"label":"Valid Until","type":"date","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
||||
[ "attachment", {"label":"Attachment","type":"fileupload","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
EmployeeDocumentAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}]
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
EmployeeDocumentAdapter.method('getActionButtonsHtml', function(id,data) {
|
||||
var html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/download.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Download Document" onclick="download(\'_attachment_\');return false;"></img><img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img></div>';
|
||||
html = html.replace(/_id_/g,id);
|
||||
html = html.replace(/_attachment_/g,data[6]);
|
||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
||||
return html;
|
||||
});
|
||||
11
ext/admin/documents/meta.json
Normal file
11
ext/admin/documents/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Document Management",
|
||||
"menu":"Employees",
|
||||
"order":"2",
|
||||
"icon":"fa-files-o",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
71
ext/admin/employees/api/EmployeesAdminManager.php
Normal file
71
ext/admin/employees/api/EmployeesAdminManager.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if (!class_exists('EmployeesAdminManager')) {
|
||||
class EmployeesAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
$this->addDatabaseErrorMapping('CONSTRAINT `Fk_User_Employee` FOREIGN KEY',"Can not delete Employee, please delete the User for this employee first.");
|
||||
$this->addDatabaseErrorMapping("Duplicate entry|for key 'employee'","A duplicate entry found");
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
$this->addModelClass('Employee');
|
||||
$this->addModelClass('EmploymentStatus');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Employee')) {
|
||||
class Employee extends ICEHRM_Record {
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array("get");
|
||||
}
|
||||
|
||||
public function getUserOnlyMeAccess(){
|
||||
return array("element","save");
|
||||
}
|
||||
|
||||
public function getUserOnlyMeAccessField(){
|
||||
return "id";
|
||||
}
|
||||
|
||||
var $_table = 'Employees';
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('EmploymentStatus')) {
|
||||
class EmploymentStatus extends ICEHRM_Record {
|
||||
|
||||
var $_table = 'EmploymentStatus';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
ext/admin/employees/index.php
Normal file
34
ext/admin/employees/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
$moduleName = 'employees';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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">Employees</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageEmployee">
|
||||
<div id="Employee" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="EmployeeForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
modJsList['tabEmployee'] = new EmployeeAdapter('Employee');
|
||||
modJsList['tabEmployee'].setRemoteTable(true);
|
||||
|
||||
var modJs = modJsList['tabEmployee'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
96
ext/admin/employees/lib.js
Normal file
96
ext/admin/employees/lib.js
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
function EmployeeAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EmployeeAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
EmployeeAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"employee_id",
|
||||
"first_name",
|
||||
"last_name",
|
||||
"mobile_phone",
|
||||
"department",
|
||||
"gender",
|
||||
"supervisor"
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" },
|
||||
{ "sTitle": "Employee Number" },
|
||||
{ "sTitle": "First Name" },
|
||||
{ "sTitle": "Last Name"},
|
||||
{ "sTitle": "Mobile"},
|
||||
{ "sTitle": "Department"},
|
||||
{ "sTitle": "Gender"},
|
||||
{ "sTitle": "Supervisor"}
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden","validation":""}],
|
||||
[ "employee_id", {"label":"Employee Number","type":"text","validation":""}],
|
||||
[ "first_name", {"label":"First Name","type":"text","validation":""}],
|
||||
[ "middle_name", {"label":"Middle Name","type":"text","validation":"none"}],
|
||||
[ "last_name", {"label":"Last Name","type":"text","validation":""}],
|
||||
[ "nationality", {"label":"Nationality","type":"select2","remote-source":["Nationality","id","name"]}],
|
||||
[ "birthday", {"label":"Date of Birth","type":"date","validation":""}],
|
||||
[ "gender", {"label":"Gender","type":"select","source":[["Male","Male"],["Female","Female"]]}],
|
||||
[ "marital_status", {"label":"Marital Status","type":"select","source":[["Married","Married"],["Single","Single"],["Divorced","Divorced"],["Widowed","Widowed"],["Other","Other"]]}],
|
||||
[ "ssn_num", {"label":"SSN/NRIC","type":"text","validation":"none"}],
|
||||
[ "nic_num", {"label":"NIC","type":"text","validation":"none"}],
|
||||
[ "other_id", {"label":"Other ID","type":"text","validation":"none"}],
|
||||
[ "driving_license", {"label":"Driving License No","type":"text","validation":"none"}],
|
||||
/*[ "driving_license_exp_date", {"label":"License Exp Date","type":"date","validation":"none"}],*/
|
||||
[ "employment_status", {"label":"Employment Status","type":"select2","remote-source":["EmploymentStatus","id","name"]}],
|
||||
[ "job_title", {"label":"Job Title","type":"select2","remote-source":["JobTitle","id","name"]}],
|
||||
[ "pay_grade", {"label":"Pay Grade","type":"select2","allow-null":true,"remote-source":["PayGrade","id","name"]}],
|
||||
[ "work_station_id", {"label":"Work Station Id","type":"text","validation":"none"}],
|
||||
[ "address1", {"label":"Address Line 1","type":"text","validation":"none"}],
|
||||
[ "address2", {"label":"Address Line 2","type":"text","validation":"none"}],
|
||||
[ "city", {"label":"City","type":"text","validation":"none"}],
|
||||
[ "country", {"label":"Country","type":"select2","remote-source":["Country","code","name"]}],
|
||||
[ "province", {"label":"Province","type":"select2","allow-null":true,"remote-source":["Province","id","name"]}],
|
||||
[ "postal_code", {"label":"Postal/Zip Code","type":"text","validation":"none"}],
|
||||
[ "home_phone", {"label":"Home Phone","type":"text","validation":"none"}],
|
||||
[ "mobile_phone", {"label":"Mobile Phone","type":"text","validation":"none"}],
|
||||
[ "work_phone", {"label":"Work Phone","type":"text","validation":"none"}],
|
||||
[ "work_email", {"label":"Work Email","type":"text","validation":"emailOrEmpty"}],
|
||||
[ "private_email", {"label":"Private Email","type":"text","validation":"emailOrEmpty"}],
|
||||
[ "joined_date", {"label":"Joined Date","type":"date","validation":""}],
|
||||
[ "confirmation_date", {"label":"Confirmation Date","type":"date","validation":"none"}],
|
||||
[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"]}],
|
||||
[ "supervisor", {"label":"Supervisor","type":"select2","allow-null":true,"remote-source":["Employee","id","first_name+last_name"]}]
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "job_title", {"label":"Job Title","type":"select2","allow-null":true,"null-label":"All Job Titles","remote-source":["JobTitle","id","name"]}],
|
||||
[ "department", {"label":"Department","type":"select2","allow-null":true,"null-label":"All Departments","remote-source":["CompanyStructure","id","title"]}],
|
||||
[ "supervisor", {"label":"Supervisor","type":"select2","allow-null":true,"null-label":"Anyone","remote-source":["Employee","id","first_name+last_name"]}]
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeAdapter.method('getActionButtonsHtml', function(id) {
|
||||
var html = '<div style="width:110px;"><img class="tableActionButton" src="_BASE_images/user.png" style="cursor:pointer;" rel="tooltip" title="Login as this Employee" onclick="modJs.setAdminEmployee(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Terminate Employee" onclick="modJs.deleteRow(_id_);return false;"></img></div>';
|
||||
html = html.replace(/_id_/g,id);
|
||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
||||
return html;
|
||||
});
|
||||
|
||||
EmployeeAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=69';
|
||||
});
|
||||
|
||||
|
||||
11
ext/admin/employees/meta.json
Normal file
11
ext/admin/employees/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Employees",
|
||||
"menu":"Employees",
|
||||
"order":"1",
|
||||
"icon":"fa-users",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
54
ext/admin/jobs/api/JobsAdminManager.php
Normal file
54
ext/admin/jobs/api/JobsAdminManager.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
if (!class_exists('JobsAdminManager')) {
|
||||
class JobsAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
$this->addModelClass('JobTitle');
|
||||
$this->addModelClass('PayGrade');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('JobTitle')) {
|
||||
class JobTitle extends ICEHRM_Record {
|
||||
var $_table = 'JobTitles';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('PayGrade')) {
|
||||
class PayGrade extends ICEHRM_Record {
|
||||
var $_table = 'PayGrades';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
74
ext/admin/jobs/index.php
Normal file
74
ext/admin/jobs/index.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'jobs';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabJobTitles" href="#tabPageJobTitles">Job Titles</a></li>
|
||||
<li><a id="tabPayGrades" href="#tabPagePayGrades">Pay Grades</a></li>
|
||||
<li><a id="tabEmploymentStatus" href="#tabPageEmploymentStatus">Employment Status</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageJobTitles">
|
||||
<div id="JobTitle" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="JobTitleForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPagePayGrades">
|
||||
<div id="PayGrade" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="PayGradeForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageEmploymentStatus">
|
||||
<div id="EmploymentStatus" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="EmploymentStatusForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabJobTitles'] = new JobTitleAdapter('JobTitle');
|
||||
modJsList['tabPayGrades'] = new PayGradeAdapter('PayGrade');
|
||||
modJsList['tabEmploymentStatus'] = new EmploymentStatusAdapter('EmploymentStatus');
|
||||
|
||||
var modJs = modJsList['tabJobTitles'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
139
ext/admin/jobs/lib.js
Normal file
139
ext/admin/jobs/lib.js
Normal file
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* JobTitleAdapter
|
||||
*/
|
||||
|
||||
function JobTitleAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
JobTitleAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
JobTitleAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"code",
|
||||
"name"
|
||||
];
|
||||
});
|
||||
|
||||
JobTitleAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Code" },
|
||||
{ "sTitle": "Name" }
|
||||
];
|
||||
});
|
||||
|
||||
JobTitleAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "code", {"label":"Job Title Code","type":"text"}],
|
||||
[ "name", {"label":"Job Title","type":"text"}],
|
||||
[ "description", {"label":"Description","type":"textarea"}],
|
||||
[ "specification", {"label":"Specification","type":"textarea"}]
|
||||
];
|
||||
});
|
||||
|
||||
JobTitleAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=80';
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* PayGradeAdapter
|
||||
*/
|
||||
|
||||
function PayGradeAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
PayGradeAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
PayGradeAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"currency",
|
||||
"min_salary",
|
||||
"max_salary"
|
||||
];
|
||||
});
|
||||
|
||||
PayGradeAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Currency"},
|
||||
{ "sTitle": "Min Salary" },
|
||||
{ "sTitle": "Max Salary"}
|
||||
];
|
||||
});
|
||||
|
||||
PayGradeAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Pay Grade Name","type":"text"}],
|
||||
[ "currency", {"label":"Currency","type":"select2","remote-source":["CurrencyType","code","name"]}],
|
||||
[ "min_salary", {"label":"Min Salary","type":"text","validation":"float"}],
|
||||
[ "max_salary", {"label":"Max Salary","type":"text","validation":"float"}]
|
||||
];
|
||||
});
|
||||
|
||||
PayGradeAdapter.method('doCustomValidation', function(params) {
|
||||
try{
|
||||
if(parseFloat(params.min_salary)>parseFloat(params.max_salary)){
|
||||
return "Min Salary should be smaller than Max Salary";
|
||||
}
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* EmploymentStatusAdapter
|
||||
*/
|
||||
|
||||
function EmploymentStatusAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EmploymentStatusAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
EmploymentStatusAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"description"
|
||||
];
|
||||
});
|
||||
|
||||
EmploymentStatusAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Description"}
|
||||
];
|
||||
});
|
||||
|
||||
EmploymentStatusAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Employment Status","type":"text"}],
|
||||
[ "description", {"label":"Description","type":"textarea","validation":""}]
|
||||
];
|
||||
});
|
||||
|
||||
11
ext/admin/jobs/meta.json
Normal file
11
ext/admin/jobs/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Job Details Setup",
|
||||
"menu":"Admin",
|
||||
"order":"3",
|
||||
"icon":"fa-columns",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
37
ext/admin/loans/api/LoansAdminManager.php
Normal file
37
ext/admin/loans/api/LoansAdminManager.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if (!class_exists('LoansAdminManager')) {
|
||||
class LoansAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
$this->addModelClass('CompanyLoan');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('CompanyLoan')) {
|
||||
class CompanyLoan extends ICEHRM_Record {
|
||||
var $_table = 'CompanyLoans';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
64
ext/admin/loans/index.php
Normal file
64
ext/admin/loans/index.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'CompanyLoans';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabCompanyLoan" href="#tabPageCompanyLoan">Loan Types</a></li>
|
||||
<li><a id="tabEmployeeCompanyLoan" href="#tabPageEmployeeCompanyLoan">Employee Loans</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageCompanyLoan">
|
||||
<div id="CompanyLoan" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="CompanyLoanForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageEmployeeCompanyLoan">
|
||||
<div id="EmployeeCompanyLoan" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="EmployeeCompanyLoanForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabCompanyLoan'] = new CompanyLoanAdapter('CompanyLoan','CompanyLoan');
|
||||
modJsList['tabEmployeeCompanyLoan'] = new EmployeeCompanyLoanAdapter('EmployeeCompanyLoan','EmployeeCompanyLoan');
|
||||
|
||||
var modJs = modJsList['tabCompanyLoan'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
102
ext/admin/loans/lib.js
Normal file
102
ext/admin/loans/lib.js
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* CompanyLoanAdapter
|
||||
*/
|
||||
|
||||
function CompanyLoanAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
CompanyLoanAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
CompanyLoanAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"details"
|
||||
];
|
||||
});
|
||||
|
||||
CompanyLoanAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Details"}
|
||||
];
|
||||
});
|
||||
|
||||
CompanyLoanAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text","validation":""}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
/*
|
||||
* EmployeeCompanyLoanAdapter
|
||||
*/
|
||||
|
||||
function EmployeeCompanyLoanAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EmployeeCompanyLoanAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
EmployeeCompanyLoanAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"employee",
|
||||
"loan",
|
||||
"start_date",
|
||||
"period_months",
|
||||
"currency",
|
||||
"amount",
|
||||
"status"
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeCompanyLoanAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Employee" },
|
||||
{ "sTitle": "Loan Type" },
|
||||
{ "sTitle": "Loan Start Date"},
|
||||
{ "sTitle": "Loan Period (Months)"},
|
||||
{ "sTitle": "Currency"},
|
||||
{ "sTitle": "Amount"},
|
||||
{ "sTitle": "Status"}
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeCompanyLoanAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}],
|
||||
[ "loan", {"label":"Loan Type","type":"select","remote-source":["CompanyLoan","id","name"]}],
|
||||
[ "start_date", {"label":"Loan Start Date","type":"date","validation":""}],
|
||||
[ "last_installment_date", {"label":"Last Installment Date","type":"date","validation":"none"}],
|
||||
[ "period_months", {"label":"Loan Period (Months)","type":"text","validation":"number"}],
|
||||
[ "currency", {"label":"Currency","type":"select2","remote-source":["CurrencyType","id","name"]}],
|
||||
[ "amount", {"label":"Loan Amount","type":"text","validation":"float"}],
|
||||
[ "monthly_installment", {"label":"Monthly Installment","type":"text","validation":"float"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Approved","Approved"],["Paid","Paid"],["Suspended","Suspended"]]}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeCompanyLoanAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "employee", {"label":"Employee","type":"select2","allow-null":true,"null-label":"All Employees","remote-source":["Employee","id","first_name+last_name"]}],
|
||||
[ "loan", {"label":"Loan Type","type":"select","allow-null":true,"null-label":"All Loan Types","remote-source":["CompanyLoan","id","name"]}],
|
||||
|
||||
];
|
||||
});
|
||||
11
ext/admin/loans/meta.json
Normal file
11
ext/admin/loans/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Company Loans",
|
||||
"menu":"Admin",
|
||||
"order":"7",
|
||||
"icon":"fa-shield",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
7
ext/admin/meta.json
Normal file
7
ext/admin/meta.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"Admin":"fa-cubes",
|
||||
"Employees":"fa-users",
|
||||
"Reports":"fa-file-text",
|
||||
"System":"fa-cogs",
|
||||
"Salary Details":"fa-money"
|
||||
}
|
||||
144
ext/admin/metadata/api/MetadataAdminManager.php
Normal file
144
ext/admin/metadata/api/MetadataAdminManager.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
if (!class_exists('MetadataAdminManager')) {
|
||||
|
||||
class MetadataAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
$this->addModelClass('Country');
|
||||
$this->addModelClass('Province');
|
||||
$this->addModelClass('CurrencyType');
|
||||
$this->addModelClass('Nationality');
|
||||
$this->addModelClass('ImmigrationStatus');
|
||||
$this->addModelClass('Ethnicity');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Country')) {
|
||||
class Country extends ICEHRM_Record {
|
||||
var $_table = 'Country';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Province')) {
|
||||
class Province extends ICEHRM_Record {
|
||||
var $_table = 'Province';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('CurrencyType')) {
|
||||
class CurrencyType extends ICEHRM_Record {
|
||||
var $_table = 'CurrencyTypes';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('Nationality')) {
|
||||
class Nationality extends ICEHRM_Record {
|
||||
var $_table = 'Nationality';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('ImmigrationStatus')) {
|
||||
class ImmigrationStatus extends ICEHRM_Record {
|
||||
var $_table = 'ImmigrationStatus';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('Ethnicity')) {
|
||||
class Ethnicity extends ICEHRM_Record {
|
||||
var $_table = 'Ethnicity';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
42
ext/admin/metadata/index.php
Normal file
42
ext/admin/metadata/index.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of Ice Framework.
|
||||
|
||||
Ice Framework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Ice Framework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Ice Framework. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'metadata';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
|
||||
$moduleBuilder = new ModuleBuilder();
|
||||
|
||||
$moduleBuilder->addModuleOrGroup(new ModuleTab('Country','Country','Countries','CountryAdapter','','',true));
|
||||
$moduleBuilder->addModuleOrGroup(new ModuleTab('Province','Province','Provinces','ProvinceAdapter','',''));
|
||||
$moduleBuilder->addModuleOrGroup(new ModuleTab('CurrencyType','CurrencyType','Currency Types','CurrencyTypeAdapter','',''));
|
||||
$moduleBuilder->addModuleOrGroup(new ModuleTab('Nationality','Nationality','Nationality','NationalityAdapter','',''));
|
||||
$moduleBuilder->addModuleOrGroup(new ModuleTab('Nationality','Nationality','Nationality','NationalityAdapter','',''));
|
||||
$moduleBuilder->addModuleOrGroup(new ModuleTab('Ethnicity','Ethnicity','Ethnicity','EthnicityAdapter','',''));
|
||||
$moduleBuilder->addModuleOrGroup(new ModuleTab('ImmigrationStatus','ImmigrationStatus','Immigration Status','ImmigrationStatusAdapter','',''));
|
||||
|
||||
|
||||
echo UIManager::getInstance()->renderModule($moduleBuilder);
|
||||
|
||||
include APP_BASE_PATH.'footer.php';
|
||||
158
ext/admin/metadata/lib.js
Normal file
158
ext/admin/metadata/lib.js
Normal file
@@ -0,0 +1,158 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* CountryAdapter
|
||||
*/
|
||||
|
||||
function CountryAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
CountryAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
CountryAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"code",
|
||||
"name"
|
||||
];
|
||||
});
|
||||
|
||||
CountryAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Code" },
|
||||
{ "sTitle": "Name"}
|
||||
];
|
||||
});
|
||||
|
||||
CountryAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "code", {"label":"Code","type":"text","validation":""}],
|
||||
[ "name", {"label":"Name","type":"text","validation":""}]
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* ProvinceAdapter
|
||||
*/
|
||||
|
||||
function ProvinceAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
ProvinceAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ProvinceAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"code",
|
||||
"name",
|
||||
"country"
|
||||
];
|
||||
});
|
||||
|
||||
ProvinceAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Code" },
|
||||
{ "sTitle": "Name"},
|
||||
{ "sTitle": "Country"},
|
||||
];
|
||||
});
|
||||
|
||||
ProvinceAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "code", {"label":"Code","type":"text","validation":""}],
|
||||
[ "name", {"label":"Name","type":"text","validation":""}],
|
||||
[ "country", {"label":"Country","type":"select2","remote-source":["Country","code","name"]}]
|
||||
];
|
||||
});
|
||||
|
||||
ProvinceAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "country", {"label":"Country","type":"select2","remote-source":["Country","code","name"]}]
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* CurrencyTypeAdapter
|
||||
*/
|
||||
|
||||
function CurrencyTypeAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
CurrencyTypeAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
CurrencyTypeAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"code",
|
||||
"name"
|
||||
];
|
||||
});
|
||||
|
||||
CurrencyTypeAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Code" },
|
||||
{ "sTitle": "Name"}
|
||||
];
|
||||
});
|
||||
|
||||
CurrencyTypeAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "code", {"label":"Code","type":"text","validation":""}],
|
||||
[ "name", {"label":"Name","type":"text","validation":""}]
|
||||
];
|
||||
});
|
||||
|
||||
/**
|
||||
* NationalityAdapter
|
||||
*/
|
||||
|
||||
function NationalityAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
NationalityAdapter.inherits(IdNameAdapter);
|
||||
|
||||
/**
|
||||
* ImmigrationStatusAdapter
|
||||
*/
|
||||
|
||||
function ImmigrationStatusAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
ImmigrationStatusAdapter.inherits(IdNameAdapter);
|
||||
|
||||
|
||||
/**
|
||||
* EthnicityAdapter
|
||||
*/
|
||||
|
||||
function EthnicityAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EthnicityAdapter.inherits(IdNameAdapter);
|
||||
|
||||
|
||||
|
||||
11
ext/admin/metadata/meta.json
Normal file
11
ext/admin/metadata/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Manage Metadata",
|
||||
"menu":"System",
|
||||
"order":"6",
|
||||
"icon":"fa-sort-alpha-asc",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
35
ext/admin/modules/api/ModulesAdminManager.php
Normal file
35
ext/admin/modules/api/ModulesAdminManager.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
if (!class_exists('ModulesAdminManager')) {
|
||||
class ModulesAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
$this->addModelClass('Module');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Module')) {
|
||||
class Module extends ICEHRM_Record {
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
var $_table = 'Modules';
|
||||
}
|
||||
}
|
||||
54
ext/admin/modules/index.php
Normal file
54
ext/admin/modules/index.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'Modules';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabModule" href="#tabPageModule">Modules</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageModule">
|
||||
<div id="Module" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="ModuleForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['moduleModule'] = new ModuleAdapter('Module','Module');
|
||||
modJsList['moduleModule'].setShowAddNew(false);
|
||||
var modJs = modJsList['moduleModule'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
78
ext/admin/modules/lib.js
Normal file
78
ext/admin/modules/lib.js
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* ModuleAdapter
|
||||
*/
|
||||
|
||||
function ModuleAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
ModuleAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ModuleAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"label",
|
||||
"menu",
|
||||
"mod_group",
|
||||
"mod_order",
|
||||
"status",
|
||||
"version",
|
||||
"update_path"
|
||||
];
|
||||
});
|
||||
|
||||
ModuleAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Menu" ,"bVisible":false},
|
||||
{ "sTitle": "Group"},
|
||||
{ "sTitle": "Order"},
|
||||
{ "sTitle": "Status"},
|
||||
{ "sTitle": "Version","bVisible":false},
|
||||
{ "sTitle": "Path" ,"bVisible":false}
|
||||
];
|
||||
});
|
||||
|
||||
ModuleAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "label", {"label":"Label","type":"text","validation":""}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Enabled","Enabled"],["Disabled","Disabled"]]}],
|
||||
[ "user_levels", {"label":"User Levels","type":"select2multi","source":[["Admin","Admin"],["Manager","Manager"],["Employee","Employee"],["Other","Other"]]}]
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
ModuleAdapter.method('getActionButtonsHtml', function(id,data) {
|
||||
|
||||
|
||||
var nonEditableFields = {};
|
||||
nonEditableFields["admin_Company Structure"] = 1;
|
||||
nonEditableFields["admin_Employees"] = 1;
|
||||
nonEditableFields["admin_Jobs"] = 1;
|
||||
nonEditableFields["admin_Leaves"] = 1;
|
||||
nonEditableFields["admin_Manage Modules"] = 1;
|
||||
nonEditableFields["admin_Projects"] = 1;
|
||||
nonEditableFields["admin_Qualifications"] = 1;
|
||||
nonEditableFields["admin_Settings"] = 1;
|
||||
nonEditableFields["admin_Users"] = 1;
|
||||
nonEditableFields["admin_Upgrade"] = 1;
|
||||
|
||||
nonEditableFields["user_Basic Information"] = 1;
|
||||
|
||||
if(nonEditableFields[data[3]+"_"+data[1]] == 1){
|
||||
return "";
|
||||
}
|
||||
var html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img></div>';
|
||||
html = html.replace(/_id_/g,id);
|
||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
||||
return html;
|
||||
});
|
||||
11
ext/admin/modules/meta.json
Normal file
11
ext/admin/modules/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Manage Modules",
|
||||
"menu":"System",
|
||||
"order":"3",
|
||||
"icon":"fa-folder-open",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
37
ext/admin/permissions/api/PermissionsAdminManager.php
Normal file
37
ext/admin/permissions/api/PermissionsAdminManager.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if (!class_exists('PermissionsAdminManager')) {
|
||||
class PermissionsAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
$this->addModelClass('Permission');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Permission')) {
|
||||
class Permission extends ICEHRM_Record {
|
||||
var $_table = 'Permissions';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
54
ext/admin/permissions/index.php
Normal file
54
ext/admin/permissions/index.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'Permissions';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabPermission" href="#tabPagePermission">Permissions</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPagePermission">
|
||||
<div id="Permission" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="PermissionForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabPermission'] = new PermissionAdapter('Permission','Permission');
|
||||
modJsList['tabPermission'].setShowAddNew(false);
|
||||
var modJs = modJsList['tabPermission'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
73
ext/admin/permissions/lib.js
Normal file
73
ext/admin/permissions/lib.js
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PermissionAdapter
|
||||
*/
|
||||
|
||||
function PermissionAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
PermissionAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
PermissionAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"user_level",
|
||||
"module_id",
|
||||
"permission",
|
||||
"value"
|
||||
];
|
||||
});
|
||||
|
||||
PermissionAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "User Level" },
|
||||
{ "sTitle": "Module"},
|
||||
{ "sTitle": "Permission"},
|
||||
{ "sTitle": "Value"}
|
||||
];
|
||||
});
|
||||
|
||||
PermissionAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "user_level", {"label":"User Level","type":"placeholder","validation":"none"}],
|
||||
[ "module_id", {"label":"Module","type":"placeholder","remote-source":["Module","id","menu+name"]}],
|
||||
[ "permission", {"label":"Permission","type":"placeholder","validation":"none"}],
|
||||
[ "value", {"label":"Value","type":"text","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
PermissionAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "module_id", {"label":"Module","type":"select2","allow-null":true,"null-label":"All Modules","remote-source":["Module","id","menu+name"]}]
|
||||
];
|
||||
});
|
||||
|
||||
PermissionAdapter.method('getActionButtonsHtml', function(id,data) {
|
||||
var html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img></div>';
|
||||
html = html.replace(/_id_/g,id);
|
||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
||||
return html;
|
||||
});
|
||||
|
||||
|
||||
PermissionAdapter.method('getMetaFieldForRendering', function(fieldName) {
|
||||
if(fieldName == "value"){
|
||||
return "meta";
|
||||
}
|
||||
return "";
|
||||
});
|
||||
|
||||
|
||||
PermissionAdapter.method('fillForm', function(object) {
|
||||
this.uber('fillForm',object);
|
||||
$("#helptext").html(object.description);
|
||||
});
|
||||
11
ext/admin/permissions/meta.json
Normal file
11
ext/admin/permissions/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Manage Permissions",
|
||||
"menu":"System",
|
||||
"order":"4",
|
||||
"icon":"fa-unlock",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
60
ext/admin/projects/api/ProjectsAdminManager.php
Normal file
60
ext/admin/projects/api/ProjectsAdminManager.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
if (!class_exists('ProjectsAdminManager')) {
|
||||
class ProjectsAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
$this->addDatabaseErrorMapping("key 'EmployeeProjectsKey'", "Employee already added to this project");
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
$this->addModelClass('Client');
|
||||
$this->addModelClass('Project');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('Client')) {
|
||||
class Client extends ICEHRM_Record {
|
||||
var $_table = 'Clients';
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Project')) {
|
||||
class Project extends ICEHRM_Record {
|
||||
var $_table = 'Projects';
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
}
|
||||
113
ext/admin/projects/index.php
Normal file
113
ext/admin/projects/index.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'projects';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabClient" href="#tabPageClient">Clients</a></li>
|
||||
<li><a id="tabProject" href="#tabPageProject">Projects</a></li>
|
||||
<li><a id="tabEmployeeProject" href="#tabPageEmployeeProject">Employee Projects</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageClient">
|
||||
<div id="Client" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="ClientForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageProject">
|
||||
<div id="Project" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="ProjectForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageEmployeeProject">
|
||||
<div id="EmployeeProject" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="EmployeeProjectForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabClient'] = new ClientAdapter('Client','Client');
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Clients']) && $modulePermissions['perm']['Add Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Delete Clients']) && $modulePermissions['perm']['Delete Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowDelete(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Edit Clients']) && $modulePermissions['perm']['Edit Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowSave(false);
|
||||
<?php }?>
|
||||
|
||||
modJsList['tabProject'] = new ProjectAdapter('Project','Project');
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Projects']) && $modulePermissions['perm']['Add Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Delete Projects']) && $modulePermissions['perm']['Delete Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowDelete(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Edit Projects']) && $modulePermissions['perm']['Edit Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowSave(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
modJsList['tabEmployeeProject'] = new EmployeeProjectAdapter('EmployeeProject','EmployeeProject');
|
||||
modJsList['tabEmployeeProject'].setRemoteTable(true);
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Projects']) && $modulePermissions['perm']['Add Projects'] == "No"){?>
|
||||
modJsList['tabEmployeeProject'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Delete Projects']) && $modulePermissions['perm']['Delete Projects'] == "No"){?>
|
||||
modJsList['tabEmployeeProject'].setShowDelete(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Edit Projects']) && $modulePermissions['perm']['Edit Projects'] == "No"){?>
|
||||
modJsList['tabEmployeeProject'].setShowEdit(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
var modJs = modJsList['tabClient'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
177
ext/admin/projects/lib.js
Normal file
177
ext/admin/projects/lib.js
Normal file
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClientAdapter
|
||||
*/
|
||||
|
||||
function ClientAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
ClientAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ClientAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"details",
|
||||
"address",
|
||||
"contact_number"
|
||||
];
|
||||
});
|
||||
|
||||
ClientAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Details"},
|
||||
{ "sTitle": "Address"},
|
||||
{ "sTitle": "Contact Number"}
|
||||
];
|
||||
});
|
||||
|
||||
ClientAdapter.method('getFormFields', function() {
|
||||
if(this.showSave){
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
||||
[ "address", {"label":"Address","type":"textarea","validation":"none"}],
|
||||
[ "contact_number", {"label":"Contact Number","type":"text","validation":"none"}],
|
||||
[ "contact_email", {"label":"Contact Email","type":"text","validation":"none"}],
|
||||
[ "company_url", {"label":"Company Url","type":"text","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"]]}],
|
||||
[ "first_contact_date", {"label":"First Contact Date","type":"date","validation":"none"}]
|
||||
];
|
||||
}else{
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"placeholder"}],
|
||||
[ "details", {"label":"Details","type":"placeholder","validation":"none"}],
|
||||
[ "address", {"label":"Address","type":"placeholder","validation":"none"}],
|
||||
[ "contact_number", {"label":"Contact Number","type":"placeholder","validation":"none"}],
|
||||
[ "contact_email", {"label":"Contact Email","type":"placeholder","validation":"none"}],
|
||||
[ "company_url", {"label":"Company Url","type":"placeholder","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"placeholder","source":[["Active","Active"],["Inactive","Inactive"]]}],
|
||||
[ "first_contact_date", {"label":"First Contact Date","type":"placeholder","validation":"none"}]
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
ClientAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=85';
|
||||
});
|
||||
|
||||
/**
|
||||
* ProjectAdapter
|
||||
*/
|
||||
|
||||
function ProjectAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
ProjectAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ProjectAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"client"
|
||||
];
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Client"},
|
||||
];
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getFormFields', function() {
|
||||
if(this.showSave){
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "client", {"label":"Client","type":"select2","allow-null":true,"remote-source":["Client","id","name"]}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"]]}]
|
||||
];
|
||||
}else{
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"placeholder"}],
|
||||
[ "client", {"label":"Client","type":"placeholder","allow-null":true,"remote-source":["Client","id","name"]}],
|
||||
[ "details", {"label":"Details","type":"placeholder","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"placeholder","source":[["Active","Active"],["Inactive","Inactive"]]}]
|
||||
];
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=85';
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* EmployeeProjectAdapter
|
||||
*/
|
||||
|
||||
|
||||
function EmployeeProjectAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EmployeeProjectAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
EmployeeProjectAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"employee",
|
||||
"project",
|
||||
"status"
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Employee" },
|
||||
{ "sTitle": "Project" },
|
||||
/*{ "sTitle": "Start Date"},*/
|
||||
{ "sTitle": "Status"}
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}],
|
||||
[ "project", {"label":"Project","type":"select2","remote-source":["Project","id","name"]}],
|
||||
/*[ "date_start", {"label":"Start Date","type":"date","validation":""}],
|
||||
[ "date_end", {"label":"End Date","type":"date","validation":"none"}],*/
|
||||
[ "status", {"label":"Status","type":"select","source":[["Current","Current"],["Inactive","Inactive"],["Completed","Completed"]]}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}]
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=85';
|
||||
});
|
||||
|
||||
19
ext/admin/projects/meta.json
Normal file
19
ext/admin/projects/meta.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"label":"Projects/Client Setup",
|
||||
"menu":"Admin",
|
||||
"order":"5",
|
||||
"icon":"fa-list-alt",
|
||||
"user_levels":["Admin","Manager"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
"Manager":{
|
||||
"Add Projects":"Yes",
|
||||
"Edit Projects":"Yes",
|
||||
"Delete Projects":"No",
|
||||
"Add Clients":"Yes",
|
||||
"Edit Clients":"Yes",
|
||||
"Delete Clients":"No"
|
||||
}
|
||||
}
|
||||
}
|
||||
95
ext/admin/qualifications/api/QualificationsAdminManager.php
Normal file
95
ext/admin/qualifications/api/QualificationsAdminManager.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
if (!class_exists('QualificationsAdminManager')) {
|
||||
class QualificationsAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
$this->addModelClass('Skill');
|
||||
$this->addModelClass('Education');
|
||||
$this->addModelClass('Certification');
|
||||
$this->addModelClass('Language');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('Skill')) {
|
||||
class Skill extends ICEHRM_Record {
|
||||
var $_table = 'Skills';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
class Education extends ICEHRM_Record {
|
||||
var $_table = 'Educations';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
class Certification extends ICEHRM_Record {
|
||||
var $_table = 'Certifications';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
class Language extends ICEHRM_Record {
|
||||
var $_table = 'Languages';
|
||||
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
127
ext/admin/qualifications/index.php
Normal file
127
ext/admin/qualifications/index.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'company_structure';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabSkill" href="#tabPageSkill">Skills</a></li>
|
||||
<li><a id="tabEducation" href="#tabPageEducation">Education</a></li>
|
||||
<li><a id="tabCertification" href="#tabPageCertification">Certifications</a></li>
|
||||
<li><a id="tabLanguage" href="#tabPageLanguage">Languages</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageSkill">
|
||||
<div id="Skill" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="SkillForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageEducation">
|
||||
<div id="Education" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="EducationForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageCertification">
|
||||
<div id="Certification" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="CertificationForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageLanguage">
|
||||
<div id="Language" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="LanguageForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabSkill'] = new SkillAdapter('Skill');
|
||||
<?php if(isset($modulePermissions['perm']['Add Skills']) && $modulePermissions['perm']['Add Skills'] == "No"){?>
|
||||
modJsList['tabSkill'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Delete Skills']) && $modulePermissions['perm']['Delete Skills'] == "No"){?>
|
||||
modJsList['tabSkill'].setShowDelete(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Edit Skills']) && $modulePermissions['perm']['Edit Skills'] == "No"){?>
|
||||
modJsList['tabSkill'].setShowEdit(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
modJsList['tabEducation'] = new EducationAdapter('Education');
|
||||
<?php if(isset($modulePermissions['perm']['Add Education']) && $modulePermissions['perm']['Add Education'] == "No"){?>
|
||||
modJsList['tabEducation'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Delete Education']) && $modulePermissions['perm']['Delete Education'] == "No"){?>
|
||||
modJsList['tabEducation'].setShowDelete(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Edit Education']) && $modulePermissions['perm']['Edit Education'] == "No"){?>
|
||||
modJsList['tabEducation'].setShowEdit(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
|
||||
modJsList['tabCertification'] = new CertificationAdapter('Certification');
|
||||
<?php if(isset($modulePermissions['perm']['Add Certifications']) && $modulePermissions['perm']['Add Certifications'] == "No"){?>
|
||||
modJsList['tabCertification'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Delete Certifications']) && $modulePermissions['perm']['Delete Certifications'] == "No"){?>
|
||||
modJsList['tabCertification'].setShowDelete(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Edit Certifications']) && $modulePermissions['perm']['Edit Certifications'] == "No"){?>
|
||||
modJsList['tabCertification'].setShowEdit(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
modJsList['tabLanguage'] = new LanguageAdapter('Language');
|
||||
<?php if(isset($modulePermissions['perm']['Add Languages']) && $modulePermissions['perm']['Add Languages'] == "No"){?>
|
||||
modJsList['tabLanguage'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Delete Languages']) && $modulePermissions['perm']['Delete Languages'] == "No"){?>
|
||||
modJsList['tabLanguage'].setShowDelete(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Edit Languages']) && $modulePermissions['perm']['Edit Languages'] == "No"){?>
|
||||
modJsList['tabLanguage'].setShowEdit(false);
|
||||
<?php }?>
|
||||
|
||||
var modJs = modJsList['tabSkill'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
161
ext/admin/qualifications/lib.js
Normal file
161
ext/admin/qualifications/lib.js
Normal file
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* SkillAdapter
|
||||
*/
|
||||
|
||||
function SkillAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
SkillAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
SkillAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"description"
|
||||
];
|
||||
});
|
||||
|
||||
SkillAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Description"}
|
||||
];
|
||||
});
|
||||
|
||||
SkillAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "description", {"label":"Description","type":"textarea","validation":""}]
|
||||
];
|
||||
});
|
||||
|
||||
SkillAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=83';
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* EducationAdapter
|
||||
*/
|
||||
|
||||
function EducationAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EducationAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
EducationAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"description"
|
||||
];
|
||||
});
|
||||
|
||||
EducationAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Description"}
|
||||
];
|
||||
});
|
||||
|
||||
EducationAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "description", {"label":"Description","type":"textarea","validation":""}]
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* CertificationAdapter
|
||||
*/
|
||||
|
||||
function CertificationAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
CertificationAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
CertificationAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"description"
|
||||
];
|
||||
});
|
||||
|
||||
CertificationAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Description"}
|
||||
];
|
||||
});
|
||||
|
||||
CertificationAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "description", {"label":"Description","type":"textarea","validation":""}]
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* LanguageAdapter
|
||||
*/
|
||||
|
||||
function LanguageAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
LanguageAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
LanguageAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"description"
|
||||
];
|
||||
});
|
||||
|
||||
LanguageAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Description"}
|
||||
];
|
||||
});
|
||||
|
||||
LanguageAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "description", {"label":"Description","type":"textarea","validation":""}]
|
||||
];
|
||||
});
|
||||
|
||||
26
ext/admin/qualifications/meta.json
Normal file
26
ext/admin/qualifications/meta.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"label":"Qualifications Setup",
|
||||
"menu":"Admin",
|
||||
"order":"4",
|
||||
"icon":"fa-check-square-o",
|
||||
|
||||
"user_levels":["Admin","Manager"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
"Manager":{
|
||||
"Add Skills":"Yes",
|
||||
"Edit Skills":"Yes",
|
||||
"Delete Skills":"No",
|
||||
"Add Education":"Yes",
|
||||
"Edit Education":"Yes",
|
||||
"Delete Education":"No",
|
||||
"Add Certifications":"Yes",
|
||||
"Edit Certifications":"Yes",
|
||||
"Delete Certifications":"No",
|
||||
"Add Languages":"Yes",
|
||||
"Edit Languages":"Yes",
|
||||
"Delete Languages":"No"
|
||||
}
|
||||
}
|
||||
}
|
||||
23
ext/admin/reports/api/ReportsAdminManager.php
Normal file
23
ext/admin/reports/api/ReportsAdminManager.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
if (!class_exists('ReportsAdminManager')) {
|
||||
class ReportsAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
//This is a fixed module, store model classes in models.inc.php
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
34
ext/admin/reports/index.php
Normal file
34
ext/admin/reports/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
$moduleName = 'Reports';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabReport" href="#tabPageReport">Reports</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageReport">
|
||||
<div id="Report" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="ReportForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabReport'] = new ReportAdapter('Report','Report');
|
||||
modJsList['tabReport'].setShowAddNew(false);
|
||||
|
||||
var modJs = modJsList['tabReport'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
167
ext/admin/reports/lib.js
Normal file
167
ext/admin/reports/lib.js
Normal file
@@ -0,0 +1,167 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* ReportAdapter
|
||||
*/
|
||||
|
||||
function ReportAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
this._formFileds = [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"label","validation":""}],
|
||||
[ "parameters", {"label":"Parameters","type":"fieldset","validation":"none"}]
|
||||
];
|
||||
}
|
||||
|
||||
ReportAdapter.inherits(AdapterBase);
|
||||
|
||||
ReportAdapter.method('_initLocalFormFields', function() {
|
||||
this._formFileds = [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"label","validation":""}],
|
||||
[ "parameters", {"label":"Parameters","type":"fieldset","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
ReportAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"details",
|
||||
"parameters"
|
||||
];
|
||||
});
|
||||
|
||||
ReportAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Details"},
|
||||
{ "sTitle": "Parameters","bVisible":false},
|
||||
];
|
||||
});
|
||||
|
||||
ReportAdapter.method('getFormFields', function() {
|
||||
return this._formFileds;
|
||||
});
|
||||
|
||||
ReportAdapter.method('processFormFieldsWithObject', function(object) {
|
||||
var that = this;
|
||||
this._initLocalFormFields();
|
||||
var len = this._formFileds.length;
|
||||
var fieldIDsToDelete = [];
|
||||
var fieldsToDelete = [];
|
||||
for(var i=0;i<len;i++){
|
||||
if(this._formFileds[i][1]['type']=="fieldset"){
|
||||
var newFields = JSON.parse(object[this._formFileds[i][0]]);
|
||||
fieldsToDelete.push(this._formFileds[i][0]);
|
||||
newFields.forEach(function(entry) {
|
||||
that._formFileds.push(entry);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var tempArray = [];
|
||||
that._formFileds.forEach(function(entry) {
|
||||
if(jQuery.inArray(entry[0], fieldsToDelete) < 0){
|
||||
tempArray.push(entry);
|
||||
}
|
||||
});
|
||||
|
||||
that._formFileds = tempArray;
|
||||
});
|
||||
|
||||
ReportAdapter.method('renderForm', function(object) {
|
||||
var that = this;
|
||||
this.processFormFieldsWithObject(object);
|
||||
var cb = function(){
|
||||
that.uber('renderForm',object);
|
||||
};
|
||||
this.initFieldMasterData(cb);
|
||||
|
||||
});
|
||||
|
||||
ReportAdapter.method('getActionButtonsHtml', function(id,data) {
|
||||
var html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/download.png" style="cursor:pointer;" rel="tooltip" title="Download" onclick="modJs.edit(_id_);return false;"></img></div>';
|
||||
html = html.replace(/_id_/g,id);
|
||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
||||
return html;
|
||||
});
|
||||
|
||||
ReportAdapter.method('addSuccessCallBack', function(callBackData,serverData) {
|
||||
//var link = '<a href="'+this.getCustomActionUrl("download",{'file':serverData})+'" target="_blank">Download Report <i class="icon-download-alt"></i> </a>';
|
||||
//this.showMessage("Download Report",link);
|
||||
|
||||
var fileName = serverData[0];
|
||||
var link;
|
||||
|
||||
if(fileName.indexOf("https:") == 0){
|
||||
link = '<a href="'+fileName+'" target="_blank" style="font-size:14px;font-weight:bold;">Download Report <img src="_BASE_images/download.png"></img> </a>';
|
||||
}else{
|
||||
link = '<a href="'+modJs.getCustomActionUrl("download",{'file':fileName})+'" target="_blank" style="font-size:14px;font-weight:bold;">Download Report <img src="_BASE_images/download.png"></img> </a>';
|
||||
}
|
||||
link = link.replace(/_BASE_/g,this.baseUrl);
|
||||
|
||||
var tableHtml = link+'<br/><br/><div class="box-body table-responsive" style="overflow-x:scroll;padding: 5px;border: solid 1px #DDD;"><table id="tempReportTable" cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-striped"></table></div>';
|
||||
|
||||
//Delete existing temp report table
|
||||
$("#tempReportTable").remove();
|
||||
|
||||
//this.showMessage("Report",tableHtml);
|
||||
|
||||
$("#Report").html(tableHtml);
|
||||
$("#Report").show();
|
||||
$("#ReportForm").hide();
|
||||
|
||||
//Prepare headers
|
||||
var headers = [];
|
||||
for(title in serverData[1]){
|
||||
headers.push({ "sTitle": serverData[1][title]});
|
||||
}
|
||||
|
||||
var data = serverData[2];
|
||||
|
||||
|
||||
var dataTableParams = {
|
||||
"oLanguage": {
|
||||
"sLengthMenu": "_MENU_ records per page"
|
||||
},
|
||||
"aaData": data,
|
||||
"aoColumns": headers,
|
||||
"bSort": false,
|
||||
"iDisplayLength": 15,
|
||||
"iDisplayStart": 0
|
||||
};
|
||||
|
||||
$("#tempReportTable").dataTable( dataTableParams );
|
||||
|
||||
$(".dataTables_paginate ul").addClass("pagination");
|
||||
$(".dataTables_length").hide();
|
||||
$(".dataTables_filter input").addClass("form-control");
|
||||
$(".dataTables_filter input").attr("placeholder","Search");
|
||||
$(".dataTables_filter label").contents().filter(function(){
|
||||
return (this.nodeType == 3);
|
||||
}).remove();
|
||||
$('.tableActionButton').tooltip();
|
||||
});
|
||||
|
||||
|
||||
ReportAdapter.method('fillForm', function(object) {
|
||||
var fields = this.getFormFields();
|
||||
for(var i=0;i<fields.length;i++) {
|
||||
if(fields[i][1].type == 'label'){
|
||||
$("#"+this.getTableName()+'Form #'+fields[i][0]).html(object[fields[i][0]]);
|
||||
}else{
|
||||
$("#"+this.getTableName()+'Form #'+fields[i][0]).val(object[fields[i][0]]);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ReportAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=118';
|
||||
});
|
||||
11
ext/admin/reports/meta.json
Normal file
11
ext/admin/reports/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Reports",
|
||||
"menu":"Reports",
|
||||
"order":"1",
|
||||
"icon":"fa-file-o",
|
||||
"user_levels":["Admin","Manager"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
88
ext/admin/reports/reportClasses/ActiveEmployeeReport.php
Normal file
88
ext/admin/reports/reportClasses/ActiveEmployeeReport.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
if(!class_exists('ReportBuilder')){
|
||||
include_once MODULE_PATH.'/reportClasses/ReportBuilder.php';
|
||||
}
|
||||
class ActiveEmployeeReport extends ReportBuilder{
|
||||
|
||||
public function getMainQuery(){
|
||||
$query = "Select id, employee_id as 'Employee ID',
|
||||
concat(`first_name`,' ',`middle_name`,' ', `last_name`) as 'Name',
|
||||
(SELECT name from Nationality where id = nationality) as 'Nationality',
|
||||
birthday as 'Birthday',
|
||||
gender as 'Gender',
|
||||
marital_status as 'Marital Status',
|
||||
ssn_num as 'SSN Number',
|
||||
nic_num as 'NIC Number',
|
||||
other_id as 'Other IDs',
|
||||
driving_license as 'Driving License Number',
|
||||
(SELECT name from EmploymentStatus where id = employment_status) as 'Employment Status',
|
||||
(SELECT name from JobTitles where id = job_title) as 'Job Title',
|
||||
(SELECT name from PayGrades where id = pay_grade) as 'Pay Grade',
|
||||
work_station_id as 'Work Station ID',
|
||||
address1 as 'Address 1',
|
||||
address2 as 'Address 2',
|
||||
city as 'City',
|
||||
(SELECT name from Country where code = country) as 'Country',
|
||||
(SELECT name from Province where id = province) as 'Province',
|
||||
postal_code as 'Postal Code',
|
||||
home_phone as 'Home Phone',
|
||||
mobile_phone as 'Mobile Phone',
|
||||
work_phone as 'Work Phone',
|
||||
work_email as 'Work Email',
|
||||
private_email as 'Private Email',
|
||||
joined_date as 'Joined Date',
|
||||
confirmation_date as 'Confirmation Date',
|
||||
(SELECT title from CompanyStructures where id = department) as 'Department',
|
||||
(SELECT concat(`first_name`,' ',`middle_name`,' ', `last_name`,' [Employee ID:',`employee_id`,']') from Employees e1 where e1.id = e.supervisor) as 'Supervisor', notes as 'Notes'
|
||||
FROM Employees e";
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
public function getWhereQuery($request){
|
||||
$query = "";
|
||||
$params = array();
|
||||
|
||||
if(empty($request['department']) || $request['department'] == "NULL"){
|
||||
$params = array();
|
||||
$query = "where ((termination_date = '0001-01-01 00:00:00' or termination_date = '0000-00-00 00:00:00') and joined_date < NOW()) or (termination_date > NOW() and joined_date < NOW())";
|
||||
}else{
|
||||
$depts = $this->getChildCompanyStuctures($request['department']);
|
||||
$query = "where department in (".implode(",",$depts).") and (((termination_date = '0001-01-01 00:00:00' or termination_date = '0000-00-00 00:00:00') and joined_date < NOW()) or (termination_date > NOW() and joined_date < NOW()))";
|
||||
}
|
||||
|
||||
|
||||
return array($query, $params);
|
||||
}
|
||||
|
||||
public function getChildCompanyStuctures($companyStructId){
|
||||
$childIds = array();
|
||||
$childIds[] = $companyStructId;
|
||||
$nodeIdsAtLastLevel = $childIds;
|
||||
$count = 0;
|
||||
do{
|
||||
$count++;
|
||||
$companyStructTemp = new CompanyStructure();
|
||||
if(empty($nodeIdsAtLastLevel) || empty($childIds)){
|
||||
break;
|
||||
}
|
||||
$idQuery = "parent in (".implode(",",$nodeIdsAtLastLevel).") and id not in(".implode(",",$childIds).")";
|
||||
LogManager::getInstance()->debug($idQuery);
|
||||
$list = $companyStructTemp->Find($idQuery, array());
|
||||
if(!$list){
|
||||
LogManager::getInstance()->debug($companyStructTemp->ErrorMsg());
|
||||
}
|
||||
$nodeIdsAtLastLevel = array();
|
||||
foreach($list as $item){
|
||||
$childIds[] = $item->id;
|
||||
$nodeIdsAtLastLevel[] = $item->id;
|
||||
}
|
||||
}while(count($list) > 0 && $count < 10);
|
||||
|
||||
return $childIds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
50
ext/admin/reports/reportClasses/EmployeeAttendanceReport.php
Normal file
50
ext/admin/reports/reportClasses/EmployeeAttendanceReport.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
if(!class_exists('ReportBuilder')){
|
||||
include_once MODULE_PATH.'/reportClasses/ReportBuilder.php';
|
||||
}
|
||||
class EmployeeAttendanceReport extends ReportBuilder{
|
||||
|
||||
public function getMainQuery(){
|
||||
$query = "SELECT
|
||||
(SELECT `employee_id` from Employees where id = at.employee) as 'Employee',
|
||||
(SELECT concat(`first_name`,' ',`middle_name`,' ', `last_name`) from Employees where id = at.employee) as 'Employee',
|
||||
in_time as 'Time In',
|
||||
out_time as 'Time Out',
|
||||
note as 'Note'
|
||||
FROM Attendance at";
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
public function getWhereQuery($request){
|
||||
|
||||
$employeeList = array();
|
||||
if(!empty($request['employee'])){
|
||||
$employeeList = json_decode($request['employee'],true);
|
||||
}
|
||||
|
||||
if(in_array("NULL", $employeeList) ){
|
||||
$employeeList = array();
|
||||
}
|
||||
|
||||
if(!empty($employeeList)){
|
||||
$query = "where employee in (".implode(",", $employeeList).") and in_time >= ? and out_time <= ? order by in_time desc;";
|
||||
$params = array(
|
||||
$request['date_start']." 00:00:00",
|
||||
$request['date_end']." 23:59:59",
|
||||
);
|
||||
}else{
|
||||
$query = "where in_time >= ? and out_time <= ? order by in_time desc;";
|
||||
$params = array(
|
||||
$request['date_start']." 00:00:00",
|
||||
$request['date_end']." 23:59:59",
|
||||
);
|
||||
}
|
||||
|
||||
LogManager::getInstance()->info("Query:".$query);
|
||||
LogManager::getInstance()->info("Params:".json_encode($params));
|
||||
|
||||
return array($query, $params);
|
||||
}
|
||||
}
|
||||
70
ext/admin/reports/reportClasses/EmployeeLeavesReport.php
Normal file
70
ext/admin/reports/reportClasses/EmployeeLeavesReport.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
if(!class_exists('ReportBuilder')){
|
||||
include_once MODULE_PATH.'/reportClasses/ReportBuilder.php';
|
||||
}
|
||||
class EmployeeLeavesReport extends ReportBuilder{
|
||||
|
||||
public function getMainQuery(){
|
||||
$query = "SELECT
|
||||
(SELECT concat(`first_name`,' ',`middle_name`,' ', `last_name`) from Employees where id = employee) as 'Employee',
|
||||
(SELECT name from LeaveTypes where id = leave_type) as 'Leave Type',
|
||||
(SELECT name from LeavePeriods where id = leave_type) as 'Leave Type',
|
||||
date_start as 'Start Date',
|
||||
date_end as 'End Date',
|
||||
details as 'Reason',
|
||||
status as 'Leave Status',
|
||||
(select count(*) from EmployeeLeaveDays d where d.employee_leave = lv.id and leave_type = 'Full Day') as 'Full Day Count',
|
||||
(select count(*) from EmployeeLeaveDays d where d.employee_leave = lv.id and leave_type = 'Half Day - Morning') as 'Half Day (Morning) Count',
|
||||
(select count(*) from EmployeeLeaveDays d where d.employee_leave = lv.id and leave_type = 'Half Day - Afternoon') as 'Half Day (Afternoon) Count'
|
||||
from EmployeeLeaves lv";
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
public function getWhereQuery($request){
|
||||
|
||||
$employeeList = array();
|
||||
if(!empty($request['employee'])){
|
||||
$employeeList = json_decode($request['employee'],true);
|
||||
}
|
||||
|
||||
if(in_array("NULL", $employeeList) ){
|
||||
$employeeList = array();
|
||||
}
|
||||
|
||||
|
||||
if(!empty($employeeList) && ($request['status'] != "NULL" && !empty($request['status']))){
|
||||
$query = "where employee in (".implode(",", $employeeList).") and date_start >= ? and date_end <= ? and status = ?;";
|
||||
$params = array(
|
||||
$request['date_start'],
|
||||
$request['date_end'],
|
||||
$request['status']
|
||||
);
|
||||
}else if(!empty($employeeList)){
|
||||
$query = "where employee in (".implode(",", $employeeList).") and date_start >= ? and date_end <= ?;";
|
||||
$params = array(
|
||||
$request['date_start'],
|
||||
$request['date_end']
|
||||
);
|
||||
}else if(($request['status'] != "NULL" && !empty($request['status']))){
|
||||
$query = "where status = ? and date_start >= ? and date_end <= ?;";
|
||||
$params = array(
|
||||
$request['status'],
|
||||
$request['date_start'],
|
||||
$request['date_end']
|
||||
);
|
||||
}else{
|
||||
$query = "where date_start >= ? and date_end <= ?;";
|
||||
$params = array(
|
||||
$request['date_start'],
|
||||
$request['date_end']
|
||||
);
|
||||
}
|
||||
|
||||
LogManager::getInstance()->info("Query:".$query);
|
||||
LogManager::getInstance()->info("Params:".json_encode($params));
|
||||
|
||||
return array($query, $params);
|
||||
}
|
||||
}
|
||||
104
ext/admin/reports/reportClasses/EmployeeTimeTrackReport.php
Normal file
104
ext/admin/reports/reportClasses/EmployeeTimeTrackReport.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
if(!interface_exists('ReportBuilderInterface')){
|
||||
include_once MODULE_PATH.'/reportClasses/ReportBuilderInterface.php';
|
||||
}
|
||||
class EmployeeTimeTrackReport implements ReportBuilderInterface{
|
||||
public function getData($report,$req){
|
||||
|
||||
LogManager::getInstance()->info(json_encode($report));
|
||||
LogManager::getInstance()->info(json_encode($req));
|
||||
|
||||
$employeeTimeEntry = new EmployeeTimeEntry();
|
||||
|
||||
$timeEntryList = $employeeTimeEntry->Find("employee = ? and date(date_start) >= ? and date(date_end) <= ?",array($req['employee'], $req['date_start'], $req['date_end']));
|
||||
|
||||
|
||||
$seconds = 0;
|
||||
$graphTimeArray = array();
|
||||
foreach($timeEntryList as $entry){
|
||||
$seconds = (strtotime($entry->date_end) - strtotime($entry->date_start));
|
||||
$key = date("Y-m-d",strtotime($entry->date_end));
|
||||
if(isset($graphTimeArray[$key])){
|
||||
$graphTimeArray[$key] += $seconds;
|
||||
}else{
|
||||
$graphTimeArray[$key] = $seconds;
|
||||
}
|
||||
}
|
||||
|
||||
//$minutes = (int)($seconds/60);
|
||||
|
||||
|
||||
//Find Attendance Entries
|
||||
|
||||
$attendance = new Attendance();
|
||||
$atteandanceList = $attendance->Find("employee = ? and date(in_time) >= ? and date(out_time) <= ? and in_time < out_time",array($req['employee'], $req['date_start'], $req['date_end']));
|
||||
|
||||
$seconds = 0;
|
||||
$graphAttendanceArray = array();
|
||||
$firstTimeInArray = array();
|
||||
$lastTimeOutArray = array();
|
||||
foreach($atteandanceList as $entry){
|
||||
$seconds = (strtotime($entry->out_time) - strtotime($entry->in_time));
|
||||
$key = date("Y-m-d",strtotime($entry->in_time));
|
||||
if(isset($graphAttendanceArray[$key])){
|
||||
$graphAttendanceArray[$key] += $seconds;
|
||||
$lastTimeOutArray[$key] = $entry->out_time;
|
||||
}else{
|
||||
$graphAttendanceArray[$key] = $seconds;
|
||||
$firstTimeInArray[$key] = $entry->in_time;
|
||||
$lastTimeOutArray[$key] = $entry->out_time;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
|
||||
$employeeObject = new Employee();
|
||||
$employeeObject->Load("id = ?",array($req['employee']));
|
||||
|
||||
|
||||
$reportData = array();
|
||||
//$reportData[] = array($employeeObject->first_name." ".$employeeObject->last_name,"","","","");
|
||||
$reportData[] = array("Date","First Punch-In Time","Last Punch-Out Time","Time in Office","Time in Timesheets");
|
||||
|
||||
|
||||
//Iterate date range
|
||||
|
||||
$interval = DateInterval::createFromDateString('1 day');
|
||||
$period = new DatePeriod(new DateTime($req['date_start']), $interval, new DateTime($req['date_end']));
|
||||
|
||||
foreach ( $period as $dt ){
|
||||
$dataRow = array();
|
||||
$key = $dt->format("Y-m-d");
|
||||
|
||||
$dataRow[] = $key;
|
||||
|
||||
if(isset($firstTimeInArray[$key])){
|
||||
$dataRow[] = $firstTimeInArray[$key];
|
||||
}else{
|
||||
$dataRow[] = "Not Found";
|
||||
}
|
||||
|
||||
if(isset($lastTimeOutArray[$key])){
|
||||
$dataRow[] = $lastTimeOutArray[$key];
|
||||
}else{
|
||||
$dataRow[] = "Not Found";
|
||||
}
|
||||
|
||||
if(isset($graphAttendanceArray[$key])){
|
||||
$dataRow[] = round(($graphAttendanceArray[$key]/3600),2);
|
||||
}else{
|
||||
$dataRow[] = 0;
|
||||
}
|
||||
|
||||
if(isset($graphTimeArray[$key])){
|
||||
$dataRow[] = round(($graphTimeArray[$key]/3600),2);
|
||||
}else{
|
||||
$dataRow[] = 0;
|
||||
}
|
||||
|
||||
$reportData[] = $dataRow;
|
||||
}
|
||||
return $reportData;
|
||||
}
|
||||
}
|
||||
66
ext/admin/reports/reportClasses/EmployeeTimesheetReport.php
Normal file
66
ext/admin/reports/reportClasses/EmployeeTimesheetReport.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
if(!class_exists('ReportBuilder')){
|
||||
include_once MODULE_PATH.'/reportClasses/ReportBuilder.php';
|
||||
}
|
||||
class EmployeeTimesheetReport extends ReportBuilder{
|
||||
|
||||
public function getMainQuery(){
|
||||
$query = "SELECT
|
||||
(SELECT concat(`first_name`,' ',`middle_name`,' ', `last_name`) from Employees where id = te.employee) as 'Employee',
|
||||
(SELECT name from Projects where id = te.project) as 'Project',
|
||||
details as 'Details',
|
||||
date_start as 'Start Time',
|
||||
date_end as 'End Time',
|
||||
SEC_TO_TIME(TIMESTAMPDIFF(SECOND,te.date_start,te.date_end)) as 'Duration'
|
||||
FROM EmployeeTimeEntry te";
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
public function getWhereQuery($request){
|
||||
|
||||
$employeeList = array();
|
||||
if(!empty($request['employee'])){
|
||||
$employeeList = json_decode($request['employee'],true);
|
||||
}
|
||||
|
||||
if(in_array("NULL", $employeeList) ){
|
||||
$employeeList = array();
|
||||
}
|
||||
|
||||
|
||||
if(!empty($employeeList) && ($request['project'] != "NULL" && !empty($request['project']))){
|
||||
$query = "where employee in (".implode(",", $employeeList).") and date_start >= ? and date_end <= ? and project = ?;";
|
||||
$params = array(
|
||||
$request['date_start'],
|
||||
$request['date_end'],
|
||||
$request['project']
|
||||
);
|
||||
}else if(!empty($employeeList)){
|
||||
$query = "where employee in (".implode(",", $employeeList).") and date_start >= ? and date_end <= ?;";
|
||||
$params = array(
|
||||
$request['date_start'],
|
||||
$request['date_end']
|
||||
);
|
||||
}else if(($request['project'] != "NULL" && !empty($request['project']))){
|
||||
$query = "where project = ? and date_start >= ? and date_end <= ?;";
|
||||
$params = array(
|
||||
$request['project'],
|
||||
$request['date_start'],
|
||||
$request['date_end']
|
||||
);
|
||||
}else{
|
||||
$query = "where date_start >= ? and date_end <= ?;";
|
||||
$params = array(
|
||||
$request['date_start'],
|
||||
$request['date_end']
|
||||
);
|
||||
}
|
||||
|
||||
LogManager::getInstance()->info("Query:".$query);
|
||||
LogManager::getInstance()->info("Params:".json_encode($params));
|
||||
|
||||
return array($query, $params);
|
||||
}
|
||||
}
|
||||
34
ext/admin/reports/reportClasses/NewHiresEmployeeReport.php
Normal file
34
ext/admin/reports/reportClasses/NewHiresEmployeeReport.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
if(!class_exists('ActiveEmployeeReport')){
|
||||
include_once MODULE_PATH.'/reportClasses/ActiveEmployeeReport.php';
|
||||
}
|
||||
class NewHiresEmployeeReport extends ActiveEmployeeReport{
|
||||
|
||||
|
||||
public function getWhereQuery($request){
|
||||
$query = "where ";
|
||||
$params = array();
|
||||
if(!empty($request['department']) && $request['department'] != "NULL"){
|
||||
$depts = $this->getChildCompanyStuctures($request['department']);
|
||||
$query.="department in(".implode(",",$depts).") and ";
|
||||
}
|
||||
|
||||
if(empty($request['date_start']) || $request['date_start'] == "NULL"){
|
||||
$request['date_start'] = date("Y-m-d 00:00:00");
|
||||
}
|
||||
|
||||
if(empty($request['date_end']) || $request['date_end'] == "NULL"){
|
||||
$request['date_end'] = date("Y-m-d 23:59:59");
|
||||
}
|
||||
|
||||
$query.="joined_date >= ? ";
|
||||
$params[] = $request['date_start']." 00:00:00";
|
||||
|
||||
|
||||
|
||||
$query.="and joined_date <= ? ";
|
||||
$params[] = $request['date_end']." 23:59:59";
|
||||
|
||||
return array($query, $params);
|
||||
}
|
||||
}
|
||||
57
ext/admin/reports/reportClasses/ReportBuilder.php
Normal file
57
ext/admin/reports/reportClasses/ReportBuilder.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
if(!interface_exists('ReportBuilderInterface')){
|
||||
include_once MODULE_PATH.'/reportClasses/ReportBuilderInterface.php';
|
||||
}
|
||||
abstract class ReportBuilder implements ReportBuilderInterface{
|
||||
|
||||
public function getData($report,$request){
|
||||
$query = $this->getMainQuery();
|
||||
$where = $this->getWhereQuery($request);
|
||||
$query.=" ".$where[0];
|
||||
return $this->execute($report, $query, $where[1]);
|
||||
}
|
||||
|
||||
protected function execute($report, $query, $parameters){
|
||||
$report->DB()->SetFetchMode(ADODB_FETCH_ASSOC);
|
||||
LogManager::getInstance()->debug("Query: ".$query);
|
||||
LogManager::getInstance()->debug("Parameters: ".json_encode($parameters));
|
||||
$rs = $report->DB()->Execute($query,$parameters);
|
||||
if(!$rs){
|
||||
LogManager::getInstance()->info($report->DB()->ErrorMsg());
|
||||
return array("ERROR","Error generating report");
|
||||
}
|
||||
|
||||
$reportNamesFilled = false;
|
||||
$columnNames = array();
|
||||
$reportData = array();
|
||||
foreach ($rs as $rowId => $row) {
|
||||
$reportData[] = array();
|
||||
if(!$reportNamesFilled){
|
||||
$countIt = 0;
|
||||
foreach ($row as $name=> $value){
|
||||
$countIt++;
|
||||
$columnNames[$countIt] = $name;
|
||||
$reportData[count($reportData)-1][] = $value;
|
||||
}
|
||||
$reportNamesFilled = true;
|
||||
}else{
|
||||
foreach ($row as $name=> $value){
|
||||
$reportData[count($reportData)-1][] = $this->transformData($name, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
array_unshift($reportData,$columnNames);
|
||||
|
||||
return $reportData;
|
||||
}
|
||||
|
||||
abstract public function getWhereQuery($request);
|
||||
|
||||
abstract public function getMainQuery();
|
||||
|
||||
public function transformData($name, $value){
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
interface ReportBuilderInterface{
|
||||
public function getData($report,$request);
|
||||
}
|
||||
34
ext/admin/reports/reportClasses/TerminatedEmployeeReport.php
Normal file
34
ext/admin/reports/reportClasses/TerminatedEmployeeReport.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
if(!class_exists('ActiveEmployeeReport')){
|
||||
include_once MODULE_PATH.'/reportClasses/ActiveEmployeeReport.php';
|
||||
}
|
||||
class TerminatedEmployeeReport extends ActiveEmployeeReport{
|
||||
|
||||
|
||||
public function getWhereQuery($request){
|
||||
$query = "where ";
|
||||
$params = array();
|
||||
if(!empty($request['department']) && $request['department'] != "NULL"){
|
||||
$depts = $this->getChildCompanyStuctures($request['department']);
|
||||
$query.="department in(".implode(",",$depts).") and ";
|
||||
}
|
||||
|
||||
if(empty($request['date_start']) || $request['date_start'] == "NULL"){
|
||||
$request['date_start'] = date("Y-m-d 00:00:00");
|
||||
}
|
||||
|
||||
if(empty($request['date_end']) || $request['date_end'] == "NULL"){
|
||||
$request['date_end'] = date("Y-m-d 23:59:59");
|
||||
}
|
||||
|
||||
$query.="termination_date >= ? ";
|
||||
$params[] = $request['date_start']." 00:00:00";
|
||||
|
||||
|
||||
|
||||
$query.="and termination_date <= ? ";
|
||||
$params[] = $request['date_end']." 23:59:59";
|
||||
|
||||
return array($query, $params);
|
||||
}
|
||||
}
|
||||
18
ext/admin/reports/scripts/reports.sql
Normal file
18
ext/admin/reports/scripts/reports.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
INSERT INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`) VALUES
|
||||
('Active Employee Report', 'This report list employees who are currently active based on joined date and termination date ',
|
||||
'[\r\n[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true}]\r\n]',
|
||||
'ActiveEmployeeReport',
|
||||
'["department"]', 'Class');
|
||||
|
||||
|
||||
INSERT INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`) VALUES
|
||||
('New Hires Employee Report', 'This report list employees who are joined between given two dates ',
|
||||
'[[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}]\r\n]',
|
||||
'NewHiresEmployeeReport',
|
||||
'["department","date_start","date_end"]', 'Class');
|
||||
|
||||
INSERT INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`) VALUES
|
||||
('Terminated Employee Report', 'This report list employees who are terminated between given two dates ',
|
||||
'[[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}]\r\n]',
|
||||
'TerminatedEmployeeReport',
|
||||
'["department","date_start","date_end"]', 'Class');
|
||||
6
ext/admin/reports/templates/fields/label.html
Normal file
6
ext/admin/reports/templates/fields/label.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="control-group" id="field__id_">
|
||||
<div class="controls">
|
||||
<label id="_id_" name="_id_" style="font-weight:bold"></label>
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
||||
14
ext/admin/reports/templates/form_template.html
Normal file
14
ext/admin/reports/templates/form_template.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<form class="form-horizontal" id="_id_">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<span class="label label-warning" id="_id__error" style="display:none;"></span>
|
||||
</div>
|
||||
</div>
|
||||
_fields_
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button onclick="try{modJs.save()}catch(e){};return false;" class="btn">Download</button>
|
||||
<button onclick="modJs.cancel();return false;" class="btn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
23
ext/admin/settings/api/SettingsAdminManager.php
Normal file
23
ext/admin/settings/api/SettingsAdminManager.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
if (!class_exists('SettingsAdminManager')) {
|
||||
class SettingsAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
//This is a fixed module, store model classes in models.inc.php
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
39
ext/admin/settings/api/SettingsInitialize.php
Normal file
39
ext/admin/settings/api/SettingsInitialize.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
class SettingsInitialize extends AbstractInitialize{
|
||||
|
||||
public function init(){
|
||||
if(SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1"){
|
||||
$user = BaseService::getInstance()->getCurrentUser();
|
||||
$dbUser = new User();
|
||||
$dbUser->Load("id = ?",array($user->id));
|
||||
$resp = RestApiManager::getInstance()->getAccessTokenForUser($dbUser);
|
||||
if($resp->getStatus() != IceResponse::SUCCESS){
|
||||
LogManager::getInstance()->error("Error occured while creating REST Api acces token for ".$user->username);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
55
ext/admin/settings/index.php
Normal file
55
ext/admin/settings/index.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'settings';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><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="tabSetting" href="#tabPageSetting">Settings</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageSetting">
|
||||
<div id="Setting" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="SettingForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabSetting'] = new SettingAdapter('Setting','Setting','','name');
|
||||
modJsList['tabSetting'].setShowAddNew(false);
|
||||
|
||||
var modJs = modJsList['tabSetting'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
67
ext/admin/settings/lib.js
Normal file
67
ext/admin/settings/lib.js
Normal file
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* SettingAdapter
|
||||
*/
|
||||
|
||||
function SettingAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
SettingAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
SettingAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"value",
|
||||
"description"
|
||||
];
|
||||
});
|
||||
|
||||
SettingAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Value"},
|
||||
{ "sTitle": "Details"}
|
||||
];
|
||||
});
|
||||
|
||||
SettingAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "value", {"label":"Value","type":"text","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
SettingAdapter.method('getActionButtonsHtml', function(id,data) {
|
||||
var html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img></div>';
|
||||
html = html.replace(/_id_/g,id);
|
||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
||||
return html;
|
||||
});
|
||||
|
||||
|
||||
SettingAdapter.method('getMetaFieldForRendering', function(fieldName) {
|
||||
if(fieldName == "value"){
|
||||
return "meta";
|
||||
}
|
||||
return "";
|
||||
});
|
||||
|
||||
|
||||
SettingAdapter.method('fillForm', function(object) {
|
||||
this.uber('fillForm',object);
|
||||
$("#helptext").html(object.description);
|
||||
});
|
||||
|
||||
|
||||
SettingAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=126';
|
||||
});
|
||||
11
ext/admin/settings/meta.json
Normal file
11
ext/admin/settings/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Settings",
|
||||
"menu":"System",
|
||||
"order":"1",
|
||||
"icon":"fa-cogs",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
16
ext/admin/settings/templates/form_template.html
Normal file
16
ext/admin/settings/templates/form_template.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<form class="form-horizontal" id="_id_">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<span class="label label-warning" id="_id__error" style="display:none;"></span>
|
||||
</div>
|
||||
</div>
|
||||
_fields_
|
||||
<div class="control-group" id="helptext" style="padding-left:20%;">
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button onclick="try{modJs.save()}catch(e){};return false;" class="btn">Save</button>
|
||||
<button onclick="modJs.cancel();return false;" class="btn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
100
ext/admin/users/api/UsersActionManager.php
Normal file
100
ext/admin/users/api/UsersActionManager.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
class UsersActionManager extends SubActionManager{
|
||||
public function changePassword($req){
|
||||
if($this->user->user_level == 'Admin' || $this->user->id == $req->id){
|
||||
$user = $this->baseService->getElement('User',$req->id);
|
||||
if(empty($user->id)){
|
||||
return new IceResponse(IceResponse::ERROR,"Please save the user first");
|
||||
}
|
||||
$user->password = md5($req->pwd);
|
||||
$ok = $user->Save();
|
||||
if(!$ok){
|
||||
return new IceResponse(IceResponse::ERROR,$user->ErrorMsg());
|
||||
}
|
||||
return new IceResponse(IceResponse::SUCCESS,$user);
|
||||
}
|
||||
return new IceResponse(IceResponse::ERROR);
|
||||
}
|
||||
|
||||
public function saveUser($req){
|
||||
if($this->user->user_level == 'Admin'){
|
||||
|
||||
$user = new User();
|
||||
$user->Load("email = ?",array($req->email));
|
||||
|
||||
if($user->email == $req->email){
|
||||
return new IceResponse(IceResponse::ERROR,"User with same email already exists");
|
||||
}
|
||||
|
||||
$user->Load("username = ?",array($req->username));
|
||||
|
||||
if($user->username == $req->username){
|
||||
return new IceResponse(IceResponse::ERROR,"User with same username already exists");
|
||||
}
|
||||
|
||||
$user = new User();
|
||||
$user->email = $req->email;
|
||||
$user->username = $req->username;
|
||||
$password = $this->generateRandomString(6);
|
||||
$user->password = md5($password);
|
||||
$user->employee = (empty($req->employee) || $req->employee == "NULL" )?NULL:$req->employee;
|
||||
$user->user_level = $req->user_level;
|
||||
$user->last_login = date("Y-m-d H:i:s");
|
||||
$user->last_update = date("Y-m-d H:i:s");
|
||||
$user->created = date("Y-m-d H:i:s");
|
||||
|
||||
$employee = null;
|
||||
if(!empty($user->employee)){
|
||||
$employee = $this->baseService->getElement('Employee',$user->employee,null,true);
|
||||
}
|
||||
|
||||
$ok = $user->Save();
|
||||
if(!$ok){
|
||||
LogManager::getInstance()->info($user->ErrorMsg()."|".json_encode($user));
|
||||
return new IceResponse(IceResponse::ERROR,"Error occured while saving the user");
|
||||
}
|
||||
$user->password = "";
|
||||
$user = $this->baseService->cleanUpAdoDB($user);
|
||||
|
||||
if(!empty($this->emailSender)){
|
||||
$usersEmailSender = new UsersEmailSender($this->emailSender, $this);
|
||||
$usersEmailSender->sendWelcomeUserEmail($user, $password, $employee);
|
||||
}
|
||||
return new IceResponse(IceResponse::SUCCESS,$user);
|
||||
}
|
||||
return new IceResponse(IceResponse::ERROR, "Not Allowed");
|
||||
}
|
||||
|
||||
|
||||
private function generateRandomString($length = 10) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
}
|
||||
56
ext/admin/users/api/UsersAdminManager.php
Normal file
56
ext/admin/users/api/UsersAdminManager.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
if (!class_exists('UsersAdminManager')) {
|
||||
class UsersAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
$this->addModelClass('User');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('User')) {
|
||||
class User extends ICEHRM_Record {
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
public function validateSave($obj){
|
||||
$userTemp = new User();
|
||||
|
||||
if(empty($obj->id)){
|
||||
$users = $userTemp->Find("email = ?",array($obj->email));
|
||||
if(count($users) > 0){
|
||||
return new IceResponse(IceResponse::ERROR,"A user with same authentication email already exist");
|
||||
}
|
||||
}else{
|
||||
$users = $userTemp->Find("email = ? and id <> ?",array($obj->email, $obj->id));
|
||||
if(count($users) > 0){
|
||||
return new IceResponse(IceResponse::ERROR,"A user with same authentication email already exist");
|
||||
}
|
||||
}
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS,"");
|
||||
}
|
||||
|
||||
var $_table = 'Users';
|
||||
}
|
||||
}
|
||||
46
ext/admin/users/api/UsersEmailSender.php
Normal file
46
ext/admin/users/api/UsersEmailSender.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
class UsersEmailSender{
|
||||
|
||||
var $emailSender = null;
|
||||
var $subActionManager = null;
|
||||
|
||||
public function __construct($emailSender, $subActionManager){
|
||||
$this->emailSender = $emailSender;
|
||||
$this->subActionManager = $subActionManager;
|
||||
}
|
||||
|
||||
public function sendWelcomeUserEmail($user, $password, $employee = NULL){
|
||||
|
||||
$params = array();
|
||||
if(!empty($employee)){
|
||||
$params['name'] = $employee->first_name." ".$employee->last_name;
|
||||
}else{
|
||||
$params['name'] = $user->username;
|
||||
}
|
||||
$params['url'] = CLIENT_BASE_URL;
|
||||
$params['password'] = $password;
|
||||
$params['email'] = $user->email;
|
||||
$params['username'] = $user->username;
|
||||
|
||||
$email = $this->subActionManager->getEmailTemplate('welcomeUser.html');
|
||||
|
||||
|
||||
$emailTo = null;
|
||||
if(!empty($user)){
|
||||
$emailTo = $user->email;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!empty($emailTo)){
|
||||
if(!empty($this->emailSender)){
|
||||
LogManager::getInstance()->info("[sendWelcomeUserEmail] sending email to $emailTo : ".$email);
|
||||
$this->emailSender->sendEmail("Your IceHrm account is ready",$emailTo,$email,$params);
|
||||
}
|
||||
}else{
|
||||
LogManager::getInstance()->info("[sendWelcomeUserEmail] email is empty");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
17
ext/admin/users/emailTemplates/welcomeUser.html
Normal file
17
ext/admin/users/emailTemplates/welcomeUser.html
Normal file
@@ -0,0 +1,17 @@
|
||||
Dear #_name_#,<br/><br/>
|
||||
Your account in <b>IceHrm</b> has been created on <a href="#_url_#">#_url_#</a><br/><br/>
|
||||
|
||||
<b>Please find your account information below:</b><br/><br/>
|
||||
Username: <b>#_username_#</b><br/>
|
||||
Email: <b>#_email_#</b> (You can use, username or email to login)<br/>
|
||||
Password: <b>#_password_#</b> (Strongly advised to change this password once logged in)<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
To get started, follow this link: <b><a href="#_url_#">#_url_#</a></b><br/><br/>
|
||||
|
||||
<font face="Arial, sans-serif" size="1" color="#4a4a4a">
|
||||
THIS IS AN AUTOMATED EMAIL - REPLIES WILL BE SENT TO #_adminEmail_#
|
||||
</font>
|
||||
<br/>
|
||||
<br/>
|
||||
57
ext/admin/users/index.php
Normal file
57
ext/admin/users/index.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'users';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
|
||||
?><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="tabUser" href="#tabPageUser">Users</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageUser">
|
||||
<div id="User" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="UserForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
modJsList['tabUser'] = new UserAdapter('User');
|
||||
<?php if(isset($_REQUEST['action']) && $_REQUEST['action'] == "new" && isset($_REQUEST['object'])){?>
|
||||
modJsList['tabUser'].newInitObject = JSON.parse(Base64.decode('<?=$_REQUEST['object']?>'));
|
||||
<?php }?>
|
||||
|
||||
var modJs = modJsList['tabUser'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
162
ext/admin/users/lib.js
Normal file
162
ext/admin/users/lib.js
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
function UserAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
UserAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
UserAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"username",
|
||||
"email",
|
||||
"employee",
|
||||
"user_level"
|
||||
];
|
||||
});
|
||||
|
||||
UserAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" },
|
||||
{ "sTitle": "User Name" },
|
||||
{ "sTitle": "Authentication Email" },
|
||||
{ "sTitle": "Employee"},
|
||||
{ "sTitle": "User Level"}
|
||||
];
|
||||
});
|
||||
|
||||
UserAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden","validation":""}],
|
||||
[ "username", {"label":"User Name","type":"text","validation":"username"}],
|
||||
[ "email", {"label":"Email","type":"text","validation":"email"}],
|
||||
[ "employee", {"label":"Employee","type":"select2","allow-null":true,"remote-source":["Employee","id","first_name+last_name"]}],
|
||||
[ "user_level", {"label":"User Level","type":"select","source":[["Admin","Admin"],["Manager","Manager"],["Employee","Employee"]]}]
|
||||
];
|
||||
});
|
||||
|
||||
UserAdapter.method('postRenderForm', function(object, $tempDomObj) {
|
||||
if(object == null || object == undefined){
|
||||
$tempDomObj.find("#changePasswordBtn").remove();
|
||||
}
|
||||
});
|
||||
|
||||
UserAdapter.method('changePassword', function() {
|
||||
$('#adminUsersModel').modal('show');
|
||||
$('#adminUsersChangePwd #newpwd').val('');
|
||||
$('#adminUsersChangePwd #conpwd').val('');
|
||||
});
|
||||
|
||||
UserAdapter.method('saveUserSuccessCallBack', function(callBackData,serverData) {
|
||||
this.showMessage("Create User","An email has been sent to "+callBackData['email']+" with a temporary password to login to IceHrm.");
|
||||
this.get([]);
|
||||
});
|
||||
|
||||
UserAdapter.method('saveUserFailCallBack', function(callBackData,serverData) {
|
||||
this.showMessage("Error",callBackData);
|
||||
});
|
||||
|
||||
UserAdapter.method('doCustomValidation', function(params) {
|
||||
var msg = null;
|
||||
if(params['user_level'] != "Admin" && params['employee'] == "NULL"){
|
||||
msg = "For non Admin users, you have to assign an employee when adding or editing the user.<br/>";
|
||||
msg += " You may create a new employee through 'Admin'->'Employees' menu";
|
||||
}
|
||||
return msg;
|
||||
});
|
||||
|
||||
UserAdapter.method('save', function() {
|
||||
var validator = new FormValidation(this.getTableName()+"_submit",true,{'ShowPopup':false,"LabelErrorClass":"error"});
|
||||
if(validator.checkValues()){
|
||||
var params = validator.getFormParameters();
|
||||
|
||||
var msg = this.doCustomValidation(params);
|
||||
if(msg == null){
|
||||
var id = $('#'+this.getTableName()+"_submit #id").val();
|
||||
if(id != null && id != undefined && id != ""){
|
||||
$(params).attr('id',id);
|
||||
this.add(params,[]);
|
||||
}else{
|
||||
|
||||
var reqJson = JSON.stringify(params);
|
||||
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'saveUserSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'saveUserFailCallBack';
|
||||
|
||||
this.customAction('saveUser','admin=users',reqJson,callBackData);
|
||||
}
|
||||
|
||||
}else{
|
||||
//$("#"+this.getTableName()+'Form .label').html(msg);
|
||||
//$("#"+this.getTableName()+'Form .label').show();
|
||||
this.showMessage("Error Saving User",msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
UserAdapter.method('changePasswordConfirm', function() {
|
||||
$('#adminUsersChangePwd_error').hide();
|
||||
|
||||
var passwordValidation = function (str) {
|
||||
var val = /^[a-zA-Z0-9]\w{6,}$/;
|
||||
return str != null && val.test(str);
|
||||
};
|
||||
|
||||
var password = $('#adminUsersChangePwd #newpwd').val();
|
||||
|
||||
if(!passwordValidation(password)){
|
||||
$('#adminUsersChangePwd_error').html("Password may contain only letters, numbers and should be longer than 6 characters");
|
||||
$('#adminUsersChangePwd_error').show();
|
||||
return;
|
||||
}
|
||||
|
||||
var conPassword = $('#adminUsersChangePwd #conpwd').val();
|
||||
|
||||
if(conPassword != password){
|
||||
$('#adminUsersChangePwd_error').html("Passwords don't match");
|
||||
$('#adminUsersChangePwd_error').show();
|
||||
return;
|
||||
}
|
||||
|
||||
var req = {"id":this.currentId,"pwd":conPassword};
|
||||
var reqJson = JSON.stringify(req);
|
||||
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'changePasswordSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'changePasswordFailCallBack';
|
||||
|
||||
this.customAction('changePassword','admin=users',reqJson,callBackData);
|
||||
|
||||
});
|
||||
|
||||
UserAdapter.method('closeChangePassword', function() {
|
||||
$('#adminUsersModel').modal('hide');
|
||||
});
|
||||
|
||||
UserAdapter.method('changePasswordSuccessCallBack', function(callBackData,serverData) {
|
||||
this.closeChangePassword();
|
||||
this.showMessage("Password Change","Password changed successfully");
|
||||
});
|
||||
|
||||
UserAdapter.method('changePasswordFailCallBack', function(callBackData,serverData) {
|
||||
this.closeChangePassword();
|
||||
this.showMessage("Error",callBackData);
|
||||
});
|
||||
|
||||
UserAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=132';
|
||||
});
|
||||
|
||||
|
||||
|
||||
11
ext/admin/users/meta.json
Normal file
11
ext/admin/users/meta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"label":"Users",
|
||||
"menu":"System",
|
||||
"order":"2",
|
||||
"icon":"fa-user",
|
||||
"user_levels":["Admin"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
}
|
||||
55
ext/admin/users/templates/form_template.html
Normal file
55
ext/admin/users/templates/form_template.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<form class="form-horizontal" id="_id_">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<span class="label label-warning" id="_id__error" style="display:none;"></span>
|
||||
</div>
|
||||
</div>
|
||||
_fields_
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button onclick="try{modJs.save()}catch(e){};return false;" class="btn">Save</button>
|
||||
<button onclick="modJs.cancel();return false;" class="btn">Cancel</button>
|
||||
<button id="changePasswordBtn" onclick="modJs.changePassword();return false;" class="btn btn-primary">Change Password</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<div class="modal" id="adminUsersModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
|
||||
<h3 style="font-size: 17px;">Change User Password</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="adminUsersChangePwd">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<span class="label label-warning" id="adminUsersChangePwd_error" style="display:none;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" id="field_newpwd">
|
||||
<label class="control-label" for="newpwd">New Password</label>
|
||||
<div class="controls">
|
||||
<input class="" type="password" id="newpwd" name="newpwd" value="" class="form-control"/>
|
||||
<span class="help-inline" id="help_newpwd"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" id="field_conpwd">
|
||||
<label class="control-label" for="conpwd">Confirm Password</label>
|
||||
<div class="controls">
|
||||
<input class="" type="password" id="conpwd" name="conpwd" value="" class="form-control"/>
|
||||
<span class="help-inline" id="help_conpwd"></span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" onclick="modJs.changePasswordConfirm();">Change Password</button>
|
||||
<button class="btn" onclick="modJs.closeChangePassword();">Not Now</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user